Commit fd6f4926 authored by Yaowu Xu's avatar Yaowu Xu
Browse files

remove floating point inverse transforms

Change-Id: I9c651bd7c161974bf5f929446361b00d85e57a3f
parent b575394e
......@@ -33,60 +33,6 @@ static const int cospi8sqrt2minus1 = 20091;
static const int sinpi8sqrt2 = 35468;
static const int rounding = 0;
// TODO: these transforms can be further converted into integer forms
// for complexity optimization
static const 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
};
static const 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
};
static const float idct_8[64] = {
0.353553390593274, 0.490392640201615, 0.461939766255643, 0.415734806151273,
0.353553390593274, 0.277785116509801, 0.191341716182545, 0.097545161008064,
0.353553390593274, 0.415734806151273, 0.191341716182545, -0.097545161008064,
-0.353553390593274, -0.490392640201615, -0.461939766255643, -0.277785116509801,
0.353553390593274, 0.277785116509801, -0.191341716182545, -0.490392640201615,
-0.353553390593274, 0.097545161008064, 0.461939766255643, 0.415734806151273,
0.353553390593274, 0.097545161008064, -0.461939766255643, -0.277785116509801,
0.353553390593274, 0.415734806151273, -0.191341716182545, -0.490392640201615,
0.353553390593274, -0.097545161008064, -0.461939766255643, 0.277785116509801,
0.353553390593274, -0.415734806151273, -0.191341716182545, 0.490392640201615,
0.353553390593274, -0.277785116509801, -0.191341716182545, 0.490392640201615,
-0.353553390593274, -0.097545161008064, 0.461939766255643, -0.415734806151273,
0.353553390593274, -0.415734806151273, 0.191341716182545, 0.097545161008064,
-0.353553390593274, 0.490392640201615, -0.461939766255643, 0.277785116509801,
0.353553390593274, -0.490392640201615, 0.461939766255643, -0.415734806151273,
0.353553390593274, -0.277785116509801, 0.191341716182545, -0.097545161008064
};
static const float iadst_8[64] = {
0.089131608307533, 0.255357107325376, 0.387095214016349, 0.466553967085785,
0.483002021635509, 0.434217976756762, 0.326790388032145, 0.175227946595735,
0.175227946595735, 0.434217976756762, 0.466553967085785, 0.255357107325376,
-0.089131608307533, -0.387095214016348, -0.483002021635509, -0.326790388032145,
0.255357107325376, 0.483002021635509, 0.175227946595735, -0.326790388032145,
-0.466553967085785, -0.089131608307533, 0.387095214016349, 0.434217976756762,
0.326790388032145, 0.387095214016349, -0.255357107325376, -0.434217976756762,
0.175227946595735, 0.466553967085786, -0.089131608307534, -0.483002021635509,
0.387095214016349, 0.175227946595735, -0.483002021635509, 0.089131608307533,
0.434217976756762, -0.326790388032145, -0.255357107325377, 0.466553967085785,
0.434217976756762, -0.089131608307533, -0.326790388032145, 0.483002021635509,
-0.255357107325376, -0.175227946595735, 0.466553967085785, -0.387095214016348,
0.466553967085785, -0.326790388032145, 0.089131608307533, 0.175227946595735,
-0.387095214016348, 0.483002021635509, -0.434217976756762, 0.255357107325376,
0.483002021635509, -0.466553967085785, 0.434217976756762, -0.387095214016348,
0.326790388032145, -0.255357107325375, 0.175227946595736, -0.089131608307532
};
static const int16_t idct_i4[16] = {
8192, 10703, 8192, 4433,
8192, 4433, -8192, -10703,
......@@ -139,75 +85,7 @@ static const int16_t iadst_i8[64] = {
5354, -4184, 2871, -1460
};
static float idct_16[256] = {
0.250000, 0.351851, 0.346760, 0.338330, 0.326641, 0.311806, 0.293969, 0.273300,
0.250000, 0.224292, 0.196424, 0.166664, 0.135299, 0.102631, 0.068975, 0.034654,
0.250000, 0.338330, 0.293969, 0.224292, 0.135299, 0.034654, -0.068975, -0.166664,
-0.250000, -0.311806, -0.346760, -0.351851, -0.326641, -0.273300, -0.196424, -0.102631,
0.250000, 0.311806, 0.196424, 0.034654, -0.135299, -0.273300, -0.346760, -0.338330,
-0.250000, -0.102631, 0.068975, 0.224292, 0.326641, 0.351851, 0.293969, 0.166664,
0.250000, 0.273300, 0.068975, -0.166664, -0.326641, -0.338330, -0.196424, 0.034654,
0.250000, 0.351851, 0.293969, 0.102631, -0.135299, -0.311806, -0.346760, -0.224292,
0.250000, 0.224292, -0.068975, -0.311806, -0.326641, -0.102631, 0.196424, 0.351851,
0.250000, -0.034654, -0.293969, -0.338330, -0.135299, 0.166664, 0.346760, 0.273300,
0.250000, 0.166664, -0.196424, -0.351851, -0.135299, 0.224292, 0.346760, 0.102631,
-0.250000, -0.338330, -0.068975, 0.273300, 0.326641, 0.034654, -0.293969, -0.311806,
0.250000, 0.102631, -0.293969, -0.273300, 0.135299, 0.351851, 0.068975, -0.311806,
-0.250000, 0.166664, 0.346760, 0.034654, -0.326641, -0.224292, 0.196424, 0.338330,
0.250000, 0.034654, -0.346760, -0.102631, 0.326641, 0.166664, -0.293969, -0.224292,
0.250000, 0.273300, -0.196424, -0.311806, 0.135299, 0.338330, -0.068975, -0.351851,
0.250000, -0.034654, -0.346760, 0.102631, 0.326641, -0.166664, -0.293969, 0.224292,
0.250000, -0.273300, -0.196424, 0.311806, 0.135299, -0.338330, -0.068975, 0.351851,
0.250000, -0.102631, -0.293969, 0.273300, 0.135299, -0.351851, 0.068975, 0.311806,
-0.250000, -0.166664, 0.346760, -0.034654, -0.326641, 0.224292, 0.196424, -0.338330,
0.250000, -0.166664, -0.196424, 0.351851, -0.135299, -0.224292, 0.346760, -0.102631,
-0.250000, 0.338330, -0.068975, -0.273300, 0.326641, -0.034654, -0.293969, 0.311806,
0.250000, -0.224292, -0.068975, 0.311806, -0.326641, 0.102631, 0.196424, -0.351851,
0.250000, 0.034654, -0.293969, 0.338330, -0.135299, -0.166664, 0.346760, -0.273300,
0.250000, -0.273300, 0.068975, 0.166664, -0.326641, 0.338330, -0.196424, -0.034654,
0.250000, -0.351851, 0.293969, -0.102631, -0.135299, 0.311806, -0.346760, 0.224292,
0.250000, -0.311806, 0.196424, -0.034654, -0.135299, 0.273300, -0.346760, 0.338330,
-0.250000, 0.102631, 0.068975, -0.224292, 0.326641, -0.351851, 0.293969, -0.166664,
0.250000, -0.338330, 0.293969, -0.224292, 0.135299, -0.034654, -0.068975, 0.166664,
-0.250000, 0.311806, -0.346760, 0.351851, -0.326641, 0.273300, -0.196424, 0.102631,
0.250000, -0.351851, 0.346760, -0.338330, 0.326641, -0.311806, 0.293969, -0.273300,
0.250000, -0.224292, 0.196424, -0.166664, 0.135299, -0.102631, 0.068975, -0.034654
};
static float iadst_16[256] = {
0.033094, 0.098087, 0.159534, 0.215215, 0.263118, 0.301511, 0.329007, 0.344612,
0.347761, 0.338341, 0.316693, 0.283599, 0.240255, 0.188227, 0.129396, 0.065889,
0.065889, 0.188227, 0.283599, 0.338341, 0.344612, 0.301511, 0.215215, 0.098087,
-0.033094, -0.159534, -0.263118, -0.329007, -0.347761, -0.316693, -0.240255, -0.129396,
0.098087, 0.263118, 0.344612, 0.316693, 0.188227, 0.000000, -0.188227, -0.316693,
-0.344612, -0.263118, -0.098087, 0.098087, 0.263118, 0.344612, 0.316693, 0.188227,
0.129396, 0.316693, 0.329007, 0.159534, -0.098087, -0.301511, -0.338341, -0.188227,
0.065889, 0.283599, 0.344612, 0.215215, -0.033094, -0.263118, -0.347761, -0.240255,
0.159534, 0.344612, 0.240255, -0.065889, -0.316693, -0.301511, -0.033094, 0.263118,
0.338341, 0.129396, -0.188227, -0.347761, -0.215215, 0.098087, 0.329007, 0.283599,
0.188227, 0.344612, 0.098087, -0.263118, -0.316693, -0.000000, 0.316693, 0.263118,
-0.098087, -0.344612, -0.188227, 0.188227, 0.344612, 0.098087, -0.263118, -0.316693,
0.215215, 0.316693, -0.065889, -0.347761, -0.098087, 0.301511, 0.240255, -0.188227,
-0.329007, 0.033094, 0.344612, 0.129396, -0.283599, -0.263118, 0.159534, 0.338341,
0.240255, 0.263118, -0.215215, -0.283599, 0.188227, 0.301511, -0.159534, -0.316693,
0.129396, 0.329007, -0.098087, -0.338341, 0.065889, 0.344612, -0.033094, -0.347761,
0.263118, 0.188227, -0.316693, -0.098087, 0.344612, 0.000000, -0.344612, 0.098087,
0.316693, -0.188227, -0.263118, 0.263118, 0.188227, -0.316693, -0.098087, 0.344612,
0.283599, 0.098087, -0.347761, 0.129396, 0.263118, -0.301511, -0.065889, 0.344612,
-0.159534, -0.240255, 0.316693, 0.033094, -0.338341, 0.188227, 0.215215, -0.329007,
0.301511, 0.000000, -0.301511, 0.301511, 0.000000, -0.301511, 0.301511, 0.000000,
-0.301511, 0.301511, 0.000000, -0.301511, 0.301511, 0.000000, -0.301511, 0.301511,
0.316693, -0.098087, -0.188227, 0.344612, -0.263118, -0.000000, 0.263118, -0.344612,
0.188227, 0.098087, -0.316693, 0.316693, -0.098087, -0.188227, 0.344612, -0.263118,
0.329007, -0.188227, -0.033094, 0.240255, -0.344612, 0.301511, -0.129396, -0.098087,
0.283599, -0.347761, 0.263118, -0.065889, -0.159534, 0.316693, -0.338341, 0.215215,
0.338341, -0.263118, 0.129396, 0.033094, -0.188227, 0.301511, -0.347761, 0.316693,
-0.215215, 0.065889, 0.098087, -0.240255, 0.329007, -0.344612, 0.283599, -0.159534,
0.344612, -0.316693, 0.263118, -0.188227, 0.098087, 0.000000, -0.098087, 0.188227,
-0.263118, 0.316693, -0.344612, 0.344612, -0.316693, 0.263118, -0.188227, 0.098087,
0.347761, -0.344612, 0.338341, -0.329007, 0.316693, -0.301511, 0.283599, -0.263118,
0.240255, -0.215215, 0.188227, -0.159534, 0.129396, -0.098087, 0.065889, -0.033094
};
static const int16_t idct_i16[256] = {
4096, 5765, 5681, 5543, 5352, 5109, 4816, 4478,
......@@ -279,124 +157,6 @@ static const int16_t iadst_i16[256] = {
3936, -3526, 3084, -2614, 2120, -1607, 1080, -542
};
void vp9_ihtllm_float_c(const int16_t *input, int16_t *output, int pitch,
TX_TYPE tx_type, int tx_dim) {
vp9_clear_system_state(); // Make it simd safe : __asm emms;
{
int i, j, k;
float bufa[256], bufb[256]; // buffers are for floating-point test purpose
// the implementation could be simplified in
// conjunction with integer transform
const int16_t *ip = input;
int16_t *op = output;
int shortpitch = pitch >> 1;
float *pfa = &bufa[0];
float *pfb = &bufb[0];
// pointers to vertical and horizontal transforms
const float *ptv, *pth;
assert(tx_type != DCT_DCT);
// load and convert residual array into floating-point
for(j = 0; j < tx_dim; j++) {
for(i = 0; i < tx_dim; i++) {
pfa[i] = (float)ip[i];
}
pfa += tx_dim;
ip += tx_dim;
}
// vertical transformation
pfa = &bufa[0];
pfb = &bufb[0];
switch(tx_type) {
case ADST_ADST :
case ADST_DCT :
ptv = (tx_dim == 4) ? &iadst_4[0] :
((tx_dim == 8) ? &iadst_8[0] : &iadst_16[0]);
break;
default :
ptv = (tx_dim == 4) ? &idct_4[0] :
((tx_dim == 8) ? &idct_8[0] : &idct_16[0]);
break;
}
for(j = 0; j < tx_dim; j++) {
for(i = 0; i < tx_dim; i++) {
pfb[i] = 0 ;
for(k = 0; k < tx_dim; k++) {
pfb[i] += ptv[k] * pfa[(k * tx_dim)];
}
pfa += 1;
}
pfb += tx_dim;
ptv += tx_dim;
pfa = &bufa[0];
}
// horizontal transformation
pfa = &bufa[0];
pfb = &bufb[0];
switch(tx_type) {
case ADST_ADST :
case DCT_ADST :
pth = (tx_dim == 4) ? &iadst_4[0] :
((tx_dim == 8) ? &iadst_8[0] : &iadst_16[0]);
break;
default :
pth = (tx_dim == 4) ? &idct_4[0] :
((tx_dim == 8) ? &idct_8[0] : &idct_16[0]);
break;
}
for(j = 0; j < tx_dim; j++) {
for(i = 0; i < tx_dim; i++) {
pfa[i] = 0;
for(k = 0; k < tx_dim; k++) {
pfa[i] += pfb[k] * pth[k];
}
pth += tx_dim;
}
pfa += tx_dim;
pfb += tx_dim;
switch(tx_type) {
case ADST_ADST :
case DCT_ADST :
pth = (tx_dim == 4) ? &iadst_4[0] :
((tx_dim == 8) ? &iadst_8[0] : &iadst_16[0]);
break;
default :
pth = (tx_dim == 4) ? &idct_4[0] :
((tx_dim == 8) ? &idct_8[0] : &idct_16[0]);
break;
}
}
// convert to short integer format and load BLOCKD buffer
op = output;
pfa = &bufa[0];
for(j = 0; j < tx_dim; j++) {
for(i = 0; i < tx_dim; i++) {
op[i] = (pfa[i] > 0 ) ? (int16_t)( pfa[i] / 8 + 0.49) :
-(int16_t)( - pfa[i] / 8 + 0.49);
}
op += shortpitch;
pfa += tx_dim;
}
}
vp9_clear_system_state(); // Make it simd safe : __asm emms;
}
/* Converted the transforms to integer form. */
#define VERTICAL_SHIFT 14 // 16
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment