Commit 41ebb645 authored by Michael Niedermayer's avatar Michael Niedermayer

swscale/output: fix alpha scale in the new functions

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent a4b5e45e
...@@ -1391,9 +1391,9 @@ yuv2rgb_full_2_c_template(SwsContext *c, const int16_t *buf[2], ...@@ -1391,9 +1391,9 @@ yuv2rgb_full_2_c_template(SwsContext *c, const int16_t *buf[2],
int A; int A;
if (hasAlpha) { if (hasAlpha) {
A = (abuf0[i] * yalpha1 + abuf1[i] * yalpha)<<3; A = (abuf0[i] * yalpha1 + abuf1[i] * yalpha + (1<<18)) >> 19;
if (A & 0xC0000000) if (A & 0x100)
A = av_clip_uintp2(A, 30); A = av_clip_uint8(A);
} }
yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err); yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err);
...@@ -1428,9 +1428,9 @@ yuv2rgb_full_1_c_template(SwsContext *c, const int16_t *buf0, ...@@ -1428,9 +1428,9 @@ yuv2rgb_full_1_c_template(SwsContext *c, const int16_t *buf0,
int A; int A;
if (hasAlpha) { if (hasAlpha) {
A = abuf0[i]<<15; A = (abuf0[i] + 64) >> 7;
if (A & 0xC0000000) if (A & 0x100)
A = av_clip_uintp2(A, 30); A = av_clip_uint8(A);
} }
yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err); yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err);
...@@ -1445,9 +1445,9 @@ yuv2rgb_full_1_c_template(SwsContext *c, const int16_t *buf0, ...@@ -1445,9 +1445,9 @@ yuv2rgb_full_1_c_template(SwsContext *c, const int16_t *buf0,
int A; int A;
if (hasAlpha) { if (hasAlpha) {
A = abuf0[i]<<15; A = (abuf0[i] + 64) >> 7;
if (A & 0xC0000000) if (A & 0x100)
A = av_clip_uintp2(A, 30); A = av_clip_uint8(A);
} }
yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err); yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment