summaryrefslogtreecommitdiff
path: root/libswscale/yuv2rgb.c
diff options
context:
space:
mode:
authorCédric Schieli <cschieli@gmail.com>2009-02-28 08:01:52 +0000
committerCédric Schieli <cschieli@gmail.com>2009-02-28 08:01:52 +0000
commitf8a138be5257f751ef7d3c6b7ab534c0434e90e7 (patch)
treedb7a168078a2473e859da7d43a0d964af5f0e323 /libswscale/yuv2rgb.c
parent5f59207d94115e61d5c401f5f03a3d2644fcb5c7 (diff)
downloadffmpeg-f8a138be5257f751ef7d3c6b7ab534c0434e90e7.tar.gz
When converting from a non alpha format to an alpha format, defaults
Originally committed as revision 28756 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
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;