mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2026-01-24 02:20:56 +01:00
swscale/output: add VUYA output support
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
23758380d0
commit
1974813261
14 changed files with 70 additions and 1 deletions
|
|
@ -2584,6 +2584,60 @@ yuv2ayuv64le_X_c(SwsContext *c, const int16_t *lumFilter,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
yuv2vuya_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 hasAlpha = !!alpSrc;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < dstW; i++) {
|
||||
int j;
|
||||
int Y = 1 << 18, U = 1 << 18;
|
||||
int V = 1 << 18, A = 255;
|
||||
|
||||
for (j = 0; j < lumFilterSize; j++)
|
||||
Y += lumSrc[j][i] * lumFilter[j];
|
||||
|
||||
for (j = 0; j < lumFilterSize; j++)
|
||||
U += chrUSrc[j][i] * chrFilter[j];
|
||||
|
||||
for (j = 0; j < lumFilterSize; 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);
|
||||
|
||||
if (hasAlpha) {
|
||||
A = 1 << 18;
|
||||
|
||||
for (j = 0; j < lumFilterSize; j++)
|
||||
A += alpSrc[j][i] * lumFilter[j];
|
||||
|
||||
A >>= 19;
|
||||
|
||||
if (A & 0x100)
|
||||
A = av_clip_uint8(A);
|
||||
}
|
||||
|
||||
dest[4 * i ] = V;
|
||||
dest[4 * i + 1] = U;
|
||||
dest[4 * i + 2] = Y;
|
||||
dest[4 * i + 3] = A;
|
||||
}
|
||||
}
|
||||
|
||||
av_cold void ff_sws_init_output_funcs(SwsContext *c,
|
||||
yuv2planar1_fn *yuv2plane1,
|
||||
yuv2planarX_fn *yuv2planeX,
|
||||
|
|
@ -3086,5 +3140,8 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
|
|||
case AV_PIX_FMT_AYUV64LE:
|
||||
*yuv2packedX = yuv2ayuv64le_X_c;
|
||||
break;
|
||||
case AV_PIX_FMT_VUYA:
|
||||
*yuv2packedX = yuv2vuya_X_c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue