1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-13 21:28:01 +02:00

swscale/output: Avoid 64bit in Alpha in yuv2ya16_X_c_template()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2019-09-26 17:17:15 +02:00
parent 3e6682931b
commit d260621089

View File

@ -905,7 +905,7 @@ yuv2ya16_X_c_template(SwsContext *c, const int16_t *lumFilter,
for (i = 0; i < dstW; i++) { for (i = 0; i < dstW; i++) {
int j; int j;
int Y = -0x40000000; int Y = -0x40000000;
int64_t A = 0xffff; int A = 0xffff;
for (j = 0; j < lumFilterSize; j++) for (j = 0; j < lumFilterSize; j++)
Y += lumSrc[j][i] * lumFilter[j]; Y += lumSrc[j][i] * lumFilter[j];
@ -915,11 +915,12 @@ yuv2ya16_X_c_template(SwsContext *c, const int16_t *lumFilter,
Y = av_clip_uint16(Y); Y = av_clip_uint16(Y);
if (hasAlpha) { if (hasAlpha) {
A = 1<<14; A = -0x40000000 + (1<<14);
for (j = 0; j < lumFilterSize; j++) for (j = 0; j < lumFilterSize; j++)
A += alpSrc[j][i] * lumFilter[j]; A += alpSrc[j][i] * lumFilter[j];
A >>= 15; A >>= 15;
A += 0x8000;
A = av_clip_uint16(A); A = av_clip_uint16(A);
} }