]> granicus.if.org Git - libvpx/commitdiff
Remove duplicate or unused code in encoder/quantize.c.
authorRonald S. Bultje <rbultje@google.com>
Sat, 13 Oct 2012 05:42:06 +0000 (22:42 -0700)
committerRonald S. Bultje <rbultje@google.com>
Sun, 14 Oct 2012 15:04:06 +0000 (08:04 -0700)
Also make some minor stylistic changes to bring the code closer to
the style guide. Remove checks against i8x8/bpred in the mb-codepath,
since these do individual block reconstruction and thus don't go through
this codepath.

Change-Id: I4dfcf8f78746f4647a206475acf731837aa4fd47

vp8/encoder/quantize.c
vp8/encoder/quantize.h

index 5f1280c195011b1653d64de19b2d8e86eedf2fc8..8ae3029ee457a685ab958df9d42130e8b3f12da2 100644 (file)
@@ -8,7 +8,6 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-
 #include <math.h>
 #include "vpx_mem/vpx_mem.h"
 
@@ -139,9 +138,7 @@ void vp8_regular_quantize_b_4x4(BLOCK *b, BLOCKD *d) {
 
 void vp8_quantize_mby_4x4_c(MACROBLOCK *x) {
   int i;
-  int has_2nd_order = (x->e_mbd.mode_info_context->mbmi.mode != B_PRED
-                       && x->e_mbd.mode_info_context->mbmi.mode != I8X8_PRED
-                       && x->e_mbd.mode_info_context->mbmi.mode != SPLITMV);
+  int has_2nd_order = x->e_mbd.mode_info_context->mbmi.mode != SPLITMV;
 
   for (i = 0; i < 16; i++)
     x->quantize_b_4x4(&x->block[i], &x->e_mbd.block[i]);
@@ -150,17 +147,6 @@ void vp8_quantize_mby_4x4_c(MACROBLOCK *x) {
     x->quantize_b_4x4(&x->block[24], &x->e_mbd.block[24]);
 }
 
-void vp8_quantize_mb_4x4_c(MACROBLOCK *x) {
-  int i;
-  int has_2nd_order = (x->e_mbd.mode_info_context->mbmi.mode != B_PRED
-                       && x->e_mbd.mode_info_context->mbmi.mode != I8X8_PRED
-                       && x->e_mbd.mode_info_context->mbmi.mode != SPLITMV);
-
-  for (i = 0; i < 24 + has_2nd_order; i++)
-    x->quantize_b_4x4(&x->block[i], &x->e_mbd.block[i]);
-}
-
-
 void vp8_quantize_mbuv_4x4_c(MACROBLOCK *x) {
   int i;
 
@@ -168,8 +154,10 @@ void vp8_quantize_mbuv_4x4_c(MACROBLOCK *x) {
     x->quantize_b_4x4(&x->block[i], &x->e_mbd.block[i]);
 }
 
-
-
+void vp8_quantize_mb_4x4_c(MACROBLOCK *x) {
+  vp8_quantize_mby_4x4_c(x);
+  vp8_quantize_mbuv_4x4_c(x);
+}
 
 void vp8_regular_quantize_b_2x2(BLOCK *b, BLOCKD *d) {
   int i, rc, eob;
@@ -271,8 +259,8 @@ void vp8_regular_quantize_b_8x8(BLOCK *b, BLOCKD *d) {
 
 void vp8_quantize_mby_8x8(MACROBLOCK *x) {
   int i;
-  int has_2nd_order = (x->e_mbd.mode_info_context->mbmi.mode != B_PRED
-                       && x->e_mbd.mode_info_context->mbmi.mode != SPLITMV);
+  int has_2nd_order = x->e_mbd.mode_info_context->mbmi.mode != SPLITMV;
+
   for (i = 0; i < 16; i ++) {
     x->e_mbd.block[i].eob = 0;
   }
@@ -282,21 +270,6 @@ void vp8_quantize_mby_8x8(MACROBLOCK *x) {
 
   if (has_2nd_order)
     x->quantize_b_2x2(&x->block[24], &x->e_mbd.block[24]);
-
-}
-
-void vp8_quantize_mb_8x8(MACROBLOCK *x) {
-  int i;
-  int has_2nd_order = (x->e_mbd.mode_info_context->mbmi.mode != B_PRED
-                       && x->e_mbd.mode_info_context->mbmi.mode != SPLITMV);
-  for (i = 0; i < 25; i ++) {
-    x->e_mbd.block[i].eob = 0;
-  }
-  for (i = 0; i < 24; i += 4)
-    x->quantize_b_8x8(&x->block[i], &x->e_mbd.block[i]);
-
-  if (has_2nd_order)
-    x->quantize_b_2x2(&x->block[24], &x->e_mbd.block[24]);
 }
 
 void vp8_quantize_mbuv_8x8(MACROBLOCK *x) {
@@ -308,11 +281,14 @@ void vp8_quantize_mbuv_8x8(MACROBLOCK *x) {
     x->quantize_b_8x8(&x->block[i], &x->e_mbd.block[i]);
 }
 
-
-
+void vp8_quantize_mb_8x8(MACROBLOCK *x) {
+  vp8_quantize_mby_8x8(x);
+  vp8_quantize_mbuv_8x8(x);
+}
 
 void vp8_quantize_mby_16x16(MACROBLOCK *x) {
   int i;
+
   for (i = 0; i < 16; i++)
     x->e_mbd.block[i].eob = 0;
   x->e_mbd.block[24].eob = 0;
@@ -320,22 +296,8 @@ void vp8_quantize_mby_16x16(MACROBLOCK *x) {
 }
 
 void vp8_quantize_mb_16x16(MACROBLOCK *x) {
-  int i;
-  for(i = 0; i < 25; i++)
-    x->e_mbd.block[i].eob = 0;
-  x->quantize_b_16x16(&x->block[0], &x->e_mbd.block[0]);
-  for (i = 16; i < 24; i += 4)
-    x->quantize_b_8x8(&x->block[i], &x->e_mbd.block[i]);
-}
-
-// U and V should use 8x8
-void vp8_quantize_mbuv_16x16(MACROBLOCK *x) {
-  int i;
-
-  for(i = 16; i < 24; i++)
-    x->e_mbd.block[i].eob = 0;
-  for (i = 16; i < 24; i += 4)
-    x->quantize_b_8x8(&x->block[i], &x->e_mbd.block[i]);
+  vp8_quantize_mby_16x16(x);
+  vp8_quantize_mbuv_8x8(x);
 }
 
 void vp8_regular_quantize_b_16x16(BLOCK *b, BLOCKD *d) {
@@ -385,8 +347,6 @@ void vp8_regular_quantize_b_16x16(BLOCK *b, BLOCKD *d) {
   d->eob = eob + 1;
 }
 
-
-
 /* quantize_b_pair function pointer in MACROBLOCK structure is set to one of
  * these two C functions if corresponding optimized routine is not available.
  * NEON optimized version implements currently the fast quantization for pair
@@ -408,7 +368,6 @@ static void invert_quant(short *quant,
   *shift = l;
 }
 
-
 void vp8cx_init_quantizer(VP8_COMP *cpi) {
   int i;
   int quant_val;
@@ -697,7 +656,6 @@ void vp8cx_mb_init_quantizer(VP8_COMP *cpi, MACROBLOCK *x) {
   x->q_index = QIndex;
 }
 
-
 void vp8_update_zbin_extra(VP8_COMP *cpi, MACROBLOCK *x) {
   int i;
   int QIndex = x->q_index;
@@ -731,7 +689,6 @@ void vp8_update_zbin_extra(VP8_COMP *cpi, MACROBLOCK *x) {
   x->block[24].zbin_extra = (short)zbin_extra;
 }
 
-
 void vp8cx_frame_init_quantizer(VP8_COMP *cpi) {
   // Clear Zbin mode boost for default case
   cpi->zbin_mode_boost = 0;
@@ -740,7 +697,6 @@ void vp8cx_frame_init_quantizer(VP8_COMP *cpi) {
   vp8cx_mb_init_quantizer(cpi, &cpi->mb);
 }
 
-
 void vp8_set_quantizer(struct VP8_COMP *cpi, int Q) {
   VP8_COMMON *cm = &cpi->common;
 
index 3e583a18e6535b50d30d3795f83c9a4d27441d2e..ad3a3fc0e621d8ee7c25ae3530a7388c14aa781e 100644 (file)
@@ -8,7 +8,6 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-
 #ifndef __INC_QUANTIZE_H
 #define __INC_QUANTIZE_H
 
@@ -82,7 +81,6 @@ extern prototype_quantize_mb(vp8_quantize_mbuv_8x8);
 void vp8_quantize_mb_16x16(MACROBLOCK *x);
 extern prototype_quantize_block(vp8_quantize_quantb_16x16);
 extern prototype_quantize_mb(vp8_quantize_mby_16x16);
-extern prototype_quantize_mb(vp8_quantize_mbuv_16x16);
 
 struct VP8_COMP;
 extern void vp8_set_quantizer(struct VP8_COMP *cpi, int Q);