summaryrefslogtreecommitdiffstats
path: root/libswscale/yuv2rgb.c
diff options
context:
space:
mode:
authorsdrik <sdrik@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-02-28 08:01:52 +0000
committersdrik <sdrik@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-02-28 08:01:52 +0000
commit3a81bf82a0415753790c8fc09e8020d6e0e22f67 (patch)
treecf707c9076e06d88eb297bab7d47bc521fa5a579 /libswscale/yuv2rgb.c
parentcde07e8a61ba78a8c35b1548181c1e1fd43215d9 (diff)
downloadmpv-3a81bf82a0415753790c8fc09e8020d6e0e22f67.tar.bz2
mpv-3a81bf82a0415753790c8fc09e8020d6e0e22f67.tar.xz
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
Diffstat (limited to 'libswscale/yuv2rgb.c')
-rw-r--r--libswscale/yuv2rgb.c5
1 files changed, 3 insertions, 2 deletions
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;