]> granicus.if.org Git - libvpx/commitdiff
optmized rounding for transforms
authorYaowu Xu <yaowu@google.com>
Thu, 16 Feb 2012 01:35:48 +0000 (17:35 -0800)
committerYaowu Xu <yaowu@google.com>
Thu, 16 Feb 2012 15:03:57 +0000 (07:03 -0800)
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

vp8/common/idctllm.c
vp8/encoder/dct.c

index e21af6871f8ad8297ac88069bb80d86c28f97a69..8097c4fb1603d60d8bb5730c60799007dd5271d0 100644 (file)
@@ -396,7 +396,8 @@ void vp8_short_idct8x8_c(short *coefs, short *block, int pitch)
     {
         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 @@ void vp8_short_ihaar2x2_c(short *input, short *output, int pitch)
        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;
index b537835da413abb3b6e796f476f53d6f44cc82ef..b1e461e87c8482e3ee23003e57b5714381bb0a65 100644 (file)
@@ -120,7 +120,7 @@ void vp8_short_fhaar2x2_c(short *input, short *output, int pitch) //pitch = 8
        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;