From 3a81bf82a0415753790c8fc09e8020d6e0e22f67 Mon Sep 17 00:00:00 2001 From: sdrik Date: Sat, 28 Feb 2009 08:01:52 +0000 Subject: When converting from a non alpha format to an alpha format, defaults to all ones rather than all zeroes git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28756 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/yuv2rgb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libswscale/yuv2rgb.c') diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index 53a0d4e7b8..0a8cd99a97 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -533,7 +533,7 @@ av_cold int sws_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int uint8_t *y_table; uint16_t *y_table16; uint32_t *y_table32; - int i, base, rbase, gbase, bbase; + int i, base, rbase, gbase, bbase, abase; const int yoffs = fullRange ? 384 : 326; int64_t crv = inv_table[0]; @@ -659,12 +659,13 @@ av_cold int sws_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int rbase = base + (isRgb ? 16 : 0); gbase = base + 8; bbase = base + (isRgb ? 0 : 16); + abase = (c->dstFormat == PIX_FMT_RGBA || c->dstFormat == PIX_FMT_BGRA) ? 24 : 0; c->yuvTable = av_malloc(1024*3*4); y_table32 = c->yuvTable; yb = -(384<<16) - oy; for (i = 0; i < 1024; i++) { uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16); - y_table32[i ] = yval << rbase; + y_table32[i ] = (yval << rbase) + (255 << abase); y_table32[i+1024] = yval << gbase; y_table32[i+2048] = yval << bbase; yb += cy; -- cgit v1.2.3