Skip to content
gen2brainPublic

About

AV1 video and AVIF image decoder and encoder in pure Go

Topics

Resources

Stars

11 stars

Watchers

1 watching

Forks

Latest commit

 

History

237 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gav1d

Status Go Reference

AV1 video and AVIF image decoder and encoder in pure Go.

A port of dav1d, bit-exact against it. 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 := avif.Decode(r)

avif.Decode returns *image.NRGBA, or *image.NRGBA64 above 8 bits, and registers itself with image.RegisterFormat. The av1 package decodes the bitstream on its own, a temporal unit at a time:

d := av1.Decoder{}

for _, tu := range temporalUnits {
    pics, err := d.DecodeOBUs(tu)
    ...
}

Or from an IVF, section 5 or Annex B stream:

r, err := av1.NewReader(f)

for {
    pic, pts, err := r.Next()
    ...
}

Encoding

err := avif.Encode(w, img, avif.EncodeOptions{Quality: 70, Speed: 6})

The encoder is all-intra and 8-bit, at 4:2:0 or grayscale, with alpha carried as a second item. Speed trades search effort for encoding time.

Supported

8/10/12-bit, 4:2:0/4:2:2/4:4:4/monochrome, film grain, scalable streams, and in the container alpha, grid, clap/irot/imir, colr, image sequences, Exif and XMP, and gain maps.

License

The decoder is a port of dav1d; the encoder's forward transform is a port of libaom. Both are BSD-2-Clause, and both notices are in COPYING.

This project is an implementation of a codec. It gives you no special rights on the AV1 patents. Please read the AV1 patent license that applies to the AV1 specification and codec.

About

AV1 video and AVIF image decoder and encoder in pure Go

Topics

Resources

Stars

11 stars

Watchers

1 watching

Forks

Releases

Contributors

Languages