Browse code

golomb: reduce scope of a few variables

Signed-off-by: Diego Biurrun <diego@biurrun.de>

Vittorio Giovara authored on 2013/10/23 22:43:19
Showing 1 changed files
... ...
@@ -53,7 +53,6 @@ extern const uint8_t ff_interleaved_dirac_golomb_vlc_code[256];
53 53
 static inline int get_ue_golomb(GetBitContext *gb)
54 54
 {
55 55
     unsigned int buf;
56
-    int log;
57 56
 
58 57
     OPEN_READER(re, gb);
59 58
     UPDATE_CACHE(re, gb);
... ...
@@ -66,7 +65,7 @@ static inline int get_ue_golomb(GetBitContext *gb)
66 66
 
67 67
         return ff_ue_golomb_vlc_code[buf];
68 68
     } else {
69
-        log = 2 * av_log2(buf) - 31;
69
+        int log = 2 * av_log2(buf) - 31;
70 70
         buf >>= log;
71 71
         buf--;
72 72
         LAST_SKIP_BITS(re, gb, 32 - log);
... ...
@@ -180,7 +179,6 @@ static inline int get_te_golomb(GetBitContext *gb, int range)
180 180
 static inline int get_se_golomb(GetBitContext *gb)
181 181
 {
182 182
     unsigned int buf;
183
-    int log;
184 183
 
185 184
     OPEN_READER(re, gb);
186 185
     UPDATE_CACHE(re, gb);
... ...
@@ -193,7 +191,7 @@ static inline int get_se_golomb(GetBitContext *gb)
193 193
 
194 194
         return ff_se_golomb_vlc_code[buf];
195 195
     } else {
196
-        log = 2 * av_log2(buf) - 31;
196
+        int log = 2 * av_log2(buf) - 31;
197 197
         buf >>= log;
198 198
 
199 199
         LAST_SKIP_BITS(re, gb, 32 - log);
... ...
@@ -211,7 +209,6 @@ static inline int get_se_golomb(GetBitContext *gb)
211 211
 static inline int svq3_get_se_golomb(GetBitContext *gb)
212 212
 {
213 213
     unsigned int buf;
214
-    int log;
215 214
 
216 215
     OPEN_READER(re, gb);
217 216
     UPDATE_CACHE(re, gb);
... ...
@@ -224,6 +221,7 @@ static inline int svq3_get_se_golomb(GetBitContext *gb)
224 224
 
225 225
         return ff_interleaved_se_golomb_vlc_code[buf];
226 226
     } else {
227
+        int log;
227 228
         LAST_SKIP_BITS(re, gb, 8);
228 229
         UPDATE_CACHE(re, gb);
229 230
         buf |= 1 | (GET_CACHE(re, gb) >> 8);
... ...
@@ -243,12 +241,10 @@ static inline int svq3_get_se_golomb(GetBitContext *gb)
243 243
 
244 244
 static inline int dirac_get_se_golomb(GetBitContext *gb)
245 245
 {
246
-    uint32_t buf;
247
-    uint32_t ret;
248
-
249
-    ret = svq3_get_ue_golomb(gb);
246
+    uint32_t ret = svq3_get_ue_golomb(gb);
250 247
 
251 248
     if (ret) {
249
+        uint32_t buf;
252 250
         OPEN_READER(re, gb);
253 251
         UPDATE_CACHE(re, gb);
254 252
         buf = SHOW_SBITS(re, gb, 1);
... ...
@@ -459,8 +455,6 @@ static inline int get_te(GetBitContext *s, int r, char *file, const char *func,
459 459
  */
460 460
 static inline void set_ue_golomb(PutBitContext *pb, int i)
461 461
 {
462
-    int e;
463
-
464 462
     assert(i >= 0);
465 463
 
466 464
 #if 0
... ...
@@ -472,7 +466,7 @@ static inline void set_ue_golomb(PutBitContext *pb, int i)
472 472
     if (i < 256)
473 473
         put_bits(pb, ff_ue_golomb_len[i], i + 1);
474 474
     else {
475
-        e = av_log2(i + 1);
475
+        int e = av_log2(i + 1);
476 476
         put_bits(pb, 2 * e + 1, i + 1);
477 477
     }
478 478
 }