swscale/output: add full chroma interpolation support for x2rgb10

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2024-10-30 11:47:51 -03:00
parent 430bec8666
commit febc9e8162
3 changed files with 30 additions and 3 deletions

View File

@ -1970,6 +1970,18 @@ static av_always_inline void yuv2rgb_write_full(SwsInternal *c,
dest[2] = R >> 22; dest[2] = R >> 22;
dest[3] = hasAlpha ? A : 255; dest[3] = hasAlpha ? A : 255;
break; break;
case AV_PIX_FMT_X2RGB10LE:
R >>= 20;
G >>= 20;
B >>= 20;
AV_WL32(dest, (3U << 30) + (R << 20) + (G << 10) + B);
break;
case AV_PIX_FMT_X2BGR10LE:
R >>= 20;
G >>= 20;
B >>= 20;
AV_WL32(dest, (3U << 30) + (B << 20) + (G << 10) + R);
break;
case AV_PIX_FMT_BGR4_BYTE: case AV_PIX_FMT_BGR4_BYTE:
case AV_PIX_FMT_RGB4_BYTE: case AV_PIX_FMT_RGB4_BYTE:
case AV_PIX_FMT_BGR8: case AV_PIX_FMT_BGR8:
@ -2242,6 +2254,9 @@ YUV2RGBWRAPPER(yuv2, rgb_full, rgb4_byte_full, AV_PIX_FMT_RGB4_BYTE, 0)
YUV2RGBWRAPPER(yuv2, rgb_full, bgr8_full, AV_PIX_FMT_BGR8, 0) YUV2RGBWRAPPER(yuv2, rgb_full, bgr8_full, AV_PIX_FMT_BGR8, 0)
YUV2RGBWRAPPER(yuv2, rgb_full, rgb8_full, AV_PIX_FMT_RGB8, 0) YUV2RGBWRAPPER(yuv2, rgb_full, rgb8_full, AV_PIX_FMT_RGB8, 0)
YUV2RGBWRAPPER(yuv2, rgb_full, x2rgb10_full, AV_PIX_FMT_X2RGB10LE, 0)
YUV2RGBWRAPPER(yuv2, rgb_full, x2bgr10_full, AV_PIX_FMT_X2BGR10LE, 0)
static void static void
yuv2gbrp_full_X_c(SwsInternal *c, const int16_t *lumFilter, yuv2gbrp_full_X_c(SwsInternal *c, const int16_t *lumFilter,
const int16_t **lumSrc, int lumFilterSize, const int16_t **lumSrc, int lumFilterSize,
@ -3397,6 +3412,16 @@ av_cold void ff_sws_init_output_funcs(SwsInternal *c,
*yuv2packed2 = yuv2rgb8_full_2_c; *yuv2packed2 = yuv2rgb8_full_2_c;
*yuv2packed1 = yuv2rgb8_full_1_c; *yuv2packed1 = yuv2rgb8_full_1_c;
break; break;
case AV_PIX_FMT_X2RGB10LE:
*yuv2packedX = yuv2x2rgb10_full_X_c;
*yuv2packed2 = yuv2x2rgb10_full_2_c;
*yuv2packed1 = yuv2x2rgb10_full_1_c;
break;
case AV_PIX_FMT_X2BGR10LE:
*yuv2packedX = yuv2x2bgr10_full_X_c;
*yuv2packed2 = yuv2x2bgr10_full_2_c;
*yuv2packed1 = yuv2x2bgr10_full_1_c;
break;
case AV_PIX_FMT_GBRP: case AV_PIX_FMT_GBRP:
case AV_PIX_FMT_GBRP9BE: case AV_PIX_FMT_GBRP9BE:
case AV_PIX_FMT_GBRP9LE: case AV_PIX_FMT_GBRP9LE:

View File

@ -1517,7 +1517,9 @@ static av_cold int sws_init_single_context(SwsContext *sws, SwsFilter *srcFilter
dstFormat != AV_PIX_FMT_BGR4_BYTE && dstFormat != AV_PIX_FMT_BGR4_BYTE &&
dstFormat != AV_PIX_FMT_RGB4_BYTE && dstFormat != AV_PIX_FMT_RGB4_BYTE &&
dstFormat != AV_PIX_FMT_BGR8 && dstFormat != AV_PIX_FMT_BGR8 &&
dstFormat != AV_PIX_FMT_RGB8 dstFormat != AV_PIX_FMT_RGB8 &&
dstFormat != AV_PIX_FMT_X2RGB10LE &&
dstFormat != AV_PIX_FMT_X2BGR10LE
) { ) {
av_log(c, AV_LOG_WARNING, av_log(c, AV_LOG_WARNING,
"full chroma interpolation for destination format '%s' not yet implemented\n", "full chroma interpolation for destination format '%s' not yet implemented\n",

View File

@ -104,8 +104,8 @@ v30xle 8cba1fdc0ba2c39eb6fb5885dcf628a7
vuya ffa817e283bf6a0b6fba21b07523ccaa vuya ffa817e283bf6a0b6fba21b07523ccaa
vuyx a6ff68f46c6b4b7595ec91b2a497df8e vuyx a6ff68f46c6b4b7595ec91b2a497df8e
vyu444 d663334119da56e36aca1e8e4eb29a39 vyu444 d663334119da56e36aca1e8e4eb29a39
x2bgr10le d57b9a99033cc7b65ddd111578f2d385 x2bgr10le 94fcdae6bb03cc55675fec1f708ae765
x2rgb10le d56bdb23fa6a8e12a0b4394987f89935 x2rgb10le 99ca41ff2365b1615c05f8d197471105
xv30le a2a351cbf936651b558abfc70a925057 xv30le a2a351cbf936651b558abfc70a925057
xv36be 4d084adca0228d7750d1e2e877e0d79b xv36be 4d084adca0228d7750d1e2e877e0d79b
xv36le de9c74e94dc19c828e1572aa283d8aca xv36le de9c74e94dc19c828e1572aa283d8aca