swscale: clip before assigning tables in RGB output functions.

pull/5/head
Ronald S. Bultje 13 years ago
parent 4860625236
commit 7f77e9041a
  1. 24
      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;

Loading…
Cancel
Save