This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new 2345da755e avcodec/rawdec: signal yuv2 as full range BT.601
2345da755e is described below

commit 2345da755e230a6d1b85a0e788cf644353084760
Author:     Baptiste Coudurier <[email protected]>
AuthorDate: Wed Nov 18 15:04:29 2026 -0800
Commit:     Baptiste Coudurier <[email protected]>
CommitDate: Mon Nov 23 05:58:00 2026 +0000

    avcodec/rawdec: signal yuv2 as full range BT.601
    
    QuickTime Component Video is full range BT.601 (QTFF yuv2 conversion).
    Old limited-range yuv2 files can be read with -color_range tv before -i.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Co-Authored-By: Michael Niedermayer <[email protected]>
    Assisted-by: Fairy
    Signed-off-by: Baptiste Coudurier <[email protected]>
---
 libavcodec/rawdec.c                   |  8 +++++++-
 tests/fate/mov.mak                    | 22 ++++++++++++++++++++++
 tests/ref/fate/mov-yuv2-color-colr    |  2 ++
 tests/ref/fate/mov-yuv2-color-default |  2 ++
 tests/ref/fate/mov-yuv2-color-range   |  2 ++
 5 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 16c04b9a5c..c827727759 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;
 }
diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index 931a111543..3d571b184a 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -480,6 +480,28 @@ fate-mov-3gp-udta-metadata: CMD = transcode lavfi 
"color=s=32x32:r=1:d=1" 3gp \
      -metadata copyright-eng=Copyright" \
     "-c copy" "-show_entries format_tags"
 
+# yuv2 defaults to full range BT.601; a colr matrix or a decoder option still 
takes precedence.
+MOV_YUV2_FILTERS = COLOR FORMAT SCALE
+FATE_MOV_FFMPEG_FFPROBE-$(call FILTERDEMDECENCMUX, $(MOV_YUV2_FILTERS), MOV, 
RAWVIDEO, RAWVIDEO, MOV) \
+    += fate-mov-yuv2-color-default fate-mov-yuv2-color-range
+FATE_MOV_FFMPEG_FFPROBE-$(call FILTERDEMDECENCMUX, $(MOV_YUV2_FILTERS) 
SETPARAMS, MOV, RAWVIDEO, RAWVIDEO, MOV) \
+    += fate-mov-yuv2-color-colr
+
+MOV_YUV2_SRC = color=c=black:s=32x32:r=1:d=1,format=yuv422p
+MOV_YUV2_COLR_SRC = 
$(MOV_YUV2_SRC),setparams=colorspace=bt709:color_primaries=bt709:color_trc=bt709
+MOV_YUV2_GEN = $(FFMPEG) -nostdin -v error -filter_complex $(1) \
+    -pix_fmt yuyv422 -color_range pc -c:v rawvideo -tag:v yuv2 \
+    -threads 1 -flags +bitexact -fflags +bitexact -f mov -y
+MOV_YUV2_PROBE = ffprobe$(PROGSSUF)$(EXESUF) -v error -bitexact \
+    -show_entries frame=color_range,color_space -of default=nw=1
+
+fate-mov-yuv2-color-default: CMD = run_with_temp \
+    "$(call MOV_YUV2_GEN,$(MOV_YUV2_SRC))" "$(MOV_YUV2_PROBE)" mov
+fate-mov-yuv2-color-colr: CMD = run_with_temp \
+    "$(call MOV_YUV2_GEN,$(MOV_YUV2_COLR_SRC))" "$(MOV_YUV2_PROBE)" mov
+fate-mov-yuv2-color-range: CMD = run_with_temp \
+    "$(call MOV_YUV2_GEN,$(MOV_YUV2_SRC))" "$(MOV_YUV2_PROBE) -color_range tv" 
mov
+
 FATE_MOV_FFMPEG_FFPROBE-$(call ALLYES, COLOR_FILTER SETPTS_FILTER 
MPEG4_ENCODER \
                                       MOV_MUXER MOV_DEMUXER FILE_PROTOCOL)     
 \
                                       += fate-mov-vfr-bframes-derived-duration
diff --git a/tests/ref/fate/mov-yuv2-color-colr 
b/tests/ref/fate/mov-yuv2-color-colr
new file mode 100644
index 0000000000..7ae79902cc
--- /dev/null
+++ b/tests/ref/fate/mov-yuv2-color-colr
@@ -0,0 +1,2 @@
+color_range=pc
+color_space=bt709
diff --git a/tests/ref/fate/mov-yuv2-color-default 
b/tests/ref/fate/mov-yuv2-color-default
new file mode 100644
index 0000000000..5c9996a60e
--- /dev/null
+++ b/tests/ref/fate/mov-yuv2-color-default
@@ -0,0 +1,2 @@
+color_range=pc
+color_space=smpte170m
diff --git a/tests/ref/fate/mov-yuv2-color-range 
b/tests/ref/fate/mov-yuv2-color-range
new file mode 100644
index 0000000000..72c0f47e0e
--- /dev/null
+++ b/tests/ref/fate/mov-yuv2-color-range
@@ -0,0 +1,2 @@
+color_range=tv
+color_space=smpte170m

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to