Repository navigation
fix(producer): auto renders with color-graded media stay SDR instead of promoting to HDR - #6671
Conversation
…of promoting to HDR
Edit accuracy: accurate 271 (base branch 271), smooth 125 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (1)
|
There was a problem hiding this comment.
Verdict: REQUEST CHANGES · 1 blocker · 1 important · 0 nits · head 5085f495
The Comments check is red. Every required check is green. The SDR-on-grade logic is correct at every hdrMode/rendersSdrOnly site, and collectRenderMedia spreads graded through to both render and check. ↓ inline
Scope
Read the full diff. I audited all "force-sdr" branches and the callers of rendersSdrOnly and resolveEffectiveHdrMode. Distributed mode only allows auto/force-sdr and reaches the extract stage through the same rendersSdrOnly. The fails without the fix: line names hdrMode.test.ts > resolveEffectiveHdrMode > keeps an auto render with graded media SDR…. I did not run any renders.
What
A render in auto HDR mode that has any color-graded media (
data-color-gradingon a<video>,<img>or<canvas>) now renders SDR, as--sdrdoes: HDR sources are tone-mapped to SDR before the grade, and the render logs why. Before, one HDR clip (an iPhone HLG video, for example) promoted the whole render to HDR HEVC, and every graded element was graded in SDR and then placed in the HDR output, with no warning.Why
Color grading is SDR-only. The media-treatment contract says so ("The realtime treatment path is Rec.709/SDR. Do not silently process HDR, HLG, PQ, or camera LOG sources through it."), but auto mode did exactly that. Reproduced on 0.8.212 with generated clips (a 1080x1920 HEVC Main10 HLG clip tagged
bt2020/arib-std-b67, and an SDR clip with theclean-studiopreset):checkreported the same auto-promotion, so nothing flagged the combination.Related work
#5728 changes
extractVideosStage.tsandrenderOrchestrator.tstoo, in different hunks. Whichever lands second rebases.How
parseVideoElementsandparseImageElements(engine) mark an element that carriesdata-color-gradingasgraded;hasGradedCanvas(engine) does the same for a graded<canvas>, which the media collector carries asgradedCanvasthrough compile into the render.gradingKeepsSdr(hdrMode, media)(engine) is the one rule: auto mode plus any graded media means SDR. It's read by:rendersSdrOnly, so extraction tone-maps HDR sources as it does for--sdr;extractVideosStage, which are skipped as they are for--sdr;resolveEffectiveHdrMode, which logs:HDR source detected, but color grading is SDR-only, so rendering SDR ... Use --hdr to force HDR output (grades stay SDR).;check's HDR promotion report, which no longer reports a promotion the render won't make.--hdrwith graded media still renders HDR, and now warns that the graded elements are graded in SDR.snapshotneeds no change: its stills already tone-map HDR the way an SDR export does, so a graded composition's still now matches its render.Test plan
hdrMode.test.ts(auto with graded media stays SDR and says why;--hdrwith graded media stays HDR and warns;rendersSdrOnlywith graded media),hdr.test.ts(gradingKeepsSdr, including a graded canvas),videoFrameExtractor.test.ts(graded video and image are marked, others are not;hasGradedCanvas),hdrPromotion.test.ts(no promotion and no probe when graded media keeps the render SDR).hdrMode.test.ts > resolveEffectiveHdrMode > keeps an auto render with graded media SDR when an HDR source would promote it, and says why(expected { transfer: 'pq' } to be undefined) and> rendersSdrOnly > is true for an auto render with graded media..., with the rule removed from the producer.check.test.ts150 passed;renderMediaCollector.test.tsandhtmlCompiler.test.ts189 passed; engine, producer and CLI typecheck clean; oxfmt, oxlint and fallow audit clean (the repo's commit hooks, run on the push).