|
|
|
@ -2913,6 +2913,125 @@ AYUVPACKEDWRAPPER(uyva, AV_PIX_FMT_UYVA) |
|
|
|
|
yuv2y2xx_wrapper(10) |
|
|
|
|
yuv2y2xx_wrapper(12) |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
yuv2vyu444_1_c(SwsContext *c, const int16_t *buf0, |
|
|
|
|
const int16_t *ubuf[2], const int16_t *vbuf[2], |
|
|
|
|
const int16_t *abuf0, uint8_t *dest, int dstW, |
|
|
|
|
int uvalpha, int y) |
|
|
|
|
{ |
|
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
if (uvalpha < 2048) { |
|
|
|
|
for (i = 0; i < dstW; i++) { |
|
|
|
|
int Y = (buf0[i] + 64) >> 7; |
|
|
|
|
int U = (ubuf[0][i] + 64) >> 7; |
|
|
|
|
int V = (vbuf[0][i] + 64) >> 7; |
|
|
|
|
|
|
|
|
|
if (Y & 0x100) |
|
|
|
|
Y = av_clip_uint8(Y); |
|
|
|
|
if (U & 0x100) |
|
|
|
|
U = av_clip_uint8(U); |
|
|
|
|
if (V & 0x100) |
|
|
|
|
V = av_clip_uint8(V); |
|
|
|
|
|
|
|
|
|
dest[3 * i ] = V; |
|
|
|
|
dest[3 * i + 1] = Y; |
|
|
|
|
dest[3 * i + 2] = U; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
for (i = 0; i < dstW; i++) { |
|
|
|
|
int Y = (buf0[i] + 64) >> 7; |
|
|
|
|
int U = (ubuf[0][i] + ubuf[1][i] + 128) >> 8; |
|
|
|
|
int V = (vbuf[0][i] + vbuf[1][i] + 128) >> 8; |
|
|
|
|
|
|
|
|
|
if (Y & 0x100) |
|
|
|
|
Y = av_clip_uint8(Y); |
|
|
|
|
if (U & 0x100) |
|
|
|
|
U = av_clip_uint8(U); |
|
|
|
|
if (V & 0x100) |
|
|
|
|
V = av_clip_uint8(V); |
|
|
|
|
|
|
|
|
|
dest[3 * i ] = V; |
|
|
|
|
dest[3 * i + 1] = Y; |
|
|
|
|
dest[3 * i + 2] = U; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
yuv2vyu444_2_c(SwsContext *c, const int16_t *buf[2], |
|
|
|
|
const int16_t *ubuf[2], const int16_t *vbuf[2], |
|
|
|
|
const int16_t *abuf[2], uint8_t *dest, int dstW, |
|
|
|
|
int yalpha, int uvalpha, int y) |
|
|
|
|
{ |
|
|
|
|
const int16_t *buf0 = buf[0], *buf1 = buf[1], |
|
|
|
|
*ubuf0 = ubuf[0], *ubuf1 = ubuf[1], |
|
|
|
|
*vbuf0 = vbuf[0], *vbuf1 = vbuf[1]; |
|
|
|
|
int yalpha1 = 4096 - yalpha; |
|
|
|
|
int uvalpha1 = 4096 - uvalpha; |
|
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
av_assert2(yalpha <= 4096U); |
|
|
|
|
av_assert2(uvalpha <= 4096U); |
|
|
|
|
|
|
|
|
|
for (i = 0; i < dstW; i++) { |
|
|
|
|
int Y = (buf0[i] * yalpha1 + buf1[i] * yalpha) >> 19; |
|
|
|
|
int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19; |
|
|
|
|
int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19; |
|
|
|
|
|
|
|
|
|
if (Y & 0x100) |
|
|
|
|
Y = av_clip_uint8(Y); |
|
|
|
|
if (U & 0x100) |
|
|
|
|
U = av_clip_uint8(U); |
|
|
|
|
if (V & 0x100) |
|
|
|
|
V = av_clip_uint8(V); |
|
|
|
|
|
|
|
|
|
dest[3 * i ] = V; |
|
|
|
|
dest[3 * i + 1] = Y; |
|
|
|
|
dest[3 * i + 2] = U; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
yuv2vyu444_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) |
|
|
|
|
{ |
|
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
for (i = 0; i < dstW; i++) { |
|
|
|
|
int j; |
|
|
|
|
int Y = 1 << 18, U = 1 << 18; |
|
|
|
|
int V = 1 << 18; |
|
|
|
|
|
|
|
|
|
for (j = 0; j < lumFilterSize; j++) |
|
|
|
|
Y += lumSrc[j][i] * lumFilter[j]; |
|
|
|
|
|
|
|
|
|
for (j = 0; j < chrFilterSize; j++) |
|
|
|
|
U += chrUSrc[j][i] * chrFilter[j]; |
|
|
|
|
|
|
|
|
|
for (j = 0; j < chrFilterSize; j++) |
|
|
|
|
V += chrVSrc[j][i] * chrFilter[j]; |
|
|
|
|
|
|
|
|
|
Y >>= 19; |
|
|
|
|
U >>= 19; |
|
|
|
|
V >>= 19; |
|
|
|
|
|
|
|
|
|
if (Y & 0x100) |
|
|
|
|
Y = av_clip_uint8(Y); |
|
|
|
|
if (U & 0x100) |
|
|
|
|
U = av_clip_uint8(U); |
|
|
|
|
if (V & 0x100) |
|
|
|
|
V = av_clip_uint8(V); |
|
|
|
|
|
|
|
|
|
dest[3 * i ] = V; |
|
|
|
|
dest[3 * i + 1] = Y; |
|
|
|
|
dest[3 * i + 2] = U; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#undef output_pixel |
|
|
|
|
|
|
|
|
|
av_cold void ff_sws_init_output_funcs(SwsContext *c, |
|
|
|
@ -3407,6 +3526,11 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c, |
|
|
|
|
*yuv2packed2 = yuv2uyvy422_2_c; |
|
|
|
|
*yuv2packedX = yuv2uyvy422_X_c; |
|
|
|
|
break; |
|
|
|
|
case AV_PIX_FMT_VYU444: |
|
|
|
|
*yuv2packed1 = yuv2vyu444_1_c; |
|
|
|
|
*yuv2packed2 = yuv2vyu444_2_c; |
|
|
|
|
*yuv2packedX = yuv2vyu444_X_c; |
|
|
|
|
break; |
|
|
|
|
case AV_PIX_FMT_YA8: |
|
|
|
|
*yuv2packed1 = yuv2ya8_1_c; |
|
|
|
|
*yuv2packed2 = yuv2ya8_2_c; |
|
|
|
|