shithub: libvpx

Download patch

ref: 65fe7d7605caf832d6a8fa4f984c897f7eca4a0b
parent: db487188b17df4fc670d31d223f38a32a504f10a
parent: 5d93feb6ada860cbd51975cbe208f0ccf8a312a8
author: Jingning Han <jingning@google.com>
date: Tue Sep 10 12:39:18 EDT 2013

Merge "Remove redundant condition check in 32x32 quant"

--- a/vp9/encoder/vp9_quantize.c
+++ b/vp9/encoder/vp9_quantize.c
@@ -94,7 +94,7 @@
                             uint16_t *eob_ptr, const int16_t *scan,
                             const int16_t *iscan) {
   int i, rc, eob;
-  int zbins[2], nzbins[2], zbin;
+  int zbins[2], nzbins[2];
   int x, y, z, sz;
   int idx = 0;
   int idx_arr[1024];
@@ -127,27 +127,21 @@
     for (i = 0; i < idx; i++) {
       rc = scan[idx_arr[i]];
 
-      // Calculate ZBIN
-      zbin = (zbins[rc != 0]);
-
       z = coeff_ptr[rc];
       sz = (z >> 31);                               // sign of z
       x  = (z ^ sz) - sz;                           // x = abs(z)
 
-      if (x >= zbin) {
-        x += ROUND_POWER_OF_TWO(round_ptr[rc != 0], 1);
-        x  = clamp(x, INT16_MIN, INT16_MAX);
-        y  = (((int)(((int)(x * quant_ptr[rc != 0]) >> 16) + x)) *
-              quant_shift_ptr[rc != 0]) >> 15;      // quantize (x)
+      x += ROUND_POWER_OF_TWO(round_ptr[rc != 0], 1);
+      x  = clamp(x, INT16_MIN, INT16_MAX);
+      y  = ((((x * quant_ptr[rc != 0]) >> 16) + x) *
+            quant_shift_ptr[rc != 0]) >> 15;      // quantize (x)
 
-        x  = (y ^ sz) - sz;                         // get the sign back
-        qcoeff_ptr[rc]  = x;                        // write to destination
-        dqcoeff_ptr[rc] = x * dequant_ptr[rc != 0] / 2;  // dequantized value
+      x  = (y ^ sz) - sz;                         // get the sign back
+      qcoeff_ptr[rc]  = x;                        // write to destination
+      dqcoeff_ptr[rc] = x * dequant_ptr[rc != 0] / 2;  // dequantized value
 
-        if (y) {
-          eob = idx_arr[i];                         // last nonzero coeffs
-        }
-      }
+      if (y)
+        eob = idx_arr[i];                         // last nonzero coeffs
     }
   }
   *eob_ptr = eob + 1;