[FFmpeg-cvslog] avcodec/ffv1enc: fix use of uninitalized variable in choose_rct_params()

Michael Niedermayer git at videolan.org
Tue Dec 10 03:24:44 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Dec 10 02:53:04 2013 +0100| [2bdda9a15c048a63630eec4918510c5fec05e437] | committer: Michael Niedermayer

avcodec/ffv1enc: fix use of uninitalized variable in choose_rct_params()

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/ffv1enc.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 25a69bf..a518146 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -1018,6 +1018,7 @@ static void choose_rct_params(FFV1Context *fs, uint8_t *src[3], const int stride
 
         for (x = 0; x < w; x++) {
             int b, g, r;
+            int ab, ag, ar;
             if (lbd) {
                 unsigned v = *((uint32_t*)(src[0] + x*4 + stride[0]*y));
                 b =  v        & 0xFF;
@@ -1029,10 +1030,10 @@ static void choose_rct_params(FFV1Context *fs, uint8_t *src[3], const int stride
                 r = *((uint16_t*)(src[2] + x*2 + stride[2]*y));
             }
 
+            ar = r - lastr;
+            ag = g - lastg;
+            ab = b - lastb;
             if (x && y) {
-                int ar = r - lastr;
-                int ag = g - lastg;
-                int ab = b - lastb;
                 int bg = ag - sample[0][x];
                 int bb = ab - sample[1][x];
                 int br = ar - sample[2][x];
@@ -1044,10 +1045,10 @@ static void choose_rct_params(FFV1Context *fs, uint8_t *src[3], const int stride
                 stat[1] += FFABS(bg + ((br+bb)>>2));
                 stat[2] += FFABS(bg + ((br+bb)>>1));
 
-                sample[0][x] = ag;
-                sample[1][x] = ab;
-                sample[2][x] = ar;
             }
+            sample[0][x] = ag;
+            sample[1][x] = ab;
+            sample[2][x] = ar;
 
             lastr = r;
             lastg = g;



More information about the ffmpeg-cvslog mailing list