2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
13 #include "vpx_config.h"
16 #include "third_party/googletest/src/include/gtest/gtest.h"
18 typedef void (*idct_fn_t)(short *input, unsigned char *pred_ptr,
19 int pred_stride, unsigned char *dst_ptr,
22 class IDCTTest : public ::testing::TestWithParam<idct_fn_t>
30 memset(input, 0, sizeof(input));
31 /* Set up guard blocks */
33 output[i] = ((i&0xF)<4&&(i<64))?0:-1;
38 unsigned char output[256];
39 unsigned char predict[256];
42 TEST_P(IDCTTest, TestGuardBlocks)
47 if((i&0xF) < 4 && i<64)
48 EXPECT_EQ(0, output[i]) << i;
50 EXPECT_EQ(255, output[i]);
53 TEST_P(IDCTTest, TestAllZeros)
57 UUT(input, output, 16, output, 16);
60 if((i&0xF) < 4 && i<64)
61 EXPECT_EQ(0, output[i]) << "i==" << i;
63 EXPECT_EQ(255, output[i]) << "i==" << i;
66 TEST_P(IDCTTest, TestAllOnes)
71 UUT(input, output, 16, output, 16);
74 if((i&0xF) < 4 && i<64)
75 EXPECT_EQ(1, output[i]) << "i==" << i;
77 EXPECT_EQ(255, output[i]) << "i==" << i;
80 TEST_P(IDCTTest, TestAddOne)
88 UUT(input, predict, 16, output, 16);
91 if((i&0xF) < 4 && i<64)
92 EXPECT_EQ(i+1, output[i]) << "i==" << i;
94 EXPECT_EQ(255, output[i]) << "i==" << i;
97 TEST_P(IDCTTest, TestWithData)
104 UUT(input, output, 16, output, 16);
107 if((i&0xF) > 3 || i>63)
108 EXPECT_EQ(255, output[i]) << "i==" << i;
110 EXPECT_EQ(11, output[i]) << "i==" << i;
112 EXPECT_EQ(1, output[i]) << "i==" << i;
113 else if(i == 2 || i == 17 || i == 32)
114 EXPECT_EQ(3, output[i]) << "i==" << i;
116 EXPECT_EQ(0, output[i]) << "i==" << i;
119 INSTANTIATE_TEST_CASE_P(C, IDCTTest,
120 ::testing::Values(vp8_short_idct4x4llm_c));
122 INSTANTIATE_TEST_CASE_P(MMX, IDCTTest,
123 ::testing::Values(vp8_short_idct4x4llm_mmx));