diff --git a/HEIF_IMPLEMENTATION_PLAN.md b/HEIF_IMPLEMENTATION_PLAN.md index fe8c19285c..0066a0c2ab 100644 --- a/HEIF_IMPLEMENTATION_PLAN.md +++ b/HEIF_IMPLEMENTATION_PLAN.md @@ -29,7 +29,7 @@ Checkboxes may be marked complete only when the implementation and the verificat ## Delivery dashboard -Last reconciled with the source tree on 2026-08-30 against production checkpoint `97538abd2`. Committed checkpoints include the AV1 transform architecture, OBU framing, tile partitioning, mode information, segmentation, delta quantization, transform-size selection, coefficient decoding, inverse quantization, inverse transforms, complete intra prediction, intra-block copy, official extreme-displacement intra-block-copy conformance, the 12-profile reconstruction matrix, corrected twelve-bit inverse-transform SIMD arithmetic, layered-item properties, layered reference/header/CDF/motion-field state, inter-frame intra blocks, SIMD-first translational prediction, complete single-reference inter reconstruction, compound reference trees and modes, paired reference-MV derivation, reference-dependent bounded sequence decoding, allocation-free SIMD-first equal averaging, selected inter-intra prediction, selectable compound blending, OBMC, scaled-reference reconstruction, local warped prediction, non-translational global prediction, official motion-vector conformance, official spatial- and temporal-layer default-operating-point conformance, official active-film-grain and monochrome sequence conformance, selected spatial-layer presentation, progressive color and auxiliary-alpha conformance, pinned-HM HEVC CABAC verification, pinned-HM HEVC coding-tree traversal verification, official HEVC intra-prediction verification, and official HEVC residual-reconstruction verification. This dashboard is the authoritative delivery order. The detailed phase checklists below provide subsystem evidence; they do not override the current-stage marker or permit work to skip ahead. +Last reconciled with the source tree on 2026-08-30 against production checkpoint `fcd16c862`. Committed checkpoints include the AV1 transform architecture, OBU framing, tile partitioning, mode information, segmentation, delta quantization, transform-size selection, coefficient decoding, inverse quantization, inverse transforms, complete intra prediction, intra-block copy, official extreme-displacement intra-block-copy conformance, the 12-profile reconstruction matrix, corrected twelve-bit inverse-transform SIMD arithmetic, layered-item properties, layered reference/header/CDF/motion-field state, inter-frame intra blocks, SIMD-first translational prediction, complete single-reference inter reconstruction, compound reference trees and modes, paired reference-MV derivation, reference-dependent bounded sequence decoding, allocation-free SIMD-first equal averaging, selected inter-intra prediction, selectable compound blending, OBMC, scaled-reference reconstruction, local warped prediction, non-translational global prediction, official motion-vector conformance, official spatial- and temporal-layer default-operating-point conformance, official active-film-grain and monochrome sequence conformance, selected spatial-layer presentation, progressive color and auxiliary-alpha conformance, pinned-HM HEVC CABAC verification, pinned-HM HEVC coding-tree traversal verification, official HEVC intra-prediction verification, official HEVC residual-reconstruction verification, HEVC parallel slice decoding, and bounded HEVC supplemental presentation and metadata handling. This dashboard is the authoritative delivery order. The detailed phase checklists below provide subsystem evidence; they do not override the current-stage marker or permit work to skip ahead. Commit `a0d1b5af56acb3a3a9aebb29c916d1b36cd49367` restores the established JPEG color-converter operator architecture throughout the HEIF implementation. `Av1ForwardTransformer` owns its nested one-dimensional contract and all twelve concrete forward transform operators; `Av1Inverse2dTransformer` owns the corresponding inverse contract and operators; and `Av1InverseTransformer` owns the byte and high-bit-depth reconstruction-output operators. Each contract lives in the owner's `.Operator.cs`, while every semantic transform with a shared traversal has its own `.Operator.cs` partial-family file and implements concrete scalar and SIMD overload bodies without a forwarding semantic core. The same owner-and-partial-file rule now covers HEVC inverse transforms and intra prediction, AV1 and HEVC deblocking, AV1 CDEF, and HEVC transform-skip reconstruction. Vector-width and sample-storage adapters that are not semantic dispatch operators are named `Operations`; no operator type is named after a hardware width, no static contract uses CRTP, no source file groups multiple concrete semantic operator structs, and no semantic operator remains top-level. Roslynk reports zero compiler errors, both Release source targets build with zero warnings and errors, and 736 focused `net10.0` transform, loop-filter, prediction, reconstruction, transfer-function, and film-grain cases pass without failures or skips through the existing `FeatureTestRunner` coverage. All 56 new C# paths resolve to the existing `csharp` diff driver without an attributes change, and `git diff --check` is clean. @@ -41,6 +41,8 @@ Commit `9bc5b9842` closes the Phase 4 HEVC intra-prediction checkpoint without a Commit `97538abd29cb69df0ecf3e30a4ee3b40b586c070` closes the independently coded Phase 4 residual-reconstruction checkpoint. Five official HEVC v1 and Range Extensions pictures match the native Y, Cb, and Cr plane hashes produced by pinned HM commit `9c1f298659ab0cee9dc13d23d0304221575410b9`. The retained pictures cover coding-unit luma-QP deltas, scaling lists, transform skip, transform-skip contexts and rotation, implicit residual DPCM, extended-precision processing at 12-bit 4:4:4, coding-unit chroma-QP adjustment, and complete transform-and-quantization bypass. The `DELTAQP_A_BRCM_4` comparison exposed and corrected the PCM-neighbor invariant: PCM coding units skip intra-mode syntax but remain most-probable-mode neighbors, so the allocator-backed luma-mode map now starts at HM's required DC default. The five new exact-picture cases and all 169 focused HEVC decoder cases pass without failures or skips. Both Release source targets and the scoped Release test project build with zero warnings and errors, Roslynk reports zero compiler errors, the retained fixture hashes and existing LFS attributes match their recorded provenance without an attributes change, scoped whitespace verification is clean, and `git diff --check` is clean. Explicit inter residual-DPCM syntax remains unimplemented and is not claimed by this checkpoint. +Commit `fcd16c862c437e3249c7e693012c717512985163` closes the bounded HEVC supplemental-presentation checkpoint. The item parser now consumes prefix-SEI messages in access-unit order, supports extended payload types and sizes, skips unknown payloads, rejects misplaced prefix messages and malformed trailing bits, and maps pinned-HM display orientation, no-display, mastering-display color volume, content light level, alternative transfer characteristics, ambient viewing environment, and content color volume into the bounded ImageSharp result. Codec orientation is applied after item scaling and auxiliary-alpha composition but before container crop, rotation, and mirroring, so a real public HEIC with alpha matches its independent reference PNG at every final RGBA sample after the injected transform. Metadata conflicts and no-display fail at the item boundary, while optional video timing, persistence, and post-processing messages without an ImageSharp still-image result or exposed metadata mapping remain intentionally ignored. `FeatureTestRunner` verifies normal and scalar presentation paths through an 8 KiB constrained tracked allocator with balanced exactly-once returns. All 195 focused HEVC cases pass without failures or skips, both Release source targets build with zero warnings and errors, Roslynk reports zero compiler errors, scoped StyleCop and whitespace verification are clean, `.gitattributes` is unchanged, and `git diff --check` is clean. + Commit `1c58d855f70b024170ced9eb0a7005f0f9c955ad` records the complete official motion-vector conformance checkpoint. The official IVF has SHA-1 `F064290D7FCD3B3DE19020E8AEC6C43C88D3A505`, matching the pinned libaom test-data manifest, and SHA-256 `222A9050059B254DAB17CFB802FF829C778E3F93AF18961A622C8268576C1395`; its pinned-libaom Y4M has SHA-256 `D97AC78C81782CF1507549368047769DC677DBE205706458D1EE9C807DE6EC78`. Both source targets build with zero warnings and errors, the `net10.0` test-project analyzer build completes with zero errors and 1,014 pre-existing repository warnings, Roslynk reports zero compiler errors, 3,985 focused `net10.0` cases pass without failures or skips, and `git diff --check` is clean. Commit `019ac5648b4380a6ff4865072c96fde29ce09fad` records the complete selected-spatial-layer presentation checkpoint. An essential `lsel` selecting the genuine 40x40 base layer of the committed 40x40-to-80x80 progressive AVIF returns that exact pinned-libaom native reconstruction, then scales its YUV444 planes to the 80x80 `ispe` extent before color conversion and matches pinned libavif's RGBA output exactly. Retained reconstructed planes remain at coded dimensions; presentation planes use group-safe allocator-owned rows and are returned exactly once under a 1,024-byte constrained allocator. Portable `Vector128` and scalar two-times filters match pinned libyuv edge, quarter-sample, and rounding results at 8 and 12 bits through `FeatureTestRunner`. Both source targets build with zero warnings and errors, the `net10.0` test-project analyzer build completes with zero errors and 1,014 pre-existing repository warnings, Roslynk reports zero compiler errors, 156 focused reconstruction and color cases pass without failures or skips, and `git diff --check` is clean. @@ -79,15 +81,15 @@ Status meanings: - **Not started:** supporting primitives may exist, but the production format path is absent. - **Current:** the only work item that should be advanced before taking the next queued item. -Current development stage: **Stage 4 — complete HEVC still-image decoding.** The AV1 still-image exit gate is complete across the exact 12-profile matrix, layered reference-dependent items, every connected normative reconstruction tool, official quantizer and size boundaries, constrained allocation, and pinned native and presentation output. The bounded HEVC item-local syntax, allocator-backed decoder lifecycle, CABAC arithmetic and context state, coding-tree traversal, intra prediction, residual reconstruction, in-loop filtering, tiles, wavefront entry points, dependent slices, and entry-point offset handling are implemented and verified through pinned-HM tables and analysis, official native-plane output, real HEIC payloads, constrained allocation, constructor failure, public presentation cases, and SIMD/scalar feature isolation. The next dependency is supplemental enhancement information that changes ImageSharp presentation or metadata, followed by the remaining exact HEVC profile and Range Extensions matrix. Neither AV1 nor HEVC production encoding is implemented. +Current development stage: **Stage 4 — complete HEVC still-image decoding.** The AV1 still-image exit gate is complete across the exact 12-profile matrix, layered reference-dependent items, every connected normative reconstruction tool, official quantizer and size boundaries, constrained allocation, and pinned native and presentation output. The bounded HEVC item-local syntax, allocator-backed decoder lifecycle, CABAC arithmetic and context state, coding-tree traversal, intra prediction, residual reconstruction, in-loop filtering, tiles, wavefront entry points, dependent slices, entry-point offset handling, and supplemental presentation and metadata are implemented and verified through pinned-HM tables and analysis, official native-plane output, real HEIC payloads, constrained allocation, constructor failure, public presentation cases, and SIMD/scalar feature isolation. The next dependency is the remaining exact HEVC profile and Range Extensions matrix. Neither AV1 nor HEVC production encoding is implemented. -Immediate checkpoint: **current — complete presentation-changing HEVC supplemental enhancement information.** Reconcile the bounded still-image SEI syntax with pinned HM, connect only messages that change ImageSharp presentation or exposed metadata, and retain exact native-plane, presentation, malformed-input, constrained-allocation, and scalar/SIMD evidence before completing the remaining profile and Range Extensions matrix. +Immediate checkpoint: **current — complete the remaining HEVC profile and Range Extensions matrix.** Establish exact native-plane and presentation evidence for 8/10/12-bit monochrome, 4:2:0, 4:2:2, and 4:4:4 across every exposed HEVC profile and required Range Extensions tool before closing the Phase 4 decoder exit gate. | Order | Delivery stage | State | Delivered state | Gate that remains open | | --- | --- | --- | --- | --- | | 1 | Baseline, provenance, documentation, and public contract | In progress | Pinned codec references, a bounded image-only scope, encoder options, typed bit depth, decoder-option propagation, and extensive HEIF documentation exist. | Complete the all-file documentation audit, record a fresh Release baseline, finish distinct public HEIC/AVIF save boundaries, and close API review. | | 2 | Bounded HEIF item and image-sequence container | In progress | Still-item parsing, grids, auxiliary alpha, metadata properties, bounded image-sequence tracks, Identify, and all-sync AV1 sequence presentation are connected. | Complete adversarial boundary coverage, remaining item/property behavior, reference-dependent sequence reconstruction, and the bounded sequence writer. | -| 3 | Still-image AV1 and HEVC decoding | **Current** | AV1 still-image decoding has passed its complete exact native/presentation profile, layered-item, normative-tool, official-sequence, constrained-allocation, and SIMD-fallback exit gate. HEVC item-local syntax, lifecycle, CABAC, coding-tree traversal, intra prediction, residual reconstruction, in-loop filtering, tiles, wavefront entry points, dependent slices, and entry-point offsets pass exact pinned-HM native-plane evidence across the recorded 8/10/12-bit and chroma cases. | Complete presentation-changing HEVC SEI, then close the remaining exact profile and Range Extensions matrix. | +| 3 | Still-image AV1 and HEVC decoding | **Current** | AV1 still-image decoding has passed its complete exact native/presentation profile, layered-item, normative-tool, official-sequence, constrained-allocation, and SIMD-fallback exit gate. HEVC item-local syntax, lifecycle, CABAC, coding-tree traversal, intra prediction, residual reconstruction, in-loop filtering, tiles, wavefront entry points, dependent slices, entry-point offsets, and bounded supplemental presentation and metadata pass the recorded pinned-HM, native-plane, public-presentation, constrained-allocation, and scalar/SIMD evidence. | Close the remaining exact HEVC profile and Range Extensions matrix. | | 4 | Complete decoded presentation and animation | In progress | Shared SIMD-first AV1/HEVC color conversion, ICC application, grids, transforms, direct planar alpha composition, frame metadata, repetition, and independently decodable AV1 sequence samples exist. | Close the full color/ICC cross-product, HEVC sequence decoding, AV1/HEVC reference-dependent samples, frame-local metadata/alpha behavior, and independent animated decode vectors. | | 5 | AV1/AVIF encoding | Not started | RGB-to-planar conversion, forward transforms, OBU writer foundations, options, and container-writing infrastructure exist. | `HeifEncoderCore` still rejects AV1. Implement a real independently decodable lossy/lossless AV1 payload and the complete AVIF item/metadata matrix. | | 6 | HEVC/HEIC encoding | Not started | Shared input color conversion, options, and HEIF writer infrastructure exist. | `HeifEncoderCore` still rejects HEVC. Implement a real independently decodable lossy/lossless HEVC payload and the complete HEIC item/metadata matrix. | @@ -709,10 +711,10 @@ Implement and verify in dependency order: - [x] Verify the same four pictures through `FeatureTestRunner` with normal dispatch, AVX-512 disabled, AVX disabled, and all hardware intrinsics disabled. The official SAO picture also matches all three native planes through 2 KiB allocator groups with balanced exactly-once disposal. - [x] Keep the SAO traversal on the JPEG color-converter architecture: one nested classifier contract in `HevcSampleAdaptiveOffsetFilter.Operator.cs`, separate nested semantic `readonly struct` band and edge operators, descending `Vector512`/`Vector256`/`Vector128` dispatch, and one scalar tail. Commits `702739916b2a440ad2dc9bae8b680ca7fcc636c4` and `1c7292759` record the implementation, official fixtures, exact provenance, dedicated filter tests, and explicit full-profile signaling assertions. Both Release source targets build with zero warnings and errors, Roslynk reports zero compiler errors, all 175 focused HEVC cases pass without failures or skips, documentation review is complete, and `git diff --check` is clean. - [x] Implement and verify tiles, wavefront entry points, dependent slices, entry-point offset conversion across emulation-prevention bytes, and the other parallelization syntax permitted by the exposed still-image profiles. The retained first pictures from the official `DSLICE_A`, `DSLICE_B`, `DSLICE_C`, `TILES_A`, `TILES_B`, `WPP_A`, `WPP_B`, `WPP_C`, `WPP_D`, `WPP_E`, `WPP_F`, `ENTP_A`, and `ENTP_C` bitstreams match exact native Y/Cb/Cr planes. Pinned HIGH_BITDEPTH HM at commit `9c1f298659ab0cee9dc13d23d0304221575410b9` reproduces every archive's published complete-output MD5. The production correction follows HM's exact tile-origin and wavefront-row dependent-slice context rules and retains wavefront context across dependent segment boundaries. Direct boundary arithmetic verifies entry-point conversion across emulation-prevention bytes, while combined dependent-slice wavefront and tile cases pass through 4 KiB constrained allocator groups with balanced exactly-once disposal. All 191 focused HEVC cases pass without failures or skips, both Release source targets build with zero warnings and errors, the scoped test-project analyzer build completes with zero errors and 1,010 pre-existing repository warnings, Roslynk reports zero compiler errors, the retained fixtures use the existing LFS attributes without changing `.gitattributes`, and `git diff --check` is clean. Commit `b337bce1a6931885d61ef2cda792df0a29869b8b` records the checkpoint. -- [ ] **Current:** supplemental enhancement information that changes image presentation or metadata exposed by ImageSharp. +- [x] Supplemental enhancement information that changes ImageSharp still-image presentation or metadata exposed by ImageSharp. Commit `fcd16c862c437e3249c7e693012c717512985163` records pinned-HM syntax for display orientation, no-display, mastering-display color volume, content light level, alternative transfer characteristics, ambient viewing environment, and content color volume; complete production ordering across scaling, auxiliary alpha, codec orientation, and container transforms; exact independent RGBA comparison; malformed and conflicting metadata rejection; constrained exactly-once allocation; normal/scalar `FeatureTestRunner` coverage; all 195 focused HEVC cases; both zero-warning Release source builds; zero Roslynk compiler errors; clean scoped StyleCop and whitespace verification; an unchanged `.gitattributes`; and clean `git diff --check`. - [x] Establish exact HM 18 native-plane conformance for four real 8-bit item payloads covering 4:2:0, 4:4:4, cropping, multiple grid positions, and wavefront entry points. - [x] Establish exact independent presentation verification for single images, grids, auxiliary alpha, ICC, 4:2:0, and 4:4:4 output without weakening the exact native-plane codec oracle. - - [ ] Establish exact native-plane conformance for 8/10/12-bit monochrome, 4:2:0, 4:2:2, and 4:4:4 across every exposed HEVC profile and required Range Extensions tool. + - [ ] **Current:** establish exact native-plane conformance for 8/10/12-bit monochrome, 4:2:0, 4:2:2, and 4:4:4 across every exposed HEVC profile and required Range Extensions tool. Each subsystem keeps a specification-shaped scalar oracle derived from the HEVC specification and the pinned implementation reference, while production hot paths are designed SIMD-first with scalar fallback. No valid syntax in the exposed HEIC profiles may terminate in an unsupported branch or silently omit a normative reconstruction stage. @@ -897,7 +899,7 @@ The dashboard and immediate execution queue define the remaining critical path. - [x] Complete progressive color and auxiliary-alpha verification through exact native and presentation comparisons, every required `FeatureTestRunner` fallback, and constrained tracked allocation. - [x] Correct the audited 12-bit inverse ADST4, Identity4, and Identity16 arithmetic through exact pinned boundary vectors and SIMD/scalar feature isolation. - [x] Remove every other unsupported valid AV1 still-image syntax path and prove the complete AVIF decode matrix with independent inputs and scalar/SIMD parity. Commit `2219edbc91edb6a2d905f1221a45207eb2719abc` closes Phase 3. -- [ ] **Current:** close Phase 4 by completing presentation-changing HEVC supplemental enhancement information and the remaining HEVC profile and Range Extensions native-plane and presentation evidence. +- [ ] **Current:** close Phase 4 with the remaining HEVC profile and Range Extensions native-plane and presentation evidence. - [ ] Close Phase 5 and the decode portion of the bounded sequence ledger: color, ICC, alpha, grids, presentation transforms, reference-dependent samples, and complete animated AVIF/HEIC decode. - [ ] Close the still-image portions of Phases 0, 1, and 2 that remain as release gates: documentation, provenance, public format boundaries, API review, parser hardening, and malformed-input coverage. - [ ] Complete Phase 6 with a real AV1 encoder and independent AVIF cross-decode across every public option and metadata combination.