[FFmpeg-cvslog] avfilter/vsrc_testsrc: use the alpha component information for XV3{0,6} and V30X

James Almer git at videolan.org
Mon Oct 21 16:01:07 EEST 2024


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Thu Oct 17 13:29:56 2024 -0300| [8debc5aa417dbc920aa71dd9d74d78a746025780] | committer: James Almer

avfilter/vsrc_testsrc: use the alpha component information for XV3{0,6} and V30X

And add a few more tests to ensure all the pixfmts affected by this change
are tested.

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8debc5aa417dbc920aa71dd9d74d78a746025780
---

 libavfilter/vsrc_testsrc.c              |  7 ++-----
 tests/fate/filter-video.mak             |  6 ++++++
 tests/ref/fate/filter-yuvtestsrc-ayuv64 | 10 ++++++++++
 tests/ref/fate/filter-yuvtestsrc-v30xle | 10 ++++++++++
 4 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index 6fd8c73757..ce7ca90ae8 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -1159,7 +1159,6 @@ static void yuvtest_put_pixel(uint8_t *dstp[4], int dst_linesizep[4],
                               uint8_t ayuv_map[4])
 {
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt);
-    int shift = 0;
     uint32_t n;
 
     switch (fmt) {
@@ -1172,17 +1171,15 @@ static void yuvtest_put_pixel(uint8_t *dstp[4], int dst_linesizep[4],
         n = (y << ((desc->comp[0].offset*8) + desc->comp[0].shift)) +
             (u << ((desc->comp[1].offset*8) + desc->comp[1].shift)) +
             (v << ((desc->comp[2].offset*8) + desc->comp[2].shift)) +
-            (3U << (desc->comp[1].shift ? 0 : 30));
+            (3U << ((desc->comp[3].offset*8) + desc->comp[3].shift));
         AV_WL32(&dstp[0][i*4 + j*dst_linesizep[0]], n);
         break;
     case AV_PIX_FMT_XV36:
-        shift = 4; // hardcoded as the alpha component in the descriptor has no values we can use
-    // fall-through
     case AV_PIX_FMT_AYUV64:
         AV_WN16(&dstp[0][i*8 + ayuv_map[Y]*2 + j*dst_linesizep[0]], y << desc->comp[0].shift);
         AV_WN16(&dstp[0][i*8 + ayuv_map[U]*2 + j*dst_linesizep[0]], u << desc->comp[1].shift);
         AV_WN16(&dstp[0][i*8 + ayuv_map[V]*2 + j*dst_linesizep[0]], v << desc->comp[2].shift);
-        AV_WN16(&dstp[0][i*8 + ayuv_map[A]*2 + j*dst_linesizep[0]], UINT16_MAX <<      shift);
+        AV_WN16(&dstp[0][i*8 + ayuv_map[A]*2 + j*dst_linesizep[0]], UINT16_MAX << desc->comp[3].shift);
         break;
     case AV_PIX_FMT_UYVA:
     case AV_PIX_FMT_VUYA:
diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index 47ff106062..8036d692b4 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -115,12 +115,18 @@ fate-filter-yuvtestsrc-yuv444p12: CMD = framecrc -lavfi yuvtestsrc=rate=5:durati
 FATE_FILTER-$(call FILTERFRAMECRC, YUVTESTSRC) += fate-filter-yuvtestsrc-ayuv
 fate-filter-yuvtestsrc-ayuv: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration=1 -pix_fmt ayuv
 
+FATE_FILTER-$(call FILTERFRAMECRC, YUVTESTSRC SCALE) += fate-filter-yuvtestsrc-ayuv64
+fate-filter-yuvtestsrc-ayuv64: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration=1,format=ayuv64,scale -pix_fmt ayuv64le
+
 FATE_FILTER-$(call FILTERFRAMECRC, YUVTESTSRC) += fate-filter-yuvtestsrc-vuya
 fate-filter-yuvtestsrc-vuya: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration=1 -pix_fmt vuya
 
 FATE_FILTER-$(call FILTERFRAMECRC, YUVTESTSRC) += fate-filter-yuvtestsrc-vyu444
 fate-filter-yuvtestsrc-vyu444: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration=1 -pix_fmt vyu444
 
+FATE_FILTER-$(call FILTERFRAMECRC, YUVTESTSRC) += fate-filter-yuvtestsrc-v30xle
+fate-filter-yuvtestsrc-v30xle: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration=1 -pix_fmt v30xle
+
 FATE_FILTER-$(call FILTERFRAMECRC, YUVTESTSRC) += fate-filter-yuvtestsrc-xv30le
 fate-filter-yuvtestsrc-xv30le: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration=1 -pix_fmt xv30le
 
diff --git a/tests/ref/fate/filter-yuvtestsrc-ayuv64 b/tests/ref/fate/filter-yuvtestsrc-ayuv64
new file mode 100644
index 0000000000..942ad1a1ba
--- /dev/null
+++ b/tests/ref/fate/filter-yuvtestsrc-ayuv64
@@ -0,0 +1,10 @@
+#tb 0: 1/5
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 320x240
+#sar 0: 1/1
+0,          0,          0,        1,   614400, 0xcf4f8452
+0,          1,          1,        1,   614400, 0xcf4f8452
+0,          2,          2,        1,   614400, 0xcf4f8452
+0,          3,          3,        1,   614400, 0xcf4f8452
+0,          4,          4,        1,   614400, 0xcf4f8452
diff --git a/tests/ref/fate/filter-yuvtestsrc-v30xle b/tests/ref/fate/filter-yuvtestsrc-v30xle
new file mode 100644
index 0000000000..bac805079c
--- /dev/null
+++ b/tests/ref/fate/filter-yuvtestsrc-v30xle
@@ -0,0 +1,10 @@
+#tb 0: 1/5
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 320x240
+#sar 0: 1/1
+0,          0,          0,        1,   307200, 0x9b712266
+0,          1,          1,        1,   307200, 0x9b712266
+0,          2,          2,        1,   307200, 0x9b712266
+0,          3,          3,        1,   307200, 0x9b712266
+0,          4,          4,        1,   307200, 0x9b712266



More information about the ffmpeg-cvslog mailing list