PR #26190 opened by Baptiste Coudurier (bcoudurier)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26190
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26190.patch

QuickTime Component Video (`yuv2`) is full range BT.601: the QTFF yuv2 to RGB 
conversion uses the BT.601 coefficients with no 16/219 luma scaling.

Set `color_range` / `colorspace` as defaults only, so a `colr` atom or user 
option still wins.

Checked against QuickTime 7's own decode of a QuickTime-made yuv2 file: RGB 
PSNR goes from 29.5 dB to 46.6 dB (max difference 3). No FATE sample uses yuv2.

🤖 Generated with [Claude Code](https://claude.com/claude-code)



From dc63198be72f0840a1810b418fb1d4f122619e40 Mon Sep 17 00:00:00 2001
From: Baptiste Coudurier <[email protected]>
Date: Wed, 18 Nov 2026 15:04:29 -0800
Subject: [PATCH] avcodec/rawdec: signal yuv2 as full range BT.601

QuickTime Component Video is full range BT.601 (QTFF yuv2 conversion).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Baptiste Coudurier <[email protected]>
---
 libavcodec/rawdec.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 16c04b9a5c2..c8277277594 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -123,8 +123,14 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
         context->is_nut_pal8 = 1;
 
     if (avctx->codec_tag == AV_RL32("yuv2") &&
-        avctx->pix_fmt   == AV_PIX_FMT_YUYV422)
+        avctx->pix_fmt   == AV_PIX_FMT_YUYV422) {
         context->is_yuv2 = 1;
+        /* QuickTime Component Video is full range BT.601 */
+        if (avctx->color_range == AVCOL_RANGE_UNSPECIFIED)
+            avctx->color_range = AVCOL_RANGE_JPEG;
+        if (avctx->colorspace == AVCOL_SPC_UNSPECIFIED)
+            avctx->colorspace = AVCOL_SPC_SMPTE170M;
+    }
 
     return 0;
 }
-- 
2.54.1

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to