diff options
author | clang-format <noreply@google.com> | 2016-07-25 22:50:48 -0700 |
---|---|---|
committer | James Zern <jzern@google.com> | 2016-07-27 01:58:52 +0000 |
commit | 33e40cb5db12309b69ef40e84b2ed522a54da09e (patch) | |
tree | d9772b1e118a04162b551bdfd53233725a916ab5 /test/fdct8x8_test.cc | |
parent | e4290800b21478a3f9548c58b4f15c5ba5393073 (diff) | |
download | libvpx-33e40cb5db12309b69ef40e84b2ed522a54da09e.tar libvpx-33e40cb5db12309b69ef40e84b2ed522a54da09e.tar.gz libvpx-33e40cb5db12309b69ef40e84b2ed522a54da09e.tar.bz2 libvpx-33e40cb5db12309b69ef40e84b2ed522a54da09e.zip |
test: apply clang-format
Change-Id: I0d9ab85855eb723f653a7bb09b3d0d31dd6cfd2f
Diffstat (limited to 'test/fdct8x8_test.cc')
-rw-r--r-- | test/fdct8x8_test.cc | 227 |
1 files changed, 94 insertions, 133 deletions
diff --git a/test/fdct8x8_test.cc b/test/fdct8x8_test.cc index 083ee6628..994dab118 100644 --- a/test/fdct8x8_test.cc +++ b/test/fdct8x8_test.cc @@ -53,8 +53,7 @@ void reference_8x8_dct_1d(const double in[8], double out[8]) { out[k] = 0.0; for (int n = 0; n < 8; n++) out[k] += in[n] * cos(kPi * (2 * n + 1) * k / 16.0); - if (k == 0) - out[k] = out[k] * kInvSqrt2; + if (k == 0) out[k] = out[k] * kInvSqrt2; } } @@ -63,25 +62,20 @@ void reference_8x8_dct_2d(const int16_t input[kNumCoeffs], // First transform columns for (int i = 0; i < 8; ++i) { double temp_in[8], temp_out[8]; - for (int j = 0; j < 8; ++j) - temp_in[j] = input[j*8 + i]; + for (int j = 0; j < 8; ++j) temp_in[j] = input[j * 8 + i]; reference_8x8_dct_1d(temp_in, temp_out); - for (int j = 0; j < 8; ++j) - output[j * 8 + i] = temp_out[j]; + for (int j = 0; j < 8; ++j) output[j * 8 + i] = temp_out[j]; } // Then transform rows for (int i = 0; i < 8; ++i) { double temp_in[8], temp_out[8]; - for (int j = 0; j < 8; ++j) - temp_in[j] = output[j + i*8]; + for (int j = 0; j < 8; ++j) temp_in[j] = output[j + i * 8]; reference_8x8_dct_1d(temp_in, temp_out); // Scale by some magic number - for (int j = 0; j < 8; ++j) - output[j + i * 8] = temp_out[j] * 2; + for (int j = 0; j < 8; ++j) output[j + i * 8] = temp_out[j] * 2; } } - void fdct8x8_ref(const int16_t *in, tran_low_t *out, int stride, int /*tx_type*/) { vpx_fdct8x8_c(in, out, stride); @@ -177,8 +171,7 @@ class FwdTrans8x8TestBase { << 1. * max_diff / count_test_block * 100 << "%" << " for input range [-255, 255] at index " << j << " count0: " << count_sign_block[j][0] - << " count1: " << count_sign_block[j][1] - << " diff: " << diff; + << " count1: " << count_sign_block[j][1] << " diff: " << diff; } memset(count_sign_block, 0, sizeof(count_sign_block)); @@ -186,8 +179,8 @@ class FwdTrans8x8TestBase { for (int i = 0; i < count_test_block; ++i) { // Initialize a test block with input range [-mask_ / 16, mask_ / 16]. for (int j = 0; j < 64; ++j) - test_input_block[j] = ((rnd.Rand16() & mask_) >> 4) - - ((rnd.Rand16() & mask_) >> 4); + test_input_block[j] = + ((rnd.Rand16() & mask_) >> 4) - ((rnd.Rand16() & mask_) >> 4); ASM_REGISTER_STATE_CHECK( RunFwdTxfm(test_input_block, test_output_block, pitch_)); @@ -207,8 +200,7 @@ class FwdTrans8x8TestBase { << 1. * max_diff / count_test_block * 100 << "%" << " for input range [-15, 15] at index " << j << " count0: " << count_sign_block[j][0] - << " count1: " << count_sign_block[j][1] - << " diff: " << diff; + << " count1: " << count_sign_block[j][1] << " diff: " << diff; } } @@ -245,19 +237,18 @@ class FwdTrans8x8TestBase { ASM_REGISTER_STATE_CHECK( RunFwdTxfm(test_input_block, test_temp_block, pitch_)); for (int j = 0; j < 64; ++j) { - if (test_temp_block[j] > 0) { - test_temp_block[j] += 2; - test_temp_block[j] /= 4; - test_temp_block[j] *= 4; - } else { - test_temp_block[j] -= 2; - test_temp_block[j] /= 4; - test_temp_block[j] *= 4; - } + if (test_temp_block[j] > 0) { + test_temp_block[j] += 2; + test_temp_block[j] /= 4; + test_temp_block[j] *= 4; + } else { + test_temp_block[j] -= 2; + test_temp_block[j] /= 4; + test_temp_block[j] *= 4; + } } if (bit_depth_ == VPX_BITS_8) { - ASM_REGISTER_STATE_CHECK( - RunInvTxfm(test_temp_block, dst, pitch_)); + ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_)); #if CONFIG_VP9_HIGHBITDEPTH } else { ASM_REGISTER_STATE_CHECK( @@ -273,19 +264,18 @@ class FwdTrans8x8TestBase { const int diff = dst[j] - src[j]; #endif const int error = diff * diff; - if (max_error < error) - max_error = error; + if (max_error < error) max_error = error; total_error += error; } } EXPECT_GE(1 << 2 * (bit_depth_ - 8), max_error) - << "Error: 8x8 FDCT/IDCT or FHT/IHT has an individual" - << " roundtrip error > 1"; + << "Error: 8x8 FDCT/IDCT or FHT/IHT has an individual" + << " roundtrip error > 1"; - EXPECT_GE((count_test_block << 2 * (bit_depth_ - 8))/5, total_error) - << "Error: 8x8 FDCT/IDCT or FHT/IHT has average roundtrip " - << "error > 1/5 per block"; + EXPECT_GE((count_test_block << 2 * (bit_depth_ - 8)) / 5, total_error) + << "Error: 8x8 FDCT/IDCT or FHT/IHT has average roundtrip " + << "error > 1/5 per block"; } void RunExtremalCheck() { @@ -341,8 +331,7 @@ class FwdTrans8x8TestBase { ASM_REGISTER_STATE_CHECK( fwd_txfm_ref(test_input_block, ref_temp_block, pitch_, tx_type_)); if (bit_depth_ == VPX_BITS_8) { - ASM_REGISTER_STATE_CHECK( - RunInvTxfm(test_temp_block, dst, pitch_)); + ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_)); #if CONFIG_VP9_HIGHBITDEPTH } else { ASM_REGISTER_STATE_CHECK( @@ -358,8 +347,7 @@ class FwdTrans8x8TestBase { const int diff = dst[j] - src[j]; #endif const int error = diff * diff; - if (max_error < error) - max_error = error; + if (max_error < error) max_error = error; total_error += error; const int coeff_diff = test_temp_block[j] - ref_temp_block[j]; @@ -370,7 +358,7 @@ class FwdTrans8x8TestBase { << "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has" << "an individual roundtrip error > 1"; - EXPECT_GE((count_test_block << 2 * (bit_depth_ - 8))/5, total_error) + EXPECT_GE((count_test_block << 2 * (bit_depth_ - 8)) / 5, total_error) << "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has average" << " roundtrip error > 1/5 per block"; @@ -418,8 +406,8 @@ class FwdTrans8x8TestBase { ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_)); #if CONFIG_VP9_HIGHBITDEPTH } else { - ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), - pitch_)); + ASM_REGISTER_STATE_CHECK( + RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_)); #endif } @@ -432,8 +420,7 @@ class FwdTrans8x8TestBase { #endif const uint32_t error = diff * diff; EXPECT_GE(1u << 2 * (bit_depth_ - 8), error) - << "Error: 8x8 IDCT has error " << error - << " at index " << j; + << "Error: 8x8 IDCT has error " << error << " at index " << j; } } } @@ -461,13 +448,12 @@ class FwdTrans8x8TestBase { const int32_t diff = coeff[j] - coeff_r[j]; const uint32_t error = diff * diff; EXPECT_GE(9u << 2 * (bit_depth_ - 8), error) - << "Error: 8x8 DCT has error " << error - << " at index " << j; + << "Error: 8x8 DCT has error " << error << " at index " << j; } } } -void CompareInvReference(IdctFunc ref_txfm, int thresh) { + void CompareInvReference(IdctFunc ref_txfm, int thresh) { ACMRandom rnd(ACMRandom::DeterministicSeed()); const int count_test_block = 10000; const int eob = 12; @@ -484,7 +470,7 @@ void CompareInvReference(IdctFunc ref_txfm, int thresh) { for (int j = 0; j < kNumCoeffs; ++j) { if (j < eob) { // Random values less than the threshold, either positive or negative - coeff[scan[j]] = rnd(thresh) * (1-2*(i%2)); + coeff[scan[j]] = rnd(thresh) * (1 - 2 * (i % 2)); } else { coeff[scan[j]] = 0; } @@ -504,8 +490,8 @@ void CompareInvReference(IdctFunc ref_txfm, int thresh) { #if CONFIG_VP9_HIGHBITDEPTH } else { ref_txfm(coeff, CONVERT_TO_BYTEPTR(ref16), pitch_); - ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), - pitch_)); + ASM_REGISTER_STATE_CHECK( + RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_)); #endif } @@ -517,9 +503,8 @@ void CompareInvReference(IdctFunc ref_txfm, int thresh) { const int diff = dst[j] - ref[j]; #endif const uint32_t error = diff * diff; - EXPECT_EQ(0u, error) - << "Error: 8x8 IDCT has error " << error - << " at index " << j; + EXPECT_EQ(0u, error) << "Error: 8x8 IDCT has error " << error + << " at index " << j; } } } @@ -530,17 +515,16 @@ void CompareInvReference(IdctFunc ref_txfm, int thresh) { int mask_; }; -class FwdTrans8x8DCT - : public FwdTrans8x8TestBase, - public ::testing::TestWithParam<Dct8x8Param> { +class FwdTrans8x8DCT : public FwdTrans8x8TestBase, + public ::testing::TestWithParam<Dct8x8Param> { public: virtual ~FwdTrans8x8DCT() {} virtual void SetUp() { fwd_txfm_ = GET_PARAM(0); inv_txfm_ = GET_PARAM(1); - tx_type_ = GET_PARAM(2); - pitch_ = 8; + tx_type_ = GET_PARAM(2); + pitch_ = 8; fwd_txfm_ref = fdct8x8_ref; bit_depth_ = GET_PARAM(3); mask_ = (1 << bit_depth_) - 1; @@ -560,37 +544,26 @@ class FwdTrans8x8DCT IdctFunc inv_txfm_; }; -TEST_P(FwdTrans8x8DCT, SignBiasCheck) { - RunSignBiasCheck(); -} +TEST_P(FwdTrans8x8DCT, SignBiasCheck) { RunSignBiasCheck(); } -TEST_P(FwdTrans8x8DCT, RoundTripErrorCheck) { - RunRoundTripErrorCheck(); -} +TEST_P(FwdTrans8x8DCT, RoundTripErrorCheck) { RunRoundTripErrorCheck(); } -TEST_P(FwdTrans8x8DCT, ExtremalCheck) { - RunExtremalCheck(); -} +TEST_P(FwdTrans8x8DCT, ExtremalCheck) { RunExtremalCheck(); } -TEST_P(FwdTrans8x8DCT, FwdAccuracyCheck) { - RunFwdAccuracyCheck(); -} +TEST_P(FwdTrans8x8DCT, FwdAccuracyCheck) { RunFwdAccuracyCheck(); } -TEST_P(FwdTrans8x8DCT, InvAccuracyCheck) { - RunInvAccuracyCheck(); -} +TEST_P(FwdTrans8x8DCT, InvAccuracyCheck) { RunInvAccuracyCheck(); } -class FwdTrans8x8HT - : public FwdTrans8x8TestBase, - public ::testing::TestWithParam<Ht8x8Param> { +class FwdTrans8x8HT : public FwdTrans8x8TestBase, + public ::testing::TestWithParam<Ht8x8Param> { public: virtual ~FwdTrans8x8HT() {} virtual void SetUp() { fwd_txfm_ = GET_PARAM(0); inv_txfm_ = GET_PARAM(1); - tx_type_ = GET_PARAM(2); - pitch_ = 8; + tx_type_ = GET_PARAM(2); + pitch_ = 8; fwd_txfm_ref = fht8x8_ref; bit_depth_ = GET_PARAM(3); mask_ = (1 << bit_depth_) - 1; @@ -610,21 +583,14 @@ class FwdTrans8x8HT IhtFunc inv_txfm_; }; -TEST_P(FwdTrans8x8HT, SignBiasCheck) { - RunSignBiasCheck(); -} +TEST_P(FwdTrans8x8HT, SignBiasCheck) { RunSignBiasCheck(); } -TEST_P(FwdTrans8x8HT, RoundTripErrorCheck) { - RunRoundTripErrorCheck(); -} +TEST_P(FwdTrans8x8HT, RoundTripErrorCheck) { RunRoundTripErrorCheck(); } -TEST_P(FwdTrans8x8HT, ExtremalCheck) { - RunExtremalCheck(); -} +TEST_P(FwdTrans8x8HT, ExtremalCheck) { RunExtremalCheck(); } -class InvTrans8x8DCT - : public FwdTrans8x8TestBase, - public ::testing::TestWithParam<Idct8x8Param> { +class InvTrans8x8DCT : public FwdTrans8x8TestBase, + public ::testing::TestWithParam<Idct8x8Param> { public: virtual ~InvTrans8x8DCT() {} @@ -664,10 +630,10 @@ INSTANTIATE_TEST_CASE_P( make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_10, 0, VPX_BITS_10), make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_12, 0, VPX_BITS_12))); #else -INSTANTIATE_TEST_CASE_P( - C, FwdTrans8x8DCT, - ::testing::Values( - make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c, 0, VPX_BITS_8))); +INSTANTIATE_TEST_CASE_P(C, FwdTrans8x8DCT, + ::testing::Values(make_tuple(&vpx_fdct8x8_c, + &vpx_idct8x8_64_add_c, 0, + VPX_BITS_8))); #endif // CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH @@ -697,11 +663,10 @@ INSTANTIATE_TEST_CASE_P( #endif // CONFIG_VP9_HIGHBITDEPTH #if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE -INSTANTIATE_TEST_CASE_P( - NEON, FwdTrans8x8DCT, - ::testing::Values( - make_tuple(&vpx_fdct8x8_neon, &vpx_idct8x8_64_add_neon, 0, - VPX_BITS_8))); +INSTANTIATE_TEST_CASE_P(NEON, FwdTrans8x8DCT, + ::testing::Values(make_tuple(&vpx_fdct8x8_neon, + &vpx_idct8x8_64_add_neon, + 0, VPX_BITS_8))); #endif // HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE @@ -715,11 +680,10 @@ INSTANTIATE_TEST_CASE_P( #endif // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE -INSTANTIATE_TEST_CASE_P( - SSE2, FwdTrans8x8DCT, - ::testing::Values( - make_tuple(&vpx_fdct8x8_sse2, &vpx_idct8x8_64_add_sse2, 0, - VPX_BITS_8))); +INSTANTIATE_TEST_CASE_P(SSE2, FwdTrans8x8DCT, + ::testing::Values(make_tuple(&vpx_fdct8x8_sse2, + &vpx_idct8x8_64_add_sse2, + 0, VPX_BITS_8))); INSTANTIATE_TEST_CASE_P( SSE2, FwdTrans8x8HT, ::testing::Values( @@ -732,16 +696,16 @@ INSTANTIATE_TEST_CASE_P( #if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE INSTANTIATE_TEST_CASE_P( SSE2, FwdTrans8x8DCT, - ::testing::Values( - make_tuple(&vpx_fdct8x8_sse2, &vpx_idct8x8_64_add_c, 0, VPX_BITS_8), - make_tuple(&vpx_highbd_fdct8x8_c, - &idct8x8_64_add_10_sse2, 12, VPX_BITS_10), - make_tuple(&vpx_highbd_fdct8x8_sse2, - &idct8x8_64_add_10_sse2, 12, VPX_BITS_10), - make_tuple(&vpx_highbd_fdct8x8_c, - &idct8x8_64_add_12_sse2, 12, VPX_BITS_12), - make_tuple(&vpx_highbd_fdct8x8_sse2, - &idct8x8_64_add_12_sse2, 12, VPX_BITS_12))); + ::testing::Values(make_tuple(&vpx_fdct8x8_sse2, &vpx_idct8x8_64_add_c, 0, + VPX_BITS_8), + make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_64_add_10_sse2, + 12, VPX_BITS_10), + make_tuple(&vpx_highbd_fdct8x8_sse2, + &idct8x8_64_add_10_sse2, 12, VPX_BITS_10), + make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_64_add_12_sse2, + 12, VPX_BITS_12), + make_tuple(&vpx_highbd_fdct8x8_sse2, + &idct8x8_64_add_12_sse2, 12, VPX_BITS_12))); INSTANTIATE_TEST_CASE_P( SSE2, FwdTrans8x8HT, @@ -756,30 +720,27 @@ INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P( SSE2, InvTrans8x8DCT, ::testing::Values( - make_tuple(&idct8x8_10_add_10_c, - &idct8x8_10_add_10_sse2, 6225, VPX_BITS_10), - make_tuple(&idct8x8_10, - &idct8x8_64_add_10_sse2, 6225, VPX_BITS_10), - make_tuple(&idct8x8_10_add_12_c, - &idct8x8_10_add_12_sse2, 6225, VPX_BITS_12), - make_tuple(&idct8x8_12, - &idct8x8_64_add_12_sse2, 6225, VPX_BITS_12))); + make_tuple(&idct8x8_10_add_10_c, &idct8x8_10_add_10_sse2, 6225, + VPX_BITS_10), + make_tuple(&idct8x8_10, &idct8x8_64_add_10_sse2, 6225, VPX_BITS_10), + make_tuple(&idct8x8_10_add_12_c, &idct8x8_10_add_12_sse2, 6225, + VPX_BITS_12), + make_tuple(&idct8x8_12, &idct8x8_64_add_12_sse2, 6225, VPX_BITS_12))); #endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE -#if HAVE_SSSE3 && ARCH_X86_64 && \ - !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE -INSTANTIATE_TEST_CASE_P( - SSSE3, FwdTrans8x8DCT, - ::testing::Values( - make_tuple(&vpx_fdct8x8_ssse3, &vpx_idct8x8_64_add_ssse3, 0, - VPX_BITS_8))); +#if HAVE_SSSE3 && ARCH_X86_64 && !CONFIG_VP9_HIGHBITDEPTH && \ + !CONFIG_EMULATE_HARDWARE +INSTANTIATE_TEST_CASE_P(SSSE3, FwdTrans8x8DCT, + ::testing::Values(make_tuple(&vpx_fdct8x8_ssse3, + &vpx_idct8x8_64_add_ssse3, + 0, VPX_BITS_8))); #endif #if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE -INSTANTIATE_TEST_CASE_P( - MSA, FwdTrans8x8DCT, - ::testing::Values( - make_tuple(&vpx_fdct8x8_msa, &vpx_idct8x8_64_add_msa, 0, VPX_BITS_8))); +INSTANTIATE_TEST_CASE_P(MSA, FwdTrans8x8DCT, + ::testing::Values(make_tuple(&vpx_fdct8x8_msa, + &vpx_idct8x8_64_add_msa, 0, + VPX_BITS_8))); INSTANTIATE_TEST_CASE_P( MSA, FwdTrans8x8HT, ::testing::Values( |