Commit 5e2dcde72d for ffmpeg

commit 5e2dcde72d4e6cea423298eba213e513b3d2a7b1
Author: Zhao Zhili <quinkblack@foxmail.com>
Date:   Mon Mar 2 00:41:04 2026 +0800

    avfilter/vf_scale_cuda: add FATE tests for YUV/RGB conversion

    Add CUDA hardware-accelerated FATE tests for scale_cuda YUV<->RGB
    color conversion, covering 8 and 10-bit formats in both directions,
    tagged and full range input, round trips, hardware cropping and odd
    frame sizes. As they require a CUDA GPU, they are part of fate-hw:
      make fate-hw
      make fate-filter-scale_cuda

    Co-authored-by: Timo Rothenpieler <timo@rothenpieler.org>
    Co-authored-by: Reinhard Nißl <rnissl@gmx.de>
    Assisted-By: Claude Opus 5.5

diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index ebbc0a7d1c..dcb3c0da92 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -1016,6 +1016,78 @@ FATE_FFMPEG += $(FATE_FILTER-yes)

 FATE-$(CONFIG_AVFILTER) += $(FATE_LIBAVFILTER-yes)

+# scale_cuda filter tests (YUV<->RGB color space conversion)
+# These require a CUDA capable GPU, so they are only run as part of fate-hw
+# or when requested directly with make fate-filter-scale_cuda.
+SCALE_CUDA_FILTERS = SCALE_CUDA HWUPLOAD_CUDA HWDOWNLOAD FORMAT TESTSRC2 SETPARAMS CROP
+
+sc_yuv_rgb   = format=$(1),hwupload_cuda,scale_cuda=format=$(2),hwdownload,format=$(2)
+sc_rgb_yuv   = format=$(1),hwupload_cuda,scale_cuda=format=$(2):out_range=limited,hwdownload,format=$(2)
+sc_roundtrip = format=$(1),hwupload_cuda,scale_cuda=format=$(2),scale_cuda=format=$(3):out_range=limited,hwdownload,format=$(3)
+
+FATE_SCALE_CUDA_YUV_RGB := $(addprefix fate-filter-scale_cuda-, nv12-bgra yuv420p-bgra p010-bgra yuv444p-bgra nv12-rgba)
+FATE_SCALE_CUDA_RGB_YUV := $(addprefix fate-filter-scale_cuda-, bgra-nv12 bgra-yuv420p bgra-p010 rgba-nv12)
+FATE_SCALE_CUDA_SPECIAL := $(addprefix fate-filter-scale_cuda-, nv12-bgra-bt709 nv12-bgra-full roundtrip-nv12 roundtrip-yuv444p nv12-nv12-scale \
+                                                               auto-bgra-nv12 roundtrip-nv12-auto roundtrip-nv12-center \
+                                                               crop-nv12-bgra crop-bgra-nv12 nv12-bgra-full-gbr roundtrip-nv12-bt709)
+FATE_SCALE_CUDA_ODD_RGB := $(addprefix fate-filter-scale_cuda-, odd-bgra-nv12 odd-bgra-yuv420p)
+FATE_SCALE_CUDA_ODD_YUV := $(addprefix fate-filter-scale_cuda-, odd-nv12-bgra odd-yuv420p-bgra)
+
+FATE_SCALE_CUDA := $(FATE_SCALE_CUDA_YUV_RGB) $(FATE_SCALE_CUDA_RGB_YUV) $(FATE_SCALE_CUDA_SPECIAL) \
+                   $(FATE_SCALE_CUDA_ODD_RGB) $(FATE_SCALE_CUDA_ODD_YUV)
+
+FATE_SCALE_CUDA-$(call FILTERFRAMECRC, $(SCALE_CUDA_FILTERS), FFMPEG) := $(FATE_SCALE_CUDA)
+
+$(FATE_SCALE_CUDA-yes): CMD = framecrc -lavfi "testsrc2=s=$(SIZE),$(LAVFI)" -frames:v 5
+
+$(FATE_SCALE_CUDA_YUV_RGB) $(FATE_SCALE_CUDA_RGB_YUV) $(FATE_SCALE_CUDA_SPECIAL): SIZE = 160x120
+$(FATE_SCALE_CUDA_ODD_RGB): SIZE = 161x121
+# testsrc2 rounds subsampled YUV sizes down, so crop exactly to 161x121 instead.
+$(FATE_SCALE_CUDA_ODD_YUV): SIZE = 162x122
+
+fate-filter-scale_cuda-nv12-bgra:    LAVFI = $(call sc_yuv_rgb,nv12,bgra)
+fate-filter-scale_cuda-yuv420p-bgra: LAVFI = $(call sc_yuv_rgb,yuv420p,bgra)
+fate-filter-scale_cuda-p010-bgra:    LAVFI = $(call sc_yuv_rgb,p010,bgra)
+fate-filter-scale_cuda-yuv444p-bgra: LAVFI = $(call sc_yuv_rgb,yuv444p,bgra)
+fate-filter-scale_cuda-nv12-rgba:    LAVFI = $(call sc_yuv_rgb,nv12,rgba)
+
+fate-filter-scale_cuda-bgra-nv12:    LAVFI = $(call sc_rgb_yuv,bgra,nv12)
+fate-filter-scale_cuda-bgra-yuv420p: LAVFI = $(call sc_rgb_yuv,bgra,yuv420p)
+fate-filter-scale_cuda-bgra-p010:    LAVFI = $(call sc_rgb_yuv,bgra,p010)
+fate-filter-scale_cuda-rgba-nv12:    LAVFI = $(call sc_rgb_yuv,rgba,nv12)
+
+fate-filter-scale_cuda-nv12-bgra-bt709: LAVFI = format=nv12,setparams=colorspace=bt709:range=tv,hwupload_cuda,scale_cuda=format=bgra,hwdownload,format=bgra
+fate-filter-scale_cuda-nv12-bgra-full: LAVFI = format=bgra,hwupload_cuda,scale_cuda=format=nv12:out_range=full,scale_cuda=format=bgra,hwdownload,format=bgra
+
+fate-filter-scale_cuda-roundtrip-nv12: LAVFI = $(call sc_roundtrip,nv12,bgra,nv12)
+fate-filter-scale_cuda-roundtrip-yuv444p: LAVFI = format=bgra,hwupload_cuda,scale_cuda=format=yuv444p:out_range=limited,scale_cuda=format=bgra,hwdownload,format=bgra
+fate-filter-scale_cuda-nv12-nv12-scale: LAVFI = format=nv12,hwupload_cuda,scale_cuda=w=320:h=240:format=nv12,hwdownload,format=nv12
+
+# An RGB tag on the input must not leak into the YUV link read by the next instance.
+fate-filter-scale_cuda-nv12-bgra-full-gbr: LAVFI = format=bgra,hwupload_cuda,setparams=colorspace=gbr,scale_cuda=format=nv12:out_range=full,scale_cuda=format=bgra,hwdownload,format=bgra
+# Without out_range and out_color_matrix, RGB->YUV defaults to BT.601 limited range,
+# also when converting back from RGB that was converted from YUV.
+fate-filter-scale_cuda-auto-bgra-nv12: LAVFI = format=bgra,hwupload_cuda,scale_cuda=format=nv12,hwdownload,format=nv12
+fate-filter-scale_cuda-roundtrip-nv12-auto: LAVFI = format=nv12,hwupload_cuda,scale_cuda=format=bgra,scale_cuda=format=nv12,hwdownload,format=nv12
+# Converting to RGB drops the chroma location, so converting back can produce the requested centered chroma.
+fate-filter-scale_cuda-roundtrip-nv12-center: LAVFI = format=nv12,setparams=chroma_location=left,hwupload_cuda,scale_cuda=format=bgra,scale_cuda=format=nv12,hwdownload,format=nv12:chroma_locations=center
+fate-filter-scale_cuda-roundtrip-nv12-bt709: LAVFI = format=nv12,setparams=colorspace=bt709:range=tv,hwupload_cuda,scale_cuda=format=bgra,scale_cuda=format=nv12:out_color_matrix=bt709:out_range=limited,hwdownload,format=nv12
+
+# Hardware crop keeps the link size, so the visible size is passed explicitly.
+fate-filter-scale_cuda-crop-nv12-bgra: LAVFI = format=nv12,hwupload_cuda,crop=96:64:16:8,scale_cuda=96:64:format=bgra,hwdownload,format=bgra
+fate-filter-scale_cuda-crop-bgra-nv12: LAVFI = format=bgra,hwupload_cuda,crop=96:64:16:8,scale_cuda=96:64:format=nv12:out_range=limited,hwdownload,format=nv12
+
+fate-filter-scale_cuda-odd-bgra-nv12:    LAVFI = $(call sc_rgb_yuv,bgra,nv12)
+fate-filter-scale_cuda-odd-bgra-yuv420p: LAVFI = $(call sc_rgb_yuv,bgra,yuv420p)
+fate-filter-scale_cuda-odd-nv12-bgra:    LAVFI = format=nv12,crop=161:121:0:0:exact=1,hwupload_cuda,scale_cuda=format=bgra,hwdownload,format=bgra
+fate-filter-scale_cuda-odd-yuv420p-bgra: LAVFI = format=yuv420p,crop=161:121:0:0:exact=1,hwupload_cuda,scale_cuda=format=bgra,hwdownload,format=bgra
+
+FATE_HW-yes += $(FATE_SCALE_CUDA-yes)
+
+$(FATE_SCALE_CUDA-yes): $(FFMPEG)
+
+fate-filter-scale_cuda: $(FATE_SCALE_CUDA-yes)
+
 fate-vfilter: $(FATE_FILTER-yes) $(FATE_FILTER_SAMPLES-yes) $(FATE_FILTER_VSYNTH-yes) $(FATE_LIBAVFILTER-yes)

 fate-filter: fate-afilter fate-vfilter $(FATE_METADATA_FILTER-yes) $(FATE_FILTER_FFPROBE-yes)
