From 214251b9ad4b21a982730512a1431e9b355afb4d Mon Sep 17 00:00:00 2001 From: James Almer Date: Tue, 15 Oct 2024 14:50:38 -0300 Subject: [PATCH] avfilter/vsrc_testsrc: add support for XV36 and AYUV64 Signed-off-by: James Almer Signed-off-by: Paul B Mahol --- libavfilter/vsrc_testsrc.c | 14 ++++++++++++-- tests/fate/filter-video.mak | 3 +++ tests/ref/fate/filter-yuvtestsrc-xv36 | 10 ++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 tests/ref/fate/filter-yuvtestsrc-xv36 diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c index 8fd885b53e..c8461ca5b1 100644 --- a/libavfilter/vsrc_testsrc.c +++ b/libavfilter/vsrc_testsrc.c @@ -1162,6 +1162,7 @@ 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) { @@ -1176,6 +1177,15 @@ static void yuvtest_put_pixel(uint8_t *dstp[4], int dst_linesizep[4], (v << ((desc->comp[2].offset*8) + desc->comp[2].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); + break; case AV_PIX_FMT_UYVA: case AV_PIX_FMT_VUYA: case AV_PIX_FMT_VUYX: @@ -1238,9 +1248,9 @@ static const enum AVPixelFormat yuvtest_pix_fmts[] = { AV_PIX_FMT_YUV444P9, AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUV444P12, AV_PIX_FMT_YUV444P14, AV_PIX_FMT_YUV444P16, AV_PIX_FMT_VYU444, - AV_PIX_FMT_AYUV, AV_PIX_FMT_UYVA, + AV_PIX_FMT_AYUV, AV_PIX_FMT_UYVA, AV_PIX_FMT_AYUV64, AV_PIX_FMT_VUYA, AV_PIX_FMT_VUYX, - AV_PIX_FMT_XV30LE, AV_PIX_FMT_V30XLE, + AV_PIX_FMT_XV30LE, AV_PIX_FMT_V30XLE, AV_PIX_FMT_XV36, AV_PIX_FMT_NONE }; diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak index e6612bd407..24feb70fe8 100644 --- a/tests/fate/filter-video.mak +++ b/tests/fate/filter-video.mak @@ -124,6 +124,9 @@ fate-filter-yuvtestsrc-vyu444: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration= FATE_FILTER-$(call FILTERFRAMECRC, YUVTESTSRC) += fate-filter-yuvtestsrc-xv30le fate-filter-yuvtestsrc-xv30le: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration=1 -pix_fmt xv30le +FATE_FILTER-$(call FILTERFRAMECRC, YUVTESTSRC SCALE) += fate-filter-yuvtestsrc-xv36 +fate-filter-yuvtestsrc-xv36: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration=1,format=xv36,scale -pix_fmt xv36le + FATE_FILTER-$(call FILTERFRAMECRC, TESTSRC FORMAT CONCAT SCALE, LAVFI_INDEV FILE_PROTOCOL) += fate-filter-lavd-scalenorm fate-filter-lavd-scalenorm: tests/data/filtergraphs/scalenorm fate-filter-lavd-scalenorm: CMD = framecrc -f lavfi -graph_file $(TARGET_PATH)/tests/data/filtergraphs/scalenorm -i dummy diff --git a/tests/ref/fate/filter-yuvtestsrc-xv36 b/tests/ref/fate/filter-yuvtestsrc-xv36 new file mode 100644 index 0000000000..16c24b80f8 --- /dev/null +++ b/tests/ref/fate/filter-yuvtestsrc-xv36 @@ -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, 0xdadee6db +0, 1, 1, 1, 614400, 0xdadee6db +0, 2, 2, 1, 614400, 0xdadee6db +0, 3, 3, 1, 614400, 0xdadee6db +0, 4, 4, 1, 614400, 0xdadee6db