Commit a5aaa01fde for ffmpeg
commit a5aaa01fde65a17063d7be39f4c04f80339d38e7
Author: Kacper Michajłow <kasper93@gmail.com>
Date: Wed Sep 30 16:26:22 2026 +0200
avfilter/vf_zscale: apply the requested primaries and transfer to passthrough frames
Frames that need no conversion kept the tags of the input, so when
primariesin or transferin made the input match the requested output, only
the first frame, which is always converted, got the requested primaries
and transfer characteristics.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
diff --git a/libavfilter/vf_zscale.c b/libavfilter/vf_zscale.c
index dc14d61e87..a2d77be1dd 100644
--- a/libavfilter/vf_zscale.c
+++ b/libavfilter/vf_zscale.c
@@ -899,6 +899,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
/*no need for any filtering */
if (outlink->chroma_location != AVCHROMA_LOC_UNSPECIFIED)
in->chroma_location = outlink->chroma_location;
+ update_output_color_information(s, in);
return ff_filter_frame(outlink, in);
}
fail:
diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index 1a7d9a0192..b24379ae81 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -611,6 +611,9 @@ FATE_FILTER-$(call ALLYES, SCALE_FILTER COLOR_FILTER LAVFI_INDEV WRAPPED_AVFRAME
fate-filter-scale-zero-dim: CMD = ! run $(FFMPEG) -nostdin -hide_banner -f lavfi -i "color=c=red:s=3000x2:d=1" -vf "scale=iw/2:-2,scale=iw/3:-2,scale=iw/2:-2" -f null none
fate-filter-scale-zero-dim: CMP = null
+FATE_FILTER_FFPROBE-$(call ALLYES, FFPROBE LAVFI_INDEV WRAPPED_AVFRAME_DECODER TESTSRC2_FILTER FORMAT_FILTER SETPARAMS_FILTER ZSCALE_FILTER) += fate-filter-zscale-passthrough
+fate-filter-zscale-passthrough: CMD = probe -print_format compact -show_entries frame=color_primaries,color_transfer -f lavfi "testsrc2=s=64x64:r=2:d=2,format=gbrp,setparams=color_primaries=bt709:color_trc=bt709,zscale=primariesin=bt470bg:primaries=bt470bg:transferin=smpte170m:transfer=smpte170m"
+
FATE_FILTER_VSYNTH_VIDEO_FILTER-$(CONFIG_VFLIP_FILTER) += fate-filter-vflip
fate-filter-vflip: CMD = video_filter "vflip"
diff --git a/tests/ref/fate/filter-zscale-passthrough b/tests/ref/fate/filter-zscale-passthrough
new file mode 100644
index 0000000000..8211e8b127
--- /dev/null
+++ b/tests/ref/fate/filter-zscale-passthrough
@@ -0,0 +1,4 @@
+frame|color_primaries=bt470bg|color_transfer=smpte170m
+frame|color_primaries=bt470bg|color_transfer=smpte170m
+frame|color_primaries=bt470bg|color_transfer=smpte170m
+frame|color_primaries=bt470bg|color_transfer=smpte170m