diff --git a/HEIF_IMPLEMENTATION_PLAN.md b/HEIF_IMPLEMENTATION_PLAN.md index 05b490a4d..6ab5a7edc 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-29 against production checkpoint `da9a46b3d72fd682ea9293af3f88fde26defb222`. Committed checkpoints include the AV1 transform architecture, OBU framing, 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, and progressive color and auxiliary-alpha conformance. 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-29 against production checkpoint `e6f0ef84fc8273a7d50fdfc1489f54f058a2a424`. Committed checkpoints include the AV1 transform architecture, OBU framing, 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, and progressive color and auxiliary-alpha conformance. 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 `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. @@ -53,6 +53,8 @@ Commit `15613b01c0bc098fd9926b886216558e0d26eff9` records the official ten-frame Commit `da9a46b3d72fd682ea9293af3f88fde26defb222` records the official eight-bit monochrome checkpoint. The manifest-matching 10,000-byte IVF and pinned-libaom raw luma reference prove all ten displayed 320x180 YUV400 frames exactly under normal and scalar dispatch. The shared compact-sequence oracle validates native monochrome without manufacturing chroma and keeps every prior YUV420 fixture exact. Constrained tracked allocation returns every allocation exactly once. The existing decoder required no production correction. Both Release source targets build with zero warnings and errors, the scoped test-project analyzer build completes with zero errors and 1,011 repository warnings, Roslynk reports zero compiler errors, all 17 official-sequence cases pass without failures or skips, and `git diff --check` is clean. +Commit `e6f0ef84fc8273a7d50fdfc1489f54f058a2a424` records the OBU framing verification checkpoint. The bounded parser was re-audited against pinned libaom across length fields, operating points, header ordering, padding, alignment, tile-group boundaries, tile sizes, and ordered coverage. Corrected test oracles now address the actual item-relative tile bytes and avoid reflection invocation of span-valued properties. Both Release source builds remain clean, the scoped analyzer build and Roslynk report zero errors, all 119 focused cases pass, and `git diff --check` is clean. + Status meanings: - **Complete:** the implementation and its phase exit evidence are recorded. @@ -575,7 +577,7 @@ Implement and verify in dependency order: - [x] OBU framing, sequence headers, frame headers, tile groups, byte alignment, and trailing bits. - [x] Isolate every declared OBU payload with a zero-copy bounded span reader, advance ignored metadata and reserved units without parsing their bytes as headers, validate padding and trailing bytes, enforce primary/redundant/combined frame-header order, accept the final unsized low-overhead OBU by consuming the bounded image-item remainder, and reject lengths that cross the containing boundary. Focused malformed-input tests and independent 8/10/12-bit AVIF reconstruction pass in Release. - - [x] Re-audit the complete bounded parser against pinned libaom `03087864cf4bea6abb0d28f95cf7843511413d8f`, including ULEB128 and Annex B lengths, operating-point filtering, sequence/frame ordering, redundant-header identity, temporal delimiters, padding, byte alignment, tile-group bounds, tile sizes, and complete ordered tile coverage. AV1-ISOBMFF's final unsized low-overhead OBU remains the deliberate item-specific extension and is covered by a real fixture. Correct the stale direct tile tests to address item-relative tile bytes and make header round-trip diagnostics skip span-valued properties that reflection cannot box. Both Release source builds remain zero-warning and zero-error, the scoped test-project analyzer build completes with zero errors and 1,011 repository warnings, Roslynk reports zero compiler errors, and all 119 focused framing, lifecycle, bit-reader, tiling, and official-sequence cases pass without failures or skips. + - [x] Re-audit the complete bounded parser against pinned libaom `03087864cf4bea6abb0d28f95cf7843511413d8f`, including ULEB128 and Annex B lengths, operating-point filtering, sequence/frame ordering, redundant-header identity, temporal delimiters, padding, byte alignment, tile-group bounds, tile sizes, and complete ordered tile coverage. AV1-ISOBMFF's final unsized low-overhead OBU remains the deliberate item-specific extension and is covered by a real fixture. Correct the stale direct tile tests to address item-relative tile bytes and make header round-trip diagnostics skip span-valued properties that reflection cannot box. Both Release source builds remain zero-warning and zero-error, the scoped test-project analyzer build completes with zero errors and 1,011 repository warnings, Roslynk reports zero compiler errors, and all 119 focused framing, lifecycle, bit-reader, tiling, and official-sequence cases pass without failures or skips. Commit `e6f0ef84fc8273a7d50fdfc1489f54f058a2a424` records the checkpoint. - [x] One coherent bounded decoder lifecycle retains parsed tile state until successful frame completion, commits frame-owned reference samples and metadata only after reconstruction, resets retained state at a new sequence boundary, and disposes tile, reference, entropy, and presentation ownership deterministically. The real two-layer lifecycle fixture proves the header/reference ownership boundary through a fake tile reader; dependent inter reconstruction remains covered by the unchecked items below. - [ ] Tile partitioning, mode information, segmentation, delta quantization, transform-size selection, coefficient token decode, inverse quantization, and inverse transforms. - [x] Match libaom's depth-first traversal and frame-edge behavior for all ten AV1 partition types. Independent 8/10/12-bit streams collectively select every terminal partition shape and contain nested block geometry that requires recursive `Split` traversal; their complete native planes remain byte-exact under normal hardware dispatch and the scalar fallback. diff --git a/tests/ImageSharp.Tests/Formats/Heif/Av1/Av1CoefficientsEntropyTests.cs b/tests/ImageSharp.Tests/Formats/Heif/Av1/Av1CoefficientsEntropyTests.cs index 24eec17c8..b996311e1 100644 --- a/tests/ImageSharp.Tests/Formats/Heif/Av1/Av1CoefficientsEntropyTests.cs +++ b/tests/ImageSharp.Tests/Formats/Heif/Av1/Av1CoefficientsEntropyTests.cs @@ -150,7 +150,7 @@ public class Av1CoefficientsEntropyTests // Act encoder.WriteCoefficients(transformSize, transformType, intraDirection, coefficientsBuffer, componentType, transformBlockContext, endOfBlock, true, filterIntraMode); - IMemoryOwner encoded = encoder.Exit(); + using IMemoryOwner encoded = encoder.Exit(); Av1SymbolDecoder decoder = new(Configuration.Default, encoded.GetSpan(), BaseQIndex); int plane = Math.Min((int)componentType, 1); @@ -161,7 +161,13 @@ public class Av1CoefficientsEntropyTests // Assert Assert.Equal(endOfBlock, actuals[0]); - Assert.Equal(coefficientsBuffer[..endOfBlock], actuals[1..(endOfBlock + 1)]); + ReadOnlySpan scan = Av1ScanOrderConstants.GetScanOrder(transformSize, transformType).Scan; + + // The parser retains quantized levels in entropy scan order; inverse quantization maps them back to raster positions. + for (int coefficientIndex = 0; coefficientIndex < endOfBlock; coefficientIndex++) + { + Assert.Equal(coefficientsBuffer[scan[coefficientIndex]], actuals[coefficientIndex + 1]); + } } public static TheoryData GetTransformTypes()