]> granicus.if.org Git - libvpx/commitdiff
Cleaning up decode_coefs() function.
authorDmitry Kovalev <dkovalev@google.com>
Thu, 14 Nov 2013 00:46:21 +0000 (16:46 -0800)
committerDmitry Kovalev <dkovalev@google.com>
Thu, 14 Nov 2013 00:46:21 +0000 (16:46 -0800)
Removing vp9_read_and_apply_sign macro which was used only once.

Change-Id: I6a1625b720d89fc1291c99deccd6638b705f9b06

vp9/decoder/vp9_detokenize.c
vp9/decoder/vp9_treereader.h

index d5ad3039bad6916564d2e7037286efb794abd16b..017cb3f7d2f0e54c1d1f196f8072bb36c9649d00 100644 (file)
@@ -67,27 +67,27 @@ static const int token_to_counttoken[MAX_ENTROPY_TOKENS] = {
   TWO_TOKEN, TWO_TOKEN, TWO_TOKEN, DCT_EOB_MODEL_TOKEN
 };
 
-#define INCREMENT_COUNT(token)                           \
-  do {                                                   \
-     if (!cm->frame_parallel_decoding_mode) {            \
+#define INCREMENT_COUNT(token)                              \
+  do {                                                      \
+     if (!cm->frame_parallel_decoding_mode)                 \
        ++coef_counts[band][pt][token_to_counttoken[token]]; \
-     }                                                   \
-  } while (0);
+  } while (0)
+
 
 #define WRITE_COEF_CONTINUE(val, token)                  \
   {                                                      \
-    dqcoeff_ptr[scan[c]] = vp9_read_and_apply_sign(r, val) * \
+    dqcoeff_ptr[scan[c]] = (vp9_read_bit(r) ? -val : val) * \
                             dq[c > 0] / (1 + (tx_size == TX_32X32)); \
     INCREMENT_COUNT(token);                              \
     token_cache[scan[c]] = vp9_pt_energy_class[token];   \
-    c++;                                                 \
+    ++c;                                                 \
     continue;                                            \
   }
 
 #define ADJUST_COEF(prob, bits_count)                   \
   do {                                                  \
     val += (vp9_read(r, prob) << bits_count);           \
-  } while (0);
+  } while (0)
 
 static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
                         vp9_reader *r, int block_idx,
@@ -201,10 +201,10 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
     }
     val = 0;
     cat6 = cat6_prob;
-    while (*cat6) {
+    while (*cat6)
       val = (val << 1) | vp9_read(r, *cat6++);
-    }
     val += CAT6_MIN_VAL;
+
     WRITE_COEF_CONTINUE(val, DCT_VAL_CATEGORY6);
   }
 
index f6124973f9febac9db89b665416cfa439bd68304..41680d245b2f8b52fdac9ad5c872e57c3fce6499 100644 (file)
@@ -15,8 +15,6 @@
 #include "vp9/common/vp9_treecoder.h"
 #include "vp9/decoder/vp9_dboolhuff.h"
 
-#define vp9_read_and_apply_sign(r, value) (vp9_read_bit(r) ? -(value) : (value))
-
 // Intent of tree data structure is to make decoding trivial.
 static int treed_read(vp9_reader *const r, /* !!! must return a 0 or 1 !!! */
                       vp9_tree t,