[FFmpeg-cvslog] swscale: clip before assigning tables in RGB output functions.

Ronald S. Bultje git at videolan.org
Sun Apr 15 23:36:04 CEST 2012


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Fri Apr 13 14:42:21 2012 -0700| [7f77e9041a79fd05ed872ff9eeb06f109d30acb7] | committer: Ronald S. Bultje

swscale: clip before assigning tables in RGB output functions.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7f77e9041a79fd05ed872ff9eeb06f109d30acb7
---

 libswscale/output.c |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/libswscale/output.c b/libswscale/output.c
index c0f9b36..b58bda9 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;



More information about the ffmpeg-cvslog mailing list