/**
* @file faandct.c
- * @brief
+ * @brief
* Floating point AAN DCT
* @author Michael Niedermayer <michaelni@gmx.at>
*/
-#include <math.h>
-
#include "dsputil.h"
#include "faandct.h"
B7*B0, B7*B1, B7*B2, B7*B3, B7*B4, B7*B5, B7*B6, B7*B7,
};
-void ff_faandct(DCTELEM * data)
+static always_inline void row_fdct(FLOAT temp[64], DCTELEM * data)
{
FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
FLOAT tmp10, tmp11, tmp12, tmp13;
FLOAT z1, z2, z3, z4, z5, z11, z13;
- FLOAT temp[64];
int i;
- emms_c();
-
for (i=0; i<8*8; i+=8) {
tmp0= data[0 + i] + data[7 + i];
tmp7= data[0 + i] - data[7 + i];
tmp5= data[2 + i] - data[5 + i];
tmp3= data[3 + i] + data[4 + i];
tmp4= data[3 + i] - data[4 + i];
-
+
tmp10= tmp0 + tmp3;
tmp13= tmp0 - tmp3;
tmp11= tmp1 + tmp2;
tmp12= tmp1 - tmp2;
-
+
temp[0 + i]= tmp10 + tmp11;
temp[4 + i]= tmp10 - tmp11;
-
+
z1= (tmp12 + tmp13)*A1;
temp[2 + i]= tmp13 + z1;
temp[6 + i]= tmp13 - z1;
-
+
tmp10= tmp4 + tmp5;
tmp11= tmp5 + tmp6;
tmp12= tmp6 + tmp7;
temp[1 + i]= z11 + z4;
temp[7 + i]= z11 - z4;
}
+}
+
+void ff_faandct(DCTELEM * data)
+{
+ FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
+ FLOAT tmp10, tmp11, tmp12, tmp13;
+ FLOAT z1, z2, z3, z4, z5, z11, z13;
+ FLOAT temp[64];
+ int i;
+
+ emms_c();
+
+ row_fdct(temp, data);
for (i=0; i<8; i++) {
tmp0= temp[8*0 + i] + temp[8*7 + i];
tmp5= temp[8*2 + i] - temp[8*5 + i];
tmp3= temp[8*3 + i] + temp[8*4 + i];
tmp4= temp[8*3 + i] - temp[8*4 + i];
-
+
tmp10= tmp0 + tmp3;
tmp13= tmp0 - tmp3;
tmp11= tmp1 + tmp2;
tmp12= tmp1 - tmp2;
-
+
data[8*0 + i]= lrintf(SCALE(8*0 + i) * (tmp10 + tmp11));
data[8*4 + i]= lrintf(SCALE(8*4 + i) * (tmp10 - tmp11));
-
+
z1= (tmp12 + tmp13)* A1;
data[8*2 + i]= lrintf(SCALE(8*2 + i) * (tmp13 + z1));
data[8*6 + i]= lrintf(SCALE(8*6 + i) * (tmp13 - z1));
-
+
tmp10= tmp4 + tmp5;
tmp11= tmp5 + tmp6;
tmp12= tmp6 + tmp7;
data[8*7 + i]= lrintf(SCALE(8*7 + i) * (z11 - z4));
}
}
+
+void ff_faandct248(DCTELEM * data)
+{
+ FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
+ FLOAT tmp10, tmp11, tmp12, tmp13;
+ FLOAT z1;
+ FLOAT temp[64];
+ int i;
+
+ emms_c();
+
+ row_fdct(temp, data);
+
+ for (i=0; i<8; i++) {
+ tmp0 = temp[8*0 + i] + temp[8*1 + i];
+ tmp1 = temp[8*2 + i] + temp[8*3 + i];
+ tmp2 = temp[8*4 + i] + temp[8*5 + i];
+ tmp3 = temp[8*6 + i] + temp[8*7 + i];
+ tmp4 = temp[8*0 + i] - temp[8*1 + i];
+ tmp5 = temp[8*2 + i] - temp[8*3 + i];
+ tmp6 = temp[8*4 + i] - temp[8*5 + i];
+ tmp7 = temp[8*6 + i] - temp[8*7 + i];
+
+ tmp10 = tmp0 + tmp3;
+ tmp11 = tmp1 + tmp2;
+ tmp12 = tmp1 - tmp2;
+ tmp13 = tmp0 - tmp3;
+
+ data[8*0 + i] = lrintf(SCALE(8*0 + i) * (tmp10 + tmp11));
+ data[8*4 + i] = lrintf(SCALE(8*4 + i) * (tmp10 - tmp11));
+
+ z1 = (tmp12 + tmp13)* A1;
+ data[8*2 + i] = lrintf(SCALE(8*2 + i) * (tmp13 + z1));
+ data[8*6 + i] = lrintf(SCALE(8*6 + i) * (tmp13 - z1));
+
+ tmp10 = tmp4 + tmp7;
+ tmp11 = tmp5 + tmp6;
+ tmp12 = tmp5 - tmp6;
+ tmp13 = tmp4 - tmp7;
+
+ data[8*1 + i] = lrintf(SCALE(8*0 + i) * (tmp10 + tmp11));
+ data[8*5 + i] = lrintf(SCALE(8*4 + i) * (tmp10 - tmp11));
+
+ z1 = (tmp12 + tmp13)* A1;
+ data[8*3 + i] = lrintf(SCALE(8*2 + i) * (tmp13 + z1));
+ data[8*7 + i] = lrintf(SCALE(8*6 + i) * (tmp13 - z1));
+ }
+}