SDWebImage / SDWebImageAVIFCoder

A SDWebImage coder plugin to support AVIF(AV1 Image File Format) image
MIT License
55 stars 14 forks source link

Support libavif 0.8.2+ #29

Closed dreampiggy closed 3 years ago

dreampiggy commented 3 years ago

During past one year, the AVIF community has grown fastly.

The libavif and libdav1/libaom/libgav1 has released many versions.

This App-level codec framework need to upgrade to match the latest codec API changes.

This PR support the latest libavif v0.9.2 (I choose >= 0.8.2 for min dependency). Test and works well.

Note: The biggest API changes is https://github.com/AOMediaCodec/libavif/commit/1d32f88ab33e04b74f4e978bf30f0184d3a96011. Which remove the avifPrepareReformatState. However, our ColorProfile transform need this. So just copy the implementation.

dreampiggy commented 3 years ago

The test sample image kimono.crop.avif seems has invalid crop box ? The image size is 722x1024, but the crop box is (x = 38245056, y = 24576, width = 1, height = 56)

image

Not sure if this is issue. I'll use libgav1 or libdav1d testing again.

dreampiggy commented 3 years ago

Seems there are one AVIF_STRICT_CLAP_VALID option...

We need:

decoder->strictFlags = AVIF_STRICT_DISABLED;

However, this API is only available in v0.9.1.

I decide to release two version, one patch version 0.8.1 (supports libavif v0.8.2~0.9.0), one minor version 0.9.0 (supports libavif 0.9.1+)