h265

HEVC video and
HEIC image decoder in pure Go.
Byte-exact on the JCT-VC HEVC v1 conformance suite. No CGo, no dependencies.
SIMD support for amd64 (AVX2, AVX-512), arm64 (NEON) and riscv64 (RVV, with GORISCV64=rva23u64).
Build with -tags noasm for pure Go everywhere.
Decoding
img, err := heic.Decode(r)
heic.Decode returns *image.NRGBA, or *image.NRGBA64 above 8 bits, and registers itself with
image.RegisterFormat. The hevc package decodes the bitstream on its own, a NAL unit at a time:
d := hevc.Decoder{}
for _, nal := range nals {
pics, err := d.DecodeNAL(nal)
...
}
Supported
8-16 bit, 4:2:0/4:2:2/4:4:4/monochrome, tiles, wavefronts, dependent slice segments, PCM, lossless,
scaling lists, and the range extensions other than cross-component prediction, RDPCM and CABAC bypass
alignment, which are refused rather than decoded wrongly. In the container alpha, grid,
clap/irot/imir, colr, image sequences, Exif and XMP.
Decoding is threaded over grid tiles and wavefront rows; heic.Options.Threads and
hevc.Decoder.Threads bound it.
License
MIT, in LICENSE. The decoder is a port of the pure-Rust
rust_h265 and
oxideav-h265 decoders and carries their notices.
This project is an implementation of a decoder. It gives you no special rights on the HEVC patents.
HEVC is covered by patents held by several pools and by unpooled holders; if you distribute or use
this software you may need a licence from them.