Add unit tests for idctllm_test and idctllm_mmx
add unit tests for vp8_short_idct4x4llm_c Change-Id: I472b7c0baa365ba25dc99a3f6efccc816d27c941
This commit is contained in:
parent
b0a12a2880
commit
0c1cec2205
31
vp8/common/idctllm_test.cc
Executable file
31
vp8/common/idctllm_test.cc
Executable file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
|
||||
extern "C" {
|
||||
void vp8_short_idct4x4llm_c(short *input, unsigned char *pred_ptr,
|
||||
int pred_stride, unsigned char *dst_ptr,
|
||||
int dst_stride);
|
||||
}
|
||||
|
||||
#include "vpx_config.h"
|
||||
#include "idctllm_test.h"
|
||||
namespace
|
||||
{
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(C, IDCTTest,
|
||||
::testing::Values(vp8_short_idct4x4llm_c));
|
||||
|
||||
} // namespace
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
113
vp8/common/idctllm_test.h
Executable file
113
vp8/common/idctllm_test.h
Executable file
@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
typedef void (*idct_fn_t)(short *input, unsigned char *pred_ptr,
|
||||
int pred_stride, unsigned char *dst_ptr,
|
||||
int dst_stride);
|
||||
namespace {
|
||||
class IDCTTest : public ::testing::TestWithParam<idct_fn_t>
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
idct_fn_t UUT;
|
||||
short input[16];
|
||||
unsigned char output[256];
|
||||
unsigned char predict[256];
|
||||
};
|
||||
|
||||
TEST_P(IDCTTest, TestGuardBlocks)
|
||||
{
|
||||
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]);
|
||||
}
|
||||
|
||||
TEST_P(IDCTTest, TestAllZeros)
|
||||
{
|
||||
int i;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
TEST_P(IDCTTest, TestAllOnes)
|
||||
{
|
||||
int i;
|
||||
|
||||
input[0] = 4;
|
||||
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;
|
||||
}
|
||||
|
||||
TEST_P(IDCTTest, TestAddOne)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0; i<256; i++)
|
||||
predict[i] = i;
|
||||
|
||||
input[0] = 4;
|
||||
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;
|
||||
}
|
||||
|
||||
TEST_P(IDCTTest, TestWithData)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0; i<16; i++)
|
||||
input[i] = i;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
31
vp8/common/x86/idctllm_mmx_test.cc
Executable file
31
vp8/common/x86/idctllm_mmx_test.cc
Executable file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
|
||||
extern "C" {
|
||||
void vp8_short_idct4x4llm_mmx(short *input, unsigned char *pred_ptr,
|
||||
int pred_stride, unsigned char *dst_ptr,
|
||||
int dst_stride);
|
||||
}
|
||||
|
||||
#include "vp8/common/idctllm_test.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(MMX, IDCTTest,
|
||||
::testing::Values(vp8_short_idct4x4llm_mmx));
|
||||
|
||||
} // namespace
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
@ -30,6 +30,7 @@ VP8_COMMON_SRCS-yes += common/findnearmv.c
|
||||
VP8_COMMON_SRCS-yes += common/generic/systemdependent.c
|
||||
VP8_COMMON_SRCS-yes += common/idct_blk.c
|
||||
VP8_COMMON_SRCS-yes += common/idctllm.c
|
||||
VP8_COMMON_SRCS-yes += common/idctllm_test.cc
|
||||
VP8_COMMON_SRCS-yes += common/alloccommon.h
|
||||
VP8_COMMON_SRCS-yes += common/blockd.h
|
||||
VP8_COMMON_SRCS-yes += common/common.h
|
||||
@ -80,6 +81,7 @@ VP8_COMMON_SRCS-$(CONFIG_POSTPROC) += common/postproc.c
|
||||
VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/dequantize_mmx.asm
|
||||
VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/idct_blk_mmx.c
|
||||
VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/idctllm_mmx.asm
|
||||
VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/idctllm_mmx_test.cc
|
||||
VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/iwalsh_mmx.asm
|
||||
VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/recon_mmx.asm
|
||||
VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/subpixel_mmx.asm
|
||||
|
Loading…
Reference in New Issue
Block a user