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@gmail.com>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
James Almer 2024-10-17 13:29:56 -03:00 committed by Paul B Mahol
parent fb9ac36bf6
commit 5c2be4b256
4 changed files with 28 additions and 5 deletions

View File

@ -1162,7 +1162,6 @@ static void yuvtest_put_pixel(uint8_t *dstp[4], int dst_linesizep[4],
uint8_t ayuv_map[4]) uint8_t ayuv_map[4])
{ {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt);
int shift = 0;
uint32_t n; uint32_t n;
switch (fmt) { switch (fmt) {
@ -1175,17 +1174,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)) + n = (y << ((desc->comp[0].offset*8) + desc->comp[0].shift)) +
(u << ((desc->comp[1].offset*8) + desc->comp[1].shift)) + (u << ((desc->comp[1].offset*8) + desc->comp[1].shift)) +
(v << ((desc->comp[2].offset*8) + desc->comp[2].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); AV_WL32(&dstp[0][i*4 + j*dst_linesizep[0]], n);
break; break;
case AV_PIX_FMT_XV36: 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: 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[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[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[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; break;
case AV_PIX_FMT_UYVA: case AV_PIX_FMT_UYVA:
case AV_PIX_FMT_VUYA: case AV_PIX_FMT_VUYA:

View File

@ -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-$(call FILTERFRAMECRC, YUVTESTSRC) += fate-filter-yuvtestsrc-ayuv
fate-filter-yuvtestsrc-ayuv: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration=1 -pix_fmt 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-$(call FILTERFRAMECRC, YUVTESTSRC) += fate-filter-yuvtestsrc-vuya
fate-filter-yuvtestsrc-vuya: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration=1 -pix_fmt 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-$(call FILTERFRAMECRC, YUVTESTSRC) += fate-filter-yuvtestsrc-vyu444
fate-filter-yuvtestsrc-vyu444: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration=1 -pix_fmt 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-$(call FILTERFRAMECRC, YUVTESTSRC) += fate-filter-yuvtestsrc-xv30le
fate-filter-yuvtestsrc-xv30le: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration=1 -pix_fmt xv30le fate-filter-yuvtestsrc-xv30le: CMD = framecrc -lavfi yuvtestsrc=rate=5:duration=1 -pix_fmt xv30le

View File

@ -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

View File

@ -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