Skip to content

test(unblend): fix the vacuous 8 = 10-bit test; exact and real-source depth tests (task #64) - #221

Merged
StuartCameronCode merged 2 commits into
mainfrom
stuart/64-unblend-srestore-heavy-test-a-10-bit-cop
Nov 18, 2026
Merged

StuartCameronCode merged 2 commits into
mainfrom
stuart/64-unblend-srestore-heavy-test-a-10-bit-cop

Conversation

@StuartCameronCode

Copy link
Copy Markdown
Owner

Fixes task #64: Unblend's heavy test "a 10-bit copy of the source gives the 8-bit result" has failed on every platform since dc9e36c (task #50). It measured 13.08 levels on arm64 and 13.43 on x86.

Cause

Nothing in Unblend regressed. The test was vacuous until task #50.

  • The test's job named no inputPixelFormat. Before the source model, the worker then decoded the source as 8-bit 4:2:0, so the test compared the 8-bit run with itself (0.000).
  • Now the worker probes the format, so the copy really runs at 10 bits. QTGMC rounds differently there: luma median 0.35 levels.
  • srestore's detector thresholds min/max statistics of blend maps. That turns the rounding into large swings: SrBMax changes by up to 31. As a result 30 of 300 decisions change, and 7–11 of 143 output frames take a neighbouring original.
  • Recovery is just as good: 143/143 frames are clean at both depths.

The deps version is ruled out: 1.16.0 and the pinned 1.17.0-rc2 give an identical 13.102. Nightly passed on every platform through f4c5f3f and failed on every platform from dc9e36c.

Change

  • integration_unblend_test.dart: the depth test is now two tests.
    • Exact: QTGMC runs once at 8 bits, and ffmpeg makes an exact 10-bit shift of that result. With Deinterlace off, Unblend must give identical output, sample for sample. This still catches a threshold left in 8-bit units at 10 bits.
    • Real 10-bit source: it checks recovery against the original film frames, using a luma metric:
      • ≥95% of frames clean;
      • no more than 2% fewer clean frames than the 8-bit run;
      • ≥85% of frames pick the same original;
      • where the pick is the same, the frames differ by a median ≤ 0.6 and at most 2.0 levels.
  • Every >8-bit job in the file now sets inputPixelFormat and asserts the output's pix_fmt. This includes the PAL 10-bit 4:2:2 test, which had also been running at 8 bits.
  • Preview test: since task Address the filter/feature feedback in issue #50 #56 F8 the preview converts to RGB with accurate_rnd+full_chroma_int. The test now decodes the encode with the same flags, and the difference is 0.00 again.
  • Report docs/reports/2026-11-srestore: the wrong sentence is struck through, with a correction card. A new scripts/depth_source.py / data/depth_source.json measures the real 10-bit source.
  • Notes: a dated entry in ENGINEERING_NOTES. In CLAUDE.md, a rule that Unblend's picks are not stable to a level of input change, and a rule that heavy tests on >8-bit fixtures set inputPixelFormat and assert pix_fmt.

Testing

  • flutter test --tags heavy test/integration_unblend_test.dart passes on macOS arm64 with deps 1.17.0-rc2. I ran it twice, with identical numbers.
  • When the 10-bit job is forced back to yuv420p, the exact test fails as expected.
  • flutter analyze is clean on the test file.

Follow-ups (separate tasks)

🤖 Generated with Claude Code

@StuartCameronCode
StuartCameronCode force-pushed the stuart/64-unblend-srestore-heavy-test-a-10-bit-cop branch from 6b32d7d to 068e49c Compare November 18, 2026 02:25
StuartCameronCode and others added 2 commits November 18, 2026 15:02
…rce test (task #64)

The old test compared the 8-bit run with itself until task #50: its job
named no inputPixelFormat, so the worker decoded the 10-bit copy as 8-bit.
At 10 bits QTGMC rounds differently and srestore's min/max statistics move
~10% of decisions to a neighbouring original, with recovery as good.

- Exact: the same picture at 8 and 10 bits (Deinterlace off on a lossless
  50p intermediate) gives identical output, sample for sample.
- Real source: a 10-bit copy recovers as well as the 8-bit run (luma),
  with >= 85% of picks the same.
- Both 10-bit jobs, and the PAL 4:2:2 one, set inputPixelFormat and assert
  the output pix_fmt.
- The preview test decodes the encode with the preview's own RGB flags
  (task #56 F8), which had moved the same frame 0.54 levels.

Report section 8 corrected (scripts/depth_source.py), CLAUDE.md and
ENGINEERING_NOTES updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…review)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@StuartCameronCode
StuartCameronCode force-pushed the stuart/64-unblend-srestore-heavy-test-a-10-bit-cop branch from 068e49c to 9658faf Compare November 18, 2026 04:02
@StuartCameronCode
StuartCameronCode merged commit eea6c4b into main Nov 18, 2026
4 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.

1 participant