Browse code

flashsvenc: merge variable declarations and initializations

Diego Biurrun authored on 2011/07/15 22:28:18
Showing 1 changed files
... ...
@@ -164,9 +164,7 @@ static int encode_bitstream(FlashSVContext *s, AVFrame *p, uint8_t *buf,
164 164
             int wp  = i * block_width; // vertical position in frame
165 165
             int ws  = (i < h_blocks) ? block_width : h_part; // size of block
166 166
             int ret = Z_OK;
167
-            uint8_t *ptr;
168
-
169
-            ptr = buf + buf_pos;
167
+            uint8_t *ptr = buf + buf_pos;
170 168
 
171 169
             /* copy the block to the temp buffer before compression
172 170
              * (if it differs from the previous frame's block) */
... ...
@@ -175,11 +173,9 @@ static int encode_bitstream(FlashSVContext *s, AVFrame *p, uint8_t *buf,
175 175
                                   wp, hs, ws, p->linesize[0], previous_frame);
176 176
 
177 177
             if (res || *I_frame) {
178
-                unsigned long zsize;
179
-                zsize = 3 * block_width * block_height;
178
+                unsigned long zsize = 3 * block_width * block_height;
180 179
                 ret   = compress2(ptr + 2, &zsize, s->tmpblock, 3 * ws * hs, 9);
181 180
 
182
-
183 181
                 //ret = deflateReset(&s->zstream);
184 182
                 if (ret != Z_OK)
185 183
                     av_log(s->avctx, AV_LOG_ERROR,
... ...
@@ -214,7 +210,7 @@ static int flashsv_encode_frame(AVCodecContext *avctx, uint8_t *buf,
214 214
     uint8_t *pfptr;
215 215
     int res;
216 216
     int I_frame = 0;
217
-    int opt_w, opt_h;
217
+    int opt_w = 4, opt_h = 4;
218 218
 
219 219
     *p = *pict;
220 220
 
... ...
@@ -240,9 +236,6 @@ static int flashsv_encode_frame(AVCodecContext *avctx, uint8_t *buf,
240 240
         }
241 241
     }
242 242
 
243
-    opt_w = 4;
244
-    opt_h = 4;
245
-
246 243
     if (buf_size < s->image_width * s->image_height * 3) {
247 244
         //Conservative upper bound check for compressed data
248 245
         av_log(avctx, AV_LOG_ERROR, "buf_size %d <  %d\n",