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.
12 #include "third_party/googletest/src/include/gtest/gtest.h"
13 typedef void (*idct_fn_t)(short *input, unsigned char *pred_ptr,
14 int pred_stride, unsigned char *dst_ptr,
17 class IDCTTest : public ::testing::TestWithParam<idct_fn_t>
25 memset(input, 0, sizeof(input));
26 /* Set up guard blocks */
28 output[i] = ((i&0xF)<4&&(i<64))?0:-1;
33 unsigned char output[256];
34 unsigned char predict[256];
37 TEST_P(IDCTTest, TestGuardBlocks)
42 if((i&0xF) < 4 && i<64)
43 EXPECT_EQ(0, output[i]) << i;
45 EXPECT_EQ(255, output[i]);
48 TEST_P(IDCTTest, TestAllZeros)
52 UUT(input, output, 16, output, 16);
55 if((i&0xF) < 4 && i<64)
56 EXPECT_EQ(0, output[i]) << "i==" << i;
58 EXPECT_EQ(255, output[i]) << "i==" << i;
61 TEST_P(IDCTTest, TestAllOnes)
66 UUT(input, output, 16, output, 16);
69 if((i&0xF) < 4 && i<64)
70 EXPECT_EQ(1, output[i]) << "i==" << i;
72 EXPECT_EQ(255, output[i]) << "i==" << i;
75 TEST_P(IDCTTest, TestAddOne)
83 UUT(input, predict, 16, output, 16);
86 if((i&0xF) < 4 && i<64)
87 EXPECT_EQ(i+1, output[i]) << "i==" << i;
89 EXPECT_EQ(255, output[i]) << "i==" << i;
92 TEST_P(IDCTTest, TestWithData)
99 UUT(input, output, 16, output, 16);
102 if((i&0xF) > 3 || i>63)
103 EXPECT_EQ(255, output[i]) << "i==" << i;
105 EXPECT_EQ(11, output[i]) << "i==" << i;
107 EXPECT_EQ(1, output[i]) << "i==" << i;
108 else if(i == 2 || i == 17 || i == 32)
109 EXPECT_EQ(3, output[i]) << "i==" << i;
111 EXPECT_EQ(0, output[i]) << "i==" << i;