shithub: libvpx

Download patch

ref: efa9abd02891855afc40670cc874922a5c1fcb1b
parent: 62a78f0342ca45fc295aa63bbc4d6974b0c57da7
author: Yaowu Xu <yaowu@google.com>
date: Wed Feb 15 12:35:48 EST 2012

optmized rounding for transforms

the changes are still temporary, the final transforms, especially
inverse ones should take in account both accuracy, complexity, and
sign-bias, which should be decided at a later time.

Change-Id: I116b0c70b25f5ee324ae5713d4564f5d0aa27151

--- a/vp8/common/idctllm.c
+++ b/vp8/common/idctllm.c
@@ -396,7 +396,8 @@
     {
         for (j = 0; j < TX_DIM; j++)
         {
-             X[i * TX_DIM + j] = (int)(coefs[i * TX_DIM + j]+2)>>2;
+             X[i * TX_DIM + j] = (int)(coefs[i * TX_DIM + j]+1
+                                    + (coefs[i * TX_DIM + j]<0))>>2;
         }
     }
   for (i = 0; i < 8; i++)
@@ -487,7 +488,7 @@
        op[i] = 0;
    }
 
-   op[0] = (ip[0] + ip[1] + ip[4] + ip[8])>>1;
+   op[0] = (ip[0] + ip[1] + ip[4] + ip[8] + 1)>>1;
    op[1] = (ip[0] - ip[1] + ip[4] - ip[8])>>1;
    op[4] = (ip[0] + ip[1] - ip[4] - ip[8])>>1;
    op[8] = (ip[0] - ip[1] - ip[4] + ip[8])>>1;
--- a/vp8/encoder/dct.c
+++ b/vp8/encoder/dct.c
@@ -120,7 +120,7 @@
        op1[i] = 0;
    }
 
-   op1[0]=(ip1[0] + ip1[1] + ip1[4] + ip1[8])>>1;
+   op1[0]=(ip1[0] + ip1[1] + ip1[4] + ip1[8] + 1)>>1;
    op1[1]=(ip1[0] - ip1[1] + ip1[4] - ip1[8])>>1;
    op1[4]=(ip1[0] + ip1[1] - ip1[4] - ip1[8])>>1;
    op1[8]=(ip1[0] - ip1[1] - ip1[4] + ip1[8])>>1;