Commit 73749924b0 for ffmpeg
commit 73749924b05b514cf0f26944aa88070a73fbd91d
Author: Kacper Michajłow <kasper93@gmail.com>
Date: Wed Sep 30 03:16:01 2026 +0200
tests/fate: add chroma location negotiation tests
Check that a location set by setparams is kept by a following scale, that
the reference input of scale does not have to match the main one, that
untagged input to scale is tagged with the output location instead of
being converted, that top-left 4:2:0 reaches mpeg2video converted to
left, that noformat converts away from an excluded location, and that
zscale tags the frames it passes through unconverted with the negotiated
location.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
index e255cdcc0b..b749af4a7e 100644
--- a/tests/fate/ffmpeg.mak
+++ b/tests/fate/ffmpeg.mak
@@ -16,6 +16,9 @@ fate-ffmpeg-filter_colorkey: CMD = framecrc -auto_conversion_filters -idct simpl
FATE_FFMPEG-$(call FILTERFRAMECRC, COLOR) += fate-ffmpeg-lavfi
fate-ffmpeg-lavfi: CMD = framecrc -lavfi color=d=1:r=5 -fflags +bitexact
+FATE_FFMPEG-$(call FILTERFRAMECRC, TESTSRC2 FORMAT SETPARAMS SCALE, LAVFI_INDEV WRAPPED_AVFRAME_DECODER MPEG2VIDEO_ENCODER) += fate-ffmpeg-chroma-location
+fate-ffmpeg-chroma-location: CMD = framecrc -auto_conversion_filters -f lavfi -i testsrc2=s=64x64:r=25:d=1,format=yuv420p,setparams=chroma_location=topleft -sws_flags +accurate_rnd+bitexact -flags +bitexact -idct simple -dct fastint -threads 1 -c:v mpeg2video -qscale:v 2 -frames:v 1
+
FATE_FFMPEG-$(call ENCDEC2, MPEG4, RAWVIDEO, AVI, RAWVIDEO_DEMUXER FRAMECRC_MUXER) += fate-force_key_frames
fate-force_key_frames: tests/data/vsynth1.yuv
fate-force_key_frames: CMD = enc_dec \
diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index b24379ae81..b746f6a0e8 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -592,6 +592,22 @@ FATE_FILTER-$(call FILTERFRAMECRC, TESTSRC2 FORMAT SCALE) += fate-filter-scalech
fate-filter-scalechroma-matrix: CMD = framecrc -flags bitexact -lavfi testsrc2=s=64x64:r=1:d=1,format=yuv420p,scale=96:80:in_color_matrix=bt709:out_color_matrix=bt470bg:in_range=tv:out_range=tv:in_chroma_loc=topleft:out_chroma_loc=center:flags=accurate_rnd+bitexact,format=yuv420p -frames:v 1
fate-filter-scalechroma-downscale: CMD = framecrc -flags bitexact -lavfi testsrc2=s=2048x2048:r=1:d=1,format=yuv420p,scale=8:8:in_chroma_loc=topleft:out_chroma_loc=center:flags=accurate_rnd+bitexact,format=yuv420p -frames:v 1
+FATE_FILTER-$(call FILTERFRAMECRC, TESTSRC2 FORMAT SETPARAMS SCALE) += fate-filter-scalechroma-setparams
+fate-filter-scalechroma-setparams: CMD = framecrc -flags bitexact -lavfi testsrc2=s=64x64:r=1:d=1,format=yuv420p,format=chroma_locations=left,setparams=chroma_location=center,scale=flags=accurate_rnd+bitexact,format=yuv420p -frames:v 1
+
+FATE_FILTER-$(call FILTERFRAMECRC, TESTSRC2 FORMAT SCALE) += fate-filter-scalechroma-ref
+fate-filter-scalechroma-ref: CMD = framecrc -flags bitexact -lavfi "testsrc2=s=64x64:r=1:d=1,format=yuv420p,format=chroma_locations=left[m];testsrc2=s=32x48:r=1:d=1,format=yuv420p,format=chroma_locations=center[r];[m][r]scale=w=rw:h=rh:flags=accurate_rnd+bitexact,format=yuv420p" -frames:v 1
+
+FATE_FILTER-$(call FILTERFRAMECRC, TESTSRC2 FORMAT SCALE) += fate-filter-scalechroma-untagged fate-filter-scalechroma-untagged-422
+fate-filter-scalechroma-untagged: CMD = framecrc -flags bitexact -lavfi testsrc2=s=64x64:r=1:d=1,format=yuv420p,scale=96:80:flags=accurate_rnd+bitexact,format=pix_fmts=yuv420p:chroma_locations=left -frames:v 1
+fate-filter-scalechroma-untagged-422: CMD = framecrc -flags bitexact -lavfi testsrc2=s=64x64:r=1:d=1,format=yuv420p,scale=flags=accurate_rnd+bitexact,format=pix_fmts=yuv422p:chroma_locations=topleft -frames:v 1
+
+FATE_FILTER-$(call FILTERFRAMECRC, TESTSRC2 FORMAT SETPARAMS SCALE NOFORMAT) += fate-filter-noformat-chroma
+fate-filter-noformat-chroma: CMD = framecrc -flags bitexact -lavfi testsrc2=s=64x64:r=1:d=1,format=yuv420p,setparams=chroma_location=left,scale=flags=accurate_rnd+bitexact,noformat=chroma_locations=left -frames:v 1
+
+FATE_FILTER-$(call FILTERFRAMECRC, TESTSRC2 FORMAT SETPARAMS ZSCALE SCALE, LAVFI_INDEV WRAPPED_AVFRAME_DECODER) += fate-filter-zscale-chroma-input-override
+fate-filter-zscale-chroma-input-override: CMD = framecrc -flags bitexact -f lavfi -i testsrc2=s=64x64:r=2:d=2,setparams=chroma_location=left -vf zscale=chromalin=center,format=chroma_locations=center,scale=flags=accurate_rnd+bitexact -frames:v 4
+
FATE_FILTER-$(call ALLYES, SCALE_FILTER TESTSRC2_FILTER LAVFI_INDEV \
WRAPPED_AVFRAME_DECODER WRAPPED_AVFRAME_ENCODER \
NULL_MUXER) += fate-filter-scale-print-info \
diff --git a/tests/ref/fate/ffmpeg-chroma-location b/tests/ref/fate/ffmpeg-chroma-location
new file mode 100644
index 0000000000..2c96964494
--- /dev/null
+++ b/tests/ref/fate/ffmpeg-chroma-location
@@ -0,0 +1,6 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: mpeg2video
+#dimensions 0: 64x64
+#sar 0: 1/1
+0, 0, 0, 1, 2687, 0xf341d96b, S=1, Quality stats, 8, 0x076400ed
diff --git a/tests/ref/fate/filter-noformat-chroma b/tests/ref/fate/filter-noformat-chroma
new file mode 100644
index 0000000000..d525d1fa57
--- /dev/null
+++ b/tests/ref/fate/filter-noformat-chroma
@@ -0,0 +1,6 @@
+#tb 0: 1/1
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 64x64
+#sar 0: 1/1
+0, 0, 0, 1, 6144, 0x9bc050a5
diff --git a/tests/ref/fate/filter-scalechroma-ref b/tests/ref/fate/filter-scalechroma-ref
new file mode 100644
index 0000000000..c934991b40
--- /dev/null
+++ b/tests/ref/fate/filter-scalechroma-ref
@@ -0,0 +1,6 @@
+#tb 0: 1/1
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 32x48
+#sar 0: 3/2
+0, 0, 0, 1, 2304, 0x29a68068
diff --git a/tests/ref/fate/filter-scalechroma-setparams b/tests/ref/fate/filter-scalechroma-setparams
new file mode 100644
index 0000000000..2d4ee73333
--- /dev/null
+++ b/tests/ref/fate/filter-scalechroma-setparams
@@ -0,0 +1,6 @@
+#tb 0: 1/1
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 64x64
+#sar 0: 1/1
+0, 0, 0, 1, 6144, 0x42205435
diff --git a/tests/ref/fate/filter-scalechroma-untagged b/tests/ref/fate/filter-scalechroma-untagged
new file mode 100644
index 0000000000..e5f7bb2a5a
--- /dev/null
+++ b/tests/ref/fate/filter-scalechroma-untagged
@@ -0,0 +1,6 @@
+#tb 0: 1/1
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 96x80
+#sar 0: 5/6
+0, 0, 0, 1, 11520, 0x11d57c6a
diff --git a/tests/ref/fate/filter-scalechroma-untagged-422 b/tests/ref/fate/filter-scalechroma-untagged-422
new file mode 100644
index 0000000000..2dd464d1b9
--- /dev/null
+++ b/tests/ref/fate/filter-scalechroma-untagged-422
@@ -0,0 +1,6 @@
+#tb 0: 1/1
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 64x64
+#sar 0: 1/1
+0, 0, 0, 1, 8192, 0x490b5f6f
diff --git a/tests/ref/fate/filter-zscale-chroma-input-override b/tests/ref/fate/filter-zscale-chroma-input-override
new file mode 100644
index 0000000000..c0139fe68a
--- /dev/null
+++ b/tests/ref/fate/filter-zscale-chroma-input-override
@@ -0,0 +1,9 @@
+#tb 0: 1/2
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 64x64
+#sar 0: 1/1
+0, 0, 0, 1, 6144, 0x42205435
+0, 1, 1, 1, 6144, 0x71c74475
+0, 2, 2, 1, 6144, 0x2bcd4c89
+0, 3, 3, 1, 6144, 0xff376234