vsrc_testsrc: add support for x2rgb10le to rgbtestsrc

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2024-10-30 10:20:19 -03:00
parent 78ba06928a
commit 165f124129
1 changed files with 11 additions and 0 deletions

View File

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