swscale/output: add Y216LE output support

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2024-10-21 22:08:02 -03:00
parent 7756cd98ac
commit b520d95467
11 changed files with 54 additions and 2 deletions

View file

@ -2983,6 +2983,47 @@ AYUVPACKEDWRAPPER(uyva, AV_PIX_FMT_UYVA)
yuv2y2xx_wrapper(10)
yuv2y2xx_wrapper(12)
static void
yuv2y216le_X_c(SwsContext *c, const int16_t *lumFilter,
const int16_t **_lumSrc, int lumFilterSize,
const int16_t *chrFilter,
const int16_t **_chrUSrc,
const int16_t **_chrVSrc, int chrFilterSize,
const int16_t **_alpSrc,
uint8_t *dest, int dstW, int y)
{
const int32_t **lumSrc = (const int32_t **)_lumSrc;
const int32_t **chrUSrc = (const int32_t **)_chrUSrc;
const int32_t **chrVSrc = (const int32_t **)_chrVSrc;
int shift = 15;
for (int i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = 1 << (shift - 1), Y2 = 1 << (shift - 1);
int U = 1 << (shift - 1), V = 1 << (shift - 1);
/* See yuv2planeX_16_c_template for details. */
Y1 -= 0x40000000;
U -= 0x40000000;
Y2 -= 0x40000000;
V -= 0x40000000;
for (int j = 0; j < lumFilterSize; j++) {
Y1 += lumSrc[j][i * 2] * (unsigned)lumFilter[j];
Y2 += lumSrc[j][i * 2 + 1] * (unsigned)lumFilter[j];
}
for (int j = 0; j < chrFilterSize; j++) {
U += chrUSrc[j][i] * (unsigned)chrFilter[j];
V += chrVSrc[j][i] * (unsigned)chrFilter[j];
}
AV_WL16(dest + 8 * i + 0, 0x8000 + av_clip_int16(Y1 >> shift));
AV_WL16(dest + 8 * i + 2, 0x8000 + av_clip_int16(U >> shift));
AV_WL16(dest + 8 * i + 4, 0x8000 + av_clip_int16(Y2 >> shift));
AV_WL16(dest + 8 * i + 6, 0x8000 + av_clip_int16(V >> shift));
}
}
static void
yuv2vyu444_1_c(SwsContext *c, const int16_t *buf0,
const int16_t *ubuf[2], const int16_t *vbuf[2],
@ -3656,5 +3697,8 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
case AV_PIX_FMT_Y212LE:
*yuv2packedX = yuv2y212le_X_c;
break;
case AV_PIX_FMT_Y216LE:
*yuv2packedX = yuv2y216le_X_c;
break;
}
}

View file

@ -248,7 +248,7 @@ static const FormatEntry format_entries[] = {
[AV_PIX_FMT_NV42] = { 1, 1 },
[AV_PIX_FMT_Y210LE] = { 1, 1 },
[AV_PIX_FMT_Y212LE] = { 1, 1 },
[AV_PIX_FMT_Y216LE] = { 1, 0 },
[AV_PIX_FMT_Y216LE] = { 1, 1 },
[AV_PIX_FMT_X2RGB10LE] = { 1, 1 },
[AV_PIX_FMT_X2BGR10LE] = { 1, 1 },
[AV_PIX_FMT_P210BE] = { 1, 1 },

View file

@ -29,7 +29,7 @@
#include "version_major.h"
#define LIBSWSCALE_VERSION_MINOR 6
#define LIBSWSCALE_VERSION_MICRO 100
#define LIBSWSCALE_VERSION_MICRO 101
#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
LIBSWSCALE_VERSION_MINOR, \