diff --git a/tests/ref/fate/filter-scale_cuda-auto-bgra-nv12 b/tests/ref/fate/filter-scale_cuda-auto-bgra-nv12
new file mode 100644
index 0000000000..356f15e1de
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-auto-bgra-nv12
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 160x120
+#sar 0: 1/1
+0,          0,          0,        1,    28800, 0xe07afcc1
+0,          1,          1,        1,    28800, 0x3442f609
+0,          2,          2,        1,    28800, 0x67fefe95
+0,          3,          3,        1,    28800, 0x1865f1d5
+0,          4,          4,        1,    28800, 0x4381f390
diff --git a/tests/ref/fate/filter-scale_cuda-bgra-nv12 b/tests/ref/fate/filter-scale_cuda-bgra-nv12
new file mode 100644
index 0000000000..356f15e1de
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-bgra-nv12
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 160x120
+#sar 0: 1/1
+0,          0,          0,        1,    28800, 0xe07afcc1
+0,          1,          1,        1,    28800, 0x3442f609
+0,          2,          2,        1,    28800, 0x67fefe95
+0,          3,          3,        1,    28800, 0x1865f1d5
+0,          4,          4,        1,    28800, 0x4381f390
diff --git a/tests/ref/fate/filter-scale_cuda-bgra-p010 b/tests/ref/fate/filter-scale_cuda-bgra-p010
new file mode 100644
index 0000000000..7d06390a98
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-bgra-p010
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 160x120
+#sar 0: 1/1
+0,          0,          0,        1,    57600, 0x6fbb0d63
+0,          1,          1,        1,    57600, 0x60a0233d
+0,          2,          2,        1,    57600, 0x32e1bcd3
+0,          3,          3,        1,    57600, 0xca98b8a8
+0,          4,          4,        1,    57600, 0xb164a9c3
diff --git a/tests/ref/fate/filter-scale_cuda-bgra-yuv420p b/tests/ref/fate/filter-scale_cuda-bgra-yuv420p
new file mode 100644
index 0000000000..0c04668d7d
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-bgra-yuv420p
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 160x120
+#sar 0: 1/1
+0,          0,          0,        1,    28800, 0xac0efcc1
+0,          1,          1,        1,    28800, 0x4d54f609
+0,          2,          2,        1,    28800, 0x297ffe95
+0,          3,          3,        1,    28800, 0x2d2df1d5
+0,          4,          4,        1,    28800, 0xc5b8f390
diff --git a/tests/ref/fate/filter-scale_cuda-crop-bgra-nv12 b/tests/ref/fate/filter-scale_cuda-crop-bgra-nv12
new file mode 100644
index 0000000000..1ae029ef0b
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-crop-bgra-nv12
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 96x64
+#sar 0: 1/1
+0,          0,          0,        1,     9216, 0x9197a77a
+0,          1,          1,        1,     9216, 0xe5d29b72
+0,          2,          2,        1,     9216, 0x6ad99aa5
+0,          3,          3,        1,     9216, 0xf2138997
+0,          4,          4,        1,     9216, 0x1a06867d
diff --git a/tests/ref/fate/filter-scale_cuda-crop-nv12-bgra b/tests/ref/fate/filter-scale_cuda-crop-nv12-bgra
new file mode 100644
index 0000000000..8e9d326be3
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-crop-nv12-bgra
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 96x64
+#sar 0: 1/1
+0,          0,          0,        1,    24576, 0x7071c113
+0,          1,          1,        1,    24576, 0xc378a7e8
+0,          2,          2,        1,    24576, 0xd6d9b0cb
+0,          3,          3,        1,    24576, 0xbbfc8d15
+0,          4,          4,        1,    24576, 0x196888ce
diff --git a/tests/ref/fate/filter-scale_cuda-nv12-bgra b/tests/ref/fate/filter-scale_cuda-nv12-bgra
new file mode 100644
index 0000000000..d67d3fdb24
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-nv12-bgra
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 160x120
+#sar 0: 1/1
+0,          0,          0,        1,    76800, 0x1bad7907
+0,          1,          1,        1,    76800, 0x9bd3774d
+0,          2,          2,        1,    76800, 0xa1129eee
+0,          3,          3,        1,    76800, 0x04458f95
+0,          4,          4,        1,    76800, 0xc1ca9de7
diff --git a/tests/ref/fate/filter-scale_cuda-nv12-bgra-bt709 b/tests/ref/fate/filter-scale_cuda-nv12-bgra-bt709
new file mode 100644
index 0000000000..a8831d3ead
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-nv12-bgra-bt709
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 160x120
+#sar 0: 1/1
+0,          0,          0,        1,    76800, 0x5a8fe7c7
+0,          1,          1,        1,    76800, 0xa05ee72f
+0,          2,          2,        1,    76800, 0xbd650e8a
+0,          3,          3,        1,    76800, 0xa9c0052e
+0,          4,          4,        1,    76800, 0xb9c81713
diff --git a/tests/ref/fate/filter-scale_cuda-nv12-bgra-full b/tests/ref/fate/filter-scale_cuda-nv12-bgra-full
new file mode 100644
index 0000000000..5034af2d60
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-nv12-bgra-full
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 160x120
+#sar 0: 1/1
+0,          0,          0,        1,    76800, 0x96fe1b0f
+0,          1,          1,        1,    76800, 0xf7ea14f9
+0,          2,          2,        1,    76800, 0x9c843b5a
+0,          3,          3,        1,    76800, 0xf0ce2d83
+0,          4,          4,        1,    76800, 0x59ed3ceb
diff --git a/tests/ref/fate/filter-scale_cuda-nv12-bgra-full-gbr b/tests/ref/fate/filter-scale_cuda-nv12-bgra-full-gbr
new file mode 100644
index 0000000000..5034af2d60
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-nv12-bgra-full-gbr
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 160x120
+#sar 0: 1/1
+0,          0,          0,        1,    76800, 0x96fe1b0f
+0,          1,          1,        1,    76800, 0xf7ea14f9
+0,          2,          2,        1,    76800, 0x9c843b5a
+0,          3,          3,        1,    76800, 0xf0ce2d83
+0,          4,          4,        1,    76800, 0x59ed3ceb
diff --git a/tests/ref/fate/filter-scale_cuda-nv12-nv12-scale b/tests/ref/fate/filter-scale_cuda-nv12-nv12-scale
new file mode 100644
index 0000000000..939c2997d2
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-nv12-nv12-scale
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 320x240
+#sar 0: 1/1
+0,          0,          0,        1,   115200, 0x59730662
+0,          1,          1,        1,   115200, 0x6ca8ee33
+0,          2,          2,        1,   115200, 0xa1fd11f9
+0,          3,          3,        1,   115200, 0x6e29e275
+0,          4,          4,        1,   115200, 0xf6e8e5ba
diff --git a/tests/ref/fate/filter-scale_cuda-nv12-rgba b/tests/ref/fate/filter-scale_cuda-nv12-rgba
new file mode 100644
index 0000000000..c6ae2055db
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-nv12-rgba
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 160x120
+#sar 0: 1/1
+0,          0,          0,        1,    76800, 0xe9ea7907
+0,          1,          1,        1,    76800, 0xf7fc774d
+0,          2,          2,        1,    76800, 0xe2c39eee
+0,          3,          3,        1,    76800, 0xa9598f95
+0,          4,          4,        1,    76800, 0x32359de7
diff --git a/tests/ref/fate/filter-scale_cuda-odd-bgra-nv12 b/tests/ref/fate/filter-scale_cuda-odd-bgra-nv12
new file mode 100644
index 0000000000..b93db9d358
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-odd-bgra-nv12
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 161x121
+#sar 0: 1/1
+0,          0,          0,        1,    29363, 0x031a1e9b
+0,          1,          1,        1,    29363, 0x145716f8
+0,          2,          2,        1,    29363, 0xf9952059
+0,          3,          3,        1,    29363, 0xe20b11e3
+0,          4,          4,        1,    29363, 0xb65e14bd
diff --git a/tests/ref/fate/filter-scale_cuda-odd-bgra-yuv420p b/tests/ref/fate/filter-scale_cuda-odd-bgra-yuv420p
new file mode 100644
index 0000000000..cfde71820b
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-odd-bgra-yuv420p
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 161x121
+#sar 0: 1/1
+0,          0,          0,        1,    29363, 0x92691e9b
+0,          1,          1,        1,    29363, 0x707a16f8
+0,          2,          2,        1,    29363, 0x881c2059
+0,          3,          3,        1,    29363, 0x759911e3
+0,          4,          4,        1,    29363, 0x6e5314bd
diff --git a/tests/ref/fate/filter-scale_cuda-odd-nv12-bgra b/tests/ref/fate/filter-scale_cuda-odd-nv12-bgra
new file mode 100644
index 0000000000..28e115622a
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-odd-nv12-bgra
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 161x121
+#sar 0: 1/1
+0,          0,          0,        1,    77924, 0xdef20a0d
+0,          1,          1,        1,    77924, 0x24520aa7
+0,          2,          2,        1,    77924, 0x75683129
+0,          3,          3,        1,    77924, 0x08c820ae
+0,          4,          4,        1,    77924, 0x64e932d1
diff --git a/tests/ref/fate/filter-scale_cuda-odd-yuv420p-bgra b/tests/ref/fate/filter-scale_cuda-odd-yuv420p-bgra
new file mode 100644
index 0000000000..28e115622a
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-odd-yuv420p-bgra
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 161x121
+#sar 0: 1/1
+0,          0,          0,        1,    77924, 0xdef20a0d
+0,          1,          1,        1,    77924, 0x24520aa7
+0,          2,          2,        1,    77924, 0x75683129
+0,          3,          3,        1,    77924, 0x08c820ae
+0,          4,          4,        1,    77924, 0x64e932d1
diff --git a/tests/ref/fate/filter-scale_cuda-p010-bgra b/tests/ref/fate/filter-scale_cuda-p010-bgra
new file mode 100644
index 0000000000..e855f7d700
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-p010-bgra
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 160x120
+#sar 0: 1/1
+0,          0,          0,        1,    76800, 0x3c5fd1a5
+0,          1,          1,        1,    76800, 0x42cad0ba
+0,          2,          2,        1,    76800, 0x0084f803
+0,          3,          3,        1,    76800, 0x9db5eaac
+0,          4,          4,        1,    76800, 0xadf0f8bd
diff --git a/tests/ref/fate/filter-scale_cuda-rgba-nv12 b/tests/ref/fate/filter-scale_cuda-rgba-nv12
new file mode 100644
index 0000000000..356f15e1de
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-rgba-nv12
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 160x120
+#sar 0: 1/1
+0,          0,          0,        1,    28800, 0xe07afcc1
+0,          1,          1,        1,    28800, 0x3442f609
+0,          2,          2,        1,    28800, 0x67fefe95
+0,          3,          3,        1,    28800, 0x1865f1d5
+0,          4,          4,        1,    28800, 0x4381f390
diff --git a/tests/ref/fate/filter-scale_cuda-roundtrip-nv12 b/tests/ref/fate/filter-scale_cuda-roundtrip-nv12
new file mode 100644
index 0000000000..ed810379e2
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-roundtrip-nv12
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 160x120
+#sar 0: 1/1
+0,          0,          0,        1,    28800, 0x5d58cb67
+0,          1,          1,        1,    28800, 0x9c84c57a
+0,          2,          2,        1,    28800, 0xda77cf55
+0,          3,          3,        1,    28800, 0x07cfc371
+0,          4,          4,        1,    28800, 0xe1fcc3c9
diff --git a/tests/ref/fate/filter-scale_cuda-roundtrip-nv12-auto b/tests/ref/fate/filter-scale_cuda-roundtrip-nv12-auto
new file mode 100644
index 0000000000..ed810379e2
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-roundtrip-nv12-auto
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 160x120
+#sar 0: 1/1
+0,          0,          0,        1,    28800, 0x5d58cb67
+0,          1,          1,        1,    28800, 0x9c84c57a
+0,          2,          2,        1,    28800, 0xda77cf55
+0,          3,          3,        1,    28800, 0x07cfc371
+0,          4,          4,        1,    28800, 0xe1fcc3c9
diff --git a/tests/ref/fate/filter-scale_cuda-roundtrip-nv12-bt709 b/tests/ref/fate/filter-scale_cuda-roundtrip-nv12-bt709
new file mode 100644
index 0000000000..4b30aab3a1
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-roundtrip-nv12-bt709
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 160x120
+#sar 0: 1/1
+0,          0,          0,        1,    28800, 0x2718c59e
+0,          1,          1,        1,    28800, 0xd8b2bed6
+0,          2,          2,        1,    28800, 0x1aadc7f7
+0,          3,          3,        1,    28800, 0xe89abbde
+0,          4,          4,        1,    28800, 0x56b4bb5b
diff --git a/tests/ref/fate/filter-scale_cuda-roundtrip-nv12-center b/tests/ref/fate/filter-scale_cuda-roundtrip-nv12-center
new file mode 100644
index 0000000000..ed810379e2
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-roundtrip-nv12-center
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 160x120
+#sar 0: 1/1
+0,          0,          0,        1,    28800, 0x5d58cb67
+0,          1,          1,        1,    28800, 0x9c84c57a
+0,          2,          2,        1,    28800, 0xda77cf55
+0,          3,          3,        1,    28800, 0x07cfc371
+0,          4,          4,        1,    28800, 0xe1fcc3c9
diff --git a/tests/ref/fate/filter-scale_cuda-roundtrip-yuv444p b/tests/ref/fate/filter-scale_cuda-roundtrip-yuv444p
new file mode 100644
index 0000000000..6a148c13d7
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-roundtrip-yuv444p
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 160x120
+#sar 0: 1/1
+0,          0,          0,        1,    76800, 0x4e8ef7dd
+0,          1,          1,        1,    76800, 0xf1dbefed
+0,          2,          2,        1,    76800, 0xc70a13f4
+0,          3,          3,        1,    76800, 0xc6f40342
+0,          4,          4,        1,    76800, 0x0fcd185a
diff --git a/tests/ref/fate/filter-scale_cuda-yuv420p-bgra b/tests/ref/fate/filter-scale_cuda-yuv420p-bgra
new file mode 100644
index 0000000000..d67d3fdb24
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-yuv420p-bgra
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 160x120
+#sar 0: 1/1
+0,          0,          0,        1,    76800, 0x1bad7907
+0,          1,          1,        1,    76800, 0x9bd3774d
+0,          2,          2,        1,    76800, 0xa1129eee
+0,          3,          3,        1,    76800, 0x04458f95
+0,          4,          4,        1,    76800, 0xc1ca9de7
diff --git a/tests/ref/fate/filter-scale_cuda-yuv444p-bgra b/tests/ref/fate/filter-scale_cuda-yuv444p-bgra
new file mode 100644
index 0000000000..d63ba75de2
--- /dev/null
+++ b/tests/ref/fate/filter-scale_cuda-yuv444p-bgra
@@ -0,0 +1,10 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 160x120
+#sar 0: 1/1
+0,          0,          0,        1,    76800, 0x69e7f5cb
+0,          1,          1,        1,    76800, 0x7ac4ee0e
+0,          2,          2,        1,    76800, 0x3f87122e
+0,          3,          3,        1,    76800, 0xf16001a9
+0,          4,          4,        1,    76800, 0xde7116af