ref: 4a688b26f77e1606e6445ae11d2e1e70c0a5ac62
parent: 3798d7a641d39a1afe6767b2676bedec1f5a96a2
parent: 36b882eeb6a1b4a347a62e833354c33897a7f995
author: James Zern <[email protected]>
date: Mon Jul 22 07:49:23 EDT 2013
Merge "cosmetics: idct_test.cc: fix formatting"
--- a/test/idct_test.cc
+++ b/test/idct_test.cc
@@ -8,7 +8,6 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-
extern "C" {
#include "./vpx_config.h"
#include "./vp8_rtcd.h"
@@ -22,100 +21,94 @@
int dst_stride);
namespace {
class IDCTTest : public ::testing::TestWithParam<idct_fn_t> {
- protected:
- virtual void SetUp() {
- int i;
+ protected:
+ virtual void SetUp() {
+ int i;
- UUT = GetParam();
- memset(input, 0, sizeof(input));
- /* Set up guard blocks */
- for (i = 0; i < 256; i++)
- output[i] = ((i & 0xF) < 4 && (i < 64)) ? 0 : -1;
- }
+ UUT = GetParam();
+ memset(input, 0, sizeof(input));
+ /* Set up guard blocks */
+ for (i = 0; i < 256; i++) output[i] = ((i & 0xF) < 4 && (i < 64)) ? 0 : -1;
+ }
- virtual void TearDown() {
- libvpx_test::ClearSystemState();
- }
+ virtual void TearDown() { libvpx_test::ClearSystemState(); }
- idct_fn_t UUT;
- short input[16];
- unsigned char output[256];
- unsigned char predict[256];
+ idct_fn_t UUT;
+ short input[16];
+ unsigned char output[256];
+ unsigned char predict[256];
};
TEST_P(IDCTTest, TestGuardBlocks) {
- int i;
+ int i;
- for (i = 0; i < 256; i++)
- if ((i & 0xF) < 4 && i < 64)
- EXPECT_EQ(0, output[i]) << i;
- else
- EXPECT_EQ(255, output[i]);
+ for (i = 0; i < 256; i++)
+ if ((i & 0xF) < 4 && i < 64)
+ EXPECT_EQ(0, output[i]) << i;
+ else
+ EXPECT_EQ(255, output[i]);
}
TEST_P(IDCTTest, TestAllZeros) {
- int i;
+ int i;
- REGISTER_STATE_CHECK(UUT(input, output, 16, output, 16));
+ REGISTER_STATE_CHECK(UUT(input, output, 16, output, 16));
- for (i = 0; i < 256; i++)
- if ((i & 0xF) < 4 && i < 64)
- EXPECT_EQ(0, output[i]) << "i==" << i;
- else
- EXPECT_EQ(255, output[i]) << "i==" << i;
+ for (i = 0; i < 256; i++)
+ if ((i & 0xF) < 4 && i < 64)
+ EXPECT_EQ(0, output[i]) << "i==" << i;
+ else
+ EXPECT_EQ(255, output[i]) << "i==" << i;
}
TEST_P(IDCTTest, TestAllOnes) {
- int i;
+ int i;
- input[0] = 4;
- REGISTER_STATE_CHECK(UUT(input, output, 16, output, 16));
+ input[0] = 4;
+ REGISTER_STATE_CHECK(UUT(input, output, 16, output, 16));
- for (i = 0; i < 256; i++)
- if ((i & 0xF) < 4 && i < 64)
- EXPECT_EQ(1, output[i]) << "i==" << i;
- else
- EXPECT_EQ(255, output[i]) << "i==" << i;
+ for (i = 0; i < 256; i++)
+ if ((i & 0xF) < 4 && i < 64)
+ EXPECT_EQ(1, output[i]) << "i==" << i;
+ else
+ EXPECT_EQ(255, output[i]) << "i==" << i;
}
TEST_P(IDCTTest, TestAddOne) {
- int i;
+ int i;
- for (i = 0; i < 256; i++)
- predict[i] = i;
- input[0] = 4;
- REGISTER_STATE_CHECK(UUT(input, predict, 16, output, 16));
+ for (i = 0; i < 256; i++) predict[i] = i;
+ input[0] = 4;
+ REGISTER_STATE_CHECK(UUT(input, predict, 16, output, 16));
- for (i = 0; i < 256; i++)
- if ((i & 0xF) < 4 && i < 64)
- EXPECT_EQ(i+1, output[i]) << "i==" << i;
- else
- EXPECT_EQ(255, output[i]) << "i==" << i;
+ for (i = 0; i < 256; i++)
+ if ((i & 0xF) < 4 && i < 64)
+ EXPECT_EQ(i + 1, output[i]) << "i==" << i;
+ else
+ EXPECT_EQ(255, output[i]) << "i==" << i;
}
TEST_P(IDCTTest, TestWithData) {
- int i;
+ int i;
- for (i = 0; i < 16; i++)
- input[i] = i;
+ for (i = 0; i < 16; i++) input[i] = i;
- REGISTER_STATE_CHECK(UUT(input, output, 16, output, 16));
+ REGISTER_STATE_CHECK(UUT(input, output, 16, output, 16));
- for (i = 0; i < 256; i++)
- if ((i & 0xF) > 3 || i > 63)
- EXPECT_EQ(255, output[i]) << "i==" << i;
- else if (i == 0)
- EXPECT_EQ(11, output[i]) << "i==" << i;
- else if (i == 34)
- EXPECT_EQ(1, output[i]) << "i==" << i;
- else if (i == 2 || i == 17 || i == 32)
- EXPECT_EQ(3, output[i]) << "i==" << i;
- else
- EXPECT_EQ(0, output[i]) << "i==" << i;
+ for (i = 0; i < 256; i++)
+ if ((i & 0xF) > 3 || i > 63)
+ EXPECT_EQ(255, output[i]) << "i==" << i;
+ else if (i == 0)
+ EXPECT_EQ(11, output[i]) << "i==" << i;
+ else if (i == 34)
+ EXPECT_EQ(1, output[i]) << "i==" << i;
+ else if (i == 2 || i == 17 || i == 32)
+ EXPECT_EQ(3, output[i]) << "i==" << i;
+ else
+ EXPECT_EQ(0, output[i]) << "i==" << i;
}
-INSTANTIATE_TEST_CASE_P(C, IDCTTest,
- ::testing::Values(vp8_short_idct4x4llm_c));
+INSTANTIATE_TEST_CASE_P(C, IDCTTest, ::testing::Values(vp8_short_idct4x4llm_c));
#if HAVE_MMX
INSTANTIATE_TEST_CASE_P(MMX, IDCTTest,
::testing::Values(vp8_short_idct4x4llm_mmx));