test: apply clang-format

Change-Id: I0d9ab85855eb723f653a7bb09b3d0d31dd6cfd2f
This commit is contained in:
clang-format 2016-07-25 22:50:48 -07:00 committed by James Zern
parent e4290800b2
commit 33e40cb5db
88 changed files with 2928 additions and 3653 deletions

View File

@ -23,9 +23,7 @@ class ACMRandom {
explicit ACMRandom(int seed) : random_(seed) {} explicit ACMRandom(int seed) : random_(seed) {}
void Reset(int seed) { void Reset(int seed) { random_.Reseed(seed); }
random_.Reseed(seed);
}
uint16_t Rand16(void) { uint16_t Rand16(void) {
const uint32_t value = const uint32_t value =
random_.Generate(testing::internal::Random::kMaxRange); random_.Generate(testing::internal::Random::kMaxRange);
@ -52,17 +50,11 @@ class ACMRandom {
return r < 128 ? r << 4 : r >> 4; return r < 128 ? r << 4 : r >> 4;
} }
int PseudoUniform(int range) { int PseudoUniform(int range) { return random_.Generate(range); }
return random_.Generate(range);
}
int operator()(int n) { int operator()(int n) { return PseudoUniform(n); }
return PseudoUniform(n);
}
static int DeterministicSeed(void) { static int DeterministicSeed(void) { return 0xbaba; }
return 0xbaba;
}
private: private:
testing::internal::Random random_; testing::internal::Random random_;

View File

@ -17,8 +17,8 @@
namespace { namespace {
// Check if any pixel in a 16x16 macroblock varies between frames. // Check if any pixel in a 16x16 macroblock varies between frames.
int CheckMb(const vpx_image_t &current, const vpx_image_t &previous, int CheckMb(const vpx_image_t &current, const vpx_image_t &previous, int mb_r,
int mb_r, int mb_c) { int mb_c) {
for (int plane = 0; plane < 3; plane++) { for (int plane = 0; plane < 3; plane++) {
int r = 16 * mb_r; int r = 16 * mb_r;
int c0 = 16 * mb_c; int c0 = 16 * mb_c;

View File

@ -39,6 +39,7 @@ class ActiveMapTest
encoder->Control(VP8E_SET_CPUUSED, cpu_used_); encoder->Control(VP8E_SET_CPUUSED, cpu_used_);
} else if (video->frame() == 3) { } else if (video->frame() == 3) {
vpx_active_map_t map = vpx_active_map_t(); vpx_active_map_t map = vpx_active_map_t();
/* clang-format off */
uint8_t active_map[9 * 13] = { uint8_t active_map[9 * 13] = {
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
@ -50,6 +51,7 @@ class ActiveMapTest
0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1,
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0,
}; };
/* clang-format on */
map.cols = (kWidth + 15) / 16; map.cols = (kWidth + 15) / 16;
map.rows = (kHeight + 15) / 16; map.rows = (kHeight + 15) / 16;
ASSERT_EQ(map.cols, 13u); ASSERT_EQ(map.cols, 13u);
@ -77,8 +79,8 @@ TEST_P(ActiveMapTest, Test) {
cfg_.rc_end_usage = VPX_CBR; cfg_.rc_end_usage = VPX_CBR;
cfg_.kf_max_dist = 90000; cfg_.kf_max_dist = 90000;
::libvpx_test::I420VideoSource video("hantro_odd.yuv", kWidth, kHeight, 30, ::libvpx_test::I420VideoSource video("hantro_odd.yuv", kWidth, kHeight, 30, 1,
1, 0, 20); 0, 20);
ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
} }

View File

@ -22,15 +22,12 @@ static const int kNoiseSize = 3072;
// TODO(jimbankoski): make width and height integers not unsigned. // TODO(jimbankoski): make width and height integers not unsigned.
typedef void (*AddNoiseFunc)(uint8_t *start, const int8_t *noise, typedef void (*AddNoiseFunc)(uint8_t *start, const int8_t *noise,
int blackclamp, int whiteclamp, int blackclamp, int whiteclamp, int width,
int width, int height, int pitch); int height, int pitch);
class AddNoiseTest class AddNoiseTest : public ::testing::TestWithParam<AddNoiseFunc> {
: public ::testing::TestWithParam<AddNoiseFunc> {
public: public:
virtual void TearDown() { virtual void TearDown() { libvpx_test::ClearSystemState(); }
libvpx_test::ClearSystemState();
}
virtual ~AddNoiseTest() {} virtual ~AddNoiseTest() {}
}; };
@ -48,13 +45,13 @@ TEST_P(AddNoiseTest, CheckNoiseAdded) {
const int image_size = width * height; const int image_size = width * height;
int8_t noise[kNoiseSize]; int8_t noise[kNoiseSize];
const int clamp = vpx_setup_noise(4.4, noise, kNoiseSize); const int clamp = vpx_setup_noise(4.4, noise, kNoiseSize);
uint8_t *const s = reinterpret_cast<uint8_t *>(vpx_calloc(image_size, uint8_t *const s =
sizeof(*s))); reinterpret_cast<uint8_t *>(vpx_calloc(image_size, sizeof(*s)));
ASSERT_TRUE(s != NULL); ASSERT_TRUE(s != NULL);
memset(s, 99, image_size * sizeof(*s)); memset(s, 99, image_size * sizeof(*s));
ASM_REGISTER_STATE_CHECK(GetParam()(s, noise, clamp, clamp, ASM_REGISTER_STATE_CHECK(
width, height, width)); GetParam()(s, noise, clamp, clamp, width, height, width));
// Check to make sure we don't end up having either the same or no added // Check to make sure we don't end up having either the same or no added
// noise either vertically or horizontally. // noise either vertically or horizontally.
@ -72,8 +69,8 @@ TEST_P(AddNoiseTest, CheckNoiseAdded) {
// Initialize pixels in the image to 255 and check for roll over. // Initialize pixels in the image to 255 and check for roll over.
memset(s, 255, image_size); memset(s, 255, image_size);
ASM_REGISTER_STATE_CHECK(GetParam()(s, noise, clamp, clamp, ASM_REGISTER_STATE_CHECK(
width, height, width)); GetParam()(s, noise, clamp, clamp, width, height, width));
// Check to make sure don't roll over. // Check to make sure don't roll over.
for (int i = 0; i < image_size; ++i) { for (int i = 0; i < image_size; ++i) {
@ -83,8 +80,8 @@ TEST_P(AddNoiseTest, CheckNoiseAdded) {
// Initialize pixels in the image to 0 and check for roll under. // Initialize pixels in the image to 0 and check for roll under.
memset(s, 0, image_size); memset(s, 0, image_size);
ASM_REGISTER_STATE_CHECK(GetParam()(s, noise, clamp, clamp, ASM_REGISTER_STATE_CHECK(
width, height, width)); GetParam()(s, noise, clamp, clamp, width, height, width));
// Check to make sure don't roll under. // Check to make sure don't roll under.
for (int i = 0; i < image_size; ++i) { for (int i = 0; i < image_size; ++i) {

View File

@ -31,9 +31,7 @@ class AltRefTest : public ::libvpx_test::EncoderTest,
SetMode(libvpx_test::kTwoPassGood); SetMode(libvpx_test::kTwoPassGood);
} }
virtual void BeginPassHook(unsigned int pass) { virtual void BeginPassHook(unsigned int pass) { altref_count_ = 0; }
altref_count_ = 0;
}
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video, virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
libvpx_test::Encoder *encoder) { libvpx_test::Encoder *encoder) {
@ -75,11 +73,8 @@ class AltRefForcedKeyTestLarge
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> { public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
protected: protected:
AltRefForcedKeyTestLarge() AltRefForcedKeyTestLarge()
: EncoderTest(GET_PARAM(0)), : EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)),
encoding_mode_(GET_PARAM(1)), cpu_used_(GET_PARAM(2)), forced_kf_frame_num_(1), frame_num_(0) {}
cpu_used_(GET_PARAM(2)),
forced_kf_frame_num_(1),
frame_num_(0) {}
virtual ~AltRefForcedKeyTestLarge() {} virtual ~AltRefForcedKeyTestLarge() {}
virtual void SetUp() { virtual void SetUp() {
@ -94,8 +89,8 @@ class AltRefForcedKeyTestLarge
if (video->frame() == 0) { if (video->frame() == 0) {
encoder->Control(VP8E_SET_CPUUSED, cpu_used_); encoder->Control(VP8E_SET_CPUUSED, cpu_used_);
encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1); encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
// override test default for tile columns if necessary.
#if CONFIG_VP9_ENCODER #if CONFIG_VP9_ENCODER
// override test default for tile columns if necessary.
if (GET_PARAM(0) == &libvpx_test::kVP9) { if (GET_PARAM(0) == &libvpx_test::kVP9) {
encoder->Control(VP9E_SET_TILE_COLUMNS, 6); encoder->Control(VP9E_SET_TILE_COLUMNS, 6);
} }
@ -147,13 +142,11 @@ TEST_P(AltRefForcedKeyTestLarge, ForcedFrameIsKey) {
} }
} }
VP8_INSTANTIATE_TEST_CASE( VP8_INSTANTIATE_TEST_CASE(AltRefForcedKeyTestLarge,
AltRefForcedKeyTestLarge,
::testing::Values(::libvpx_test::kOnePassGood), ::testing::Values(::libvpx_test::kOnePassGood),
::testing::Range(0, 9)); ::testing::Range(0, 9));
VP9_INSTANTIATE_TEST_CASE( VP9_INSTANTIATE_TEST_CASE(AltRefForcedKeyTestLarge,
AltRefForcedKeyTestLarge,
::testing::Values(::libvpx_test::kOnePassGood), ::testing::Values(::libvpx_test::kOnePassGood),
::testing::Range(0, 9)); ::testing::Range(0, 9));
} // namespace } // namespace

View File

@ -40,9 +40,7 @@ class AverageTestBase : public ::testing::Test {
source_data_ = NULL; source_data_ = NULL;
} }
virtual void TearDown() { virtual void TearDown() { libvpx_test::ClearSystemState(); }
libvpx_test::ClearSystemState();
}
protected: protected:
// Handle blocks up to 4 blocks 64x64 with stride up to 128 // Handle blocks up to 4 blocks 64x64 with stride up to 128
@ -58,16 +56,14 @@ class AverageTestBase : public ::testing::Test {
unsigned int ReferenceAverage8x8(const uint8_t *source, int pitch) { unsigned int ReferenceAverage8x8(const uint8_t *source, int pitch) {
unsigned int average = 0; unsigned int average = 0;
for (int h = 0; h < 8; ++h) for (int h = 0; h < 8; ++h)
for (int w = 0; w < 8; ++w) for (int w = 0; w < 8; ++w) average += source[h * pitch + w];
average += source[h * pitch + w];
return ((average + 32) >> 6); return ((average + 32) >> 6);
} }
unsigned int ReferenceAverage4x4(const uint8_t *source, int pitch) { unsigned int ReferenceAverage4x4(const uint8_t *source, int pitch) {
unsigned int average = 0; unsigned int average = 0;
for (int h = 0; h < 4; ++h) for (int h = 0; h < 4; ++h)
for (int w = 0; w < 4; ++w) for (int w = 0; w < 4; ++w) average += source[h * pitch + w];
average += source[h * pitch + w];
return ((average + 8) >> 4); return ((average + 8) >> 4);
} }
@ -93,8 +89,7 @@ typedef unsigned int (*AverageFunction)(const uint8_t* s, int pitch);
typedef std::tr1::tuple<int, int, int, int, AverageFunction> AvgFunc; typedef std::tr1::tuple<int, int, int, int, AverageFunction> AvgFunc;
class AverageTest class AverageTest : public AverageTestBase,
: public AverageTestBase,
public ::testing::WithParamInterface<AvgFunc> { public ::testing::WithParamInterface<AvgFunc> {
public: public:
AverageTest() : AverageTestBase(GET_PARAM(0), GET_PARAM(1)) {} AverageTest() : AverageTestBase(GET_PARAM(0), GET_PARAM(1)) {}
@ -103,17 +98,17 @@ class AverageTest
void CheckAverages() { void CheckAverages() {
unsigned int expected = 0; unsigned int expected = 0;
if (GET_PARAM(3) == 8) { if (GET_PARAM(3) == 8) {
expected = ReferenceAverage8x8(source_data_+ GET_PARAM(2), expected =
source_stride_); ReferenceAverage8x8(source_data_ + GET_PARAM(2), source_stride_);
} else if (GET_PARAM(3) == 4) { } else if (GET_PARAM(3) == 4) {
expected = ReferenceAverage4x4(source_data_+ GET_PARAM(2), expected =
source_stride_); ReferenceAverage4x4(source_data_ + GET_PARAM(2), source_stride_);
} }
ASM_REGISTER_STATE_CHECK(GET_PARAM(4)(source_data_+ GET_PARAM(2), ASM_REGISTER_STATE_CHECK(
source_stride_)); GET_PARAM(4)(source_data_ + GET_PARAM(2), source_stride_));
unsigned int actual = GET_PARAM(4)(source_data_+ GET_PARAM(2), unsigned int actual =
source_stride_); GET_PARAM(4)(source_data_ + GET_PARAM(2), source_stride_);
EXPECT_EQ(expected, actual); EXPECT_EQ(expected, actual);
} }
@ -124,14 +119,11 @@ typedef void (*IntProRowFunc)(int16_t hbuf[16], uint8_t const *ref,
typedef std::tr1::tuple<int, IntProRowFunc, IntProRowFunc> IntProRowParam; typedef std::tr1::tuple<int, IntProRowFunc, IntProRowFunc> IntProRowParam;
class IntProRowTest class IntProRowTest : public AverageTestBase,
: public AverageTestBase,
public ::testing::WithParamInterface<IntProRowParam> { public ::testing::WithParamInterface<IntProRowParam> {
public: public:
IntProRowTest() IntProRowTest()
: AverageTestBase(16, GET_PARAM(0)), : AverageTestBase(16, GET_PARAM(0)), hbuf_asm_(NULL), hbuf_c_(NULL) {
hbuf_asm_(NULL),
hbuf_c_(NULL) {
asm_func_ = GET_PARAM(1); asm_func_ = GET_PARAM(1);
c_func_ = GET_PARAM(2); c_func_ = GET_PARAM(2);
} }
@ -169,8 +161,7 @@ typedef int16_t (*IntProColFunc)(uint8_t const *ref, const int width);
typedef std::tr1::tuple<int, IntProColFunc, IntProColFunc> IntProColParam; typedef std::tr1::tuple<int, IntProColFunc, IntProColFunc> IntProColParam;
class IntProColTest class IntProColTest : public AverageTestBase,
: public AverageTestBase,
public ::testing::WithParamInterface<IntProColParam> { public ::testing::WithParamInterface<IntProColParam> {
public: public:
IntProColTest() : AverageTestBase(GET_PARAM(0), 1), sum_asm_(0), sum_c_(0) { IntProColTest() : AverageTestBase(GET_PARAM(0), 1), sum_asm_(0), sum_c_(0) {
@ -195,8 +186,7 @@ class IntProColTest
typedef int (*SatdFunc)(const int16_t *coeffs, int length); typedef int (*SatdFunc)(const int16_t *coeffs, int length);
typedef std::tr1::tuple<int, SatdFunc> SatdTestParam; typedef std::tr1::tuple<int, SatdFunc> SatdTestParam;
class SatdTest class SatdTest : public ::testing::Test,
: public ::testing::Test,
public ::testing::WithParamInterface<SatdTestParam> { public ::testing::WithParamInterface<SatdTestParam> {
protected: protected:
virtual void SetUp() { virtual void SetUp() {
@ -286,7 +276,6 @@ TEST_P(IntProColTest, Random) {
RunComparison(); RunComparison();
} }
TEST_P(SatdTest, MinValue) { TEST_P(SatdTest, MinValue) {
const int kMin = -32640; const int kMin = -32640;
const int expected = -kMin * satd_size_; const int expected = -kMin * satd_size_;
@ -320,14 +309,11 @@ using std::tr1::make_tuple;
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
C, AverageTest, C, AverageTest,
::testing::Values( ::testing::Values(make_tuple(16, 16, 1, 8, &vpx_avg_8x8_c),
make_tuple(16, 16, 1, 8, &vpx_avg_8x8_c),
make_tuple(16, 16, 1, 4, &vpx_avg_4x4_c))); make_tuple(16, 16, 1, 4, &vpx_avg_4x4_c)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(C, SatdTest,
C, SatdTest, ::testing::Values(make_tuple(16, &vpx_satd_c),
::testing::Values(
make_tuple(16, &vpx_satd_c),
make_tuple(64, &vpx_satd_c), make_tuple(64, &vpx_satd_c),
make_tuple(256, &vpx_satd_c), make_tuple(256, &vpx_satd_c),
make_tuple(1024, &vpx_satd_c))); make_tuple(1024, &vpx_satd_c)));
@ -335,8 +321,7 @@ INSTANTIATE_TEST_CASE_P(
#if HAVE_SSE2 #if HAVE_SSE2
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, AverageTest, SSE2, AverageTest,
::testing::Values( ::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_sse2),
make_tuple(16, 16, 0, 8, &vpx_avg_8x8_sse2),
make_tuple(16, 16, 5, 8, &vpx_avg_8x8_sse2), make_tuple(16, 16, 5, 8, &vpx_avg_8x8_sse2),
make_tuple(32, 32, 15, 8, &vpx_avg_8x8_sse2), make_tuple(32, 32, 15, 8, &vpx_avg_8x8_sse2),
make_tuple(16, 16, 0, 4, &vpx_avg_4x4_sse2), make_tuple(16, 16, 0, 4, &vpx_avg_4x4_sse2),
@ -344,21 +329,21 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(32, 32, 15, 4, &vpx_avg_4x4_sse2))); make_tuple(32, 32, 15, 4, &vpx_avg_4x4_sse2)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, IntProRowTest, ::testing::Values( SSE2, IntProRowTest,
make_tuple(16, &vpx_int_pro_row_sse2, &vpx_int_pro_row_c), ::testing::Values(make_tuple(16, &vpx_int_pro_row_sse2, &vpx_int_pro_row_c),
make_tuple(32, &vpx_int_pro_row_sse2, &vpx_int_pro_row_c), make_tuple(32, &vpx_int_pro_row_sse2, &vpx_int_pro_row_c),
make_tuple(64, &vpx_int_pro_row_sse2, &vpx_int_pro_row_c))); make_tuple(64, &vpx_int_pro_row_sse2,
&vpx_int_pro_row_c)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, IntProColTest, ::testing::Values( SSE2, IntProColTest,
make_tuple(16, &vpx_int_pro_col_sse2, &vpx_int_pro_col_c), ::testing::Values(make_tuple(16, &vpx_int_pro_col_sse2, &vpx_int_pro_col_c),
make_tuple(32, &vpx_int_pro_col_sse2, &vpx_int_pro_col_c), make_tuple(32, &vpx_int_pro_col_sse2, &vpx_int_pro_col_c),
make_tuple(64, &vpx_int_pro_col_sse2, &vpx_int_pro_col_c))); make_tuple(64, &vpx_int_pro_col_sse2,
&vpx_int_pro_col_c)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(SSE2, SatdTest,
SSE2, SatdTest, ::testing::Values(make_tuple(16, &vpx_satd_sse2),
::testing::Values(
make_tuple(16, &vpx_satd_sse2),
make_tuple(64, &vpx_satd_sse2), make_tuple(64, &vpx_satd_sse2),
make_tuple(256, &vpx_satd_sse2), make_tuple(256, &vpx_satd_sse2),
make_tuple(1024, &vpx_satd_sse2))); make_tuple(1024, &vpx_satd_sse2)));
@ -367,8 +352,7 @@ INSTANTIATE_TEST_CASE_P(
#if HAVE_NEON #if HAVE_NEON
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
NEON, AverageTest, NEON, AverageTest,
::testing::Values( ::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_neon),
make_tuple(16, 16, 0, 8, &vpx_avg_8x8_neon),
make_tuple(16, 16, 5, 8, &vpx_avg_8x8_neon), make_tuple(16, 16, 5, 8, &vpx_avg_8x8_neon),
make_tuple(32, 32, 15, 8, &vpx_avg_8x8_neon), make_tuple(32, 32, 15, 8, &vpx_avg_8x8_neon),
make_tuple(16, 16, 0, 4, &vpx_avg_4x4_neon), make_tuple(16, 16, 0, 4, &vpx_avg_4x4_neon),
@ -376,21 +360,21 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(32, 32, 15, 4, &vpx_avg_4x4_neon))); make_tuple(32, 32, 15, 4, &vpx_avg_4x4_neon)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
NEON, IntProRowTest, ::testing::Values( NEON, IntProRowTest,
make_tuple(16, &vpx_int_pro_row_neon, &vpx_int_pro_row_c), ::testing::Values(make_tuple(16, &vpx_int_pro_row_neon, &vpx_int_pro_row_c),
make_tuple(32, &vpx_int_pro_row_neon, &vpx_int_pro_row_c), make_tuple(32, &vpx_int_pro_row_neon, &vpx_int_pro_row_c),
make_tuple(64, &vpx_int_pro_row_neon, &vpx_int_pro_row_c))); make_tuple(64, &vpx_int_pro_row_neon,
&vpx_int_pro_row_c)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
NEON, IntProColTest, ::testing::Values( NEON, IntProColTest,
make_tuple(16, &vpx_int_pro_col_neon, &vpx_int_pro_col_c), ::testing::Values(make_tuple(16, &vpx_int_pro_col_neon, &vpx_int_pro_col_c),
make_tuple(32, &vpx_int_pro_col_neon, &vpx_int_pro_col_c), make_tuple(32, &vpx_int_pro_col_neon, &vpx_int_pro_col_c),
make_tuple(64, &vpx_int_pro_col_neon, &vpx_int_pro_col_c))); make_tuple(64, &vpx_int_pro_col_neon,
&vpx_int_pro_col_c)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(NEON, SatdTest,
NEON, SatdTest, ::testing::Values(make_tuple(16, &vpx_satd_neon),
::testing::Values(
make_tuple(16, &vpx_satd_neon),
make_tuple(64, &vpx_satd_neon), make_tuple(64, &vpx_satd_neon),
make_tuple(256, &vpx_satd_neon), make_tuple(256, &vpx_satd_neon),
make_tuple(1024, &vpx_satd_neon))); make_tuple(1024, &vpx_satd_neon)));
@ -399,8 +383,7 @@ INSTANTIATE_TEST_CASE_P(
#if HAVE_MSA #if HAVE_MSA
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
MSA, AverageTest, MSA, AverageTest,
::testing::Values( ::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_msa),
make_tuple(16, 16, 0, 8, &vpx_avg_8x8_msa),
make_tuple(16, 16, 5, 8, &vpx_avg_8x8_msa), make_tuple(16, 16, 5, 8, &vpx_avg_8x8_msa),
make_tuple(32, 32, 15, 8, &vpx_avg_8x8_msa), make_tuple(32, 32, 15, 8, &vpx_avg_8x8_msa),
make_tuple(16, 16, 0, 4, &vpx_avg_4x4_msa), make_tuple(16, 16, 0, 4, &vpx_avg_4x4_msa),

View File

@ -26,9 +26,7 @@
#include "vpx_mem/vpx_mem.h" #include "vpx_mem/vpx_mem.h"
extern "C" double vp9_get_blockiness(const unsigned char *img1, int img1_pitch,
extern "C"
double vp9_get_blockiness(const unsigned char *img1, int img1_pitch,
const unsigned char *img2, int img2_pitch, const unsigned char *img2, int img2_pitch,
int width, int height); int width, int height);
@ -53,9 +51,7 @@ class BlockinessTestBase : public ::testing::Test {
reference_data_ = NULL; reference_data_ = NULL;
} }
virtual void TearDown() { virtual void TearDown() { libvpx_test::ClearSystemState(); }
libvpx_test::ClearSystemState();
}
protected: protected:
// Handle frames up to 640x480 // Handle frames up to 640x480
@ -68,8 +64,8 @@ class BlockinessTestBase : public ::testing::Test {
rnd_.Reset(ACMRandom::DeterministicSeed()); rnd_.Reset(ACMRandom::DeterministicSeed());
} }
void FillConstant(uint8_t *data, int stride, uint8_t fill_constant, void FillConstant(uint8_t *data, int stride, uint8_t fill_constant, int width,
int width, int height) { int height) {
for (int h = 0; h < height; ++h) { for (int h = 0; h < height; ++h) {
for (int w = 0; w < width; ++w) { for (int w = 0; w < width; ++w) {
data[h * stride + w] = fill_constant; data[h * stride + w] = fill_constant;
@ -153,9 +149,8 @@ class BlockinessVP9Test
protected: protected:
double GetBlockiness() const { double GetBlockiness() const {
return vp9_get_blockiness(source_data_, source_stride_, return vp9_get_blockiness(source_data_, source_stride_, reference_data_,
reference_data_, reference_stride_, reference_stride_, width_, height_);
width_, height_);
} }
}; };
#endif // CONFIG_VP9_ENCODER #endif // CONFIG_VP9_ENCODER
@ -212,7 +207,6 @@ TEST_P(BlockinessVP9Test, WorstCaseBlockiness) {
} }
#endif // CONFIG_VP9_ENCODER #endif // CONFIG_VP9_ENCODER
using std::tr1::make_tuple; using std::tr1::make_tuple;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -220,9 +214,7 @@ using std::tr1::make_tuple;
#if CONFIG_VP9_ENCODER #if CONFIG_VP9_ENCODER
const BlockinessParam c_vp9_tests[] = { const BlockinessParam c_vp9_tests[] = {
make_tuple(320, 240), make_tuple(320, 240), make_tuple(318, 242), make_tuple(318, 238),
make_tuple(318, 242),
make_tuple(318, 238),
}; };
INSTANTIATE_TEST_CASE_P(C, BlockinessVP9Test, ::testing::ValuesIn(c_vp9_tests)); INSTANTIATE_TEST_CASE_P(C, BlockinessVP9Test, ::testing::ValuesIn(c_vp9_tests));
#endif #endif

View File

@ -17,7 +17,8 @@
namespace { namespace {
class BordersTest : public ::libvpx_test::EncoderTest, class BordersTest
: public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> { public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
protected: protected:
BordersTest() : EncoderTest(GET_PARAM(0)) {} BordersTest() : EncoderTest(GET_PARAM(0)) {}
@ -78,6 +79,6 @@ TEST_P(BordersTest, TestLowBitrate) {
ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
} }
VP9_INSTANTIATE_TEST_CASE(BordersTest, ::testing::Values( VP9_INSTANTIATE_TEST_CASE(BordersTest,
::libvpx_test::kTwoPassGood)); ::testing::Values(::libvpx_test::kTwoPassGood));
} // namespace } // namespace

View File

@ -55,10 +55,7 @@ const ByteAlignmentTestParam kBaTestParams[] = {
class ByteAlignmentTest class ByteAlignmentTest
: public ::testing::TestWithParam<ByteAlignmentTestParam> { : public ::testing::TestWithParam<ByteAlignmentTestParam> {
protected: protected:
ByteAlignmentTest() ByteAlignmentTest() : video_(NULL), decoder_(NULL), md5_file_(NULL) {}
: video_(NULL),
decoder_(NULL),
md5_file_(NULL) {}
virtual void SetUp() { virtual void SetUp() {
video_ = new libvpx_test::WebMVideoSource(kVP9TestFile); video_ = new libvpx_test::WebMVideoSource(kVP9TestFile);
@ -74,8 +71,7 @@ class ByteAlignmentTest
} }
virtual void TearDown() { virtual void TearDown() {
if (md5_file_ != NULL) if (md5_file_ != NULL) fclose(md5_file_);
fclose(md5_file_);
delete decoder_; delete decoder_;
delete video_; delete video_;
@ -89,8 +85,7 @@ class ByteAlignmentTest
const vpx_codec_err_t res = const vpx_codec_err_t res =
decoder_->DecodeFrame(video_->cxdata(), video_->frame_size()); decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
CheckDecodedFrames(byte_alignment_to_check); CheckDecodedFrames(byte_alignment_to_check);
if (res == VPX_CODEC_OK) if (res == VPX_CODEC_OK) video_->Next();
video_->Next();
return res; return res;
} }
@ -98,8 +93,7 @@ class ByteAlignmentTest
for (; video_->cxdata() != NULL; video_->Next()) { for (; video_->cxdata() != NULL; video_->Next()) {
const vpx_codec_err_t res = const vpx_codec_err_t res =
decoder_->DecodeFrame(video_->cxdata(), video_->frame_size()); decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
if (res != VPX_CODEC_OK) if (res != VPX_CODEC_OK) return res;
return res;
CheckDecodedFrames(byte_alignment_to_check); CheckDecodedFrames(byte_alignment_to_check);
} }
return VPX_CODEC_OK; return VPX_CODEC_OK;

View File

@ -54,19 +54,19 @@ class CodecFactory {
* definition. * definition.
*/ */
template <class T1> template <class T1>
class CodecTestWithParam : public ::testing::TestWithParam< class CodecTestWithParam
std::tr1::tuple< const libvpx_test::CodecFactory*, T1 > > { : public ::testing::TestWithParam<
}; std::tr1::tuple<const libvpx_test::CodecFactory *, T1> > {};
template <class T1, class T2> template <class T1, class T2>
class CodecTestWith2Params : public ::testing::TestWithParam< class CodecTestWith2Params
std::tr1::tuple< const libvpx_test::CodecFactory*, T1, T2 > > { : public ::testing::TestWithParam<
}; std::tr1::tuple<const libvpx_test::CodecFactory *, T1, T2> > {};
template <class T1, class T2, class T3> template <class T1, class T2, class T3>
class CodecTestWith3Params : public ::testing::TestWithParam< class CodecTestWith3Params
std::tr1::tuple< const libvpx_test::CodecFactory*, T1, T2, T3 > > { : public ::testing::TestWithParam<
}; std::tr1::tuple<const libvpx_test::CodecFactory *, T1, T2, T3> > {};
/* /*
* VP8 Codec Definitions * VP8 Codec Definitions
@ -150,7 +150,8 @@ class VP8CodecFactory : public CodecFactory {
const libvpx_test::VP8CodecFactory kVP8; const libvpx_test::VP8CodecFactory kVP8;
#define VP8_INSTANTIATE_TEST_CASE(test, ...) \ #define VP8_INSTANTIATE_TEST_CASE(test, ...) \
INSTANTIATE_TEST_CASE_P(VP8, test, \ INSTANTIATE_TEST_CASE_P( \
VP8, test, \
::testing::Combine( \ ::testing::Combine( \
::testing::Values(static_cast<const libvpx_test::CodecFactory *>( \ ::testing::Values(static_cast<const libvpx_test::CodecFactory *>( \
&libvpx_test::kVP8)), \ &libvpx_test::kVP8)), \
@ -159,7 +160,6 @@ const libvpx_test::VP8CodecFactory kVP8;
#define VP8_INSTANTIATE_TEST_CASE(test, ...) #define VP8_INSTANTIATE_TEST_CASE(test, ...)
#endif // CONFIG_VP8 #endif // CONFIG_VP8
/* /*
* VP9 Codec Definitions * VP9 Codec Definitions
*/ */
@ -242,7 +242,8 @@ class VP9CodecFactory : public CodecFactory {
const libvpx_test::VP9CodecFactory kVP9; const libvpx_test::VP9CodecFactory kVP9;
#define VP9_INSTANTIATE_TEST_CASE(test, ...) \ #define VP9_INSTANTIATE_TEST_CASE(test, ...) \
INSTANTIATE_TEST_CASE_P(VP9, test, \ INSTANTIATE_TEST_CASE_P( \
VP9, test, \
::testing::Combine( \ ::testing::Combine( \
::testing::Values(static_cast<const libvpx_test::CodecFactory *>( \ ::testing::Values(static_cast<const libvpx_test::CodecFactory *>( \
&libvpx_test::kVP9)), \ &libvpx_test::kVP9)), \

View File

@ -15,11 +15,13 @@
namespace { namespace {
class ConfigTest : public ::libvpx_test::EncoderTest, class ConfigTest
: public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> { public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
protected: protected:
ConfigTest() : EncoderTest(GET_PARAM(0)), ConfigTest()
frame_count_in_(0), frame_count_out_(0), frame_count_max_(0) {} : EncoderTest(GET_PARAM(0)), frame_count_in_(0), frame_count_out_(0),
frame_count_max_(0) {}
virtual ~ConfigTest() {} virtual ~ConfigTest() {}
virtual void SetUp() { virtual void SetUp() {

View File

@ -26,11 +26,9 @@
#include "vpx_dsp/ssim.h" #include "vpx_dsp/ssim.h"
#include "vpx_mem/vpx_mem.h" #include "vpx_mem/vpx_mem.h"
extern "C" extern "C" double vpx_get_ssim_metrics(uint8_t *img1, int img1_pitch,
double vpx_get_ssim_metrics(uint8_t *img1, int img1_pitch, uint8_t *img2, int img2_pitch, int width,
uint8_t *img2, int img2_pitch, int height, Ssimv *sv2, Metrics *m,
int width, int height,
Ssimv *sv2, Metrics *m,
int do_inconsistency); int do_inconsistency);
using libvpx_test::ACMRandom; using libvpx_test::ACMRandom;
@ -52,9 +50,7 @@ class ConsistencyTestBase : public ::testing::Test {
ssim_array_ = new Ssimv[kDataBufferSize / 16]; ssim_array_ = new Ssimv[kDataBufferSize / 16];
} }
static void ClearSsim() { static void ClearSsim() { memset(ssim_array_, 0, kDataBufferSize / 16); }
memset(ssim_array_, 0, kDataBufferSize / 16);
}
static void TearDownTestCase() { static void TearDownTestCase() {
vpx_free(source_data_[0]); vpx_free(source_data_[0]);
source_data_[0] = NULL; source_data_[0] = NULL;
@ -68,9 +64,7 @@ class ConsistencyTestBase : public ::testing::Test {
delete[] ssim_array_; delete[] ssim_array_;
} }
virtual void TearDown() { virtual void TearDown() { libvpx_test::ClearSystemState(); }
libvpx_test::ClearSystemState();
}
protected: protected:
// Handle frames up to 640x480 // Handle frames up to 640x480
@ -143,8 +137,7 @@ class ConsistencyVP9Test
protected: protected:
double CheckConsistency(int frame) { double CheckConsistency(int frame) {
EXPECT_LT(frame, 2) << "Frame to check has to be less than 2."; EXPECT_LT(frame, 2) << "Frame to check has to be less than 2.";
return return vpx_get_ssim_metrics(source_data_[frame], source_stride_,
vpx_get_ssim_metrics(source_data_[frame], source_stride_,
reference_data_[frame], reference_stride_, reference_data_[frame], reference_stride_,
width_, height_, ssim_array_, &metrics_, 1); width_, height_, ssim_array_, &metrics_, 1);
} }
@ -205,7 +198,6 @@ TEST_P(ConsistencyVP9Test, ConsistencyIsZero) {
} }
#endif // CONFIG_VP9_ENCODER #endif // CONFIG_VP9_ENCODER
using std::tr1::make_tuple; using std::tr1::make_tuple;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -213,9 +205,7 @@ using std::tr1::make_tuple;
#if CONFIG_VP9_ENCODER #if CONFIG_VP9_ENCODER
const ConsistencyParam c_vp9_tests[] = { const ConsistencyParam c_vp9_tests[] = {
make_tuple(320, 240), make_tuple(320, 240), make_tuple(318, 242), make_tuple(318, 238),
make_tuple(318, 242),
make_tuple(318, 238),
}; };
INSTANTIATE_TEST_CASE_P(C, ConsistencyVP9Test, INSTANTIATE_TEST_CASE_P(C, ConsistencyVP9Test,
::testing::ValuesIn(c_vp9_tests)); ::testing::ValuesIn(c_vp9_tests));

View File

@ -37,14 +37,12 @@ typedef void (*ConvolveFunc)(const uint8_t *src, ptrdiff_t src_stride,
int w, int h); int w, int h);
struct ConvolveFunctions { struct ConvolveFunctions {
ConvolveFunctions(ConvolveFunc copy, ConvolveFunc avg, ConvolveFunctions(ConvolveFunc copy, ConvolveFunc avg, ConvolveFunc h8,
ConvolveFunc h8, ConvolveFunc h8_avg, ConvolveFunc h8_avg, ConvolveFunc v8, ConvolveFunc v8_avg,
ConvolveFunc v8, ConvolveFunc v8_avg, ConvolveFunc hv8, ConvolveFunc hv8_avg, ConvolveFunc sh8,
ConvolveFunc hv8, ConvolveFunc hv8_avg, ConvolveFunc sh8_avg, ConvolveFunc sv8,
ConvolveFunc sh8, ConvolveFunc sh8_avg, ConvolveFunc sv8_avg, ConvolveFunc shv8,
ConvolveFunc sv8, ConvolveFunc sv8_avg, ConvolveFunc shv8_avg, int bd)
ConvolveFunc shv8, ConvolveFunc shv8_avg,
int bd)
: copy_(copy), avg_(avg), h8_(h8), v8_(v8), hv8_(hv8), h8_avg_(h8_avg), : copy_(copy), avg_(avg), h8_(h8), v8_(v8), hv8_(hv8), h8_avg_(h8_avg),
v8_avg_(v8_avg), hv8_avg_(hv8_avg), sh8_(sh8), sv8_(sv8), shv8_(shv8), v8_avg_(v8_avg), hv8_avg_(hv8_avg), sh8_(sh8), sv8_(sv8), shv8_(shv8),
sh8_avg_(sh8_avg), sv8_avg_(sv8_avg), shv8_avg_(shv8_avg), sh8_avg_(sh8_avg), sv8_avg_(sv8_avg), shv8_avg_(shv8_avg),
@ -70,37 +68,23 @@ struct ConvolveFunctions {
typedef std::tr1::tuple<int, int, const ConvolveFunctions *> ConvolveParam; typedef std::tr1::tuple<int, int, const ConvolveFunctions *> ConvolveParam;
#define ALL_SIZES(convolve_fn) \ #define ALL_SIZES(convolve_fn) \
make_tuple(4, 4, &convolve_fn), \ make_tuple(4, 4, &convolve_fn), make_tuple(8, 4, &convolve_fn), \
make_tuple(8, 4, &convolve_fn), \ make_tuple(4, 8, &convolve_fn), make_tuple(8, 8, &convolve_fn), \
make_tuple(4, 8, &convolve_fn), \ make_tuple(16, 8, &convolve_fn), make_tuple(8, 16, &convolve_fn), \
make_tuple(8, 8, &convolve_fn), \ make_tuple(16, 16, &convolve_fn), make_tuple(32, 16, &convolve_fn), \
make_tuple(16, 8, &convolve_fn), \ make_tuple(16, 32, &convolve_fn), make_tuple(32, 32, &convolve_fn), \
make_tuple(8, 16, &convolve_fn), \ make_tuple(64, 32, &convolve_fn), make_tuple(32, 64, &convolve_fn), \
make_tuple(16, 16, &convolve_fn), \
make_tuple(32, 16, &convolve_fn), \
make_tuple(16, 32, &convolve_fn), \
make_tuple(32, 32, &convolve_fn), \
make_tuple(64, 32, &convolve_fn), \
make_tuple(32, 64, &convolve_fn), \
make_tuple(64, 64, &convolve_fn) make_tuple(64, 64, &convolve_fn)
// Reference 8-tap subpixel filter, slightly modified to fit into this test. // Reference 8-tap subpixel filter, slightly modified to fit into this test.
#define VP9_FILTER_WEIGHT 128 #define VP9_FILTER_WEIGHT 128
#define VP9_FILTER_SHIFT 7 #define VP9_FILTER_SHIFT 7
uint8_t clip_pixel(int x) { uint8_t clip_pixel(int x) { return x < 0 ? 0 : x > 255 ? 255 : x; }
return x < 0 ? 0 :
x > 255 ? 255 :
x;
}
void filter_block2d_8_c(const uint8_t *src_ptr, void filter_block2d_8_c(const uint8_t *src_ptr, const unsigned int src_stride,
const unsigned int src_stride, const int16_t *HFilter, const int16_t *VFilter,
const int16_t *HFilter, uint8_t *dst_ptr, unsigned int dst_stride,
const int16_t *VFilter, unsigned int output_width, unsigned int output_height) {
uint8_t *dst_ptr,
unsigned int dst_stride,
unsigned int output_width,
unsigned int output_height) {
// Between passes, we use an intermediate buffer whose height is extended to // Between passes, we use an intermediate buffer whose height is extended to
// have enough horizontally filtered values as input for the vertical pass. // have enough horizontally filtered values as input for the vertical pass.
// This buffer is allocated to be big enough for the largest block type we // This buffer is allocated to be big enough for the largest block type we
@ -128,14 +112,10 @@ void filter_block2d_8_c(const uint8_t *src_ptr,
for (i = 0; i < intermediate_height; ++i) { for (i = 0; i < intermediate_height; ++i) {
for (j = 0; j < output_width; ++j) { for (j = 0; j < output_width; ++j) {
// Apply filter... // Apply filter...
const int temp = (src_ptr[0] * HFilter[0]) + const int temp = (src_ptr[0] * HFilter[0]) + (src_ptr[1] * HFilter[1]) +
(src_ptr[1] * HFilter[1]) + (src_ptr[2] * HFilter[2]) + (src_ptr[3] * HFilter[3]) +
(src_ptr[2] * HFilter[2]) + (src_ptr[4] * HFilter[4]) + (src_ptr[5] * HFilter[5]) +
(src_ptr[3] * HFilter[3]) + (src_ptr[6] * HFilter[6]) + (src_ptr[7] * HFilter[7]) +
(src_ptr[4] * HFilter[4]) +
(src_ptr[5] * HFilter[5]) +
(src_ptr[6] * HFilter[6]) +
(src_ptr[7] * HFilter[7]) +
(VP9_FILTER_WEIGHT >> 1); // Rounding (VP9_FILTER_WEIGHT >> 1); // Rounding
// Normalize back to 0-255... // Normalize back to 0-255...
@ -153,14 +133,10 @@ void filter_block2d_8_c(const uint8_t *src_ptr,
for (i = 0; i < output_height; ++i) { for (i = 0; i < output_height; ++i) {
for (j = 0; j < output_width; ++j) { for (j = 0; j < output_width; ++j) {
// Apply filter... // Apply filter...
const int temp = (src_ptr[0] * VFilter[0]) + const int temp = (src_ptr[0] * VFilter[0]) + (src_ptr[1] * VFilter[1]) +
(src_ptr[1] * VFilter[1]) + (src_ptr[2] * VFilter[2]) + (src_ptr[3] * VFilter[3]) +
(src_ptr[2] * VFilter[2]) + (src_ptr[4] * VFilter[4]) + (src_ptr[5] * VFilter[5]) +
(src_ptr[3] * VFilter[3]) + (src_ptr[6] * VFilter[6]) + (src_ptr[7] * VFilter[7]) +
(src_ptr[4] * VFilter[4]) +
(src_ptr[5] * VFilter[5]) +
(src_ptr[6] * VFilter[6]) +
(src_ptr[7] * VFilter[7]) +
(VP9_FILTER_WEIGHT >> 1); // Rounding (VP9_FILTER_WEIGHT >> 1); // Rounding
// Normalize back to 0-255... // Normalize back to 0-255...
@ -172,12 +148,9 @@ void filter_block2d_8_c(const uint8_t *src_ptr,
} }
} }
void block2d_average_c(uint8_t *src, void block2d_average_c(uint8_t *src, unsigned int src_stride,
unsigned int src_stride, uint8_t *output_ptr, unsigned int output_stride,
uint8_t *output_ptr, unsigned int output_width, unsigned int output_height) {
unsigned int output_stride,
unsigned int output_width,
unsigned int output_height) {
unsigned int i, j; unsigned int i, j;
for (i = 0; i < output_height; ++i) { for (i = 0; i < output_height; ++i) {
for (j = 0; j < output_width; ++j) { for (j = 0; j < output_width; ++j) {
@ -189,10 +162,8 @@ void block2d_average_c(uint8_t *src,
void filter_average_block2d_8_c(const uint8_t *src_ptr, void filter_average_block2d_8_c(const uint8_t *src_ptr,
const unsigned int src_stride, const unsigned int src_stride,
const int16_t *HFilter, const int16_t *HFilter, const int16_t *VFilter,
const int16_t *VFilter, uint8_t *dst_ptr, unsigned int dst_stride,
uint8_t *dst_ptr,
unsigned int dst_stride,
unsigned int output_width, unsigned int output_width,
unsigned int output_height) { unsigned int output_height) {
uint8_t tmp[kMaxDimension * kMaxDimension]; uint8_t tmp[kMaxDimension * kMaxDimension];
@ -201,20 +172,16 @@ void filter_average_block2d_8_c(const uint8_t *src_ptr,
assert(output_height <= kMaxDimension); assert(output_height <= kMaxDimension);
filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, tmp, 64, filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, tmp, 64,
output_width, output_height); output_width, output_height);
block2d_average_c(tmp, 64, dst_ptr, dst_stride, block2d_average_c(tmp, 64, dst_ptr, dst_stride, output_width, output_height);
output_width, output_height);
} }
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
void highbd_filter_block2d_8_c(const uint16_t *src_ptr, void highbd_filter_block2d_8_c(const uint16_t *src_ptr,
const unsigned int src_stride, const unsigned int src_stride,
const int16_t *HFilter, const int16_t *HFilter, const int16_t *VFilter,
const int16_t *VFilter, uint16_t *dst_ptr, unsigned int dst_stride,
uint16_t *dst_ptr,
unsigned int dst_stride,
unsigned int output_width, unsigned int output_width,
unsigned int output_height, unsigned int output_height, int bd) {
int bd) {
// Between passes, we use an intermediate buffer whose height is extended to // Between passes, we use an intermediate buffer whose height is extended to
// have enough horizontally filtered values as input for the vertical pass. // have enough horizontally filtered values as input for the vertical pass.
// This buffer is allocated to be big enough for the largest block type we // This buffer is allocated to be big enough for the largest block type we
@ -243,14 +210,10 @@ void highbd_filter_block2d_8_c(const uint16_t *src_ptr,
for (i = 0; i < intermediate_height; ++i) { for (i = 0; i < intermediate_height; ++i) {
for (j = 0; j < output_width; ++j) { for (j = 0; j < output_width; ++j) {
// Apply filter... // Apply filter...
const int temp = (src_ptr[0] * HFilter[0]) + const int temp = (src_ptr[0] * HFilter[0]) + (src_ptr[1] * HFilter[1]) +
(src_ptr[1] * HFilter[1]) + (src_ptr[2] * HFilter[2]) + (src_ptr[3] * HFilter[3]) +
(src_ptr[2] * HFilter[2]) + (src_ptr[4] * HFilter[4]) + (src_ptr[5] * HFilter[5]) +
(src_ptr[3] * HFilter[3]) + (src_ptr[6] * HFilter[6]) + (src_ptr[7] * HFilter[7]) +
(src_ptr[4] * HFilter[4]) +
(src_ptr[5] * HFilter[5]) +
(src_ptr[6] * HFilter[6]) +
(src_ptr[7] * HFilter[7]) +
(VP9_FILTER_WEIGHT >> 1); // Rounding (VP9_FILTER_WEIGHT >> 1); // Rounding
// Normalize back to 0-255... // Normalize back to 0-255...
@ -271,14 +234,10 @@ void highbd_filter_block2d_8_c(const uint16_t *src_ptr,
for (i = 0; i < output_height; ++i) { for (i = 0; i < output_height; ++i) {
for (j = 0; j < output_width; ++j) { for (j = 0; j < output_width; ++j) {
// Apply filter... // Apply filter...
const int temp = (src_ptr[0] * VFilter[0]) + const int temp = (src_ptr[0] * VFilter[0]) + (src_ptr[1] * VFilter[1]) +
(src_ptr[1] * VFilter[1]) + (src_ptr[2] * VFilter[2]) + (src_ptr[3] * VFilter[3]) +
(src_ptr[2] * VFilter[2]) + (src_ptr[4] * VFilter[4]) + (src_ptr[5] * VFilter[5]) +
(src_ptr[3] * VFilter[3]) + (src_ptr[6] * VFilter[6]) + (src_ptr[7] * VFilter[7]) +
(src_ptr[4] * VFilter[4]) +
(src_ptr[5] * VFilter[5]) +
(src_ptr[6] * VFilter[6]) +
(src_ptr[7] * VFilter[7]) +
(VP9_FILTER_WEIGHT >> 1); // Rounding (VP9_FILTER_WEIGHT >> 1); // Rounding
// Normalize back to 0-255... // Normalize back to 0-255...
@ -291,10 +250,8 @@ void highbd_filter_block2d_8_c(const uint16_t *src_ptr,
} }
} }
void highbd_block2d_average_c(uint16_t *src, void highbd_block2d_average_c(uint16_t *src, unsigned int src_stride,
unsigned int src_stride, uint16_t *output_ptr, unsigned int output_stride,
uint16_t *output_ptr,
unsigned int output_stride,
unsigned int output_width, unsigned int output_width,
unsigned int output_height) { unsigned int output_height) {
unsigned int i, j; unsigned int i, j;
@ -306,23 +263,19 @@ void highbd_block2d_average_c(uint16_t *src,
} }
} }
void highbd_filter_average_block2d_8_c(const uint16_t *src_ptr, void highbd_filter_average_block2d_8_c(
const unsigned int src_stride, const uint16_t *src_ptr, const unsigned int src_stride,
const int16_t *HFilter, const int16_t *HFilter, const int16_t *VFilter, uint16_t *dst_ptr,
const int16_t *VFilter, unsigned int dst_stride, unsigned int output_width,
uint16_t *dst_ptr, unsigned int output_height, int bd) {
unsigned int dst_stride,
unsigned int output_width,
unsigned int output_height,
int bd) {
uint16_t tmp[kMaxDimension * kMaxDimension]; uint16_t tmp[kMaxDimension * kMaxDimension];
assert(output_width <= kMaxDimension); assert(output_width <= kMaxDimension);
assert(output_height <= kMaxDimension); assert(output_height <= kMaxDimension);
highbd_filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, tmp, 64, highbd_filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, tmp, 64,
output_width, output_height, bd); output_width, output_height, bd);
highbd_block2d_average_c(tmp, 64, dst_ptr, dst_stride, highbd_block2d_average_c(tmp, 64, dst_ptr, dst_stride, output_width,
output_width, output_height); output_height);
} }
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
@ -331,15 +284,16 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
static void SetUpTestCase() { static void SetUpTestCase() {
// Force input_ to be unaligned, output to be 16 byte aligned. // Force input_ to be unaligned, output to be 16 byte aligned.
input_ = reinterpret_cast<uint8_t *>( input_ = reinterpret_cast<uint8_t *>(
vpx_memalign(kDataAlignment, kInputBufferSize + 1)) + 1; vpx_memalign(kDataAlignment, kInputBufferSize + 1)) +
1;
output_ = reinterpret_cast<uint8_t *>( output_ = reinterpret_cast<uint8_t *>(
vpx_memalign(kDataAlignment, kOutputBufferSize)); vpx_memalign(kDataAlignment, kOutputBufferSize));
output_ref_ = reinterpret_cast<uint8_t *>( output_ref_ = reinterpret_cast<uint8_t *>(
vpx_memalign(kDataAlignment, kOutputBufferSize)); vpx_memalign(kDataAlignment, kOutputBufferSize));
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
input16_ = reinterpret_cast<uint16_t*>( input16_ = reinterpret_cast<uint16_t *>(vpx_memalign(
vpx_memalign(kDataAlignment, kDataAlignment, (kInputBufferSize + 1) * sizeof(uint16_t))) +
(kInputBufferSize + 1) * sizeof(uint16_t))) + 1; 1;
output16_ = reinterpret_cast<uint16_t *>( output16_ = reinterpret_cast<uint16_t *>(
vpx_memalign(kDataAlignment, (kOutputBufferSize) * sizeof(uint16_t))); vpx_memalign(kDataAlignment, (kOutputBufferSize) * sizeof(uint16_t)));
output16_ref_ = reinterpret_cast<uint16_t *>( output16_ref_ = reinterpret_cast<uint16_t *>(
@ -438,8 +392,7 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
void CheckGuardBlocks() { void CheckGuardBlocks() {
for (int i = 0; i < kOutputBufferSize; ++i) { for (int i = 0; i < kOutputBufferSize; ++i) {
if (IsIndexInBorder(i)) if (IsIndexInBorder(i)) EXPECT_EQ(255, output_[i]);
EXPECT_EQ(255, output_[i]);
} }
} }
@ -506,54 +459,47 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
#endif #endif
} }
void wrapper_filter_average_block2d_8_c(const uint8_t *src_ptr, void wrapper_filter_average_block2d_8_c(
const unsigned int src_stride, const uint8_t *src_ptr, const unsigned int src_stride,
const int16_t *HFilter, const int16_t *HFilter, const int16_t *VFilter, uint8_t *dst_ptr,
const int16_t *VFilter, unsigned int dst_stride, unsigned int output_width,
uint8_t *dst_ptr,
unsigned int dst_stride,
unsigned int output_width,
unsigned int output_height) { unsigned int output_height) {
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
if (UUT_->use_highbd_ == 0) { if (UUT_->use_highbd_ == 0) {
filter_average_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, filter_average_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, dst_ptr,
dst_ptr, dst_stride, output_width, dst_stride, output_width, output_height);
output_height);
} else { } else {
highbd_filter_average_block2d_8_c(CONVERT_TO_SHORTPTR(src_ptr), highbd_filter_average_block2d_8_c(
src_stride, HFilter, VFilter, CONVERT_TO_SHORTPTR(src_ptr), src_stride, HFilter, VFilter,
CONVERT_TO_SHORTPTR(dst_ptr), CONVERT_TO_SHORTPTR(dst_ptr), dst_stride, output_width, output_height,
dst_stride, output_width, output_height,
UUT_->use_highbd_); UUT_->use_highbd_);
} }
#else #else
filter_average_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, filter_average_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, dst_ptr,
dst_ptr, dst_stride, output_width, dst_stride, output_width, output_height);
output_height);
#endif #endif
} }
void wrapper_filter_block2d_8_c(const uint8_t *src_ptr, void wrapper_filter_block2d_8_c(const uint8_t *src_ptr,
const unsigned int src_stride, const unsigned int src_stride,
const int16_t *HFilter, const int16_t *HFilter,
const int16_t *VFilter, const int16_t *VFilter, uint8_t *dst_ptr,
uint8_t *dst_ptr,
unsigned int dst_stride, unsigned int dst_stride,
unsigned int output_width, unsigned int output_width,
unsigned int output_height) { unsigned int output_height) {
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
if (UUT_->use_highbd_ == 0) { if (UUT_->use_highbd_ == 0) {
filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, dst_ptr,
dst_ptr, dst_stride, output_width, output_height); dst_stride, output_width, output_height);
} else { } else {
highbd_filter_block2d_8_c(CONVERT_TO_SHORTPTR(src_ptr), src_stride, highbd_filter_block2d_8_c(CONVERT_TO_SHORTPTR(src_ptr), src_stride,
HFilter, VFilter, HFilter, VFilter, CONVERT_TO_SHORTPTR(dst_ptr),
CONVERT_TO_SHORTPTR(dst_ptr), dst_stride, dst_stride, output_width, output_height,
output_width, output_height, UUT_->use_highbd_); UUT_->use_highbd_);
} }
#else #else
filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, dst_ptr,
dst_ptr, dst_stride, output_width, output_height); dst_stride, output_width, output_height);
#endif #endif
} }
@ -578,17 +524,14 @@ uint16_t* ConvolveTest::output16_ = NULL;
uint16_t *ConvolveTest::output16_ref_ = NULL; uint16_t *ConvolveTest::output16_ref_ = NULL;
#endif #endif
TEST_P(ConvolveTest, GuardBlocks) { TEST_P(ConvolveTest, GuardBlocks) { CheckGuardBlocks(); }
CheckGuardBlocks();
}
TEST_P(ConvolveTest, Copy) { TEST_P(ConvolveTest, Copy) {
uint8_t *const in = input(); uint8_t *const in = input();
uint8_t *const out = output(); uint8_t *const out = output();
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(UUT_->copy_(in, kInputStride, out, kOutputStride,
UUT_->copy_(in, kInputStride, out, kOutputStride, NULL, 0, NULL, 0, NULL, 0, NULL, 0, Width(), Height()));
Width(), Height()));
CheckGuardBlocks(); CheckGuardBlocks();
@ -605,9 +548,8 @@ TEST_P(ConvolveTest, Avg) {
uint8_t *const out_ref = output_ref(); uint8_t *const out_ref = output_ref();
CopyOutputToRef(); CopyOutputToRef();
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(UUT_->avg_(in, kInputStride, out, kOutputStride,
UUT_->avg_(in, kInputStride, out, kOutputStride, NULL, 0, NULL, 0, NULL, 0, NULL, 0, Width(), Height()));
Width(), Height()));
CheckGuardBlocks(); CheckGuardBlocks();
@ -615,18 +557,20 @@ TEST_P(ConvolveTest, Avg) {
for (int x = 0; x < Width(); ++x) for (int x = 0; x < Width(); ++x)
ASSERT_EQ(lookup(out, y * kOutputStride + x), ASSERT_EQ(lookup(out, y * kOutputStride + x),
ROUND_POWER_OF_TWO(lookup(in, y * kInputStride + x) + ROUND_POWER_OF_TWO(lookup(in, y * kInputStride + x) +
lookup(out_ref, y * kOutputStride + x), 1)) lookup(out_ref, y * kOutputStride + x),
1))
<< "(" << x << "," << y << ")"; << "(" << x << "," << y << ")";
} }
TEST_P(ConvolveTest, CopyHoriz) { TEST_P(ConvolveTest, CopyHoriz) {
uint8_t *const in = input(); uint8_t *const in = input();
uint8_t *const out = output(); uint8_t *const out = output();
DECLARE_ALIGNED(256, const int16_t, filter8[8]) = {0, 0, 0, 128, 0, 0, 0, 0}; DECLARE_ALIGNED(256, const int16_t,
filter8[8]) = { 0, 0, 0, 128, 0, 0, 0, 0 };
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(UUT_->sh8_(in, kInputStride, out, kOutputStride,
UUT_->sh8_(in, kInputStride, out, kOutputStride, filter8, 16, filter8, 16, filter8, 16, filter8, 16, Width(),
Width(), Height())); Height()));
CheckGuardBlocks(); CheckGuardBlocks();
@ -640,11 +584,12 @@ TEST_P(ConvolveTest, CopyHoriz) {
TEST_P(ConvolveTest, CopyVert) { TEST_P(ConvolveTest, CopyVert) {
uint8_t *const in = input(); uint8_t *const in = input();
uint8_t *const out = output(); uint8_t *const out = output();
DECLARE_ALIGNED(256, const int16_t, filter8[8]) = {0, 0, 0, 128, 0, 0, 0, 0}; DECLARE_ALIGNED(256, const int16_t,
filter8[8]) = { 0, 0, 0, 128, 0, 0, 0, 0 };
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(UUT_->sv8_(in, kInputStride, out, kOutputStride,
UUT_->sv8_(in, kInputStride, out, kOutputStride, filter8, 16, filter8, 16, filter8, 16, filter8, 16, Width(),
Width(), Height())); Height()));
CheckGuardBlocks(); CheckGuardBlocks();
@ -658,11 +603,12 @@ TEST_P(ConvolveTest, CopyVert) {
TEST_P(ConvolveTest, Copy2D) { TEST_P(ConvolveTest, Copy2D) {
uint8_t *const in = input(); uint8_t *const in = input();
uint8_t *const out = output(); uint8_t *const out = output();
DECLARE_ALIGNED(256, const int16_t, filter8[8]) = {0, 0, 0, 128, 0, 0, 0, 0}; DECLARE_ALIGNED(256, const int16_t,
filter8[8]) = { 0, 0, 0, 128, 0, 0, 0, 0 };
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(UUT_->shv8_(in, kInputStride, out, kOutputStride,
UUT_->shv8_(in, kInputStride, out, kOutputStride, filter8, 16, filter8, filter8, 16, filter8, 16, Width(),
16, Width(), Height())); Height()));
CheckGuardBlocks(); CheckGuardBlocks();
@ -721,31 +667,26 @@ TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) {
for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) { for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) { for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
wrapper_filter_block2d_8_c(in, kInputStride, wrapper_filter_block2d_8_c(in, kInputStride, filters[filter_x],
filters[filter_x], filters[filter_y], filters[filter_y], ref, kOutputStride,
ref, kOutputStride,
Width(), Height()); Width(), Height());
if (filter_x && filter_y) if (filter_x && filter_y)
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(UUT_->hv8_(
UUT_->hv8_(in, kInputStride, out, kOutputStride, in, kInputStride, out, kOutputStride, filters[filter_x], 16,
filters[filter_x], 16, filters[filter_y], 16, filters[filter_y], 16, Width(), Height()));
Width(), Height()));
else if (filter_y) else if (filter_y)
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(
UUT_->v8_(in, kInputStride, out, kOutputStride, UUT_->v8_(in, kInputStride, out, kOutputStride, kInvalidFilter,
kInvalidFilter, 16, filters[filter_y], 16, 16, filters[filter_y], 16, Width(), Height()));
Width(), Height()));
else if (filter_x) else if (filter_x)
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(
UUT_->h8_(in, kInputStride, out, kOutputStride, UUT_->h8_(in, kInputStride, out, kOutputStride, filters[filter_x],
filters[filter_x], 16, kInvalidFilter, 16, 16, kInvalidFilter, 16, Width(), Height()));
Width(), Height()));
else else
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(
UUT_->copy_(in, kInputStride, out, kOutputStride, UUT_->copy_(in, kInputStride, out, kOutputStride, kInvalidFilter,
kInvalidFilter, 0, kInvalidFilter, 0, 0, kInvalidFilter, 0, Width(), Height()));
Width(), Height()));
CheckGuardBlocks(); CheckGuardBlocks();
@ -754,8 +695,8 @@ TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) {
ASSERT_EQ(lookup(ref, y * kOutputStride + x), ASSERT_EQ(lookup(ref, y * kOutputStride + x),
lookup(out, y * kOutputStride + x)) lookup(out, y * kOutputStride + x))
<< "mismatch at (" << x << "," << y << "), " << "mismatch at (" << x << "," << y << "), "
<< "filters (" << filter_bank << "," << "filters (" << filter_bank << "," << filter_x << ","
<< filter_x << "," << filter_y << ")"; << filter_y << ")";
} }
} }
} }
@ -803,31 +744,26 @@ TEST_P(ConvolveTest, MatchesReferenceAveragingSubpixelFilter) {
for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) { for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) { for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
wrapper_filter_average_block2d_8_c(in, kInputStride, wrapper_filter_average_block2d_8_c(in, kInputStride, filters[filter_x],
filters[filter_x], filters[filter_y], filters[filter_y], ref,
ref, kOutputStride, kOutputStride, Width(), Height());
Width(), Height());
if (filter_x && filter_y) if (filter_x && filter_y)
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(UUT_->hv8_avg_(
UUT_->hv8_avg_(in, kInputStride, out, kOutputStride, in, kInputStride, out, kOutputStride, filters[filter_x], 16,
filters[filter_x], 16, filters[filter_y], 16, filters[filter_y], 16, Width(), Height()));
Width(), Height()));
else if (filter_y) else if (filter_y)
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(UUT_->v8_avg_(
UUT_->v8_avg_(in, kInputStride, out, kOutputStride, in, kInputStride, out, kOutputStride, kInvalidFilter, 16,
kInvalidFilter, 16, filters[filter_y], 16, filters[filter_y], 16, Width(), Height()));
Width(), Height()));
else if (filter_x) else if (filter_x)
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(UUT_->h8_avg_(
UUT_->h8_avg_(in, kInputStride, out, kOutputStride, in, kInputStride, out, kOutputStride, filters[filter_x], 16,
filters[filter_x], 16, kInvalidFilter, 16, kInvalidFilter, 16, Width(), Height()));
Width(), Height()));
else else
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(
UUT_->avg_(in, kInputStride, out, kOutputStride, UUT_->avg_(in, kInputStride, out, kOutputStride, kInvalidFilter,
kInvalidFilter, 0, kInvalidFilter, 0, 0, kInvalidFilter, 0, Width(), Height()));
Width(), Height()));
CheckGuardBlocks(); CheckGuardBlocks();
@ -836,8 +772,8 @@ TEST_P(ConvolveTest, MatchesReferenceAveragingSubpixelFilter) {
ASSERT_EQ(lookup(ref, y * kOutputStride + x), ASSERT_EQ(lookup(ref, y * kOutputStride + x),
lookup(out, y * kOutputStride + x)) lookup(out, y * kOutputStride + x))
<< "mismatch at (" << x << "," << y << "), " << "mismatch at (" << x << "," << y << "), "
<< "filters (" << filter_bank << "," << "filters (" << filter_bank << "," << filter_x << ","
<< filter_x << "," << filter_y << ")"; << filter_y << ")";
} }
} }
} }
@ -904,38 +840,33 @@ TEST_P(ConvolveTest, FilterExtremes) {
vp9_filter_kernels[static_cast<INTERP_FILTER>(filter_bank)]; vp9_filter_kernels[static_cast<INTERP_FILTER>(filter_bank)];
for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) { for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) { for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
wrapper_filter_block2d_8_c(in, kInputStride, wrapper_filter_block2d_8_c(in, kInputStride, filters[filter_x],
filters[filter_x], filters[filter_y], filters[filter_y], ref, kOutputStride,
ref, kOutputStride,
Width(), Height()); Width(), Height());
if (filter_x && filter_y) if (filter_x && filter_y)
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(UUT_->hv8_(
UUT_->hv8_(in, kInputStride, out, kOutputStride, in, kInputStride, out, kOutputStride, filters[filter_x], 16,
filters[filter_x], 16, filters[filter_y], 16, filters[filter_y], 16, Width(), Height()));
Width(), Height()));
else if (filter_y) else if (filter_y)
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(UUT_->v8_(
UUT_->v8_(in, kInputStride, out, kOutputStride, in, kInputStride, out, kOutputStride, kInvalidFilter, 16,
kInvalidFilter, 16, filters[filter_y], 16, filters[filter_y], 16, Width(), Height()));
Width(), Height()));
else if (filter_x) else if (filter_x)
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(UUT_->h8_(
UUT_->h8_(in, kInputStride, out, kOutputStride, in, kInputStride, out, kOutputStride, filters[filter_x], 16,
filters[filter_x], 16, kInvalidFilter, 16, kInvalidFilter, 16, Width(), Height()));
Width(), Height()));
else else
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(UUT_->copy_(
UUT_->copy_(in, kInputStride, out, kOutputStride, in, kInputStride, out, kOutputStride, kInvalidFilter, 0,
kInvalidFilter, 0, kInvalidFilter, 0, kInvalidFilter, 0, Width(), Height()));
Width(), Height()));
for (int y = 0; y < Height(); ++y) for (int y = 0; y < Height(); ++y)
for (int x = 0; x < Width(); ++x) for (int x = 0; x < Width(); ++x)
ASSERT_EQ(lookup(ref, y * kOutputStride + x), ASSERT_EQ(lookup(ref, y * kOutputStride + x),
lookup(out, y * kOutputStride + x)) lookup(out, y * kOutputStride + x))
<< "mismatch at (" << x << "," << y << "), " << "mismatch at (" << x << "," << y << "), "
<< "filters (" << filter_bank << "," << "filters (" << filter_bank << "," << filter_x << ","
<< filter_x << "," << filter_y << ")"; << filter_y << ")";
} }
} }
} }
@ -956,9 +887,8 @@ TEST_P(ConvolveTest, CheckScalingFiltering) {
for (int step = 1; step <= 32; ++step) { for (int step = 1; step <= 32; ++step) {
/* Test the horizontal and vertical filters in combination. */ /* Test the horizontal and vertical filters in combination. */
ASM_REGISTER_STATE_CHECK(UUT_->shv8_(in, kInputStride, out, kOutputStride, ASM_REGISTER_STATE_CHECK(UUT_->shv8_(in, kInputStride, out, kOutputStride,
eighttap[frac], step, eighttap[frac], step, eighttap[frac],
eighttap[frac], step, step, Width(), Height()));
Width(), Height()));
CheckGuardBlocks(); CheckGuardBlocks();
@ -966,8 +896,8 @@ TEST_P(ConvolveTest, CheckScalingFiltering) {
for (int x = 0; x < Width(); ++x) { for (int x = 0; x < Width(); ++x) {
ASSERT_EQ(lookup(in, y * kInputStride + x), ASSERT_EQ(lookup(in, y * kInputStride + x),
lookup(out, y * kOutputStride + x)) lookup(out, y * kOutputStride + x))
<< "x == " << x << ", y == " << y << "x == " << x << ", y == " << y << ", frac == " << frac
<< ", frac == " << frac << ", step == " << step; << ", step == " << step;
} }
} }
} }
@ -978,16 +908,12 @@ using std::tr1::make_tuple;
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
#define WRAP(func, bd) \ #define WRAP(func, bd) \
void wrap_ ## func ## _ ## bd(const uint8_t *src, ptrdiff_t src_stride, \ void wrap_##func##_##bd( \
uint8_t *dst, ptrdiff_t dst_stride, \ const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, \
const int16_t *filter_x, \ ptrdiff_t dst_stride, const int16_t *filter_x, int filter_x_stride, \
int filter_x_stride, \ const int16_t *filter_y, int filter_y_stride, int w, int h) { \
const int16_t *filter_y, \
int filter_y_stride, \
int w, int h) { \
vpx_highbd_##func(src, src_stride, dst, dst_stride, filter_x, \ vpx_highbd_##func(src, src_stride, dst, dst_stride, filter_x, \
filter_x_stride, filter_y, filter_y_stride, \ filter_x_stride, filter_y, filter_y_stride, w, h, bd); \
w, h, bd); \
} }
#if HAVE_SSE2 && ARCH_X86_64 #if HAVE_SSE2 && ARCH_X86_64
WRAP(convolve_copy_sse2, 8) WRAP(convolve_copy_sse2, 8)
@ -1043,48 +969,40 @@ WRAP(convolve8_avg_c, 12)
#undef WRAP #undef WRAP
const ConvolveFunctions convolve8_c( const ConvolveFunctions convolve8_c(
wrap_convolve_copy_c_8, wrap_convolve_avg_c_8, wrap_convolve_copy_c_8, wrap_convolve_avg_c_8, wrap_convolve8_horiz_c_8,
wrap_convolve8_avg_horiz_c_8, wrap_convolve8_vert_c_8,
wrap_convolve8_avg_vert_c_8, wrap_convolve8_c_8, wrap_convolve8_avg_c_8,
wrap_convolve8_horiz_c_8, wrap_convolve8_avg_horiz_c_8, wrap_convolve8_horiz_c_8, wrap_convolve8_avg_horiz_c_8,
wrap_convolve8_vert_c_8, wrap_convolve8_avg_vert_c_8, wrap_convolve8_vert_c_8, wrap_convolve8_avg_vert_c_8, wrap_convolve8_c_8,
wrap_convolve8_c_8, wrap_convolve8_avg_c_8, wrap_convolve8_avg_c_8, 8);
wrap_convolve8_horiz_c_8, wrap_convolve8_avg_horiz_c_8,
wrap_convolve8_vert_c_8, wrap_convolve8_avg_vert_c_8,
wrap_convolve8_c_8, wrap_convolve8_avg_c_8, 8);
const ConvolveFunctions convolve10_c( const ConvolveFunctions convolve10_c(
wrap_convolve_copy_c_10, wrap_convolve_avg_c_10, wrap_convolve_copy_c_10, wrap_convolve_avg_c_10, wrap_convolve8_horiz_c_10,
wrap_convolve8_avg_horiz_c_10, wrap_convolve8_vert_c_10,
wrap_convolve8_avg_vert_c_10, wrap_convolve8_c_10, wrap_convolve8_avg_c_10,
wrap_convolve8_horiz_c_10, wrap_convolve8_avg_horiz_c_10, wrap_convolve8_horiz_c_10, wrap_convolve8_avg_horiz_c_10,
wrap_convolve8_vert_c_10, wrap_convolve8_avg_vert_c_10, wrap_convolve8_vert_c_10, wrap_convolve8_avg_vert_c_10, wrap_convolve8_c_10,
wrap_convolve8_c_10, wrap_convolve8_avg_c_10, wrap_convolve8_avg_c_10, 10);
wrap_convolve8_horiz_c_10, wrap_convolve8_avg_horiz_c_10,
wrap_convolve8_vert_c_10, wrap_convolve8_avg_vert_c_10,
wrap_convolve8_c_10, wrap_convolve8_avg_c_10, 10);
const ConvolveFunctions convolve12_c( const ConvolveFunctions convolve12_c(
wrap_convolve_copy_c_12, wrap_convolve_avg_c_12, wrap_convolve_copy_c_12, wrap_convolve_avg_c_12, wrap_convolve8_horiz_c_12,
wrap_convolve8_avg_horiz_c_12, wrap_convolve8_vert_c_12,
wrap_convolve8_avg_vert_c_12, wrap_convolve8_c_12, wrap_convolve8_avg_c_12,
wrap_convolve8_horiz_c_12, wrap_convolve8_avg_horiz_c_12, wrap_convolve8_horiz_c_12, wrap_convolve8_avg_horiz_c_12,
wrap_convolve8_vert_c_12, wrap_convolve8_avg_vert_c_12, wrap_convolve8_vert_c_12, wrap_convolve8_avg_vert_c_12, wrap_convolve8_c_12,
wrap_convolve8_c_12, wrap_convolve8_avg_c_12, wrap_convolve8_avg_c_12, 12);
wrap_convolve8_horiz_c_12, wrap_convolve8_avg_horiz_c_12,
wrap_convolve8_vert_c_12, wrap_convolve8_avg_vert_c_12,
wrap_convolve8_c_12, wrap_convolve8_avg_c_12, 12);
const ConvolveParam kArrayConvolve_c[] = { const ConvolveParam kArrayConvolve_c[] = {
ALL_SIZES(convolve8_c), ALL_SIZES(convolve8_c), ALL_SIZES(convolve10_c), ALL_SIZES(convolve12_c)
ALL_SIZES(convolve10_c),
ALL_SIZES(convolve12_c)
}; };
#else #else
const ConvolveFunctions convolve8_c( const ConvolveFunctions convolve8_c(
vpx_convolve_copy_c, vpx_convolve_avg_c, vpx_convolve_copy_c, vpx_convolve_avg_c, vpx_convolve8_horiz_c,
vpx_convolve8_horiz_c, vpx_convolve8_avg_horiz_c, vpx_convolve8_avg_horiz_c, vpx_convolve8_vert_c, vpx_convolve8_avg_vert_c,
vpx_convolve8_vert_c, vpx_convolve8_avg_vert_c, vpx_convolve8_c, vpx_convolve8_avg_c, vpx_scaled_horiz_c,
vpx_convolve8_c, vpx_convolve8_avg_c, vpx_scaled_avg_horiz_c, vpx_scaled_vert_c, vpx_scaled_avg_vert_c,
vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c,
vpx_scaled_vert_c, vpx_scaled_avg_vert_c,
vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0); vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
const ConvolveParam kArrayConvolve_c[] = { ALL_SIZES(convolve8_c) }; const ConvolveParam kArrayConvolve_c[] = { ALL_SIZES(convolve8_c) };
#endif #endif
INSTANTIATE_TEST_CASE_P(C, ConvolveTest, INSTANTIATE_TEST_CASE_P(C, ConvolveTest, ::testing::ValuesIn(kArrayConvolve_c));
::testing::ValuesIn(kArrayConvolve_c));
#if HAVE_SSE2 && ARCH_X86_64 #if HAVE_SSE2 && ARCH_X86_64
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
@ -1112,20 +1030,16 @@ const ConvolveFunctions convolve12_sse2(
wrap_convolve8_horiz_sse2_12, wrap_convolve8_avg_horiz_sse2_12, wrap_convolve8_horiz_sse2_12, wrap_convolve8_avg_horiz_sse2_12,
wrap_convolve8_vert_sse2_12, wrap_convolve8_avg_vert_sse2_12, wrap_convolve8_vert_sse2_12, wrap_convolve8_avg_vert_sse2_12,
wrap_convolve8_sse2_12, wrap_convolve8_avg_sse2_12, 12); wrap_convolve8_sse2_12, wrap_convolve8_avg_sse2_12, 12);
const ConvolveParam kArrayConvolve_sse2[] = { const ConvolveParam kArrayConvolve_sse2[] = { ALL_SIZES(convolve8_sse2),
ALL_SIZES(convolve8_sse2),
ALL_SIZES(convolve10_sse2), ALL_SIZES(convolve10_sse2),
ALL_SIZES(convolve12_sse2) ALL_SIZES(convolve12_sse2) };
};
#else #else
const ConvolveFunctions convolve8_sse2( const ConvolveFunctions convolve8_sse2(
vpx_convolve_copy_sse2, vpx_convolve_avg_sse2, vpx_convolve_copy_sse2, vpx_convolve_avg_sse2, vpx_convolve8_horiz_sse2,
vpx_convolve8_horiz_sse2, vpx_convolve8_avg_horiz_sse2, vpx_convolve8_avg_horiz_sse2, vpx_convolve8_vert_sse2,
vpx_convolve8_vert_sse2, vpx_convolve8_avg_vert_sse2, vpx_convolve8_avg_vert_sse2, vpx_convolve8_sse2, vpx_convolve8_avg_sse2,
vpx_convolve8_sse2, vpx_convolve8_avg_sse2, vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_vert_c,
vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_avg_vert_c, vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
vpx_scaled_vert_c, vpx_scaled_avg_vert_c,
vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
const ConvolveParam kArrayConvolve_sse2[] = { ALL_SIZES(convolve8_sse2) }; const ConvolveParam kArrayConvolve_sse2[] = { ALL_SIZES(convolve8_sse2) };
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
@ -1135,13 +1049,11 @@ INSTANTIATE_TEST_CASE_P(SSE2, ConvolveTest,
#if HAVE_SSSE3 #if HAVE_SSSE3
const ConvolveFunctions convolve8_ssse3( const ConvolveFunctions convolve8_ssse3(
vpx_convolve_copy_c, vpx_convolve_avg_c, vpx_convolve_copy_c, vpx_convolve_avg_c, vpx_convolve8_horiz_ssse3,
vpx_convolve8_horiz_ssse3, vpx_convolve8_avg_horiz_ssse3, vpx_convolve8_avg_horiz_ssse3, vpx_convolve8_vert_ssse3,
vpx_convolve8_vert_ssse3, vpx_convolve8_avg_vert_ssse3, vpx_convolve8_avg_vert_ssse3, vpx_convolve8_ssse3, vpx_convolve8_avg_ssse3,
vpx_convolve8_ssse3, vpx_convolve8_avg_ssse3, vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_vert_c,
vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_avg_vert_c, vpx_scaled_2d_ssse3, vpx_scaled_avg_2d_c, 0);
vpx_scaled_vert_c, vpx_scaled_avg_vert_c,
vpx_scaled_2d_ssse3, vpx_scaled_avg_2d_c, 0);
const ConvolveParam kArrayConvolve8_ssse3[] = { ALL_SIZES(convolve8_ssse3) }; const ConvolveParam kArrayConvolve8_ssse3[] = { ALL_SIZES(convolve8_ssse3) };
INSTANTIATE_TEST_CASE_P(SSSE3, ConvolveTest, INSTANTIATE_TEST_CASE_P(SSSE3, ConvolveTest,
@ -1150,13 +1062,11 @@ INSTANTIATE_TEST_CASE_P(SSSE3, ConvolveTest,
#if HAVE_AVX2 && HAVE_SSSE3 #if HAVE_AVX2 && HAVE_SSSE3
const ConvolveFunctions convolve8_avx2( const ConvolveFunctions convolve8_avx2(
vpx_convolve_copy_c, vpx_convolve_avg_c, vpx_convolve_copy_c, vpx_convolve_avg_c, vpx_convolve8_horiz_avx2,
vpx_convolve8_horiz_avx2, vpx_convolve8_avg_horiz_ssse3, vpx_convolve8_avg_horiz_ssse3, vpx_convolve8_vert_avx2,
vpx_convolve8_vert_avx2, vpx_convolve8_avg_vert_ssse3, vpx_convolve8_avg_vert_ssse3, vpx_convolve8_avx2, vpx_convolve8_avg_ssse3,
vpx_convolve8_avx2, vpx_convolve8_avg_ssse3, vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_vert_c,
vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_avg_vert_c, vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
vpx_scaled_vert_c, vpx_scaled_avg_vert_c,
vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
const ConvolveParam kArrayConvolve8_avx2[] = { ALL_SIZES(convolve8_avx2) }; const ConvolveParam kArrayConvolve8_avx2[] = { ALL_SIZES(convolve8_avx2) };
INSTANTIATE_TEST_CASE_P(AVX2, ConvolveTest, INSTANTIATE_TEST_CASE_P(AVX2, ConvolveTest,
@ -1166,22 +1076,18 @@ INSTANTIATE_TEST_CASE_P(AVX2, ConvolveTest,
#if HAVE_NEON #if HAVE_NEON
#if HAVE_NEON_ASM #if HAVE_NEON_ASM
const ConvolveFunctions convolve8_neon( const ConvolveFunctions convolve8_neon(
vpx_convolve_copy_neon, vpx_convolve_avg_neon, vpx_convolve_copy_neon, vpx_convolve_avg_neon, vpx_convolve8_horiz_neon,
vpx_convolve8_horiz_neon, vpx_convolve8_avg_horiz_neon, vpx_convolve8_avg_horiz_neon, vpx_convolve8_vert_neon,
vpx_convolve8_vert_neon, vpx_convolve8_avg_vert_neon, vpx_convolve8_avg_vert_neon, vpx_convolve8_neon, vpx_convolve8_avg_neon,
vpx_convolve8_neon, vpx_convolve8_avg_neon, vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_vert_c,
vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_avg_vert_c, vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
vpx_scaled_vert_c, vpx_scaled_avg_vert_c,
vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
#else // HAVE_NEON #else // HAVE_NEON
const ConvolveFunctions convolve8_neon( const ConvolveFunctions convolve8_neon(
vpx_convolve_copy_neon, vpx_convolve_avg_neon, vpx_convolve_copy_neon, vpx_convolve_avg_neon, vpx_convolve8_horiz_neon,
vpx_convolve8_horiz_neon, vpx_convolve8_avg_horiz_neon, vpx_convolve8_avg_horiz_neon, vpx_convolve8_vert_neon,
vpx_convolve8_vert_neon, vpx_convolve8_avg_vert_neon, vpx_convolve8_avg_vert_neon, vpx_convolve8_neon, vpx_convolve8_avg_neon,
vpx_convolve8_neon, vpx_convolve8_avg_neon, vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_vert_c,
vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_avg_vert_c, vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
vpx_scaled_vert_c, vpx_scaled_avg_vert_c,
vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
#endif // HAVE_NEON_ASM #endif // HAVE_NEON_ASM
const ConvolveParam kArrayConvolve8_neon[] = { ALL_SIZES(convolve8_neon) }; const ConvolveParam kArrayConvolve8_neon[] = { ALL_SIZES(convolve8_neon) };
@ -1191,13 +1097,11 @@ INSTANTIATE_TEST_CASE_P(NEON, ConvolveTest,
#if HAVE_DSPR2 #if HAVE_DSPR2
const ConvolveFunctions convolve8_dspr2( const ConvolveFunctions convolve8_dspr2(
vpx_convolve_copy_dspr2, vpx_convolve_avg_dspr2, vpx_convolve_copy_dspr2, vpx_convolve_avg_dspr2, vpx_convolve8_horiz_dspr2,
vpx_convolve8_horiz_dspr2, vpx_convolve8_avg_horiz_dspr2, vpx_convolve8_avg_horiz_dspr2, vpx_convolve8_vert_dspr2,
vpx_convolve8_vert_dspr2, vpx_convolve8_avg_vert_dspr2, vpx_convolve8_avg_vert_dspr2, vpx_convolve8_dspr2, vpx_convolve8_avg_dspr2,
vpx_convolve8_dspr2, vpx_convolve8_avg_dspr2, vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_vert_c,
vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_avg_vert_c, vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
vpx_scaled_vert_c, vpx_scaled_avg_vert_c,
vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
const ConvolveParam kArrayConvolve8_dspr2[] = { ALL_SIZES(convolve8_dspr2) }; const ConvolveParam kArrayConvolve8_dspr2[] = { ALL_SIZES(convolve8_dspr2) };
INSTANTIATE_TEST_CASE_P(DSPR2, ConvolveTest, INSTANTIATE_TEST_CASE_P(DSPR2, ConvolveTest,
@ -1206,13 +1110,11 @@ INSTANTIATE_TEST_CASE_P(DSPR2, ConvolveTest,
#if HAVE_MSA #if HAVE_MSA
const ConvolveFunctions convolve8_msa( const ConvolveFunctions convolve8_msa(
vpx_convolve_copy_msa, vpx_convolve_avg_msa, vpx_convolve_copy_msa, vpx_convolve_avg_msa, vpx_convolve8_horiz_msa,
vpx_convolve8_horiz_msa, vpx_convolve8_avg_horiz_msa, vpx_convolve8_avg_horiz_msa, vpx_convolve8_vert_msa,
vpx_convolve8_vert_msa, vpx_convolve8_avg_vert_msa, vpx_convolve8_avg_vert_msa, vpx_convolve8_msa, vpx_convolve8_avg_msa,
vpx_convolve8_msa, vpx_convolve8_avg_msa, vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_vert_c,
vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_avg_vert_c, vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
vpx_scaled_vert_c, vpx_scaled_avg_vert_c,
vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
const ConvolveParam kArrayConvolve8_msa[] = { ALL_SIZES(convolve8_msa) }; const ConvolveParam kArrayConvolve8_msa[] = { ALL_SIZES(convolve8_msa) };
INSTANTIATE_TEST_CASE_P(MSA, ConvolveTest, INSTANTIATE_TEST_CASE_P(MSA, ConvolveTest,

View File

@ -23,10 +23,8 @@ class CpuSpeedTest
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> { public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
protected: protected:
CpuSpeedTest() CpuSpeedTest()
: EncoderTest(GET_PARAM(0)), : EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)),
encoding_mode_(GET_PARAM(1)), set_cpu_used_(GET_PARAM(2)), min_psnr_(kMaxPSNR),
set_cpu_used_(GET_PARAM(2)),
min_psnr_(kMaxPSNR),
tune_content_(VP9E_CONTENT_DEFAULT) {} tune_content_(VP9E_CONTENT_DEFAULT) {}
virtual ~CpuSpeedTest() {} virtual ~CpuSpeedTest() {}
@ -42,9 +40,7 @@ class CpuSpeedTest
} }
} }
virtual void BeginPassHook(unsigned int /*pass*/) { virtual void BeginPassHook(unsigned int /*pass*/) { min_psnr_ = kMaxPSNR; }
min_psnr_ = kMaxPSNR;
}
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
::libvpx_test::Encoder *encoder) { ::libvpx_test::Encoder *encoder) {
@ -61,8 +57,7 @@ class CpuSpeedTest
} }
virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) { virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
if (pkt->data.psnr.psnr[0] < min_psnr_) if (pkt->data.psnr.psnr[0] < min_psnr_) min_psnr_ = pkt->data.psnr.psnr[0];
min_psnr_ = pkt->data.psnr.psnr[0];
} }
::libvpx_test::TestMode encoding_mode_; ::libvpx_test::TestMode encoding_mode_;
@ -153,9 +148,9 @@ TEST_P(CpuSpeedTest, TestLowBitrate) {
ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
} }
VP9_INSTANTIATE_TEST_CASE( VP9_INSTANTIATE_TEST_CASE(CpuSpeedTest,
CpuSpeedTest, ::testing::Values(::libvpx_test::kTwoPassGood,
::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood, ::libvpx_test::kOnePassGood,
::libvpx_test::kRealTime), ::libvpx_test::kRealTime),
::testing::Range(0, 9)); ::testing::Range(0, 9));
} // namespace } // namespace

View File

@ -29,9 +29,7 @@ class CQTest : public ::libvpx_test::EncoderTest,
// maps the cqlevel to the bitrate produced. // maps the cqlevel to the bitrate produced.
typedef std::map<int, uint32_t> BitrateMap; typedef std::map<int, uint32_t> BitrateMap;
static void SetUpTestCase() { static void SetUpTestCase() { bitrates_.clear(); }
bitrates_.clear();
}
static void TearDownTestCase() { static void TearDownTestCase() {
ASSERT_TRUE(!HasFailure()) ASSERT_TRUE(!HasFailure())
@ -128,7 +126,6 @@ TEST_P(CQTest, LinearPSNRIsHigherForCQLevel) {
EXPECT_GE(cq_psnr_lin, vbr_psnr_lin); EXPECT_GE(cq_psnr_lin, vbr_psnr_lin);
} }
VP8_INSTANTIATE_TEST_CASE(CQTest, VP8_INSTANTIATE_TEST_CASE(CQTest, ::testing::Range(kCQLevelMin, kCQLevelMax,
::testing::Range(kCQLevelMin, kCQLevelMax,
kCQLevelStep)); kCQLevelStep));
} // namespace } // namespace

View File

@ -18,7 +18,8 @@
namespace { namespace {
class DatarateTestLarge : public ::libvpx_test::EncoderTest, class DatarateTestLarge
: public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> { public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
public: public:
DatarateTestLarge() : EncoderTest(GET_PARAM(0)) {} DatarateTestLarge() : EncoderTest(GET_PARAM(0)) {}
@ -71,8 +72,7 @@ class DatarateTestLarge : public ::libvpx_test::EncoderTest,
// http://code.google.com/p/webm/issues/detail?id=496 is fixed. // http://code.google.com/p/webm/issues/detail?id=496 is fixed.
// For now the codec assumes buffer starts at starting buffer rate // For now the codec assumes buffer starts at starting buffer rate
// plus one frame's time. // plus one frame's time.
if (last_pts_ == 0) if (last_pts_ == 0) duration = 1;
duration = 1;
// Add to the buffer the bits we'd expect from a constant bitrate server. // Add to the buffer the bits we'd expect from a constant bitrate server.
bits_in_buffer_model_ += static_cast<int64_t>( bits_in_buffer_model_ += static_cast<int64_t>(
@ -83,8 +83,8 @@ class DatarateTestLarge : public ::libvpx_test::EncoderTest,
* empty - and then stop showing frames until we've got enough bits to * empty - and then stop showing frames until we've got enough bits to
* show one. As noted in comment below (issue 495), this does not currently * show one. As noted in comment below (issue 495), this does not currently
* apply to key frames. For now exclude key frames in condition below. */ * apply to key frames. For now exclude key frames in condition below. */
const bool key_frame = (pkt->data.frame.flags & VPX_FRAME_IS_KEY) const bool key_frame =
? true: false; (pkt->data.frame.flags & VPX_FRAME_IS_KEY) ? true : false;
if (!key_frame) { if (!key_frame) {
ASSERT_GE(bits_in_buffer_model_, 0) << "Buffer Underrun at frame " ASSERT_GE(bits_in_buffer_model_, 0) << "Buffer Underrun at frame "
<< pkt->data.frame.pts; << pkt->data.frame.pts;
@ -99,8 +99,7 @@ class DatarateTestLarge : public ::libvpx_test::EncoderTest,
bits_total_ += frame_size_in_bits; bits_total_ += frame_size_in_bits;
// If first drop not set and we have a drop set it to this time. // If first drop not set and we have a drop set it to this time.
if (!first_drop_ && duration > 1) if (!first_drop_ && duration > 1) first_drop_ = last_pts_ + 1;
first_drop_ = last_pts_ + 1;
// Update the most recent pts. // Update the most recent pts.
last_pts_ = pkt->data.frame.pts; last_pts_ = pkt->data.frame.pts;
@ -119,8 +118,8 @@ class DatarateTestLarge : public ::libvpx_test::EncoderTest,
duration_ = (last_pts_ + 1) * timebase_; duration_ = (last_pts_ + 1) * timebase_;
// Effective file datarate includes the time spent prebuffering. // Effective file datarate includes the time spent prebuffering.
effective_datarate_ = (bits_total_ - bits_in_last_frame_) / 1000.0 effective_datarate_ = (bits_total_ - bits_in_last_frame_) / 1000.0 /
/ (cfg_.rc_buf_initial_sz / 1000.0 + duration_); (cfg_.rc_buf_initial_sz / 1000.0 + duration_);
file_datarate_ = file_size_in_kb / duration_; file_datarate_ = file_size_in_kb / duration_;
} }
@ -256,7 +255,8 @@ TEST_P(DatarateTestLarge, ChangingDropFrameThresh) {
} }
} }
class DatarateTestVP9Large : public ::libvpx_test::EncoderTest, class DatarateTestVP9Large
: public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> { public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
public: public:
DatarateTestVP9Large() : EncoderTest(GET_PARAM(0)) {} DatarateTestVP9Large() : EncoderTest(GET_PARAM(0)) {}
@ -307,8 +307,8 @@ class DatarateTestVP9Large : public ::libvpx_test::EncoderTest,
if (num_temp_layers == 2) { if (num_temp_layers == 2) {
if (frame_num % 2 == 0) { if (frame_num % 2 == 0) {
// Layer 0: predict from L and ARF, update L. // Layer 0: predict from L and ARF, update L.
frame_flags = VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_UPD_GF | frame_flags =
VP8_EFLAG_NO_UPD_ARF; VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
} else { } else {
// Layer 1: predict from L, G and ARF, and update G. // Layer 1: predict from L, G and ARF, and update G.
frame_flags = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST | frame_flags = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST |
@ -317,15 +317,15 @@ class DatarateTestVP9Large : public ::libvpx_test::EncoderTest,
} else if (num_temp_layers == 3) { } else if (num_temp_layers == 3) {
if (frame_num % 4 == 0) { if (frame_num % 4 == 0) {
// Layer 0: predict from L and ARF; update L. // Layer 0: predict from L and ARF; update L.
frame_flags = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF | frame_flags =
VP8_EFLAG_NO_REF_GF; VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_REF_GF;
} else if ((frame_num - 2) % 4 == 0) { } else if ((frame_num - 2) % 4 == 0) {
// Layer 1: predict from L, G, ARF; update G. // Layer 1: predict from L, G, ARF; update G.
frame_flags = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST; frame_flags = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST;
} else if ((frame_num - 1) % 2 == 0) { } else if ((frame_num - 1) % 2 == 0) {
// Layer 2: predict from L, G, ARF; update none. // Layer 2: predict from L, G, ARF; update none.
frame_flags = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF | frame_flags =
VP8_EFLAG_NO_UPD_LAST; VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST;
} }
} }
return frame_flags; return frame_flags;
@ -353,8 +353,7 @@ class DatarateTestVP9Large : public ::libvpx_test::EncoderTest,
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
::libvpx_test::Encoder *encoder) { ::libvpx_test::Encoder *encoder) {
if (video->frame() == 0) if (video->frame() == 0) encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
if (denoiser_offon_test_) { if (denoiser_offon_test_) {
ASSERT_GT(denoiser_offon_period_, 0) ASSERT_GT(denoiser_offon_period_, 0)
@ -374,8 +373,8 @@ class DatarateTestVP9Large : public ::libvpx_test::EncoderTest,
vpx_svc_layer_id_t layer_id; vpx_svc_layer_id_t layer_id;
layer_id.spatial_layer_id = 0; layer_id.spatial_layer_id = 0;
frame_flags_ = SetFrameFlags(video->frame(), cfg_.ts_number_layers); frame_flags_ = SetFrameFlags(video->frame(), cfg_.ts_number_layers);
layer_id.temporal_layer_id = SetLayerId(video->frame(), layer_id.temporal_layer_id =
cfg_.ts_number_layers); SetLayerId(video->frame(), cfg_.ts_number_layers);
encoder->Control(VP9E_SET_SVC_LAYER_ID, &layer_id); encoder->Control(VP9E_SET_SVC_LAYER_ID, &layer_id);
} }
const vpx_rational_t tb = video->timebase(); const vpx_rational_t tb = video->timebase();
@ -383,15 +382,13 @@ class DatarateTestVP9Large : public ::libvpx_test::EncoderTest,
duration_ = 0; duration_ = 0;
} }
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) { virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
// Time since last timestamp = duration. // Time since last timestamp = duration.
vpx_codec_pts_t duration = pkt->data.frame.pts - last_pts_; vpx_codec_pts_t duration = pkt->data.frame.pts - last_pts_;
if (duration > 1) { if (duration > 1) {
// If first drop not set and we have a drop set it to this time. // If first drop not set and we have a drop set it to this time.
if (!first_drop_) if (!first_drop_) first_drop_ = last_pts_ + 1;
first_drop_ = last_pts_ + 1;
// Update the number of frame drops. // Update the number of frame drops.
num_drops_ += static_cast<int>(duration - 1); num_drops_ += static_cast<int>(duration - 1);
// Update counter for total number of frames (#frames input to encoder). // Update counter for total number of frames (#frames input to encoder).
@ -616,8 +613,7 @@ TEST_P(DatarateTestVP9Large, BasicRateTargeting2TemporalLayers) {
cfg_.temporal_layering_mode = VP9E_TEMPORAL_LAYERING_MODE_BYPASS; cfg_.temporal_layering_mode = VP9E_TEMPORAL_LAYERING_MODE_BYPASS;
if (deadline_ == VPX_DL_REALTIME) if (deadline_ == VPX_DL_REALTIME) cfg_.g_error_resilient = 1;
cfg_.g_error_resilient = 1;
::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
30, 1, 0, 200); 30, 1, 0, 200);
@ -631,10 +627,12 @@ TEST_P(DatarateTestVP9Large, BasicRateTargeting2TemporalLayers) {
for (int j = 0; j < static_cast<int>(cfg_.ts_number_layers); ++j) { for (int j = 0; j < static_cast<int>(cfg_.ts_number_layers); ++j) {
ASSERT_GE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 0.85) ASSERT_GE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 0.85)
<< " The datarate for the file is lower than target by too much, " << " The datarate for the file is lower than target by too much, "
"for layer: " << j; "for layer: "
<< j;
ASSERT_LE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 1.15) ASSERT_LE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 1.15)
<< " The datarate for the file is greater than target by too much, " << " The datarate for the file is greater than target by too much, "
"for layer: " << j; "for layer: "
<< j;
} }
} }
} }
@ -674,12 +672,14 @@ TEST_P(DatarateTestVP9Large, BasicRateTargeting3TemporalLayers) {
// Adjust the thresholds to be tighter than .75. // Adjust the thresholds to be tighter than .75.
ASSERT_GE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 0.75) ASSERT_GE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 0.75)
<< " The datarate for the file is lower than target by too much, " << " The datarate for the file is lower than target by too much, "
"for layer: " << j; "for layer: "
<< j;
// TODO(yaowu): Work out more stable rc control strategy and // TODO(yaowu): Work out more stable rc control strategy and
// Adjust the thresholds to be tighter than 1.25. // Adjust the thresholds to be tighter than 1.25.
ASSERT_LE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 1.25) ASSERT_LE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 1.25)
<< " The datarate for the file is greater than target by too much, " << " The datarate for the file is greater than target by too much, "
"for layer: " << j; "for layer: "
<< j;
} }
} }
} }
@ -719,10 +719,12 @@ TEST_P(DatarateTestVP9Large, BasicRateTargeting3TemporalLayersFrameDropping) {
for (int j = 0; j < static_cast<int>(cfg_.ts_number_layers); ++j) { for (int j = 0; j < static_cast<int>(cfg_.ts_number_layers); ++j) {
ASSERT_GE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 0.85) ASSERT_GE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 0.85)
<< " The datarate for the file is lower than target by too much, " << " The datarate for the file is lower than target by too much, "
"for layer: " << j; "for layer: "
<< j;
ASSERT_LE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 1.15) ASSERT_LE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 1.15)
<< " The datarate for the file is greater than target by too much, " << " The datarate for the file is greater than target by too much, "
"for layer: " << j; "for layer: "
<< j;
// Expect some frame drops in this test: for this 200 frames test, // Expect some frame drops in this test: for this 200 frames test,
// expect at least 10% and not more than 60% drops. // expect at least 10% and not more than 60% drops.
ASSERT_GE(num_drops_, 20); ASSERT_GE(num_drops_, 20);
@ -792,11 +794,13 @@ TEST_P(DatarateTestVP9Large, DenoiserOffOn) {
} }
#endif // CONFIG_VP9_TEMPORAL_DENOISING #endif // CONFIG_VP9_TEMPORAL_DENOISING
class DatarateOnePassCbrSvc : public ::libvpx_test::EncoderTest, class DatarateOnePassCbrSvc
: public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> { public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
public: public:
DatarateOnePassCbrSvc() : EncoderTest(GET_PARAM(0)) {} DatarateOnePassCbrSvc() : EncoderTest(GET_PARAM(0)) {}
virtual ~DatarateOnePassCbrSvc() {} virtual ~DatarateOnePassCbrSvc() {}
protected: protected:
virtual void SetUp() { virtual void SetUp() {
InitializeConfig(); InitializeConfig();
@ -814,8 +818,7 @@ class DatarateOnePassCbrSvc : public ::libvpx_test::EncoderTest,
mismatch_psnr_ = 0.0; mismatch_psnr_ = 0.0;
mismatch_nframes_ = 0; mismatch_nframes_ = 0;
} }
virtual void BeginPassHook(unsigned int /*pass*/) { virtual void BeginPassHook(unsigned int /*pass*/) {}
}
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
::libvpx_test::Encoder *encoder) { ::libvpx_test::Encoder *encoder) {
if (video->frame() == 0) { if (video->frame() == 0) {
@ -837,12 +840,11 @@ class DatarateOnePassCbrSvc : public ::libvpx_test::EncoderTest,
} }
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) { virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
vpx_codec_pts_t duration = pkt->data.frame.pts - last_pts_; vpx_codec_pts_t duration = pkt->data.frame.pts - last_pts_;
if (last_pts_ == 0) if (last_pts_ == 0) duration = 1;
duration = 1;
bits_in_buffer_model_ += static_cast<int64_t>( bits_in_buffer_model_ += static_cast<int64_t>(
duration * timebase_ * cfg_.rc_target_bitrate * 1000); duration * timebase_ * cfg_.rc_target_bitrate * 1000);
const bool key_frame = (pkt->data.frame.flags & VPX_FRAME_IS_KEY) const bool key_frame =
? true: false; (pkt->data.frame.flags & VPX_FRAME_IS_KEY) ? true : false;
if (!key_frame) { if (!key_frame) {
ASSERT_GE(bits_in_buffer_model_, 0) << "Buffer Underrun at frame " ASSERT_GE(bits_in_buffer_model_, 0) << "Buffer Underrun at frame "
<< pkt->data.frame.pts; << pkt->data.frame.pts;
@ -850,8 +852,7 @@ class DatarateOnePassCbrSvc : public ::libvpx_test::EncoderTest,
const size_t frame_size_in_bits = pkt->data.frame.sz * 8; const size_t frame_size_in_bits = pkt->data.frame.sz * 8;
bits_in_buffer_model_ -= frame_size_in_bits; bits_in_buffer_model_ -= frame_size_in_bits;
bits_total_ += frame_size_in_bits; bits_total_ += frame_size_in_bits;
if (!first_drop_ && duration > 1) if (!first_drop_ && duration > 1) first_drop_ = last_pts_ + 1;
first_drop_ = last_pts_ + 1;
last_pts_ = pkt->data.frame.pts; last_pts_ = pkt->data.frame.pts;
bits_in_last_frame_ = frame_size_in_bits; bits_in_last_frame_ = frame_size_in_bits;
++frame_number_; ++frame_number_;
@ -864,16 +865,13 @@ class DatarateOnePassCbrSvc : public ::libvpx_test::EncoderTest,
} }
} }
virtual void MismatchHook(const vpx_image_t *img1, virtual void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2) {
const vpx_image_t *img2) {
double mismatch_psnr = compute_psnr(img1, img2); double mismatch_psnr = compute_psnr(img1, img2);
mismatch_psnr_ += mismatch_psnr; mismatch_psnr_ += mismatch_psnr;
++mismatch_nframes_; ++mismatch_nframes_;
} }
unsigned int GetMismatchFrames() { unsigned int GetMismatchFrames() { return mismatch_nframes_; }
return mismatch_nframes_;
}
vpx_codec_pts_t last_pts_; vpx_codec_pts_t last_pts_;
int64_t bits_in_buffer_model_; int64_t bits_in_buffer_model_;
@ -891,36 +889,30 @@ class DatarateOnePassCbrSvc : public ::libvpx_test::EncoderTest,
}; };
static void assign_layer_bitrates(vpx_codec_enc_cfg_t *const enc_cfg, static void assign_layer_bitrates(vpx_codec_enc_cfg_t *const enc_cfg,
const vpx_svc_extra_cfg_t *svc_params, const vpx_svc_extra_cfg_t *svc_params,
int spatial_layers, int spatial_layers, int temporal_layers,
int temporal_layers,
int temporal_layering_mode) { int temporal_layering_mode) {
int sl, spatial_layer_target; int sl, spatial_layer_target;
float total = 0; float total = 0;
float alloc_ratio[VPX_MAX_LAYERS] = { 0 }; float alloc_ratio[VPX_MAX_LAYERS] = { 0 };
for (sl = 0; sl < spatial_layers; ++sl) { for (sl = 0; sl < spatial_layers; ++sl) {
if (svc_params->scaling_factor_den[sl] > 0) { if (svc_params->scaling_factor_den[sl] > 0) {
alloc_ratio[sl] = (float)(svc_params->scaling_factor_num[sl] * alloc_ratio[sl] = (float)(svc_params->scaling_factor_num[sl] * 1.0 /
1.0 / svc_params->scaling_factor_den[sl]); svc_params->scaling_factor_den[sl]);
total += alloc_ratio[sl]; total += alloc_ratio[sl];
} }
} }
for (sl = 0; sl < spatial_layers; ++sl) { for (sl = 0; sl < spatial_layers; ++sl) {
enc_cfg->ss_target_bitrate[sl] = spatial_layer_target = enc_cfg->ss_target_bitrate[sl] = spatial_layer_target =
(unsigned int)(enc_cfg->rc_target_bitrate * (unsigned int)(enc_cfg->rc_target_bitrate * alloc_ratio[sl] / total);
alloc_ratio[sl] / total);
const int index = sl * temporal_layers; const int index = sl * temporal_layers;
if (temporal_layering_mode == 3) { if (temporal_layering_mode == 3) {
enc_cfg->layer_target_bitrate[index] = enc_cfg->layer_target_bitrate[index] = spatial_layer_target >> 1;
spatial_layer_target >> 1;
enc_cfg->layer_target_bitrate[index + 1] = enc_cfg->layer_target_bitrate[index + 1] =
(spatial_layer_target >> 1) + (spatial_layer_target >> 2); (spatial_layer_target >> 1) + (spatial_layer_target >> 2);
enc_cfg->layer_target_bitrate[index + 2] = enc_cfg->layer_target_bitrate[index + 2] = spatial_layer_target;
spatial_layer_target;
} else if (temporal_layering_mode == 2) { } else if (temporal_layering_mode == 2) {
enc_cfg->layer_target_bitrate[index] = enc_cfg->layer_target_bitrate[index] = spatial_layer_target * 2 / 3;
spatial_layer_target * 2 / 3; enc_cfg->layer_target_bitrate[index + 1] = spatial_layer_target;
enc_cfg->layer_target_bitrate[index + 1] =
spatial_layer_target;
} }
} }
} }
@ -1033,8 +1025,8 @@ TEST_P(DatarateOnePassCbrSvc, OnePassCbrSvc2SpatialLayers4threads) {
svc_params_.scaling_factor_den[1] = 288; svc_params_.scaling_factor_den[1] = 288;
cfg_.rc_dropframe_thresh = 10; cfg_.rc_dropframe_thresh = 10;
cfg_.kf_max_dist = 9999; cfg_.kf_max_dist = 9999;
::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720, ::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720, 30,
30, 1, 0, 300); 1, 0, 300);
cfg_.rc_target_bitrate = 800; cfg_.rc_target_bitrate = 800;
ResetModel(); ResetModel();
assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers, assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers,
@ -1073,8 +1065,8 @@ TEST_P(DatarateOnePassCbrSvc, OnePassCbrSvc3SpatialLayers) {
svc_params_.scaling_factor_den[2] = 288; svc_params_.scaling_factor_den[2] = 288;
cfg_.rc_dropframe_thresh = 10; cfg_.rc_dropframe_thresh = 10;
cfg_.kf_max_dist = 9999; cfg_.kf_max_dist = 9999;
::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720, ::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720, 30,
30, 1, 0, 300); 1, 0, 300);
cfg_.rc_target_bitrate = 800; cfg_.rc_target_bitrate = 800;
ResetModel(); ResetModel();
assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers, assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers,
@ -1112,8 +1104,8 @@ TEST_P(DatarateOnePassCbrSvc, OnePassCbrSvc3SpatialLayersSmallKf) {
svc_params_.scaling_factor_num[2] = 288; svc_params_.scaling_factor_num[2] = 288;
svc_params_.scaling_factor_den[2] = 288; svc_params_.scaling_factor_den[2] = 288;
cfg_.rc_dropframe_thresh = 10; cfg_.rc_dropframe_thresh = 10;
::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720, ::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720, 30,
30, 1, 0, 300); 1, 0, 300);
cfg_.rc_target_bitrate = 800; cfg_.rc_target_bitrate = 800;
// For this 3 temporal layer case, pattern repeats every 4 frames, so choose // For this 3 temporal layer case, pattern repeats every 4 frames, so choose
// 4 key neighboring key frame periods (so key frame will land on 0-2-1-2). // 4 key neighboring key frame periods (so key frame will land on 0-2-1-2).
@ -1157,8 +1149,8 @@ TEST_P(DatarateOnePassCbrSvc, OnePassCbrSvc3SpatialLayers4threads) {
svc_params_.scaling_factor_den[2] = 288; svc_params_.scaling_factor_den[2] = 288;
cfg_.rc_dropframe_thresh = 10; cfg_.rc_dropframe_thresh = 10;
cfg_.kf_max_dist = 9999; cfg_.kf_max_dist = 9999;
::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720, ::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720, 30,
30, 1, 0, 300); 1, 0, 300);
cfg_.rc_target_bitrate = 800; cfg_.rc_target_bitrate = 800;
ResetModel(); ResetModel();
assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers, assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers,

View File

@ -208,21 +208,17 @@ void reference_16x16_dct_2d(int16_t input[256], double output[256]) {
// First transform columns // First transform columns
for (int i = 0; i < 16; ++i) { for (int i = 0; i < 16; ++i) {
double temp_in[16], temp_out[16]; double temp_in[16], temp_out[16];
for (int j = 0; j < 16; ++j) for (int j = 0; j < 16; ++j) temp_in[j] = input[j * 16 + i];
temp_in[j] = input[j * 16 + i];
butterfly_16x16_dct_1d(temp_in, temp_out); butterfly_16x16_dct_1d(temp_in, temp_out);
for (int j = 0; j < 16; ++j) for (int j = 0; j < 16; ++j) output[j * 16 + i] = temp_out[j];
output[j * 16 + i] = temp_out[j];
} }
// Then transform rows // Then transform rows
for (int i = 0; i < 16; ++i) { for (int i = 0; i < 16; ++i) {
double temp_in[16], temp_out[16]; double temp_in[16], temp_out[16];
for (int j = 0; j < 16; ++j) for (int j = 0; j < 16; ++j) temp_in[j] = output[j + i * 16];
temp_in[j] = output[j + i * 16];
butterfly_16x16_dct_1d(temp_in, temp_out); butterfly_16x16_dct_1d(temp_in, temp_out);
// Scale by some magic number // Scale by some magic number
for (int j = 0; j < 16; ++j) for (int j = 0; j < 16; ++j) output[j + i * 16] = temp_out[j] / 2;
output[j + i * 16] = temp_out[j]/2;
} }
} }
@ -248,8 +244,7 @@ void idct16x16_ref(const tran_low_t *in, uint8_t *dest, int stride,
vpx_idct16x16_256_add_c(in, dest, stride); vpx_idct16x16_256_add_c(in, dest, stride);
} }
void fht16x16_ref(const int16_t *in, tran_low_t *out, int stride, void fht16x16_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) {
int tx_type) {
vp9_fht16x16_c(in, out, stride, tx_type); vp9_fht16x16_c(in, out, stride, tx_type);
} }
@ -351,11 +346,10 @@ class Trans16x16TestBase {
} }
} }
ASM_REGISTER_STATE_CHECK(RunFwdTxfm(test_input_block,
test_temp_block, pitch_));
if (bit_depth_ == VPX_BITS_8) {
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(
RunInvTxfm(test_temp_block, dst, pitch_)); RunFwdTxfm(test_input_block, test_temp_block, pitch_));
if (bit_depth_ == VPX_BITS_8) {
ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_));
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
} else { } else {
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(
@ -371,8 +365,7 @@ class Trans16x16TestBase {
const int32_t diff = dst[j] - src[j]; const int32_t diff = dst[j] - src[j];
#endif #endif
const uint32_t error = diff * diff; const uint32_t error = diff * diff;
if (max_error < error) if (max_error < error) max_error = error;
max_error = error;
total_error += error; total_error += error;
} }
} }
@ -418,16 +411,14 @@ class Trans16x16TestBase {
input_extreme_block[j] = rnd.Rand8() % 2 ? mask_ : -mask_; input_extreme_block[j] = rnd.Rand8() % 2 ? mask_ : -mask_;
} }
if (i == 0) { if (i == 0) {
for (int j = 0; j < kNumCoeffs; ++j) for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = mask_;
input_extreme_block[j] = mask_;
} else if (i == 1) { } else if (i == 1) {
for (int j = 0; j < kNumCoeffs; ++j) for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = -mask_;
input_extreme_block[j] = -mask_;
} }
fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_); fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_);
ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_extreme_block, ASM_REGISTER_STATE_CHECK(
output_block, pitch_)); RunFwdTxfm(input_extreme_block, output_block, pitch_));
// The minimum quant value is 4. // The minimum quant value is 4.
for (int j = 0; j < kNumCoeffs; ++j) { for (int j = 0; j < kNumCoeffs; ++j) {
@ -457,11 +448,9 @@ class Trans16x16TestBase {
input_extreme_block[j] = rnd.Rand8() % 2 ? mask_ : -mask_; input_extreme_block[j] = rnd.Rand8() % 2 ? mask_ : -mask_;
} }
if (i == 0) if (i == 0)
for (int j = 0; j < kNumCoeffs; ++j) for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = mask_;
input_extreme_block[j] = mask_;
if (i == 1) if (i == 1)
for (int j = 0; j < kNumCoeffs; ++j) for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = -mask_;
input_extreme_block[j] = -mask_;
fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_); fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_);
@ -484,17 +473,15 @@ class Trans16x16TestBase {
} else { } else {
inv_txfm_ref(output_ref_block, CONVERT_TO_BYTEPTR(ref16), pitch_, inv_txfm_ref(output_ref_block, CONVERT_TO_BYTEPTR(ref16), pitch_,
tx_type_); tx_type_);
ASM_REGISTER_STATE_CHECK(RunInvTxfm(output_ref_block, ASM_REGISTER_STATE_CHECK(
CONVERT_TO_BYTEPTR(dst16), pitch_)); RunInvTxfm(output_ref_block, CONVERT_TO_BYTEPTR(dst16), pitch_));
#endif #endif
} }
if (bit_depth_ == VPX_BITS_8) { if (bit_depth_ == VPX_BITS_8) {
for (int j = 0; j < kNumCoeffs; ++j) for (int j = 0; j < kNumCoeffs; ++j) EXPECT_EQ(ref[j], dst[j]);
EXPECT_EQ(ref[j], dst[j]);
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
} else { } else {
for (int j = 0; j < kNumCoeffs; ++j) for (int j = 0; j < kNumCoeffs; ++j) EXPECT_EQ(ref16[j], dst16[j]);
EXPECT_EQ(ref16[j], dst16[j]);
#endif #endif
} }
} }
@ -538,8 +525,8 @@ class Trans16x16TestBase {
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, 16)); ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, 16));
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
} else { } else {
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), ASM_REGISTER_STATE_CHECK(
16)); RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), 16));
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
} }
@ -551,8 +538,7 @@ class Trans16x16TestBase {
const uint32_t diff = dst[j] - src[j]; const uint32_t diff = dst[j] - src[j];
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
const uint32_t error = diff * diff; const uint32_t error = diff * diff;
EXPECT_GE(1u, error) EXPECT_GE(1u, error) << "Error: 16x16 IDCT has error " << error
<< "Error: 16x16 IDCT has error " << error
<< " at index " << j; << " at index " << j;
} }
} }
@ -595,8 +581,8 @@ class Trans16x16TestBase {
} else { } else {
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
ref_txfm(coeff, CONVERT_TO_BYTEPTR(ref16), pitch_); ref_txfm(coeff, CONVERT_TO_BYTEPTR(ref16), pitch_);
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), ASM_REGISTER_STATE_CHECK(
pitch_)); RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_));
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
} }
@ -608,9 +594,8 @@ class Trans16x16TestBase {
const uint32_t diff = dst[j] - ref[j]; const uint32_t diff = dst[j] - ref[j];
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
const uint32_t error = diff * diff; const uint32_t error = diff * diff;
EXPECT_EQ(0u, error) EXPECT_EQ(0u, error) << "Error: 16x16 IDCT Comparison has error "
<< "Error: 16x16 IDCT Comparison has error " << error << error << " at index " << j;
<< " at index " << j;
} }
} }
} }
@ -623,8 +608,7 @@ class Trans16x16TestBase {
IhtFunc inv_txfm_ref; IhtFunc inv_txfm_ref;
}; };
class Trans16x16DCT class Trans16x16DCT : public Trans16x16TestBase,
: public Trans16x16TestBase,
public ::testing::TestWithParam<Dct16x16Param> { public ::testing::TestWithParam<Dct16x16Param> {
public: public:
virtual ~Trans16x16DCT() {} virtual ~Trans16x16DCT() {}
@ -640,15 +624,9 @@ class Trans16x16DCT
mask_ = (1 << bit_depth_) - 1; mask_ = (1 << bit_depth_) - 1;
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
switch (bit_depth_) { switch (bit_depth_) {
case VPX_BITS_10: case VPX_BITS_10: inv_txfm_ref = idct16x16_10_ref; break;
inv_txfm_ref = idct16x16_10_ref; case VPX_BITS_12: inv_txfm_ref = idct16x16_12_ref; break;
break; default: inv_txfm_ref = idct16x16_ref; break;
case VPX_BITS_12:
inv_txfm_ref = idct16x16_12_ref;
break;
default:
inv_txfm_ref = idct16x16_ref;
break;
} }
#else #else
inv_txfm_ref = idct16x16_ref; inv_txfm_ref = idct16x16_ref;
@ -668,17 +646,11 @@ class Trans16x16DCT
IdctFunc inv_txfm_; IdctFunc inv_txfm_;
}; };
TEST_P(Trans16x16DCT, AccuracyCheck) { TEST_P(Trans16x16DCT, AccuracyCheck) { RunAccuracyCheck(); }
RunAccuracyCheck();
}
TEST_P(Trans16x16DCT, CoeffCheck) { TEST_P(Trans16x16DCT, CoeffCheck) { RunCoeffCheck(); }
RunCoeffCheck();
}
TEST_P(Trans16x16DCT, MemCheck) { TEST_P(Trans16x16DCT, MemCheck) { RunMemCheck(); }
RunMemCheck();
}
TEST_P(Trans16x16DCT, QuantCheck) { TEST_P(Trans16x16DCT, QuantCheck) {
// Use maximally allowed quantization step sizes for DC and AC // Use maximally allowed quantization step sizes for DC and AC
@ -686,12 +658,9 @@ TEST_P(Trans16x16DCT, QuantCheck) {
RunQuantCheck(1336, 1828); RunQuantCheck(1336, 1828);
} }
TEST_P(Trans16x16DCT, InvAccuracyCheck) { TEST_P(Trans16x16DCT, InvAccuracyCheck) { RunInvAccuracyCheck(); }
RunInvAccuracyCheck();
}
class Trans16x16HT class Trans16x16HT : public Trans16x16TestBase,
: public Trans16x16TestBase,
public ::testing::TestWithParam<Ht16x16Param> { public ::testing::TestWithParam<Ht16x16Param> {
public: public:
virtual ~Trans16x16HT() {} virtual ~Trans16x16HT() {}
@ -707,15 +676,9 @@ class Trans16x16HT
mask_ = (1 << bit_depth_) - 1; mask_ = (1 << bit_depth_) - 1;
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
switch (bit_depth_) { switch (bit_depth_) {
case VPX_BITS_10: case VPX_BITS_10: inv_txfm_ref = iht16x16_10; break;
inv_txfm_ref = iht16x16_10; case VPX_BITS_12: inv_txfm_ref = iht16x16_12; break;
break; default: inv_txfm_ref = iht16x16_ref; break;
case VPX_BITS_12:
inv_txfm_ref = iht16x16_12;
break;
default:
inv_txfm_ref = iht16x16_ref;
break;
} }
#else #else
inv_txfm_ref = iht16x16_ref; inv_txfm_ref = iht16x16_ref;
@ -735,17 +698,11 @@ class Trans16x16HT
IhtFunc inv_txfm_; IhtFunc inv_txfm_;
}; };
TEST_P(Trans16x16HT, AccuracyCheck) { TEST_P(Trans16x16HT, AccuracyCheck) { RunAccuracyCheck(); }
RunAccuracyCheck();
}
TEST_P(Trans16x16HT, CoeffCheck) { TEST_P(Trans16x16HT, CoeffCheck) { RunCoeffCheck(); }
RunCoeffCheck();
}
TEST_P(Trans16x16HT, MemCheck) { TEST_P(Trans16x16HT, MemCheck) { RunMemCheck(); }
RunMemCheck();
}
TEST_P(Trans16x16HT, QuantCheck) { TEST_P(Trans16x16HT, QuantCheck) {
// The encoder skips any non-DC intra prediction modes, // The encoder skips any non-DC intra prediction modes,
@ -753,8 +710,7 @@ TEST_P(Trans16x16HT, QuantCheck) {
RunQuantCheck(429, 729); RunQuantCheck(429, 729);
} }
class InvTrans16x16DCT class InvTrans16x16DCT : public Trans16x16TestBase,
: public Trans16x16TestBase,
public ::testing::TestWithParam<Idct16x16Param> { public ::testing::TestWithParam<Idct16x16Param> {
public: public:
virtual ~InvTrans16x16DCT() {} virtual ~InvTrans16x16DCT() {}
@ -784,8 +740,7 @@ TEST_P(InvTrans16x16DCT, CompareReference) {
CompareInvReference(ref_txfm_, thresh_); CompareInvReference(ref_txfm_, thresh_);
} }
class PartialTrans16x16Test class PartialTrans16x16Test : public ::testing::TestWithParam<
: public ::testing::TestWithParam<
std::tr1::tuple<FdctFunc, vpx_bit_depth_t> > { std::tr1::tuple<FdctFunc, vpx_bit_depth_t> > {
public: public:
virtual ~PartialTrans16x16Test() {} virtual ~PartialTrans16x16Test() {}
@ -855,10 +810,10 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&vpx_highbd_fdct16x16_c, &idct16x16_12, 0, VPX_BITS_12), make_tuple(&vpx_highbd_fdct16x16_c, &idct16x16_12, 0, VPX_BITS_12),
make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c, 0, VPX_BITS_8))); make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c, 0, VPX_BITS_8)));
#else #else
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(C, Trans16x16DCT,
C, Trans16x16DCT, ::testing::Values(make_tuple(&vpx_fdct16x16_c,
::testing::Values( &vpx_idct16x16_256_add_c,
make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c, 0, VPX_BITS_8))); 0, VPX_BITS_8)));
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
@ -898,28 +853,25 @@ INSTANTIATE_TEST_CASE_P(C, PartialTrans16x16Test,
#if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
NEON, Trans16x16DCT, NEON, Trans16x16DCT,
::testing::Values( ::testing::Values(make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_neon,
make_tuple(&vpx_fdct16x16_c, 0, VPX_BITS_8)));
&vpx_idct16x16_256_add_neon, 0, VPX_BITS_8)));
#endif #endif
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, Trans16x16DCT, SSE2, Trans16x16DCT,
::testing::Values( ::testing::Values(make_tuple(&vpx_fdct16x16_sse2,
make_tuple(&vpx_fdct16x16_sse2,
&vpx_idct16x16_256_add_sse2, 0, VPX_BITS_8))); &vpx_idct16x16_256_add_sse2, 0, VPX_BITS_8)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, Trans16x16HT, SSE2, Trans16x16HT,
::testing::Values( ::testing::Values(make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2,
make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 0, 0, VPX_BITS_8),
VPX_BITS_8), make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2,
make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 1, 1, VPX_BITS_8),
VPX_BITS_8), make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2,
make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 2, 2, VPX_BITS_8),
VPX_BITS_8), make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2,
make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 3, 3, VPX_BITS_8)));
VPX_BITS_8)));
INSTANTIATE_TEST_CASE_P(SSE2, PartialTrans16x16Test, INSTANTIATE_TEST_CASE_P(SSE2, PartialTrans16x16Test,
::testing::Values(make_tuple(&vpx_fdct16x16_1_sse2, ::testing::Values(make_tuple(&vpx_fdct16x16_1_sse2,
VPX_BITS_8))); VPX_BITS_8)));
@ -929,16 +881,14 @@ INSTANTIATE_TEST_CASE_P(SSE2, PartialTrans16x16Test,
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, Trans16x16DCT, SSE2, Trans16x16DCT,
::testing::Values( ::testing::Values(
make_tuple(&vpx_highbd_fdct16x16_sse2, make_tuple(&vpx_highbd_fdct16x16_sse2, &idct16x16_10, 0, VPX_BITS_10),
&idct16x16_10, 0, VPX_BITS_10), make_tuple(&vpx_highbd_fdct16x16_c, &idct16x16_256_add_10_sse2, 0,
make_tuple(&vpx_highbd_fdct16x16_c, VPX_BITS_10),
&idct16x16_256_add_10_sse2, 0, VPX_BITS_10), make_tuple(&vpx_highbd_fdct16x16_sse2, &idct16x16_12, 0, VPX_BITS_12),
make_tuple(&vpx_highbd_fdct16x16_sse2, make_tuple(&vpx_highbd_fdct16x16_c, &idct16x16_256_add_12_sse2, 0,
&idct16x16_12, 0, VPX_BITS_12), VPX_BITS_12),
make_tuple(&vpx_highbd_fdct16x16_c, make_tuple(&vpx_fdct16x16_sse2, &vpx_idct16x16_256_add_c, 0,
&idct16x16_256_add_12_sse2, 0, VPX_BITS_12), VPX_BITS_8)));
make_tuple(&vpx_fdct16x16_sse2,
&vpx_idct16x16_256_add_c, 0, VPX_BITS_8)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, Trans16x16HT, SSE2, Trans16x16HT,
::testing::Values( ::testing::Values(
@ -951,26 +901,24 @@ INSTANTIATE_TEST_CASE_P(
// that to test both branches. // that to test both branches.
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, InvTrans16x16DCT, SSE2, InvTrans16x16DCT,
::testing::Values( ::testing::Values(make_tuple(&idct16x16_10_add_10_c,
make_tuple(&idct16x16_10_add_10_c,
&idct16x16_10_add_10_sse2, 3167, VPX_BITS_10), &idct16x16_10_add_10_sse2, 3167, VPX_BITS_10),
make_tuple(&idct16x16_10, make_tuple(&idct16x16_10, &idct16x16_256_add_10_sse2,
&idct16x16_256_add_10_sse2, 3167, VPX_BITS_10), 3167, VPX_BITS_10),
make_tuple(&idct16x16_10_add_12_c, make_tuple(&idct16x16_10_add_12_c,
&idct16x16_10_add_12_sse2, 3167, VPX_BITS_12), &idct16x16_10_add_12_sse2, 3167, VPX_BITS_12),
make_tuple(&idct16x16_12, make_tuple(&idct16x16_12, &idct16x16_256_add_12_sse2,
&idct16x16_256_add_12_sse2, 3167, VPX_BITS_12))); 3167, VPX_BITS_12)));
INSTANTIATE_TEST_CASE_P(SSE2, PartialTrans16x16Test, INSTANTIATE_TEST_CASE_P(SSE2, PartialTrans16x16Test,
::testing::Values(make_tuple(&vpx_fdct16x16_1_sse2, ::testing::Values(make_tuple(&vpx_fdct16x16_1_sse2,
VPX_BITS_8))); VPX_BITS_8)));
#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(MSA, Trans16x16DCT,
MSA, Trans16x16DCT, ::testing::Values(make_tuple(&vpx_fdct16x16_msa,
::testing::Values( &vpx_idct16x16_256_add_msa,
make_tuple(&vpx_fdct16x16_msa, 0, VPX_BITS_8)));
&vpx_idct16x16_256_add_msa, 0, VPX_BITS_8)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
MSA, Trans16x16HT, MSA, Trans16x16HT,
::testing::Values( ::testing::Values(

View File

@ -39,8 +39,7 @@ void reference_32x32_dct_1d(const double in[32], double out[32]) {
out[k] = 0.0; out[k] = 0.0;
for (int n = 0; n < 32; n++) for (int n = 0; n < 32; n++)
out[k] += in[n] * cos(kPi * (2 * n + 1) * k / 64.0); out[k] += in[n] * cos(kPi * (2 * n + 1) * k / 64.0);
if (k == 0) if (k == 0) out[k] = out[k] * kInvSqrt2;
out[k] = out[k] * kInvSqrt2;
} }
} }
@ -49,21 +48,17 @@ void reference_32x32_dct_2d(const int16_t input[kNumCoeffs],
// First transform columns // First transform columns
for (int i = 0; i < 32; ++i) { for (int i = 0; i < 32; ++i) {
double temp_in[32], temp_out[32]; double temp_in[32], temp_out[32];
for (int j = 0; j < 32; ++j) for (int j = 0; j < 32; ++j) temp_in[j] = input[j * 32 + i];
temp_in[j] = input[j*32 + i];
reference_32x32_dct_1d(temp_in, temp_out); reference_32x32_dct_1d(temp_in, temp_out);
for (int j = 0; j < 32; ++j) for (int j = 0; j < 32; ++j) output[j * 32 + i] = temp_out[j];
output[j * 32 + i] = temp_out[j];
} }
// Then transform rows // Then transform rows
for (int i = 0; i < 32; ++i) { for (int i = 0; i < 32; ++i) {
double temp_in[32], temp_out[32]; double temp_in[32], temp_out[32];
for (int j = 0; j < 32; ++j) for (int j = 0; j < 32; ++j) temp_in[j] = output[j + i * 32];
temp_in[j] = output[j + i*32];
reference_32x32_dct_1d(temp_in, temp_out); reference_32x32_dct_1d(temp_in, temp_out);
// Scale by some magic number // Scale by some magic number
for (int j = 0; j < 32; ++j) for (int j = 0; j < 32; ++j) output[j + i * 32] = temp_out[j] / 4;
output[j + i * 32] = temp_out[j] / 4;
} }
} }
@ -140,8 +135,8 @@ TEST_P(Trans32x32Test, AccuracyCheck) {
ASM_REGISTER_STATE_CHECK(inv_txfm_(test_temp_block, dst, 32)); ASM_REGISTER_STATE_CHECK(inv_txfm_(test_temp_block, dst, 32));
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
} else { } else {
ASM_REGISTER_STATE_CHECK(inv_txfm_(test_temp_block, ASM_REGISTER_STATE_CHECK(
CONVERT_TO_BYTEPTR(dst16), 32)); inv_txfm_(test_temp_block, CONVERT_TO_BYTEPTR(dst16), 32));
#endif #endif
} }
@ -153,8 +148,7 @@ TEST_P(Trans32x32Test, AccuracyCheck) {
const int32_t diff = dst[j] - src[j]; const int32_t diff = dst[j] - src[j];
#endif #endif
const uint32_t error = diff * diff; const uint32_t error = diff * diff;
if (max_error < error) if (max_error < error) max_error = error;
max_error = error;
total_error += error; total_error += error;
} }
} }
@ -213,11 +207,9 @@ TEST_P(Trans32x32Test, MemCheck) {
input_extreme_block[j] = rnd.Rand8() & 1 ? mask_ : -mask_; input_extreme_block[j] = rnd.Rand8() & 1 ? mask_ : -mask_;
} }
if (i == 0) { if (i == 0) {
for (int j = 0; j < kNumCoeffs; ++j) for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = mask_;
input_extreme_block[j] = mask_;
} else if (i == 1) { } else if (i == 1) {
for (int j = 0; j < kNumCoeffs; ++j) for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = -mask_;
input_extreme_block[j] = -mask_;
} }
const int stride = 32; const int stride = 32;
@ -291,8 +283,7 @@ TEST_P(Trans32x32Test, InverseAccuracy) {
const int diff = dst[j] - src[j]; const int diff = dst[j] - src[j];
#endif #endif
const int error = diff * diff; const int error = diff * diff;
EXPECT_GE(1, error) EXPECT_GE(1, error) << "Error: 32x32 IDCT has error " << error
<< "Error: 32x32 IDCT has error " << error
<< " at index " << j; << " at index " << j;
} }
} }
@ -365,18 +356,13 @@ using std::tr1::make_tuple;
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
C, Trans32x32Test, C, Trans32x32Test,
::testing::Values( ::testing::Values(
make_tuple(&vpx_highbd_fdct32x32_c, make_tuple(&vpx_highbd_fdct32x32_c, &idct32x32_10, 0, VPX_BITS_10),
&idct32x32_10, 0, VPX_BITS_10), make_tuple(&vpx_highbd_fdct32x32_rd_c, &idct32x32_10, 1, VPX_BITS_10),
make_tuple(&vpx_highbd_fdct32x32_rd_c, make_tuple(&vpx_highbd_fdct32x32_c, &idct32x32_12, 0, VPX_BITS_12),
&idct32x32_10, 1, VPX_BITS_10), make_tuple(&vpx_highbd_fdct32x32_rd_c, &idct32x32_12, 1, VPX_BITS_12),
make_tuple(&vpx_highbd_fdct32x32_c, make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c, 0, VPX_BITS_8),
&idct32x32_12, 0, VPX_BITS_12), make_tuple(&vpx_fdct32x32_rd_c, &vpx_idct32x32_1024_add_c, 1,
make_tuple(&vpx_highbd_fdct32x32_rd_c, VPX_BITS_8)));
&idct32x32_12, 1, VPX_BITS_12),
make_tuple(&vpx_fdct32x32_c,
&vpx_idct32x32_1024_add_c, 0, VPX_BITS_8),
make_tuple(&vpx_fdct32x32_rd_c,
&vpx_idct32x32_1024_add_c, 1, VPX_BITS_8)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
C, PartialTrans32x32Test, C, PartialTrans32x32Test,
::testing::Values(make_tuple(&vpx_highbd_fdct32x32_1_c, VPX_BITS_8), ::testing::Values(make_tuple(&vpx_highbd_fdct32x32_1_c, VPX_BITS_8),
@ -385,11 +371,10 @@ INSTANTIATE_TEST_CASE_P(
#else #else
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
C, Trans32x32Test, C, Trans32x32Test,
::testing::Values( ::testing::Values(make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c, 0,
make_tuple(&vpx_fdct32x32_c, VPX_BITS_8),
&vpx_idct32x32_1024_add_c, 0, VPX_BITS_8), make_tuple(&vpx_fdct32x32_rd_c, &vpx_idct32x32_1024_add_c,
make_tuple(&vpx_fdct32x32_rd_c, 1, VPX_BITS_8)));
&vpx_idct32x32_1024_add_c, 1, VPX_BITS_8)));
INSTANTIATE_TEST_CASE_P(C, PartialTrans32x32Test, INSTANTIATE_TEST_CASE_P(C, PartialTrans32x32Test,
::testing::Values(make_tuple(&vpx_fdct32x32_1_c, ::testing::Values(make_tuple(&vpx_fdct32x32_1_c,
VPX_BITS_8))); VPX_BITS_8)));
@ -398,9 +383,8 @@ INSTANTIATE_TEST_CASE_P(C, PartialTrans32x32Test,
#if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
NEON, Trans32x32Test, NEON, Trans32x32Test,
::testing::Values( ::testing::Values(make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_neon,
make_tuple(&vpx_fdct32x32_c, 0, VPX_BITS_8),
&vpx_idct32x32_1024_add_neon, 0, VPX_BITS_8),
make_tuple(&vpx_fdct32x32_rd_c, make_tuple(&vpx_fdct32x32_rd_c,
&vpx_idct32x32_1024_add_neon, 1, VPX_BITS_8))); &vpx_idct32x32_1024_add_neon, 1, VPX_BITS_8)));
#endif // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #endif // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
@ -408,8 +392,7 @@ INSTANTIATE_TEST_CASE_P(
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, Trans32x32Test, SSE2, Trans32x32Test,
::testing::Values( ::testing::Values(make_tuple(&vpx_fdct32x32_sse2,
make_tuple(&vpx_fdct32x32_sse2,
&vpx_idct32x32_1024_add_sse2, 0, VPX_BITS_8), &vpx_idct32x32_1024_add_sse2, 0, VPX_BITS_8),
make_tuple(&vpx_fdct32x32_rd_sse2, make_tuple(&vpx_fdct32x32_rd_sse2,
&vpx_idct32x32_1024_add_sse2, 1, VPX_BITS_8))); &vpx_idct32x32_1024_add_sse2, 1, VPX_BITS_8)));
@ -440,8 +423,7 @@ INSTANTIATE_TEST_CASE_P(SSE2, PartialTrans32x32Test,
#if HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
AVX2, Trans32x32Test, AVX2, Trans32x32Test,
::testing::Values( ::testing::Values(make_tuple(&vpx_fdct32x32_avx2,
make_tuple(&vpx_fdct32x32_avx2,
&vpx_idct32x32_1024_add_sse2, 0, VPX_BITS_8), &vpx_idct32x32_1024_add_sse2, 0, VPX_BITS_8),
make_tuple(&vpx_fdct32x32_rd_avx2, make_tuple(&vpx_fdct32x32_rd_avx2,
&vpx_idct32x32_1024_add_sse2, 1, VPX_BITS_8))); &vpx_idct32x32_1024_add_sse2, 1, VPX_BITS_8)));
@ -450,8 +432,7 @@ INSTANTIATE_TEST_CASE_P(
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
MSA, Trans32x32Test, MSA, Trans32x32Test,
::testing::Values( ::testing::Values(make_tuple(&vpx_fdct32x32_msa,
make_tuple(&vpx_fdct32x32_msa,
&vpx_idct32x32_1024_add_msa, 0, VPX_BITS_8), &vpx_idct32x32_1024_add_msa, 0, VPX_BITS_8),
make_tuple(&vpx_fdct32x32_rd_msa, make_tuple(&vpx_fdct32x32_rd_msa,
&vpx_idct32x32_1024_add_msa, 1, VPX_BITS_8))); &vpx_idct32x32_1024_add_msa, 1, VPX_BITS_8)));

View File

@ -51,8 +51,7 @@ TEST(DecodeAPI, InvalidParams) {
vpx_codec_decode(&dec, buf, NELEMENTS(buf), NULL, 0)); vpx_codec_decode(&dec, buf, NELEMENTS(buf), NULL, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_decode(&dec, NULL, NELEMENTS(buf), NULL, 0)); vpx_codec_decode(&dec, NULL, NELEMENTS(buf), NULL, 0));
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_decode(&dec, buf, 0, NULL, 0));
vpx_codec_decode(&dec, buf, 0, NULL, 0));
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec)); EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec));
} }
@ -77,12 +76,9 @@ TEST(DecodeAPI, OptionalParams) {
// Test VP9 codec controls after a decode error to ensure the code doesn't // Test VP9 codec controls after a decode error to ensure the code doesn't
// misbehave. // misbehave.
void TestVp9Controls(vpx_codec_ctx_t *dec) { void TestVp9Controls(vpx_codec_ctx_t *dec) {
static const int kControls[] = { static const int kControls[] = { VP8D_GET_LAST_REF_UPDATES,
VP8D_GET_LAST_REF_UPDATES,
VP8D_GET_FRAME_CORRUPTED, VP8D_GET_FRAME_CORRUPTED,
VP9D_GET_DISPLAY_SIZE, VP9D_GET_DISPLAY_SIZE, VP9D_GET_FRAME_SIZE };
VP9D_GET_FRAME_SIZE
};
int val[2]; int val[2];
for (int i = 0; i < NELEMENTS(kControls); ++i) { for (int i = 0; i < NELEMENTS(kControls); ++i) {
@ -91,9 +87,7 @@ void TestVp9Controls(vpx_codec_ctx_t *dec) {
case VP8D_GET_FRAME_CORRUPTED: case VP8D_GET_FRAME_CORRUPTED:
EXPECT_EQ(VPX_CODEC_ERROR, res) << kControls[i]; EXPECT_EQ(VPX_CODEC_ERROR, res) << kControls[i];
break; break;
default: default: EXPECT_EQ(VPX_CODEC_OK, res) << kControls[i]; break;
EXPECT_EQ(VPX_CODEC_OK, res) << kControls[i];
break;
} }
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
vpx_codec_control_(dec, kControls[i], NULL)); vpx_codec_control_(dec, kControls[i], NULL));
@ -150,10 +144,9 @@ TEST(DecodeAPI, Vp9PeekSI) {
// size 10, this should return VPX_CODEC_UNSUP_BITSTREAM and after that it // size 10, this should return VPX_CODEC_UNSUP_BITSTREAM and after that it
// should return VPX_CODEC_CORRUPT_FRAME. // should return VPX_CODEC_CORRUPT_FRAME.
const uint8_t data[32] = { const uint8_t data[32] = {
0x85, 0xa4, 0xc1, 0xa1, 0x38, 0x81, 0xa3, 0x49, 0x85, 0xa4, 0xc1, 0xa1, 0x38, 0x81, 0xa3, 0x49, 0x83, 0xff, 0xff,
0x83, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
}; };
for (uint32_t data_sz = 1; data_sz <= 32; ++data_sz) { for (uint32_t data_sz = 1; data_sz <= 32; ++data_sz) {
@ -162,8 +155,8 @@ TEST(DecodeAPI, Vp9PeekSI) {
if (data_sz >= 8) { if (data_sz >= 8) {
vpx_codec_ctx_t dec; vpx_codec_ctx_t dec;
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_dec_init(&dec, codec, NULL, 0)); EXPECT_EQ(VPX_CODEC_OK, vpx_codec_dec_init(&dec, codec, NULL, 0));
EXPECT_EQ((data_sz < 10) ? EXPECT_EQ(
VPX_CODEC_UNSUP_BITSTREAM : VPX_CODEC_CORRUPT_FRAME, (data_sz < 10) ? VPX_CODEC_UNSUP_BITSTREAM : VPX_CODEC_CORRUPT_FRAME,
vpx_codec_decode(&dec, data, data_sz, NULL, 0)); vpx_codec_decode(&dec, data, data_sz, NULL, 0));
vpx_codec_iter_t iter = NULL; vpx_codec_iter_t iter = NULL;
EXPECT_EQ(NULL, vpx_codec_get_frame(&dec, &iter)); EXPECT_EQ(NULL, vpx_codec_get_frame(&dec, &iter));

View File

@ -70,8 +70,7 @@ const DecodePerfParam kVP9DecodePerfVectors[] = {
power/temp/min max frame decode times/etc power/temp/min max frame decode times/etc
*/ */
class DecodePerfTest : public ::testing::TestWithParam<DecodePerfParam> { class DecodePerfTest : public ::testing::TestWithParam<DecodePerfParam> {};
};
TEST_P(DecodePerfTest, PerfTest) { TEST_P(DecodePerfTest, PerfTest) {
const char *const video_name = GET_PARAM(VIDEO_NAME); const char *const video_name = GET_PARAM(VIDEO_NAME);
@ -92,8 +91,7 @@ TEST_P(DecodePerfTest, PerfTest) {
} }
vpx_usec_timer_mark(&t); vpx_usec_timer_mark(&t);
const double elapsed_secs = double(vpx_usec_timer_elapsed(&t)) const double elapsed_secs = double(vpx_usec_timer_elapsed(&t)) / kUsecsInSec;
/ kUsecsInSec;
const unsigned frames = video.frame_number(); const unsigned frames = video.frame_number();
const double fps = double(frames) / elapsed_secs; const double fps = double(frames) / elapsed_secs;
@ -111,17 +109,13 @@ TEST_P(DecodePerfTest, PerfTest) {
INSTANTIATE_TEST_CASE_P(VP9, DecodePerfTest, INSTANTIATE_TEST_CASE_P(VP9, DecodePerfTest,
::testing::ValuesIn(kVP9DecodePerfVectors)); ::testing::ValuesIn(kVP9DecodePerfVectors));
class VP9NewEncodeDecodePerfTest : class VP9NewEncodeDecodePerfTest
public ::libvpx_test::EncoderTest, : public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> { public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
protected: protected:
VP9NewEncodeDecodePerfTest() VP9NewEncodeDecodePerfTest()
: EncoderTest(GET_PARAM(0)), : EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)), speed_(0),
encoding_mode_(GET_PARAM(1)), outfile_(0), out_frames_(0) {}
speed_(0),
outfile_(0),
out_frames_(0) {
}
virtual ~VP9NewEncodeDecodePerfTest() {} virtual ~VP9NewEncodeDecodePerfTest() {}
@ -182,9 +176,7 @@ class VP9NewEncodeDecodePerfTest :
virtual bool DoDecode() { return false; } virtual bool DoDecode() { return false; }
void set_speed(unsigned int speed) { void set_speed(unsigned int speed) { speed_ = speed; }
speed_ = speed;
}
private: private:
libvpx_test::TestMode encoding_mode_; libvpx_test::TestMode encoding_mode_;
@ -196,10 +188,7 @@ class VP9NewEncodeDecodePerfTest :
struct EncodePerfTestVideo { struct EncodePerfTestVideo {
EncodePerfTestVideo(const char *name_, uint32_t width_, uint32_t height_, EncodePerfTestVideo(const char *name_, uint32_t width_, uint32_t height_,
uint32_t bitrate_, int frames_) uint32_t bitrate_, int frames_)
: name(name_), : name(name_), width(width_), height(height_), bitrate(bitrate_),
width(width_),
height(height_),
bitrate(bitrate_),
frames(frames_) {} frames(frames_) {}
const char *name; const char *name;
uint32_t width; uint32_t width;
@ -225,10 +214,8 @@ TEST_P(VP9NewEncodeDecodePerfTest, PerfTest) {
const char *video_name = kVP9EncodePerfTestVectors[i].name; const char *video_name = kVP9EncodePerfTestVectors[i].name;
libvpx_test::I420VideoSource video( libvpx_test::I420VideoSource video(
video_name, video_name, kVP9EncodePerfTestVectors[i].width,
kVP9EncodePerfTestVectors[i].width, kVP9EncodePerfTestVectors[i].height, timebase.den, timebase.num, 0,
kVP9EncodePerfTestVectors[i].height,
timebase.den, timebase.num, 0,
kVP9EncodePerfTestVectors[i].frames); kVP9EncodePerfTestVectors[i].frames);
set_speed(2); set_speed(2);
@ -268,6 +255,6 @@ TEST_P(VP9NewEncodeDecodePerfTest, PerfTest) {
printf("}\n"); printf("}\n");
} }
VP9_INSTANTIATE_TEST_CASE( VP9_INSTANTIATE_TEST_CASE(VP9NewEncodeDecodePerfTest,
VP9NewEncodeDecodePerfTest, ::testing::Values(::libvpx_test::kTwoPassGood)); ::testing::Values(::libvpx_test::kTwoPassGood));
} // namespace } // namespace

View File

@ -21,9 +21,8 @@ const char kVP8Name[] = "WebM Project VP8";
vpx_codec_err_t Decoder::PeekStream(const uint8_t *cxdata, size_t size, vpx_codec_err_t Decoder::PeekStream(const uint8_t *cxdata, size_t size,
vpx_codec_stream_info_t *stream_info) { vpx_codec_stream_info_t *stream_info) {
return vpx_codec_peek_stream_info(CodecInterface(), return vpx_codec_peek_stream_info(
cxdata, static_cast<unsigned int>(size), CodecInterface(), cxdata, static_cast<unsigned int>(size), stream_info);
stream_info);
} }
vpx_codec_err_t Decoder::DecodeFrame(const uint8_t *cxdata, size_t size) { vpx_codec_err_t Decoder::DecodeFrame(const uint8_t *cxdata, size_t size) {
@ -35,9 +34,8 @@ vpx_codec_err_t Decoder::DecodeFrame(const uint8_t *cxdata, size_t size,
vpx_codec_err_t res_dec; vpx_codec_err_t res_dec;
InitOnce(); InitOnce();
API_REGISTER_STATE_CHECK( API_REGISTER_STATE_CHECK(
res_dec = vpx_codec_decode(&decoder_, res_dec = vpx_codec_decode(
cxdata, static_cast<unsigned int>(size), &decoder_, cxdata, static_cast<unsigned int>(size), user_priv, 0));
user_priv, 0));
return res_dec; return res_dec;
} }
@ -80,16 +78,14 @@ void DecoderTest::RunLoop(CompressedVideoSource *video,
stream_info.sz = sizeof(stream_info); stream_info.sz = sizeof(stream_info);
if (video->cxdata() != NULL) { if (video->cxdata() != NULL) {
const vpx_codec_err_t res_peek = decoder->PeekStream(video->cxdata(), const vpx_codec_err_t res_peek = decoder->PeekStream(
video->frame_size(), video->cxdata(), video->frame_size(), &stream_info);
&stream_info);
HandlePeekResult(decoder, video, res_peek); HandlePeekResult(decoder, video, res_peek);
ASSERT_FALSE(::testing::Test::HasFailure()); ASSERT_FALSE(::testing::Test::HasFailure());
vpx_codec_err_t res_dec = decoder->DecodeFrame(video->cxdata(), vpx_codec_err_t res_dec =
video->frame_size()); decoder->DecodeFrame(video->cxdata(), video->frame_size());
if (!HandleDecodeResult(res_dec, *video, decoder)) if (!HandleDecodeResult(res_dec, *video, decoder)) break;
break;
} else { } else {
// Signal end of the file to the decoder. // Signal end of the file to the decoder.
const vpx_codec_err_t res_dec = decoder->DecodeFrame(NULL, 0); const vpx_codec_err_t res_dec = decoder->DecodeFrame(NULL, 0);
@ -116,8 +112,6 @@ void DecoderTest::set_cfg(const vpx_codec_dec_cfg_t &dec_cfg) {
memcpy(&cfg_, &dec_cfg, sizeof(cfg_)); memcpy(&cfg_, &dec_cfg, sizeof(cfg_));
} }
void DecoderTest::set_flags(const vpx_codec_flags_t flags) { void DecoderTest::set_flags(const vpx_codec_flags_t flags) { flags_ = flags; }
flags_ = flags;
}
} // namespace libvpx_test } // namespace libvpx_test

View File

@ -26,9 +26,7 @@ class DxDataIterator {
explicit DxDataIterator(vpx_codec_ctx_t *decoder) explicit DxDataIterator(vpx_codec_ctx_t *decoder)
: decoder_(decoder), iter_(NULL) {} : decoder_(decoder), iter_(NULL) {}
const vpx_image_t *Next() { const vpx_image_t *Next() { return vpx_codec_get_frame(decoder_, &iter_); }
return vpx_codec_get_frame(decoder_, &iter_);
}
private: private:
vpx_codec_ctx_t *decoder_; vpx_codec_ctx_t *decoder_;
@ -47,13 +45,14 @@ class Decoder {
Decoder(vpx_codec_dec_cfg_t cfg, const vpx_codec_flags_t flag, Decoder(vpx_codec_dec_cfg_t cfg, const vpx_codec_flags_t flag,
unsigned long deadline) // NOLINT unsigned long deadline) // NOLINT
: cfg_(cfg), flags_(flag), deadline_(deadline), init_done_(false) { : cfg_(cfg),
flags_(flag),
deadline_(deadline),
init_done_(false) {
memset(&decoder_, 0, sizeof(decoder_)); memset(&decoder_, 0, sizeof(decoder_));
} }
virtual ~Decoder() { virtual ~Decoder() { vpx_codec_destroy(&decoder_); }
vpx_codec_destroy(&decoder_);
}
vpx_codec_err_t PeekStream(const uint8_t *cxdata, size_t size, vpx_codec_err_t PeekStream(const uint8_t *cxdata, size_t size,
vpx_codec_stream_info_t *stream_info); vpx_codec_stream_info_t *stream_info);
@ -63,17 +62,11 @@ class Decoder {
vpx_codec_err_t DecodeFrame(const uint8_t *cxdata, size_t size, vpx_codec_err_t DecodeFrame(const uint8_t *cxdata, size_t size,
void *user_priv); void *user_priv);
DxDataIterator GetDxData() { DxDataIterator GetDxData() { return DxDataIterator(&decoder_); }
return DxDataIterator(&decoder_);
}
void set_deadline(unsigned long deadline) { void set_deadline(unsigned long deadline) { deadline_ = deadline; }
deadline_ = deadline;
}
void Control(int ctrl_id, int arg) { void Control(int ctrl_id, int arg) { Control(ctrl_id, arg, VPX_CODEC_OK); }
Control(ctrl_id, arg, VPX_CODEC_OK);
}
void Control(int ctrl_id, const void *arg) { void Control(int ctrl_id, const void *arg) {
InitOnce(); InitOnce();
@ -97,8 +90,8 @@ class Decoder {
vpx_get_frame_buffer_cb_fn_t cb_get, vpx_get_frame_buffer_cb_fn_t cb_get,
vpx_release_frame_buffer_cb_fn_t cb_release, void *user_priv) { vpx_release_frame_buffer_cb_fn_t cb_release, void *user_priv) {
InitOnce(); InitOnce();
return vpx_codec_set_frame_buffer_functions( return vpx_codec_set_frame_buffer_functions(&decoder_, cb_get, cb_release,
&decoder_, cb_get, cb_release, user_priv); user_priv);
} }
const char *GetDecoderName() const { const char *GetDecoderName() const {
@ -107,18 +100,15 @@ class Decoder {
bool IsVP8() const; bool IsVP8() const;
vpx_codec_ctx_t * GetDecoder() { vpx_codec_ctx_t *GetDecoder() { return &decoder_; }
return &decoder_;
}
protected: protected:
virtual vpx_codec_iface_t *CodecInterface() const = 0; virtual vpx_codec_iface_t *CodecInterface() const = 0;
void InitOnce() { void InitOnce() {
if (!init_done_) { if (!init_done_) {
const vpx_codec_err_t res = vpx_codec_dec_init(&decoder_, const vpx_codec_err_t res =
CodecInterface(), vpx_codec_dec_init(&decoder_, CodecInterface(), &cfg_, flags_);
&cfg_, flags_);
ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError(); ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError();
init_done_ = true; init_done_ = true;
} }
@ -165,9 +155,7 @@ class DecoderTest {
protected: protected:
explicit DecoderTest(const CodecFactory *codec) explicit DecoderTest(const CodecFactory *codec)
: codec_(codec), : codec_(codec), cfg_(), flags_(0) {}
cfg_(),
flags_(0) {}
virtual ~DecoderTest() {} virtual ~DecoderTest() {}

View File

@ -26,10 +26,7 @@ const double kUsecsInSec = 1000000.0;
struct EncodePerfTestVideo { struct EncodePerfTestVideo {
EncodePerfTestVideo(const char *name_, uint32_t width_, uint32_t height_, EncodePerfTestVideo(const char *name_, uint32_t width_, uint32_t height_,
uint32_t bitrate_, int frames_) uint32_t bitrate_, int frames_)
: name(name_), : name(name_), width(width_), height(height_), bitrate(bitrate_),
width(width_),
height(height_),
bitrate(bitrate_),
frames(frames_) {} frames(frames_) {}
const char *name; const char *name;
uint32_t width; uint32_t width;
@ -45,8 +42,8 @@ const EncodePerfTestVideo kVP9EncodePerfTestVectors[] = {
EncodePerfTestVideo("macmarcostationary_640_480_30.yuv", 640, 480, 200, 718), EncodePerfTestVideo("macmarcostationary_640_480_30.yuv", 640, 480, 200, 718),
EncodePerfTestVideo("niklas_640_480_30.yuv", 640, 480, 200, 471), EncodePerfTestVideo("niklas_640_480_30.yuv", 640, 480, 200, 471),
EncodePerfTestVideo("tacomanarrows_640_480_30.yuv", 640, 480, 200, 300), EncodePerfTestVideo("tacomanarrows_640_480_30.yuv", 640, 480, 200, 300),
EncodePerfTestVideo("tacomasmallcameramovement_640_480_30.yuv", EncodePerfTestVideo("tacomasmallcameramovement_640_480_30.yuv", 640, 480, 200,
640, 480, 200, 300), 300),
EncodePerfTestVideo("thaloundeskmtg_640_480_30.yuv", 640, 480, 200, 300), EncodePerfTestVideo("thaloundeskmtg_640_480_30.yuv", 640, 480, 200, 300),
EncodePerfTestVideo("niklas_1280_720_30.yuv", 1280, 720, 600, 470), EncodePerfTestVideo("niklas_1280_720_30.yuv", 1280, 720, 600, 470),
}; };
@ -61,12 +58,8 @@ class VP9EncodePerfTest
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> { public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
protected: protected:
VP9EncodePerfTest() VP9EncodePerfTest()
: EncoderTest(GET_PARAM(0)), : EncoderTest(GET_PARAM(0)), min_psnr_(kMaxPsnr), nframes_(0),
min_psnr_(kMaxPsnr), encoding_mode_(GET_PARAM(1)), speed_(0), threads_(1) {}
nframes_(0),
encoding_mode_(GET_PARAM(1)),
speed_(0),
threads_(1) {}
virtual ~VP9EncodePerfTest() {} virtual ~VP9EncodePerfTest() {}
@ -114,17 +107,11 @@ class VP9EncodePerfTest
// for performance reasons don't decode // for performance reasons don't decode
virtual bool DoDecode() { return 0; } virtual bool DoDecode() { return 0; }
double min_psnr() const { double min_psnr() const { return min_psnr_; }
return min_psnr_;
}
void set_speed(unsigned int speed) { void set_speed(unsigned int speed) { speed_ = speed; }
speed_ = speed;
}
void set_threads(unsigned int threads) { void set_threads(unsigned int threads) { threads_ = threads; }
threads_ = threads;
}
private: private:
double min_psnr_; double min_psnr_;
@ -157,10 +144,8 @@ TEST_P(VP9EncodePerfTest, PerfTest) {
const unsigned frames = kVP9EncodePerfTestVectors[i].frames; const unsigned frames = kVP9EncodePerfTestVectors[i].frames;
const char *video_name = kVP9EncodePerfTestVectors[i].name; const char *video_name = kVP9EncodePerfTestVectors[i].name;
libvpx_test::I420VideoSource video( libvpx_test::I420VideoSource video(
video_name, video_name, kVP9EncodePerfTestVectors[i].width,
kVP9EncodePerfTestVectors[i].width, kVP9EncodePerfTestVectors[i].height, timebase.den, timebase.num, 0,
kVP9EncodePerfTestVectors[i].height,
timebase.den, timebase.num, 0,
kVP9EncodePerfTestVectors[i].frames); kVP9EncodePerfTestVectors[i].frames);
set_speed(kEncodePerfTestSpeeds[j]); set_speed(kEncodePerfTestSpeeds[j]);
@ -197,6 +182,6 @@ TEST_P(VP9EncodePerfTest, PerfTest) {
} }
} }
VP9_INSTANTIATE_TEST_CASE( VP9_INSTANTIATE_TEST_CASE(VP9EncodePerfTest,
VP9EncodePerfTest, ::testing::Values(::libvpx_test::kRealTime)); ::testing::Values(::libvpx_test::kRealTime));
} // namespace } // namespace

View File

@ -30,8 +30,7 @@ void Encoder::InitEncoder(VideoSource *video) {
cfg_.g_timebase = video->timebase(); cfg_.g_timebase = video->timebase();
cfg_.rc_twopass_stats_in = stats_->buf(); cfg_.rc_twopass_stats_in = stats_->buf();
res = vpx_codec_enc_init(&encoder_, CodecInterface(), &cfg_, res = vpx_codec_enc_init(&encoder_, CodecInterface(), &cfg_, init_flags_);
init_flags_);
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
#if CONFIG_VP9_ENCODER #if CONFIG_VP9_ENCODER
@ -62,8 +61,7 @@ void Encoder::EncodeFrame(VideoSource *video, const unsigned long frame_flags) {
CxDataIterator iter = GetCxData(); CxDataIterator iter = GetCxData();
while (const vpx_codec_cx_pkt_t *pkt = iter.Next()) { while (const vpx_codec_cx_pkt_t *pkt = iter.Next()) {
if (pkt->kind != VPX_CODEC_STATS_PKT) if (pkt->kind != VPX_CODEC_STATS_PKT) continue;
continue;
stats_->Append(*pkt); stats_->Append(*pkt);
} }
@ -83,15 +81,15 @@ void Encoder::EncodeFrameInternal(const VideoSource &video,
} }
// Encode the frame // Encode the frame
API_REGISTER_STATE_CHECK( API_REGISTER_STATE_CHECK(res = vpx_codec_encode(&encoder_, img, video.pts(),
res = vpx_codec_encode(&encoder_, img, video.pts(), video.duration(), video.duration(), frame_flags,
frame_flags, deadline_)); deadline_));
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError(); ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
} }
void Encoder::Flush() { void Encoder::Flush() {
const vpx_codec_err_t res = vpx_codec_encode(&encoder_, NULL, 0, 0, 0, const vpx_codec_err_t res =
deadline_); vpx_codec_encode(&encoder_, NULL, 0, 0, 0, deadline_);
if (!encoder_.priv) if (!encoder_.priv)
ASSERT_EQ(VPX_CODEC_ERROR, res) << EncoderError(); ASSERT_EQ(VPX_CODEC_ERROR, res) << EncoderError();
else else
@ -106,22 +104,15 @@ void EncoderTest::InitializeConfig() {
void EncoderTest::SetMode(TestMode mode) { void EncoderTest::SetMode(TestMode mode) {
switch (mode) { switch (mode) {
case kRealTime: case kRealTime: deadline_ = VPX_DL_REALTIME; break;
deadline_ = VPX_DL_REALTIME;
break;
case kOnePassGood: case kOnePassGood:
case kTwoPassGood: case kTwoPassGood: deadline_ = VPX_DL_GOOD_QUALITY; break;
deadline_ = VPX_DL_GOOD_QUALITY;
break;
case kOnePassBest: case kOnePassBest:
case kTwoPassBest: case kTwoPassBest: deadline_ = VPX_DL_BEST_QUALITY; break;
deadline_ = VPX_DL_BEST_QUALITY;
break;
default: default: ASSERT_TRUE(false) << "Unexpected mode " << mode;
ASSERT_TRUE(false) << "Unexpected mode " << mode;
} }
if (mode == kTwoPassGood || mode == kTwoPassBest) if (mode == kTwoPassGood || mode == kTwoPassBest)
@ -131,12 +122,9 @@ void EncoderTest::SetMode(TestMode mode) {
} }
// The function should return "true" most of the time, therefore no early // The function should return "true" most of the time, therefore no early
// break-out is implemented within the match checking process. // break-out is implemented within the match checking process.
static bool compare_img(const vpx_image_t *img1, static bool compare_img(const vpx_image_t *img1, const vpx_image_t *img2) {
const vpx_image_t *img2) { bool match = (img1->fmt == img2->fmt) && (img1->cs == img2->cs) &&
bool match = (img1->fmt == img2->fmt) && (img1->d_w == img2->d_w) && (img1->d_h == img2->d_h);
(img1->cs == img2->cs) &&
(img1->d_w == img2->d_w) &&
(img1->d_h == img2->d_h);
const unsigned int width_y = img1->d_w; const unsigned int width_y = img1->d_w;
const unsigned int height_y = img1->d_h; const unsigned int height_y = img1->d_h;
@ -144,17 +132,20 @@ static bool compare_img(const vpx_image_t *img1,
for (i = 0; i < height_y; ++i) for (i = 0; i < height_y; ++i)
match = (memcmp(img1->planes[VPX_PLANE_Y] + i * img1->stride[VPX_PLANE_Y], match = (memcmp(img1->planes[VPX_PLANE_Y] + i * img1->stride[VPX_PLANE_Y],
img2->planes[VPX_PLANE_Y] + i * img2->stride[VPX_PLANE_Y], img2->planes[VPX_PLANE_Y] + i * img2->stride[VPX_PLANE_Y],
width_y) == 0) && match; width_y) == 0) &&
match;
const unsigned int width_uv = (img1->d_w + 1) >> 1; const unsigned int width_uv = (img1->d_w + 1) >> 1;
const unsigned int height_uv = (img1->d_h + 1) >> 1; const unsigned int height_uv = (img1->d_h + 1) >> 1;
for (i = 0; i < height_uv; ++i) for (i = 0; i < height_uv; ++i)
match = (memcmp(img1->planes[VPX_PLANE_U] + i * img1->stride[VPX_PLANE_U], match = (memcmp(img1->planes[VPX_PLANE_U] + i * img1->stride[VPX_PLANE_U],
img2->planes[VPX_PLANE_U] + i * img2->stride[VPX_PLANE_U], img2->planes[VPX_PLANE_U] + i * img2->stride[VPX_PLANE_U],
width_uv) == 0) && match; width_uv) == 0) &&
match;
for (i = 0; i < height_uv; ++i) for (i = 0; i < height_uv; ++i)
match = (memcmp(img1->planes[VPX_PLANE_V] + i * img1->stride[VPX_PLANE_V], match = (memcmp(img1->planes[VPX_PLANE_V] + i * img1->stride[VPX_PLANE_V],
img2->planes[VPX_PLANE_V] + i * img2->stride[VPX_PLANE_V], img2->planes[VPX_PLANE_V] + i * img2->stride[VPX_PLANE_V],
width_uv) == 0) && match; width_uv) == 0) &&
match;
return match; return match;
} }
@ -217,8 +208,7 @@ void EncoderTest::RunLoop(VideoSource *video) {
vpx_codec_err_t res_dec = decoder->DecodeFrame( vpx_codec_err_t res_dec = decoder->DecodeFrame(
(const uint8_t *)pkt->data.frame.buf, pkt->data.frame.sz); (const uint8_t *)pkt->data.frame.buf, pkt->data.frame.sz);
if (!HandleDecodeResult(res_dec, *video, decoder.get())) if (!HandleDecodeResult(res_dec, *video, decoder.get())) break;
break;
has_dxdata = true; has_dxdata = true;
} }
@ -227,20 +217,16 @@ void EncoderTest::RunLoop(VideoSource *video) {
FramePktHook(pkt); FramePktHook(pkt);
break; break;
case VPX_CODEC_PSNR_PKT: case VPX_CODEC_PSNR_PKT: PSNRPktHook(pkt); break;
PSNRPktHook(pkt);
break;
default: default: break;
break;
} }
} }
// Flush the decoder when there are no more fragments. // Flush the decoder when there are no more fragments.
if ((init_flags_ & VPX_CODEC_USE_OUTPUT_PARTITION) && has_dxdata) { if ((init_flags_ & VPX_CODEC_USE_OUTPUT_PARTITION) && has_dxdata) {
const vpx_codec_err_t res_dec = decoder->DecodeFrame(NULL, 0); const vpx_codec_err_t res_dec = decoder->DecodeFrame(NULL, 0);
if (!HandleDecodeResult(res_dec, *video, decoder.get())) if (!HandleDecodeResult(res_dec, *video, decoder.get())) break;
break;
} }
if (has_dxdata && has_cxdata) { if (has_dxdata && has_cxdata) {
@ -253,17 +239,14 @@ void EncoderTest::RunLoop(VideoSource *video) {
MismatchHook(img_enc, img_dec); MismatchHook(img_enc, img_dec);
} }
} }
if (img_dec) if (img_dec) DecompressedFrameHook(*img_dec, video->pts());
DecompressedFrameHook(*img_dec, video->pts());
} }
if (!Continue()) if (!Continue()) break;
break;
} }
EndPassHook(); EndPassHook();
if (!Continue()) if (!Continue()) break;
break;
} }
} }

View File

@ -33,19 +33,17 @@ enum TestMode {
kTwoPassGood, kTwoPassGood,
kTwoPassBest kTwoPassBest
}; };
#define ALL_TEST_MODES ::testing::Values(::libvpx_test::kRealTime, \ #define ALL_TEST_MODES \
::libvpx_test::kOnePassGood, \ ::testing::Values(::libvpx_test::kRealTime, ::libvpx_test::kOnePassGood, \
::libvpx_test::kOnePassBest, \ ::libvpx_test::kOnePassBest, ::libvpx_test::kTwoPassGood, \
::libvpx_test::kTwoPassGood, \
::libvpx_test::kTwoPassBest) ::libvpx_test::kTwoPassBest)
#define ONE_PASS_TEST_MODES ::testing::Values(::libvpx_test::kRealTime, \ #define ONE_PASS_TEST_MODES \
::libvpx_test::kOnePassGood, \ ::testing::Values(::libvpx_test::kRealTime, ::libvpx_test::kOnePassGood, \
::libvpx_test::kOnePassBest) ::libvpx_test::kOnePassBest)
#define TWO_PASS_TEST_MODES ::testing::Values(::libvpx_test::kTwoPassGood, \ #define TWO_PASS_TEST_MODES \
::libvpx_test::kTwoPassBest) ::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kTwoPassBest)
// Provides an object to handle the libvpx get_cx_data() iteration pattern // Provides an object to handle the libvpx get_cx_data() iteration pattern
class CxDataIterator { class CxDataIterator {
@ -75,15 +73,12 @@ class TwopassStatsStore {
return buf; return buf;
} }
void Reset() { void Reset() { buffer_.clear(); }
buffer_.clear();
}
protected: protected:
std::string buffer_; std::string buffer_;
}; };
// Provides a simplified interface to manage one video encoding pass, given // Provides a simplified interface to manage one video encoding pass, given
// a configuration and video source. // a configuration and video source.
// //
@ -97,13 +92,9 @@ class Encoder {
memset(&encoder_, 0, sizeof(encoder_)); memset(&encoder_, 0, sizeof(encoder_));
} }
virtual ~Encoder() { virtual ~Encoder() { vpx_codec_destroy(&encoder_); }
vpx_codec_destroy(&encoder_);
}
CxDataIterator GetCxData() { CxDataIterator GetCxData() { return CxDataIterator(&encoder_); }
return CxDataIterator(&encoder_);
}
void InitEncoder(VideoSource *video); void InitEncoder(VideoSource *video);
@ -115,9 +106,7 @@ class Encoder {
void EncodeFrame(VideoSource *video, const unsigned long frame_flags); void EncodeFrame(VideoSource *video, const unsigned long frame_flags);
// Convenience wrapper for EncodeFrame() // Convenience wrapper for EncodeFrame()
void EncodeFrame(VideoSource *video) { void EncodeFrame(VideoSource *video) { EncodeFrame(video, 0); }
EncodeFrame(video, 0);
}
void Control(int ctrl_id, int arg) { void Control(int ctrl_id, int arg) {
const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg); const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg);
@ -156,9 +145,7 @@ class Encoder {
cfg_ = *cfg; cfg_ = *cfg;
} }
void set_deadline(unsigned long deadline) { void set_deadline(unsigned long deadline) { deadline_ = deadline; }
deadline_ = deadline;
}
protected: protected:
virtual vpx_codec_iface_t *CodecInterface() const = 0; virtual vpx_codec_iface_t *CodecInterface() const = 0;
@ -241,8 +228,7 @@ class EncoderTest {
virtual bool DoDecode() const { return 1; } virtual bool DoDecode() const { return 1; }
// Hook to handle encode/decode mismatch // Hook to handle encode/decode mismatch
virtual void MismatchHook(const vpx_image_t *img1, virtual void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2);
const vpx_image_t *img2);
// Hook to be called on every decompressed frame. // Hook to be called on every decompressed frame.
virtual void DecompressedFrameHook(const vpx_image_t & /*img*/, virtual void DecompressedFrameHook(const vpx_image_t & /*img*/,

View File

@ -19,16 +19,13 @@ namespace {
const int kMaxErrorFrames = 12; const int kMaxErrorFrames = 12;
const int kMaxDroppableFrames = 12; const int kMaxDroppableFrames = 12;
class ErrorResilienceTestLarge : public ::libvpx_test::EncoderTest, class ErrorResilienceTestLarge
: public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, bool> { public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, bool> {
protected: protected:
ErrorResilienceTestLarge() ErrorResilienceTestLarge()
: EncoderTest(GET_PARAM(0)), : EncoderTest(GET_PARAM(0)), svc_support_(GET_PARAM(2)), psnr_(0.0),
svc_support_(GET_PARAM(2)), nframes_(0), mismatch_psnr_(0.0), mismatch_nframes_(0),
psnr_(0.0),
nframes_(0),
mismatch_psnr_(0.0),
mismatch_nframes_(0),
encoding_mode_(GET_PARAM(1)) { encoding_mode_(GET_PARAM(1)) {
Reset(); Reset();
} }
@ -66,32 +63,26 @@ class ErrorResilienceTestLarge : public ::libvpx_test::EncoderTest,
// LAST is updated on base/layer 0, GOLDEN updated on layer 1. // LAST is updated on base/layer 0, GOLDEN updated on layer 1.
// Non-zero pattern_switch parameter means pattern will switch to // Non-zero pattern_switch parameter means pattern will switch to
// not using LAST for frame_num >= pattern_switch. // not using LAST for frame_num >= pattern_switch.
int SetFrameFlags(int frame_num, int SetFrameFlags(int frame_num, int num_temp_layers, int pattern_switch) {
int num_temp_layers,
int pattern_switch) {
int frame_flags = 0; int frame_flags = 0;
if (num_temp_layers == 2) { if (num_temp_layers == 2) {
if (frame_num % 2 == 0) { if (frame_num % 2 == 0) {
if (frame_num < pattern_switch || pattern_switch == 0) { if (frame_num < pattern_switch || pattern_switch == 0) {
// Layer 0: predict from LAST and ARF, update LAST. // Layer 0: predict from LAST and ARF, update LAST.
frame_flags = VP8_EFLAG_NO_REF_GF | frame_flags =
VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
VP8_EFLAG_NO_UPD_ARF;
} else { } else {
// Layer 0: predict from GF and ARF, update GF. // Layer 0: predict from GF and ARF, update GF.
frame_flags = VP8_EFLAG_NO_REF_LAST | frame_flags = VP8_EFLAG_NO_REF_LAST | VP8_EFLAG_NO_UPD_LAST |
VP8_EFLAG_NO_UPD_LAST |
VP8_EFLAG_NO_UPD_ARF; VP8_EFLAG_NO_UPD_ARF;
} }
} else { } else {
if (frame_num < pattern_switch || pattern_switch == 0) { if (frame_num < pattern_switch || pattern_switch == 0) {
// Layer 1: predict from L, GF, and ARF, update GF. // Layer 1: predict from L, GF, and ARF, update GF.
frame_flags = VP8_EFLAG_NO_UPD_ARF | frame_flags = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST;
VP8_EFLAG_NO_UPD_LAST;
} else { } else {
// Layer 1: predict from GF and ARF, update GF. // Layer 1: predict from GF and ARF, update GF.
frame_flags = VP8_EFLAG_NO_REF_LAST | frame_flags = VP8_EFLAG_NO_REF_LAST | VP8_EFLAG_NO_UPD_LAST |
VP8_EFLAG_NO_UPD_LAST |
VP8_EFLAG_NO_UPD_ARF; VP8_EFLAG_NO_UPD_ARF;
} }
} }
@ -101,18 +92,16 @@ class ErrorResilienceTestLarge : public ::libvpx_test::EncoderTest,
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video, virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
::libvpx_test::Encoder * /*encoder*/) { ::libvpx_test::Encoder * /*encoder*/) {
frame_flags_ &= ~(VP8_EFLAG_NO_UPD_LAST | frame_flags_ &=
VP8_EFLAG_NO_UPD_GF | ~(VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF);
VP8_EFLAG_NO_UPD_ARF);
// For temporal layer case. // For temporal layer case.
if (cfg_.ts_number_layers > 1) { if (cfg_.ts_number_layers > 1) {
frame_flags_ = SetFrameFlags(video->frame(), frame_flags_ =
cfg_.ts_number_layers, SetFrameFlags(video->frame(), cfg_.ts_number_layers, pattern_switch_);
pattern_switch_);
for (unsigned int i = 0; i < droppable_nframes_; ++i) { for (unsigned int i = 0; i < droppable_nframes_; ++i) {
if (droppable_frames_[i] == video->frame()) { if (droppable_frames_[i] == video->frame()) {
std::cout << "Encoding droppable frame: " std::cout << "Encoding droppable frame: " << droppable_frames_[i]
<< droppable_frames_[i] << "\n"; << "\n";
} }
} }
} else { } else {
@ -120,10 +109,9 @@ class ErrorResilienceTestLarge : public ::libvpx_test::EncoderTest,
(cfg_.g_pass == VPX_RC_LAST_PASS || cfg_.g_pass == VPX_RC_ONE_PASS)) { (cfg_.g_pass == VPX_RC_LAST_PASS || cfg_.g_pass == VPX_RC_ONE_PASS)) {
for (unsigned int i = 0; i < droppable_nframes_; ++i) { for (unsigned int i = 0; i < droppable_nframes_; ++i) {
if (droppable_frames_[i] == video->frame()) { if (droppable_frames_[i] == video->frame()) {
std::cout << "Encoding droppable frame: " std::cout << "Encoding droppable frame: " << droppable_frames_[i]
<< droppable_frames_[i] << "\n"; << "\n";
frame_flags_ |= (VP8_EFLAG_NO_UPD_LAST | frame_flags_ |= (VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF |
VP8_EFLAG_NO_UPD_GF |
VP8_EFLAG_NO_UPD_ARF); VP8_EFLAG_NO_UPD_ARF);
return; return;
} }
@ -133,14 +121,12 @@ class ErrorResilienceTestLarge : public ::libvpx_test::EncoderTest,
} }
double GetAveragePsnr() const { double GetAveragePsnr() const {
if (nframes_) if (nframes_) return psnr_ / nframes_;
return psnr_ / nframes_;
return 0.0; return 0.0;
} }
double GetAverageMismatchPsnr() const { double GetAverageMismatchPsnr() const {
if (mismatch_nframes_) if (mismatch_nframes_) return mismatch_psnr_ / mismatch_nframes_;
return mismatch_psnr_ / mismatch_nframes_;
return 0.0; return 0.0;
} }
@ -158,8 +144,7 @@ class ErrorResilienceTestLarge : public ::libvpx_test::EncoderTest,
return 1; return 1;
} }
virtual void MismatchHook(const vpx_image_t *img1, virtual void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2) {
const vpx_image_t *img2) {
double mismatch_psnr = compute_psnr(img1, img2); double mismatch_psnr = compute_psnr(img1, img2);
mismatch_psnr_ += mismatch_psnr; mismatch_psnr_ += mismatch_psnr;
++mismatch_nframes_; ++mismatch_nframes_;
@ -186,13 +171,9 @@ class ErrorResilienceTestLarge : public ::libvpx_test::EncoderTest,
droppable_frames_[i] = list[i]; droppable_frames_[i] = list[i];
} }
unsigned int GetMismatchFrames() { unsigned int GetMismatchFrames() { return mismatch_nframes_; }
return mismatch_nframes_;
}
void SetPatternSwitch(int frame_switch) { void SetPatternSwitch(int frame_switch) { pattern_switch_ = frame_switch; }
pattern_switch_ = frame_switch;
}
bool svc_support_; bool svc_support_;
@ -265,14 +246,13 @@ TEST_P(ErrorResilienceTestLarge, DropFramesWithoutRecovery) {
// In addition to isolated loss/drop, add a long consecutive series // In addition to isolated loss/drop, add a long consecutive series
// (of size 9) of dropped frames. // (of size 9) of dropped frames.
unsigned int num_droppable_frames = 11; unsigned int num_droppable_frames = 11;
unsigned int droppable_frame_list[] = {5, 16, 22, 23, 24, 25, 26, 27, 28, unsigned int droppable_frame_list[] = { 5, 16, 22, 23, 24, 25,
29, 30}; 26, 27, 28, 29, 30 };
SetDroppableFrames(num_droppable_frames, droppable_frame_list); SetDroppableFrames(num_droppable_frames, droppable_frame_list);
SetErrorFrames(num_droppable_frames, droppable_frame_list); SetErrorFrames(num_droppable_frames, droppable_frame_list);
ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
// Test that no mismatches have been found // Test that no mismatches have been found
std::cout << " Mismatch frames: " std::cout << " Mismatch frames: " << GetMismatchFrames() << "\n";
<< GetMismatchFrames() << "\n";
EXPECT_EQ(GetMismatchFrames(), (unsigned int)0); EXPECT_EQ(GetMismatchFrames(), (unsigned int)0);
// Reset previously set of error/droppable frames. // Reset previously set of error/droppable frames.
@ -306,8 +286,7 @@ TEST_P(ErrorResilienceTestLarge, DropFramesWithoutRecovery) {
// layer, so successful decoding is expected. // layer, so successful decoding is expected.
TEST_P(ErrorResilienceTestLarge, 2LayersDropEnhancement) { TEST_P(ErrorResilienceTestLarge, 2LayersDropEnhancement) {
// This test doesn't run if SVC is not supported. // This test doesn't run if SVC is not supported.
if (!svc_support_) if (!svc_support_) return;
return;
const vpx_rational timebase = { 33333333, 1000000000 }; const vpx_rational timebase = { 33333333, 1000000000 };
cfg_.g_timebase = timebase; cfg_.g_timebase = timebase;
@ -342,8 +321,7 @@ TEST_P(ErrorResilienceTestLarge, 2LayersDropEnhancement) {
SetErrorFrames(num_droppable_frames, droppable_frame_list); SetErrorFrames(num_droppable_frames, droppable_frame_list);
ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
// Test that no mismatches have been found // Test that no mismatches have been found
std::cout << " Mismatch frames: " std::cout << " Mismatch frames: " << GetMismatchFrames() << "\n";
<< GetMismatchFrames() << "\n";
EXPECT_EQ(GetMismatchFrames(), (unsigned int)0); EXPECT_EQ(GetMismatchFrames(), (unsigned int)0);
// Reset previously set of error/droppable frames. // Reset previously set of error/droppable frames.
@ -355,8 +333,7 @@ TEST_P(ErrorResilienceTestLarge, 2LayersDropEnhancement) {
// sequence, the LAST ref is not used anymore. // sequence, the LAST ref is not used anymore.
TEST_P(ErrorResilienceTestLarge, 2LayersNoRefLast) { TEST_P(ErrorResilienceTestLarge, 2LayersNoRefLast) {
// This test doesn't run if SVC is not supported. // This test doesn't run if SVC is not supported.
if (!svc_support_) if (!svc_support_) return;
return;
const vpx_rational timebase = { 33333333, 1000000000 }; const vpx_rational timebase = { 33333333, 1000000000 };
cfg_.g_timebase = timebase; cfg_.g_timebase = timebase;
@ -385,20 +362,19 @@ TEST_P(ErrorResilienceTestLarge, 2LayersNoRefLast) {
ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
// Test that no mismatches have been found // Test that no mismatches have been found
std::cout << " Mismatch frames: " std::cout << " Mismatch frames: " << GetMismatchFrames() << "\n";
<< GetMismatchFrames() << "\n";
EXPECT_EQ(GetMismatchFrames(), (unsigned int)0); EXPECT_EQ(GetMismatchFrames(), (unsigned int)0);
// Reset previously set of error/droppable frames. // Reset previously set of error/droppable frames.
Reset(); Reset();
} }
class ErrorResilienceTestLargeCodecControls : public ::libvpx_test::EncoderTest, class ErrorResilienceTestLargeCodecControls
: public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> { public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
protected: protected:
ErrorResilienceTestLargeCodecControls() ErrorResilienceTestLargeCodecControls()
: EncoderTest(GET_PARAM(0)), : EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)) {
encoding_mode_(GET_PARAM(1)) {
Reset(); Reset();
} }
@ -437,8 +413,8 @@ class ErrorResilienceTestLargeCodecControls : public ::libvpx_test::EncoderTest,
if (num_temp_layers == 2) { if (num_temp_layers == 2) {
if (frame_num % 2 == 0) { if (frame_num % 2 == 0) {
// Layer 0: predict from L and ARF, update L. // Layer 0: predict from L and ARF, update L.
frame_flags = VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_UPD_GF | frame_flags =
VP8_EFLAG_NO_UPD_ARF; VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
} else { } else {
// Layer 1: predict from L, G and ARF, and update G. // Layer 1: predict from L, G and ARF, and update G.
frame_flags = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST | frame_flags = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST |
@ -451,8 +427,8 @@ class ErrorResilienceTestLargeCodecControls : public ::libvpx_test::EncoderTest,
VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF; VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF;
} else if ((frame_num - 2) % 4 == 0) { } else if ((frame_num - 2) % 4 == 0) {
// Layer 1: predict from L, G, update G. // Layer 1: predict from L, G, update G.
frame_flags = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST | frame_flags =
VP8_EFLAG_NO_REF_ARF; VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_REF_ARF;
} else if ((frame_num - 1) % 2 == 0) { } else if ((frame_num - 1) % 2 == 0) {
// Layer 2: predict from L, G, ARF; update ARG. // Layer 2: predict from L, G, ARF; update ARG.
frame_flags = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_LAST; frame_flags = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_LAST;
@ -524,13 +500,15 @@ class ErrorResilienceTestLargeCodecControls : public ::libvpx_test::EncoderTest,
++layer) { ++layer) {
if (bits_total_[layer]) { if (bits_total_[layer]) {
// Effective file datarate: // Effective file datarate:
effective_datarate_[layer] = (bits_total_[layer] / 1000.0) / duration_; effective_datarate_[layer] =
(bits_total_[layer] / 1000.0) / duration_;
} }
} }
} }
} }
double effective_datarate_[3]; double effective_datarate_[3];
private: private:
libvpx_test::TestMode encoding_mode_; libvpx_test::TestMode encoding_mode_;
vpx_codec_pts_t last_pts_; vpx_codec_pts_t last_pts_;
@ -582,10 +560,12 @@ TEST_P(ErrorResilienceTestLargeCodecControls, CodecControl3TemporalLayers) {
for (int j = 0; j < static_cast<int>(cfg_.ts_number_layers); ++j) { for (int j = 0; j < static_cast<int>(cfg_.ts_number_layers); ++j) {
ASSERT_GE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 0.75) ASSERT_GE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 0.75)
<< " The datarate for the file is lower than target by too much, " << " The datarate for the file is lower than target by too much, "
"for layer: " << j; "for layer: "
<< j;
ASSERT_LE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 1.25) ASSERT_LE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 1.25)
<< " The datarate for the file is greater than target by too much, " << " The datarate for the file is greater than target by too much, "
"for layer: " << j; "for layer: "
<< j;
} }
} }
} }

View File

@ -34,9 +34,7 @@ struct ExternalFrameBuffer {
// Class to manipulate a list of external frame buffers. // Class to manipulate a list of external frame buffers.
class ExternalFrameBufferList { class ExternalFrameBufferList {
public: public:
ExternalFrameBufferList() ExternalFrameBufferList() : num_buffers_(0), ext_fb_list_(NULL) {}
: num_buffers_(0),
ext_fb_list_(NULL) {}
virtual ~ExternalFrameBufferList() { virtual ~ExternalFrameBufferList() {
for (int i = 0; i < num_buffers_; ++i) { for (int i = 0; i < num_buffers_; ++i) {
@ -47,8 +45,7 @@ class ExternalFrameBufferList {
// Creates the list to hold the external buffers. Returns true on success. // Creates the list to hold the external buffers. Returns true on success.
bool CreateBufferList(int num_buffers) { bool CreateBufferList(int num_buffers) {
if (num_buffers < 0) if (num_buffers < 0) return false;
return false;
num_buffers_ = num_buffers; num_buffers_ = num_buffers;
ext_fb_list_ = new ExternalFrameBuffer[num_buffers_]; ext_fb_list_ = new ExternalFrameBuffer[num_buffers_];
@ -64,8 +61,7 @@ class ExternalFrameBufferList {
int GetFreeFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) { int GetFreeFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) {
EXPECT_TRUE(fb != NULL); EXPECT_TRUE(fb != NULL);
const int idx = FindFreeBufferIndex(); const int idx = FindFreeBufferIndex();
if (idx == num_buffers_) if (idx == num_buffers_) return -1;
return -1;
if (ext_fb_list_[idx].size < min_size) { if (ext_fb_list_[idx].size < min_size) {
delete[] ext_fb_list_[idx].data; delete[] ext_fb_list_[idx].data;
@ -83,8 +79,7 @@ class ExternalFrameBufferList {
int GetZeroFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) { int GetZeroFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) {
EXPECT_TRUE(fb != NULL); EXPECT_TRUE(fb != NULL);
const int idx = FindFreeBufferIndex(); const int idx = FindFreeBufferIndex();
if (idx == num_buffers_) if (idx == num_buffers_) return -1;
return -1;
if (ext_fb_list_[idx].size < min_size) { if (ext_fb_list_[idx].size < min_size) {
delete[] ext_fb_list_[idx].data; delete[] ext_fb_list_[idx].data;
@ -133,8 +128,7 @@ class ExternalFrameBufferList {
int i; int i;
// Find a free frame buffer. // Find a free frame buffer.
for (i = 0; i < num_buffers_; ++i) { for (i = 0; i < num_buffers_; ++i) {
if (!ext_fb_list_[i].in_use) if (!ext_fb_list_[i].in_use) break;
break;
} }
return i; return i;
} }
@ -167,8 +161,7 @@ int get_vp9_frame_buffer(void *user_priv, size_t min_size,
// Callback used by libvpx to tell the application that |fb| is not needed // Callback used by libvpx to tell the application that |fb| is not needed
// anymore. // anymore.
int release_vp9_frame_buffer(void *user_priv, int release_vp9_frame_buffer(void *user_priv, vpx_codec_frame_buffer_t *fb) {
vpx_codec_frame_buffer_t *fb) {
ExternalFrameBufferList *const fb_list = ExternalFrameBufferList *const fb_list =
reinterpret_cast<ExternalFrameBufferList *>(user_priv); reinterpret_cast<ExternalFrameBufferList *>(user_priv);
return fb_list->ReturnFrameBuffer(fb); return fb_list->ReturnFrameBuffer(fb);
@ -207,12 +200,10 @@ class ExternalFrameBufferMD5Test
protected: protected:
ExternalFrameBufferMD5Test() ExternalFrameBufferMD5Test()
: DecoderTest(GET_PARAM(::libvpx_test::kCodecFactoryParam)), : DecoderTest(GET_PARAM(::libvpx_test::kCodecFactoryParam)),
md5_file_(NULL), md5_file_(NULL), num_buffers_(0) {}
num_buffers_(0) {}
virtual ~ExternalFrameBufferMD5Test() { virtual ~ExternalFrameBufferMD5Test() {
if (md5_file_ != NULL) if (md5_file_ != NULL) fclose(md5_file_);
fclose(md5_file_);
} }
virtual void PreDecodeFrameHook( virtual void PreDecodeFrameHook(
@ -222,8 +213,8 @@ class ExternalFrameBufferMD5Test
// Have libvpx use frame buffers we create. // Have libvpx use frame buffers we create.
ASSERT_TRUE(fb_list_.CreateBufferList(num_buffers_)); ASSERT_TRUE(fb_list_.CreateBufferList(num_buffers_));
ASSERT_EQ(VPX_CODEC_OK, ASSERT_EQ(VPX_CODEC_OK,
decoder->SetFrameBufferFunctions( decoder->SetFrameBufferFunctions(GetVP9FrameBuffer,
GetVP9FrameBuffer, ReleaseVP9FrameBuffer, this)); ReleaseVP9FrameBuffer, this));
} }
} }
@ -286,10 +277,7 @@ const char kVP9TestFile[] = "vp90-2-02-size-lf-1920x1080.webm";
// Class for testing passing in external frame buffers to libvpx. // Class for testing passing in external frame buffers to libvpx.
class ExternalFrameBufferTest : public ::testing::Test { class ExternalFrameBufferTest : public ::testing::Test {
protected: protected:
ExternalFrameBufferTest() ExternalFrameBufferTest() : video_(NULL), decoder_(NULL), num_buffers_(0) {}
: video_(NULL),
decoder_(NULL),
num_buffers_(0) {}
virtual void SetUp() { virtual void SetUp() {
video_ = new libvpx_test::WebMVideoSource(kVP9TestFile); video_ = new libvpx_test::WebMVideoSource(kVP9TestFile);
@ -309,8 +297,7 @@ class ExternalFrameBufferTest : public ::testing::Test {
// Passes the external frame buffer information to libvpx. // Passes the external frame buffer information to libvpx.
vpx_codec_err_t SetFrameBufferFunctions( vpx_codec_err_t SetFrameBufferFunctions(
int num_buffers, int num_buffers, vpx_get_frame_buffer_cb_fn_t cb_get,
vpx_get_frame_buffer_cb_fn_t cb_get,
vpx_release_frame_buffer_cb_fn_t cb_release) { vpx_release_frame_buffer_cb_fn_t cb_release) {
if (num_buffers > 0) { if (num_buffers > 0) {
num_buffers_ = num_buffers; num_buffers_ = num_buffers;
@ -324,8 +311,7 @@ class ExternalFrameBufferTest : public ::testing::Test {
const vpx_codec_err_t res = const vpx_codec_err_t res =
decoder_->DecodeFrame(video_->cxdata(), video_->frame_size()); decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
CheckDecodedFrames(); CheckDecodedFrames();
if (res == VPX_CODEC_OK) if (res == VPX_CODEC_OK) video_->Next();
video_->Next();
return res; return res;
} }
@ -333,8 +319,7 @@ class ExternalFrameBufferTest : public ::testing::Test {
for (; video_->cxdata() != NULL; video_->Next()) { for (; video_->cxdata() != NULL; video_->Next()) {
const vpx_codec_err_t res = const vpx_codec_err_t res =
decoder_->DecodeFrame(video_->cxdata(), video_->frame_size()); decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
if (res != VPX_CODEC_OK) if (res != VPX_CODEC_OK) return res;
return res;
CheckDecodedFrames(); CheckDecodedFrames();
} }
return VPX_CODEC_OK; return VPX_CODEC_OK;
@ -409,8 +394,8 @@ TEST_F(ExternalFrameBufferTest, MinFrameBuffers) {
// #VP9_MAXIMUM_REF_BUFFERS + #VPX_MAXIMUM_WORK_BUFFERS. // #VP9_MAXIMUM_REF_BUFFERS + #VPX_MAXIMUM_WORK_BUFFERS.
const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS; const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
ASSERT_EQ(VPX_CODEC_OK, ASSERT_EQ(VPX_CODEC_OK,
SetFrameBufferFunctions( SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer,
num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer)); release_vp9_frame_buffer));
ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames()); ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames());
} }
@ -421,8 +406,8 @@ TEST_F(ExternalFrameBufferTest, EightJitterBuffers) {
const int num_buffers = const int num_buffers =
VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS + jitter_buffers; VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS + jitter_buffers;
ASSERT_EQ(VPX_CODEC_OK, ASSERT_EQ(VPX_CODEC_OK,
SetFrameBufferFunctions( SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer,
num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer)); release_vp9_frame_buffer));
ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames()); ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames());
} }
@ -432,8 +417,8 @@ TEST_F(ExternalFrameBufferTest, NotEnoughBuffers) {
// only use 5 frame buffers at one time. // only use 5 frame buffers at one time.
const int num_buffers = 2; const int num_buffers = 2;
ASSERT_EQ(VPX_CODEC_OK, ASSERT_EQ(VPX_CODEC_OK,
SetFrameBufferFunctions( SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer,
num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer)); release_vp9_frame_buffer));
ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame()); ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame());
ASSERT_EQ(VPX_CODEC_MEM_ERROR, DecodeRemainingFrames()); ASSERT_EQ(VPX_CODEC_MEM_ERROR, DecodeRemainingFrames());
} }
@ -457,8 +442,7 @@ TEST_F(ExternalFrameBufferTest, NullRealloc) {
TEST_F(ExternalFrameBufferTest, ReallocOneLessByte) { TEST_F(ExternalFrameBufferTest, ReallocOneLessByte) {
const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS; const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
ASSERT_EQ(VPX_CODEC_OK, ASSERT_EQ(VPX_CODEC_OK, SetFrameBufferFunctions(
SetFrameBufferFunctions(
num_buffers, get_vp9_one_less_byte_frame_buffer, num_buffers, get_vp9_one_less_byte_frame_buffer,
release_vp9_frame_buffer)); release_vp9_frame_buffer));
ASSERT_EQ(VPX_CODEC_MEM_ERROR, DecodeOneFrame()); ASSERT_EQ(VPX_CODEC_MEM_ERROR, DecodeOneFrame());
@ -466,9 +450,9 @@ TEST_F(ExternalFrameBufferTest, ReallocOneLessByte) {
TEST_F(ExternalFrameBufferTest, NullGetFunction) { TEST_F(ExternalFrameBufferTest, NullGetFunction) {
const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS; const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
ASSERT_EQ(VPX_CODEC_INVALID_PARAM, ASSERT_EQ(
SetFrameBufferFunctions(num_buffers, NULL, VPX_CODEC_INVALID_PARAM,
release_vp9_frame_buffer)); SetFrameBufferFunctions(num_buffers, NULL, release_vp9_frame_buffer));
} }
TEST_F(ExternalFrameBufferTest, NullReleaseFunction) { TEST_F(ExternalFrameBufferTest, NullReleaseFunction) {
@ -481,12 +465,13 @@ TEST_F(ExternalFrameBufferTest, SetAfterDecode) {
const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS; const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame()); ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame());
ASSERT_EQ(VPX_CODEC_ERROR, ASSERT_EQ(VPX_CODEC_ERROR,
SetFrameBufferFunctions( SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer,
num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer)); release_vp9_frame_buffer));
} }
#endif // CONFIG_WEBM_IO #endif // CONFIG_WEBM_IO
VP9_INSTANTIATE_TEST_CASE(ExternalFrameBufferMD5Test, VP9_INSTANTIATE_TEST_CASE(
ExternalFrameBufferMD5Test,
::testing::ValuesIn(libvpx_test::kVP9TestVectors, ::testing::ValuesIn(libvpx_test::kVP9TestVectors,
libvpx_test::kVP9TestVectors + libvpx_test::kVP9TestVectors +
libvpx_test::kNumVP9TestVectors)); libvpx_test::kNumVP9TestVectors));

View File

@ -128,14 +128,14 @@ class Trans4x4TestBase {
} }
} }
ASM_REGISTER_STATE_CHECK(RunFwdTxfm(test_input_block, ASM_REGISTER_STATE_CHECK(
test_temp_block, pitch_)); RunFwdTxfm(test_input_block, test_temp_block, pitch_));
if (bit_depth_ == VPX_BITS_8) { 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 #if CONFIG_VP9_HIGHBITDEPTH
} else { } else {
ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, ASM_REGISTER_STATE_CHECK(
CONVERT_TO_BYTEPTR(dst16), pitch_)); RunInvTxfm(test_temp_block, CONVERT_TO_BYTEPTR(dst16), pitch_));
#endif #endif
} }
@ -148,15 +148,13 @@ class Trans4x4TestBase {
const int diff = dst[j] - src[j]; const int diff = dst[j] - src[j];
#endif #endif
const uint32_t error = diff * diff; const uint32_t error = diff * diff;
if (max_error < error) if (max_error < error) max_error = error;
max_error = error;
total_error += error; total_error += error;
} }
} }
EXPECT_GE(static_cast<uint32_t>(limit), max_error) EXPECT_GE(static_cast<uint32_t>(limit), max_error)
<< "Error: 4x4 FHT/IHT has an individual round trip error > " << "Error: 4x4 FHT/IHT has an individual round trip error > " << limit;
<< limit;
EXPECT_GE(count_test_block * limit, total_error) EXPECT_GE(count_test_block * limit, total_error)
<< "Error: 4x4 FHT/IHT has average round trip error > " << limit << "Error: 4x4 FHT/IHT has average round trip error > " << limit
@ -197,16 +195,14 @@ class Trans4x4TestBase {
input_extreme_block[j] = rnd.Rand8() % 2 ? mask_ : -mask_; input_extreme_block[j] = rnd.Rand8() % 2 ? mask_ : -mask_;
} }
if (i == 0) { if (i == 0) {
for (int j = 0; j < kNumCoeffs; ++j) for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = mask_;
input_extreme_block[j] = mask_;
} else if (i == 1) { } else if (i == 1) {
for (int j = 0; j < kNumCoeffs; ++j) for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = -mask_;
input_extreme_block[j] = -mask_;
} }
fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_); fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_);
ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_extreme_block, ASM_REGISTER_STATE_CHECK(
output_block, pitch_)); RunFwdTxfm(input_extreme_block, output_block, pitch_));
// The minimum quant value is 4. // The minimum quant value is 4.
for (int j = 0; j < kNumCoeffs; ++j) { for (int j = 0; j < kNumCoeffs; ++j) {
@ -251,8 +247,8 @@ class Trans4x4TestBase {
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_)); ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_));
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
} else { } else {
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), ASM_REGISTER_STATE_CHECK(
pitch_)); RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_));
#endif #endif
} }
@ -265,8 +261,7 @@ class Trans4x4TestBase {
#endif #endif
const uint32_t error = diff * diff; const uint32_t error = diff * diff;
EXPECT_GE(static_cast<uint32_t>(limit), error) EXPECT_GE(static_cast<uint32_t>(limit), error)
<< "Error: 4x4 IDCT has error " << error << "Error: 4x4 IDCT has error " << error << " at index " << j;
<< " at index " << j;
} }
} }
} }
@ -278,8 +273,7 @@ class Trans4x4TestBase {
int mask_; int mask_;
}; };
class Trans4x4DCT class Trans4x4DCT : public Trans4x4TestBase,
: public Trans4x4TestBase,
public ::testing::TestWithParam<Dct4x4Param> { public ::testing::TestWithParam<Dct4x4Param> {
public: public:
virtual ~Trans4x4DCT() {} virtual ~Trans4x4DCT() {}
@ -307,24 +301,15 @@ class Trans4x4DCT
IdctFunc inv_txfm_; IdctFunc inv_txfm_;
}; };
TEST_P(Trans4x4DCT, AccuracyCheck) { TEST_P(Trans4x4DCT, AccuracyCheck) { RunAccuracyCheck(1); }
RunAccuracyCheck(1);
}
TEST_P(Trans4x4DCT, CoeffCheck) { TEST_P(Trans4x4DCT, CoeffCheck) { RunCoeffCheck(); }
RunCoeffCheck();
}
TEST_P(Trans4x4DCT, MemCheck) { TEST_P(Trans4x4DCT, MemCheck) { RunMemCheck(); }
RunMemCheck();
}
TEST_P(Trans4x4DCT, InvAccuracyCheck) { TEST_P(Trans4x4DCT, InvAccuracyCheck) { RunInvAccuracyCheck(1); }
RunInvAccuracyCheck(1);
}
class Trans4x4HT class Trans4x4HT : public Trans4x4TestBase,
: public Trans4x4TestBase,
public ::testing::TestWithParam<Ht4x4Param> { public ::testing::TestWithParam<Ht4x4Param> {
public: public:
virtual ~Trans4x4HT() {} virtual ~Trans4x4HT() {}
@ -353,24 +338,15 @@ class Trans4x4HT
IhtFunc inv_txfm_; IhtFunc inv_txfm_;
}; };
TEST_P(Trans4x4HT, AccuracyCheck) { TEST_P(Trans4x4HT, AccuracyCheck) { RunAccuracyCheck(1); }
RunAccuracyCheck(1);
}
TEST_P(Trans4x4HT, CoeffCheck) { TEST_P(Trans4x4HT, CoeffCheck) { RunCoeffCheck(); }
RunCoeffCheck();
}
TEST_P(Trans4x4HT, MemCheck) { TEST_P(Trans4x4HT, MemCheck) { RunMemCheck(); }
RunMemCheck();
}
TEST_P(Trans4x4HT, InvAccuracyCheck) { TEST_P(Trans4x4HT, InvAccuracyCheck) { RunInvAccuracyCheck(1); }
RunInvAccuracyCheck(1);
}
class Trans4x4WHT class Trans4x4WHT : public Trans4x4TestBase,
: public Trans4x4TestBase,
public ::testing::TestWithParam<Dct4x4Param> { public ::testing::TestWithParam<Dct4x4Param> {
public: public:
virtual ~Trans4x4WHT() {} virtual ~Trans4x4WHT() {}
@ -398,21 +374,13 @@ class Trans4x4WHT
IdctFunc inv_txfm_; IdctFunc inv_txfm_;
}; };
TEST_P(Trans4x4WHT, AccuracyCheck) { TEST_P(Trans4x4WHT, AccuracyCheck) { RunAccuracyCheck(0); }
RunAccuracyCheck(0);
}
TEST_P(Trans4x4WHT, CoeffCheck) { TEST_P(Trans4x4WHT, CoeffCheck) { RunCoeffCheck(); }
RunCoeffCheck();
}
TEST_P(Trans4x4WHT, MemCheck) { TEST_P(Trans4x4WHT, MemCheck) { RunMemCheck(); }
RunMemCheck();
}
TEST_P(Trans4x4WHT, InvAccuracyCheck) { TEST_P(Trans4x4WHT, InvAccuracyCheck) { RunInvAccuracyCheck(0); }
RunInvAccuracyCheck(0);
}
using std::tr1::make_tuple; using std::tr1::make_tuple;
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
@ -423,10 +391,10 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&vpx_highbd_fdct4x4_c, &idct4x4_12, 0, VPX_BITS_12), make_tuple(&vpx_highbd_fdct4x4_c, &idct4x4_12, 0, VPX_BITS_12),
make_tuple(&vpx_fdct4x4_c, &vpx_idct4x4_16_add_c, 0, VPX_BITS_8))); make_tuple(&vpx_fdct4x4_c, &vpx_idct4x4_16_add_c, 0, VPX_BITS_8)));
#else #else
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(C, Trans4x4DCT,
C, Trans4x4DCT, ::testing::Values(make_tuple(&vpx_fdct4x4_c,
::testing::Values( &vpx_idct4x4_16_add_c, 0,
make_tuple(&vpx_fdct4x4_c, &vpx_idct4x4_16_add_c, 0, VPX_BITS_8))); VPX_BITS_8)));
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
@ -463,18 +431,17 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&vp9_highbd_fwht4x4_c, &iwht4x4_12, 0, VPX_BITS_12), make_tuple(&vp9_highbd_fwht4x4_c, &iwht4x4_12, 0, VPX_BITS_12),
make_tuple(&vp9_fwht4x4_c, &vpx_iwht4x4_16_add_c, 0, VPX_BITS_8))); make_tuple(&vp9_fwht4x4_c, &vpx_iwht4x4_16_add_c, 0, VPX_BITS_8)));
#else #else
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(C, Trans4x4WHT,
C, Trans4x4WHT, ::testing::Values(make_tuple(&vp9_fwht4x4_c,
::testing::Values( &vpx_iwht4x4_16_add_c, 0,
make_tuple(&vp9_fwht4x4_c, &vpx_iwht4x4_16_add_c, 0, VPX_BITS_8))); VPX_BITS_8)));
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
#if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(NEON, Trans4x4DCT,
NEON, Trans4x4DCT, ::testing::Values(make_tuple(&vpx_fdct4x4_c,
::testing::Values( &vpx_idct4x4_16_add_neon,
make_tuple(&vpx_fdct4x4_c, 0, VPX_BITS_8)));
&vpx_idct4x4_16_add_neon, 0, VPX_BITS_8)));
#endif // HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #endif // HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
@ -496,11 +463,10 @@ INSTANTIATE_TEST_CASE_P(
#endif #endif
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(SSE2, Trans4x4DCT,
SSE2, Trans4x4DCT, ::testing::Values(make_tuple(&vpx_fdct4x4_sse2,
::testing::Values( &vpx_idct4x4_16_add_sse2,
make_tuple(&vpx_fdct4x4_sse2, 0, VPX_BITS_8)));
&vpx_idct4x4_16_add_sse2, 0, VPX_BITS_8)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, Trans4x4HT, SSE2, Trans4x4HT,
::testing::Values( ::testing::Values(
@ -518,8 +484,7 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(&vpx_highbd_fdct4x4_sse2, &idct4x4_10_sse2, 0, VPX_BITS_10), make_tuple(&vpx_highbd_fdct4x4_sse2, &idct4x4_10_sse2, 0, VPX_BITS_10),
make_tuple(&vpx_highbd_fdct4x4_c, &idct4x4_12_sse2, 0, VPX_BITS_12), make_tuple(&vpx_highbd_fdct4x4_c, &idct4x4_12_sse2, 0, VPX_BITS_12),
make_tuple(&vpx_highbd_fdct4x4_sse2, &idct4x4_12_sse2, 0, VPX_BITS_12), make_tuple(&vpx_highbd_fdct4x4_sse2, &idct4x4_12_sse2, 0, VPX_BITS_12),
make_tuple(&vpx_fdct4x4_sse2, &vpx_idct4x4_16_add_c, 0, make_tuple(&vpx_fdct4x4_sse2, &vpx_idct4x4_16_add_c, 0, VPX_BITS_8)));
VPX_BITS_8)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, Trans4x4HT, SSE2, Trans4x4HT,
@ -531,10 +496,10 @@ INSTANTIATE_TEST_CASE_P(
#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(MSA, Trans4x4DCT,
MSA, Trans4x4DCT, ::testing::Values(make_tuple(&vpx_fdct4x4_msa,
::testing::Values( &vpx_idct4x4_16_add_msa, 0,
make_tuple(&vpx_fdct4x4_msa, &vpx_idct4x4_16_add_msa, 0, VPX_BITS_8))); VPX_BITS_8)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
MSA, Trans4x4HT, MSA, Trans4x4HT,
::testing::Values( ::testing::Values(

View File

@ -53,8 +53,7 @@ void reference_8x8_dct_1d(const double in[8], double out[8]) {
out[k] = 0.0; out[k] = 0.0;
for (int n = 0; n < 8; n++) for (int n = 0; n < 8; n++)
out[k] += in[n] * cos(kPi * (2 * n + 1) * k / 16.0); out[k] += in[n] * cos(kPi * (2 * n + 1) * k / 16.0);
if (k == 0) if (k == 0) out[k] = out[k] * kInvSqrt2;
out[k] = out[k] * kInvSqrt2;
} }
} }
@ -63,25 +62,20 @@ void reference_8x8_dct_2d(const int16_t input[kNumCoeffs],
// First transform columns // First transform columns
for (int i = 0; i < 8; ++i) { for (int i = 0; i < 8; ++i) {
double temp_in[8], temp_out[8]; double temp_in[8], temp_out[8];
for (int j = 0; j < 8; ++j) for (int j = 0; j < 8; ++j) temp_in[j] = input[j * 8 + i];
temp_in[j] = input[j*8 + i];
reference_8x8_dct_1d(temp_in, temp_out); reference_8x8_dct_1d(temp_in, temp_out);
for (int j = 0; j < 8; ++j) for (int j = 0; j < 8; ++j) output[j * 8 + i] = temp_out[j];
output[j * 8 + i] = temp_out[j];
} }
// Then transform rows // Then transform rows
for (int i = 0; i < 8; ++i) { for (int i = 0; i < 8; ++i) {
double temp_in[8], temp_out[8]; double temp_in[8], temp_out[8];
for (int j = 0; j < 8; ++j) for (int j = 0; j < 8; ++j) temp_in[j] = output[j + i * 8];
temp_in[j] = output[j + i*8];
reference_8x8_dct_1d(temp_in, temp_out); reference_8x8_dct_1d(temp_in, temp_out);
// Scale by some magic number // Scale by some magic number
for (int j = 0; j < 8; ++j) for (int j = 0; j < 8; ++j) output[j + i * 8] = temp_out[j] * 2;
output[j + i * 8] = temp_out[j] * 2;
} }
} }
void fdct8x8_ref(const int16_t *in, tran_low_t *out, int stride, void fdct8x8_ref(const int16_t *in, tran_low_t *out, int stride,
int /*tx_type*/) { int /*tx_type*/) {
vpx_fdct8x8_c(in, out, stride); vpx_fdct8x8_c(in, out, stride);
@ -177,8 +171,7 @@ class FwdTrans8x8TestBase {
<< 1. * max_diff / count_test_block * 100 << "%" << 1. * max_diff / count_test_block * 100 << "%"
<< " for input range [-255, 255] at index " << j << " for input range [-255, 255] at index " << j
<< " count0: " << count_sign_block[j][0] << " count0: " << count_sign_block[j][0]
<< " count1: " << count_sign_block[j][1] << " count1: " << count_sign_block[j][1] << " diff: " << diff;
<< " diff: " << diff;
} }
memset(count_sign_block, 0, sizeof(count_sign_block)); memset(count_sign_block, 0, sizeof(count_sign_block));
@ -186,8 +179,8 @@ class FwdTrans8x8TestBase {
for (int i = 0; i < count_test_block; ++i) { for (int i = 0; i < count_test_block; ++i) {
// Initialize a test block with input range [-mask_ / 16, mask_ / 16]. // Initialize a test block with input range [-mask_ / 16, mask_ / 16].
for (int j = 0; j < 64; ++j) for (int j = 0; j < 64; ++j)
test_input_block[j] = ((rnd.Rand16() & mask_) >> 4) - test_input_block[j] =
((rnd.Rand16() & mask_) >> 4); ((rnd.Rand16() & mask_) >> 4) - ((rnd.Rand16() & mask_) >> 4);
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(
RunFwdTxfm(test_input_block, test_output_block, pitch_)); RunFwdTxfm(test_input_block, test_output_block, pitch_));
@ -207,8 +200,7 @@ class FwdTrans8x8TestBase {
<< 1. * max_diff / count_test_block * 100 << "%" << 1. * max_diff / count_test_block * 100 << "%"
<< " for input range [-15, 15] at index " << j << " for input range [-15, 15] at index " << j
<< " count0: " << count_sign_block[j][0] << " count0: " << count_sign_block[j][0]
<< " count1: " << count_sign_block[j][1] << " count1: " << count_sign_block[j][1] << " diff: " << diff;
<< " diff: " << diff;
} }
} }
@ -256,8 +248,7 @@ class FwdTrans8x8TestBase {
} }
} }
if (bit_depth_ == VPX_BITS_8) { if (bit_depth_ == VPX_BITS_8) {
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_));
RunInvTxfm(test_temp_block, dst, pitch_));
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
} else { } else {
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(
@ -273,8 +264,7 @@ class FwdTrans8x8TestBase {
const int diff = dst[j] - src[j]; const int diff = dst[j] - src[j];
#endif #endif
const int error = diff * diff; const int error = diff * diff;
if (max_error < error) if (max_error < error) max_error = error;
max_error = error;
total_error += error; total_error += error;
} }
} }
@ -341,8 +331,7 @@ class FwdTrans8x8TestBase {
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(
fwd_txfm_ref(test_input_block, ref_temp_block, pitch_, tx_type_)); fwd_txfm_ref(test_input_block, ref_temp_block, pitch_, tx_type_));
if (bit_depth_ == VPX_BITS_8) { if (bit_depth_ == VPX_BITS_8) {
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_));
RunInvTxfm(test_temp_block, dst, pitch_));
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
} else { } else {
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(
@ -358,8 +347,7 @@ class FwdTrans8x8TestBase {
const int diff = dst[j] - src[j]; const int diff = dst[j] - src[j];
#endif #endif
const int error = diff * diff; const int error = diff * diff;
if (max_error < error) if (max_error < error) max_error = error;
max_error = error;
total_error += error; total_error += error;
const int coeff_diff = test_temp_block[j] - ref_temp_block[j]; const int coeff_diff = test_temp_block[j] - ref_temp_block[j];
@ -418,8 +406,8 @@ class FwdTrans8x8TestBase {
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_)); ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_));
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
} else { } else {
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), ASM_REGISTER_STATE_CHECK(
pitch_)); RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_));
#endif #endif
} }
@ -432,8 +420,7 @@ class FwdTrans8x8TestBase {
#endif #endif
const uint32_t error = diff * diff; const uint32_t error = diff * diff;
EXPECT_GE(1u << 2 * (bit_depth_ - 8), error) EXPECT_GE(1u << 2 * (bit_depth_ - 8), error)
<< "Error: 8x8 IDCT has error " << error << "Error: 8x8 IDCT has error " << error << " at index " << j;
<< " at index " << j;
} }
} }
} }
@ -461,8 +448,7 @@ class FwdTrans8x8TestBase {
const int32_t diff = coeff[j] - coeff_r[j]; const int32_t diff = coeff[j] - coeff_r[j];
const uint32_t error = diff * diff; const uint32_t error = diff * diff;
EXPECT_GE(9u << 2 * (bit_depth_ - 8), error) EXPECT_GE(9u << 2 * (bit_depth_ - 8), error)
<< "Error: 8x8 DCT has error " << error << "Error: 8x8 DCT has error " << error << " at index " << j;
<< " at index " << j;
} }
} }
} }
@ -504,8 +490,8 @@ void CompareInvReference(IdctFunc ref_txfm, int thresh) {
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
} else { } else {
ref_txfm(coeff, CONVERT_TO_BYTEPTR(ref16), pitch_); ref_txfm(coeff, CONVERT_TO_BYTEPTR(ref16), pitch_);
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), ASM_REGISTER_STATE_CHECK(
pitch_)); RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_));
#endif #endif
} }
@ -517,8 +503,7 @@ void CompareInvReference(IdctFunc ref_txfm, int thresh) {
const int diff = dst[j] - ref[j]; const int diff = dst[j] - ref[j];
#endif #endif
const uint32_t error = diff * diff; const uint32_t error = diff * diff;
EXPECT_EQ(0u, error) EXPECT_EQ(0u, error) << "Error: 8x8 IDCT has error " << error
<< "Error: 8x8 IDCT has error " << error
<< " at index " << j; << " at index " << j;
} }
} }
@ -530,8 +515,7 @@ void CompareInvReference(IdctFunc ref_txfm, int thresh) {
int mask_; int mask_;
}; };
class FwdTrans8x8DCT class FwdTrans8x8DCT : public FwdTrans8x8TestBase,
: public FwdTrans8x8TestBase,
public ::testing::TestWithParam<Dct8x8Param> { public ::testing::TestWithParam<Dct8x8Param> {
public: public:
virtual ~FwdTrans8x8DCT() {} virtual ~FwdTrans8x8DCT() {}
@ -560,28 +544,17 @@ class FwdTrans8x8DCT
IdctFunc inv_txfm_; IdctFunc inv_txfm_;
}; };
TEST_P(FwdTrans8x8DCT, SignBiasCheck) { TEST_P(FwdTrans8x8DCT, SignBiasCheck) { RunSignBiasCheck(); }
RunSignBiasCheck();
}
TEST_P(FwdTrans8x8DCT, RoundTripErrorCheck) { TEST_P(FwdTrans8x8DCT, RoundTripErrorCheck) { RunRoundTripErrorCheck(); }
RunRoundTripErrorCheck();
}
TEST_P(FwdTrans8x8DCT, ExtremalCheck) { TEST_P(FwdTrans8x8DCT, ExtremalCheck) { RunExtremalCheck(); }
RunExtremalCheck();
}
TEST_P(FwdTrans8x8DCT, FwdAccuracyCheck) { TEST_P(FwdTrans8x8DCT, FwdAccuracyCheck) { RunFwdAccuracyCheck(); }
RunFwdAccuracyCheck();
}
TEST_P(FwdTrans8x8DCT, InvAccuracyCheck) { TEST_P(FwdTrans8x8DCT, InvAccuracyCheck) { RunInvAccuracyCheck(); }
RunInvAccuracyCheck();
}
class FwdTrans8x8HT class FwdTrans8x8HT : public FwdTrans8x8TestBase,
: public FwdTrans8x8TestBase,
public ::testing::TestWithParam<Ht8x8Param> { public ::testing::TestWithParam<Ht8x8Param> {
public: public:
virtual ~FwdTrans8x8HT() {} virtual ~FwdTrans8x8HT() {}
@ -610,20 +583,13 @@ class FwdTrans8x8HT
IhtFunc inv_txfm_; IhtFunc inv_txfm_;
}; };
TEST_P(FwdTrans8x8HT, SignBiasCheck) { TEST_P(FwdTrans8x8HT, SignBiasCheck) { RunSignBiasCheck(); }
RunSignBiasCheck();
}
TEST_P(FwdTrans8x8HT, RoundTripErrorCheck) { TEST_P(FwdTrans8x8HT, RoundTripErrorCheck) { RunRoundTripErrorCheck(); }
RunRoundTripErrorCheck();
}
TEST_P(FwdTrans8x8HT, ExtremalCheck) { TEST_P(FwdTrans8x8HT, ExtremalCheck) { RunExtremalCheck(); }
RunExtremalCheck();
}
class InvTrans8x8DCT class InvTrans8x8DCT : public FwdTrans8x8TestBase,
: public FwdTrans8x8TestBase,
public ::testing::TestWithParam<Idct8x8Param> { public ::testing::TestWithParam<Idct8x8Param> {
public: public:
virtual ~InvTrans8x8DCT() {} 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_10, 0, VPX_BITS_10),
make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_12, 0, VPX_BITS_12))); make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_12, 0, VPX_BITS_12)));
#else #else
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(C, FwdTrans8x8DCT,
C, FwdTrans8x8DCT, ::testing::Values(make_tuple(&vpx_fdct8x8_c,
::testing::Values( &vpx_idct8x8_64_add_c, 0,
make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c, 0, VPX_BITS_8))); VPX_BITS_8)));
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
@ -697,11 +663,10 @@ INSTANTIATE_TEST_CASE_P(
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
#if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(NEON, FwdTrans8x8DCT,
NEON, FwdTrans8x8DCT, ::testing::Values(make_tuple(&vpx_fdct8x8_neon,
::testing::Values( &vpx_idct8x8_64_add_neon,
make_tuple(&vpx_fdct8x8_neon, &vpx_idct8x8_64_add_neon, 0, 0, VPX_BITS_8)));
VPX_BITS_8)));
#endif // HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #endif // HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_NEON && !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 #endif // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(SSE2, FwdTrans8x8DCT,
SSE2, FwdTrans8x8DCT, ::testing::Values(make_tuple(&vpx_fdct8x8_sse2,
::testing::Values( &vpx_idct8x8_64_add_sse2,
make_tuple(&vpx_fdct8x8_sse2, &vpx_idct8x8_64_add_sse2, 0, 0, VPX_BITS_8)));
VPX_BITS_8)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, FwdTrans8x8HT, SSE2, FwdTrans8x8HT,
::testing::Values( ::testing::Values(
@ -732,14 +696,14 @@ INSTANTIATE_TEST_CASE_P(
#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, FwdTrans8x8DCT, SSE2, FwdTrans8x8DCT,
::testing::Values( ::testing::Values(make_tuple(&vpx_fdct8x8_sse2, &vpx_idct8x8_64_add_c, 0,
make_tuple(&vpx_fdct8x8_sse2, &vpx_idct8x8_64_add_c, 0, VPX_BITS_8), VPX_BITS_8),
make_tuple(&vpx_highbd_fdct8x8_c, make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_64_add_10_sse2,
&idct8x8_64_add_10_sse2, 12, VPX_BITS_10), 12, VPX_BITS_10),
make_tuple(&vpx_highbd_fdct8x8_sse2, make_tuple(&vpx_highbd_fdct8x8_sse2,
&idct8x8_64_add_10_sse2, 12, VPX_BITS_10), &idct8x8_64_add_10_sse2, 12, VPX_BITS_10),
make_tuple(&vpx_highbd_fdct8x8_c, make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_64_add_12_sse2,
&idct8x8_64_add_12_sse2, 12, VPX_BITS_12), 12, VPX_BITS_12),
make_tuple(&vpx_highbd_fdct8x8_sse2, make_tuple(&vpx_highbd_fdct8x8_sse2,
&idct8x8_64_add_12_sse2, 12, VPX_BITS_12))); &idct8x8_64_add_12_sse2, 12, VPX_BITS_12)));
@ -756,30 +720,27 @@ INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, InvTrans8x8DCT, SSE2, InvTrans8x8DCT,
::testing::Values( ::testing::Values(
make_tuple(&idct8x8_10_add_10_c, make_tuple(&idct8x8_10_add_10_c, &idct8x8_10_add_10_sse2, 6225,
&idct8x8_10_add_10_sse2, 6225, VPX_BITS_10), VPX_BITS_10),
make_tuple(&idct8x8_10, make_tuple(&idct8x8_10, &idct8x8_64_add_10_sse2, 6225, VPX_BITS_10),
&idct8x8_64_add_10_sse2, 6225, VPX_BITS_10), make_tuple(&idct8x8_10_add_12_c, &idct8x8_10_add_12_sse2, 6225,
make_tuple(&idct8x8_10_add_12_c, VPX_BITS_12),
&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_12,
&idct8x8_64_add_12_sse2, 6225, VPX_BITS_12)));
#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_SSSE3 && ARCH_X86_64 && \ #if HAVE_SSSE3 && ARCH_X86_64 && !CONFIG_VP9_HIGHBITDEPTH && \
!CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(SSSE3, FwdTrans8x8DCT,
SSSE3, FwdTrans8x8DCT, ::testing::Values(make_tuple(&vpx_fdct8x8_ssse3,
::testing::Values( &vpx_idct8x8_64_add_ssse3,
make_tuple(&vpx_fdct8x8_ssse3, &vpx_idct8x8_64_add_ssse3, 0, 0, VPX_BITS_8)));
VPX_BITS_8)));
#endif #endif
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(MSA, FwdTrans8x8DCT,
MSA, FwdTrans8x8DCT, ::testing::Values(make_tuple(&vpx_fdct8x8_msa,
::testing::Values( &vpx_idct8x8_64_add_msa, 0,
make_tuple(&vpx_fdct8x8_msa, &vpx_idct8x8_64_add_msa, 0, VPX_BITS_8))); VPX_BITS_8)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
MSA, FwdTrans8x8HT, MSA, FwdTrans8x8HT,
::testing::Values( ::testing::Values(

View File

@ -13,12 +13,11 @@
namespace { namespace {
class VP9FrameSizeTestsLarge class VP9FrameSizeTestsLarge : public ::libvpx_test::EncoderTest,
: public ::libvpx_test::EncoderTest,
public ::testing::Test { public ::testing::Test {
protected: protected:
VP9FrameSizeTestsLarge() : EncoderTest(&::libvpx_test::kVP9), VP9FrameSizeTestsLarge()
expected_res_(VPX_CODEC_OK) {} : EncoderTest(&::libvpx_test::kVP9), expected_res_(VPX_CODEC_OK) {}
virtual ~VP9FrameSizeTestsLarge() {} virtual ~VP9FrameSizeTestsLarge() {}
virtual void SetUp() { virtual void SetUp() {

View File

@ -21,14 +21,11 @@ namespace libvpx_test {
// so that we can do actual file encodes. // so that we can do actual file encodes.
class I420VideoSource : public YUVVideoSource { class I420VideoSource : public YUVVideoSource {
public: public:
I420VideoSource(const std::string &file_name, I420VideoSource(const std::string &file_name, unsigned int width,
unsigned int width, unsigned int height, unsigned int height, int rate_numerator, int rate_denominator,
int rate_numerator, int rate_denominator,
unsigned int start, int limit) unsigned int start, int limit)
: YUVVideoSource(file_name, VPX_IMG_FMT_I420, : YUVVideoSource(file_name, VPX_IMG_FMT_I420, width, height,
width, height, rate_numerator, rate_denominator, start, limit) {}
rate_numerator, rate_denominator,
start, limit) {}
}; };
} // namespace libvpx_test } // namespace libvpx_test

View File

@ -30,8 +30,7 @@ void reference_dct_1d(double input[8], double output[8]) {
output[k] = 0.0; output[k] = 0.0;
for (int n = 0; n < 8; n++) for (int n = 0; n < 8; n++)
output[k] += input[n] * cos(kPi * (2 * n + 1) * k / 16.0); output[k] += input[n] * cos(kPi * (2 * n + 1) * k / 16.0);
if (k == 0) if (k == 0) output[k] = output[k] * kInvSqrt2;
output[k] = output[k]*kInvSqrt2;
} }
} }
@ -39,24 +38,19 @@ void reference_dct_2d(int16_t input[64], double output[64]) {
// First transform columns // First transform columns
for (int i = 0; i < 8; ++i) { for (int i = 0; i < 8; ++i) {
double temp_in[8], temp_out[8]; double temp_in[8], temp_out[8];
for (int j = 0; j < 8; ++j) for (int j = 0; j < 8; ++j) temp_in[j] = input[j * 8 + i];
temp_in[j] = input[j*8 + i];
reference_dct_1d(temp_in, temp_out); reference_dct_1d(temp_in, temp_out);
for (int j = 0; j < 8; ++j) for (int j = 0; j < 8; ++j) output[j * 8 + i] = temp_out[j];
output[j*8 + i] = temp_out[j];
} }
// Then transform rows // Then transform rows
for (int i = 0; i < 8; ++i) { for (int i = 0; i < 8; ++i) {
double temp_in[8], temp_out[8]; double temp_in[8], temp_out[8];
for (int j = 0; j < 8; ++j) for (int j = 0; j < 8; ++j) temp_in[j] = output[j + i * 8];
temp_in[j] = output[j + i*8];
reference_dct_1d(temp_in, temp_out); reference_dct_1d(temp_in, temp_out);
for (int j = 0; j < 8; ++j) for (int j = 0; j < 8; ++j) output[j + i * 8] = temp_out[j];
output[j + i*8] = temp_out[j];
} }
// Scale by some magic number // Scale by some magic number
for (int i = 0; i < 64; ++i) for (int i = 0; i < 64; ++i) output[i] *= 2;
output[i] *= 2;
} }
TEST(VP9Idct8x8Test, AccuracyCheck) { TEST(VP9Idct8x8Test, AccuracyCheck) {
@ -73,8 +67,7 @@ TEST(VP9Idct8x8Test, AccuracyCheck) {
dst[j] = rnd.Rand8(); dst[j] = rnd.Rand8();
} }
// Initialize a test block with input range [-255, 255]. // Initialize a test block with input range [-255, 255].
for (int j = 0; j < 64; ++j) for (int j = 0; j < 64; ++j) input[j] = src[j] - dst[j];
input[j] = src[j] - dst[j];
reference_dct_2d(input, output_r); reference_dct_2d(input, output_r);
for (int j = 0; j < 64; ++j) for (int j = 0; j < 64; ++j)
@ -83,8 +76,7 @@ TEST(VP9Idct8x8Test, AccuracyCheck) {
for (int j = 0; j < 64; ++j) { for (int j = 0; j < 64; ++j) {
const int diff = dst[j] - src[j]; const int diff = dst[j] - src[j];
const int error = diff * diff; const int error = diff * diff;
EXPECT_GE(1, error) EXPECT_GE(1, error) << "Error: 8x8 FDCT/IDCT has error " << error
<< "Error: 8x8 FDCT/IDCT has error " << error
<< " at index " << j; << " at index " << j;
} }
} }

View File

@ -34,15 +34,13 @@ std::ostream &operator<<(std::ostream &os, const DecodeParam &dp) {
return os << "threads: " << dp.threads << " file: " << dp.filename; return os << "threads: " << dp.threads << " file: " << dp.filename;
} }
class InvalidFileTest class InvalidFileTest : public ::libvpx_test::DecoderTest,
: public ::libvpx_test::DecoderTest,
public ::libvpx_test::CodecTestWithParam<DecodeParam> { public ::libvpx_test::CodecTestWithParam<DecodeParam> {
protected: protected:
InvalidFileTest() : DecoderTest(GET_PARAM(0)), res_file_(NULL) {} InvalidFileTest() : DecoderTest(GET_PARAM(0)), res_file_(NULL) {}
virtual ~InvalidFileTest() { virtual ~InvalidFileTest() {
if (res_file_ != NULL) if (res_file_ != NULL) fclose(res_file_);
fclose(res_file_);
} }
void OpenResFile(const std::string &res_file_name_) { void OpenResFile(const std::string &res_file_name_) {
@ -72,8 +70,9 @@ class InvalidFileTest
EXPECT_TRUE(res_dec == expected_res_dec || EXPECT_TRUE(res_dec == expected_res_dec ||
res_dec == VPX_CODEC_CORRUPT_FRAME) res_dec == VPX_CODEC_CORRUPT_FRAME)
<< "Results don't match: frame number = " << video.frame_number() << "Results don't match: frame number = " << video.frame_number()
<< ". (" << decoder->DecodeError() << "). Expected: " << ". (" << decoder->DecodeError()
<< expected_res_dec << " or " << VPX_CODEC_CORRUPT_FRAME; << "). Expected: " << expected_res_dec << " or "
<< VPX_CODEC_CORRUPT_FRAME;
} else { } else {
EXPECT_EQ(expected_res_dec, res_dec) EXPECT_EQ(expected_res_dec, res_dec)
<< "Results don't match: frame number = " << video.frame_number() << "Results don't match: frame number = " << video.frame_number()
@ -119,9 +118,7 @@ class InvalidFileTest
FILE *res_file_; FILE *res_file_;
}; };
TEST_P(InvalidFileTest, ReturnCode) { TEST_P(InvalidFileTest, ReturnCode) { RunTest(); }
RunTest();
}
const DecodeParam kVP9InvalidFileTests[] = { const DecodeParam kVP9InvalidFileTests[] = {
{ 1, "invalid-vp90-02-v2.webm" }, { 1, "invalid-vp90-02-v2.webm" },
@ -153,9 +150,7 @@ class InvalidFileInvalidPeekTest : public InvalidFileTest {
const vpx_codec_err_t /*res_peek*/) {} const vpx_codec_err_t /*res_peek*/) {}
}; };
TEST_P(InvalidFileInvalidPeekTest, ReturnCode) { TEST_P(InvalidFileInvalidPeekTest, ReturnCode) { RunTest(); }
RunTest();
}
const DecodeParam kVP9InvalidFileInvalidPeekTests[] = { const DecodeParam kVP9InvalidFileInvalidPeekTests[] = {
{ 1, "invalid-vp90-01-v3.webm" }, { 1, "invalid-vp90-01-v3.webm" },
@ -166,9 +161,11 @@ VP9_INSTANTIATE_TEST_CASE(InvalidFileInvalidPeekTest,
const DecodeParam kMultiThreadedVP9InvalidFileTests[] = { const DecodeParam kMultiThreadedVP9InvalidFileTests[] = {
{ 4, "invalid-vp90-2-08-tile_1x4_frame_parallel_all_key.webm" }, { 4, "invalid-vp90-2-08-tile_1x4_frame_parallel_all_key.webm" },
{4, "invalid-" { 4,
"invalid-"
"vp90-2-08-tile_1x2_frame_parallel.webm.ivf.s47039_r01-05_b6-.ivf" }, "vp90-2-08-tile_1x2_frame_parallel.webm.ivf.s47039_r01-05_b6-.ivf" },
{4, "invalid-vp90-2-08-tile_1x8_frame_parallel.webm.ivf.s288_r01-05_b6-.ivf"}, { 4,
"invalid-vp90-2-08-tile_1x8_frame_parallel.webm.ivf.s288_r01-05_b6-.ivf" },
{ 2, "invalid-vp90-2-09-aq2.webm.ivf.s3984_r01-05_b6-.v2.ivf" }, { 2, "invalid-vp90-2-09-aq2.webm.ivf.s3984_r01-05_b6-.v2.ivf" },
{ 4, "invalid-vp90-2-09-subpixel-00.ivf.s19552_r01-05_b6-.v2.ivf" }, { 4, "invalid-vp90-2-09-subpixel-00.ivf.s19552_r01-05_b6-.v2.ivf" },
}; };

View File

@ -29,19 +29,13 @@ static unsigned int MemGetLe32(const uint8_t *mem) {
class IVFVideoSource : public CompressedVideoSource { class IVFVideoSource : public CompressedVideoSource {
public: public:
explicit IVFVideoSource(const std::string &file_name) explicit IVFVideoSource(const std::string &file_name)
: file_name_(file_name), : file_name_(file_name), input_file_(NULL), compressed_frame_buf_(NULL),
input_file_(NULL), frame_sz_(0), frame_(0), end_of_file_(false) {}
compressed_frame_buf_(NULL),
frame_sz_(0),
frame_(0),
end_of_file_(false) {
}
virtual ~IVFVideoSource() { virtual ~IVFVideoSource() {
delete[] compressed_frame_buf_; delete[] compressed_frame_buf_;
if (input_file_) if (input_file_) fclose(input_file_);
fclose(input_file_);
} }
virtual void Init() { virtual void Init() {
@ -61,8 +55,9 @@ class IVFVideoSource : public CompressedVideoSource {
ASSERT_EQ(kIvfFileHdrSize, fread(file_hdr, 1, kIvfFileHdrSize, input_file_)) ASSERT_EQ(kIvfFileHdrSize, fread(file_hdr, 1, kIvfFileHdrSize, input_file_))
<< "File header read failed."; << "File header read failed.";
// Check file header // Check file header
ASSERT_TRUE(file_hdr[0] == 'D' && file_hdr[1] == 'K' && file_hdr[2] == 'I' ASSERT_TRUE(file_hdr[0] == 'D' && file_hdr[1] == 'K' &&
&& file_hdr[3] == 'F') << "Input is not an IVF file."; file_hdr[2] == 'I' && file_hdr[3] == 'F')
<< "Input is not an IVF file.";
FillFrame(); FillFrame();
} }
@ -76,8 +71,8 @@ class IVFVideoSource : public CompressedVideoSource {
ASSERT_TRUE(input_file_ != NULL); ASSERT_TRUE(input_file_ != NULL);
uint8_t frame_hdr[kIvfFrameHdrSize]; uint8_t frame_hdr[kIvfFrameHdrSize];
// Check frame header and read a frame from input_file. // Check frame header and read a frame from input_file.
if (fread(frame_hdr, 1, kIvfFrameHdrSize, input_file_) if (fread(frame_hdr, 1, kIvfFrameHdrSize, input_file_) !=
!= kIvfFrameHdrSize) { kIvfFrameHdrSize) {
end_of_file_ = true; end_of_file_ = true;
} else { } else {
end_of_file_ = false; end_of_file_ = false;

View File

@ -17,7 +17,8 @@
namespace { namespace {
class KeyframeTest : public ::libvpx_test::EncoderTest, class KeyframeTest
: public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> { public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
protected: protected:
KeyframeTest() : EncoderTest(GET_PARAM(0)) {} KeyframeTest() : EncoderTest(GET_PARAM(0)) {}
@ -65,8 +66,7 @@ TEST_P(KeyframeTest, TestRandomVideoSource) {
// In realtime mode - auto placed keyframes are exceedingly rare, don't // In realtime mode - auto placed keyframes are exceedingly rare, don't
// bother with this check if(GetParam() > 0) // bother with this check if(GetParam() > 0)
if (GET_PARAM(1) > 0) if (GET_PARAM(1) > 0) EXPECT_GT(kf_count_, 1);
EXPECT_GT(kf_count_, 1);
} }
TEST_P(KeyframeTest, TestDisableKeyframes) { TEST_P(KeyframeTest, TestDisableKeyframes) {
@ -114,8 +114,7 @@ TEST_P(KeyframeTest, TestAutoKeyframe) {
// may not produce a keyframe like we expect. This is necessary when running // may not produce a keyframe like we expect. This is necessary when running
// on very slow environments (like Valgrind). The step -11 was determined // on very slow environments (like Valgrind). The step -11 was determined
// experimentally as the fastest mode that still throws the keyframe. // experimentally as the fastest mode that still throws the keyframe.
if (deadline_ == VPX_DL_REALTIME) if (deadline_ == VPX_DL_REALTIME) set_cpu_used_ = -11;
set_cpu_used_ = -11;
// This clip has a cut scene every 30 frames -> Frame 0, 30, 60, 90, 120. // This clip has a cut scene every 30 frames -> Frame 0, 30, 60, 90, 120.
// I check only the first 40 frames to make sure there's a keyframe at frame // I check only the first 40 frames to make sure there's a keyframe at frame

View File

@ -19,11 +19,8 @@ class LevelTest
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> { public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
protected: protected:
LevelTest() LevelTest()
: EncoderTest(GET_PARAM(0)), : EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)),
encoding_mode_(GET_PARAM(1)), cpu_used_(GET_PARAM(2)), min_gf_internal_(24), target_level_(0),
cpu_used_(GET_PARAM(2)),
min_gf_internal_(24),
target_level_(0),
level_(0) {} level_(0) {}
virtual ~LevelTest() {} virtual ~LevelTest() {}

View File

@ -36,8 +36,7 @@ const int number_of_iterations = 10000;
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
typedef void (*loop_op_t)(uint16_t *s, int p, const uint8_t *blimit, typedef void (*loop_op_t)(uint16_t *s, int p, const uint8_t *blimit,
const uint8_t *limit, const uint8_t *thresh, const uint8_t *limit, const uint8_t *thresh, int bd);
int bd);
typedef void (*dual_loop_op_t)(uint16_t *s, int p, const uint8_t *blimit0, typedef void (*dual_loop_op_t)(uint16_t *s, int p, const uint8_t *blimit0,
const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *limit0, const uint8_t *thresh0,
const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *blimit1, const uint8_t *limit1,
@ -108,20 +107,17 @@ TEST_P(Loop8Test6Param, OperationCheck) {
for (int i = 0; i < count_test_block; ++i) { for (int i = 0; i < count_test_block; ++i) {
int err_count = 0; int err_count = 0;
uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4)); uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4));
DECLARE_ALIGNED(16, const uint8_t, blimit[16]) = { DECLARE_ALIGNED(16, const uint8_t,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, blimit[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
};
tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER)); tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER));
DECLARE_ALIGNED(16, const uint8_t, limit[16]) = { DECLARE_ALIGNED(16, const uint8_t,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, limit[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
};
tmp = rnd.Rand8(); tmp = rnd.Rand8();
DECLARE_ALIGNED(16, const uint8_t, thresh[16]) = { DECLARE_ALIGNED(16, const uint8_t,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, thresh[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
};
int32_t p = kNumCoeffs / 32; int32_t p = kNumCoeffs / 32;
uint16_t tmp_s[kNumCoeffs]; uint16_t tmp_s[kNumCoeffs];
@ -206,20 +202,17 @@ TEST_P(Loop8Test6Param, ValueCheck) {
for (int i = 0; i < count_test_block; ++i) { for (int i = 0; i < count_test_block; ++i) {
int err_count = 0; int err_count = 0;
uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4)); uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4));
DECLARE_ALIGNED(16, const uint8_t, blimit[16]) = { DECLARE_ALIGNED(16, const uint8_t,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, blimit[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
};
tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER)); tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER));
DECLARE_ALIGNED(16, const uint8_t, limit[16]) = { DECLARE_ALIGNED(16, const uint8_t,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, limit[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
};
tmp = rnd.Rand8(); tmp = rnd.Rand8();
DECLARE_ALIGNED(16, const uint8_t, thresh[16]) = { DECLARE_ALIGNED(16, const uint8_t,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, thresh[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
};
int32_t p = kNumCoeffs / 32; int32_t p = kNumCoeffs / 32;
for (int j = 0; j < kNumCoeffs; ++j) { for (int j = 0; j < kNumCoeffs; ++j) {
s[j] = rnd.Rand16() & mask_; s[j] = rnd.Rand16() & mask_;
@ -264,35 +257,29 @@ TEST_P(Loop8Test9Param, OperationCheck) {
for (int i = 0; i < count_test_block; ++i) { for (int i = 0; i < count_test_block; ++i) {
int err_count = 0; int err_count = 0;
uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4)); uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4));
DECLARE_ALIGNED(16, const uint8_t, blimit0[16]) = { DECLARE_ALIGNED(16, const uint8_t,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, blimit0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
};
tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER)); tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER));
DECLARE_ALIGNED(16, const uint8_t, limit0[16]) = { DECLARE_ALIGNED(16, const uint8_t,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, limit0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
};
tmp = rnd.Rand8(); tmp = rnd.Rand8();
DECLARE_ALIGNED(16, const uint8_t, thresh0[16]) = { DECLARE_ALIGNED(16, const uint8_t,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, thresh0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
};
tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4)); tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4));
DECLARE_ALIGNED(16, const uint8_t, blimit1[16]) = { DECLARE_ALIGNED(16, const uint8_t,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, blimit1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
};
tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER)); tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER));
DECLARE_ALIGNED(16, const uint8_t, limit1[16]) = { DECLARE_ALIGNED(16, const uint8_t,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, limit1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
};
tmp = rnd.Rand8(); tmp = rnd.Rand8();
DECLARE_ALIGNED(16, const uint8_t, thresh1[16]) = { DECLARE_ALIGNED(16, const uint8_t,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, thresh1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
};
int32_t p = kNumCoeffs / 32; int32_t p = kNumCoeffs / 32;
uint16_t tmp_s[kNumCoeffs]; uint16_t tmp_s[kNumCoeffs];
int j = 0; int j = 0;
@ -325,17 +312,16 @@ TEST_P(Loop8Test9Param, OperationCheck) {
ref_s[j] = s[j]; ref_s[j] = s[j];
} }
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, blimit1,
blimit1, limit1, thresh1, bd); limit1, thresh1, bd);
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0,
loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0, thresh0, thresh0, blimit1, limit1, thresh1,
blimit1, limit1, thresh1, bd)); bd));
#else #else
ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, blimit1,
blimit1, limit1, thresh1); limit1, thresh1);
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0,
loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0, thresh0, thresh0, blimit1, limit1, thresh1));
blimit1, limit1, thresh1));
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
for (int j = 0; j < kNumCoeffs; ++j) { for (int j = 0; j < kNumCoeffs; ++j) {
err_count += ref_s[j] != s[j]; err_count += ref_s[j] != s[j];
@ -366,35 +352,29 @@ TEST_P(Loop8Test9Param, ValueCheck) {
for (int i = 0; i < count_test_block; ++i) { for (int i = 0; i < count_test_block; ++i) {
int err_count = 0; int err_count = 0;
uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4)); uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4));
DECLARE_ALIGNED(16, const uint8_t, blimit0[16]) = { DECLARE_ALIGNED(16, const uint8_t,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, blimit0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
};
tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER)); tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER));
DECLARE_ALIGNED(16, const uint8_t, limit0[16]) = { DECLARE_ALIGNED(16, const uint8_t,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, limit0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
};
tmp = rnd.Rand8(); tmp = rnd.Rand8();
DECLARE_ALIGNED(16, const uint8_t, thresh0[16]) = { DECLARE_ALIGNED(16, const uint8_t,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, thresh0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
};
tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4)); tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4));
DECLARE_ALIGNED(16, const uint8_t, blimit1[16]) = { DECLARE_ALIGNED(16, const uint8_t,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, blimit1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
};
tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER)); tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER));
DECLARE_ALIGNED(16, const uint8_t, limit1[16]) = { DECLARE_ALIGNED(16, const uint8_t,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, limit1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
};
tmp = rnd.Rand8(); tmp = rnd.Rand8();
DECLARE_ALIGNED(16, const uint8_t, thresh1[16]) = { DECLARE_ALIGNED(16, const uint8_t,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, thresh1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
};
int32_t p = kNumCoeffs / 32; // TODO(pdlf) can we have non-square here? int32_t p = kNumCoeffs / 32; // TODO(pdlf) can we have non-square here?
for (int j = 0; j < kNumCoeffs; ++j) { for (int j = 0; j < kNumCoeffs; ++j) {
s[j] = rnd.Rand16() & mask_; s[j] = rnd.Rand16() & mask_;
@ -402,17 +382,16 @@ TEST_P(Loop8Test9Param, ValueCheck) {
} }
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
const int32_t bd = bit_depth_; const int32_t bd = bit_depth_;
ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, blimit1,
blimit1, limit1, thresh1, bd); limit1, thresh1, bd);
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0,
loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0, thresh0, blimit1, limit1, thresh1,
thresh0, blimit1, limit1, thresh1, bd)); bd));
#else #else
ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, blimit1,
blimit1, limit1, thresh1); limit1, thresh1);
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0,
loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0, thresh0, thresh0, blimit1, limit1, thresh1));
blimit1, limit1, thresh1));
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
for (int j = 0; j < kNumCoeffs; ++j) { for (int j = 0; j < kNumCoeffs; ++j) {
err_count += ref_s[j] != s[j]; err_count += ref_s[j] != s[j];
@ -434,8 +413,7 @@ using std::tr1::make_tuple;
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, Loop8Test6Param, SSE2, Loop8Test6Param,
::testing::Values( ::testing::Values(make_tuple(&vpx_highbd_lpf_horizontal_4_sse2,
make_tuple(&vpx_highbd_lpf_horizontal_4_sse2,
&vpx_highbd_lpf_horizontal_4_c, 8), &vpx_highbd_lpf_horizontal_4_c, 8),
make_tuple(&vpx_highbd_lpf_vertical_4_sse2, make_tuple(&vpx_highbd_lpf_vertical_4_sse2,
&vpx_highbd_lpf_vertical_4_c, 8), &vpx_highbd_lpf_vertical_4_c, 8),
@ -487,30 +465,24 @@ INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, Loop8Test6Param, SSE2, Loop8Test6Param,
::testing::Values( ::testing::Values(
make_tuple(&vpx_lpf_horizontal_4_sse2, make_tuple(&vpx_lpf_horizontal_4_sse2, &vpx_lpf_horizontal_4_c, 8),
&vpx_lpf_horizontal_4_c, 8), make_tuple(&vpx_lpf_horizontal_8_sse2, &vpx_lpf_horizontal_8_c, 8),
make_tuple(&vpx_lpf_horizontal_8_sse2,
&vpx_lpf_horizontal_8_c, 8),
make_tuple(&vpx_lpf_horizontal_edge_8_sse2, make_tuple(&vpx_lpf_horizontal_edge_8_sse2,
&vpx_lpf_horizontal_edge_8_c, 8), &vpx_lpf_horizontal_edge_8_c, 8),
make_tuple(&vpx_lpf_horizontal_edge_16_sse2, make_tuple(&vpx_lpf_horizontal_edge_16_sse2,
&vpx_lpf_horizontal_edge_16_c, 8), &vpx_lpf_horizontal_edge_16_c, 8),
make_tuple(&vpx_lpf_vertical_4_sse2, make_tuple(&vpx_lpf_vertical_4_sse2, &vpx_lpf_vertical_4_c, 8),
&vpx_lpf_vertical_4_c, 8), make_tuple(&vpx_lpf_vertical_8_sse2, &vpx_lpf_vertical_8_c, 8),
make_tuple(&vpx_lpf_vertical_8_sse2, make_tuple(&vpx_lpf_vertical_16_sse2, &vpx_lpf_vertical_16_c, 8),
&vpx_lpf_vertical_8_c, 8), make_tuple(&vpx_lpf_vertical_16_dual_sse2, &vpx_lpf_vertical_16_dual_c,
make_tuple(&vpx_lpf_vertical_16_sse2, 8)));
&vpx_lpf_vertical_16_c, 8),
make_tuple(&vpx_lpf_vertical_16_dual_sse2,
&vpx_lpf_vertical_16_dual_c, 8)));
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
#endif #endif
#if HAVE_AVX2 && (!CONFIG_VP9_HIGHBITDEPTH) #if HAVE_AVX2 && (!CONFIG_VP9_HIGHBITDEPTH)
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
AVX2, Loop8Test6Param, AVX2, Loop8Test6Param,
::testing::Values( ::testing::Values(make_tuple(&vpx_lpf_horizontal_edge_8_avx2,
make_tuple(&vpx_lpf_horizontal_edge_8_avx2,
&vpx_lpf_horizontal_edge_8_c, 8), &vpx_lpf_horizontal_edge_8_c, 8),
make_tuple(&vpx_lpf_horizontal_edge_16_avx2, make_tuple(&vpx_lpf_horizontal_edge_16_avx2,
&vpx_lpf_horizontal_edge_16_c, 8))); &vpx_lpf_horizontal_edge_16_c, 8)));
@ -520,8 +492,7 @@ INSTANTIATE_TEST_CASE_P(
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, Loop8Test9Param, SSE2, Loop8Test9Param,
::testing::Values( ::testing::Values(make_tuple(&vpx_highbd_lpf_horizontal_4_dual_sse2,
make_tuple(&vpx_highbd_lpf_horizontal_4_dual_sse2,
&vpx_highbd_lpf_horizontal_4_dual_c, 8), &vpx_highbd_lpf_horizontal_4_dual_c, 8),
make_tuple(&vpx_highbd_lpf_horizontal_8_dual_sse2, make_tuple(&vpx_highbd_lpf_horizontal_8_dual_sse2,
&vpx_highbd_lpf_horizontal_8_dual_c, 8), &vpx_highbd_lpf_horizontal_8_dual_c, 8),
@ -548,8 +519,7 @@ INSTANTIATE_TEST_CASE_P(
#else #else
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, Loop8Test9Param, SSE2, Loop8Test9Param,
::testing::Values( ::testing::Values(make_tuple(&vpx_lpf_horizontal_4_dual_sse2,
make_tuple(&vpx_lpf_horizontal_4_dual_sse2,
&vpx_lpf_horizontal_4_dual_c, 8), &vpx_lpf_horizontal_4_dual_c, 8),
make_tuple(&vpx_lpf_horizontal_8_dual_sse2, make_tuple(&vpx_lpf_horizontal_8_dual_sse2,
&vpx_lpf_horizontal_8_dual_c, 8), &vpx_lpf_horizontal_8_dual_c, 8),
@ -567,28 +537,22 @@ INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
NEON, Loop8Test6Param, NEON, Loop8Test6Param,
::testing::Values( ::testing::Values(
#if HAVE_NEON_ASM
// Using #if inside the macro is unsupported on MSVS but the tests are not // Using #if inside the macro is unsupported on MSVS but the tests are not
// currently built for MSVS with ARM and NEON. // currently built for MSVS with ARM and NEON.
#if HAVE_NEON_ASM
make_tuple(&vpx_lpf_horizontal_edge_8_neon, make_tuple(&vpx_lpf_horizontal_edge_8_neon,
&vpx_lpf_horizontal_edge_8_c, 8), &vpx_lpf_horizontal_edge_8_c, 8),
make_tuple(&vpx_lpf_horizontal_edge_16_neon, make_tuple(&vpx_lpf_horizontal_edge_16_neon,
&vpx_lpf_horizontal_edge_16_c, 8), &vpx_lpf_horizontal_edge_16_c, 8),
make_tuple(&vpx_lpf_vertical_16_neon, make_tuple(&vpx_lpf_vertical_16_neon, &vpx_lpf_vertical_16_c, 8),
&vpx_lpf_vertical_16_c, 8), make_tuple(&vpx_lpf_vertical_16_dual_neon, &vpx_lpf_vertical_16_dual_c,
make_tuple(&vpx_lpf_vertical_16_dual_neon, 8),
&vpx_lpf_vertical_16_dual_c, 8),
#endif // HAVE_NEON_ASM #endif // HAVE_NEON_ASM
make_tuple(&vpx_lpf_horizontal_8_neon, make_tuple(&vpx_lpf_horizontal_8_neon, &vpx_lpf_horizontal_8_c, 8),
&vpx_lpf_horizontal_8_c, 8), make_tuple(&vpx_lpf_vertical_8_neon, &vpx_lpf_vertical_8_c, 8),
make_tuple(&vpx_lpf_vertical_8_neon, make_tuple(&vpx_lpf_horizontal_4_neon, &vpx_lpf_horizontal_4_c, 8),
&vpx_lpf_vertical_8_c, 8), make_tuple(&vpx_lpf_vertical_4_neon, &vpx_lpf_vertical_4_c, 8)));
make_tuple(&vpx_lpf_horizontal_4_neon, INSTANTIATE_TEST_CASE_P(NEON, Loop8Test9Param,
&vpx_lpf_horizontal_4_c, 8),
make_tuple(&vpx_lpf_vertical_4_neon,
&vpx_lpf_vertical_4_c, 8)));
INSTANTIATE_TEST_CASE_P(
NEON, Loop8Test9Param,
::testing::Values( ::testing::Values(
#if HAVE_NEON_ASM #if HAVE_NEON_ASM
make_tuple(&vpx_lpf_horizontal_8_dual_neon, make_tuple(&vpx_lpf_horizontal_8_dual_neon,
@ -607,27 +571,19 @@ INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
DSPR2, Loop8Test6Param, DSPR2, Loop8Test6Param,
::testing::Values( ::testing::Values(
make_tuple(&vpx_lpf_horizontal_4_dspr2, make_tuple(&vpx_lpf_horizontal_4_dspr2, &vpx_lpf_horizontal_4_c, 8),
&vpx_lpf_horizontal_4_c, 8), make_tuple(&vpx_lpf_horizontal_8_dspr2, &vpx_lpf_horizontal_8_c, 8),
make_tuple(&vpx_lpf_horizontal_8_dspr2, make_tuple(&vpx_lpf_horizontal_edge_8, &vpx_lpf_horizontal_edge_8, 8),
&vpx_lpf_horizontal_8_c, 8), make_tuple(&vpx_lpf_horizontal_edge_16, &vpx_lpf_horizontal_edge_16, 8),
make_tuple(&vpx_lpf_horizontal_edge_8, make_tuple(&vpx_lpf_vertical_4_dspr2, &vpx_lpf_vertical_4_c, 8),
&vpx_lpf_horizontal_edge_8, 8), make_tuple(&vpx_lpf_vertical_8_dspr2, &vpx_lpf_vertical_8_c, 8),
make_tuple(&vpx_lpf_horizontal_edge_16, make_tuple(&vpx_lpf_vertical_16_dspr2, &vpx_lpf_vertical_16_c, 8),
&vpx_lpf_horizontal_edge_16, 8), make_tuple(&vpx_lpf_vertical_16_dual_dspr2, &vpx_lpf_vertical_16_dual_c,
make_tuple(&vpx_lpf_vertical_4_dspr2, 8)));
&vpx_lpf_vertical_4_c, 8),
make_tuple(&vpx_lpf_vertical_8_dspr2,
&vpx_lpf_vertical_8_c, 8),
make_tuple(&vpx_lpf_vertical_16_dspr2,
&vpx_lpf_vertical_16_c, 8),
make_tuple(&vpx_lpf_vertical_16_dual_dspr2,
&vpx_lpf_vertical_16_dual_c, 8)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
DSPR2, Loop8Test9Param, DSPR2, Loop8Test9Param,
::testing::Values( ::testing::Values(make_tuple(&vpx_lpf_horizontal_4_dual_dspr2,
make_tuple(&vpx_lpf_horizontal_4_dual_dspr2,
&vpx_lpf_horizontal_4_dual_c, 8), &vpx_lpf_horizontal_4_dual_c, 8),
make_tuple(&vpx_lpf_horizontal_8_dual_dspr2, make_tuple(&vpx_lpf_horizontal_8_dual_dspr2,
&vpx_lpf_horizontal_8_dual_c, 8), &vpx_lpf_horizontal_8_dual_c, 8),
@ -641,25 +597,19 @@ INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
MSA, Loop8Test6Param, MSA, Loop8Test6Param,
::testing::Values( ::testing::Values(
make_tuple(&vpx_lpf_horizontal_4_msa, make_tuple(&vpx_lpf_horizontal_4_msa, &vpx_lpf_horizontal_4_c, 8),
&vpx_lpf_horizontal_4_c, 8), make_tuple(&vpx_lpf_horizontal_8_msa, &vpx_lpf_horizontal_8_c, 8),
make_tuple(&vpx_lpf_horizontal_8_msa, make_tuple(&vpx_lpf_horizontal_edge_8_msa, &vpx_lpf_horizontal_edge_8_c,
&vpx_lpf_horizontal_8_c, 8), 8),
make_tuple(&vpx_lpf_horizontal_edge_8_msa,
&vpx_lpf_horizontal_edge_8_c, 8),
make_tuple(&vpx_lpf_horizontal_edge_16_msa, make_tuple(&vpx_lpf_horizontal_edge_16_msa,
&vpx_lpf_horizontal_edge_16_c, 8), &vpx_lpf_horizontal_edge_16_c, 8),
make_tuple(&vpx_lpf_vertical_4_msa, make_tuple(&vpx_lpf_vertical_4_msa, &vpx_lpf_vertical_4_c, 8),
&vpx_lpf_vertical_4_c, 8), make_tuple(&vpx_lpf_vertical_8_msa, &vpx_lpf_vertical_8_c, 8),
make_tuple(&vpx_lpf_vertical_8_msa, make_tuple(&vpx_lpf_vertical_16_msa, &vpx_lpf_vertical_16_c, 8)));
&vpx_lpf_vertical_8_c, 8),
make_tuple(&vpx_lpf_vertical_16_msa,
&vpx_lpf_vertical_16_c, 8)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
MSA, Loop8Test9Param, MSA, Loop8Test9Param,
::testing::Values( ::testing::Values(make_tuple(&vpx_lpf_horizontal_4_dual_msa,
make_tuple(&vpx_lpf_horizontal_4_dual_msa,
&vpx_lpf_horizontal_4_dual_c, 8), &vpx_lpf_horizontal_4_dual_c, 8),
make_tuple(&vpx_lpf_horizontal_8_dual_msa, make_tuple(&vpx_lpf_horizontal_8_dual_msa,
&vpx_lpf_horizontal_8_dual_c, 8), &vpx_lpf_horizontal_8_dual_c, 8),

View File

@ -17,9 +17,7 @@
namespace libvpx_test { namespace libvpx_test {
class MD5 { class MD5 {
public: public:
MD5() { MD5() { MD5Init(&md5_); }
MD5Init(&md5_);
}
void Add(const vpx_image_t *img) { void Add(const vpx_image_t *img) {
for (int plane = 0; plane < 3; ++plane) { for (int plane = 0; plane < 3; ++plane) {
@ -30,10 +28,13 @@ class MD5 {
// This works only for chroma_shift of 0 and 1. // This works only for chroma_shift of 0 and 1.
const int bytes_per_sample = const int bytes_per_sample =
(img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? 2 : 1; (img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? 2 : 1;
const int h = plane ? (img->d_h + img->y_chroma_shift) >> const int h =
img->y_chroma_shift : img->d_h; plane ? (img->d_h + img->y_chroma_shift) >> img->y_chroma_shift
const int w = (plane ? (img->d_w + img->x_chroma_shift) >> : img->d_h;
img->x_chroma_shift : img->d_w) * bytes_per_sample; const int w =
(plane ? (img->d_w + img->x_chroma_shift) >> img->x_chroma_shift
: img->d_w) *
bytes_per_sample;
for (int y = 0; y < h; ++y) { for (int y = 0; y < h; ++y) {
MD5Update(&md5_, buf, w); MD5Update(&md5_, buf, w);

View File

@ -23,9 +23,8 @@ namespace {
using ::libvpx_test::ACMRandom; using ::libvpx_test::ACMRandom;
typedef void (*MinMaxFunc)(const uint8_t *a, int a_stride, typedef void (*MinMaxFunc)(const uint8_t *a, int a_stride, const uint8_t *b,
const uint8_t *b, int b_stride, int b_stride, int *min, int *max);
int *min, int *max);
class MinMaxTest : public ::testing::TestWithParam<MinMaxFunc> { class MinMaxTest : public ::testing::TestWithParam<MinMaxFunc> {
public: public:
@ -39,9 +38,8 @@ class MinMaxTest : public ::testing::TestWithParam<MinMaxFunc> {
ACMRandom rnd_; ACMRandom rnd_;
}; };
void reference_minmax(const uint8_t *a, int a_stride, void reference_minmax(const uint8_t *a, int a_stride, const uint8_t *b,
const uint8_t *b, int b_stride, int b_stride, int *min_ret, int *max_ret) {
int *min_ret, int *max_ret) {
int min = 255; int min = 255;
int max = 0; int max = 0;
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
@ -110,9 +108,9 @@ TEST_P(MinMaxTest, CompareReferenceAndVaryStride) {
reference_minmax(a, a_stride, b, b_stride, &min_ref, &max_ref); reference_minmax(a, a_stride, b, b_stride, &min_ref, &max_ref);
ASM_REGISTER_STATE_CHECK(mm_func_(a, a_stride, b, b_stride, &min, &max)); ASM_REGISTER_STATE_CHECK(mm_func_(a, a_stride, b, b_stride, &min, &max));
EXPECT_EQ(max_ref, max) << "when a_stride = " << a_stride EXPECT_EQ(max_ref, max) << "when a_stride = " << a_stride
<< " and b_stride = " << b_stride;; << " and b_stride = " << b_stride;
EXPECT_EQ(min_ref, min) << "when a_stride = " << a_stride EXPECT_EQ(min_ref, min) << "when a_stride = " << a_stride
<< " and b_stride = " << b_stride;; << " and b_stride = " << b_stride;
} }
} }
} }

View File

@ -29,10 +29,8 @@ using libvpx_test::ACMRandom;
namespace { namespace {
typedef void (*FwdTxfmFunc)(const int16_t *in, tran_low_t *out, int stride); typedef void (*FwdTxfmFunc)(const int16_t *in, tran_low_t *out, int stride);
typedef void (*InvTxfmFunc)(const tran_low_t *in, uint8_t *out, int stride); typedef void (*InvTxfmFunc)(const tran_low_t *in, uint8_t *out, int stride);
typedef std::tr1::tuple<FwdTxfmFunc, typedef std::tr1::tuple<FwdTxfmFunc, InvTxfmFunc, InvTxfmFunc, TX_SIZE, int>
InvTxfmFunc, PartialInvTxfmParam;
InvTxfmFunc,
TX_SIZE, int> PartialInvTxfmParam;
const int kMaxNumCoeffs = 1024; const int kMaxNumCoeffs = 1024;
class PartialIDctTest : public ::testing::TestWithParam<PartialInvTxfmParam> { class PartialIDctTest : public ::testing::TestWithParam<PartialInvTxfmParam> {
public: public:
@ -59,21 +57,11 @@ TEST_P(PartialIDctTest, RunQuantCheck) {
ACMRandom rnd(ACMRandom::DeterministicSeed()); ACMRandom rnd(ACMRandom::DeterministicSeed());
int size; int size;
switch (tx_size_) { switch (tx_size_) {
case TX_4X4: case TX_4X4: size = 4; break;
size = 4; case TX_8X8: size = 8; break;
break; case TX_16X16: size = 16; break;
case TX_8X8: case TX_32X32: size = 32; break;
size = 8; default: FAIL() << "Wrong Size!"; break;
break;
case TX_16X16:
size = 16;
break;
case TX_32X32:
size = 32;
break;
default:
FAIL() << "Wrong Size!";
break;
} }
DECLARE_ALIGNED(16, tran_low_t, test_coef_block1[kMaxNumCoeffs]); DECLARE_ALIGNED(16, tran_low_t, test_coef_block1[kMaxNumCoeffs]);
DECLARE_ALIGNED(16, tran_low_t, test_coef_block2[kMaxNumCoeffs]); DECLARE_ALIGNED(16, tran_low_t, test_coef_block2[kMaxNumCoeffs]);
@ -99,11 +87,9 @@ TEST_P(PartialIDctTest, RunQuantCheck) {
for (int i = 0; i < count_test_block; ++i) { for (int i = 0; i < count_test_block; ++i) {
// Initialize a test block with input range [-255, 255]. // Initialize a test block with input range [-255, 255].
if (i == 0) { if (i == 0) {
for (int j = 0; j < block_size; ++j) for (int j = 0; j < block_size; ++j) input_extreme_block[j] = 255;
input_extreme_block[j] = 255;
} else if (i == 1) { } else if (i == 1) {
for (int j = 0; j < block_size; ++j) for (int j = 0; j < block_size; ++j) input_extreme_block[j] = -255;
input_extreme_block[j] = -255;
} else { } else {
for (int j = 0; j < block_size; ++j) { for (int j = 0; j < block_size; ++j) {
input_extreme_block[j] = rnd.Rand8() % 2 ? 255 : -255; input_extreme_block[j] = rnd.Rand8() % 2 ? 255 : -255;
@ -115,8 +101,8 @@ TEST_P(PartialIDctTest, RunQuantCheck) {
// quantization with maximum allowed step sizes // quantization with maximum allowed step sizes
test_coef_block1[0] = (output_ref_block[0] / 1336) * 1336; test_coef_block1[0] = (output_ref_block[0] / 1336) * 1336;
for (int j = 1; j < last_nonzero_; ++j) for (int j = 1; j < last_nonzero_; ++j)
test_coef_block1[vp9_default_scan_orders[tx_size_].scan[j]] test_coef_block1[vp9_default_scan_orders[tx_size_].scan[j]] =
= (output_ref_block[j] / 1828) * 1828; (output_ref_block[j] / 1828) * 1828;
} }
ASM_REGISTER_STATE_CHECK(full_itxfm_(test_coef_block1, dst1, size)); ASM_REGISTER_STATE_CHECK(full_itxfm_(test_coef_block1, dst1, size));
@ -125,8 +111,7 @@ TEST_P(PartialIDctTest, RunQuantCheck) {
for (int j = 0; j < block_size; ++j) { for (int j = 0; j < block_size; ++j) {
const int diff = dst1[j] - dst2[j]; const int diff = dst1[j] - dst2[j];
const int error = diff * diff; const int error = diff * diff;
if (max_error < error) if (max_error < error) max_error = error;
max_error = error;
} }
} }
@ -138,21 +123,11 @@ TEST_P(PartialIDctTest, ResultsMatch) {
ACMRandom rnd(ACMRandom::DeterministicSeed()); ACMRandom rnd(ACMRandom::DeterministicSeed());
int size; int size;
switch (tx_size_) { switch (tx_size_) {
case TX_4X4: case TX_4X4: size = 4; break;
size = 4; case TX_8X8: size = 8; break;
break; case TX_16X16: size = 16; break;
case TX_8X8: case TX_32X32: size = 32; break;
size = 8; default: FAIL() << "Wrong Size!"; break;
break;
case TX_16X16:
size = 16;
break;
case TX_32X32:
size = 32;
break;
default:
FAIL() << "Wrong Size!";
break;
} }
DECLARE_ALIGNED(16, tran_low_t, test_coef_block1[kMaxNumCoeffs]); DECLARE_ALIGNED(16, tran_low_t, test_coef_block1[kMaxNumCoeffs]);
DECLARE_ALIGNED(16, tran_low_t, test_coef_block2[kMaxNumCoeffs]); DECLARE_ALIGNED(16, tran_low_t, test_coef_block2[kMaxNumCoeffs]);
@ -189,8 +164,7 @@ TEST_P(PartialIDctTest, ResultsMatch) {
for (int j = 0; j < block_size; ++j) { for (int j = 0; j < block_size; ++j) {
const int diff = dst1[j] - dst2[j]; const int diff = dst1[j] - dst2[j];
const int error = diff * diff; const int error = diff * diff;
if (max_error < error) if (max_error < error) max_error = error;
max_error = error;
} }
} }
@ -201,143 +175,82 @@ using std::tr1::make_tuple;
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
C, PartialIDctTest, C, PartialIDctTest,
::testing::Values( ::testing::Values(make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c,
make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_34_add_c, TX_32X32, 34),
&vpx_idct32x32_1024_add_c, make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c,
&vpx_idct32x32_34_add_c, &vpx_idct32x32_1_add_c, TX_32X32, 1),
TX_32X32, 34), make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c,
make_tuple(&vpx_fdct32x32_c, &vpx_idct16x16_10_add_c, TX_16X16, 10),
&vpx_idct32x32_1024_add_c, make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c,
&vpx_idct32x32_1_add_c, &vpx_idct16x16_1_add_c, TX_16X16, 1),
TX_32X32, 1), make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c,
make_tuple(&vpx_fdct16x16_c, &vpx_idct8x8_12_add_c, TX_8X8, 12),
&vpx_idct16x16_256_add_c, make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c,
&vpx_idct16x16_10_add_c, &vpx_idct8x8_1_add_c, TX_8X8, 1),
TX_16X16, 10), make_tuple(&vpx_fdct4x4_c, &vpx_idct4x4_16_add_c,
make_tuple(&vpx_fdct16x16_c, &vpx_idct4x4_1_add_c, TX_4X4, 1)));
&vpx_idct16x16_256_add_c,
&vpx_idct16x16_1_add_c,
TX_16X16, 1),
make_tuple(&vpx_fdct8x8_c,
&vpx_idct8x8_64_add_c,
&vpx_idct8x8_12_add_c,
TX_8X8, 12),
make_tuple(&vpx_fdct8x8_c,
&vpx_idct8x8_64_add_c,
&vpx_idct8x8_1_add_c,
TX_8X8, 1),
make_tuple(&vpx_fdct4x4_c,
&vpx_idct4x4_16_add_c,
&vpx_idct4x4_1_add_c,
TX_4X4, 1)));
#if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
NEON, PartialIDctTest, NEON, PartialIDctTest,
::testing::Values( ::testing::Values(make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c,
make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1_add_neon, TX_32X32, 1),
&vpx_idct32x32_1024_add_c, make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c,
&vpx_idct32x32_1_add_neon, &vpx_idct16x16_10_add_neon, TX_16X16, 10),
TX_32X32, 1), make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c,
make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_1_add_neon, TX_16X16, 1),
&vpx_idct16x16_256_add_c, make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c,
&vpx_idct16x16_10_add_neon, &vpx_idct8x8_12_add_neon, TX_8X8, 12),
TX_16X16, 10), make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c,
make_tuple(&vpx_fdct16x16_c, &vpx_idct8x8_1_add_neon, TX_8X8, 1),
&vpx_idct16x16_256_add_c, make_tuple(&vpx_fdct4x4_c, &vpx_idct4x4_16_add_c,
&vpx_idct16x16_1_add_neon, &vpx_idct4x4_1_add_neon, TX_4X4, 1)));
TX_16X16, 1),
make_tuple(&vpx_fdct8x8_c,
&vpx_idct8x8_64_add_c,
&vpx_idct8x8_12_add_neon,
TX_8X8, 12),
make_tuple(&vpx_fdct8x8_c,
&vpx_idct8x8_64_add_c,
&vpx_idct8x8_1_add_neon,
TX_8X8, 1),
make_tuple(&vpx_fdct4x4_c,
&vpx_idct4x4_16_add_c,
&vpx_idct4x4_1_add_neon,
TX_4X4, 1)));
#endif // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #endif // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, PartialIDctTest, SSE2, PartialIDctTest,
::testing::Values( ::testing::Values(make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c,
make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_34_add_sse2, TX_32X32, 34),
&vpx_idct32x32_1024_add_c, make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c,
&vpx_idct32x32_34_add_sse2, &vpx_idct32x32_1_add_sse2, TX_32X32, 1),
TX_32X32, 34), make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c,
make_tuple(&vpx_fdct32x32_c, &vpx_idct16x16_10_add_sse2, TX_16X16, 10),
&vpx_idct32x32_1024_add_c, make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c,
&vpx_idct32x32_1_add_sse2, &vpx_idct16x16_1_add_sse2, TX_16X16, 1),
TX_32X32, 1), make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c,
make_tuple(&vpx_fdct16x16_c, &vpx_idct8x8_12_add_sse2, TX_8X8, 12),
&vpx_idct16x16_256_add_c, make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c,
&vpx_idct16x16_10_add_sse2, &vpx_idct8x8_1_add_sse2, TX_8X8, 1),
TX_16X16, 10), make_tuple(&vpx_fdct4x4_c, &vpx_idct4x4_16_add_c,
make_tuple(&vpx_fdct16x16_c, &vpx_idct4x4_1_add_sse2, TX_4X4, 1)));
&vpx_idct16x16_256_add_c,
&vpx_idct16x16_1_add_sse2,
TX_16X16, 1),
make_tuple(&vpx_fdct8x8_c,
&vpx_idct8x8_64_add_c,
&vpx_idct8x8_12_add_sse2,
TX_8X8, 12),
make_tuple(&vpx_fdct8x8_c,
&vpx_idct8x8_64_add_c,
&vpx_idct8x8_1_add_sse2,
TX_8X8, 1),
make_tuple(&vpx_fdct4x4_c,
&vpx_idct4x4_16_add_c,
&vpx_idct4x4_1_add_sse2,
TX_4X4, 1)));
#endif #endif
#if HAVE_SSSE3 && ARCH_X86_64 && \ #if HAVE_SSSE3 && ARCH_X86_64 && !CONFIG_VP9_HIGHBITDEPTH && \
!CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSSE3_64, PartialIDctTest, SSSE3_64, PartialIDctTest,
::testing::Values( ::testing::Values(make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c,
make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_12_add_ssse3, TX_8X8, 12)));
&vpx_idct8x8_64_add_c,
&vpx_idct8x8_12_add_ssse3,
TX_8X8, 12)));
#endif #endif
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
MSA, PartialIDctTest, MSA, PartialIDctTest,
::testing::Values( ::testing::Values(make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c,
make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_34_add_msa, TX_32X32, 34),
&vpx_idct32x32_1024_add_c, make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c,
&vpx_idct32x32_34_add_msa, &vpx_idct32x32_1_add_msa, TX_32X32, 1),
TX_32X32, 34), make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c,
make_tuple(&vpx_fdct32x32_c, &vpx_idct16x16_10_add_msa, TX_16X16, 10),
&vpx_idct32x32_1024_add_c, make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c,
&vpx_idct32x32_1_add_msa, &vpx_idct16x16_1_add_msa, TX_16X16, 1),
TX_32X32, 1), make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c,
make_tuple(&vpx_fdct16x16_c, &vpx_idct8x8_12_add_msa, TX_8X8, 10),
&vpx_idct16x16_256_add_c, make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c,
&vpx_idct16x16_10_add_msa, &vpx_idct8x8_1_add_msa, TX_8X8, 1),
TX_16X16, 10), make_tuple(&vpx_fdct4x4_c, &vpx_idct4x4_16_add_c,
make_tuple(&vpx_fdct16x16_c, &vpx_idct4x4_1_add_msa, TX_4X4, 1)));
&vpx_idct16x16_256_add_c,
&vpx_idct16x16_1_add_msa,
TX_16X16, 1),
make_tuple(&vpx_fdct8x8_c,
&vpx_idct8x8_64_add_c,
&vpx_idct8x8_12_add_msa,
TX_8X8, 10),
make_tuple(&vpx_fdct8x8_c,
&vpx_idct8x8_64_add_c,
&vpx_idct8x8_1_add_msa,
TX_8X8, 1),
make_tuple(&vpx_fdct4x4_c,
&vpx_idct4x4_16_add_c,
&vpx_idct4x4_1_add_msa,
TX_4X4, 1)));
#endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE #endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
} // namespace } // namespace

View File

@ -15,22 +15,16 @@
#include "vpx/vpx_integer.h" #include "vpx/vpx_integer.h"
#include "vpx_mem/vpx_mem.h" #include "vpx_mem/vpx_mem.h"
typedef void (*PostProcFunc)(unsigned char *src_ptr, typedef void (*PostProcFunc)(unsigned char *src_ptr, unsigned char *dst_ptr,
unsigned char *dst_ptr, int src_pixels_per_line, int dst_pixels_per_line,
int src_pixels_per_line, int cols, unsigned char *flimit, int size);
int dst_pixels_per_line,
int cols,
unsigned char *flimit,
int size);
namespace { namespace {
class VPxPostProcessingFilterTest class VPxPostProcessingFilterTest
: public ::testing::TestWithParam<PostProcFunc> { : public ::testing::TestWithParam<PostProcFunc> {
public: public:
virtual void TearDown() { virtual void TearDown() { libvpx_test::ClearSystemState(); }
libvpx_test::ClearSystemState();
}
}; };
// Test routine for the VPx post-processing function // Test routine for the VPx post-processing function
@ -80,13 +74,12 @@ TEST_P(VPxPostProcessingFilterTest, FilterOutputCheck) {
// Initialize pixels in the output to 99. // Initialize pixels in the output to 99.
(void)memset(dst_image, 99, output_size); (void)memset(dst_image, 99, output_size);
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(GetParam()(src_image_ptr, dst_image_ptr,
GetParam()(src_image_ptr, dst_image_ptr, input_stride, input_stride, output_stride, block_width,
output_stride, block_width, flimits, 16)); flimits, 16));
static const uint8_t expected_data[block_height] = { static const uint8_t expected_data[block_height] = { 4, 3, 1, 1, 1, 1, 1, 1,
4, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4 1, 1, 1, 1, 1, 1, 3, 4 };
};
pixel_ptr = dst_image_ptr; pixel_ptr = dst_image_ptr;
for (int i = 0; i < block_height; ++i) { for (int i = 0; i < block_height; ++i) {
@ -102,16 +95,19 @@ TEST_P(VPxPostProcessingFilterTest, FilterOutputCheck) {
vpx_free(flimits); vpx_free(flimits);
}; };
INSTANTIATE_TEST_CASE_P(C, VPxPostProcessingFilterTest, INSTANTIATE_TEST_CASE_P(
C, VPxPostProcessingFilterTest,
::testing::Values(vpx_post_proc_down_and_across_mb_row_c)); ::testing::Values(vpx_post_proc_down_and_across_mb_row_c));
#if HAVE_SSE2 #if HAVE_SSE2
INSTANTIATE_TEST_CASE_P(SSE2, VPxPostProcessingFilterTest, INSTANTIATE_TEST_CASE_P(
SSE2, VPxPostProcessingFilterTest,
::testing::Values(vpx_post_proc_down_and_across_mb_row_sse2)); ::testing::Values(vpx_post_proc_down_and_across_mb_row_sse2));
#endif #endif
#if HAVE_MSA #if HAVE_MSA
INSTANTIATE_TEST_CASE_P(MSA, VPxPostProcessingFilterTest, INSTANTIATE_TEST_CASE_P(
MSA, VPxPostProcessingFilterTest,
::testing::Values(vpx_post_proc_down_and_across_mb_row_msa)); ::testing::Values(vpx_post_proc_down_and_across_mb_row_msa));
#endif #endif

View File

@ -23,8 +23,7 @@ class RealtimeTest
: public ::libvpx_test::EncoderTest, : public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> { public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
protected: protected:
RealtimeTest() RealtimeTest() : EncoderTest(GET_PARAM(0)), frame_packets_(0) {}
: EncoderTest(GET_PARAM(0)), frame_packets_(0) {}
virtual ~RealtimeTest() {} virtual ~RealtimeTest() {}
virtual void SetUp() { virtual void SetUp() {

View File

@ -79,15 +79,16 @@ class RegisterStateCheck {
CONTEXT pre_context_; CONTEXT pre_context_;
}; };
#define ASM_REGISTER_STATE_CHECK(statement) do { \ #define ASM_REGISTER_STATE_CHECK(statement) \
do { \
libvpx_test::RegisterStateCheck reg_check; \ libvpx_test::RegisterStateCheck reg_check; \
statement; \ statement; \
} while (false) } while (false)
} // namespace libvpx_test } // namespace libvpx_test
#elif defined(CONFIG_SHARED) && defined(HAVE_NEON_ASM) && defined(CONFIG_VP9) \ #elif defined(CONFIG_SHARED) && defined(HAVE_NEON_ASM) && \
&& !CONFIG_SHARED && HAVE_NEON_ASM && CONFIG_VP9 defined(CONFIG_VP9) && !CONFIG_SHARED && HAVE_NEON_ASM && CONFIG_VP9
extern "C" { extern "C" {
// Save the d8-d15 registers into store. // Save the d8-d15 registers into store.
@ -110,15 +111,16 @@ class RegisterStateCheck {
int64_t post_store[8]; int64_t post_store[8];
vpx_push_neon(post_store); vpx_push_neon(post_store);
for (int i = 0; i < 8; ++i) { for (int i = 0; i < 8; ++i) {
EXPECT_EQ(pre_store_[i], post_store[i]) << "d" EXPECT_EQ(pre_store_[i], post_store[i]) << "d" << i + 8
<< i + 8 << " has been modified"; << " has been modified";
} }
} }
int64_t pre_store_[8]; int64_t pre_store_[8];
}; };
#define ASM_REGISTER_STATE_CHECK(statement) do { \ #define ASM_REGISTER_STATE_CHECK(statement) \
do { \
libvpx_test::RegisterStateCheck reg_check; \ libvpx_test::RegisterStateCheck reg_check; \
statement; \ statement; \
} while (false) } while (false)
@ -165,7 +167,8 @@ class RegisterStateCheckMMX {
uint16_t pre_fpu_env_[14]; uint16_t pre_fpu_env_[14];
}; };
#define API_REGISTER_STATE_CHECK(statement) do { \ #define API_REGISTER_STATE_CHECK(statement) \
do { \
libvpx_test::RegisterStateCheckMMX reg_check; \ libvpx_test::RegisterStateCheckMMX reg_check; \
ASM_REGISTER_STATE_CHECK(statement); \ ASM_REGISTER_STATE_CHECK(statement); \
} while (false) } while (false)

View File

@ -68,8 +68,7 @@ static void write_ivf_frame_header(const vpx_codec_cx_pkt_t *const pkt,
char header[12]; char header[12];
vpx_codec_pts_t pts; vpx_codec_pts_t pts;
if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) return;
return;
pts = pkt->data.frame.pts; pts = pkt->data.frame.pts;
mem_put_le32(header, static_cast<unsigned int>(pkt->data.frame.sz)); mem_put_le32(header, static_cast<unsigned int>(pkt->data.frame.sz));
@ -92,12 +91,9 @@ struct FrameInfo {
unsigned int h; unsigned int h;
}; };
void ScaleForFrameNumber(unsigned int frame, void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
unsigned int initial_w, unsigned int initial_h, unsigned int *w,
unsigned int initial_h, unsigned int *h, int flag_codec) {
unsigned int *w,
unsigned int *h,
int flag_codec) {
if (frame < 10) { if (frame < 10) {
*w = initial_w; *w = initial_w;
*h = initial_h; *h = initial_h;
@ -268,7 +264,8 @@ class ResizingVideoSource : public ::libvpx_test::DummyVideoSource {
} }
}; };
class ResizeTest : public ::libvpx_test::EncoderTest, class ResizeTest
: public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> { public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
protected: protected:
ResizeTest() : EncoderTest(GET_PARAM(0)) {} ResizeTest() : EncoderTest(GET_PARAM(0)) {}
@ -299,12 +296,12 @@ TEST_P(ResizeTest, TestExternalResizeWorks) {
const unsigned int frame = static_cast<unsigned>(info->pts); const unsigned int frame = static_cast<unsigned>(info->pts);
unsigned int expected_w; unsigned int expected_w;
unsigned int expected_h; unsigned int expected_h;
ScaleForFrameNumber(frame, kInitialWidth, kInitialHeight, ScaleForFrameNumber(frame, kInitialWidth, kInitialHeight, &expected_w,
&expected_w, &expected_h, 0); &expected_h, 0);
EXPECT_EQ(expected_w, info->w) EXPECT_EQ(expected_w, info->w) << "Frame " << frame
<< "Frame " << frame << " had unexpected width"; << " had unexpected width";
EXPECT_EQ(expected_h, info->h) EXPECT_EQ(expected_h, info->h) << "Frame " << frame
<< "Frame " << frame << " had unexpected height"; << " had unexpected height";
} }
} }
@ -315,10 +312,7 @@ class ResizeInternalTest : public ResizeTest {
protected: protected:
#if WRITE_COMPRESSED_STREAM #if WRITE_COMPRESSED_STREAM
ResizeInternalTest() ResizeInternalTest()
: ResizeTest(), : ResizeTest(), frame0_psnr_(0.0), outfile_(NULL), out_frames_(0) {}
frame0_psnr_(0.0),
outfile_(NULL),
out_frames_(0) {}
#else #else
ResizeInternalTest() : ResizeTest(), frame0_psnr_(0.0) {} ResizeInternalTest() : ResizeTest(), frame0_psnr_(0.0) {}
#endif #endif
@ -369,8 +363,7 @@ class ResizeInternalTest : public ResizeTest {
} }
virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) { virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
if (frame0_psnr_ == 0.) if (frame0_psnr_ == 0.) frame0_psnr_ = pkt->data.psnr.psnr[0];
frame0_psnr_ = pkt->data.psnr.psnr[0];
EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 2.0); EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 2.0);
} }
@ -379,8 +372,7 @@ class ResizeInternalTest : public ResizeTest {
++out_frames_; ++out_frames_;
// Write initial file header if first frame. // Write initial file header if first frame.
if (pkt->data.frame.pts == 0) if (pkt->data.frame.pts == 0) write_ivf_file_header(&cfg_, 0, outfile_);
write_ivf_file_header(&cfg_, 0, outfile_);
// Write frame header and data. // Write frame header and data.
write_ivf_frame_header(pkt, outfile_); write_ivf_frame_header(pkt, outfile_);
@ -434,7 +426,8 @@ TEST_P(ResizeInternalTest, TestInternalResizeChangeConfig) {
ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
} }
class ResizeRealtimeTest : public ::libvpx_test::EncoderTest, class ResizeRealtimeTest
: public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> { public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
protected: protected:
ResizeRealtimeTest() : EncoderTest(GET_PARAM(0)) {} ResizeRealtimeTest() : EncoderTest(GET_PARAM(0)) {}
@ -465,16 +458,13 @@ class ResizeRealtimeTest : public ::libvpx_test::EncoderTest,
frame_info_list_.push_back(FrameInfo(pts, img.d_w, img.d_h)); frame_info_list_.push_back(FrameInfo(pts, img.d_w, img.d_h));
} }
virtual void MismatchHook(const vpx_image_t *img1, virtual void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2) {
const vpx_image_t *img2) {
double mismatch_psnr = compute_psnr(img1, img2); double mismatch_psnr = compute_psnr(img1, img2);
mismatch_psnr_ += mismatch_psnr; mismatch_psnr_ += mismatch_psnr;
++mismatch_nframes_; ++mismatch_nframes_;
} }
unsigned int GetMismatchFrames() { unsigned int GetMismatchFrames() { return mismatch_nframes_; }
return mismatch_nframes_;
}
void DefaultConfig() { void DefaultConfig() {
cfg_.rc_buf_initial_sz = 500; cfg_.rc_buf_initial_sz = 500;
@ -521,12 +511,12 @@ TEST_P(ResizeRealtimeTest, TestExternalResizeWorks) {
const unsigned int frame = static_cast<unsigned>(info->pts); const unsigned int frame = static_cast<unsigned>(info->pts);
unsigned int expected_w; unsigned int expected_w;
unsigned int expected_h; unsigned int expected_h;
ScaleForFrameNumber(frame, kInitialWidth, kInitialHeight, ScaleForFrameNumber(frame, kInitialWidth, kInitialHeight, &expected_w,
&expected_w, &expected_h, 1); &expected_h, 1);
EXPECT_EQ(expected_w, info->w) EXPECT_EQ(expected_w, info->w) << "Frame " << frame
<< "Frame " << frame << " had unexpected width"; << " had unexpected width";
EXPECT_EQ(expected_h, info->h) EXPECT_EQ(expected_h, info->h) << "Frame " << frame
<< "Frame " << frame << " had unexpected height"; << " had unexpected height";
EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames()); EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
} }
} }
@ -618,10 +608,8 @@ TEST_P(ResizeRealtimeTest, TestInternalResizeDownUpChangeBitRate) {
} }
vpx_img_fmt_t CspForFrameNumber(int frame) { vpx_img_fmt_t CspForFrameNumber(int frame) {
if (frame < 10) if (frame < 10) return VPX_IMG_FMT_I420;
return VPX_IMG_FMT_I420; if (frame < 20) return VPX_IMG_FMT_I444;
if (frame < 20)
return VPX_IMG_FMT_I444;
return VPX_IMG_FMT_I420; return VPX_IMG_FMT_I420;
} }
@ -629,10 +617,7 @@ class ResizeCspTest : public ResizeTest {
protected: protected:
#if WRITE_COMPRESSED_STREAM #if WRITE_COMPRESSED_STREAM
ResizeCspTest() ResizeCspTest()
: ResizeTest(), : ResizeTest(), frame0_psnr_(0.0), outfile_(NULL), out_frames_(0) {}
frame0_psnr_(0.0),
outfile_(NULL),
out_frames_(0) {}
#else #else
ResizeCspTest() : ResizeTest(), frame0_psnr_(0.0) {} ResizeCspTest() : ResizeTest(), frame0_psnr_(0.0) {}
#endif #endif
@ -671,8 +656,7 @@ class ResizeCspTest : public ResizeTest {
} }
virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) { virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
if (frame0_psnr_ == 0.) if (frame0_psnr_ == 0.) frame0_psnr_ = pkt->data.psnr.psnr[0];
frame0_psnr_ = pkt->data.psnr.psnr[0];
EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 2.0); EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 2.0);
} }
@ -681,8 +665,7 @@ class ResizeCspTest : public ResizeTest {
++out_frames_; ++out_frames_;
// Write initial file header if first frame. // Write initial file header if first frame.
if (pkt->data.frame.pts == 0) if (pkt->data.frame.pts == 0) write_ivf_file_header(&cfg_, 0, outfile_);
write_ivf_file_header(&cfg_, 0, outfile_);
// Write frame header and data. // Write frame header and data.
write_ivf_frame_header(pkt, outfile_); write_ivf_frame_header(pkt, outfile_);

View File

@ -8,7 +8,6 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>
#include <stdio.h> #include <stdio.h>
@ -60,8 +59,8 @@ class SADTestBase : public ::testing::TestWithParam<ParamType> {
vpx_memalign(kDataAlignment, kDataBlockSize)); vpx_memalign(kDataAlignment, kDataBlockSize));
reference_data8_ = reinterpret_cast<uint8_t *>( reference_data8_ = reinterpret_cast<uint8_t *>(
vpx_memalign(kDataAlignment, kDataBufferSize)); vpx_memalign(kDataAlignment, kDataBufferSize));
second_pred8_ = reinterpret_cast<uint8_t*>( second_pred8_ =
vpx_memalign(kDataAlignment, 64*64)); reinterpret_cast<uint8_t *>(vpx_memalign(kDataAlignment, 64 * 64));
source_data16_ = reinterpret_cast<uint16_t *>( source_data16_ = reinterpret_cast<uint16_t *>(
vpx_memalign(kDataAlignment, kDataBlockSize * sizeof(uint16_t))); vpx_memalign(kDataAlignment, kDataBlockSize * sizeof(uint16_t)));
reference_data16_ = reinterpret_cast<uint16_t *>( reference_data16_ = reinterpret_cast<uint16_t *>(
@ -248,9 +247,8 @@ class SADx4Test : public SADTestBase<SadMxNx4Param> {
const uint8_t *references[] = { GetReference(0), GetReference(1), const uint8_t *references[] = { GetReference(0), GetReference(1),
GetReference(2), GetReference(3) }; GetReference(2), GetReference(3) };
ASM_REGISTER_STATE_CHECK(params_.func(source_data_, source_stride_, ASM_REGISTER_STATE_CHECK(params_.func(
references, reference_stride_, source_data_, source_stride_, references, reference_stride_, results));
results));
} }
void CheckSADs() const { void CheckSADs() const {

View File

@ -8,7 +8,6 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include <math.h> #include <math.h>
#include <stddef.h> #include <stddef.h>
#include <stdio.h> #include <stdio.h>
@ -33,14 +32,10 @@ TEST(VP8RoiMapTest, ParameterCheck) {
unsigned int threshold[MAX_MB_SEGMENTS] = { 0, 100, 200, 300 }; unsigned int threshold[MAX_MB_SEGMENTS] = { 0, 100, 200, 300 };
const int internalq_trans[] = { const int internalq_trans[] = {
0, 1, 2, 3, 4, 5, 7, 8, 0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 12, 13, 15, 17, 18, 19,
9, 10, 12, 13, 15, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 35, 37, 39, 41,
20, 21, 23, 24, 25, 26, 27, 28, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 64, 67, 70, 73, 76, 79,
29, 30, 31, 33, 35, 37, 39, 41, 82, 85, 88, 91, 94, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124, 127,
43, 45, 47, 49, 51, 53, 55, 57,
59, 61, 64, 67, 70, 73, 76, 79,
82, 85, 88, 91, 94, 97, 100, 103,
106, 109, 112, 115, 118, 121, 124, 127,
}; };
// Initialize elements of cpi with valid defaults. // Initialize elements of cpi with valid defaults.
@ -66,9 +61,9 @@ TEST(VP8RoiMapTest, ParameterCheck) {
memset(&roi_map[mbs - (mbs >> 2)], 3, (mbs >> 2)); memset(&roi_map[mbs - (mbs >> 2)], 3, (mbs >> 2));
// Do a test call with valid parameters. // Do a test call with valid parameters.
int roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows, int roi_retval =
cpi.common.mb_cols, delta_q, delta_lf, vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows, cpi.common.mb_cols,
threshold); delta_q, delta_lf, threshold);
EXPECT_EQ(0, roi_retval) EXPECT_EQ(0, roi_retval)
<< "vp8_set_roimap roi failed with default test parameters"; << "vp8_set_roimap roi failed with default test parameters";
@ -104,8 +99,7 @@ TEST(VP8RoiMapTest, ParameterCheck) {
static_cast<unsigned int>(cpi.segment_encode_breakout[i]); static_cast<unsigned int>(cpi.segment_encode_breakout[i]);
if (threshold[i] != breakout) { if (threshold[i] != breakout) {
EXPECT_EQ(threshold[i], breakout) EXPECT_EQ(threshold[i], breakout) << "breakout threshold error";
<< "breakout threshold error";
break; break;
} }
} }
@ -118,7 +112,6 @@ TEST(VP8RoiMapTest, ParameterCheck) {
EXPECT_EQ(1, cpi.mb.e_mbd.update_mb_segmentation_data) EXPECT_EQ(1, cpi.mb.e_mbd.update_mb_segmentation_data)
<< "update_mb_segmentation_data error"; << "update_mb_segmentation_data error";
// Try a range of delta q and lf parameters (some legal, some not) // Try a range of delta q and lf parameters (some legal, some not)
for (int i = 0; i < 1000; ++i) { for (int i = 0; i < 1000; ++i) {
int rand_deltas[4]; int rand_deltas[4];
@ -128,57 +121,54 @@ TEST(VP8RoiMapTest, ParameterCheck) {
rand_deltas[2] = rnd(160) - 80; rand_deltas[2] = rnd(160) - 80;
rand_deltas[3] = rnd(160) - 80; rand_deltas[3] = rnd(160) - 80;
deltas_valid = ((abs(rand_deltas[0]) <= 63) && deltas_valid =
(abs(rand_deltas[1]) <= 63) && ((abs(rand_deltas[0]) <= 63) && (abs(rand_deltas[1]) <= 63) &&
(abs(rand_deltas[2]) <= 63) && (abs(rand_deltas[2]) <= 63) && (abs(rand_deltas[3]) <= 63))
(abs(rand_deltas[3]) <= 63)) ? 0 : -1; ? 0
: -1;
// Test with random delta q values. // Test with random delta q values.
roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows, roi_retval =
cpi.common.mb_cols, rand_deltas, vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows, cpi.common.mb_cols,
delta_lf, threshold); rand_deltas, delta_lf, threshold);
EXPECT_EQ(deltas_valid, roi_retval) << "dq range check error"; EXPECT_EQ(deltas_valid, roi_retval) << "dq range check error";
// One delta_q error shown at a time // One delta_q error shown at a time
if (deltas_valid != roi_retval) if (deltas_valid != roi_retval) break;
break;
// Test with random loop filter values. // Test with random loop filter values.
roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows, roi_retval =
cpi.common.mb_cols, delta_q, vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows, cpi.common.mb_cols,
rand_deltas, threshold); delta_q, rand_deltas, threshold);
EXPECT_EQ(deltas_valid, roi_retval) << "dlf range check error"; EXPECT_EQ(deltas_valid, roi_retval) << "dlf range check error";
// One delta loop filter error shown at a time // One delta loop filter error shown at a time
if (deltas_valid != roi_retval) if (deltas_valid != roi_retval) break;
break;
} }
// Test that we report and error if cyclic refresh is enabled. // Test that we report and error if cyclic refresh is enabled.
cpi.cyclic_refresh_mode_enabled = 1; cpi.cyclic_refresh_mode_enabled = 1;
roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows, roi_retval =
cpi.common.mb_cols, delta_q, vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows, cpi.common.mb_cols,
delta_lf, threshold); delta_q, delta_lf, threshold);
EXPECT_EQ(-1, roi_retval) << "cyclic refresh check error"; EXPECT_EQ(-1, roi_retval) << "cyclic refresh check error";
cpi.cyclic_refresh_mode_enabled = 0; cpi.cyclic_refresh_mode_enabled = 0;
// Test invalid number of rows or colums. // Test invalid number of rows or colums.
roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows + 1, roi_retval =
cpi.common.mb_cols, delta_q, vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows + 1,
delta_lf, threshold); cpi.common.mb_cols, delta_q, delta_lf, threshold);
EXPECT_EQ(-1, roi_retval) << "MB rows bounds check error"; EXPECT_EQ(-1, roi_retval) << "MB rows bounds check error";
roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows, roi_retval =
cpi.common.mb_cols - 1, delta_q, vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
delta_lf, threshold); cpi.common.mb_cols - 1, delta_q, delta_lf, threshold);
EXPECT_EQ(-1, roi_retval) << "MB cols bounds check error"; EXPECT_EQ(-1, roi_retval) << "MB cols bounds check error";
} }
// Free allocated memory // Free allocated memory
if (cpi.segmentation_map) if (cpi.segmentation_map) vpx_free(cpi.segmentation_map);
vpx_free(cpi.segmentation_map); if (roi_map) vpx_free(roi_map);
if (roi_map)
vpx_free(roi_map);
}; };
} // namespace } // namespace

View File

@ -25,22 +25,19 @@
namespace { namespace {
typedef void (*SixtapPredictFunc)(uint8_t *src_ptr, typedef void (*SixtapPredictFunc)(uint8_t *src_ptr, int src_pixels_per_line,
int src_pixels_per_line, int xoffset, int yoffset, uint8_t *dst_ptr,
int xoffset,
int yoffset,
uint8_t *dst_ptr,
int dst_pitch); int dst_pitch);
typedef std::tr1::tuple<int, int, SixtapPredictFunc> SixtapPredictParam; typedef std::tr1::tuple<int, int, SixtapPredictFunc> SixtapPredictParam;
class SixtapPredictTest class SixtapPredictTest : public ::testing::TestWithParam<SixtapPredictParam> {
: public ::testing::TestWithParam<SixtapPredictParam> {
public: public:
static void SetUpTestCase() { static void SetUpTestCase() {
src_ = reinterpret_cast<uint8_t *>(vpx_memalign(kDataAlignment, kSrcSize)); src_ = reinterpret_cast<uint8_t *>(vpx_memalign(kDataAlignment, kSrcSize));
dst_ = reinterpret_cast<uint8_t *>(vpx_memalign(kDataAlignment, kDstSize)); dst_ = reinterpret_cast<uint8_t *>(vpx_memalign(kDataAlignment, kDstSize));
dst_c_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kDstSize)); dst_c_ =
reinterpret_cast<uint8_t *>(vpx_memalign(kDataAlignment, kDstSize));
} }
static void TearDownTestCase() { static void TearDownTestCase() {
@ -52,9 +49,7 @@ class SixtapPredictTest
dst_c_ = NULL; dst_c_ = NULL;
} }
virtual void TearDown() { virtual void TearDown() { libvpx_test::ClearSystemState(); }
libvpx_test::ClearSystemState();
}
protected: protected:
// Make test arrays big enough for 16x16 functions. Six-tap filters // Make test arrays big enough for 16x16 functions. Six-tap filters
@ -92,62 +87,64 @@ uint8_t* SixtapPredictTest::dst_c_ = NULL;
TEST_P(SixtapPredictTest, TestWithPresetData) { TEST_P(SixtapPredictTest, TestWithPresetData) {
// Test input // Test input
static const uint8_t test_data[kSrcSize] = { static const uint8_t test_data[kSrcSize] = {
216, 184, 4, 191, 82, 92, 41, 0, 1, 226, 236, 172, 20, 182, 42, 226, 177, 216, 184, 4, 191, 82, 92, 41, 0, 1, 226, 236, 172, 20, 182, 42,
79, 94, 77, 179, 203, 206, 198, 22, 192, 19, 75, 17, 192, 44, 233, 120, 226, 177, 79, 94, 77, 179, 203, 206, 198, 22, 192, 19, 75, 17, 192,
48, 168, 203, 141, 210, 203, 143, 180, 184, 59, 201, 110, 102, 171, 32, 44, 233, 120, 48, 168, 203, 141, 210, 203, 143, 180, 184, 59, 201, 110,
182, 10, 109, 105, 213, 60, 47, 236, 253, 67, 55, 14, 3, 99, 247, 124, 102, 171, 32, 182, 10, 109, 105, 213, 60, 47, 236, 253, 67, 55, 14,
148, 159, 71, 34, 114, 19, 177, 38, 203, 237, 239, 58, 83, 155, 91, 10, 3, 99, 247, 124, 148, 159, 71, 34, 114, 19, 177, 38, 203, 237, 239,
166, 201, 115, 124, 5, 163, 104, 2, 231, 160, 16, 234, 4, 8, 103, 153, 58, 83, 155, 91, 10, 166, 201, 115, 124, 5, 163, 104, 2, 231, 160,
167, 174, 187, 26, 193, 109, 64, 141, 90, 48, 200, 174, 204, 36, 184, 16, 234, 4, 8, 103, 153, 167, 174, 187, 26, 193, 109, 64, 141, 90,
114, 237, 43, 238, 242, 207, 86, 245, 182, 247, 6, 161, 251, 14, 8, 148, 48, 200, 174, 204, 36, 184, 114, 237, 43, 238, 242, 207, 86, 245, 182,
182, 182, 79, 208, 120, 188, 17, 6, 23, 65, 206, 197, 13, 242, 126, 128, 247, 6, 161, 251, 14, 8, 148, 182, 182, 79, 208, 120, 188, 17, 6,
224, 170, 110, 211, 121, 197, 200, 47, 188, 207, 208, 184, 221, 216, 76, 23, 65, 206, 197, 13, 242, 126, 128, 224, 170, 110, 211, 121, 197, 200,
148, 143, 156, 100, 8, 89, 117, 14, 112, 183, 221, 54, 197, 208, 180, 69, 47, 188, 207, 208, 184, 221, 216, 76, 148, 143, 156, 100, 8, 89, 117,
176, 94, 180, 131, 215, 121, 76, 7, 54, 28, 216, 238, 249, 176, 58, 142, 14, 112, 183, 221, 54, 197, 208, 180, 69, 176, 94, 180, 131, 215, 121,
64, 215, 242, 72, 49, 104, 87, 161, 32, 52, 216, 230, 4, 141, 44, 181, 76, 7, 54, 28, 216, 238, 249, 176, 58, 142, 64, 215, 242, 72, 49,
235, 224, 57, 195, 89, 134, 203, 144, 162, 163, 126, 156, 84, 185, 42, 104, 87, 161, 32, 52, 216, 230, 4, 141, 44, 181, 235, 224, 57, 195,
148, 145, 29, 221, 194, 134, 52, 100, 166, 105, 60, 140, 110, 201, 184, 89, 134, 203, 144, 162, 163, 126, 156, 84, 185, 42, 148, 145, 29, 221,
35, 181, 153, 93, 121, 243, 227, 68, 131, 134, 232, 2, 35, 60, 187, 77, 194, 134, 52, 100, 166, 105, 60, 140, 110, 201, 184, 35, 181, 153, 93,
209, 76, 106, 174, 15, 241, 227, 115, 151, 77, 175, 36, 187, 121, 221, 121, 243, 227, 68, 131, 134, 232, 2, 35, 60, 187, 77, 209, 76, 106,
223, 47, 118, 61, 168, 105, 32, 237, 236, 167, 213, 238, 202, 17, 170, 174, 15, 241, 227, 115, 151, 77, 175, 36, 187, 121, 221, 223, 47, 118,
24, 226, 247, 131, 145, 6, 116, 117, 121, 11, 194, 41, 48, 126, 162, 13, 61, 168, 105, 32, 237, 236, 167, 213, 238, 202, 17, 170, 24, 226, 247,
93, 209, 131, 154, 122, 237, 187, 103, 217, 99, 60, 200, 45, 78, 115, 69, 131, 145, 6, 116, 117, 121, 11, 194, 41, 48, 126, 162, 13, 93, 209,
49, 106, 200, 194, 112, 60, 56, 234, 72, 251, 19, 120, 121, 182, 134, 215, 131, 154, 122, 237, 187, 103, 217, 99, 60, 200, 45, 78, 115, 69, 49,
135, 10, 114, 2, 247, 46, 105, 209, 145, 165, 153, 191, 243, 12, 5, 36, 106, 200, 194, 112, 60, 56, 234, 72, 251, 19, 120, 121, 182, 134, 215,
119, 206, 231, 231, 11, 32, 209, 83, 27, 229, 204, 149, 155, 83, 109, 35, 135, 10, 114, 2, 247, 46, 105, 209, 145, 165, 153, 191, 243, 12, 5,
93, 223, 37, 84, 14, 142, 37, 160, 52, 191, 96, 40, 204, 101, 77, 67, 52, 36, 119, 206, 231, 231, 11, 32, 209, 83, 27, 229, 204, 149, 155, 83,
53, 43, 63, 85, 253, 147, 113, 226, 96, 6, 125, 179, 115, 161, 17, 83, 109, 35, 93, 223, 37, 84, 14, 142, 37, 160, 52, 191, 96, 40, 204,
198, 101, 98, 85, 139, 3, 137, 75, 99, 178, 23, 201, 255, 91, 253, 52, 101, 77, 67, 52, 53, 43, 63, 85, 253, 147, 113, 226, 96, 6, 125,
134, 60, 138, 131, 208, 251, 101, 48, 2, 227, 228, 118, 132, 245, 202, 179, 115, 161, 17, 83, 198, 101, 98, 85, 139, 3, 137, 75, 99, 178,
75, 91, 44, 160, 231, 47, 41, 50, 147, 220, 74, 92, 219, 165, 89, 16 23, 201, 255, 91, 253, 52, 134, 60, 138, 131, 208, 251, 101, 48, 2,
227, 228, 118, 132, 245, 202, 75, 91, 44, 160, 231, 47, 41, 50, 147,
220, 74, 92, 219, 165, 89, 16
}; };
// Expected result // Expected result
static const uint8_t expected_dst[kDstSize] = { static const uint8_t expected_dst[kDstSize] = {
117, 102, 74, 135, 42, 98, 175, 206, 70, 73, 222, 197, 50, 24, 39, 49, 38, 117, 102, 74, 135, 42, 98, 175, 206, 70, 73, 222, 197, 50, 24, 39,
105, 90, 47, 169, 40, 171, 215, 200, 73, 109, 141, 53, 85, 177, 164, 79, 49, 38, 105, 90, 47, 169, 40, 171, 215, 200, 73, 109, 141, 53, 85,
208, 124, 89, 212, 18, 81, 145, 151, 164, 217, 153, 91, 154, 102, 102, 177, 164, 79, 208, 124, 89, 212, 18, 81, 145, 151, 164, 217, 153, 91,
159, 75, 164, 152, 136, 51, 213, 219, 186, 116, 193, 224, 186, 36, 231, 154, 102, 102, 159, 75, 164, 152, 136, 51, 213, 219, 186, 116, 193, 224,
208, 84, 211, 155, 167, 35, 59, 42, 76, 216, 149, 73, 201, 78, 149, 184, 186, 36, 231, 208, 84, 211, 155, 167, 35, 59, 42, 76, 216, 149, 73,
100, 96, 196, 189, 198, 188, 235, 195, 117, 129, 120, 129, 49, 25, 133, 201, 78, 149, 184, 100, 96, 196, 189, 198, 188, 235, 195, 117, 129, 120,
113, 69, 221, 114, 70, 143, 99, 157, 108, 189, 140, 78, 6, 55, 65, 240, 129, 49, 25, 133, 113, 69, 221, 114, 70, 143, 99, 157, 108, 189, 140,
255, 245, 184, 72, 90, 100, 116, 131, 39, 60, 234, 167, 33, 160, 88, 185, 78, 6, 55, 65, 240, 255, 245, 184, 72, 90, 100, 116, 131, 39, 60,
200, 157, 159, 176, 127, 151, 138, 102, 168, 106, 170, 86, 82, 219, 189, 234, 167, 33, 160, 88, 185, 200, 157, 159, 176, 127, 151, 138, 102, 168,
76, 33, 115, 197, 106, 96, 198, 136, 97, 141, 237, 151, 98, 137, 191, 106, 170, 86, 82, 219, 189, 76, 33, 115, 197, 106, 96, 198, 136, 97,
185, 2, 57, 95, 142, 91, 255, 185, 97, 137, 76, 162, 94, 173, 131, 193, 141, 237, 151, 98, 137, 191, 185, 2, 57, 95, 142, 91, 255, 185, 97,
161, 81, 106, 72, 135, 222, 234, 137, 66, 137, 106, 243, 210, 147, 95, 137, 76, 162, 94, 173, 131, 193, 161, 81, 106, 72, 135, 222, 234, 137,
15, 137, 110, 85, 66, 16, 96, 167, 147, 150, 173, 203, 140, 118, 196, 66, 137, 106, 243, 210, 147, 95, 15, 137, 110, 85, 66, 16, 96, 167,
84, 147, 160, 19, 95, 101, 123, 74, 132, 202, 82, 166, 12, 131, 166, 147, 150, 173, 203, 140, 118, 196, 84, 147, 160, 19, 95, 101, 123, 74,
189, 170, 159, 85, 79, 66, 57, 152, 132, 203, 194, 0, 1, 56, 146, 180, 132, 202, 82, 166, 12, 131, 166, 189, 170, 159, 85, 79, 66, 57, 152,
224, 156, 28, 83, 181, 79, 76, 80, 46, 160, 175, 59, 106, 43, 87, 75, 132, 203, 194, 0, 1, 56, 146, 180, 224, 156, 28, 83, 181, 79, 76,
136, 85, 189, 46, 71, 200, 90 80, 46, 160, 175, 59, 106, 43, 87, 75, 136, 85, 189, 46, 71, 200,
90
}; };
uint8_t *src = const_cast<uint8_t *>(test_data); uint8_t *src = const_cast<uint8_t *>(test_data);
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(sixtap_predict_(&src[kSrcStride * 2 + 2 + 1],
sixtap_predict_(&src[kSrcStride * 2 + 2 + 1], kSrcStride, kSrcStride, 2, 2, dst_, kDstStride));
2, 2, dst_, kDstStride));
for (int i = 0; i < height_; ++i) for (int i = 0; i < height_; ++i)
for (int j = 0; j < width_; ++j) for (int j = 0; j < width_; ++j)
@ -159,8 +156,7 @@ using libvpx_test::ACMRandom;
TEST_P(SixtapPredictTest, TestWithRandomData) { TEST_P(SixtapPredictTest, TestWithRandomData) {
ACMRandom rnd(ACMRandom::DeterministicSeed()); ACMRandom rnd(ACMRandom::DeterministicSeed());
for (int i = 0; i < kSrcSize; ++i) for (int i = 0; i < kSrcSize; ++i) src_[i] = rnd.Rand8();
src_[i] = rnd.Rand8();
// Run tests for all possible offsets. // Run tests for all possible offsets.
for (int xoffset = 0; xoffset < 8; ++xoffset) { for (int xoffset = 0; xoffset < 8; ++xoffset) {
@ -172,9 +168,9 @@ TEST_P(SixtapPredictTest, TestWithRandomData) {
xoffset, yoffset, dst_c_, kDstStride); xoffset, yoffset, dst_c_, kDstStride);
// Run test. // Run test.
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(sixtap_predict_(&src_[kSrcStride * 2 + 2 + 1],
sixtap_predict_(&src_[kSrcStride * 2 + 2 + 1], kSrcStride, kSrcStride, xoffset, yoffset,
xoffset, yoffset, dst_, kDstStride)); dst_, kDstStride));
for (int i = 0; i < height_; ++i) for (int i = 0; i < height_; ++i)
for (int j = 0; j < width_; ++j) for (int j = 0; j < width_; ++j)
@ -187,45 +183,45 @@ TEST_P(SixtapPredictTest, TestWithRandomData) {
using std::tr1::make_tuple; using std::tr1::make_tuple;
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
C, SixtapPredictTest, ::testing::Values( C, SixtapPredictTest,
make_tuple(16, 16, &vp8_sixtap_predict16x16_c), ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_c),
make_tuple(8, 8, &vp8_sixtap_predict8x8_c), make_tuple(8, 8, &vp8_sixtap_predict8x8_c),
make_tuple(8, 4, &vp8_sixtap_predict8x4_c), make_tuple(8, 4, &vp8_sixtap_predict8x4_c),
make_tuple(4, 4, &vp8_sixtap_predict4x4_c))); make_tuple(4, 4, &vp8_sixtap_predict4x4_c)));
#if HAVE_NEON #if HAVE_NEON
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
NEON, SixtapPredictTest, ::testing::Values( NEON, SixtapPredictTest,
make_tuple(16, 16, &vp8_sixtap_predict16x16_neon), ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_neon),
make_tuple(8, 8, &vp8_sixtap_predict8x8_neon), make_tuple(8, 8, &vp8_sixtap_predict8x8_neon),
make_tuple(8, 4, &vp8_sixtap_predict8x4_neon))); make_tuple(8, 4, &vp8_sixtap_predict8x4_neon)));
#endif #endif
#if HAVE_MMX #if HAVE_MMX
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
MMX, SixtapPredictTest, ::testing::Values( MMX, SixtapPredictTest,
make_tuple(16, 16, &vp8_sixtap_predict16x16_mmx), ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_mmx),
make_tuple(8, 8, &vp8_sixtap_predict8x8_mmx), make_tuple(8, 8, &vp8_sixtap_predict8x8_mmx),
make_tuple(8, 4, &vp8_sixtap_predict8x4_mmx), make_tuple(8, 4, &vp8_sixtap_predict8x4_mmx),
make_tuple(4, 4, &vp8_sixtap_predict4x4_mmx))); make_tuple(4, 4, &vp8_sixtap_predict4x4_mmx)));
#endif #endif
#if HAVE_SSE2 #if HAVE_SSE2
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, SixtapPredictTest, ::testing::Values( SSE2, SixtapPredictTest,
make_tuple(16, 16, &vp8_sixtap_predict16x16_sse2), ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_sse2),
make_tuple(8, 8, &vp8_sixtap_predict8x8_sse2), make_tuple(8, 8, &vp8_sixtap_predict8x8_sse2),
make_tuple(8, 4, &vp8_sixtap_predict8x4_sse2))); make_tuple(8, 4, &vp8_sixtap_predict8x4_sse2)));
#endif #endif
#if HAVE_SSSE3 #if HAVE_SSSE3
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSSE3, SixtapPredictTest, ::testing::Values( SSSE3, SixtapPredictTest,
make_tuple(16, 16, &vp8_sixtap_predict16x16_ssse3), ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_ssse3),
make_tuple(8, 8, &vp8_sixtap_predict8x8_ssse3), make_tuple(8, 8, &vp8_sixtap_predict8x8_ssse3),
make_tuple(8, 4, &vp8_sixtap_predict8x4_ssse3), make_tuple(8, 4, &vp8_sixtap_predict8x4_ssse3),
make_tuple(4, 4, &vp8_sixtap_predict4x4_ssse3))); make_tuple(4, 4, &vp8_sixtap_predict4x4_ssse3)));
#endif #endif
#if HAVE_MSA #if HAVE_MSA
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
MSA, SixtapPredictTest, ::testing::Values( MSA, SixtapPredictTest,
make_tuple(16, 16, &vp8_sixtap_predict16x16_msa), ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_msa),
make_tuple(8, 8, &vp8_sixtap_predict8x8_msa), make_tuple(8, 8, &vp8_sixtap_predict8x8_msa),
make_tuple(8, 4, &vp8_sixtap_predict8x4_msa), make_tuple(8, 4, &vp8_sixtap_predict8x4_msa),
make_tuple(4, 4, &vp8_sixtap_predict4x4_msa))); make_tuple(4, 4, &vp8_sixtap_predict4x4_msa)));

View File

@ -68,8 +68,7 @@ TEST_P(SumSquaresTest, OperationCheck) {
uint64_t res_tst; uint64_t res_tst;
ASM_REGISTER_STATE_CHECK(res_tst = tst_func_(src, stride, size)); ASM_REGISTER_STATE_CHECK(res_tst = tst_func_(src, stride, size));
ASSERT_EQ(res_ref, res_tst) ASSERT_EQ(res_ref, res_tst) << "Error: Sum Squares Test"
<< "Error: Sum Squares Test"
<< " C output does not match optimized output."; << " C output does not match optimized output.";
} }
} }
@ -98,8 +97,7 @@ TEST_P(SumSquaresTest, ExtremeValues) {
uint64_t res_tst; uint64_t res_tst;
ASM_REGISTER_STATE_CHECK(res_tst = tst_func_(src, stride, size)); ASM_REGISTER_STATE_CHECK(res_tst = tst_func_(src, stride, size));
ASSERT_EQ(res_ref, res_tst) ASSERT_EQ(res_ref, res_tst) << "Error: Sum Squares Test"
<< "Error: Sum Squares Test"
<< " C output does not match optimized output."; << " C output does not match optimized output.";
} }
} }

View File

@ -20,11 +20,12 @@ const int kTestMode = 0;
typedef std::tr1::tuple<libvpx_test::TestMode, int> SuperframeTestParam; typedef std::tr1::tuple<libvpx_test::TestMode, int> SuperframeTestParam;
class SuperframeTest : public ::libvpx_test::EncoderTest, class SuperframeTest
: public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWithParam<SuperframeTestParam> { public ::libvpx_test::CodecTestWithParam<SuperframeTestParam> {
protected: protected:
SuperframeTest() : EncoderTest(GET_PARAM(0)), modified_buf_(NULL), SuperframeTest()
last_sf_pts_(0) {} : EncoderTest(GET_PARAM(0)), modified_buf_(NULL), last_sf_pts_(0) {}
virtual ~SuperframeTest() {} virtual ~SuperframeTest() {}
virtual void SetUp() { virtual void SetUp() {
@ -36,9 +37,7 @@ class SuperframeTest : public ::libvpx_test::EncoderTest,
sf_count_max_ = INT_MAX; sf_count_max_ = INT_MAX;
} }
virtual void TearDown() { virtual void TearDown() { delete[] modified_buf_; }
delete[] modified_buf_;
}
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video, virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
libvpx_test::Encoder *encoder) { libvpx_test::Encoder *encoder) {
@ -49,23 +48,19 @@ class SuperframeTest : public ::libvpx_test::EncoderTest,
virtual const vpx_codec_cx_pkt_t *MutateEncoderOutputHook( virtual const vpx_codec_cx_pkt_t *MutateEncoderOutputHook(
const vpx_codec_cx_pkt_t *pkt) { const vpx_codec_cx_pkt_t *pkt) {
if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) return pkt;
return pkt;
const uint8_t *buffer = reinterpret_cast<uint8_t *>(pkt->data.frame.buf); const uint8_t *buffer = reinterpret_cast<uint8_t *>(pkt->data.frame.buf);
const uint8_t marker = buffer[pkt->data.frame.sz - 1]; const uint8_t marker = buffer[pkt->data.frame.sz - 1];
const int frames = (marker & 0x7) + 1; const int frames = (marker & 0x7) + 1;
const int mag = ((marker >> 3) & 3) + 1; const int mag = ((marker >> 3) & 3) + 1;
const unsigned int index_sz = 2 + mag * frames; const unsigned int index_sz = 2 + mag * frames;
if ((marker & 0xe0) == 0xc0 && if ((marker & 0xe0) == 0xc0 && pkt->data.frame.sz >= index_sz &&
pkt->data.frame.sz >= index_sz &&
buffer[pkt->data.frame.sz - index_sz] == marker) { buffer[pkt->data.frame.sz - index_sz] == marker) {
// frame is a superframe. strip off the index. // frame is a superframe. strip off the index.
if (modified_buf_) if (modified_buf_) delete[] modified_buf_;
delete[] modified_buf_;
modified_buf_ = new uint8_t[pkt->data.frame.sz - index_sz]; modified_buf_ = new uint8_t[pkt->data.frame.sz - index_sz];
memcpy(modified_buf_, pkt->data.frame.buf, memcpy(modified_buf_, pkt->data.frame.buf, pkt->data.frame.sz - index_sz);
pkt->data.frame.sz - index_sz);
modified_pkt_ = *pkt; modified_pkt_ = *pkt;
modified_pkt_.data.frame.buf = modified_buf_; modified_pkt_.data.frame.buf = modified_buf_;
modified_pkt_.data.frame.sz -= index_sz; modified_pkt_.data.frame.sz -= index_sz;
@ -76,8 +71,8 @@ class SuperframeTest : public ::libvpx_test::EncoderTest,
} }
// Make sure we do a few frames after the last SF // Make sure we do a few frames after the last SF
abort_ |= sf_count_ > sf_count_max_ && abort_ |=
pkt->data.frame.pts - last_sf_pts_ >= 5; sf_count_ > sf_count_max_ && pkt->data.frame.pts - last_sf_pts_ >= 5;
return pkt; return pkt;
} }
@ -98,7 +93,8 @@ TEST_P(SuperframeTest, TestSuperframeIndexIsOptional) {
EXPECT_EQ(sf_count_, 1); EXPECT_EQ(sf_count_, 1);
} }
VP9_INSTANTIATE_TEST_CASE(SuperframeTest, ::testing::Combine( VP9_INSTANTIATE_TEST_CASE(
::testing::Values(::libvpx_test::kTwoPassGood), SuperframeTest,
::testing::Combine(::testing::Values(::libvpx_test::kTwoPassGood),
::testing::Values(0))); ::testing::Values(0)));
} // namespace } // namespace

View File

@ -33,10 +33,8 @@ class SvcTest : public ::testing::Test {
static const uint32_t kHeight = 288; static const uint32_t kHeight = 288;
SvcTest() SvcTest()
: codec_iface_(0), : codec_iface_(0), test_file_name_("hantro_collage_w352h288.yuv"),
test_file_name_("hantro_collage_w352h288.yuv"), codec_initialized_(false), decoder_(0) {
codec_initialized_(false),
decoder_(0) {
memset(&svc_, 0, sizeof(svc_)); memset(&svc_, 0, sizeof(svc_));
memset(&codec_, 0, sizeof(codec_)); memset(&codec_, 0, sizeof(codec_));
memset(&codec_enc_, 0, sizeof(codec_enc_)); memset(&codec_enc_, 0, sizeof(codec_enc_));
@ -113,10 +111,9 @@ class SvcTest : public ::testing::Test {
codec_enc_.g_pass = VPX_RC_FIRST_PASS; codec_enc_.g_pass = VPX_RC_FIRST_PASS;
InitializeEncoder(); InitializeEncoder();
libvpx_test::I420VideoSource video(test_file_name_, libvpx_test::I420VideoSource video(
codec_enc_.g_w, codec_enc_.g_h, test_file_name_, codec_enc_.g_w, codec_enc_.g_h,
codec_enc_.g_timebase.den, codec_enc_.g_timebase.den, codec_enc_.g_timebase.num, 0, 30);
codec_enc_.g_timebase.num, 0, 30);
video.Begin(); video.Begin();
for (int i = 0; i < n; ++i) { for (int i = 0; i < n; ++i) {
@ -128,8 +125,8 @@ class SvcTest : public ::testing::Test {
} }
// Flush encoder and test EOS packet. // Flush encoder and test EOS packet.
res = vpx_svc_encode(&svc_, &codec_, NULL, video.pts(), res = vpx_svc_encode(&svc_, &codec_, NULL, video.pts(), video.duration(),
video.duration(), VPX_DL_GOOD_QUALITY); VPX_DL_GOOD_QUALITY);
ASSERT_EQ(VPX_CODEC_OK, res); ASSERT_EQ(VPX_CODEC_OK, res);
GetStatsData(stats_buf); GetStatsData(stats_buf);
@ -163,8 +160,8 @@ class SvcTest : public ::testing::Test {
} }
} }
void Pass2EncodeNFrames(std::string *const stats_buf, void Pass2EncodeNFrames(std::string *const stats_buf, const int n,
const int n, const int layers, const int layers,
struct vpx_fixed_buf *const outputs) { struct vpx_fixed_buf *const outputs) {
vpx_codec_err_t res; vpx_codec_err_t res;
size_t frame_received = 0; size_t frame_received = 0;
@ -182,10 +179,9 @@ class SvcTest : public ::testing::Test {
} }
InitializeEncoder(); InitializeEncoder();
libvpx_test::I420VideoSource video(test_file_name_, libvpx_test::I420VideoSource video(
codec_enc_.g_w, codec_enc_.g_h, test_file_name_, codec_enc_.g_w, codec_enc_.g_h,
codec_enc_.g_timebase.den, codec_enc_.g_timebase.den, codec_enc_.g_timebase.num, 0, 30);
codec_enc_.g_timebase.num, 0, 30);
video.Begin(); video.Begin();
for (int i = 0; i < n; ++i) { for (int i = 0; i < n; ++i) {
@ -197,8 +193,8 @@ class SvcTest : public ::testing::Test {
} }
// Flush encoder. // Flush encoder.
res = vpx_svc_encode(&svc_, &codec_, NULL, 0, res = vpx_svc_encode(&svc_, &codec_, NULL, 0, video.duration(),
video.duration(), VPX_DL_GOOD_QUALITY); VPX_DL_GOOD_QUALITY);
EXPECT_EQ(VPX_CODEC_OK, res); EXPECT_EQ(VPX_CODEC_OK, res);
StoreFrames(n, outputs, &frame_received); StoreFrames(n, outputs, &frame_received);
@ -217,9 +213,8 @@ class SvcTest : public ::testing::Test {
for (int i = 0; i < n; ++i) { for (int i = 0; i < n; ++i) {
ASSERT_TRUE(inputs[i].buf != NULL); ASSERT_TRUE(inputs[i].buf != NULL);
ASSERT_GT(inputs[i].sz, 0U); ASSERT_GT(inputs[i].sz, 0U);
const vpx_codec_err_t res_dec = const vpx_codec_err_t res_dec = decoder_->DecodeFrame(
decoder_->DecodeFrame(static_cast<const uint8_t *>(inputs[i].buf), static_cast<const uint8_t *>(inputs[i].buf), inputs[i].sz);
inputs[i].sz);
ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder_->DecodeError(); ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder_->DecodeError();
++decoded_frames; ++decoded_frames;
@ -247,10 +242,9 @@ class SvcTest : public ::testing::Test {
ASSERT_TRUE(inputs[i].buf != NULL); ASSERT_TRUE(inputs[i].buf != NULL);
ASSERT_GT(inputs[i].sz, 0U); ASSERT_GT(inputs[i].sz, 0U);
vpx_codec_err_t res = vpx_codec_err_t res = vp9_parse_superframe_index(
vp9_parse_superframe_index(static_cast<const uint8_t*>(inputs[i].buf), static_cast<const uint8_t *>(inputs[i].buf), inputs[i].sz,
inputs[i].sz, frame_sizes, &frame_count, frame_sizes, &frame_count, NULL, NULL);
NULL, NULL);
ASSERT_EQ(VPX_CODEC_OK, res); ASSERT_EQ(VPX_CODEC_OK, res);
if (frame_count == 0) { if (frame_count == 0) {
@ -264,16 +258,15 @@ class SvcTest : public ::testing::Test {
// Looking for a visible frame. // Looking for a visible frame.
if (frame_data[0] & 0x02) { if (frame_data[0] & 0x02) {
++frames_found; ++frames_found;
if (frames_found == remained_spatial_layers) if (frames_found == remained_spatial_layers) break;
break;
} }
frame_data += frame_sizes[frame]; frame_data += frame_sizes[frame];
} }
ASSERT_LT(frame, frame_count) << "Couldn't find a visible frame. " ASSERT_LT(frame, frame_count)
<< "Couldn't find a visible frame. "
<< "remained_spatial_layers: " << remained_spatial_layers << "remained_spatial_layers: " << remained_spatial_layers
<< " super_frame: " << i; << " super_frame: " << i;
if (frame == frame_count - 1) if (frame == frame_count - 1) continue;
continue;
frame_data += frame_sizes[frame]; frame_data += frame_sizes[frame];
@ -539,8 +532,7 @@ TEST_F(SvcTest, TwoPassEncode2SNRLayers) {
// Second pass encode // Second pass encode
codec_enc_.g_pass = VPX_RC_LAST_PASS; codec_enc_.g_pass = VPX_RC_LAST_PASS;
vpx_svc_set_options(&svc_, vpx_svc_set_options(&svc_, "auto-alt-refs=1,1 scale-factors=1/1,1/1");
"auto-alt-refs=1,1 scale-factors=1/1,1/1");
vpx_fixed_buf outputs[20]; vpx_fixed_buf outputs[20];
memset(&outputs[0], 0, sizeof(outputs)); memset(&outputs[0], 0, sizeof(outputs));
Pass2EncodeNFrames(&stats_buf, 20, 2, &outputs[0]); Pass2EncodeNFrames(&stats_buf, 20, 2, &outputs[0]);
@ -556,8 +548,7 @@ TEST_F(SvcTest, TwoPassEncode3SNRLayersDecode321Layers) {
// Second pass encode // Second pass encode
codec_enc_.g_pass = VPX_RC_LAST_PASS; codec_enc_.g_pass = VPX_RC_LAST_PASS;
vpx_svc_set_options(&svc_, vpx_svc_set_options(&svc_, "auto-alt-refs=1,1,1 scale-factors=1/1,1/1,1/1");
"auto-alt-refs=1,1,1 scale-factors=1/1,1/1,1/1");
vpx_fixed_buf outputs[20]; vpx_fixed_buf outputs[20];
memset(&outputs[0], 0, sizeof(outputs)); memset(&outputs[0], 0, sizeof(outputs));
Pass2EncodeNFrames(&stats_buf, 20, 3, &outputs[0]); Pass2EncodeNFrames(&stats_buf, 20, 3, &outputs[0]);
@ -572,8 +563,7 @@ TEST_F(SvcTest, TwoPassEncode3SNRLayersDecode321Layers) {
TEST_F(SvcTest, SetMultipleFrameContextsOption) { TEST_F(SvcTest, SetMultipleFrameContextsOption) {
svc_.spatial_layers = 5; svc_.spatial_layers = 5;
vpx_codec_err_t res = vpx_codec_err_t res = vpx_svc_set_options(&svc_, "multi-frame-contexts=1");
vpx_svc_set_options(&svc_, "multi-frame-contexts=1");
EXPECT_EQ(VPX_CODEC_OK, res); EXPECT_EQ(VPX_CODEC_OK, res);
res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_); res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res); EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
@ -626,7 +616,8 @@ TEST_F(SvcTest, TwoPassEncode2SNRLayersWithMultipleFrameContexts) {
// Second pass encode // Second pass encode
codec_enc_.g_pass = VPX_RC_LAST_PASS; codec_enc_.g_pass = VPX_RC_LAST_PASS;
codec_enc_.g_error_resilient = 0; codec_enc_.g_error_resilient = 0;
vpx_svc_set_options(&svc_, "auto-alt-refs=1,1 scale-factors=1/1,1/1 " vpx_svc_set_options(&svc_,
"auto-alt-refs=1,1 scale-factors=1/1,1/1 "
"multi-frame-contexts=1"); "multi-frame-contexts=1");
vpx_fixed_buf outputs[10]; vpx_fixed_buf outputs[10];
memset(&outputs[0], 0, sizeof(outputs)); memset(&outputs[0], 0, sizeof(outputs));
@ -645,7 +636,8 @@ TEST_F(SvcTest,
// Second pass encode // Second pass encode
codec_enc_.g_pass = VPX_RC_LAST_PASS; codec_enc_.g_pass = VPX_RC_LAST_PASS;
codec_enc_.g_error_resilient = 0; codec_enc_.g_error_resilient = 0;
vpx_svc_set_options(&svc_, "auto-alt-refs=1,1,1 scale-factors=1/1,1/1,1/1 " vpx_svc_set_options(&svc_,
"auto-alt-refs=1,1,1 scale-factors=1/1,1/1,1/1 "
"multi-frame-contexts=1"); "multi-frame-contexts=1");
vpx_fixed_buf outputs[10]; vpx_fixed_buf outputs[10];
memset(&outputs[0], 0, sizeof(outputs)); memset(&outputs[0], 0, sizeof(outputs));
@ -689,7 +681,8 @@ TEST_F(SvcTest, TwoPassEncode2TemporalLayersWithMultipleFrameContexts) {
codec_enc_.g_pass = VPX_RC_LAST_PASS; codec_enc_.g_pass = VPX_RC_LAST_PASS;
svc_.temporal_layers = 2; svc_.temporal_layers = 2;
codec_enc_.g_error_resilient = 0; codec_enc_.g_error_resilient = 0;
vpx_svc_set_options(&svc_, "auto-alt-refs=1 scale-factors=1/1 " vpx_svc_set_options(&svc_,
"auto-alt-refs=1 scale-factors=1/1 "
"multi-frame-contexts=1"); "multi-frame-contexts=1");
vpx_fixed_buf outputs[10]; vpx_fixed_buf outputs[10];
memset(&outputs[0], 0, sizeof(outputs)); memset(&outputs[0], 0, sizeof(outputs));
@ -714,8 +707,7 @@ TEST_F(SvcTest, TwoPassEncode2TemporalLayersDecodeBaseLayer) {
Pass2EncodeNFrames(&stats_buf, 10, 1, &outputs[0]); Pass2EncodeNFrames(&stats_buf, 10, 1, &outputs[0]);
vpx_fixed_buf base_layer[5]; vpx_fixed_buf base_layer[5];
for (int i = 0; i < 5; ++i) for (int i = 0; i < 5; ++i) base_layer[i] = outputs[i * 2];
base_layer[i] = outputs[i * 2];
DecodeNFrames(&base_layer[0], 5); DecodeNFrames(&base_layer[0], 5);
FreeBitstreamBuffers(&outputs[0], 10); FreeBitstreamBuffers(&outputs[0], 10);
@ -733,15 +725,15 @@ TEST_F(SvcTest,
codec_enc_.g_pass = VPX_RC_LAST_PASS; codec_enc_.g_pass = VPX_RC_LAST_PASS;
svc_.temporal_layers = 2; svc_.temporal_layers = 2;
codec_enc_.g_error_resilient = 0; codec_enc_.g_error_resilient = 0;
vpx_svc_set_options(&svc_, "auto-alt-refs=1 scale-factors=1/1 " vpx_svc_set_options(&svc_,
"auto-alt-refs=1 scale-factors=1/1 "
"multi-frame-contexts=1"); "multi-frame-contexts=1");
vpx_fixed_buf outputs[10]; vpx_fixed_buf outputs[10];
memset(&outputs[0], 0, sizeof(outputs)); memset(&outputs[0], 0, sizeof(outputs));
Pass2EncodeNFrames(&stats_buf, 10, 1, &outputs[0]); Pass2EncodeNFrames(&stats_buf, 10, 1, &outputs[0]);
vpx_fixed_buf base_layer[5]; vpx_fixed_buf base_layer[5];
for (int i = 0; i < 5; ++i) for (int i = 0; i < 5; ++i) base_layer[i] = outputs[i * 2];
base_layer[i] = outputs[i * 2];
DecodeNFrames(&base_layer[0], 5); DecodeNFrames(&base_layer[0], 5);
FreeBitstreamBuffers(&outputs[0], 10); FreeBitstreamBuffers(&outputs[0], 10);
@ -769,8 +761,7 @@ TEST_F(SvcTest, TwoPassEncode2TemporalLayersWithTiles) {
FreeBitstreamBuffers(&outputs[0], 10); FreeBitstreamBuffers(&outputs[0], 10);
} }
TEST_F(SvcTest, TEST_F(SvcTest, TwoPassEncode2TemporalLayersWithMultipleFrameContextsAndTiles) {
TwoPassEncode2TemporalLayersWithMultipleFrameContextsAndTiles) {
// First pass encode // First pass encode
std::string stats_buf; std::string stats_buf;
vpx_svc_set_options(&svc_, "scale-factors=1/1"); vpx_svc_set_options(&svc_, "scale-factors=1/1");
@ -785,7 +776,8 @@ TEST_F(SvcTest,
codec_enc_.g_h = 144; codec_enc_.g_h = 144;
tile_columns_ = 1; tile_columns_ = 1;
tile_rows_ = 1; tile_rows_ = 1;
vpx_svc_set_options(&svc_, "auto-alt-refs=1 scale-factors=1/1 " vpx_svc_set_options(&svc_,
"auto-alt-refs=1 scale-factors=1/1 "
"multi-frame-contexts=1"); "multi-frame-contexts=1");
vpx_fixed_buf outputs[10]; vpx_fixed_buf outputs[10];
memset(&outputs[0], 0, sizeof(outputs)); memset(&outputs[0], 0, sizeof(outputs));

View File

@ -31,9 +31,9 @@ typedef void (*VpxPredFunc)(uint8_t *dst, ptrdiff_t y_stride,
const int kNumVp9IntraPredFuncs = 13; const int kNumVp9IntraPredFuncs = 13;
const char *kVp9IntraPredNames[kNumVp9IntraPredFuncs] = { const char *kVp9IntraPredNames[kNumVp9IntraPredFuncs] = {
"DC_PRED", "DC_LEFT_PRED", "DC_TOP_PRED", "DC_128_PRED", "V_PRED", "H_PRED", "DC_PRED", "DC_LEFT_PRED", "DC_TOP_PRED", "DC_128_PRED", "V_PRED",
"D45_PRED", "D135_PRED", "D117_PRED", "D153_PRED", "D207_PRED", "D63_PRED", "H_PRED", "D45_PRED", "D135_PRED", "D117_PRED", "D153_PRED",
"TM_PRED" "D207_PRED", "D63_PRED", "TM_PRED"
}; };
void TestIntraPred(const char name[], VpxPredFunc const *pred_funcs, void TestIntraPred(const char name[], VpxPredFunc const *pred_funcs,
@ -82,18 +82,12 @@ void TestIntraPred(const char name[], VpxPredFunc const *pred_funcs,
void TestIntraPred4(VpxPredFunc const *pred_funcs) { void TestIntraPred4(VpxPredFunc const *pred_funcs) {
static const int kNumVp9IntraFuncs = 13; static const int kNumVp9IntraFuncs = 13;
static const char *const kSignatures[kNumVp9IntraFuncs] = { static const char *const kSignatures[kNumVp9IntraFuncs] = {
"4334156168b34ab599d9b5b30f522fe9", "4334156168b34ab599d9b5b30f522fe9", "bc4649d5ba47c7ff178d92e475960fb0",
"bc4649d5ba47c7ff178d92e475960fb0", "8d316e5933326dcac24e1064794b5d12", "a27270fed024eafd762c95de85f4da51",
"8d316e5933326dcac24e1064794b5d12", "c33dff000d4256c2b8f3bf9e9bab14d2", "44d8cddc2ad8f79b8ed3306051722b4f",
"a27270fed024eafd762c95de85f4da51", "eb54839b2bad6699d8946f01ec041cd0", "ecb0d56ae5f677ea45127ce9d5c058e4",
"c33dff000d4256c2b8f3bf9e9bab14d2", "0b7936841f6813da818275944895b574", "9117972ef64f91a58ff73e1731c81db2",
"44d8cddc2ad8f79b8ed3306051722b4f", "c56d5e8c729e46825f46dd5d3b5d508a", "c0889e2039bcf7bcb5d2f33cdca69adc",
"eb54839b2bad6699d8946f01ec041cd0",
"ecb0d56ae5f677ea45127ce9d5c058e4",
"0b7936841f6813da818275944895b574",
"9117972ef64f91a58ff73e1731c81db2",
"c56d5e8c729e46825f46dd5d3b5d508a",
"c0889e2039bcf7bcb5d2f33cdca69adc",
"309a618577b27c648f9c5ee45252bc8f", "309a618577b27c648f9c5ee45252bc8f",
}; };
TestIntraPred("Intra4", pred_funcs, kVp9IntraPredNames, kNumVp9IntraFuncs, TestIntraPred("Intra4", pred_funcs, kVp9IntraPredNames, kNumVp9IntraFuncs,
@ -103,18 +97,12 @@ void TestIntraPred4(VpxPredFunc const *pred_funcs) {
void TestIntraPred8(VpxPredFunc const *pred_funcs) { void TestIntraPred8(VpxPredFunc const *pred_funcs) {
static const int kNumVp9IntraFuncs = 13; static const int kNumVp9IntraFuncs = 13;
static const char *const kSignatures[kNumVp9IntraFuncs] = { static const char *const kSignatures[kNumVp9IntraFuncs] = {
"7694ddeeefed887faf9d339d18850928", "7694ddeeefed887faf9d339d18850928", "7d726b1213591b99f736be6dec65065b",
"7d726b1213591b99f736be6dec65065b", "19c5711281357a485591aaf9c96c0a67", "ba6b66877a089e71cd938e3b8c40caac",
"19c5711281357a485591aaf9c96c0a67", "802440c93317e0f8ba93fab02ef74265", "9e09a47a15deb0b9d8372824f9805080",
"ba6b66877a089e71cd938e3b8c40caac", "b7c2d8c662268c0c427da412d7b0311d", "78339c1c60bb1d67d248ab8c4da08b7f",
"802440c93317e0f8ba93fab02ef74265", "5c97d70f7d47de1882a6cd86c165c8a9", "8182bf60688b42205acd95e59e967157",
"9e09a47a15deb0b9d8372824f9805080", "08323400005a297f16d7e57e7fe1eaac", "95f7bfc262329a5849eda66d8f7c68ce",
"b7c2d8c662268c0c427da412d7b0311d",
"78339c1c60bb1d67d248ab8c4da08b7f",
"5c97d70f7d47de1882a6cd86c165c8a9",
"8182bf60688b42205acd95e59e967157",
"08323400005a297f16d7e57e7fe1eaac",
"95f7bfc262329a5849eda66d8f7c68ce",
"815b75c8e0d91cc1ae766dc5d3e445a3", "815b75c8e0d91cc1ae766dc5d3e445a3",
}; };
TestIntraPred("Intra8", pred_funcs, kVp9IntraPredNames, kNumVp9IntraFuncs, TestIntraPred("Intra8", pred_funcs, kVp9IntraPredNames, kNumVp9IntraFuncs,
@ -124,18 +112,12 @@ void TestIntraPred8(VpxPredFunc const *pred_funcs) {
void TestIntraPred16(VpxPredFunc const *pred_funcs) { void TestIntraPred16(VpxPredFunc const *pred_funcs) {
static const int kNumVp9IntraFuncs = 13; static const int kNumVp9IntraFuncs = 13;
static const char *const kSignatures[kNumVp9IntraFuncs] = { static const char *const kSignatures[kNumVp9IntraFuncs] = {
"b40dbb555d5d16a043dc361e6694fe53", "b40dbb555d5d16a043dc361e6694fe53", "fb08118cee3b6405d64c1fd68be878c6",
"fb08118cee3b6405d64c1fd68be878c6", "6c190f341475c837cc38c2e566b64875", "db5c34ccbe2c7f595d9b08b0dc2c698c",
"6c190f341475c837cc38c2e566b64875", "a62cbfd153a1f0b9fed13e62b8408a7a", "143df5b4c89335e281103f610f5052e4",
"db5c34ccbe2c7f595d9b08b0dc2c698c", "d87feb124107cdf2cfb147655aa0bb3c", "7841fae7d4d47b519322e6a03eeed9dc",
"a62cbfd153a1f0b9fed13e62b8408a7a", "f6ebed3f71cbcf8d6d0516ce87e11093", "3cc480297dbfeed01a1c2d78dd03d0c5",
"143df5b4c89335e281103f610f5052e4", "b9f69fa6532b372c545397dcb78ef311", "a8fe1c70432f09d0c20c67bdb6432c4d",
"d87feb124107cdf2cfb147655aa0bb3c",
"7841fae7d4d47b519322e6a03eeed9dc",
"f6ebed3f71cbcf8d6d0516ce87e11093",
"3cc480297dbfeed01a1c2d78dd03d0c5",
"b9f69fa6532b372c545397dcb78ef311",
"a8fe1c70432f09d0c20c67bdb6432c4d",
"b8a41aa968ec108af447af4217cba91b", "b8a41aa968ec108af447af4217cba91b",
}; };
TestIntraPred("Intra16", pred_funcs, kVp9IntraPredNames, kNumVp9IntraFuncs, TestIntraPred("Intra16", pred_funcs, kVp9IntraPredNames, kNumVp9IntraFuncs,
@ -145,18 +127,12 @@ void TestIntraPred16(VpxPredFunc const *pred_funcs) {
void TestIntraPred32(VpxPredFunc const *pred_funcs) { void TestIntraPred32(VpxPredFunc const *pred_funcs) {
static const int kNumVp9IntraFuncs = 13; static const int kNumVp9IntraFuncs = 13;
static const char *const kSignatures[kNumVp9IntraFuncs] = { static const char *const kSignatures[kNumVp9IntraFuncs] = {
"558541656d84f9ae7896db655826febe", "558541656d84f9ae7896db655826febe", "b3587a1f9a01495fa38c8cd3c8e2a1bf",
"b3587a1f9a01495fa38c8cd3c8e2a1bf", "4c6501e64f25aacc55a2a16c7e8f0255", "b3b01379ba08916ef6b1b35f7d9ad51c",
"4c6501e64f25aacc55a2a16c7e8f0255", "0f1eb38b6cbddb3d496199ef9f329071", "911c06efb9ed1c3b4c104b232b55812f",
"b3b01379ba08916ef6b1b35f7d9ad51c", "9225beb0ddfa7a1d24eaa1be430a6654", "0a6d584a44f8db9aa7ade2e2fdb9fc9e",
"0f1eb38b6cbddb3d496199ef9f329071", "b01c9076525216925f3456f034fb6eee", "d267e20ad9e5cd2915d1a47254d3d149",
"911c06efb9ed1c3b4c104b232b55812f", "ed012a4a5da71f36c2393023184a0e59", "f162b51ed618d28b936974cff4391da5",
"9225beb0ddfa7a1d24eaa1be430a6654",
"0a6d584a44f8db9aa7ade2e2fdb9fc9e",
"b01c9076525216925f3456f034fb6eee",
"d267e20ad9e5cd2915d1a47254d3d149",
"ed012a4a5da71f36c2393023184a0e59",
"f162b51ed618d28b936974cff4391da5",
"9e1370c6d42e08d357d9612c93a71cfc", "9e1370c6d42e08d357d9612c93a71cfc",
}; };
TestIntraPred("Intra32", pred_funcs, kVp9IntraPredNames, kNumVp9IntraFuncs, TestIntraPred("Intra32", pred_funcs, kVp9IntraPredNames, kNumVp9IntraFuncs,
@ -171,8 +147,8 @@ void TestIntraPred32(VpxPredFunc const *pred_funcs) {
d45, d135, d117, d153, d207, d63, tm) \ d45, d135, d117, d153, d207, d63, tm) \
TEST(arch, test_func) { \ TEST(arch, test_func) { \
static const VpxPredFunc vpx_intra_pred[] = { \ static const VpxPredFunc vpx_intra_pred[] = { \
dc, dc_left, dc_top, dc_128, v, h, d45, \ dc, dc_left, dc_top, dc_128, v, h, d45, d135, d117, d153, d207, d63, tm \
d135, d117, d153, d207, d63, tm}; \ }; \
test_func(vpx_intra_pred); \ test_func(vpx_intra_pred); \
} }
@ -197,9 +173,8 @@ INTRA_PRED_TEST(SSE2, TestIntraPred4, vpx_dc_predictor_4x4_sse2,
#endif // HAVE_SSE2 #endif // HAVE_SSE2
#if HAVE_SSSE3 #if HAVE_SSSE3
INTRA_PRED_TEST(SSSE3, TestIntraPred4, NULL, NULL, NULL, NULL, NULL, INTRA_PRED_TEST(SSSE3, TestIntraPred4, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, vpx_d153_predictor_4x4_ssse3, NULL,
vpx_d153_predictor_4x4_ssse3, NULL,
vpx_d63_predictor_4x4_ssse3, NULL) vpx_d63_predictor_4x4_ssse3, NULL)
#endif // HAVE_SSSE3 #endif // HAVE_SSSE3
@ -222,8 +197,8 @@ INTRA_PRED_TEST(NEON, TestIntraPred4, vpx_dc_predictor_4x4_neon,
INTRA_PRED_TEST(MSA, TestIntraPred4, vpx_dc_predictor_4x4_msa, INTRA_PRED_TEST(MSA, TestIntraPred4, vpx_dc_predictor_4x4_msa,
vpx_dc_left_predictor_4x4_msa, vpx_dc_top_predictor_4x4_msa, vpx_dc_left_predictor_4x4_msa, vpx_dc_top_predictor_4x4_msa,
vpx_dc_128_predictor_4x4_msa, vpx_v_predictor_4x4_msa, vpx_dc_128_predictor_4x4_msa, vpx_v_predictor_4x4_msa,
vpx_h_predictor_4x4_msa, NULL, NULL, NULL, NULL, NULL, vpx_h_predictor_4x4_msa, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, vpx_tm_predictor_4x4_msa) vpx_tm_predictor_4x4_msa)
#endif // HAVE_MSA #endif // HAVE_MSA
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -246,10 +221,9 @@ INTRA_PRED_TEST(SSE2, TestIntraPred8, vpx_dc_predictor_8x8_sse2,
#endif // HAVE_SSE2 #endif // HAVE_SSE2
#if HAVE_SSSE3 #if HAVE_SSSE3
INTRA_PRED_TEST(SSSE3, TestIntraPred8, NULL, NULL, NULL, NULL, NULL, INTRA_PRED_TEST(SSSE3, TestIntraPred8, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, vpx_d153_predictor_8x8_ssse3,
vpx_d153_predictor_8x8_ssse3, vpx_d207_predictor_8x8_ssse3, vpx_d207_predictor_8x8_ssse3, vpx_d63_predictor_8x8_ssse3, NULL)
vpx_d63_predictor_8x8_ssse3, NULL)
#endif // HAVE_SSSE3 #endif // HAVE_SSSE3
#if HAVE_DSPR2 #if HAVE_DSPR2
@ -271,8 +245,8 @@ INTRA_PRED_TEST(NEON, TestIntraPred8, vpx_dc_predictor_8x8_neon,
INTRA_PRED_TEST(MSA, TestIntraPred8, vpx_dc_predictor_8x8_msa, INTRA_PRED_TEST(MSA, TestIntraPred8, vpx_dc_predictor_8x8_msa,
vpx_dc_left_predictor_8x8_msa, vpx_dc_top_predictor_8x8_msa, vpx_dc_left_predictor_8x8_msa, vpx_dc_top_predictor_8x8_msa,
vpx_dc_128_predictor_8x8_msa, vpx_v_predictor_8x8_msa, vpx_dc_128_predictor_8x8_msa, vpx_v_predictor_8x8_msa,
vpx_h_predictor_8x8_msa, NULL, NULL, NULL, NULL, NULL, vpx_h_predictor_8x8_msa, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, vpx_tm_predictor_8x8_msa) vpx_tm_predictor_8x8_msa)
#endif // HAVE_MSA #endif // HAVE_MSA
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -296,11 +270,10 @@ INTRA_PRED_TEST(SSE2, TestIntraPred16, vpx_dc_predictor_16x16_sse2,
#endif // HAVE_SSE2 #endif // HAVE_SSE2
#if HAVE_SSSE3 #if HAVE_SSSE3
INTRA_PRED_TEST(SSSE3, TestIntraPred16, NULL, NULL, NULL, NULL, NULL, INTRA_PRED_TEST(SSSE3, TestIntraPred16, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, vpx_d45_predictor_16x16_ssse3, vpx_d45_predictor_16x16_ssse3, NULL, NULL,
NULL, NULL, vpx_d153_predictor_16x16_ssse3, vpx_d153_predictor_16x16_ssse3, vpx_d207_predictor_16x16_ssse3,
vpx_d207_predictor_16x16_ssse3, vpx_d63_predictor_16x16_ssse3, vpx_d63_predictor_16x16_ssse3, NULL)
NULL)
#endif // HAVE_SSSE3 #endif // HAVE_SSSE3
#if HAVE_DSPR2 #if HAVE_DSPR2
@ -322,8 +295,8 @@ INTRA_PRED_TEST(NEON, TestIntraPred16, vpx_dc_predictor_16x16_neon,
INTRA_PRED_TEST(MSA, TestIntraPred16, vpx_dc_predictor_16x16_msa, INTRA_PRED_TEST(MSA, TestIntraPred16, vpx_dc_predictor_16x16_msa,
vpx_dc_left_predictor_16x16_msa, vpx_dc_top_predictor_16x16_msa, vpx_dc_left_predictor_16x16_msa, vpx_dc_top_predictor_16x16_msa,
vpx_dc_128_predictor_16x16_msa, vpx_v_predictor_16x16_msa, vpx_dc_128_predictor_16x16_msa, vpx_v_predictor_16x16_msa,
vpx_h_predictor_16x16_msa, NULL, NULL, NULL, NULL, NULL, vpx_h_predictor_16x16_msa, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, vpx_tm_predictor_16x16_msa) vpx_tm_predictor_16x16_msa)
#endif // HAVE_MSA #endif // HAVE_MSA
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -342,13 +315,13 @@ INTRA_PRED_TEST(SSE2, TestIntraPred32, vpx_dc_predictor_32x32_sse2,
vpx_dc_left_predictor_32x32_sse2, vpx_dc_left_predictor_32x32_sse2,
vpx_dc_top_predictor_32x32_sse2, vpx_dc_top_predictor_32x32_sse2,
vpx_dc_128_predictor_32x32_sse2, vpx_v_predictor_32x32_sse2, vpx_dc_128_predictor_32x32_sse2, vpx_v_predictor_32x32_sse2,
vpx_h_predictor_32x32_sse2, NULL, NULL, NULL, NULL, NULL, vpx_h_predictor_32x32_sse2, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, vpx_tm_predictor_32x32_sse2) vpx_tm_predictor_32x32_sse2)
#endif // HAVE_SSE2 #endif // HAVE_SSE2
#if HAVE_SSSE3 #if HAVE_SSSE3
INTRA_PRED_TEST(SSSE3, TestIntraPred32, NULL, NULL, NULL, NULL, NULL, INTRA_PRED_TEST(SSSE3, TestIntraPred32, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, vpx_d45_predictor_32x32_ssse3, NULL, NULL, vpx_d45_predictor_32x32_ssse3, NULL, NULL,
vpx_d153_predictor_32x32_ssse3, vpx_d207_predictor_32x32_ssse3, vpx_d153_predictor_32x32_ssse3, vpx_d207_predictor_32x32_ssse3,
vpx_d63_predictor_32x32_ssse3, NULL) vpx_d63_predictor_32x32_ssse3, NULL)
#endif // HAVE_SSSE3 #endif // HAVE_SSSE3
@ -366,8 +339,8 @@ INTRA_PRED_TEST(NEON, TestIntraPred32, vpx_dc_predictor_32x32_neon,
INTRA_PRED_TEST(MSA, TestIntraPred32, vpx_dc_predictor_32x32_msa, INTRA_PRED_TEST(MSA, TestIntraPred32, vpx_dc_predictor_32x32_msa,
vpx_dc_left_predictor_32x32_msa, vpx_dc_top_predictor_32x32_msa, vpx_dc_left_predictor_32x32_msa, vpx_dc_top_predictor_32x32_msa,
vpx_dc_128_predictor_32x32_msa, vpx_v_predictor_32x32_msa, vpx_dc_128_predictor_32x32_msa, vpx_v_predictor_32x32_msa,
vpx_h_predictor_32x32_msa, NULL, NULL, NULL, NULL, NULL, vpx_h_predictor_32x32_msa, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, vpx_tm_predictor_32x32_msa) vpx_tm_predictor_32x32_msa)
#endif // HAVE_MSA #endif // HAVE_MSA
#include "test/test_libvpx.cc" #include "test/test_libvpx.cc"

View File

@ -41,22 +41,16 @@ int main(int argc, char **argv) {
#if ARCH_X86 || ARCH_X86_64 #if ARCH_X86 || ARCH_X86_64
const int simd_caps = x86_simd_caps(); const int simd_caps = x86_simd_caps();
if (!(simd_caps & HAS_MMX)) if (!(simd_caps & HAS_MMX)) append_negative_gtest_filter(":MMX.*:MMX/*");
append_negative_gtest_filter(":MMX.*:MMX/*"); if (!(simd_caps & HAS_SSE)) append_negative_gtest_filter(":SSE.*:SSE/*");
if (!(simd_caps & HAS_SSE)) if (!(simd_caps & HAS_SSE2)) append_negative_gtest_filter(":SSE2.*:SSE2/*");
append_negative_gtest_filter(":SSE.*:SSE/*"); if (!(simd_caps & HAS_SSE3)) append_negative_gtest_filter(":SSE3.*:SSE3/*");
if (!(simd_caps & HAS_SSE2))
append_negative_gtest_filter(":SSE2.*:SSE2/*");
if (!(simd_caps & HAS_SSE3))
append_negative_gtest_filter(":SSE3.*:SSE3/*");
if (!(simd_caps & HAS_SSSE3)) if (!(simd_caps & HAS_SSSE3))
append_negative_gtest_filter(":SSSE3.*:SSSE3/*"); append_negative_gtest_filter(":SSSE3.*:SSSE3/*");
if (!(simd_caps & HAS_SSE4_1)) if (!(simd_caps & HAS_SSE4_1))
append_negative_gtest_filter(":SSE4_1.*:SSE4_1/*"); append_negative_gtest_filter(":SSE4_1.*:SSE4_1/*");
if (!(simd_caps & HAS_AVX)) if (!(simd_caps & HAS_AVX)) append_negative_gtest_filter(":AVX.*:AVX/*");
append_negative_gtest_filter(":AVX.*:AVX/*"); if (!(simd_caps & HAS_AVX2)) append_negative_gtest_filter(":AVX2.*:AVX2/*");
if (!(simd_caps & HAS_AVX2))
append_negative_gtest_filter(":AVX2.*:AVX2/*");
#endif // ARCH_X86 || ARCH_X86_64 #endif // ARCH_X86 || ARCH_X86_64
#if !CONFIG_SHARED #if !CONFIG_SHARED

View File

@ -28,10 +28,7 @@
namespace { namespace {
enum DecodeMode { enum DecodeMode { kSerialMode, kFrameParallelMode };
kSerialMode,
kFrameParallelMode
};
const int kDecodeMode = 0; const int kDecodeMode = 0;
const int kThreads = 1; const int kThreads = 1;
@ -42,20 +39,16 @@ typedef std::tr1::tuple<int, int, const char*> DecodeParam;
class TestVectorTest : public ::libvpx_test::DecoderTest, class TestVectorTest : public ::libvpx_test::DecoderTest,
public ::libvpx_test::CodecTestWithParam<DecodeParam> { public ::libvpx_test::CodecTestWithParam<DecodeParam> {
protected: protected:
TestVectorTest() TestVectorTest() : DecoderTest(GET_PARAM(0)), md5_file_(NULL) {
: DecoderTest(GET_PARAM(0)),
md5_file_(NULL) {
#if CONFIG_VP9_DECODER #if CONFIG_VP9_DECODER
resize_clips_.insert( resize_clips_.insert(::libvpx_test::kVP9TestVectorsResize,
::libvpx_test::kVP9TestVectorsResize,
::libvpx_test::kVP9TestVectorsResize + ::libvpx_test::kVP9TestVectorsResize +
::libvpx_test::kNumVP9TestVectorsResize); ::libvpx_test::kNumVP9TestVectorsResize);
#endif #endif
} }
virtual ~TestVectorTest() { virtual ~TestVectorTest() {
if (md5_file_) if (md5_file_) fclose(md5_file_);
fclose(md5_file_);
} }
void OpenMD5File(const std::string &md5_file_name_) { void OpenMD5File(const std::string &md5_file_name_) {
@ -121,8 +114,8 @@ TEST_P(TestVectorTest, MD5Match) {
cfg.threads = threads; cfg.threads = threads;
snprintf(str, sizeof(str) / sizeof(str[0]) - 1, snprintf(str, sizeof(str) / sizeof(str[0]) - 1,
"file: %s mode: %s threads: %d", "file: %s mode: %s threads: %d", filename.c_str(),
filename.c_str(), mode == 0 ? "Serial" : "Parallel", threads); mode == 0 ? "Serial" : "Parallel", threads);
SCOPED_TRACE(str); SCOPED_TRACE(str);
// Open compressed video file. // Open compressed video file.

View File

@ -16,43 +16,43 @@ namespace libvpx_test {
#if CONFIG_VP8_DECODER #if CONFIG_VP8_DECODER
const char *const kVP8TestVectors[] = { const char *const kVP8TestVectors[] = {
"vp80-00-comprehensive-001.ivf", "vp80-00-comprehensive-001.ivf", "vp80-00-comprehensive-002.ivf",
"vp80-00-comprehensive-002.ivf", "vp80-00-comprehensive-003.ivf", "vp80-00-comprehensive-003.ivf", "vp80-00-comprehensive-004.ivf",
"vp80-00-comprehensive-004.ivf", "vp80-00-comprehensive-005.ivf", "vp80-00-comprehensive-005.ivf", "vp80-00-comprehensive-006.ivf",
"vp80-00-comprehensive-006.ivf", "vp80-00-comprehensive-007.ivf", "vp80-00-comprehensive-007.ivf", "vp80-00-comprehensive-008.ivf",
"vp80-00-comprehensive-008.ivf", "vp80-00-comprehensive-009.ivf", "vp80-00-comprehensive-009.ivf", "vp80-00-comprehensive-010.ivf",
"vp80-00-comprehensive-010.ivf", "vp80-00-comprehensive-011.ivf", "vp80-00-comprehensive-011.ivf", "vp80-00-comprehensive-012.ivf",
"vp80-00-comprehensive-012.ivf", "vp80-00-comprehensive-013.ivf", "vp80-00-comprehensive-013.ivf", "vp80-00-comprehensive-014.ivf",
"vp80-00-comprehensive-014.ivf", "vp80-00-comprehensive-015.ivf", "vp80-00-comprehensive-015.ivf", "vp80-00-comprehensive-016.ivf",
"vp80-00-comprehensive-016.ivf", "vp80-00-comprehensive-017.ivf", "vp80-00-comprehensive-017.ivf", "vp80-00-comprehensive-018.ivf",
"vp80-00-comprehensive-018.ivf", "vp80-01-intra-1400.ivf", "vp80-01-intra-1400.ivf", "vp80-01-intra-1411.ivf",
"vp80-01-intra-1411.ivf", "vp80-01-intra-1416.ivf", "vp80-01-intra-1416.ivf", "vp80-01-intra-1417.ivf",
"vp80-01-intra-1417.ivf", "vp80-02-inter-1402.ivf", "vp80-02-inter-1402.ivf", "vp80-02-inter-1412.ivf",
"vp80-02-inter-1412.ivf", "vp80-02-inter-1418.ivf", "vp80-02-inter-1418.ivf", "vp80-02-inter-1424.ivf",
"vp80-02-inter-1424.ivf", "vp80-03-segmentation-01.ivf", "vp80-03-segmentation-01.ivf", "vp80-03-segmentation-02.ivf",
"vp80-03-segmentation-02.ivf", "vp80-03-segmentation-03.ivf", "vp80-03-segmentation-03.ivf", "vp80-03-segmentation-04.ivf",
"vp80-03-segmentation-04.ivf", "vp80-03-segmentation-1401.ivf", "vp80-03-segmentation-1401.ivf", "vp80-03-segmentation-1403.ivf",
"vp80-03-segmentation-1403.ivf", "vp80-03-segmentation-1407.ivf", "vp80-03-segmentation-1407.ivf", "vp80-03-segmentation-1408.ivf",
"vp80-03-segmentation-1408.ivf", "vp80-03-segmentation-1409.ivf", "vp80-03-segmentation-1409.ivf", "vp80-03-segmentation-1410.ivf",
"vp80-03-segmentation-1410.ivf", "vp80-03-segmentation-1413.ivf", "vp80-03-segmentation-1413.ivf", "vp80-03-segmentation-1414.ivf",
"vp80-03-segmentation-1414.ivf", "vp80-03-segmentation-1415.ivf", "vp80-03-segmentation-1415.ivf", "vp80-03-segmentation-1425.ivf",
"vp80-03-segmentation-1425.ivf", "vp80-03-segmentation-1426.ivf", "vp80-03-segmentation-1426.ivf", "vp80-03-segmentation-1427.ivf",
"vp80-03-segmentation-1427.ivf", "vp80-03-segmentation-1432.ivf", "vp80-03-segmentation-1432.ivf", "vp80-03-segmentation-1435.ivf",
"vp80-03-segmentation-1435.ivf", "vp80-03-segmentation-1436.ivf", "vp80-03-segmentation-1436.ivf", "vp80-03-segmentation-1437.ivf",
"vp80-03-segmentation-1437.ivf", "vp80-03-segmentation-1441.ivf", "vp80-03-segmentation-1441.ivf", "vp80-03-segmentation-1442.ivf",
"vp80-03-segmentation-1442.ivf", "vp80-04-partitions-1404.ivf", "vp80-04-partitions-1404.ivf", "vp80-04-partitions-1405.ivf",
"vp80-04-partitions-1405.ivf", "vp80-04-partitions-1406.ivf", "vp80-04-partitions-1406.ivf", "vp80-05-sharpness-1428.ivf",
"vp80-05-sharpness-1428.ivf", "vp80-05-sharpness-1429.ivf", "vp80-05-sharpness-1429.ivf", "vp80-05-sharpness-1430.ivf",
"vp80-05-sharpness-1430.ivf", "vp80-05-sharpness-1431.ivf", "vp80-05-sharpness-1431.ivf", "vp80-05-sharpness-1433.ivf",
"vp80-05-sharpness-1433.ivf", "vp80-05-sharpness-1434.ivf", "vp80-05-sharpness-1434.ivf", "vp80-05-sharpness-1438.ivf",
"vp80-05-sharpness-1438.ivf", "vp80-05-sharpness-1439.ivf", "vp80-05-sharpness-1439.ivf", "vp80-05-sharpness-1440.ivf",
"vp80-05-sharpness-1440.ivf", "vp80-05-sharpness-1443.ivf", "vp80-05-sharpness-1443.ivf", "vp80-06-smallsize.ivf"
"vp80-06-smallsize.ivf"
}; };
const int kNumVP8TestVectors = NELEMENTS(kVP8TestVectors); const int kNumVP8TestVectors = NELEMENTS(kVP8TestVectors);
#endif // CONFIG_VP8_DECODER #endif // CONFIG_VP8_DECODER
#if CONFIG_VP9_DECODER #if CONFIG_VP9_DECODER
#define RESIZE_TEST_VECTORS "vp90-2-21-resize_inter_320x180_5_1-2.webm", \ #define RESIZE_TEST_VECTORS \
"vp90-2-21-resize_inter_320x180_5_1-2.webm", \
"vp90-2-21-resize_inter_320x180_5_3-4.webm", \ "vp90-2-21-resize_inter_320x180_5_3-4.webm", \
"vp90-2-21-resize_inter_320x180_7_1-2.webm", \ "vp90-2-21-resize_inter_320x180_7_1-2.webm", \
"vp90-2-21-resize_inter_320x180_7_3-4.webm", \ "vp90-2-21-resize_inter_320x180_7_3-4.webm", \
@ -78,139 +78,262 @@ const int kNumVP8TestVectors = NELEMENTS(kVP8TestVectors);
"vp90-2-21-resize_inter_1920x1080_7_3-4.webm", "vp90-2-21-resize_inter_1920x1080_7_3-4.webm",
const char *const kVP9TestVectors[] = { const char *const kVP9TestVectors[] = {
"vp90-2-00-quantizer-00.webm", "vp90-2-00-quantizer-01.webm", "vp90-2-00-quantizer-00.webm",
"vp90-2-00-quantizer-02.webm", "vp90-2-00-quantizer-03.webm", "vp90-2-00-quantizer-01.webm",
"vp90-2-00-quantizer-04.webm", "vp90-2-00-quantizer-05.webm", "vp90-2-00-quantizer-02.webm",
"vp90-2-00-quantizer-06.webm", "vp90-2-00-quantizer-07.webm", "vp90-2-00-quantizer-03.webm",
"vp90-2-00-quantizer-08.webm", "vp90-2-00-quantizer-09.webm", "vp90-2-00-quantizer-04.webm",
"vp90-2-00-quantizer-10.webm", "vp90-2-00-quantizer-11.webm", "vp90-2-00-quantizer-05.webm",
"vp90-2-00-quantizer-12.webm", "vp90-2-00-quantizer-13.webm", "vp90-2-00-quantizer-06.webm",
"vp90-2-00-quantizer-14.webm", "vp90-2-00-quantizer-15.webm", "vp90-2-00-quantizer-07.webm",
"vp90-2-00-quantizer-16.webm", "vp90-2-00-quantizer-17.webm", "vp90-2-00-quantizer-08.webm",
"vp90-2-00-quantizer-18.webm", "vp90-2-00-quantizer-19.webm", "vp90-2-00-quantizer-09.webm",
"vp90-2-00-quantizer-20.webm", "vp90-2-00-quantizer-21.webm", "vp90-2-00-quantizer-10.webm",
"vp90-2-00-quantizer-22.webm", "vp90-2-00-quantizer-23.webm", "vp90-2-00-quantizer-11.webm",
"vp90-2-00-quantizer-24.webm", "vp90-2-00-quantizer-25.webm", "vp90-2-00-quantizer-12.webm",
"vp90-2-00-quantizer-26.webm", "vp90-2-00-quantizer-27.webm", "vp90-2-00-quantizer-13.webm",
"vp90-2-00-quantizer-28.webm", "vp90-2-00-quantizer-29.webm", "vp90-2-00-quantizer-14.webm",
"vp90-2-00-quantizer-30.webm", "vp90-2-00-quantizer-31.webm", "vp90-2-00-quantizer-15.webm",
"vp90-2-00-quantizer-32.webm", "vp90-2-00-quantizer-33.webm", "vp90-2-00-quantizer-16.webm",
"vp90-2-00-quantizer-34.webm", "vp90-2-00-quantizer-35.webm", "vp90-2-00-quantizer-17.webm",
"vp90-2-00-quantizer-36.webm", "vp90-2-00-quantizer-37.webm", "vp90-2-00-quantizer-18.webm",
"vp90-2-00-quantizer-38.webm", "vp90-2-00-quantizer-39.webm", "vp90-2-00-quantizer-19.webm",
"vp90-2-00-quantizer-40.webm", "vp90-2-00-quantizer-41.webm", "vp90-2-00-quantizer-20.webm",
"vp90-2-00-quantizer-42.webm", "vp90-2-00-quantizer-43.webm", "vp90-2-00-quantizer-21.webm",
"vp90-2-00-quantizer-44.webm", "vp90-2-00-quantizer-45.webm", "vp90-2-00-quantizer-22.webm",
"vp90-2-00-quantizer-46.webm", "vp90-2-00-quantizer-47.webm", "vp90-2-00-quantizer-23.webm",
"vp90-2-00-quantizer-48.webm", "vp90-2-00-quantizer-49.webm", "vp90-2-00-quantizer-24.webm",
"vp90-2-00-quantizer-50.webm", "vp90-2-00-quantizer-51.webm", "vp90-2-00-quantizer-25.webm",
"vp90-2-00-quantizer-52.webm", "vp90-2-00-quantizer-53.webm", "vp90-2-00-quantizer-26.webm",
"vp90-2-00-quantizer-54.webm", "vp90-2-00-quantizer-55.webm", "vp90-2-00-quantizer-27.webm",
"vp90-2-00-quantizer-56.webm", "vp90-2-00-quantizer-57.webm", "vp90-2-00-quantizer-28.webm",
"vp90-2-00-quantizer-58.webm", "vp90-2-00-quantizer-59.webm", "vp90-2-00-quantizer-29.webm",
"vp90-2-00-quantizer-60.webm", "vp90-2-00-quantizer-61.webm", "vp90-2-00-quantizer-30.webm",
"vp90-2-00-quantizer-62.webm", "vp90-2-00-quantizer-63.webm", "vp90-2-00-quantizer-31.webm",
"vp90-2-01-sharpness-1.webm", "vp90-2-01-sharpness-2.webm", "vp90-2-00-quantizer-32.webm",
"vp90-2-01-sharpness-3.webm", "vp90-2-01-sharpness-4.webm", "vp90-2-00-quantizer-33.webm",
"vp90-2-01-sharpness-5.webm", "vp90-2-01-sharpness-6.webm", "vp90-2-00-quantizer-34.webm",
"vp90-2-01-sharpness-7.webm", "vp90-2-02-size-08x08.webm", "vp90-2-00-quantizer-35.webm",
"vp90-2-02-size-08x10.webm", "vp90-2-02-size-08x16.webm", "vp90-2-00-quantizer-36.webm",
"vp90-2-02-size-08x18.webm", "vp90-2-02-size-08x32.webm", "vp90-2-00-quantizer-37.webm",
"vp90-2-02-size-08x34.webm", "vp90-2-02-size-08x64.webm", "vp90-2-00-quantizer-38.webm",
"vp90-2-02-size-08x66.webm", "vp90-2-02-size-10x08.webm", "vp90-2-00-quantizer-39.webm",
"vp90-2-02-size-10x10.webm", "vp90-2-02-size-10x16.webm", "vp90-2-00-quantizer-40.webm",
"vp90-2-02-size-10x18.webm", "vp90-2-02-size-10x32.webm", "vp90-2-00-quantizer-41.webm",
"vp90-2-02-size-10x34.webm", "vp90-2-02-size-10x64.webm", "vp90-2-00-quantizer-42.webm",
"vp90-2-02-size-10x66.webm", "vp90-2-02-size-16x08.webm", "vp90-2-00-quantizer-43.webm",
"vp90-2-02-size-16x10.webm", "vp90-2-02-size-16x16.webm", "vp90-2-00-quantizer-44.webm",
"vp90-2-02-size-16x18.webm", "vp90-2-02-size-16x32.webm", "vp90-2-00-quantizer-45.webm",
"vp90-2-02-size-16x34.webm", "vp90-2-02-size-16x64.webm", "vp90-2-00-quantizer-46.webm",
"vp90-2-02-size-16x66.webm", "vp90-2-02-size-18x08.webm", "vp90-2-00-quantizer-47.webm",
"vp90-2-02-size-18x10.webm", "vp90-2-02-size-18x16.webm", "vp90-2-00-quantizer-48.webm",
"vp90-2-02-size-18x18.webm", "vp90-2-02-size-18x32.webm", "vp90-2-00-quantizer-49.webm",
"vp90-2-02-size-18x34.webm", "vp90-2-02-size-18x64.webm", "vp90-2-00-quantizer-50.webm",
"vp90-2-02-size-18x66.webm", "vp90-2-02-size-32x08.webm", "vp90-2-00-quantizer-51.webm",
"vp90-2-02-size-32x10.webm", "vp90-2-02-size-32x16.webm", "vp90-2-00-quantizer-52.webm",
"vp90-2-02-size-32x18.webm", "vp90-2-02-size-32x32.webm", "vp90-2-00-quantizer-53.webm",
"vp90-2-02-size-32x34.webm", "vp90-2-02-size-32x64.webm", "vp90-2-00-quantizer-54.webm",
"vp90-2-02-size-32x66.webm", "vp90-2-02-size-34x08.webm", "vp90-2-00-quantizer-55.webm",
"vp90-2-02-size-34x10.webm", "vp90-2-02-size-34x16.webm", "vp90-2-00-quantizer-56.webm",
"vp90-2-02-size-34x18.webm", "vp90-2-02-size-34x32.webm", "vp90-2-00-quantizer-57.webm",
"vp90-2-02-size-34x34.webm", "vp90-2-02-size-34x64.webm", "vp90-2-00-quantizer-58.webm",
"vp90-2-02-size-34x66.webm", "vp90-2-02-size-64x08.webm", "vp90-2-00-quantizer-59.webm",
"vp90-2-02-size-64x10.webm", "vp90-2-02-size-64x16.webm", "vp90-2-00-quantizer-60.webm",
"vp90-2-02-size-64x18.webm", "vp90-2-02-size-64x32.webm", "vp90-2-00-quantizer-61.webm",
"vp90-2-02-size-64x34.webm", "vp90-2-02-size-64x64.webm", "vp90-2-00-quantizer-62.webm",
"vp90-2-02-size-64x66.webm", "vp90-2-02-size-66x08.webm", "vp90-2-00-quantizer-63.webm",
"vp90-2-02-size-66x10.webm", "vp90-2-02-size-66x16.webm", "vp90-2-01-sharpness-1.webm",
"vp90-2-02-size-66x18.webm", "vp90-2-02-size-66x32.webm", "vp90-2-01-sharpness-2.webm",
"vp90-2-02-size-66x34.webm", "vp90-2-02-size-66x64.webm", "vp90-2-01-sharpness-3.webm",
"vp90-2-02-size-66x66.webm", "vp90-2-02-size-130x132.webm", "vp90-2-01-sharpness-4.webm",
"vp90-2-02-size-132x130.webm", "vp90-2-02-size-132x132.webm", "vp90-2-01-sharpness-5.webm",
"vp90-2-02-size-178x180.webm", "vp90-2-02-size-180x178.webm", "vp90-2-01-sharpness-6.webm",
"vp90-2-02-size-180x180.webm", "vp90-2-03-size-196x196.webm", "vp90-2-01-sharpness-7.webm",
"vp90-2-03-size-196x198.webm", "vp90-2-03-size-196x200.webm", "vp90-2-02-size-08x08.webm",
"vp90-2-03-size-196x202.webm", "vp90-2-03-size-196x208.webm", "vp90-2-02-size-08x10.webm",
"vp90-2-03-size-196x210.webm", "vp90-2-03-size-196x224.webm", "vp90-2-02-size-08x16.webm",
"vp90-2-03-size-196x226.webm", "vp90-2-03-size-198x196.webm", "vp90-2-02-size-08x18.webm",
"vp90-2-03-size-198x198.webm", "vp90-2-03-size-198x200.webm", "vp90-2-02-size-08x32.webm",
"vp90-2-03-size-198x202.webm", "vp90-2-03-size-198x208.webm", "vp90-2-02-size-08x34.webm",
"vp90-2-03-size-198x210.webm", "vp90-2-03-size-198x224.webm", "vp90-2-02-size-08x64.webm",
"vp90-2-03-size-198x226.webm", "vp90-2-03-size-200x196.webm", "vp90-2-02-size-08x66.webm",
"vp90-2-03-size-200x198.webm", "vp90-2-03-size-200x200.webm", "vp90-2-02-size-10x08.webm",
"vp90-2-03-size-200x202.webm", "vp90-2-03-size-200x208.webm", "vp90-2-02-size-10x10.webm",
"vp90-2-03-size-200x210.webm", "vp90-2-03-size-200x224.webm", "vp90-2-02-size-10x16.webm",
"vp90-2-03-size-200x226.webm", "vp90-2-03-size-202x196.webm", "vp90-2-02-size-10x18.webm",
"vp90-2-03-size-202x198.webm", "vp90-2-03-size-202x200.webm", "vp90-2-02-size-10x32.webm",
"vp90-2-03-size-202x202.webm", "vp90-2-03-size-202x208.webm", "vp90-2-02-size-10x34.webm",
"vp90-2-03-size-202x210.webm", "vp90-2-03-size-202x224.webm", "vp90-2-02-size-10x64.webm",
"vp90-2-03-size-202x226.webm", "vp90-2-03-size-208x196.webm", "vp90-2-02-size-10x66.webm",
"vp90-2-03-size-208x198.webm", "vp90-2-03-size-208x200.webm", "vp90-2-02-size-16x08.webm",
"vp90-2-03-size-208x202.webm", "vp90-2-03-size-208x208.webm", "vp90-2-02-size-16x10.webm",
"vp90-2-03-size-208x210.webm", "vp90-2-03-size-208x224.webm", "vp90-2-02-size-16x16.webm",
"vp90-2-03-size-208x226.webm", "vp90-2-03-size-210x196.webm", "vp90-2-02-size-16x18.webm",
"vp90-2-03-size-210x198.webm", "vp90-2-03-size-210x200.webm", "vp90-2-02-size-16x32.webm",
"vp90-2-03-size-210x202.webm", "vp90-2-03-size-210x208.webm", "vp90-2-02-size-16x34.webm",
"vp90-2-03-size-210x210.webm", "vp90-2-03-size-210x224.webm", "vp90-2-02-size-16x64.webm",
"vp90-2-03-size-210x226.webm", "vp90-2-03-size-224x196.webm", "vp90-2-02-size-16x66.webm",
"vp90-2-03-size-224x198.webm", "vp90-2-03-size-224x200.webm", "vp90-2-02-size-18x08.webm",
"vp90-2-03-size-224x202.webm", "vp90-2-03-size-224x208.webm", "vp90-2-02-size-18x10.webm",
"vp90-2-03-size-224x210.webm", "vp90-2-03-size-224x224.webm", "vp90-2-02-size-18x16.webm",
"vp90-2-03-size-224x226.webm", "vp90-2-03-size-226x196.webm", "vp90-2-02-size-18x18.webm",
"vp90-2-03-size-226x198.webm", "vp90-2-03-size-226x200.webm", "vp90-2-02-size-18x32.webm",
"vp90-2-03-size-226x202.webm", "vp90-2-03-size-226x208.webm", "vp90-2-02-size-18x34.webm",
"vp90-2-03-size-226x210.webm", "vp90-2-03-size-226x224.webm", "vp90-2-02-size-18x64.webm",
"vp90-2-03-size-226x226.webm", "vp90-2-03-size-352x288.webm", "vp90-2-02-size-18x66.webm",
"vp90-2-02-size-32x08.webm",
"vp90-2-02-size-32x10.webm",
"vp90-2-02-size-32x16.webm",
"vp90-2-02-size-32x18.webm",
"vp90-2-02-size-32x32.webm",
"vp90-2-02-size-32x34.webm",
"vp90-2-02-size-32x64.webm",
"vp90-2-02-size-32x66.webm",
"vp90-2-02-size-34x08.webm",
"vp90-2-02-size-34x10.webm",
"vp90-2-02-size-34x16.webm",
"vp90-2-02-size-34x18.webm",
"vp90-2-02-size-34x32.webm",
"vp90-2-02-size-34x34.webm",
"vp90-2-02-size-34x64.webm",
"vp90-2-02-size-34x66.webm",
"vp90-2-02-size-64x08.webm",
"vp90-2-02-size-64x10.webm",
"vp90-2-02-size-64x16.webm",
"vp90-2-02-size-64x18.webm",
"vp90-2-02-size-64x32.webm",
"vp90-2-02-size-64x34.webm",
"vp90-2-02-size-64x64.webm",
"vp90-2-02-size-64x66.webm",
"vp90-2-02-size-66x08.webm",
"vp90-2-02-size-66x10.webm",
"vp90-2-02-size-66x16.webm",
"vp90-2-02-size-66x18.webm",
"vp90-2-02-size-66x32.webm",
"vp90-2-02-size-66x34.webm",
"vp90-2-02-size-66x64.webm",
"vp90-2-02-size-66x66.webm",
"vp90-2-02-size-130x132.webm",
"vp90-2-02-size-132x130.webm",
"vp90-2-02-size-132x132.webm",
"vp90-2-02-size-178x180.webm",
"vp90-2-02-size-180x178.webm",
"vp90-2-02-size-180x180.webm",
"vp90-2-03-size-196x196.webm",
"vp90-2-03-size-196x198.webm",
"vp90-2-03-size-196x200.webm",
"vp90-2-03-size-196x202.webm",
"vp90-2-03-size-196x208.webm",
"vp90-2-03-size-196x210.webm",
"vp90-2-03-size-196x224.webm",
"vp90-2-03-size-196x226.webm",
"vp90-2-03-size-198x196.webm",
"vp90-2-03-size-198x198.webm",
"vp90-2-03-size-198x200.webm",
"vp90-2-03-size-198x202.webm",
"vp90-2-03-size-198x208.webm",
"vp90-2-03-size-198x210.webm",
"vp90-2-03-size-198x224.webm",
"vp90-2-03-size-198x226.webm",
"vp90-2-03-size-200x196.webm",
"vp90-2-03-size-200x198.webm",
"vp90-2-03-size-200x200.webm",
"vp90-2-03-size-200x202.webm",
"vp90-2-03-size-200x208.webm",
"vp90-2-03-size-200x210.webm",
"vp90-2-03-size-200x224.webm",
"vp90-2-03-size-200x226.webm",
"vp90-2-03-size-202x196.webm",
"vp90-2-03-size-202x198.webm",
"vp90-2-03-size-202x200.webm",
"vp90-2-03-size-202x202.webm",
"vp90-2-03-size-202x208.webm",
"vp90-2-03-size-202x210.webm",
"vp90-2-03-size-202x224.webm",
"vp90-2-03-size-202x226.webm",
"vp90-2-03-size-208x196.webm",
"vp90-2-03-size-208x198.webm",
"vp90-2-03-size-208x200.webm",
"vp90-2-03-size-208x202.webm",
"vp90-2-03-size-208x208.webm",
"vp90-2-03-size-208x210.webm",
"vp90-2-03-size-208x224.webm",
"vp90-2-03-size-208x226.webm",
"vp90-2-03-size-210x196.webm",
"vp90-2-03-size-210x198.webm",
"vp90-2-03-size-210x200.webm",
"vp90-2-03-size-210x202.webm",
"vp90-2-03-size-210x208.webm",
"vp90-2-03-size-210x210.webm",
"vp90-2-03-size-210x224.webm",
"vp90-2-03-size-210x226.webm",
"vp90-2-03-size-224x196.webm",
"vp90-2-03-size-224x198.webm",
"vp90-2-03-size-224x200.webm",
"vp90-2-03-size-224x202.webm",
"vp90-2-03-size-224x208.webm",
"vp90-2-03-size-224x210.webm",
"vp90-2-03-size-224x224.webm",
"vp90-2-03-size-224x226.webm",
"vp90-2-03-size-226x196.webm",
"vp90-2-03-size-226x198.webm",
"vp90-2-03-size-226x200.webm",
"vp90-2-03-size-226x202.webm",
"vp90-2-03-size-226x208.webm",
"vp90-2-03-size-226x210.webm",
"vp90-2-03-size-226x224.webm",
"vp90-2-03-size-226x226.webm",
"vp90-2-03-size-352x288.webm",
"vp90-2-03-deltaq.webm", "vp90-2-03-deltaq.webm",
"vp90-2-05-resize.ivf", "vp90-2-06-bilinear.webm", "vp90-2-05-resize.ivf",
"vp90-2-07-frame_parallel.webm", "vp90-2-08-tile_1x2_frame_parallel.webm", "vp90-2-06-bilinear.webm",
"vp90-2-08-tile_1x2.webm", "vp90-2-08-tile_1x4_frame_parallel.webm", "vp90-2-07-frame_parallel.webm",
"vp90-2-08-tile_1x4.webm", "vp90-2-08-tile_1x8_frame_parallel.webm", "vp90-2-08-tile_1x2_frame_parallel.webm",
"vp90-2-08-tile_1x8.webm", "vp90-2-08-tile-4x4.webm", "vp90-2-08-tile_1x2.webm",
"vp90-2-08-tile-4x1.webm", "vp90-2-09-subpixel-00.ivf", "vp90-2-08-tile_1x4_frame_parallel.webm",
"vp90-2-02-size-lf-1920x1080.webm", "vp90-2-09-aq2.webm", "vp90-2-08-tile_1x4.webm",
"vp90-2-09-lf_deltas.webm", "vp90-2-10-show-existing-frame.webm", "vp90-2-08-tile_1x8_frame_parallel.webm",
"vp90-2-08-tile_1x8.webm",
"vp90-2-08-tile-4x4.webm",
"vp90-2-08-tile-4x1.webm",
"vp90-2-09-subpixel-00.ivf",
"vp90-2-02-size-lf-1920x1080.webm",
"vp90-2-09-aq2.webm",
"vp90-2-09-lf_deltas.webm",
"vp90-2-10-show-existing-frame.webm",
"vp90-2-10-show-existing-frame2.webm", "vp90-2-10-show-existing-frame2.webm",
"vp90-2-11-size-351x287.webm", "vp90-2-11-size-351x288.webm", "vp90-2-11-size-351x287.webm",
"vp90-2-11-size-352x287.webm", "vp90-2-12-droppable_1.ivf", "vp90-2-11-size-351x288.webm",
"vp90-2-12-droppable_2.ivf", "vp90-2-12-droppable_3.ivf", "vp90-2-11-size-352x287.webm",
"vp90-2-12-droppable_1.ivf",
"vp90-2-12-droppable_2.ivf",
"vp90-2-12-droppable_3.ivf",
#if !CONFIG_SIZE_LIMIT || \ #if !CONFIG_SIZE_LIMIT || \
(DECODE_WIDTH_LIMIT >= 20400 && DECODE_HEIGHT_LIMIT >= 120) (DECODE_WIDTH_LIMIT >= 20400 && DECODE_HEIGHT_LIMIT >= 120)
"vp90-2-13-largescaling.webm", "vp90-2-13-largescaling.webm",
#endif #endif
"vp90-2-14-resize-fp-tiles-1-16.webm", "vp90-2-14-resize-fp-tiles-1-16.webm",
"vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm", "vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm",
"vp90-2-14-resize-fp-tiles-1-2.webm", "vp90-2-14-resize-fp-tiles-1-4.webm", "vp90-2-14-resize-fp-tiles-1-2.webm",
"vp90-2-14-resize-fp-tiles-16-1.webm", "vp90-2-14-resize-fp-tiles-16-2.webm", "vp90-2-14-resize-fp-tiles-1-4.webm",
"vp90-2-14-resize-fp-tiles-16-1.webm",
"vp90-2-14-resize-fp-tiles-16-2.webm",
"vp90-2-14-resize-fp-tiles-16-4.webm", "vp90-2-14-resize-fp-tiles-16-4.webm",
"vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm", "vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm",
"vp90-2-14-resize-fp-tiles-16-8.webm", "vp90-2-14-resize-fp-tiles-1-8.webm", "vp90-2-14-resize-fp-tiles-16-8.webm",
"vp90-2-14-resize-fp-tiles-2-16.webm", "vp90-2-14-resize-fp-tiles-2-1.webm", "vp90-2-14-resize-fp-tiles-1-8.webm",
"vp90-2-14-resize-fp-tiles-2-4.webm", "vp90-2-14-resize-fp-tiles-2-8.webm", "vp90-2-14-resize-fp-tiles-2-16.webm",
"vp90-2-14-resize-fp-tiles-4-16.webm", "vp90-2-14-resize-fp-tiles-4-1.webm", "vp90-2-14-resize-fp-tiles-2-1.webm",
"vp90-2-14-resize-fp-tiles-4-2.webm", "vp90-2-14-resize-fp-tiles-4-8.webm", "vp90-2-14-resize-fp-tiles-2-4.webm",
"vp90-2-14-resize-fp-tiles-8-16.webm", "vp90-2-14-resize-fp-tiles-8-1.webm", "vp90-2-14-resize-fp-tiles-2-8.webm",
"vp90-2-14-resize-fp-tiles-8-2.webm", "vp90-2-14-resize-fp-tiles-8-4.webm", "vp90-2-14-resize-fp-tiles-4-16.webm",
"vp90-2-14-resize-fp-tiles-4-1.webm",
"vp90-2-14-resize-fp-tiles-4-2.webm",
"vp90-2-14-resize-fp-tiles-4-8.webm",
"vp90-2-14-resize-fp-tiles-8-16.webm",
"vp90-2-14-resize-fp-tiles-8-1.webm",
"vp90-2-14-resize-fp-tiles-8-2.webm",
"vp90-2-14-resize-fp-tiles-8-4.webm",
"vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm", "vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm",
"vp90-2-14-resize-10frames-fp-tiles-1-2.webm", "vp90-2-14-resize-10frames-fp-tiles-1-2.webm",
"vp90-2-14-resize-10frames-fp-tiles-1-4.webm", "vp90-2-14-resize-10frames-fp-tiles-1-4.webm",
@ -225,25 +348,33 @@ const char *const kVP9TestVectors[] = {
"vp90-2-14-resize-10frames-fp-tiles-8-2.webm", "vp90-2-14-resize-10frames-fp-tiles-8-2.webm",
"vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm", "vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm",
"vp90-2-14-resize-10frames-fp-tiles-8-4.webm", "vp90-2-14-resize-10frames-fp-tiles-8-4.webm",
"vp90-2-15-segkey.webm", "vp90-2-15-segkey_adpq.webm", "vp90-2-15-segkey.webm",
"vp90-2-16-intra-only.webm", "vp90-2-17-show-existing-frame.webm", "vp90-2-15-segkey_adpq.webm",
"vp90-2-18-resize.ivf", "vp90-2-19-skip.webm", "vp90-2-16-intra-only.webm",
"vp90-2-19-skip-01.webm", "vp90-2-19-skip-02.webm", "vp90-2-17-show-existing-frame.webm",
"vp90-2-18-resize.ivf",
"vp90-2-19-skip.webm",
"vp90-2-19-skip-01.webm",
"vp90-2-19-skip-02.webm",
"vp91-2-04-yuv444.webm", "vp91-2-04-yuv444.webm",
"vp91-2-04-yuv422.webm", "vp91-2-04-yuv440.webm", "vp91-2-04-yuv422.webm",
"vp91-2-04-yuv440.webm",
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
"vp92-2-20-10bit-yuv420.webm", "vp92-2-20-12bit-yuv420.webm", "vp92-2-20-10bit-yuv420.webm",
"vp93-2-20-10bit-yuv422.webm", "vp93-2-20-12bit-yuv422.webm", "vp92-2-20-12bit-yuv420.webm",
"vp93-2-20-10bit-yuv440.webm", "vp93-2-20-12bit-yuv440.webm", "vp93-2-20-10bit-yuv422.webm",
"vp93-2-20-10bit-yuv444.webm", "vp93-2-20-12bit-yuv444.webm", "vp93-2-20-12bit-yuv422.webm",
"vp93-2-20-10bit-yuv440.webm",
"vp93-2-20-12bit-yuv440.webm",
"vp93-2-20-10bit-yuv444.webm",
"vp93-2-20-12bit-yuv444.webm",
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
"vp90-2-20-big_superframe-01.webm", "vp90-2-20-big_superframe-02.webm", "vp90-2-20-big_superframe-01.webm",
"vp90-2-20-big_superframe-02.webm",
RESIZE_TEST_VECTORS RESIZE_TEST_VECTORS
}; };
const int kNumVP9TestVectors = NELEMENTS(kVP9TestVectors); const int kNumVP9TestVectors = NELEMENTS(kVP9TestVectors);
const char *const kVP9TestVectorsResize[] = { const char *const kVP9TestVectorsResize[] = { RESIZE_TEST_VECTORS };
RESIZE_TEST_VECTORS
};
const int kNumVP9TestVectorsResize = NELEMENTS(kVP9TestVectorsResize); const int kNumVP9TestVectorsResize = NELEMENTS(kVP9TestVectorsResize);
#undef RESIZE_TEST_VECTORS #undef RESIZE_TEST_VECTORS
#endif // CONFIG_VP9_DECODER #endif // CONFIG_VP9_DECODER

View File

@ -24,9 +24,7 @@ class TileIndependenceTest : public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWithParam<int> { public ::libvpx_test::CodecTestWithParam<int> {
protected: protected:
TileIndependenceTest() TileIndependenceTest()
: EncoderTest(GET_PARAM(0)), : EncoderTest(GET_PARAM(0)), md5_fw_order_(), md5_inv_order_(),
md5_fw_order_(),
md5_inv_order_(),
n_tiles_(GET_PARAM(1)) { n_tiles_(GET_PARAM(1)) {
init_flags_ = VPX_CODEC_USE_PSNR; init_flags_ = VPX_CODEC_USE_PSNR;
vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t(); vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();

View File

@ -34,8 +34,8 @@ using libvpx_test::ACMRandom;
void CheckUserPrivateData(void *user_priv, int *target) { void CheckUserPrivateData(void *user_priv, int *target) {
// actual pointer value should be the same as expected. // actual pointer value should be the same as expected.
EXPECT_EQ(reinterpret_cast<void *>(target), user_priv) << EXPECT_EQ(reinterpret_cast<void *>(target), user_priv)
"user_priv pointer value does not match."; << "user_priv pointer value does not match.";
} }
// Decodes |filename|. Passes in user_priv data when calling DecodeFrame and // Decodes |filename|. Passes in user_priv data when calling DecodeFrame and

View File

@ -20,8 +20,7 @@
#define GET_PARAM(k) std::tr1::get<k>(GetParam()) #define GET_PARAM(k) std::tr1::get<k>(GetParam())
inline double compute_psnr(const vpx_image_t *img1, const vpx_image_t *img2) { inline double compute_psnr(const vpx_image_t *img1, const vpx_image_t *img2) {
assert((img1->fmt == img2->fmt) && assert((img1->fmt == img2->fmt) && (img1->d_w == img2->d_w) &&
(img1->d_w == img2->d_w) &&
(img1->d_h == img2->d_h)); (img1->d_h == img2->d_h));
const unsigned int width_y = img1->d_w; const unsigned int width_y = img1->d_w;

View File

@ -57,8 +57,7 @@ static void RoundHighBitDepth(int bit_depth, int64_t *se, uint64_t *sse) {
*se = (*se + 2) >> 2; *se = (*se + 2) >> 2;
break; break;
case VPX_BITS_8: case VPX_BITS_8:
default: default: break;
break;
} }
} }
@ -74,10 +73,9 @@ static unsigned int mb_ss_ref(const int16_t *src) {
* Our codebase calculates the "diff" value in the variance algorithm by * Our codebase calculates the "diff" value in the variance algorithm by
* (src - ref). * (src - ref).
*/ */
static uint32_t variance_ref(const uint8_t *src, const uint8_t *ref, static uint32_t variance_ref(const uint8_t *src, const uint8_t *ref, int l2w,
int l2w, int l2h, int src_stride, int l2h, int src_stride, int ref_stride,
int ref_stride, uint32_t *sse_ptr, uint32_t *sse_ptr, bool use_high_bit_depth_,
bool use_high_bit_depth_,
vpx_bit_depth_t bit_depth) { vpx_bit_depth_t bit_depth) {
int64_t se = 0; int64_t se = 0;
uint64_t sse = 0; uint64_t sse = 0;
@ -87,8 +85,7 @@ static uint32_t variance_ref(const uint8_t *src, const uint8_t *ref,
for (int x = 0; x < w; x++) { for (int x = 0; x < w; x++) {
int diff; int diff;
if (!use_high_bit_depth_) { if (!use_high_bit_depth_) {
diff = src[y * src_stride + x] - diff = src[y * src_stride + x] - ref[y * ref_stride + x];
ref[y * ref_stride + x];
se += diff; se += diff;
sse += diff * diff; sse += diff * diff;
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
@ -103,9 +100,8 @@ static uint32_t variance_ref(const uint8_t *src, const uint8_t *ref,
} }
RoundHighBitDepth(bit_depth, &se, &sse); RoundHighBitDepth(bit_depth, &se, &sse);
*sse_ptr = static_cast<uint32_t>(sse); *sse_ptr = static_cast<uint32_t>(sse);
return static_cast<uint32_t>(sse - return static_cast<uint32_t>(
((static_cast<int64_t>(se) * se) >> sse - ((static_cast<int64_t>(se) * se) >> (l2w + l2h)));
(l2w + l2h)));
} }
/* The subpel reference functions differ from the codec version in one aspect: /* The subpel reference functions differ from the codec version in one aspect:
@ -116,8 +112,7 @@ static uint32_t variance_ref(const uint8_t *src, const uint8_t *ref,
*/ */
static uint32_t subpel_variance_ref(const uint8_t *ref, const uint8_t *src, static uint32_t subpel_variance_ref(const uint8_t *ref, const uint8_t *src,
int l2w, int l2h, int xoff, int yoff, int l2w, int l2h, int xoff, int yoff,
uint32_t *sse_ptr, uint32_t *sse_ptr, bool use_high_bit_depth_,
bool use_high_bit_depth_,
vpx_bit_depth_t bit_depth) { vpx_bit_depth_t bit_depth) {
int64_t se = 0; int64_t se = 0;
uint64_t sse = 0; uint64_t sse = 0;
@ -161,16 +156,13 @@ static uint32_t subpel_variance_ref(const uint8_t *ref, const uint8_t *src,
} }
RoundHighBitDepth(bit_depth, &se, &sse); RoundHighBitDepth(bit_depth, &se, &sse);
*sse_ptr = static_cast<uint32_t>(sse); *sse_ptr = static_cast<uint32_t>(sse);
return static_cast<uint32_t>(sse - return static_cast<uint32_t>(
((static_cast<int64_t>(se) * se) >> sse - ((static_cast<int64_t>(se) * se) >> (l2w + l2h)));
(l2w + l2h)));
} }
static uint32_t subpel_avg_variance_ref(const uint8_t *ref, static uint32_t subpel_avg_variance_ref(const uint8_t *ref, const uint8_t *src,
const uint8_t *src, const uint8_t *second_pred, int l2w,
const uint8_t *second_pred, int l2h, int xoff, int yoff,
int l2w, int l2h,
int xoff, int yoff,
uint32_t *sse_ptr, uint32_t *sse_ptr,
bool use_high_bit_depth, bool use_high_bit_depth,
vpx_bit_depth_t bit_depth) { vpx_bit_depth_t bit_depth) {
@ -218,9 +210,8 @@ static uint32_t subpel_avg_variance_ref(const uint8_t *ref,
} }
RoundHighBitDepth(bit_depth, &se, &sse); RoundHighBitDepth(bit_depth, &se, &sse);
*sse_ptr = static_cast<uint32_t>(sse); *sse_ptr = static_cast<uint32_t>(sse);
return static_cast<uint32_t>(sse - return static_cast<uint32_t>(
((static_cast<int64_t>(se) * se) >> sse - ((static_cast<int64_t>(se) * se) >> (l2w + l2h)));
(l2w + l2h)));
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -229,9 +220,7 @@ class SumOfSquaresTest : public ::testing::TestWithParam<SumOfSquaresFunction> {
public: public:
SumOfSquaresTest() : func_(GetParam()) {} SumOfSquaresTest() : func_(GetParam()) {}
virtual ~SumOfSquaresTest() { virtual ~SumOfSquaresTest() { libvpx_test::ClearSystemState(); }
libvpx_test::ClearSystemState();
}
protected: protected:
void ConstTest(); void ConstTest();
@ -274,8 +263,8 @@ void SumOfSquaresTest::RefTest() {
template <typename Func> template <typename Func>
struct TestParams { struct TestParams {
TestParams(int log2w = 0, int log2h = 0, TestParams(int log2w = 0, int log2h = 0, Func function = NULL,
Func function = NULL, int bit_depth_value = 0) int bit_depth_value = 0)
: log2width(log2w), log2height(log2h), func(function) { : log2width(log2w), log2height(log2h), func(function) {
use_high_bit_depth = (bit_depth_value > 0); use_high_bit_depth = (bit_depth_value > 0);
if (use_high_bit_depth) { if (use_high_bit_depth) {
@ -307,8 +296,8 @@ std::ostream &operator<<(std::ostream &os, const TestParams<Func> &p) {
// Main class for testing a function type // Main class for testing a function type
template <typename FunctionType> template <typename FunctionType>
class MainTestClass : class MainTestClass
public ::testing::TestWithParam<TestParams<FunctionType> > { : public ::testing::TestWithParam<TestParams<FunctionType> > {
public: public:
virtual void SetUp() { virtual void SetUp() {
params_ = this->GetParam(); params_ = this->GetParam();
@ -422,9 +411,9 @@ void MainTestClass<VarianceFunctionType>::RefTest() {
const int stride = width(); const int stride = width();
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(
var1 = params_.func(src_, stride, ref_, stride, &sse1)); var1 = params_.func(src_, stride, ref_, stride, &sse1));
var2 = variance_ref(src_, ref_, params_.log2width, params_.log2height, var2 =
stride, stride, &sse2, variance_ref(src_, ref_, params_.log2width, params_.log2height, stride,
use_high_bit_depth(), params_.bit_depth); stride, &sse2, use_high_bit_depth(), params_.bit_depth);
EXPECT_EQ(sse1, sse2) << "Error at test index: " << i; EXPECT_EQ(sse1, sse2) << "Error at test index: " << i;
EXPECT_EQ(var1, var2) << "Error at test index: " << i; EXPECT_EQ(var1, var2) << "Error at test index: " << i;
} }
@ -453,10 +442,9 @@ void MainTestClass<VarianceFunctionType>::RefStrideTest() {
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(
var1 = params_.func(src_, src_stride, ref_, ref_stride, &sse1)); var1 = params_.func(src_, src_stride, ref_, ref_stride, &sse1));
var2 = variance_ref(src_, ref_, var2 = variance_ref(src_, ref_, params_.log2width, params_.log2height,
params_.log2width, params_.log2height, src_stride, ref_stride, &sse2, use_high_bit_depth(),
src_stride, ref_stride, &sse2, params_.bit_depth);
use_high_bit_depth(), params_.bit_depth);
EXPECT_EQ(sse1, sse2) << "Error at test index: " << i; EXPECT_EQ(sse1, sse2) << "Error at test index: " << i;
EXPECT_EQ(var1, var2) << "Error at test index: " << i; EXPECT_EQ(var1, var2) << "Error at test index: " << i;
} }
@ -496,8 +484,8 @@ void MainTestClass<FunctionType>::RefTestMse() {
unsigned int sse1, sse2; unsigned int sse1, sse2;
const int stride = width(); const int stride = width();
ASM_REGISTER_STATE_CHECK(params_.func(src_, stride, ref_, stride, &sse1)); ASM_REGISTER_STATE_CHECK(params_.func(src_, stride, ref_, stride, &sse1));
variance_ref(src_, ref_, params_.log2width, params_.log2height, variance_ref(src_, ref_, params_.log2width, params_.log2height, stride,
stride, stride, &sse2, false, VPX_BITS_8); stride, &sse2, false, VPX_BITS_8);
EXPECT_EQ(sse1, sse2); EXPECT_EQ(sse1, sse2);
} }
} }
@ -513,8 +501,8 @@ void MainTestClass<FunctionType>::RefTestSse() {
unsigned int var1; unsigned int var1;
const int stride = width(); const int stride = width();
ASM_REGISTER_STATE_CHECK(var1 = params_.func(src_, stride, ref_, stride)); ASM_REGISTER_STATE_CHECK(var1 = params_.func(src_, stride, ref_, stride));
variance_ref(src_, ref_, params_.log2width, params_.log2height, variance_ref(src_, ref_, params_.log2width, params_.log2height, stride,
stride, stride, &sse2, false, VPX_BITS_8); stride, &sse2, false, VPX_BITS_8);
EXPECT_EQ(var1, sse2); EXPECT_EQ(var1, sse2);
} }
} }
@ -547,8 +535,8 @@ using ::std::tr1::tuple;
template <typename SubpelVarianceFunctionType> template <typename SubpelVarianceFunctionType>
class SubpelVarianceTest class SubpelVarianceTest
: public ::testing::TestWithParam<tuple<int, int, : public ::testing::TestWithParam<
SubpelVarianceFunctionType, int> > { tuple<int, int, SubpelVarianceFunctionType, int> > {
public: public:
virtual void SetUp() { virtual void SetUp() {
const tuple<int, int, SubpelVarianceFunctionType, int> &params = const tuple<int, int, SubpelVarianceFunctionType, int> &params =
@ -575,14 +563,12 @@ class SubpelVarianceTest
ref_ = new uint8_t[block_size_ + width_ + height_ + 1]; ref_ = new uint8_t[block_size_ + width_ + height_ + 1];
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
} else { } else {
src_ = CONVERT_TO_BYTEPTR( src_ = CONVERT_TO_BYTEPTR(reinterpret_cast<uint16_t *>(
reinterpret_cast<uint16_t *>(
vpx_memalign(16, block_size_ * sizeof(uint16_t)))); vpx_memalign(16, block_size_ * sizeof(uint16_t))));
sec_ = CONVERT_TO_BYTEPTR( sec_ = CONVERT_TO_BYTEPTR(reinterpret_cast<uint16_t *>(
reinterpret_cast<uint16_t *>(
vpx_memalign(16, block_size_ * sizeof(uint16_t)))); vpx_memalign(16, block_size_ * sizeof(uint16_t))));
ref_ = CONVERT_TO_BYTEPTR( ref_ =
new uint16_t[block_size_ + width_ + height_ + 1]); CONVERT_TO_BYTEPTR(new uint16_t[block_size_ + width_ + height_ + 1]);
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
} }
ASSERT_TRUE(src_ != NULL); ASSERT_TRUE(src_ != NULL);
@ -644,13 +630,11 @@ void SubpelVarianceTest<SubpelVarianceFunctionType>::RefTest() {
} }
unsigned int sse1, sse2; unsigned int sse1, sse2;
unsigned int var1; unsigned int var1;
ASM_REGISTER_STATE_CHECK(var1 = subpel_variance_(ref_, width_ + 1, x, y, ASM_REGISTER_STATE_CHECK(
src_, width_, &sse1)); var1 = subpel_variance_(ref_, width_ + 1, x, y, src_, width_, &sse1));
const unsigned int var2 = subpel_variance_ref(ref_, src_, const unsigned int var2 =
log2width_, log2height_, subpel_variance_ref(ref_, src_, log2width_, log2height_, x, y, &sse2,
x, y, &sse2, use_high_bit_depth_, bit_depth_);
use_high_bit_depth_,
bit_depth_);
EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y; EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;
EXPECT_EQ(var1, var2) << "at position " << x << ", " << y; EXPECT_EQ(var1, var2) << "at position " << x << ", " << y;
} }
@ -684,8 +668,8 @@ void SubpelVarianceTest<SubpelVarianceFunctionType>::ExtremeRefTest() {
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(
var1 = subpel_variance_(ref_, width_ + 1, x, y, src_, width_, &sse1)); var1 = subpel_variance_(ref_, width_ + 1, x, y, src_, width_, &sse1));
const unsigned int var2 = const unsigned int var2 =
subpel_variance_ref(ref_, src_, log2width_, log2height_, subpel_variance_ref(ref_, src_, log2width_, log2height_, x, y, &sse2,
x, y, &sse2, use_high_bit_depth_, bit_depth_); use_high_bit_depth_, bit_depth_);
EXPECT_EQ(sse1, sse2) << "for xoffset " << x << " and yoffset " << y; EXPECT_EQ(sse1, sse2) << "for xoffset " << x << " and yoffset " << y;
EXPECT_EQ(var1, var2) << "for xoffset " << x << " and yoffset " << y; EXPECT_EQ(var1, var2) << "for xoffset " << x << " and yoffset " << y;
} }
@ -717,13 +701,11 @@ void SubpelVarianceTest<SubpixAvgVarMxNFunc>::RefTest() {
} }
uint32_t sse1, sse2; uint32_t sse1, sse2;
uint32_t var1, var2; uint32_t var1, var2;
ASM_REGISTER_STATE_CHECK( ASM_REGISTER_STATE_CHECK(var1 =
var1 = subpel_variance_(ref_, width_ + 1, x, y, subpel_variance_(ref_, width_ + 1, x, y,
src_, width_, &sse1, sec_)); src_, width_, &sse1, sec_));
var2 = subpel_avg_variance_ref(ref_, src_, sec_, var2 = subpel_avg_variance_ref(ref_, src_, sec_, log2width_, log2height_,
log2width_, log2height_, x, y, &sse2, use_high_bit_depth_,
x, y, &sse2,
use_high_bit_depth_,
static_cast<vpx_bit_depth_t>(bit_depth_)); static_cast<vpx_bit_depth_t>(bit_depth_));
EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y; EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;
EXPECT_EQ(var1, var2) << "at position " << x << ", " << y; EXPECT_EQ(var1, var2) << "at position " << x << ", " << y;
@ -756,7 +738,8 @@ INSTANTIATE_TEST_CASE_P(C, SumOfSquaresTest,
typedef TestParams<Get4x4SseFunc> SseParams; typedef TestParams<Get4x4SseFunc> SseParams;
INSTANTIATE_TEST_CASE_P(C, VpxSseTest, INSTANTIATE_TEST_CASE_P(C, VpxSseTest,
::testing::Values(SseParams(2, 2, &vpx_get4x4sse_cs_c))); ::testing::Values(SseParams(2, 2,
&vpx_get4x4sse_cs_c)));
typedef TestParams<VarianceMxNFunc> MseParams; typedef TestParams<VarianceMxNFunc> MseParams;
INSTANTIATE_TEST_CASE_P(C, VpxMseTest, INSTANTIATE_TEST_CASE_P(C, VpxMseTest,
@ -818,8 +801,7 @@ INSTANTIATE_TEST_CASE_P(
typedef MainTestClass<VarianceMxNFunc> VpxHBDMseTest; typedef MainTestClass<VarianceMxNFunc> VpxHBDMseTest;
typedef MainTestClass<VarianceMxNFunc> VpxHBDVarianceTest; typedef MainTestClass<VarianceMxNFunc> VpxHBDVarianceTest;
typedef SubpelVarianceTest<SubpixVarMxNFunc> VpxHBDSubpelVarianceTest; typedef SubpelVarianceTest<SubpixVarMxNFunc> VpxHBDSubpelVarianceTest;
typedef SubpelVarianceTest<SubpixAvgVarMxNFunc> typedef SubpelVarianceTest<SubpixAvgVarMxNFunc> VpxHBDSubpelAvgVarianceTest;
VpxHBDSubpelAvgVarianceTest;
TEST_P(VpxHBDMseTest, RefMse) { RefTestMse(); } TEST_P(VpxHBDMseTest, RefMse) { RefTestMse(); }
TEST_P(VpxHBDMseTest, MaxMse) { MaxTestMse(); } TEST_P(VpxHBDMseTest, MaxMse) { MaxTestMse(); }
@ -1055,7 +1037,8 @@ INSTANTIATE_TEST_CASE_P(
*/ */
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, VpxHBDVarianceTest, ::testing::Values( SSE2, VpxHBDVarianceTest,
::testing::Values(
VarianceParams(6, 6, &vpx_highbd_12_variance64x64_sse2, 12), VarianceParams(6, 6, &vpx_highbd_12_variance64x64_sse2, 12),
VarianceParams(6, 5, &vpx_highbd_12_variance64x32_sse2, 12), VarianceParams(6, 5, &vpx_highbd_12_variance64x32_sse2, 12),
VarianceParams(5, 6, &vpx_highbd_12_variance32x64_sse2, 12), VarianceParams(5, 6, &vpx_highbd_12_variance32x64_sse2, 12),
@ -1224,7 +1207,8 @@ INSTANTIATE_TEST_CASE_P(
#if HAVE_MEDIA #if HAVE_MEDIA
INSTANTIATE_TEST_CASE_P(MEDIA, VpxMseTest, INSTANTIATE_TEST_CASE_P(MEDIA, VpxMseTest,
::testing::Values(MseParams(4, 4, &vpx_mse16x16_media))); ::testing::Values(MseParams(4, 4,
&vpx_mse16x16_media)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
MEDIA, VpxVarianceTest, MEDIA, VpxVarianceTest,
@ -1239,7 +1223,8 @@ INSTANTIATE_TEST_CASE_P(
#if HAVE_NEON #if HAVE_NEON
INSTANTIATE_TEST_CASE_P(NEON, VpxSseTest, INSTANTIATE_TEST_CASE_P(NEON, VpxSseTest,
::testing::Values(SseParams(2, 2, &vpx_get4x4sse_cs_neon))); ::testing::Values(SseParams(2, 2,
&vpx_get4x4sse_cs_neon)));
INSTANTIATE_TEST_CASE_P(NEON, VpxMseTest, INSTANTIATE_TEST_CASE_P(NEON, VpxMseTest,
::testing::Values(MseParams(4, 4, &vpx_mse16x16_neon))); ::testing::Values(MseParams(4, 4, &vpx_mse16x16_neon)));
@ -1268,7 +1253,8 @@ INSTANTIATE_TEST_CASE_P(MSA, SumOfSquaresTest,
::testing::Values(vpx_get_mb_ss_msa)); ::testing::Values(vpx_get_mb_ss_msa));
INSTANTIATE_TEST_CASE_P(MSA, VpxSseTest, INSTANTIATE_TEST_CASE_P(MSA, VpxSseTest,
::testing::Values(SseParams(2, 2, &vpx_get4x4sse_cs_msa))); ::testing::Values(SseParams(2, 2,
&vpx_get4x4sse_cs_msa)));
INSTANTIATE_TEST_CASE_P(MSA, VpxMseTest, INSTANTIATE_TEST_CASE_P(MSA, VpxMseTest,
::testing::Values(MseParams(4, 4, &vpx_mse16x16_msa), ::testing::Values(MseParams(4, 4, &vpx_mse16x16_msa),

View File

@ -76,21 +76,15 @@ static FILE *GetTempOutFile(std::string *file_name) {
class TempOutFile { class TempOutFile {
public: public:
TempOutFile() { TempOutFile() { file_ = GetTempOutFile(&file_name_); }
file_ = GetTempOutFile(&file_name_);
}
~TempOutFile() { ~TempOutFile() {
CloseFile(); CloseFile();
if (!file_name_.empty()) { if (!file_name_.empty()) {
EXPECT_EQ(0, remove(file_name_.c_str())); EXPECT_EQ(0, remove(file_name_.c_str()));
} }
} }
FILE *file() { FILE *file() { return file_; }
return file_; const std::string &file_name() { return file_name_; }
}
const std::string& file_name() {
return file_name_;
}
protected: protected:
void CloseFile() { void CloseFile() {
@ -134,14 +128,10 @@ class VideoSource {
virtual unsigned int limit() const = 0; virtual unsigned int limit() const = 0;
}; };
class DummyVideoSource : public VideoSource { class DummyVideoSource : public VideoSource {
public: public:
DummyVideoSource() DummyVideoSource()
: img_(NULL), : img_(NULL), limit_(100), width_(80), height_(64),
limit_(100),
width_(80),
height_(64),
format_(VPX_IMG_FMT_I420) { format_(VPX_IMG_FMT_I420) {
ReallocImage(); ReallocImage();
} }
@ -158,9 +148,7 @@ class DummyVideoSource : public VideoSource {
FillFrame(); FillFrame();
} }
virtual vpx_image_t *img() const { virtual vpx_image_t *img() const { return (frame_ < limit_) ? img_ : NULL; }
return (frame_ < limit_) ? img_ : NULL;
}
// Models a stream where Timebase = 1/FPS, so pts == frame. // Models a stream where Timebase = 1/FPS, so pts == frame.
virtual vpx_codec_pts_t pts() const { return frame_; } virtual vpx_codec_pts_t pts() const { return frame_; }
@ -176,9 +164,7 @@ class DummyVideoSource : public VideoSource {
virtual unsigned int limit() const { return limit_; } virtual unsigned int limit() const { return limit_; }
void set_limit(unsigned int limit) { void set_limit(unsigned int limit) { limit_ = limit; }
limit_ = limit;
}
void SetSize(unsigned int width, unsigned int height) { void SetSize(unsigned int width, unsigned int height) {
if (width != width_ || height != height_) { if (width != width_ || height != height_) {
@ -196,7 +182,9 @@ class DummyVideoSource : public VideoSource {
} }
protected: protected:
virtual void FillFrame() { if (img_) memset(img_->img_data, 0, raw_sz_); } virtual void FillFrame() {
if (img_) memset(img_->img_data, 0, raw_sz_);
}
void ReallocImage() { void ReallocImage() {
vpx_img_free(img_); vpx_img_free(img_);
@ -213,12 +201,10 @@ class DummyVideoSource : public VideoSource {
vpx_img_fmt_t format_; vpx_img_fmt_t format_;
}; };
class RandomVideoSource : public DummyVideoSource { class RandomVideoSource : public DummyVideoSource {
public: public:
RandomVideoSource(int seed = ACMRandom::DeterministicSeed()) RandomVideoSource(int seed = ACMRandom::DeterministicSeed())
: rnd_(seed), : rnd_(seed), seed_(seed) {}
seed_(seed) { }
protected: protected:
// Reset the RNG to get a matching stream for the second pass // Reset the RNG to get a matching stream for the second pass
@ -233,8 +219,7 @@ class RandomVideoSource : public DummyVideoSource {
virtual void FillFrame() { virtual void FillFrame() {
if (img_) { if (img_) {
if (frame_ % 30 < 15) if (frame_ % 30 < 15)
for (size_t i = 0; i < raw_sz_; ++i) for (size_t i = 0; i < raw_sz_; ++i) img_->img_data[i] = rnd_.Rand8();
img_->img_data[i] = rnd_.Rand8();
else else
memset(img_->img_data, 0, raw_sz_); memset(img_->img_data, 0, raw_sz_);
} }

View File

@ -8,7 +8,6 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include <math.h> #include <math.h>
#include <stddef.h> #include <stddef.h>
#include <stdio.h> #include <stdio.h>
@ -41,8 +40,8 @@ void encrypt_buffer(uint8_t *buffer, size_t size) {
} }
} }
void test_decrypt_cb(void *decrypt_state, const uint8_t *input, void test_decrypt_cb(void *decrypt_state, const uint8_t *input, uint8_t *output,
uint8_t *output, int count) { int count) {
const size_t offset = input - reinterpret_cast<uint8_t *>(decrypt_state); const size_t offset = input - reinterpret_cast<uint8_t *>(decrypt_state);
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
output[i] = input[i] ^ secret_key[(offset + i) & 15]; output[i] = input[i] ^ secret_key[(offset + i) & 15];
@ -62,6 +61,7 @@ TEST(VP8, TestBitIO) {
for (int i = 0; i < kBitsToTest; ++i) { for (int i = 0; i < kBitsToTest; ++i) {
const int parity = i & 1; const int parity = i & 1;
/* clang-format off */
probas[i] = probas[i] =
(method == 0) ? 0 : (method == 1) ? 255 : (method == 0) ? 0 : (method == 1) ? 255 :
(method == 2) ? 128 : (method == 2) ? 128 :
@ -72,6 +72,7 @@ TEST(VP8, TestBitIO) {
(method == 6) ? (method == 6) ?
(parity ? rnd(64) : 255 - rnd(64)) : (parity ? rnd(64) : 255 - rnd(64)) :
(parity ? rnd(32) : 255 - rnd(32)); (parity ? rnd(32) : 255 - rnd(32));
/* clang-format on */
} }
for (int bit_method = 0; bit_method <= 3; ++bit_method) { for (int bit_method = 0; bit_method <= 3; ++bit_method) {
const int random_seed = 6432; const int random_seed = 6432;
@ -95,8 +96,7 @@ TEST(VP8, TestBitIO) {
BOOL_DECODER br; BOOL_DECODER br;
encrypt_buffer(bw_buffer, kBufferSize); encrypt_buffer(bw_buffer, kBufferSize);
vp8dx_start_decode(&br, bw_buffer, kBufferSize, vp8dx_start_decode(&br, bw_buffer, kBufferSize, test_decrypt_cb,
test_decrypt_cb,
reinterpret_cast<void *>(bw_buffer)); reinterpret_cast<void *>(bw_buffer));
bit_rnd.Reset(random_seed); bit_rnd.Reset(random_seed);
for (int i = 0; i < kBitsToTest; ++i) { for (int i = 0; i < kBitsToTest; ++i) {
@ -107,8 +107,7 @@ TEST(VP8, TestBitIO) {
} }
GTEST_ASSERT_EQ(vp8dx_decode_bool(&br, probas[i]), bit) GTEST_ASSERT_EQ(vp8dx_decode_bool(&br, probas[i]), bit)
<< "pos: " << i << " / " << kBitsToTest << "pos: " << i << " / " << kBitsToTest
<< " bit_method: " << bit_method << " bit_method: " << bit_method << " method: " << method;
<< " method: " << method;
} }
} }
} }

View File

@ -21,10 +21,8 @@ namespace {
// with whatever internal state the decryptor uses. For testing we'll just // with whatever internal state the decryptor uses. For testing we'll just
// xor with a constant key, and decrypt_state will point to the start of // xor with a constant key, and decrypt_state will point to the start of
// the original buffer. // the original buffer.
const uint8_t test_key[16] = { const uint8_t test_key[16] = { 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0 };
0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0
};
void encrypt_buffer(const uint8_t *src, uint8_t *dst, size_t size, void encrypt_buffer(const uint8_t *src, uint8_t *dst, size_t size,
ptrdiff_t offset) { ptrdiff_t offset) {
@ -33,8 +31,8 @@ void encrypt_buffer(const uint8_t *src, uint8_t *dst, size_t size,
} }
} }
void test_decrypt_cb(void *decrypt_state, const uint8_t *input, void test_decrypt_cb(void *decrypt_state, const uint8_t *input, uint8_t *output,
uint8_t *output, int count) { int count) {
encrypt_buffer(input, output, count, encrypt_buffer(input, output, count,
input - reinterpret_cast<uint8_t *>(decrypt_state)); input - reinterpret_cast<uint8_t *>(decrypt_state));
} }

View File

@ -32,9 +32,7 @@ class VP8DenoiserTest : public ::testing::TestWithParam<int> {
public: public:
virtual ~VP8DenoiserTest() {} virtual ~VP8DenoiserTest() {}
virtual void SetUp() { virtual void SetUp() { increase_denoising_ = GetParam(); }
increase_denoising_ = GetParam();
}
virtual void TearDown() { libvpx_test::ClearSystemState(); } virtual void TearDown() { libvpx_test::ClearSystemState(); }
@ -71,8 +69,8 @@ TEST_P(VP8DenoiserTest, BitexactCheck) {
sig_block_sse2[j] = sig_block_c[j] = rnd.Rand8(); sig_block_sse2[j] = sig_block_c[j] = rnd.Rand8();
// The pixels in mc_avg_block are generated by adding a random // The pixels in mc_avg_block are generated by adding a random
// number in range [-19, 19] to corresponding pixels in sig_block. // number in range [-19, 19] to corresponding pixels in sig_block.
temp = sig_block_c[j] + (rnd.Rand8() % 2 == 0 ? -1 : 1) * temp =
(rnd.Rand8() % 20); sig_block_c[j] + (rnd.Rand8() % 2 == 0 ? -1 : 1) * (rnd.Rand8() % 20);
// Clip. // Clip.
mc_avg_block[j] = (temp < 0) ? 0 : ((temp > 255) ? 255 : temp); mc_avg_block[j] = (temp < 0) ? 0 : ((temp > 255) ? 255 : temp);
} }

View File

@ -95,7 +95,8 @@ TEST(VP8FdctTest, SignBiasCheck) {
bool bias_acceptable = true; bool bias_acceptable = true;
for (int j = 0; j < 16; ++j) for (int j = 0; j < 16; ++j)
bias_acceptable = bias_acceptable && bias_acceptable =
bias_acceptable &&
(abs(count_sign_block[j][0] - count_sign_block[j][1]) < 10000); (abs(count_sign_block[j][0] - count_sign_block[j][1]) < 10000);
EXPECT_EQ(true, bias_acceptable) EXPECT_EQ(true, bias_acceptable)
@ -120,7 +121,8 @@ TEST(VP8FdctTest, SignBiasCheck) {
bias_acceptable = true; bias_acceptable = true;
for (int j = 0; j < 16; ++j) for (int j = 0; j < 16; ++j)
bias_acceptable = bias_acceptable && bias_acceptable =
bias_acceptable &&
(abs(count_sign_block[j][0] - count_sign_block[j][1]) < 100000); (abs(count_sign_block[j][0] - count_sign_block[j][1]) < 100000);
EXPECT_EQ(true, bias_acceptable) EXPECT_EQ(true, bias_acceptable)
@ -148,8 +150,7 @@ TEST(VP8FdctTest, RoundTripErrorCheck) {
for (int j = 0; j < 16; ++j) { for (int j = 0; j < 16; ++j) {
const int diff = test_input_block[j] - test_output_block[j]; const int diff = test_input_block[j] - test_output_block[j];
const int error = diff * diff; const int error = diff * diff;
if (max_error < error) if (max_error < error) max_error = error;
max_error = error;
total_error += error; total_error += error;
} }
} }

View File

@ -13,8 +13,7 @@
namespace { namespace {
class VP8FramgmentsTest class VP8FramgmentsTest : public ::libvpx_test::EncoderTest,
: public ::libvpx_test::EncoderTest,
public ::testing::Test { public ::testing::Test {
protected: protected:
VP8FramgmentsTest() : EncoderTest(&::libvpx_test::kVP8) {} VP8FramgmentsTest() : EncoderTest(&::libvpx_test::kVP8) {}

View File

@ -44,24 +44,20 @@ typedef struct {
const TestVideoParam kTestVectors[] = { const TestVideoParam kTestVectors[] = {
// artificially increase framerate to trigger default check // artificially increase framerate to trigger default check
{"hantro_collage_w352h288.yuv", 352, 288, 5000, 1, { "hantro_collage_w352h288.yuv", 352, 288, 5000, 1, 8, VPX_IMG_FMT_I420,
8, VPX_IMG_FMT_I420, VPX_BITS_8, 0}, VPX_BITS_8, 0 },
{"hantro_collage_w352h288.yuv", 352, 288, 30, 1, { "hantro_collage_w352h288.yuv", 352, 288, 30, 1, 8, VPX_IMG_FMT_I420,
8, VPX_IMG_FMT_I420, VPX_BITS_8, 0}, VPX_BITS_8, 0 },
{"rush_hour_444.y4m", 352, 288, 30, 1, { "rush_hour_444.y4m", 352, 288, 30, 1, 8, VPX_IMG_FMT_I444, VPX_BITS_8, 1 },
8, VPX_IMG_FMT_I444, VPX_BITS_8, 1},
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
// Add list of profile 2/3 test videos here ... // Add list of profile 2/3 test videos here ...
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
}; };
const TestEncodeParam kEncodeVectors[] = { const TestEncodeParam kEncodeVectors[] = {
{::libvpx_test::kOnePassGood, 2}, { ::libvpx_test::kOnePassGood, 2 }, { ::libvpx_test::kOnePassGood, 5 },
{::libvpx_test::kOnePassGood, 5}, { ::libvpx_test::kTwoPassGood, 1 }, { ::libvpx_test::kTwoPassGood, 2 },
{::libvpx_test::kTwoPassGood, 1}, { ::libvpx_test::kTwoPassGood, 5 }, { ::libvpx_test::kRealTime, 5 },
{::libvpx_test::kTwoPassGood, 2},
{::libvpx_test::kTwoPassGood, 5},
{::libvpx_test::kRealTime, 5},
}; };
const int kMinArfVectors[] = { const int kMinArfVectors[] = {
@ -80,15 +76,12 @@ int is_extension_y4m(const char *filename) {
class ArfFreqTest class ArfFreqTest
: public ::libvpx_test::EncoderTest, : public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWith3Params<TestVideoParam, \ public ::libvpx_test::CodecTestWith3Params<TestVideoParam,
TestEncodeParam, int> { TestEncodeParam, int> {
protected: protected:
ArfFreqTest() ArfFreqTest()
: EncoderTest(GET_PARAM(0)), : EncoderTest(GET_PARAM(0)), test_video_param_(GET_PARAM(1)),
test_video_param_(GET_PARAM(1)), test_encode_param_(GET_PARAM(2)), min_arf_requested_(GET_PARAM(3)) {}
test_encode_param_(GET_PARAM(2)),
min_arf_requested_(GET_PARAM(3)) {
}
virtual ~ArfFreqTest() {} virtual ~ArfFreqTest() {}
@ -123,8 +116,7 @@ class ArfFreqTest
// Assume superframe has only one visible frame, the rest being // Assume superframe has only one visible frame, the rest being
// invisible. If superframe index is not found, then there is only // invisible. If superframe index is not found, then there is only
// one frame. // one frame.
if (!((marker & 0xe0) == 0xc0 && if (!((marker & 0xe0) == 0xc0 && pkt->data.frame.sz >= index_sz &&
pkt->data.frame.sz >= index_sz &&
buffer[pkt->data.frame.sz - index_sz] == marker)) { buffer[pkt->data.frame.sz - index_sz] == marker)) {
frames = 1; frames = 1;
} }
@ -132,8 +124,7 @@ class ArfFreqTest
} }
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) { virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) return;
return;
const int frames = GetNumFramesInPkt(pkt); const int frames = GetNumFramesInPkt(pkt);
if (frames == 1) { if (frames == 1) {
run_of_visible_frames_++; run_of_visible_frames_++;
@ -167,9 +158,7 @@ class ArfFreqTest
} }
} }
int GetMinVisibleRun() const { int GetMinVisibleRun() const { return min_run_; }
return min_run_;
}
int GetMinArfDistanceRequested() const { int GetMinArfDistanceRequested() const {
if (min_arf_requested_) if (min_arf_requested_)
@ -197,21 +186,18 @@ TEST_P(ArfFreqTest, MinArfFreqTest) {
cfg_.g_input_bit_depth = test_video_param_.input_bit_depth; cfg_.g_input_bit_depth = test_video_param_.input_bit_depth;
cfg_.g_bit_depth = test_video_param_.bit_depth; cfg_.g_bit_depth = test_video_param_.bit_depth;
init_flags_ = VPX_CODEC_USE_PSNR; init_flags_ = VPX_CODEC_USE_PSNR;
if (cfg_.g_bit_depth > 8) if (cfg_.g_bit_depth > 8) init_flags_ |= VPX_CODEC_USE_HIGHBITDEPTH;
init_flags_ |= VPX_CODEC_USE_HIGHBITDEPTH;
testing::internal::scoped_ptr<libvpx_test::VideoSource> video; testing::internal::scoped_ptr<libvpx_test::VideoSource> video;
if (is_extension_y4m(test_video_param_.filename)) { if (is_extension_y4m(test_video_param_.filename)) {
video.reset(new libvpx_test::Y4mVideoSource(test_video_param_.filename, video.reset(new libvpx_test::Y4mVideoSource(test_video_param_.filename, 0,
0, kFrames)); kFrames));
} else { } else {
video.reset(new libvpx_test::YUVVideoSource(test_video_param_.filename, video.reset(new libvpx_test::YUVVideoSource(
test_video_param_.fmt, test_video_param_.filename, test_video_param_.fmt,
test_video_param_.width, test_video_param_.width, test_video_param_.height,
test_video_param_.height, test_video_param_.framerate_num, test_video_param_.framerate_den, 0,
test_video_param_.framerate_num, kFrames));
test_video_param_.framerate_den,
0, kFrames));
} }
ASSERT_NO_FATAL_FAILURE(RunLoop(video.get())); ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
@ -223,9 +209,7 @@ TEST_P(ArfFreqTest, MinArfFreqTest) {
} }
} }
VP9_INSTANTIATE_TEST_CASE( VP9_INSTANTIATE_TEST_CASE(ArfFreqTest, ::testing::ValuesIn(kTestVectors),
ArfFreqTest,
::testing::ValuesIn(kTestVectors),
::testing::ValuesIn(kEncodeVectors), ::testing::ValuesIn(kEncodeVectors),
::testing::ValuesIn(kMinArfVectors)); ::testing::ValuesIn(kMinArfVectors));
} // namespace } // namespace

View File

@ -34,6 +34,7 @@ TEST(VP9, TestBitIO) {
for (int i = 0; i < kBitsToTest; ++i) { for (int i = 0; i < kBitsToTest; ++i) {
const int parity = i & 1; const int parity = i & 1;
/* clang-format off */
probas[i] = probas[i] =
(method == 0) ? 0 : (method == 1) ? 255 : (method == 0) ? 0 : (method == 1) ? 255 :
(method == 2) ? 128 : (method == 2) ? 128 :
@ -44,6 +45,7 @@ TEST(VP9, TestBitIO) {
(method == 6) ? (method == 6) ?
(parity ? rnd(64) : 255 - rnd(64)) : (parity ? rnd(64) : 255 - rnd(64)) :
(parity ? rnd(32) : 255 - rnd(32)); (parity ? rnd(32) : 255 - rnd(32));
/* clang-format on */
} }
for (int bit_method = 0; bit_method <= 3; ++bit_method) { for (int bit_method = 0; bit_method <= 3; ++bit_method) {
const int random_seed = 6432; const int random_seed = 6432;
@ -79,8 +81,7 @@ TEST(VP9, TestBitIO) {
} }
GTEST_ASSERT_EQ(vpx_read(&br, probas[i]), bit) GTEST_ASSERT_EQ(vpx_read(&br, probas[i]), bit)
<< "pos: " << i << " / " << kBitsToTest << "pos: " << i << " / " << kBitsToTest
<< " bit_method: " << bit_method << " bit_method: " << bit_method << " method: " << method;
<< " method: " << method;
} }
} }
} }

View File

@ -21,10 +21,8 @@ namespace {
// with whatever internal state the decryptor uses. For testing we'll just // with whatever internal state the decryptor uses. For testing we'll just
// xor with a constant key, and decrypt_state will point to the start of // xor with a constant key, and decrypt_state will point to the start of
// the original buffer. // the original buffer.
const uint8_t test_key[16] = { const uint8_t test_key[16] = { 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0 };
0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0
};
void encrypt_buffer(const uint8_t *src, uint8_t *dst, size_t size, void encrypt_buffer(const uint8_t *src, uint8_t *dst, size_t size,
ptrdiff_t offset) { ptrdiff_t offset) {
@ -33,8 +31,8 @@ void encrypt_buffer(const uint8_t *src, uint8_t *dst, size_t size,
} }
} }
void test_decrypt_cb(void *decrypt_state, const uint8_t *input, void test_decrypt_cb(void *decrypt_state, const uint8_t *input, uint8_t *output,
uint8_t *output, int count) { int count) {
encrypt_buffer(input, output, count, encrypt_buffer(input, output, count,
input - reinterpret_cast<uint8_t *>(decrypt_state)); input - reinterpret_cast<uint8_t *>(decrypt_state));
} }

View File

@ -33,9 +33,7 @@ class VP9DenoiserTest : public ::testing::TestWithParam<BLOCK_SIZE> {
public: public:
virtual ~VP9DenoiserTest() {} virtual ~VP9DenoiserTest() {}
virtual void SetUp() { virtual void SetUp() { bs_ = GetParam(); }
bs_ = GetParam();
}
virtual void TearDown() { libvpx_test::ClearSystemState(); } virtual void TearDown() { libvpx_test::ClearSystemState(); }
@ -68,19 +66,19 @@ TEST_P(VP9DenoiserTest, BitexactCheck) {
sig_block[j] = rnd.Rand8(); sig_block[j] = rnd.Rand8();
// The pixels in mc_avg_block are generated by adding a random // The pixels in mc_avg_block are generated by adding a random
// number in range [-19, 19] to corresponding pixels in sig_block. // number in range [-19, 19] to corresponding pixels in sig_block.
temp = sig_block[j] + ((rnd.Rand8() % 2 == 0) ? -1 : 1) * temp =
(rnd.Rand8() % 20); sig_block[j] + ((rnd.Rand8() % 2 == 0) ? -1 : 1) * (rnd.Rand8() % 20);
// Clip. // Clip.
mc_avg_block[j] = (temp < 0) ? 0 : ((temp > 255) ? 255 : temp); mc_avg_block[j] = (temp < 0) ? 0 : ((temp > 255) ? 255 : temp);
} }
ASM_REGISTER_STATE_CHECK(vp9_denoiser_filter_c( ASM_REGISTER_STATE_CHECK(vp9_denoiser_filter_c(sig_block, 64, mc_avg_block,
sig_block, 64, mc_avg_block, 64, avg_block_c, 64, avg_block_c, 64, 0, bs_,
64, 0, bs_, motion_magnitude_random)); motion_magnitude_random));
ASM_REGISTER_STATE_CHECK(vp9_denoiser_filter_sse2( ASM_REGISTER_STATE_CHECK(vp9_denoiser_filter_sse2(
sig_block, 64, mc_avg_block, 64, avg_block_sse2, sig_block, 64, mc_avg_block, 64, avg_block_sse2, 64, 0, bs_,
64, 0, bs_, motion_magnitude_random)); motion_magnitude_random));
// Test bitexactness. // Test bitexactness.
for (int h = 0; h < (4 << b_height_log2_lookup[bs_]); ++h) { for (int h = 0; h < (4 << b_height_log2_lookup[bs_]); ++h) {
@ -92,9 +90,9 @@ TEST_P(VP9DenoiserTest, BitexactCheck) {
} }
// Test for all block size. // Test for all block size.
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(SSE2, VP9DenoiserTest,
SSE2, VP9DenoiserTest, ::testing::Values(BLOCK_8X8, BLOCK_8X16, BLOCK_16X8,
::testing::Values(BLOCK_8X8, BLOCK_8X16, BLOCK_16X8, BLOCK_16X16, BLOCK_16X16, BLOCK_16X32, BLOCK_32X16,
BLOCK_16X32, BLOCK_32X16, BLOCK_32X32, BLOCK_32X64, BLOCK_32X32, BLOCK_32X64, BLOCK_64X32,
BLOCK_64X32, BLOCK_64X64)); BLOCK_64X64));
} // namespace } // namespace

View File

@ -25,14 +25,10 @@ const unsigned int kFrames = 10;
const int kBitrate = 500; const int kBitrate = 500;
// List of psnr thresholds for speed settings 0-7 and 5 encoding modes // List of psnr thresholds for speed settings 0-7 and 5 encoding modes
const double kPsnrThreshold[][5] = { const double kPsnrThreshold[][5] = {
{ 36.0, 37.0, 37.0, 37.0, 37.0 }, { 36.0, 37.0, 37.0, 37.0, 37.0 }, { 35.0, 36.0, 36.0, 36.0, 36.0 },
{ 35.0, 36.0, 36.0, 36.0, 36.0 }, { 34.0, 35.0, 35.0, 35.0, 35.0 }, { 33.0, 34.0, 34.0, 34.0, 34.0 },
{ 34.0, 35.0, 35.0, 35.0, 35.0 }, { 32.0, 33.0, 33.0, 33.0, 33.0 }, { 31.0, 32.0, 32.0, 32.0, 32.0 },
{ 33.0, 34.0, 34.0, 34.0, 34.0 }, { 30.0, 31.0, 31.0, 31.0, 31.0 }, { 29.0, 30.0, 30.0, 30.0, 30.0 },
{ 32.0, 33.0, 33.0, 33.0, 33.0 },
{ 31.0, 32.0, 32.0, 32.0, 32.0 },
{ 30.0, 31.0, 31.0, 31.0, 31.0 },
{ 29.0, 30.0, 30.0, 30.0, 30.0 },
}; };
typedef struct { typedef struct {
@ -62,8 +58,7 @@ const TestVideoParam kTestVectors[] = {
// Encoding modes tested // Encoding modes tested
const libvpx_test::TestMode kEncodingModeVectors[] = { const libvpx_test::TestMode kEncodingModeVectors[] = {
::libvpx_test::kTwoPassGood, ::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood,
::libvpx_test::kOnePassGood,
::libvpx_test::kRealTime, ::libvpx_test::kRealTime,
}; };
@ -80,17 +75,13 @@ int is_extension_y4m(const char *filename) {
class EndToEndTestLarge class EndToEndTestLarge
: public ::libvpx_test::EncoderTest, : public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWith3Params<libvpx_test::TestMode, \ public ::libvpx_test::CodecTestWith3Params<libvpx_test::TestMode,
TestVideoParam, int> { TestVideoParam, int> {
protected: protected:
EndToEndTestLarge() EndToEndTestLarge()
: EncoderTest(GET_PARAM(0)), : EncoderTest(GET_PARAM(0)), test_video_param_(GET_PARAM(2)),
test_video_param_(GET_PARAM(2)), cpu_used_(GET_PARAM(3)), psnr_(0.0), nframes_(0),
cpu_used_(GET_PARAM(3)), encoding_mode_(GET_PARAM(1)) {}
psnr_(0.0),
nframes_(0),
encoding_mode_(GET_PARAM(1)) {
}
virtual ~EndToEndTestLarge() {} virtual ~EndToEndTestLarge() {}
@ -136,8 +127,7 @@ class EndToEndTestLarge
} }
double GetAveragePsnr() const { double GetAveragePsnr() const {
if (nframes_) if (nframes_) return psnr_ / nframes_;
return psnr_ / nframes_;
return 0.0; return 0.0;
} }
@ -161,18 +151,16 @@ TEST_P(EndToEndTestLarge, EndtoEndPSNRTest) {
cfg_.g_input_bit_depth = test_video_param_.input_bit_depth; cfg_.g_input_bit_depth = test_video_param_.input_bit_depth;
cfg_.g_bit_depth = test_video_param_.bit_depth; cfg_.g_bit_depth = test_video_param_.bit_depth;
init_flags_ = VPX_CODEC_USE_PSNR; init_flags_ = VPX_CODEC_USE_PSNR;
if (cfg_.g_bit_depth > 8) if (cfg_.g_bit_depth > 8) init_flags_ |= VPX_CODEC_USE_HIGHBITDEPTH;
init_flags_ |= VPX_CODEC_USE_HIGHBITDEPTH;
libvpx_test::VideoSource *video; libvpx_test::VideoSource *video;
if (is_extension_y4m(test_video_param_.filename)) { if (is_extension_y4m(test_video_param_.filename)) {
video = new libvpx_test::Y4mVideoSource(test_video_param_.filename, video =
0, kFrames); new libvpx_test::Y4mVideoSource(test_video_param_.filename, 0, kFrames);
} else { } else {
video = new libvpx_test::YUVVideoSource(test_video_param_.filename, video = new libvpx_test::YUVVideoSource(test_video_param_.filename,
test_video_param_.fmt, test_video_param_.fmt, kWidth,
kWidth, kHeight, kHeight, kFramerate, 1, 0, kFrames);
kFramerate, 1, 0, kFrames);
} }
ASSERT_NO_FATAL_FAILURE(RunLoop(video)); ASSERT_NO_FATAL_FAILURE(RunLoop(video));
@ -181,8 +169,7 @@ TEST_P(EndToEndTestLarge, EndtoEndPSNRTest) {
delete (video); delete (video);
} }
VP9_INSTANTIATE_TEST_CASE( VP9_INSTANTIATE_TEST_CASE(EndToEndTestLarge,
EndToEndTestLarge,
::testing::ValuesIn(kEncodingModeVectors), ::testing::ValuesIn(kEncodingModeVectors),
::testing::ValuesIn(kTestVectors), ::testing::ValuesIn(kTestVectors),
::testing::ValuesIn(kCpuUsedVectors)); ::testing::ValuesIn(kCpuUsedVectors));

View File

@ -32,8 +32,7 @@ const int kNumIterations = 1000;
typedef int64_t (*ErrorBlockFunc)(const tran_low_t *coeff, typedef int64_t (*ErrorBlockFunc)(const tran_low_t *coeff,
const tran_low_t *dqcoeff, const tran_low_t *dqcoeff,
intptr_t block_size, intptr_t block_size, int64_t *ssz, int bps);
int64_t *ssz, int bps);
typedef std::tr1::tuple<ErrorBlockFunc, ErrorBlockFunc, vpx_bit_depth_t> typedef std::tr1::tuple<ErrorBlockFunc, ErrorBlockFunc, vpx_bit_depth_t>
ErrorBlockParam; ErrorBlockParam;
@ -51,8 +50,7 @@ int64_t HighBdBlockError8bitWrapper(const tran_low_t *coeff,
return fn(coeff, dqcoeff, block_size, ssz); return fn(coeff, dqcoeff, block_size, ssz);
} }
class ErrorBlockTest class ErrorBlockTest : public ::testing::TestWithParam<ErrorBlockParam> {
: public ::testing::TestWithParam<ErrorBlockParam> {
public: public:
virtual ~ErrorBlockTest() {} virtual ~ErrorBlockTest() {}
virtual void SetUp() { virtual void SetUp() {
@ -97,10 +95,10 @@ TEST_P(ErrorBlockTest, OperationCheck) {
dqcoeff[j] = -rnd(1 << msb); dqcoeff[j] = -rnd(1 << msb);
} }
} }
ref_ret = ref_error_block_op_(coeff, dqcoeff, block_size, &ref_ssz, ref_ret =
bit_depth_); ref_error_block_op_(coeff, dqcoeff, block_size, &ref_ssz, bit_depth_);
ASM_REGISTER_STATE_CHECK(ret = error_block_op_(coeff, dqcoeff, block_size, ASM_REGISTER_STATE_CHECK(
&ssz, bit_depth_)); ret = error_block_op_(coeff, dqcoeff, block_size, &ssz, bit_depth_));
err_count += (ref_ret != ret) | (ref_ssz != ssz); err_count += (ref_ret != ret) | (ref_ssz != ssz);
if (err_count && !err_count_total) { if (err_count && !err_count_total) {
first_failure = i; first_failure = i;
@ -155,10 +153,10 @@ TEST_P(ErrorBlockTest, ExtremeValues) {
} }
} }
} }
ref_ret = ref_error_block_op_(coeff, dqcoeff, block_size, &ref_ssz, ref_ret =
bit_depth_); ref_error_block_op_(coeff, dqcoeff, block_size, &ref_ssz, bit_depth_);
ASM_REGISTER_STATE_CHECK(ret = error_block_op_(coeff, dqcoeff, block_size, ASM_REGISTER_STATE_CHECK(
&ssz, bit_depth_)); ret = error_block_op_(coeff, dqcoeff, block_size, &ssz, bit_depth_));
err_count += (ref_ret != ret) | (ref_ssz != ssz); err_count += (ref_ret != ret) | (ref_ssz != ssz);
if (err_count && !err_count_total) { if (err_count && !err_count_total) {
first_failure = i; first_failure = i;
@ -176,12 +174,12 @@ using std::tr1::make_tuple;
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, ErrorBlockTest, SSE2, ErrorBlockTest,
::testing::Values( ::testing::Values(
make_tuple(&vp9_highbd_block_error_sse2, make_tuple(&vp9_highbd_block_error_sse2, &vp9_highbd_block_error_c,
&vp9_highbd_block_error_c, VPX_BITS_10), VPX_BITS_10),
make_tuple(&vp9_highbd_block_error_sse2, make_tuple(&vp9_highbd_block_error_sse2, &vp9_highbd_block_error_c,
&vp9_highbd_block_error_c, VPX_BITS_12), VPX_BITS_12),
make_tuple(&vp9_highbd_block_error_sse2, make_tuple(&vp9_highbd_block_error_sse2, &vp9_highbd_block_error_c,
&vp9_highbd_block_error_c, VPX_BITS_8), VPX_BITS_8),
make_tuple( make_tuple(
&HighBdBlockError8bitWrapper<vp9_highbd_block_error_8bit_sse2>, &HighBdBlockError8bitWrapper<vp9_highbd_block_error_8bit_sse2>,
&HighBdBlockError8bitWrapper<vp9_highbd_block_error_8bit_c>, &HighBdBlockError8bitWrapper<vp9_highbd_block_error_8bit_c>,

View File

@ -23,11 +23,8 @@ class VPxEncoderThreadTest
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> { public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
protected: protected:
VPxEncoderThreadTest() VPxEncoderThreadTest()
: EncoderTest(GET_PARAM(0)), : EncoderTest(GET_PARAM(0)), encoder_initialized_(false), tiles_(2),
encoder_initialized_(false), encoding_mode_(GET_PARAM(1)), set_cpu_used_(GET_PARAM(2)) {
tiles_(2),
encoding_mode_(GET_PARAM(1)),
set_cpu_used_(GET_PARAM(2)) {
init_flags_ = VPX_CODEC_USE_PSNR; init_flags_ = VPX_CODEC_USE_PSNR;
md5_.clear(); md5_.clear();
} }
@ -123,9 +120,9 @@ TEST_P(VPxEncoderThreadTest, EncoderResultTest) {
ASSERT_EQ(single_thr_md5, multi_thr_md5); ASSERT_EQ(single_thr_md5, multi_thr_md5);
} }
VP9_INSTANTIATE_TEST_CASE( VP9_INSTANTIATE_TEST_CASE(VPxEncoderThreadTest,
VPxEncoderThreadTest, ::testing::Values(::libvpx_test::kTwoPassGood,
::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood, ::libvpx_test::kOnePassGood,
::libvpx_test::kRealTime), ::libvpx_test::kRealTime),
::testing::Range(1, 9)); ::testing::Range(1, 9));
} // namespace } // namespace

View File

@ -74,8 +74,7 @@ string DecodeFileWithPause(const string &filename, int num_threads,
} }
// Flush the decoder at the end of the video. // Flush the decoder at the end of the video.
if (!video.cxdata()) if (!video.cxdata()) decoder.DecodeFrame(NULL, 0);
decoder.DecodeFrame(NULL, 0);
libvpx_test::DxDataIterator dec_iter = decoder.GetDxData(); libvpx_test::DxDataIterator dec_iter = decoder.GetDxData();
const vpx_image_t *img; const vpx_image_t *img;
@ -87,8 +86,8 @@ string DecodeFileWithPause(const string &filename, int num_threads,
} }
} while (video.cxdata() != NULL); } while (video.cxdata() != NULL);
EXPECT_EQ(in_frames, out_frames) << EXPECT_EQ(in_frames, out_frames)
"Input frame count does not match output frame count"; << "Input frame count does not match output frame count";
return string(md5.Get()); return string(md5.Get());
} }
@ -108,12 +107,12 @@ TEST(VP9MultiThreadedFrameParallel, PauseSeekResume) {
// vp90-2-07-frame_parallel-1.webm is a 40 frame video file with // vp90-2-07-frame_parallel-1.webm is a 40 frame video file with
// one key frame for every ten frames. // one key frame for every ten frames.
static const PauseFileList files[] = { static const PauseFileList files[] = {
{ "vp90-2-07-frame_parallel-1.webm", { "vp90-2-07-frame_parallel-1.webm", "6ea7c3875d67252e7caf2bc6e75b36b1",
"6ea7c3875d67252e7caf2bc6e75b36b1", 6 }, 6 },
{ "vp90-2-07-frame_parallel-1.webm", { "vp90-2-07-frame_parallel-1.webm", "4bb634160c7356a8d7d4299b6dc83a45",
"4bb634160c7356a8d7d4299b6dc83a45", 12 }, 12 },
{ "vp90-2-07-frame_parallel-1.webm", { "vp90-2-07-frame_parallel-1.webm", "89772591e6ef461f9fa754f916c78ed8",
"89772591e6ef461f9fa754f916c78ed8", 26 }, 26 },
{ NULL, NULL, 0 }, { NULL, NULL, 0 },
}; };
DecodeFilesWithPause(files); DecodeFilesWithPause(files);
@ -155,8 +154,7 @@ string DecodeFile(const string &filename, int num_threads,
video.Next(); video.Next();
// Flush the decoder at the end of the video. // Flush the decoder at the end of the video.
if (!video.cxdata()) if (!video.cxdata()) decoder.DecodeFrame(NULL, 0);
decoder.DecodeFrame(NULL, 0);
libvpx_test::DxDataIterator dec_iter = decoder.GetDxData(); libvpx_test::DxDataIterator dec_iter = decoder.GetDxData();
const vpx_image_t *img; const vpx_image_t *img;
@ -168,8 +166,8 @@ string DecodeFile(const string &filename, int num_threads,
} }
} while (video.cxdata() != NULL); } while (video.cxdata() != NULL);
EXPECT_EQ(expected_frame_count, out_frames) << EXPECT_EQ(expected_frame_count, out_frames)
"Input frame count does not match expected output frame count"; << "Input frame count does not match expected output frame count";
return string(md5.Get()); return string(md5.Get());
} }
@ -209,8 +207,7 @@ TEST(VP9MultiThreadedFrameParallel, InvalidFileTest) {
TEST(VP9MultiThreadedFrameParallel, ValidFileTest) { TEST(VP9MultiThreadedFrameParallel, ValidFileTest) {
static const FileList files[] = { static const FileList files[] = {
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
{ "vp92-2-20-10bit-yuv420.webm", { "vp92-2-20-10bit-yuv420.webm", "a16b99df180c584e8db2ffeda987d293", 10 },
"a16b99df180c584e8db2ffeda987d293", 10 },
#endif #endif
{ NULL, NULL, 0 }, { NULL, NULL, 0 },
}; };

View File

@ -29,14 +29,13 @@ using libvpx_test::ACMRandom;
const int count_test_block = 100000; const int count_test_block = 100000;
typedef void (*IntraPred)(uint16_t *dst, ptrdiff_t stride, typedef void (*IntraPred)(uint16_t *dst, ptrdiff_t stride,
const uint16_t* above, const uint16_t* left, const uint16_t *above, const uint16_t *left, int bps);
int bps);
struct IntraPredFunc { struct IntraPredFunc {
IntraPredFunc(IntraPred pred = NULL, IntraPred ref = NULL, IntraPredFunc(IntraPred pred = NULL, IntraPred ref = NULL,
int block_size_value = 0, int bit_depth_value = 0) int block_size_value = 0, int bit_depth_value = 0)
: pred_fn(pred), ref_fn(ref), : pred_fn(pred), ref_fn(ref), block_size(block_size_value),
block_size(block_size_value), bit_depth(bit_depth_value) {} bit_depth(bit_depth_value) {}
IntraPred pred_fn; IntraPred pred_fn;
IntraPred ref_fn; IntraPred ref_fn;
@ -46,8 +45,8 @@ struct IntraPredFunc {
class VP9IntraPredTest : public ::testing::TestWithParam<IntraPredFunc> { class VP9IntraPredTest : public ::testing::TestWithParam<IntraPredFunc> {
public: public:
void RunTest(uint16_t* left_col, uint16_t* above_data, void RunTest(uint16_t *left_col, uint16_t *above_data, uint16_t *dst,
uint16_t* dst, uint16_t* ref_dst) { uint16_t *ref_dst) {
ACMRandom rnd(ACMRandom::DeterministicSeed()); ACMRandom rnd(ACMRandom::DeterministicSeed());
const int block_size = params_.block_size; const int block_size = params_.block_size;
above_row_ = above_data + 16; above_row_ = above_data + 16;
@ -87,8 +86,8 @@ class VP9IntraPredTest : public ::testing::TestWithParam<IntraPredFunc> {
void Predict() { void Predict() {
const int bit_depth = params_.bit_depth; const int bit_depth = params_.bit_depth;
params_.ref_fn(ref_dst_, stride_, above_row_, left_col_, bit_depth); params_.ref_fn(ref_dst_, stride_, above_row_, left_col_, bit_depth);
ASM_REGISTER_STATE_CHECK(params_.pred_fn(dst_, stride_, ASM_REGISTER_STATE_CHECK(
above_row_, left_col_, bit_depth)); params_.pred_fn(dst_, stride_, above_row_, left_col_, bit_depth));
} }
void CheckPrediction(int test_case_number, int *error_count) const { void CheckPrediction(int test_case_number, int *error_count) const {
@ -126,9 +125,9 @@ TEST_P(VP9IntraPredTest, IntraPredTests) {
#if HAVE_SSE2 #if HAVE_SSE2
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(SSE2_TO_C_8, VP9IntraPredTest, INSTANTIATE_TEST_CASE_P(
::testing::Values( SSE2_TO_C_8, VP9IntraPredTest,
IntraPredFunc(&vpx_highbd_dc_predictor_32x32_sse2, ::testing::Values(IntraPredFunc(&vpx_highbd_dc_predictor_32x32_sse2,
&vpx_highbd_dc_predictor_32x32_c, 32, 8), &vpx_highbd_dc_predictor_32x32_c, 32, 8),
IntraPredFunc(&vpx_highbd_tm_predictor_16x16_sse2, IntraPredFunc(&vpx_highbd_tm_predictor_16x16_sse2,
&vpx_highbd_tm_predictor_16x16_c, 16, 8), &vpx_highbd_tm_predictor_16x16_c, 16, 8),
@ -153,9 +152,9 @@ INSTANTIATE_TEST_CASE_P(SSE2_TO_C_8, VP9IntraPredTest,
IntraPredFunc(&vpx_highbd_tm_predictor_8x8_sse2, IntraPredFunc(&vpx_highbd_tm_predictor_8x8_sse2,
&vpx_highbd_tm_predictor_8x8_c, 8, 8))); &vpx_highbd_tm_predictor_8x8_c, 8, 8)));
INSTANTIATE_TEST_CASE_P(SSE2_TO_C_10, VP9IntraPredTest, INSTANTIATE_TEST_CASE_P(
::testing::Values( SSE2_TO_C_10, VP9IntraPredTest,
IntraPredFunc(&vpx_highbd_dc_predictor_32x32_sse2, ::testing::Values(IntraPredFunc(&vpx_highbd_dc_predictor_32x32_sse2,
&vpx_highbd_dc_predictor_32x32_c, 32, 10), &vpx_highbd_dc_predictor_32x32_c, 32, 10),
IntraPredFunc(&vpx_highbd_tm_predictor_16x16_sse2, IntraPredFunc(&vpx_highbd_tm_predictor_16x16_sse2,
&vpx_highbd_tm_predictor_16x16_c, 16, 10), &vpx_highbd_tm_predictor_16x16_c, 16, 10),
@ -180,9 +179,9 @@ INSTANTIATE_TEST_CASE_P(SSE2_TO_C_10, VP9IntraPredTest,
IntraPredFunc(&vpx_highbd_tm_predictor_8x8_sse2, IntraPredFunc(&vpx_highbd_tm_predictor_8x8_sse2,
&vpx_highbd_tm_predictor_8x8_c, 8, 10))); &vpx_highbd_tm_predictor_8x8_c, 8, 10)));
INSTANTIATE_TEST_CASE_P(SSE2_TO_C_12, VP9IntraPredTest, INSTANTIATE_TEST_CASE_P(
::testing::Values( SSE2_TO_C_12, VP9IntraPredTest,
IntraPredFunc(&vpx_highbd_dc_predictor_32x32_sse2, ::testing::Values(IntraPredFunc(&vpx_highbd_dc_predictor_32x32_sse2,
&vpx_highbd_dc_predictor_32x32_c, 32, 12), &vpx_highbd_dc_predictor_32x32_c, 32, 12),
IntraPredFunc(&vpx_highbd_tm_predictor_16x16_sse2, IntraPredFunc(&vpx_highbd_tm_predictor_16x16_sse2,
&vpx_highbd_tm_predictor_16x16_c, 16, 12), &vpx_highbd_tm_predictor_16x16_c, 16, 12),

View File

@ -21,15 +21,13 @@ namespace {
const int kMaxPsnr = 100; const int kMaxPsnr = 100;
class LosslessTest : public ::libvpx_test::EncoderTest, class LosslessTest
: public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> { public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
protected: protected:
LosslessTest() LosslessTest()
: EncoderTest(GET_PARAM(0)), : EncoderTest(GET_PARAM(0)), psnr_(kMaxPsnr), nframes_(0),
psnr_(kMaxPsnr), encoding_mode_(GET_PARAM(1)) {}
nframes_(0),
encoding_mode_(GET_PARAM(1)) {
}
virtual ~LosslessTest() {} virtual ~LosslessTest() {}
@ -55,13 +53,10 @@ class LosslessTest : public ::libvpx_test::EncoderTest,
} }
virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) { virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
if (pkt->data.psnr.psnr[0] < psnr_) if (pkt->data.psnr.psnr[0] < psnr_) psnr_ = pkt->data.psnr.psnr[0];
psnr_= pkt->data.psnr.psnr[0];
} }
double GetMinPsnr() const { double GetMinPsnr() const { return psnr_; }
return psnr_;
}
private: private:
double psnr_; double psnr_;

View File

@ -34,9 +34,8 @@ const int number_of_iterations = 100;
typedef void (*QuantizeFunc)(const tran_low_t *coeff, intptr_t count, typedef void (*QuantizeFunc)(const tran_low_t *coeff, intptr_t count,
int skip_block, const int16_t *zbin, int skip_block, const int16_t *zbin,
const int16_t *round, const int16_t *quant, const int16_t *round, const int16_t *quant,
const int16_t *quant_shift, const int16_t *quant_shift, tran_low_t *qcoeff,
tran_low_t *qcoeff, tran_low_t *dqcoeff, tran_low_t *dqcoeff, const int16_t *dequant,
const int16_t *dequant,
uint16_t *eob, const int16_t *scan, uint16_t *eob, const int16_t *scan,
const int16_t *iscan); const int16_t *iscan);
typedef std::tr1::tuple<QuantizeFunc, QuantizeFunc, vpx_bit_depth_t> typedef std::tr1::tuple<QuantizeFunc, QuantizeFunc, vpx_bit_depth_t>
@ -117,12 +116,11 @@ TEST_P(VP9QuantizeTest, OperationCheck) {
} }
ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr, ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
quant_ptr, quant_shift_ptr, ref_qcoeff_ptr, quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
ref_dqcoeff_ptr, dequant_ptr, ref_dqcoeff_ptr, dequant_ptr, ref_eob_ptr,
ref_eob_ptr, scan_order->scan, scan_order->iscan); scan_order->scan, scan_order->iscan);
ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block, ASM_REGISTER_STATE_CHECK(quantize_op_(
zbin_ptr, round_ptr, quant_ptr, coeff_ptr, count, skip_block, zbin_ptr, round_ptr, quant_ptr,
quant_shift_ptr, qcoeff_ptr, quant_shift_ptr, qcoeff_ptr, dqcoeff_ptr, dequant_ptr, eob_ptr,
dqcoeff_ptr, dequant_ptr, eob_ptr,
scan_order->scan, scan_order->iscan)); scan_order->scan, scan_order->iscan));
for (int j = 0; j < sz; ++j) { for (int j = 0; j < sz; ++j) {
err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) | err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |
@ -176,12 +174,11 @@ TEST_P(VP9Quantize32Test, OperationCheck) {
} }
ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr, ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
quant_ptr, quant_shift_ptr, ref_qcoeff_ptr, quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
ref_dqcoeff_ptr, dequant_ptr, ref_dqcoeff_ptr, dequant_ptr, ref_eob_ptr,
ref_eob_ptr, scan_order->scan, scan_order->iscan); scan_order->scan, scan_order->iscan);
ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block, ASM_REGISTER_STATE_CHECK(quantize_op_(
zbin_ptr, round_ptr, quant_ptr, coeff_ptr, count, skip_block, zbin_ptr, round_ptr, quant_ptr,
quant_shift_ptr, qcoeff_ptr, quant_shift_ptr, qcoeff_ptr, dqcoeff_ptr, dequant_ptr, eob_ptr,
dqcoeff_ptr, dequant_ptr, eob_ptr,
scan_order->scan, scan_order->iscan)); scan_order->scan, scan_order->iscan));
for (int j = 0; j < sz; ++j) { for (int j = 0; j < sz; ++j) {
err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) | err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |
@ -239,12 +236,11 @@ TEST_P(VP9QuantizeTest, EOBCheck) {
ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr, ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
quant_ptr, quant_shift_ptr, ref_qcoeff_ptr, quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
ref_dqcoeff_ptr, dequant_ptr, ref_dqcoeff_ptr, dequant_ptr, ref_eob_ptr,
ref_eob_ptr, scan_order->scan, scan_order->iscan); scan_order->scan, scan_order->iscan);
ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block, ASM_REGISTER_STATE_CHECK(quantize_op_(
zbin_ptr, round_ptr, quant_ptr, coeff_ptr, count, skip_block, zbin_ptr, round_ptr, quant_ptr,
quant_shift_ptr, qcoeff_ptr, quant_shift_ptr, qcoeff_ptr, dqcoeff_ptr, dequant_ptr, eob_ptr,
dqcoeff_ptr, dequant_ptr, eob_ptr,
scan_order->scan, scan_order->iscan)); scan_order->scan, scan_order->iscan));
for (int j = 0; j < sz; ++j) { for (int j = 0; j < sz; ++j) {
@ -303,12 +299,11 @@ TEST_P(VP9Quantize32Test, EOBCheck) {
ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr, ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
quant_ptr, quant_shift_ptr, ref_qcoeff_ptr, quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
ref_dqcoeff_ptr, dequant_ptr, ref_dqcoeff_ptr, dequant_ptr, ref_eob_ptr,
ref_eob_ptr, scan_order->scan, scan_order->iscan); scan_order->scan, scan_order->iscan);
ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block, ASM_REGISTER_STATE_CHECK(quantize_op_(
zbin_ptr, round_ptr, quant_ptr, coeff_ptr, count, skip_block, zbin_ptr, round_ptr, quant_ptr,
quant_shift_ptr, qcoeff_ptr, quant_shift_ptr, qcoeff_ptr, dqcoeff_ptr, dequant_ptr, eob_ptr,
dqcoeff_ptr, dequant_ptr, eob_ptr,
scan_order->scan, scan_order->iscan)); scan_order->scan, scan_order->iscan));
for (int j = 0; j < sz; ++j) { for (int j = 0; j < sz; ++j) {
@ -330,8 +325,7 @@ using std::tr1::make_tuple;
#if HAVE_SSE2 #if HAVE_SSE2
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, VP9QuantizeTest, SSE2, VP9QuantizeTest,
::testing::Values( ::testing::Values(make_tuple(&vpx_highbd_quantize_b_sse2,
make_tuple(&vpx_highbd_quantize_b_sse2,
&vpx_highbd_quantize_b_c, VPX_BITS_8), &vpx_highbd_quantize_b_c, VPX_BITS_8),
make_tuple(&vpx_highbd_quantize_b_sse2, make_tuple(&vpx_highbd_quantize_b_sse2,
&vpx_highbd_quantize_b_c, VPX_BITS_10), &vpx_highbd_quantize_b_c, VPX_BITS_10),
@ -339,8 +333,7 @@ INSTANTIATE_TEST_CASE_P(
&vpx_highbd_quantize_b_c, VPX_BITS_12))); &vpx_highbd_quantize_b_c, VPX_BITS_12)));
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
SSE2, VP9Quantize32Test, SSE2, VP9Quantize32Test,
::testing::Values( ::testing::Values(make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
&vpx_highbd_quantize_b_32x32_c, VPX_BITS_8), &vpx_highbd_quantize_b_32x32_c, VPX_BITS_8),
make_tuple(&vpx_highbd_quantize_b_32x32_sse2, make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
&vpx_highbd_quantize_b_32x32_c, VPX_BITS_10), &vpx_highbd_quantize_b_32x32_c, VPX_BITS_10),

View File

@ -24,14 +24,10 @@ const char kVp9Md5File[] = "vp90-2-08-tile_1x8_frame_parallel.webm.md5";
// Class for testing shutting off the loop filter. // Class for testing shutting off the loop filter.
class SkipLoopFilterTest { class SkipLoopFilterTest {
public: public:
SkipLoopFilterTest() SkipLoopFilterTest() : video_(NULL), decoder_(NULL), md5_file_(NULL) {}
: video_(NULL),
decoder_(NULL),
md5_file_(NULL) {}
~SkipLoopFilterTest() { ~SkipLoopFilterTest() {
if (md5_file_ != NULL) if (md5_file_ != NULL) fclose(md5_file_);
fclose(md5_file_);
delete decoder_; delete decoder_;
delete video_; delete video_;
} }
@ -46,8 +42,7 @@ class SkipLoopFilterTest {
video_->Begin(); video_->Begin();
vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t(); vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
if (num_threads > 0) if (num_threads > 0) cfg.threads = num_threads;
cfg.threads = num_threads;
decoder_ = new libvpx_test::VP9Decoder(cfg, 0); decoder_ = new libvpx_test::VP9Decoder(cfg, 0);
ASSERT_TRUE(decoder_ != NULL); ASSERT_TRUE(decoder_ != NULL);
@ -73,8 +68,7 @@ class SkipLoopFilterTest {
for (; video_->cxdata() != NULL; video_->Next()) { for (; video_->cxdata() != NULL; video_->Next()) {
const vpx_codec_err_t res = const vpx_codec_err_t res =
decoder_->DecodeFrame(video_->cxdata(), video_->frame_size()); decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
if (res != VPX_CODEC_OK) if (res != VPX_CODEC_OK) return res;
return res;
ReadMd5(); ReadMd5();
} }
return VPX_CODEC_OK; return VPX_CODEC_OK;

View File

@ -19,18 +19,16 @@
#include "vp9/common/vp9_blockd.h" #include "vp9/common/vp9_blockd.h"
#include "vpx_mem/vpx_mem.h" #include "vpx_mem/vpx_mem.h"
typedef void (*SubtractFunc)(int rows, int cols, typedef void (*SubtractFunc)(int rows, int cols, int16_t *diff_ptr,
int16_t *diff_ptr, ptrdiff_t diff_stride, ptrdiff_t diff_stride, const uint8_t *src_ptr,
const uint8_t *src_ptr, ptrdiff_t src_stride, ptrdiff_t src_stride, const uint8_t *pred_ptr,
const uint8_t *pred_ptr, ptrdiff_t pred_stride); ptrdiff_t pred_stride);
namespace vp9 { namespace vp9 {
class VP9SubtractBlockTest : public ::testing::TestWithParam<SubtractFunc> { class VP9SubtractBlockTest : public ::testing::TestWithParam<SubtractFunc> {
public: public:
virtual void TearDown() { virtual void TearDown() { libvpx_test::ClearSystemState(); }
libvpx_test::ClearSystemState();
}
}; };
using libvpx_test::ACMRandom; using libvpx_test::ACMRandom;
@ -58,29 +56,26 @@ TEST_P(VP9SubtractBlockTest, SimpleSubtract) {
} }
} }
GetParam()(block_height, block_width, diff, block_width, GetParam()(block_height, block_width, diff, block_width, src, block_width,
src, block_width, pred, block_width); pred, block_width);
for (int r = 0; r < block_height; ++r) { for (int r = 0; r < block_height; ++r) {
for (int c = 0; c < block_width; ++c) { for (int c = 0; c < block_width; ++c) {
EXPECT_EQ(diff[r * block_width + c], EXPECT_EQ(diff[r * block_width + c],
(src[r * block_width + c] - (src[r * block_width + c] - pred[r * block_width + c]))
pred[r * block_width + c])) << "r = " << r << "r = " << r << ", c = " << c << ", bs = " << bsize;
<< ", c = " << c
<< ", bs = " << bsize;
} }
} }
GetParam()(block_height, block_width, diff, block_width * 2, GetParam()(block_height, block_width, diff, block_width * 2, src,
src, block_width * 2, pred, block_width * 2); block_width * 2, pred, block_width * 2);
for (int r = 0; r < block_height; ++r) { for (int r = 0; r < block_height; ++r) {
for (int c = 0; c < block_width; ++c) { for (int c = 0; c < block_width; ++c) {
EXPECT_EQ(diff[r * block_width * 2 + c], EXPECT_EQ(
(src[r * block_width * 2 + c] - diff[r * block_width * 2 + c],
pred[r * block_width * 2 + c])) << "r = " << r (src[r * block_width * 2 + c] - pred[r * block_width * 2 + c]))
<< ", c = " << c << "r = " << r << ", c = " << c << ", bs = " << bsize;
<< ", bs = " << bsize;
} }
} }
} }

View File

@ -27,13 +27,9 @@ using std::string;
class VPxWorkerThreadTest : public ::testing::TestWithParam<bool> { class VPxWorkerThreadTest : public ::testing::TestWithParam<bool> {
protected: protected:
virtual ~VPxWorkerThreadTest() {} virtual ~VPxWorkerThreadTest() {}
virtual void SetUp() { virtual void SetUp() { vpx_get_worker_interface()->init(&worker_); }
vpx_get_worker_interface()->init(&worker_);
}
virtual void TearDown() { virtual void TearDown() { vpx_get_worker_interface()->end(&worker_); }
vpx_get_worker_interface()->end(&worker_);
}
void Run(VPxWorker *worker) { void Run(VPxWorker *worker) {
const bool synchronous = GetParam(); const bool synchronous = GetParam();
@ -191,8 +187,8 @@ void DecodeFiles(const FileList files[]) {
for (const FileList *iter = files; iter->name != NULL; ++iter) { for (const FileList *iter = files; iter->name != NULL; ++iter) {
SCOPED_TRACE(iter->name); SCOPED_TRACE(iter->name);
for (int t = 1; t <= 8; ++t) { for (int t = 1; t <= 8; ++t) {
EXPECT_EQ(iter->expected_md5, DecodeFile(iter->name, t)) EXPECT_EQ(iter->expected_md5, DecodeFile(iter->name, t)) << "threads = "
<< "threads = " << t; << t;
} }
} }
} }
@ -242,15 +238,13 @@ TEST(VP9DecodeMultiThreadedTest, NoTilesNonFrameParallel) {
} }
TEST(VP9DecodeMultiThreadedTest, FrameParallel) { TEST(VP9DecodeMultiThreadedTest, FrameParallel) {
static const FileList files[] = { static const FileList files[] = { { "vp90-2-08-tile_1x2_frame_parallel.webm",
{ "vp90-2-08-tile_1x2_frame_parallel.webm",
"68ede6abd66bae0a2edf2eb9232241b6" }, "68ede6abd66bae0a2edf2eb9232241b6" },
{ "vp90-2-08-tile_1x4_frame_parallel.webm", { "vp90-2-08-tile_1x4_frame_parallel.webm",
"368ebc6ebf3a5e478d85b2c3149b2848" }, "368ebc6ebf3a5e478d85b2c3149b2848" },
{ "vp90-2-08-tile_1x8_frame_parallel.webm", { "vp90-2-08-tile_1x8_frame_parallel.webm",
"17e439da2388aff3a0f69cb22579c6c1" }, "17e439da2388aff3a0f69cb22579c6c1" },
{ NULL, NULL } { NULL, NULL } };
};
DecodeFiles(files); DecodeFiles(files);
} }

View File

@ -25,9 +25,7 @@ typedef void (*CopyFrameFunc)(const YV12_BUFFER_CONFIG *src_ybf,
class VpxScaleBase { class VpxScaleBase {
public: public:
virtual ~VpxScaleBase() { virtual ~VpxScaleBase() { libvpx_test::ClearSystemState(); }
libvpx_test::ClearSystemState();
}
void ResetImage(int width, int height) { void ResetImage(int width, int height) {
width_ = width; width_ = width;
@ -112,21 +110,15 @@ class VpxScaleBase {
} }
void ReferenceExtendBorder() { void ReferenceExtendBorder() {
ExtendPlane(ref_img_.y_buffer, ExtendPlane(ref_img_.y_buffer, ref_img_.y_crop_width,
ref_img_.y_crop_width, ref_img_.y_crop_height, ref_img_.y_crop_height, ref_img_.y_width, ref_img_.y_height,
ref_img_.y_width, ref_img_.y_height, ref_img_.y_stride, ref_img_.border);
ref_img_.y_stride, ExtendPlane(ref_img_.u_buffer, ref_img_.uv_crop_width,
ref_img_.border); ref_img_.uv_crop_height, ref_img_.uv_width, ref_img_.uv_height,
ExtendPlane(ref_img_.u_buffer, ref_img_.uv_stride, ref_img_.border / 2);
ref_img_.uv_crop_width, ref_img_.uv_crop_height, ExtendPlane(ref_img_.v_buffer, ref_img_.uv_crop_width,
ref_img_.uv_width, ref_img_.uv_height, ref_img_.uv_crop_height, ref_img_.uv_width, ref_img_.uv_height,
ref_img_.uv_stride, ref_img_.uv_stride, ref_img_.border / 2);
ref_img_.border / 2);
ExtendPlane(ref_img_.v_buffer,
ref_img_.uv_crop_width, ref_img_.uv_crop_height,
ref_img_.uv_width, ref_img_.uv_height,
ref_img_.uv_stride,
ref_img_.border / 2);
} }
void ReferenceCopyFrame() { void ReferenceCopyFrame() {
@ -172,13 +164,9 @@ class ExtendBorderTest
virtual ~ExtendBorderTest() {} virtual ~ExtendBorderTest() {}
protected: protected:
virtual void SetUp() { virtual void SetUp() { extend_fn_ = GetParam(); }
extend_fn_ = GetParam();
}
void ExtendBorder() { void ExtendBorder() { ASM_REGISTER_STATE_CHECK(extend_fn_(&img_)); }
ASM_REGISTER_STATE_CHECK(extend_fn_(&img_));
}
void RunTest() { void RunTest() {
#if ARCH_ARM #if ARCH_ARM
@ -202,23 +190,18 @@ class ExtendBorderTest
ExtendFrameBorderFunc extend_fn_; ExtendFrameBorderFunc extend_fn_;
}; };
TEST_P(ExtendBorderTest, ExtendBorder) { TEST_P(ExtendBorderTest, ExtendBorder) { ASSERT_NO_FATAL_FAILURE(RunTest()); }
ASSERT_NO_FATAL_FAILURE(RunTest());
}
INSTANTIATE_TEST_CASE_P(C, ExtendBorderTest, INSTANTIATE_TEST_CASE_P(C, ExtendBorderTest,
::testing::Values(vp8_yv12_extend_frame_borders_c)); ::testing::Values(vp8_yv12_extend_frame_borders_c));
class CopyFrameTest class CopyFrameTest : public VpxScaleBase,
: public VpxScaleBase,
public ::testing::TestWithParam<CopyFrameFunc> { public ::testing::TestWithParam<CopyFrameFunc> {
public: public:
virtual ~CopyFrameTest() {} virtual ~CopyFrameTest() {}
protected: protected:
virtual void SetUp() { virtual void SetUp() { copy_frame_fn_ = GetParam(); }
copy_frame_fn_ = GetParam();
}
void CopyFrame() { void CopyFrame() {
ASM_REGISTER_STATE_CHECK(copy_frame_fn_(&img_, &cpy_img_)); ASM_REGISTER_STATE_CHECK(copy_frame_fn_(&img_, &cpy_img_));
@ -246,9 +229,7 @@ class CopyFrameTest
CopyFrameFunc copy_frame_fn_; CopyFrameFunc copy_frame_fn_;
}; };
TEST_P(CopyFrameTest, CopyFrame) { TEST_P(CopyFrameTest, CopyFrame) { ASSERT_NO_FATAL_FAILURE(RunTest()); }
ASSERT_NO_FATAL_FAILURE(RunTest());
}
INSTANTIATE_TEST_CASE_P(C, CopyFrameTest, INSTANTIATE_TEST_CASE_P(C, CopyFrameTest,
::testing::Values(vp8_yv12_copy_frame_c)); ::testing::Values(vp8_yv12_copy_frame_c));

View File

@ -25,25 +25,18 @@ namespace libvpx_test {
class WebMVideoSource : public CompressedVideoSource { class WebMVideoSource : public CompressedVideoSource {
public: public:
explicit WebMVideoSource(const std::string &file_name) explicit WebMVideoSource(const std::string &file_name)
: file_name_(file_name), : file_name_(file_name), vpx_ctx_(new VpxInputContext()),
vpx_ctx_(new VpxInputContext()), webm_ctx_(new WebmInputContext()), buf_(NULL), buf_sz_(0), frame_(0),
webm_ctx_(new WebmInputContext()), end_of_file_(false) {}
buf_(NULL),
buf_sz_(0),
frame_(0),
end_of_file_(false) {
}
virtual ~WebMVideoSource() { virtual ~WebMVideoSource() {
if (vpx_ctx_->file != NULL) if (vpx_ctx_->file != NULL) fclose(vpx_ctx_->file);
fclose(vpx_ctx_->file);
webm_free(webm_ctx_); webm_free(webm_ctx_);
delete vpx_ctx_; delete vpx_ctx_;
delete webm_ctx_; delete webm_ctx_;
} }
virtual void Init() { virtual void Init() {}
}
virtual void Begin() { virtual void Begin() {
vpx_ctx_->file = OpenTestDataFile(file_name_); vpx_ctx_->file = OpenTestDataFile(file_name_);
@ -81,9 +74,7 @@ class WebMVideoSource : public CompressedVideoSource {
} while (!webm_ctx_->is_key_frame && !end_of_file_); } while (!webm_ctx_->is_key_frame && !end_of_file_);
} }
virtual const uint8_t *cxdata() const { virtual const uint8_t *cxdata() const { return end_of_file_ ? NULL : buf_; }
return end_of_file_ ? NULL : buf_;
}
virtual size_t frame_size() const { return buf_sz_; } virtual size_t frame_size() const { return buf_sz_; }
virtual unsigned int frame_number() const { return frame_; } virtual unsigned int frame_number() const { return frame_; }

View File

@ -60,10 +60,12 @@ static void write_image_file(const vpx_image_t *img, FILE *file) {
const unsigned char *buf = img->planes[plane]; const unsigned char *buf = img->planes[plane];
const int stride = img->stride[plane]; const int stride = img->stride[plane];
const int bytes_per_sample = (img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? 2 : 1; const int bytes_per_sample = (img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? 2 : 1;
const int h = (plane ? (img->d_h + img->y_chroma_shift) >> const int h =
img->y_chroma_shift : img->d_h); (plane ? (img->d_h + img->y_chroma_shift) >> img->y_chroma_shift
const int w = (plane ? (img->d_w + img->x_chroma_shift) >> : img->d_h);
img->x_chroma_shift : img->d_w); const int w =
(plane ? (img->d_w + img->x_chroma_shift) >> img->x_chroma_shift
: img->d_w);
for (y = 0; y < h; ++y) { for (y = 0; y < h; ++y) {
fwrite(buf, bytes_per_sample, w, file); fwrite(buf, bytes_per_sample, w, file);
buf += stride; buf += stride;
@ -71,15 +73,12 @@ static void write_image_file(const vpx_image_t *img, FILE *file) {
} }
} }
class Y4mVideoSourceTest class Y4mVideoSourceTest : public ::testing::TestWithParam<Y4mTestParam>,
: public ::testing::TestWithParam<Y4mTestParam>,
public ::libvpx_test::Y4mVideoSource { public ::libvpx_test::Y4mVideoSource {
protected: protected:
Y4mVideoSourceTest() : Y4mVideoSource("", 0, 0) {} Y4mVideoSourceTest() : Y4mVideoSource("", 0, 0) {}
virtual ~Y4mVideoSourceTest() { virtual ~Y4mVideoSourceTest() { CloseSource(); }
CloseSource();
}
virtual void Init(const std::string &file_name, int limit) { virtual void Init(const std::string &file_name, int limit) {
file_name_ = file_name; file_name_ = file_name;
@ -137,8 +136,7 @@ TEST_P(Y4mVideoSourceTest, SourceTest) {
INSTANTIATE_TEST_CASE_P(C, Y4mVideoSourceTest, INSTANTIATE_TEST_CASE_P(C, Y4mVideoSourceTest,
::testing::ValuesIn(kY4mTestVectors)); ::testing::ValuesIn(kY4mTestVectors));
class Y4mVideoWriteTest class Y4mVideoWriteTest : public Y4mVideoSourceTest {
: public Y4mVideoSourceTest {
protected: protected:
Y4mVideoWriteTest() {} Y4mVideoWriteTest() {}
@ -162,10 +160,8 @@ class Y4mVideoWriteTest
const struct VpxRational framerate = { y4m_.fps_n, y4m_.fps_d }; const struct VpxRational framerate = { y4m_.fps_n, y4m_.fps_d };
tmpfile_ = new libvpx_test::TempOutFile; tmpfile_ = new libvpx_test::TempOutFile;
ASSERT_TRUE(tmpfile_->file() != NULL); ASSERT_TRUE(tmpfile_->file() != NULL);
y4m_write_file_header(buf, sizeof(buf), y4m_write_file_header(buf, sizeof(buf), kWidth, kHeight, &framerate,
kWidth, kHeight, y4m_.vpx_fmt, y4m_.bit_depth);
&framerate, y4m_.vpx_fmt,
y4m_.bit_depth);
fputs(buf, tmpfile_->file()); fputs(buf, tmpfile_->file());
for (unsigned int i = start_; i < limit_; i++) { for (unsigned int i = start_; i < limit_; i++) {
y4m_write_frame_header(buf, sizeof(buf)); y4m_write_frame_header(buf, sizeof(buf));

View File

@ -21,18 +21,10 @@ namespace libvpx_test {
// so that we can do actual file encodes. // so that we can do actual file encodes.
class Y4mVideoSource : public VideoSource { class Y4mVideoSource : public VideoSource {
public: public:
Y4mVideoSource(const std::string &file_name, Y4mVideoSource(const std::string &file_name, unsigned int start, int limit)
unsigned int start, int limit) : file_name_(file_name), input_file_(NULL), img_(new vpx_image_t()),
: file_name_(file_name), start_(start), limit_(limit), frame_(0), framerate_numerator_(0),
input_file_(NULL), framerate_denominator_(0), y4m_() {}
img_(new vpx_image_t()),
start_(start),
limit_(limit),
frame_(0),
framerate_numerator_(0),
framerate_denominator_(0),
y4m_() {
}
virtual ~Y4mVideoSource() { virtual ~Y4mVideoSource() {
vpx_img_free(img_.get()); vpx_img_free(img_.get());

View File

@ -25,19 +25,11 @@ namespace libvpx_test {
class YUVVideoSource : public VideoSource { class YUVVideoSource : public VideoSource {
public: public:
YUVVideoSource(const std::string &file_name, vpx_img_fmt format, YUVVideoSource(const std::string &file_name, vpx_img_fmt format,
unsigned int width, unsigned int height, unsigned int width, unsigned int height, int rate_numerator,
int rate_numerator, int rate_denominator, int rate_denominator, unsigned int start, int limit)
unsigned int start, int limit) : file_name_(file_name), input_file_(NULL), img_(NULL), start_(start),
: file_name_(file_name), limit_(limit), frame_(0), width_(0), height_(0),
input_file_(NULL), format_(VPX_IMG_FMT_NONE), framerate_numerator_(rate_numerator),
img_(NULL),
start_(start),
limit_(limit),
frame_(0),
width_(0),
height_(0),
format_(VPX_IMG_FMT_NONE),
framerate_numerator_(rate_numerator),
framerate_denominator_(rate_denominator) { framerate_denominator_(rate_denominator) {
// This initializes format_, raw_size_, width_, height_ and allocates img. // This initializes format_, raw_size_, width_, height_ and allocates img.
SetSize(width, height, format); SetSize(width, height, format);
@ -45,13 +37,11 @@ class YUVVideoSource : public VideoSource {
virtual ~YUVVideoSource() { virtual ~YUVVideoSource() {
vpx_img_free(img_); vpx_img_free(img_);
if (input_file_) if (input_file_) fclose(input_file_);
fclose(input_file_);
} }
virtual void Begin() { virtual void Begin() {
if (input_file_) if (input_file_) fclose(input_file_);
fclose(input_file_);
input_file_ = OpenTestDataFile(file_name_); input_file_ = OpenTestDataFile(file_name_);
ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: " ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: "
<< file_name_; << file_name_;
@ -93,32 +83,15 @@ class YUVVideoSource : public VideoSource {
height_ = height; height_ = height;
format_ = format; format_ = format;
switch (format) { switch (format) {
case VPX_IMG_FMT_I420: case VPX_IMG_FMT_I420: raw_size_ = width * height * 3 / 2; break;
raw_size_ = width * height * 3 / 2; case VPX_IMG_FMT_I422: raw_size_ = width * height * 2; break;
break; case VPX_IMG_FMT_I440: raw_size_ = width * height * 2; break;
case VPX_IMG_FMT_I422: case VPX_IMG_FMT_I444: raw_size_ = width * height * 3; break;
raw_size_ = width * height * 2; case VPX_IMG_FMT_I42016: raw_size_ = width * height * 3; break;
break; case VPX_IMG_FMT_I42216: raw_size_ = width * height * 4; break;
case VPX_IMG_FMT_I440: case VPX_IMG_FMT_I44016: raw_size_ = width * height * 4; break;
raw_size_ = width * height * 2; case VPX_IMG_FMT_I44416: raw_size_ = width * height * 6; break;
break; default: ASSERT_TRUE(0);
case VPX_IMG_FMT_I444:
raw_size_ = width * height * 3;
break;
case VPX_IMG_FMT_I42016:
raw_size_ = width * height * 3;
break;
case VPX_IMG_FMT_I42216:
raw_size_ = width * height * 4;
break;
case VPX_IMG_FMT_I44016:
raw_size_ = width * height * 4;
break;
case VPX_IMG_FMT_I44416:
raw_size_ = width * height * 6;
break;
default:
ASSERT_TRUE(0);
} }
} }
} }