summaryrefslogtreecommitdiff
path: root/vp8/common/idctllm.c
diff options
context:
space:
mode:
Diffstat (limited to 'vp8/common/idctllm.c')
-rw-r--r--vp8/common/idctllm.c127
1 files changed, 127 insertions, 0 deletions
diff --git a/vp8/common/idctllm.c b/vp8/common/idctllm.c
index 684868cb2..dbf0fda82 100644
--- a/vp8/common/idctllm.c
+++ b/vp8/common/idctllm.c
@@ -25,6 +25,9 @@
#include "vpx_ports/config.h"
#include "vp8/common/idct.h"
+#if CONFIG_HYBRIDTRANSFORM
+#include "vp8/common/blockd.h"
+#endif
#include <math.h>
@@ -32,6 +35,130 @@ static const int cospi8sqrt2minus1 = 20091;
static const int sinpi8sqrt2 = 35468;
static const int rounding = 0;
+#if CONFIG_HYBRIDTRANSFORM
+float idct_4[16] = {
+ 0.500000000000000, 0.653281482438188, 0.500000000000000, 0.270598050073099,
+ 0.500000000000000, 0.270598050073099, -0.500000000000000, -0.653281482438188,
+ 0.500000000000000, -0.270598050073099, -0.500000000000000, 0.653281482438188,
+ 0.500000000000000, -0.653281482438188, 0.500000000000000, -0.270598050073099
+};
+
+float iadst_4[16] = {
+ 0.228013428883779, 0.577350269189626, 0.656538502008139, 0.428525073124360,
+ 0.428525073124360, 0.577350269189626, -0.228013428883779, -0.656538502008139,
+ 0.577350269189626, 0, -0.577350269189626, 0.577350269189626,
+ 0.656538502008139, -0.577350269189626, 0.428525073124359, -0.228013428883779
+};
+#endif
+
+#if CONFIG_HYBRIDTRANSFORM
+void vp8_iht4x4llm_c(short *input, short *output, int pitch, TX_TYPE tx_type) {
+ int i, j, k;
+ float bufa[16], bufb[16]; // buffers are for floating-point test purpose
+ // the implementation could be simplified in conjunction with integer transform
+ short *ip = input;
+ short *op = output;
+ int shortpitch = pitch >> 1;
+
+ float *pfa = &bufa[0];
+ float *pfb = &bufb[0];
+
+ // pointers to vertical and horizontal transforms
+ float *ptv, *pth;
+
+ // load and convert residual array into floating-point
+ for(j = 0; j < 4; j++) {
+ for(i = 0; i < 4; i++) {
+ pfa[i] = (float)ip[i];
+ }
+ pfa += 4;
+ ip += 4;
+ }
+
+ // vertical transformation
+ pfa = &bufa[0];
+ pfb = &bufb[0];
+
+ switch(tx_type) {
+ case ADST_ADST :
+ case ADST_DCT :
+ ptv = &iadst_4[0];
+ break;
+
+ default :
+ ptv = &idct_4[0];
+ break;
+ }
+
+ for(j = 0; j < 4; j++) {
+ for(i = 0; i < 4; i++) {
+ pfb[i] = 0 ;
+ for(k = 0; k < 4; k++) {
+ pfb[i] += ptv[k] * pfa[(k<<2)];
+ }
+ pfa += 1;
+ }
+
+ pfb += 4;
+ ptv += 4;
+ pfa = &bufa[0];
+ }
+
+ // horizontal transformation
+ pfa = &bufa[0];
+ pfb = &bufb[0];
+
+ switch(tx_type) {
+ case ADST_ADST :
+ case DCT_ADST :
+ pth = &iadst_4[0];
+ break;
+
+ default :
+ pth = &idct_4[0];
+ break;
+ }
+
+ for(j = 0; j < 4; j++) {
+ for(i = 0; i < 4; i++) {
+ pfa[i] = 0;
+ for(k = 0; k < 4; k++) {
+ pfa[i] += pfb[k] * pth[k];
+ }
+ pth += 4;
+ }
+
+ pfa += 4;
+ pfb += 4;
+
+ switch(tx_type) {
+ case ADST_ADST :
+ case DCT_ADST :
+ pth = &iadst_4[0];
+ break;
+
+ default :
+ pth = &idct_4[0];
+ break;
+ }
+ }
+
+ // convert to short integer format and load BLOCKD buffer
+ op = output;
+ pfa = &bufa[0];
+
+ for(j = 0; j < 4; j++) {
+ for(i = 0; i < 4; i++) {
+ op[i] = (pfa[i] > 0 ) ? (short)( pfa[i] / 8 + 0.49) :
+ -(short)( - pfa[i] / 8 + 0.49);
+ }
+ op += shortpitch;
+ pfa += 4;
+ }
+}
+#endif
+
+
void vp8_short_idct4x4llm_c(short *input, short *output, int pitch) {
int i;
int a1, b1, c1, d1;