feat(avif)!: AVIF decode via gamut-avif container + hardware AV1; drop the image crate - #54
Merged
Merged
Conversation
…p the image crate AVIF decode is rebuilt as gamut-avif container parsing plus AV1 still decode through rawshift-hwdec, replacing the image crate's avif-native path. A new AvifFile mirrors the HEIC split: container, item, thumbnail, alpha/depth auxiliary, EXIF/XMP/ICC, and bit-depth enumeration are fully backend-less; pixel decode routes through an HwAv1Adapter implementing gamut-avif's Av1StillDecoder over the hwdec handoff shape (av1C config bytes + raw OBU payload; the av1C re-serializer round-trips against gamut's parser). With no backend, decode returns HwDecoderUnavailable; avif_hw_decode_available() reports the state. Shared plane-lifting moved to formats/hw_planes.rs, deduplicating the HEIC copies. The image dependency is deleted outright — its whole subtree (dav1d, dav1d-sys, av-data, ...) leaves the lockfile, and CI drops libdav1d-dev. DecodeOptions::AvifImage -> Avif; codec id avif/gamut; new avif_inspect example; MetadataNamespace::Avif carries container facts. Runtime-verified on real hardware (RX 7900 XT, VAAPI AV1 Profile 0): 8-bit 4:2:0 decodes bit-exact end-to-end (avifenc lossless fixture, expected values computed via gamut-color), 2x1 grids assemble bit-exact from hardware-decoded tiles, alpha auxiliaries enumerate and merge, and avifenc-authored EXIF/XMP items read backend-less. 10-bit decodes to P010 at the hwdec layer and gates on the upstream >8-bit presentation surface (gamut#303) with the exact error asserted. Honest scope finding: rawshift's own lossless encoder emits identity 4:4:4 AV1 Profile 1, which no current hardware still-decode profile covers — the tests assert the precise scope error and adapt if a Profile-1-capable backend appears. Software AV1 fallback remains post-v1 (gamut#259); AVIF decode is hardware-only like HEIC, documented in the README. BREAKING CHANGE: AVIF decode config/variant renames; the image-crate decode path and its software decode capability are gone — AVIF pixel decode now requires a hardware backend.
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.
Closes #33. This is the last codec migration in epic #38 — every format issue is now delivered or blocked on a filed upstream gate.
Stacked on #53; merge order #42 → … → #53 → this.
What is Delivered
AvifFilemirroring the HEIC split: container/item/thumbnail/alpha/depth-auxiliary/EXIF/XMP/ICC/bit-depth enumeration fully backend-less; pixel decode viaHwAv1Adapterimplementing gamut-avif'sAv1StillDecoderover the exact hwdec handoff shape (av1C + OBU payload; re-serializer round-trip-tested).avif_hw_decode_available();HwDecoderUnavailablewithout a backend. Shared plane-lifting extracted toformats/hw_planes.rs(HEIC deduplicated).imagecrate deleted outright — dav1d/dav1d-sys/av-data subtree leaves the lockfile; CI dropslibdav1d-dev.DecodeOptions::Avif; codec idavif/gamut; newavif_inspectexample.Verification Done — on real hardware
RX 7900 XT, VAAPI AV1 Profile 0. Run independently after implementation:
avif_8bit_420_hw_decodes_bit_exact_end_to_end— avifenc lossless fixture decodes bit-exact (expected values computed via gamut-color), also throughdecode_standard_image.avif_grid_hw_decodes_bit_exact— 2×1 grid assembles bit-exact from two hardware-decoded tiles.avif_alpha_auxiliary_hw_decodes— alpha enumerated, merged, and decoded standalone.avif_10bit_hw_decode_gates_on_upstream_presentation— P010 hardware decode succeeds; the >8-bit RGBA presentation gate is asserted with the exact gamut#303 error (referenced, not shimmed).avif_exif_xmp_items_read_backend_less— avifenc-authored items read with no decoder.Counts:
cargo test --workspace387/0;--features full563/0 (all 6 AVIF hw e2e tests RAN on this host);--features serde360/0; clippy workspace + full-D warnings0+0; standalone buildsavif/avif-decode/avif-decode,hw/avif-encode/heic,hwall clean;imageand dav1d absent from the lockfile. lefthook green.Software AV1 fallback remains post-v1 (gamut#259); AVIF decode is hardware-only like HEIC, documented in the README.