Misc AVIF fixes/improvements - #60
Merged
Merged
Conversation
bep
commented
Feb 22, 2026
Owner
- Misc
- Fix AVIF decoding iloc/iinf ordering issue
- Speed up AVIF and TIFF decoding when only config source is requested
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #60 +/- ##
==========================================
+ Coverage 78.19% 78.25% +0.05%
==========================================
Files 15 15
Lines 1885 1890 +5
==========================================
+ Hits 1474 1479 +5
Misses 279 279
Partials 132 132 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
```bash
│ sec/op │ sec/op vs base │
Decode/config/png-10 3.651µ ± 2% 3.624µ ± 2% -0.74% (p=0.037 n=6)
Decode/config/webp-10 3.572µ ± 0% 3.563µ ± 2% ~ (p=0.331 n=6)
Decode/config/jpg-10 13.77µ ± 0% 13.76µ ± 0% ~ (p=0.485 n=6)
Decode/config/tiff-10 69.360µ ± 0% 8.317µ ± 0% -88.01% (p=0.002 n=6)
Decode/config/avif-10 60.22µ ± 1% 36.84µ ± 2% -38.83% (p=0.002 n=6)
geomean 14.96µ 8.855µ -40.82%
│ stash.bench │ feat-miscavif.bench │
│ B/op │ B/op vs base │
Decode/config/png-10 352.0 ± 0% 352.0 ± 0% ~ (p=1.000 n=6) ¹
Decode/config/webp-10 368.0 ± 0% 368.0 ± 0% ~ (p=1.000 n=6) ¹
Decode/config/jpg-10 352.0 ± 0% 352.0 ± 0% ~ (p=1.000 n=6) ¹
Decode/config/tiff-10 836.0 ± 0% 356.0 ± 0% -57.42% (p=0.002 n=6)
Decode/config/avif-10 496.0 ± 0% 472.0 ± 0% -4.84% (p=0.002 n=6)
geomean 452.2 377.5 -16.53%
¹ all samples are equal
│ stash.bench │ feat-miscavif.bench │
│ allocs/op │ allocs/op vs base │
Decode/config/png-10 8.000 ± 0% 8.000 ± 0% ~ (p=1.000 n=6) ¹
Decode/config/webp-10 9.000 ± 0% 9.000 ± 0% ~ (p=1.000 n=6) ¹
Decode/config/jpg-10 8.000 ± 0% 8.000 ± 0% ~ (p=1.000 n=6) ¹
Decode/config/tiff-10 13.000 ± 0% 9.000 ± 0% -30.77% (p=0.002 n=6)
Decode/config/avif-10 29.00 ± 0% 23.00 ± 0% -20.69% (p=0.002 n=6)
geomean 11.68 10.36 -11.30%
````
There was a problem hiding this comment.
Pull request overview
This PR improves AVIF/HEIF metadata decoding robustness and speeds up config-only decoding paths, adding new AVIF fixtures to cover the ordering edge case.
Changes:
- Fix HEIF/AVIF
iloc/iinfbox ordering sensitivity by collectingilocentries keyed by item ID and resolving after the full meta scan. - Speed up config-only decoding for TIFF (early-return after reading dimensions) and for AVIF/HEIF (skip
iinf/ilocparsing when EXIF/XMP isn’t requested). - Add AVIF test images plus EXIFTool “golden” JSON/config outputs, and add a focused AVIF decode test + benchmarks for config-only paths.
Reviewed changes
Copilot reviewed 8 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| testdata/images/bep/sunset.avif | New AVIF fixture used to validate EXIF/XMP extraction (and ordering edge case). |
| testdata/images/bep/sunrise.avif | New AVIF fixture used for benchmarks and golden comparisons. |
| imagemeta_test.go | Adds TestDecodeAVIF, enables .avif in getSunrise, and adds config/* benchmark cases + AVIF benchmarks. |
| imagedecoder_webp.go | Refactors WebP FourCC constants into a grouped webpFCC struct (no logic change). |
| imagedecoder_tif.go | Returns early when Sources == CONFIG after reading TIFF dimensions. |
| imagedecoder_heif.go | Makes EXIF/XMP extraction independent of iloc/iinf ordering; skips EXIF/XMP parsing work when not needed; refactors FourCC constants into heifFCC. |
| gen/testdata_exiftool/images/bep/sunset.avif.json | Adds EXIFTool golden output for sunset.avif. |
| gen/testdata_exiftool/images/bep/sunset.avif.config.json | Adds golden {width,height} for sunset.avif. |
| gen/testdata_exiftool/images/bep/sunrise.avif.json | Adds EXIFTool golden output for sunrise.avif. |
| gen/testdata_exiftool/images/bep/sunrise.avif.config.json | Adds golden {width,height} for sunrise.avif. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.