From 165f1241299c4f43c15baa6baddd4e96aefed5a7 Mon Sep 17 00:00:00 2001 From: James Almer Date: Wed, 30 Oct 2024 10:20:19 -0300 Subject: [PATCH] vsrc_testsrc: add support for x2rgb10le to rgbtestsrc Signed-off-by: James Almer --- libavfilter/vsrc_testsrc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c index e3e076e878..1342f63d25 100644 --- a/libavfilter/vsrc_testsrc.c +++ b/libavfilter/vsrc_testsrc.c @@ -996,6 +996,7 @@ static void rgbtest_put_pixel(uint8_t *dstp[4], int dst_linesizep[4], int x, int y, unsigned r, unsigned g, unsigned b, enum AVPixelFormat fmt, uint8_t rgba_map[4]) { + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt); uint8_t *dst = dstp[0]; ptrdiff_t dst_linesize = dst_linesizep[0]; uint32_t v; @@ -1023,6 +1024,15 @@ static void rgbtest_put_pixel(uint8_t *dstp[4], int dst_linesizep[4], p = dst + 4*x + y*dst_linesize; AV_WL32(p, v); break; + case AV_PIX_FMT_X2RGB10LE: + case AV_PIX_FMT_X2BGR10LE: + v = (r << ((desc->comp[0].offset*8) + desc->comp[0].shift)) + + (g << ((desc->comp[1].offset*8) + desc->comp[1].shift)) + + (b << ((desc->comp[2].offset*8) + desc->comp[2].shift)) + + (3U << ((desc->comp[3].offset*8) + desc->comp[3].shift)); + p = dst + 4*x + y*dst_linesize; + AV_WL32(p, v); + break; case AV_PIX_FMT_GBRP: p = dstp[0] + x + y * dst_linesize; p[0] = g; @@ -1106,6 +1116,7 @@ static const enum AVPixelFormat rgbtest_pix_fmts[] = { AV_PIX_FMT_RGB555, AV_PIX_FMT_BGR555, AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16, + AV_PIX_FMT_X2RGB10LE, AV_PIX_FMT_X2BGR10LE, AV_PIX_FMT_NONE };