summaryrefslogtreecommitdiff
path: root/vp8/common/idctllm.c
diff options
context:
space:
mode:
authorYaowu Xu <yaowu@google.com>2012-05-09 17:19:16 -0700
committerYaowu Xu <yaowu@google.com>2012-05-10 16:32:47 -0700
commit7968d29fedfda970bf49b20c5ef1a227df2b745a (patch)
tree04034191a9d9c32f0969d05c31e90cc0e2c7c000 /vp8/common/idctllm.c
parent54cf1d9ad3fe7ee3d0ce843b2a640f3fcf361887 (diff)
downloadlibvpx-7968d29fedfda970bf49b20c5ef1a227df2b745a.tar
libvpx-7968d29fedfda970bf49b20c5ef1a227df2b745a.tar.gz
libvpx-7968d29fedfda970bf49b20c5ef1a227df2b745a.tar.bz2
libvpx-7968d29fedfda970bf49b20c5ef1a227df2b745a.zip
Reversible WHT pair
This commit changed the forward and the inverse 4x4 Walsh Hadamard transform to a new pair, where the inverse transform can pefectly reconstuct the input to forward transform. It also does so without changing the input and output value range. Even more, it does not change the complexity of the transforms. While it was not expected to improve the results of our current test, it does improve std-hd set by 0.2% on all metrics. No change on derf. Change-Id: Ie4f23ddd3a0f3c5fbe97fb58399f860031f99337
Diffstat (limited to 'vp8/common/idctllm.c')
-rw-r--r--vp8/common/idctllm.c73
1 files changed, 34 insertions, 39 deletions
diff --git a/vp8/common/idctllm.c b/vp8/common/idctllm.c
index f0536d5e4..b2523ba7c 100644
--- a/vp8/common/idctllm.c
+++ b/vp8/common/idctllm.c
@@ -138,65 +138,60 @@ void vp8_short_inv_walsh4x4_c(short *input, short *output)
{
int i;
int a1, b1, c1, d1;
- int a2, b2, c2, d2;
short *ip = input;
short *op = output;
for (i = 0; i < 4; i++)
{
- a1 = ip[0] + ip[12];
- b1 = ip[4] + ip[8];
- c1 = ip[4] - ip[8];
- d1 = ip[0] - ip[12];
+ a1 = ((ip[0] + ip[3]));
+ b1 = ((ip[1] + ip[2]));
+ c1 = ((ip[1] - ip[2]));
+ d1 = ((ip[0] - ip[3]));
- op[0] = a1 + b1;
- op[4] = c1 + d1;
- op[8] = a1 - b1;
- op[12] = d1 - c1;
- ip++;
- op++;
+ op[0] = (a1 + b1 + 1)>>1;
+ op[1] = (c1 + d1)>>1;
+ op[2] = (a1 - b1)>>1;
+ op[3] = (d1 - c1)>>1;
+
+ ip += 4;
+ op += 4;
}
ip = output;
op = output;
-
for (i = 0; i < 4; i++)
{
- a1 = ip[0] + ip[3];
- b1 = ip[1] + ip[2];
- c1 = ip[1] - ip[2];
- d1 = ip[0] - ip[3];
-
- a2 = a1 + b1;
- b2 = c1 + d1;
- c2 = a1 - b1;
- d2 = d1 - c1;
-
- op[0] = (a2 + 1) >> 2;
- op[1] = (b2 + 1) >> 2;
- op[2] = (c2 + 1) >> 2;
- op[3] = (d2 + 1) >> 2;
-
- ip += 4;
- op += 4;
+ a1 = ip[0] + ip[12];
+ b1 = ip[4] + ip[8];
+ c1 = ip[4] - ip[8];
+ d1 = ip[0] - ip[12];
+ op[0] = (a1 + b1 + 1)>>1;
+ op[4] = (c1 + d1)>>1;
+ op[8] = (a1 - b1)>>1;
+ op[12]= (d1 - c1)>>1;
+ ip++;
+ op++;
}
}
-void vp8_short_inv_walsh4x4_1_c(short *input, short *output)
+void vp8_short_inv_walsh4x4_1_c(short *in, short *out)
{
int i;
- int a1;
- short *op = output;
+ short tmp[4];
+ short *ip = in;
+ short *op = tmp;
- a1 = (input[0] + 1 )>> 2;
+ op[0] =(ip[0]+ 1)>>1;
+ op[1] = op[2] = op[3] = (ip[0]>>1);
- for (i = 0; i < 4; i++)
+ ip = tmp;
+ op = out;
+ for(i = 0; i<4; i++)
{
- op[0] = a1;
- op[1] = a1;
- op[2] = a1;
- op[3] = a1;
- op += 4;
+ op[0] =(ip[0]+ 1)>>1;
+ op[4] = op[8] = op[12] = (ip[0]>>1);
+ ip ++;
+ op ++;
}
}