Repository navigation
Decode 4:4:0 sources as 4:4:4, not 4:2:2 (task #100) - #258
Merged
StuartCameronCode merged 4 commits intoNov 22, 2026
Merged
Conversation
The pipe-format classifier put the subsampling code 440 with 4:2:2, judging one axis. 4:4:0 (some JPEG/MJPEG cameras record yuvj440p) has full horizontal chroma and half vertical, so the decoder's -pix_fmt yuv422p halved its horizontal chroma. 1-px colour columns came through 70 levels off on average (the columns gone); testsrc2 1.78/21 against a one-step 4:4:4 rendering. Through 4:4:4: 0/0. - pixel_format.rs: 440 is C444; 4:1:0 stays C422. New property test pipe_format_never_has_less_chroma_on_either_axis over every planar YUV code x prefix x depth. - The Dart twin pixelFormatChromaLayout moves 440 to c444, so the ProRes, v210, AV1 and NVENC warnings describe what the worker does; yuv440p rows added to the tables pinned between Rust and Dart. - Heavy group "4:4:0 sources keep their horizontal chroma (task #100)": the encode is bit-identical to ffmpeg's own 4:4:4 decode and keeps the columns, at 8/10-bit, full range and 127x95; it failed on the old worker (4:2:2 output, columns gone, 127x95 "BlankClip: invalid width"). - Report docs/reports/task-100-440-sources, engineering note, CLAUDE.md, README, reports index. Output change: under Color Format "Match source" a 4:4:0 source now comes out 4:4:4 at its depth (x264: High 4:4:4 Predictive) where it was 4:2:2. Explicit formats, AV1, ProRes, v210 and HuffYUV now convert from the true chroma; ProRes 422/v210 warnings now say the chroma is reduced, and ProRes 4444 no longer says it pads. Pipe and passes carry ~1.5x the bytes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts in docs/reports/README.md and docs/ENGINEERING_NOTES.md were additive (task #97/#98 rows and notes beside #100's). The 4:4:0 property test now takes each format's subsampling from task #97's chroma_grid instead of a duplicate table in the test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ces-yuv440p-yuvj440p-from-jpeg # Conflicts: # docs/ENGINEERING_NOTES.md
…ces-yuv440p-yuvj440p-from-jpeg # Conflicts: # docs/reports/README.md
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.
Problem
pixel_format::classifyput the subsampling code440in the 4:2:2 class, so the decoder ffmpeg converted 4:4:0 sources (yuv440p, andyuvj440pfrom some JPEG/MJPEG cameras) toyuv422p*. 4:4:0 has full horizontal chroma and half vertical, and 4:2:2 is the other way round, so this halved the source's horizontal chroma before VapourSynth saw it. That breaks the module's rule of never piping less chroma on either axis. On a fixture with 1-px colour columns, the stripes disappeared (mean error 70 levels).Change
440now falls through to the 4:4:4 class, so a 4:4:0 source pipes asyuv444p/yuv444p10le/…12le/…16le. 4:1:0 and 4:1:1 still go to 4:2:2, which is a true superset of them.pixelFormatChromaLayoutmoves440toc444. The warnings checked against the worker's tables (NVENC/hardware, ProRes, v210, AV1) gainedyuv440prows, and the Rust and Dart tables still agree.pipe_format_never_has_less_chroma_on_either_axis: it checks every planar code × prefix (yuv/yuvj/yuva) × depth throughchroma_grid(from [SUGGESTION] pre-treatment video analisys/measurements #97), and it fails on the old mapping.docs/reports/task-100-440-sources(with its measurement script).Range
A full-range 4:4:0 source keeps full range. With the bundled FFmpeg 9, black decodes to 0, not 16, as
yuv444p, both fromyuv440ptaggedpcand from MJPEGyuvj. FFmpeg 9 carries range as a frame property, so theyuvj→yuvname change is only a label, as it already was with the oldyuv422pmapping.Testing
cargo test: passes in full (lib 678 plus every integration test), after merging main.4:4:0 sources keep their horizontal chroma (task #100): passes 4/4. Each encode was compared sample for sample with ffmpeg's own 4:4:4 decode of the same source. It covers 8-bit, 10-bit, full range and the odd size 127x95, and 0 samples differ. Preview vs encode is 0.000.integration_off_grid_source_test(task [SUGGESTION] pre-treatment video analisys/measurements #97): passes 9/9.🤖 Generated with Claude Code