[FFmpeg-devel] [PATCH 2/2] avfilter/vsrc_testsrc: use the alpha component information for XV3{0, 6} and V30X
James Almer
jamrial at gmail.com
Thu Oct 17 19:31:37 EEST 2024
Signed-off-by: James Almer <jamrial at gmail.com>
---
libavfilter/vsrc_testsrc.c | 7 ++-----
1 file changed, 2 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:
--
2.47.0
More information about the ffmpeg-devel
mailing list