shithub: libvpx

Download patch

ref: 6594ca8897ea0293d44b825f7c7fe81a7eb540a4
parent: 2ae93a776b4b5ba864363a7de36f3e4b6aa99eab
author: Jingning Han <jingning@google.com>
date: Tue Oct 8 05:06:08 EDT 2013

All zero coeff skip in IDCT 32x32

When all coefficients are zeros, skip the corresponding 1-D inverse
transform. This practice has been used in the SSE2 implementation of
inverse 32x32 DCT. This commit imports this algorithm into the C code.

Change-Id: I0f58bfcb183a569fab85d524d5d9cf8ae8653f86

--- a/vp9/common/vp9_idct.c
+++ b/vp9/common/vp9_idct.c
@@ -1253,7 +1253,20 @@
 
   // Rows
   for (i = 0; i < 32; ++i) {
-    idct32_1d(input, outptr);
+    int16_t zero_coeff[16];
+    for (j = 0; j < 16; ++j)
+      zero_coeff[j] = input[2 * j] | input[2 * j + 1];
+    for (j = 0; j < 8; ++j)
+      zero_coeff[j] = zero_coeff[2 * j] | zero_coeff[2 * j + 1];
+    for (j = 0; j < 4; ++j)
+      zero_coeff[j] = zero_coeff[2 * j] | zero_coeff[2 * j + 1];
+    for (j = 0; j < 2; ++j)
+      zero_coeff[j] = zero_coeff[2 * j] | zero_coeff[2 * j + 1];
+
+    if (zero_coeff[0] | zero_coeff[1])
+      idct32_1d(input, outptr);
+    else
+      vpx_memset(outptr, 0, sizeof(int16_t) * 32);
     input += 32;
     outptr += 32;
   }