Refactor vp10_fwd_txfm2d_test.cc
Change-Id: Ibaf7b00bfe247df3e665ea3a0241667cb130e16c
diff --git a/test/vp10_txfm_test.h b/test/vp10_txfm_test.h
index 4d417ad..3849f51 100644
--- a/test/vp10_txfm_test.h
+++ b/test/vp10_txfm_test.h
@@ -33,62 +33,19 @@
TYPE_LAST
} TYPE_TXFM;
-static double invSqrt2 = 1 / pow(2, 0.5);
+int get_txfm1d_size(TX_SIZE tx_size);
-static void reference_dct_1d(const double* in, double* out, int size) {
- for (int k = 0; k < size; ++k) {
- out[k] = 0;
- for (int n = 0; n < size; ++n) {
- out[k] += in[n] * cos(M_PI * (2 * n + 1) * k / (2 * size));
- }
- if (k == 0) out[k] = out[k] * invSqrt2;
- }
-}
+void get_txfm1d_type(TX_TYPE txfm2d_type, TYPE_TXFM* type0,
+ TYPE_TXFM* type1);
-static void reference_adst_1d(const double* in, double* out, int size) {
- for (int k = 0; k < size; ++k) {
- out[k] = 0;
- for (int n = 0; n < size; ++n) {
- out[k] += in[n] * sin(M_PI * (2 * n + 1) * (2 * k + 1) / (4 * size));
- }
- }
-}
+void reference_dct_1d(const double* in, double* out, int size);
-static void reference_hybrid_1d(double* in, double* out, int size, int type) {
- if (type == TYPE_DCT)
- reference_dct_1d(in, out, size);
- else
- reference_adst_1d(in, out, size);
-}
+void reference_adst_1d(const double* in, double* out, int size);
-static INLINE void reference_hybrid_2d(double* in, double* out, int size,
- int type0, int type1) {
- double* tempOut = new double[size * size];
+void reference_hybrid_1d(double* in, double* out, int size, int type);
- for (int r = 0; r < size; r++) {
- // out ->tempOut
- for (int c = 0; c < size; c++) {
- tempOut[r * size + c] = in[c * size + r];
- }
- }
-
- // dct each row: in -> out
- for (int r = 0; r < size; r++) {
- reference_hybrid_1d(tempOut + r * size, out + r * size, size, type0);
- }
-
- for (int r = 0; r < size; r++) {
- // out ->tempOut
- for (int c = 0; c < size; c++) {
- tempOut[r * size + c] = out[c * size + r];
- }
- }
-
- for (int r = 0; r < size; r++) {
- reference_hybrid_1d(tempOut + r * size, out + r * size, size, type1);
- }
- delete[] tempOut;
-}
+void reference_hybrid_2d(double* in, double* out, int size,
+ int type0, int type1);
template <typename Type1, typename Type2>
static double compute_avg_abs_error(const Type1* a, const Type2* b,