diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2012-04-13 14:42:21 -0700 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2012-04-14 16:29:24 -0700 |
commit | 7f77e9041a79fd05ed872ff9eeb06f109d30acb7 (patch) | |
tree | 9ce7b2ac8fae7f32e4eead4f7bad41afbb8e18b3 /libswscale/output.c | |
parent | 4860625236475da20d0da954017e8c7fe412dea2 (diff) | |
download | ffmpeg-7f77e9041a79fd05ed872ff9eeb06f109d30acb7.tar.gz |
swscale: clip before assigning tables in RGB output functions.
Diffstat (limited to 'libswscale/output.c')
-rw-r--r-- | libswscale/output.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/libswscale/output.c b/libswscale/output.c index c0f9b367d3..b58bda9213 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -1005,15 +1005,17 @@ yuv2rgb_2_c_template(SwsContext *c, const int16_t *buf[2], int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19; int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19; int A1, A2; - const void *r = c->table_rV[V], - *g = (c->table_gU[U] + c->table_gV[V]), - *b = c->table_bU[U]; + const void *r, *g, *b; Y1 = av_clip_uint8(Y1); Y2 = av_clip_uint8(Y2); U = av_clip_uint8(U); V = av_clip_uint8(V); + r = c->table_rV[V]; + g = (c->table_gU[U] + c->table_gV[V]); + b = c->table_bU[U]; + if (hasAlpha) { A1 = (abuf0[i * 2 ] * yalpha1 + abuf1[i * 2 ] * yalpha) >> 19; A2 = (abuf0[i * 2 + 1] * yalpha1 + abuf1[i * 2 + 1] * yalpha) >> 19; @@ -1043,15 +1045,17 @@ yuv2rgb_1_c_template(SwsContext *c, const int16_t *buf0, int U = ubuf0[i] >> 7; int V = vbuf0[i] >> 7; int A1, A2; - const void *r = c->table_rV[V], - *g = (c->table_gU[U] + c->table_gV[V]), - *b = c->table_bU[U]; + const void *r, *g, *b; Y1 = av_clip_uint8(Y1); Y2 = av_clip_uint8(Y2); U = av_clip_uint8(U); V = av_clip_uint8(V); + r = c->table_rV[V]; + g = (c->table_gU[U] + c->table_gV[V]); + b = c->table_bU[U]; + if (hasAlpha) { A1 = abuf0[i * 2 ] >> 7; A2 = abuf0[i * 2 + 1] >> 7; @@ -1070,15 +1074,17 @@ yuv2rgb_1_c_template(SwsContext *c, const int16_t *buf0, int U = (ubuf0[i] + ubuf1[i]) >> 8; int V = (vbuf0[i] + vbuf1[i]) >> 8; int A1, A2; - const void *r = c->table_rV[V], - *g = (c->table_gU[U] + c->table_gV[V]), - *b = c->table_bU[U]; + const void *r, *g, *b; Y1 = av_clip_uint8(Y1); Y2 = av_clip_uint8(Y2); U = av_clip_uint8(U); V = av_clip_uint8(V); + r = c->table_rV[V]; + g = (c->table_gU[U] + c->table_gV[V]); + b = c->table_bU[U]; + if (hasAlpha) { A1 = abuf0[i * 2 ] >> 7; A2 = abuf0[i * 2 + 1] >> 7; |