SDWebImage / SDWebImageAVIFCoder

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

avifDecoderNextImage interface take a lot time #44

Open ghost opened 1 year ago

ghost commented 1 year ago
截屏2022-11-01 16 53 49

Unit of time milliseconds iphone x: avifDecoderNextImage: 397.489014--SDCreateCGImageFromAVIF: 1.329102 iphone 11 pro max: avifDecoderNextImage: 279.439941--SDCreateCGImageFromAVIF: 1.563965

dreampiggy commented 1 year ago

This avifDecoderNextImage seems used for AVIF animated image (really rare but supported).

I think this need more information to test and increase performance. May need libavif's upstream help :)

dreampiggy commented 1 year ago

Known issue for animated AVIF. But we have no better way to avoid this.

A possible way is like using the internal API of AOM like https://github.com/SDWebImage/SDWebImageWebPCoder

Which calculate a latest reusable frame index and canvas without re-scan, but it's complicated and I have no free time to complete.

dreampiggy commented 11 months ago

You can have a try by different AVIF codec (for decoding)

From v0.11.0, we support using SDImageCoderAVIFDecodeCodecChoice to chooce codec at runtime. You can install all 4 AVIF decoding codec and compare them one by one