ref: e22bb0dc8e50a43dc5fdeef0a39258cbf2a78370
parent: 1d44fc0c49d828d63a207e024eee4d4bf442b564
parent: ec4b2742e7b6d7a4532bf12f1255cc0b90bafc04
author: Jingning Han <[email protected]>
date: Fri Aug 30 04:53:19 EDT 2013
Merge "Refactor 16x16 unit tests"
--- a/test/dct16x16_test.cc
+++ b/test/dct16x16_test.cc
@@ -75,7 +75,7 @@
static const double C14 = 0.195090322016128;
static const double C15 = 0.098017140329561;
-static void butterfly_16x16_dct_1d(double input[16], double output[16]) {
+void butterfly_16x16_dct_1d(double input[16], double output[16]) {
double step[16];
double intermediate[16];
double temp1, temp2;
@@ -287,18 +287,18 @@
vp9_short_iht16x16_add_c(out, dst, stride >> 1, tx_type);
}
-class FwdTrans16x16Test : public ::testing::TestWithParam<int> {
+class Trans16x16Test : public ::testing::TestWithParam<int> {
public:
- virtual ~FwdTrans16x16Test() {}
+ virtual ~Trans16x16Test() {}
virtual void SetUp() {
tx_type_ = GetParam();
if (tx_type_ == 0) {
- fwd_txfm = fdct16x16;
- inv_txfm = idct16x16_add;
+ fwd_txfm_ = fdct16x16;
+ inv_txfm_ = idct16x16_add;
} else {
- fwd_txfm = fht16x16;
- inv_txfm = iht16x16_add;
+ fwd_txfm_ = fht16x16;
+ inv_txfm_ = iht16x16_add;
}
}
@@ -305,19 +305,19 @@
protected:
void RunFwdTxfm(int16_t *in, int16_t *out, uint8_t *dst,
int stride, int tx_type) {
- (*fwd_txfm)(in, out, dst, stride, tx_type);
+ (*fwd_txfm_)(in, out, dst, stride, tx_type);
}
void RunInvTxfm(int16_t *in, int16_t *out, uint8_t *dst,
int stride, int tx_type) {
- (*inv_txfm)(in, out, dst, stride, tx_type);
+ (*inv_txfm_)(in, out, dst, stride, tx_type);
}
int tx_type_;
- void (*fwd_txfm)(int16_t*, int16_t*, uint8_t*, int, int);
- void (*inv_txfm)(int16_t*, int16_t*, uint8_t*, int, int);
+ void (*fwd_txfm_)(int16_t*, int16_t*, uint8_t*, int, int);
+ void (*inv_txfm_)(int16_t*, int16_t*, uint8_t*, int, int);
};
-TEST_P(FwdTrans16x16Test, AccuracyCheck) {
+TEST_P(Trans16x16Test, AccuracyCheck) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
int max_error = 0;
int total_error = 0;
@@ -355,7 +355,7 @@
<< "Error: 16x16 FHT/IHT has average round trip error > 1 per block";
}
-TEST_P(FwdTrans16x16Test, CoeffSizeCheck) {
+TEST_P(Trans16x16Test, CoeffSizeCheck) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
const int count_test_block = 1000;
for (int i = 0; i < count_test_block; ++i) {
@@ -389,14 +389,19 @@
}
}
-INSTANTIATE_TEST_CASE_P(VP9, FwdTrans16x16Test, ::testing::Range(0, 4));
-
-TEST(VP9Idct16x16Test, AccuracyCheck) {
+TEST_P(Trans16x16Test, InvAccuracyCheck) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
const int count_test_block = 1000;
+ // TODO(jingning): is this unit test necessary? if so, need to add
+ // check sets for inverse hybrid transforms too.
+ if (tx_type_ != DCT_DCT)
+ return;
+
for (int i = 0; i < count_test_block; ++i) {
- int16_t in[256], coeff[256];
- uint8_t dst[256], src[256];
+ DECLARE_ALIGNED_ARRAY(16, int16_t, in, 256);
+ DECLARE_ALIGNED_ARRAY(16, int16_t, coeff, 256);
+ DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, 256);
+ DECLARE_ALIGNED_ARRAY(16, uint8_t, src, 256);
double out_r[256];
for (int j = 0; j < 256; ++j) {
@@ -410,7 +415,10 @@
reference_16x16_dct_2d(in, out_r);
for (int j = 0; j < 256; j++)
coeff[j] = round(out_r[j]);
- vp9_short_idct16x16_add_c(coeff, dst, 16);
+
+ const int pitch = 32;
+ RunInvTxfm(coeff, coeff, dst, pitch, tx_type_);
+
for (int j = 0; j < 256; ++j) {
const int diff = dst[j] - src[j];
const int error = diff * diff;
@@ -421,4 +429,5 @@
}
}
+INSTANTIATE_TEST_CASE_P(VP9, Trans16x16Test, ::testing::Range(0, 4));
} // namespace