Skip to content

Misc AVIF fixes/improvements - #60

Merged
bep merged 3 commits into
mainfrom
feat/miscavif
Feb 22, 2026
Merged

Misc AVIF fixes/improvements#60
bep merged 3 commits into
mainfrom
feat/miscavif

Conversation

@bep

@bep bep commented Feb 22, 2026

Copy link
Copy Markdown
Owner
  • Misc
  • Fix AVIF decoding iloc/iinf ordering issue
  • Speed up AVIF and TIFF decoding when only config source is requested

@codecov-commenter

codecov-commenter commented Feb 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.10526% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.25%. Comparing base (0985245) to head (368fcfc).

Files with missing lines Patch % Lines
imagedecoder_webp.go 71.42% 0 Missing and 2 partials ⚠️
imagedecoder_heif.go 96.55% 0 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

bep added 2 commits February 22, 2026 20:37
```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%
````

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/iinf box ordering sensitivity by collecting iloc entries 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/iloc parsing 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.

@bep
bep merged commit 69db29f into main Feb 22, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants