test: apply clang-format
Change-Id: I0d9ab85855eb723f653a7bb09b3d0d31dd6cfd2f
This commit is contained in:
parent
e4290800b2
commit
33e40cb5db
@ -23,9 +23,7 @@ class ACMRandom {
|
||||
|
||||
explicit ACMRandom(int seed) : random_(seed) {}
|
||||
|
||||
void Reset(int seed) {
|
||||
random_.Reseed(seed);
|
||||
}
|
||||
void Reset(int seed) { random_.Reseed(seed); }
|
||||
uint16_t Rand16(void) {
|
||||
const uint32_t value =
|
||||
random_.Generate(testing::internal::Random::kMaxRange);
|
||||
@ -52,17 +50,11 @@ class ACMRandom {
|
||||
return r < 128 ? r << 4 : r >> 4;
|
||||
}
|
||||
|
||||
int PseudoUniform(int range) {
|
||||
return random_.Generate(range);
|
||||
}
|
||||
int PseudoUniform(int range) { return random_.Generate(range); }
|
||||
|
||||
int operator()(int n) {
|
||||
return PseudoUniform(n);
|
||||
}
|
||||
int operator()(int n) { return PseudoUniform(n); }
|
||||
|
||||
static int DeterministicSeed(void) {
|
||||
return 0xbaba;
|
||||
}
|
||||
static int DeterministicSeed(void) { return 0xbaba; }
|
||||
|
||||
private:
|
||||
testing::internal::Random random_;
|
||||
|
@ -17,8 +17,8 @@
|
||||
namespace {
|
||||
|
||||
// Check if any pixel in a 16x16 macroblock varies between frames.
|
||||
int CheckMb(const vpx_image_t ¤t, const vpx_image_t &previous,
|
||||
int mb_r, int mb_c) {
|
||||
int CheckMb(const vpx_image_t ¤t, const vpx_image_t &previous, int mb_r,
|
||||
int mb_c) {
|
||||
for (int plane = 0; plane < 3; plane++) {
|
||||
int r = 16 * mb_r;
|
||||
int c0 = 16 * mb_c;
|
||||
|
@ -39,6 +39,7 @@ class ActiveMapTest
|
||||
encoder->Control(VP8E_SET_CPUUSED, cpu_used_);
|
||||
} else if (video->frame() == 3) {
|
||||
vpx_active_map_t map = vpx_active_map_t();
|
||||
/* clang-format off */
|
||||
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,
|
||||
@ -50,6 +51,7 @@ class ActiveMapTest
|
||||
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,
|
||||
};
|
||||
/* clang-format on */
|
||||
map.cols = (kWidth + 15) / 16;
|
||||
map.rows = (kHeight + 15) / 16;
|
||||
ASSERT_EQ(map.cols, 13u);
|
||||
@ -77,8 +79,8 @@ TEST_P(ActiveMapTest, Test) {
|
||||
cfg_.rc_end_usage = VPX_CBR;
|
||||
cfg_.kf_max_dist = 90000;
|
||||
|
||||
::libvpx_test::I420VideoSource video("hantro_odd.yuv", kWidth, kHeight, 30,
|
||||
1, 0, 20);
|
||||
::libvpx_test::I420VideoSource video("hantro_odd.yuv", kWidth, kHeight, 30, 1,
|
||||
0, 20);
|
||||
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
}
|
||||
|
@ -22,15 +22,12 @@ static const int kNoiseSize = 3072;
|
||||
|
||||
// TODO(jimbankoski): make width and height integers not unsigned.
|
||||
typedef void (*AddNoiseFunc)(uint8_t *start, const int8_t *noise,
|
||||
int blackclamp, int whiteclamp,
|
||||
int width, int height, int pitch);
|
||||
int blackclamp, int whiteclamp, int width,
|
||||
int height, int pitch);
|
||||
|
||||
class AddNoiseTest
|
||||
: public ::testing::TestWithParam<AddNoiseFunc> {
|
||||
class AddNoiseTest : public ::testing::TestWithParam<AddNoiseFunc> {
|
||||
public:
|
||||
virtual void TearDown() {
|
||||
libvpx_test::ClearSystemState();
|
||||
}
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
virtual ~AddNoiseTest() {}
|
||||
};
|
||||
|
||||
@ -43,18 +40,18 @@ double stddev6(char a, char b, char c, char d, char e, char f) {
|
||||
}
|
||||
|
||||
TEST_P(AddNoiseTest, CheckNoiseAdded) {
|
||||
const int width = 64;
|
||||
const int width = 64;
|
||||
const int height = 64;
|
||||
const int image_size = width * height;
|
||||
int8_t noise[kNoiseSize];
|
||||
const int clamp = vpx_setup_noise(4.4, noise, kNoiseSize);
|
||||
uint8_t *const s = reinterpret_cast<uint8_t *>(vpx_calloc(image_size,
|
||||
sizeof(*s)));
|
||||
uint8_t *const s =
|
||||
reinterpret_cast<uint8_t *>(vpx_calloc(image_size, sizeof(*s)));
|
||||
ASSERT_TRUE(s != NULL);
|
||||
memset(s, 99, image_size * sizeof(*s));
|
||||
|
||||
ASM_REGISTER_STATE_CHECK(GetParam()(s, noise, clamp, clamp,
|
||||
width, height, width));
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
GetParam()(s, noise, clamp, clamp, width, height, width));
|
||||
|
||||
// Check to make sure we don't end up having either the same or no added
|
||||
// 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.
|
||||
memset(s, 255, image_size);
|
||||
|
||||
ASM_REGISTER_STATE_CHECK(GetParam()(s, noise, clamp, clamp,
|
||||
width, height, width));
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
GetParam()(s, noise, clamp, clamp, width, height, width));
|
||||
|
||||
// Check to make sure don't roll over.
|
||||
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.
|
||||
memset(s, 0, image_size);
|
||||
|
||||
ASM_REGISTER_STATE_CHECK(GetParam()(s, noise, clamp, clamp,
|
||||
width, height, width));
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
GetParam()(s, noise, clamp, clamp, width, height, width));
|
||||
|
||||
// Check to make sure don't roll under.
|
||||
for (int i = 0; i < image_size; ++i) {
|
||||
@ -95,7 +92,7 @@ TEST_P(AddNoiseTest, CheckNoiseAdded) {
|
||||
}
|
||||
|
||||
TEST_P(AddNoiseTest, CheckCvsAssembly) {
|
||||
const int width = 64;
|
||||
const int width = 64;
|
||||
const int height = 64;
|
||||
const int image_size = width * height;
|
||||
int8_t noise[kNoiseSize];
|
||||
|
@ -21,7 +21,7 @@ const int kLookAheadMin = 5;
|
||||
const int kLookAheadMax = 26;
|
||||
|
||||
class AltRefTest : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<int> {
|
||||
public ::libvpx_test::CodecTestWithParam<int> {
|
||||
protected:
|
||||
AltRefTest() : EncoderTest(GET_PARAM(0)), altref_count_(0) {}
|
||||
virtual ~AltRefTest() {}
|
||||
@ -31,9 +31,7 @@ class AltRefTest : public ::libvpx_test::EncoderTest,
|
||||
SetMode(libvpx_test::kTwoPassGood);
|
||||
}
|
||||
|
||||
virtual void BeginPassHook(unsigned int pass) {
|
||||
altref_count_ = 0;
|
||||
}
|
||||
virtual void BeginPassHook(unsigned int pass) { altref_count_ = 0; }
|
||||
|
||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
||||
libvpx_test::Encoder *encoder) {
|
||||
@ -75,11 +73,8 @@ class AltRefForcedKeyTestLarge
|
||||
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
|
||||
protected:
|
||||
AltRefForcedKeyTestLarge()
|
||||
: EncoderTest(GET_PARAM(0)),
|
||||
encoding_mode_(GET_PARAM(1)),
|
||||
cpu_used_(GET_PARAM(2)),
|
||||
forced_kf_frame_num_(1),
|
||||
frame_num_(0) {}
|
||||
: EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)),
|
||||
cpu_used_(GET_PARAM(2)), forced_kf_frame_num_(1), frame_num_(0) {}
|
||||
virtual ~AltRefForcedKeyTestLarge() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
@ -94,8 +89,8 @@ class AltRefForcedKeyTestLarge
|
||||
if (video->frame() == 0) {
|
||||
encoder->Control(VP8E_SET_CPUUSED, cpu_used_);
|
||||
encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
|
||||
// override test default for tile columns if necessary.
|
||||
#if CONFIG_VP9_ENCODER
|
||||
// override test default for tile columns if necessary.
|
||||
if (GET_PARAM(0) == &libvpx_test::kVP9) {
|
||||
encoder->Control(VP9E_SET_TILE_COLUMNS, 6);
|
||||
}
|
||||
@ -147,13 +142,11 @@ TEST_P(AltRefForcedKeyTestLarge, ForcedFrameIsKey) {
|
||||
}
|
||||
}
|
||||
|
||||
VP8_INSTANTIATE_TEST_CASE(
|
||||
AltRefForcedKeyTestLarge,
|
||||
::testing::Values(::libvpx_test::kOnePassGood),
|
||||
::testing::Range(0, 9));
|
||||
VP8_INSTANTIATE_TEST_CASE(AltRefForcedKeyTestLarge,
|
||||
::testing::Values(::libvpx_test::kOnePassGood),
|
||||
::testing::Range(0, 9));
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(
|
||||
AltRefForcedKeyTestLarge,
|
||||
::testing::Values(::libvpx_test::kOnePassGood),
|
||||
::testing::Range(0, 9));
|
||||
VP9_INSTANTIATE_TEST_CASE(AltRefForcedKeyTestLarge,
|
||||
::testing::Values(::libvpx_test::kOnePassGood),
|
||||
::testing::Range(0, 9));
|
||||
} // namespace
|
||||
|
@ -57,7 +57,7 @@ TEST_P(AqSegmentTest, TestNoMisMatchAQ1) {
|
||||
aq_mode_ = 1;
|
||||
|
||||
::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
|
||||
30, 1, 0, 100);
|
||||
30, 1, 0, 100);
|
||||
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
}
|
||||
@ -77,7 +77,7 @@ TEST_P(AqSegmentTest, TestNoMisMatchAQ2) {
|
||||
aq_mode_ = 2;
|
||||
|
||||
::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
|
||||
30, 1, 0, 100);
|
||||
30, 1, 0, 100);
|
||||
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
}
|
||||
@ -97,7 +97,7 @@ TEST_P(AqSegmentTest, TestNoMisMatchAQ3) {
|
||||
aq_mode_ = 3;
|
||||
|
||||
::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
|
||||
30, 1, 0, 100);
|
||||
30, 1, 0, 100);
|
||||
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
}
|
||||
|
191
test/avg_test.cc
191
test/avg_test.cc
@ -31,7 +31,7 @@ class AverageTestBase : public ::testing::Test {
|
||||
AverageTestBase(int width, int height) : width_(width), height_(height) {}
|
||||
|
||||
static void SetUpTestCase() {
|
||||
source_data_ = reinterpret_cast<uint8_t*>(
|
||||
source_data_ = reinterpret_cast<uint8_t *>(
|
||||
vpx_memalign(kDataAlignment, kDataBlockSize));
|
||||
}
|
||||
|
||||
@ -40,9 +40,7 @@ class AverageTestBase : public ::testing::Test {
|
||||
source_data_ = NULL;
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
libvpx_test::ClearSystemState();
|
||||
}
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
// Handle blocks up to 4 blocks 64x64 with stride up to 128
|
||||
@ -55,47 +53,44 @@ class AverageTestBase : public ::testing::Test {
|
||||
}
|
||||
|
||||
// Sum Pixels
|
||||
unsigned int ReferenceAverage8x8(const uint8_t* source, int pitch) {
|
||||
unsigned int ReferenceAverage8x8(const uint8_t *source, int pitch) {
|
||||
unsigned int average = 0;
|
||||
for (int h = 0; h < 8; ++h)
|
||||
for (int w = 0; w < 8; ++w)
|
||||
average += source[h * pitch + w];
|
||||
for (int w = 0; w < 8; ++w) average += source[h * pitch + w];
|
||||
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;
|
||||
for (int h = 0; h < 4; ++h)
|
||||
for (int w = 0; w < 4; ++w)
|
||||
average += source[h * pitch + w];
|
||||
for (int w = 0; w < 4; ++w) average += source[h * pitch + w];
|
||||
return ((average + 8) >> 4);
|
||||
}
|
||||
|
||||
void FillConstant(uint8_t fill_constant) {
|
||||
for (int i = 0; i < width_ * height_; ++i) {
|
||||
source_data_[i] = fill_constant;
|
||||
source_data_[i] = fill_constant;
|
||||
}
|
||||
}
|
||||
|
||||
void FillRandom() {
|
||||
for (int i = 0; i < width_ * height_; ++i) {
|
||||
source_data_[i] = rnd_.Rand8();
|
||||
source_data_[i] = rnd_.Rand8();
|
||||
}
|
||||
}
|
||||
|
||||
int width_, height_;
|
||||
static uint8_t* source_data_;
|
||||
static uint8_t *source_data_;
|
||||
int source_stride_;
|
||||
|
||||
ACMRandom rnd_;
|
||||
};
|
||||
typedef unsigned int (*AverageFunction)(const uint8_t* s, int pitch);
|
||||
typedef unsigned int (*AverageFunction)(const uint8_t *s, int pitch);
|
||||
|
||||
typedef std::tr1::tuple<int, int, int, int, AverageFunction> AvgFunc;
|
||||
|
||||
class AverageTest
|
||||
: public AverageTestBase,
|
||||
public ::testing::WithParamInterface<AvgFunc>{
|
||||
class AverageTest : public AverageTestBase,
|
||||
public ::testing::WithParamInterface<AvgFunc> {
|
||||
public:
|
||||
AverageTest() : AverageTestBase(GET_PARAM(0), GET_PARAM(1)) {}
|
||||
|
||||
@ -103,17 +98,17 @@ class AverageTest
|
||||
void CheckAverages() {
|
||||
unsigned int expected = 0;
|
||||
if (GET_PARAM(3) == 8) {
|
||||
expected = ReferenceAverage8x8(source_data_+ GET_PARAM(2),
|
||||
source_stride_);
|
||||
} else if (GET_PARAM(3) == 4) {
|
||||
expected = ReferenceAverage4x4(source_data_+ GET_PARAM(2),
|
||||
source_stride_);
|
||||
expected =
|
||||
ReferenceAverage8x8(source_data_ + GET_PARAM(2), source_stride_);
|
||||
} else if (GET_PARAM(3) == 4) {
|
||||
expected =
|
||||
ReferenceAverage4x4(source_data_ + GET_PARAM(2), source_stride_);
|
||||
}
|
||||
|
||||
ASM_REGISTER_STATE_CHECK(GET_PARAM(4)(source_data_+ GET_PARAM(2),
|
||||
source_stride_));
|
||||
unsigned int actual = GET_PARAM(4)(source_data_+ GET_PARAM(2),
|
||||
source_stride_);
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
GET_PARAM(4)(source_data_ + GET_PARAM(2), source_stride_));
|
||||
unsigned int actual =
|
||||
GET_PARAM(4)(source_data_ + GET_PARAM(2), source_stride_);
|
||||
|
||||
EXPECT_EQ(expected, actual);
|
||||
}
|
||||
@ -124,23 +119,20 @@ typedef void (*IntProRowFunc)(int16_t hbuf[16], uint8_t const *ref,
|
||||
|
||||
typedef std::tr1::tuple<int, IntProRowFunc, IntProRowFunc> IntProRowParam;
|
||||
|
||||
class IntProRowTest
|
||||
: public AverageTestBase,
|
||||
public ::testing::WithParamInterface<IntProRowParam> {
|
||||
class IntProRowTest : public AverageTestBase,
|
||||
public ::testing::WithParamInterface<IntProRowParam> {
|
||||
public:
|
||||
IntProRowTest()
|
||||
: AverageTestBase(16, GET_PARAM(0)),
|
||||
hbuf_asm_(NULL),
|
||||
hbuf_c_(NULL) {
|
||||
: AverageTestBase(16, GET_PARAM(0)), hbuf_asm_(NULL), hbuf_c_(NULL) {
|
||||
asm_func_ = GET_PARAM(1);
|
||||
c_func_ = GET_PARAM(2);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
hbuf_asm_ = reinterpret_cast<int16_t*>(
|
||||
hbuf_asm_ = reinterpret_cast<int16_t *>(
|
||||
vpx_memalign(kDataAlignment, sizeof(*hbuf_asm_) * 16));
|
||||
hbuf_c_ = reinterpret_cast<int16_t*>(
|
||||
hbuf_c_ = reinterpret_cast<int16_t *>(
|
||||
vpx_memalign(kDataAlignment, sizeof(*hbuf_c_) * 16));
|
||||
}
|
||||
|
||||
@ -169,9 +161,8 @@ typedef int16_t (*IntProColFunc)(uint8_t const *ref, const int width);
|
||||
|
||||
typedef std::tr1::tuple<int, IntProColFunc, IntProColFunc> IntProColParam;
|
||||
|
||||
class IntProColTest
|
||||
: public AverageTestBase,
|
||||
public ::testing::WithParamInterface<IntProColParam> {
|
||||
class IntProColTest : public AverageTestBase,
|
||||
public ::testing::WithParamInterface<IntProColParam> {
|
||||
public:
|
||||
IntProColTest() : AverageTestBase(GET_PARAM(0), 1), sum_asm_(0), sum_c_(0) {
|
||||
asm_func_ = GET_PARAM(1);
|
||||
@ -195,15 +186,14 @@ class IntProColTest
|
||||
typedef int (*SatdFunc)(const int16_t *coeffs, int length);
|
||||
typedef std::tr1::tuple<int, SatdFunc> SatdTestParam;
|
||||
|
||||
class SatdTest
|
||||
: public ::testing::Test,
|
||||
public ::testing::WithParamInterface<SatdTestParam> {
|
||||
class SatdTest : public ::testing::Test,
|
||||
public ::testing::WithParamInterface<SatdTestParam> {
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
satd_size_ = GET_PARAM(0);
|
||||
satd_func_ = GET_PARAM(1);
|
||||
rnd_.Reset(ACMRandom::DeterministicSeed());
|
||||
src_ = reinterpret_cast<int16_t*>(
|
||||
src_ = reinterpret_cast<int16_t *>(
|
||||
vpx_memalign(16, sizeof(*src_) * satd_size_));
|
||||
ASSERT_TRUE(src_ != NULL);
|
||||
}
|
||||
@ -235,7 +225,7 @@ class SatdTest
|
||||
ACMRandom rnd_;
|
||||
};
|
||||
|
||||
uint8_t* AverageTestBase::source_data_ = NULL;
|
||||
uint8_t *AverageTestBase::source_data_ = NULL;
|
||||
|
||||
TEST_P(AverageTest, MinValue) {
|
||||
FillConstant(0);
|
||||
@ -286,7 +276,6 @@ TEST_P(IntProColTest, Random) {
|
||||
RunComparison();
|
||||
}
|
||||
|
||||
|
||||
TEST_P(SatdTest, MinValue) {
|
||||
const int kMin = -32640;
|
||||
const int expected = -kMin * satd_size_;
|
||||
@ -320,92 +309,86 @@ using std::tr1::make_tuple;
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, AverageTest,
|
||||
::testing::Values(
|
||||
make_tuple(16, 16, 1, 8, &vpx_avg_8x8_c),
|
||||
make_tuple(16, 16, 1, 4, &vpx_avg_4x4_c)));
|
||||
::testing::Values(make_tuple(16, 16, 1, 8, &vpx_avg_8x8_c),
|
||||
make_tuple(16, 16, 1, 4, &vpx_avg_4x4_c)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, SatdTest,
|
||||
::testing::Values(
|
||||
make_tuple(16, &vpx_satd_c),
|
||||
make_tuple(64, &vpx_satd_c),
|
||||
make_tuple(256, &vpx_satd_c),
|
||||
make_tuple(1024, &vpx_satd_c)));
|
||||
INSTANTIATE_TEST_CASE_P(C, SatdTest,
|
||||
::testing::Values(make_tuple(16, &vpx_satd_c),
|
||||
make_tuple(64, &vpx_satd_c),
|
||||
make_tuple(256, &vpx_satd_c),
|
||||
make_tuple(1024, &vpx_satd_c)));
|
||||
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, AverageTest,
|
||||
::testing::Values(
|
||||
make_tuple(16, 16, 0, 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(16, 16, 0, 4, &vpx_avg_4x4_sse2),
|
||||
make_tuple(16, 16, 5, 4, &vpx_avg_4x4_sse2),
|
||||
make_tuple(32, 32, 15, 4, &vpx_avg_4x4_sse2)));
|
||||
::testing::Values(make_tuple(16, 16, 0, 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(16, 16, 0, 4, &vpx_avg_4x4_sse2),
|
||||
make_tuple(16, 16, 5, 4, &vpx_avg_4x4_sse2),
|
||||
make_tuple(32, 32, 15, 4, &vpx_avg_4x4_sse2)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, IntProRowTest, ::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(64, &vpx_int_pro_row_sse2, &vpx_int_pro_row_c)));
|
||||
SSE2, IntProRowTest,
|
||||
::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(64, &vpx_int_pro_row_sse2,
|
||||
&vpx_int_pro_row_c)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, IntProColTest, ::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(64, &vpx_int_pro_col_sse2, &vpx_int_pro_col_c)));
|
||||
SSE2, IntProColTest,
|
||||
::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(64, &vpx_int_pro_col_sse2,
|
||||
&vpx_int_pro_col_c)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, SatdTest,
|
||||
::testing::Values(
|
||||
make_tuple(16, &vpx_satd_sse2),
|
||||
make_tuple(64, &vpx_satd_sse2),
|
||||
make_tuple(256, &vpx_satd_sse2),
|
||||
make_tuple(1024, &vpx_satd_sse2)));
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, SatdTest,
|
||||
::testing::Values(make_tuple(16, &vpx_satd_sse2),
|
||||
make_tuple(64, &vpx_satd_sse2),
|
||||
make_tuple(256, &vpx_satd_sse2),
|
||||
make_tuple(1024, &vpx_satd_sse2)));
|
||||
#endif
|
||||
|
||||
#if HAVE_NEON
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, AverageTest,
|
||||
::testing::Values(
|
||||
make_tuple(16, 16, 0, 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(16, 16, 0, 4, &vpx_avg_4x4_neon),
|
||||
make_tuple(16, 16, 5, 4, &vpx_avg_4x4_neon),
|
||||
make_tuple(32, 32, 15, 4, &vpx_avg_4x4_neon)));
|
||||
::testing::Values(make_tuple(16, 16, 0, 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(16, 16, 0, 4, &vpx_avg_4x4_neon),
|
||||
make_tuple(16, 16, 5, 4, &vpx_avg_4x4_neon),
|
||||
make_tuple(32, 32, 15, 4, &vpx_avg_4x4_neon)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, IntProRowTest, ::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(64, &vpx_int_pro_row_neon, &vpx_int_pro_row_c)));
|
||||
NEON, IntProRowTest,
|
||||
::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(64, &vpx_int_pro_row_neon,
|
||||
&vpx_int_pro_row_c)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, IntProColTest, ::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(64, &vpx_int_pro_col_neon, &vpx_int_pro_col_c)));
|
||||
NEON, IntProColTest,
|
||||
::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(64, &vpx_int_pro_col_neon,
|
||||
&vpx_int_pro_col_c)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, SatdTest,
|
||||
::testing::Values(
|
||||
make_tuple(16, &vpx_satd_neon),
|
||||
make_tuple(64, &vpx_satd_neon),
|
||||
make_tuple(256, &vpx_satd_neon),
|
||||
make_tuple(1024, &vpx_satd_neon)));
|
||||
INSTANTIATE_TEST_CASE_P(NEON, SatdTest,
|
||||
::testing::Values(make_tuple(16, &vpx_satd_neon),
|
||||
make_tuple(64, &vpx_satd_neon),
|
||||
make_tuple(256, &vpx_satd_neon),
|
||||
make_tuple(1024, &vpx_satd_neon)));
|
||||
#endif
|
||||
|
||||
#if HAVE_MSA
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, AverageTest,
|
||||
::testing::Values(
|
||||
make_tuple(16, 16, 0, 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(16, 16, 0, 4, &vpx_avg_4x4_msa),
|
||||
make_tuple(16, 16, 5, 4, &vpx_avg_4x4_msa),
|
||||
make_tuple(32, 32, 15, 4, &vpx_avg_4x4_msa)));
|
||||
::testing::Values(make_tuple(16, 16, 0, 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(16, 16, 0, 4, &vpx_avg_4x4_msa),
|
||||
make_tuple(16, 16, 5, 4, &vpx_avg_4x4_msa),
|
||||
make_tuple(32, 32, 15, 4, &vpx_avg_4x4_msa)));
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
@ -26,11 +26,9 @@
|
||||
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
|
||||
extern "C"
|
||||
double vp9_get_blockiness(const unsigned char *img1, int img1_pitch,
|
||||
const unsigned char *img2, int img2_pitch,
|
||||
int width, int height);
|
||||
extern "C" double vp9_get_blockiness(const unsigned char *img1, int img1_pitch,
|
||||
const unsigned char *img2, int img2_pitch,
|
||||
int width, int height);
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
@ -40,9 +38,9 @@ class BlockinessTestBase : public ::testing::Test {
|
||||
BlockinessTestBase(int width, int height) : width_(width), height_(height) {}
|
||||
|
||||
static void SetUpTestCase() {
|
||||
source_data_ = reinterpret_cast<uint8_t*>(
|
||||
source_data_ = reinterpret_cast<uint8_t *>(
|
||||
vpx_memalign(kDataAlignment, kDataBufferSize));
|
||||
reference_data_ = reinterpret_cast<uint8_t*>(
|
||||
reference_data_ = reinterpret_cast<uint8_t *>(
|
||||
vpx_memalign(kDataAlignment, kDataBufferSize));
|
||||
}
|
||||
|
||||
@ -53,14 +51,12 @@ class BlockinessTestBase : public ::testing::Test {
|
||||
reference_data_ = NULL;
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
libvpx_test::ClearSystemState();
|
||||
}
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
// Handle frames up to 640x480
|
||||
static const int kDataAlignment = 16;
|
||||
static const int kDataBufferSize = 640*480;
|
||||
static const int kDataBufferSize = 640 * 480;
|
||||
|
||||
virtual void SetUp() {
|
||||
source_stride_ = (width_ + 31) & ~31;
|
||||
@ -68,8 +64,8 @@ class BlockinessTestBase : public ::testing::Test {
|
||||
rnd_.Reset(ACMRandom::DeterministicSeed());
|
||||
}
|
||||
|
||||
void FillConstant(uint8_t *data, int stride, uint8_t fill_constant,
|
||||
int width, int height) {
|
||||
void FillConstant(uint8_t *data, int stride, uint8_t fill_constant, int width,
|
||||
int height) {
|
||||
for (int h = 0; h < height; ++h) {
|
||||
for (int w = 0; w < width; ++w) {
|
||||
data[h * stride + w] = fill_constant;
|
||||
@ -104,7 +100,7 @@ class BlockinessTestBase : public ::testing::Test {
|
||||
void FillCheckerboard(uint8_t *data, int stride) {
|
||||
for (int h = 0; h < height_; h += 4) {
|
||||
for (int w = 0; w < width_; w += 4) {
|
||||
if (((h/4) ^ (w/4)) & 1)
|
||||
if (((h / 4) ^ (w / 4)) & 1)
|
||||
FillConstant(data + h * stride + w, stride, 255, 4, 4);
|
||||
else
|
||||
FillConstant(data + h * stride + w, stride, 0, 4, 4);
|
||||
@ -135,9 +131,9 @@ class BlockinessTestBase : public ::testing::Test {
|
||||
}
|
||||
}
|
||||
int width_, height_;
|
||||
static uint8_t* source_data_;
|
||||
static uint8_t *source_data_;
|
||||
int source_stride_;
|
||||
static uint8_t* reference_data_;
|
||||
static uint8_t *reference_data_;
|
||||
int reference_stride_;
|
||||
|
||||
ACMRandom rnd_;
|
||||
@ -153,15 +149,14 @@ class BlockinessVP9Test
|
||||
|
||||
protected:
|
||||
double GetBlockiness() const {
|
||||
return vp9_get_blockiness(source_data_, source_stride_,
|
||||
reference_data_, reference_stride_,
|
||||
width_, height_);
|
||||
return vp9_get_blockiness(source_data_, source_stride_, reference_data_,
|
||||
reference_stride_, width_, height_);
|
||||
}
|
||||
};
|
||||
#endif // CONFIG_VP9_ENCODER
|
||||
|
||||
uint8_t* BlockinessTestBase::source_data_ = NULL;
|
||||
uint8_t* BlockinessTestBase::reference_data_ = NULL;
|
||||
uint8_t *BlockinessTestBase::source_data_ = NULL;
|
||||
uint8_t *BlockinessTestBase::reference_data_ = NULL;
|
||||
|
||||
#if CONFIG_VP9_ENCODER
|
||||
TEST_P(BlockinessVP9Test, SourceBlockierThanReference) {
|
||||
@ -212,7 +207,6 @@ TEST_P(BlockinessVP9Test, WorstCaseBlockiness) {
|
||||
}
|
||||
#endif // CONFIG_VP9_ENCODER
|
||||
|
||||
|
||||
using std::tr1::make_tuple;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -220,9 +214,7 @@ using std::tr1::make_tuple;
|
||||
|
||||
#if CONFIG_VP9_ENCODER
|
||||
const BlockinessParam c_vp9_tests[] = {
|
||||
make_tuple(320, 240),
|
||||
make_tuple(318, 242),
|
||||
make_tuple(318, 238),
|
||||
make_tuple(320, 240), make_tuple(318, 242), make_tuple(318, 238),
|
||||
};
|
||||
INSTANTIATE_TEST_CASE_P(C, BlockinessVP9Test, ::testing::ValuesIn(c_vp9_tests));
|
||||
#endif
|
||||
|
@ -17,8 +17,9 @@
|
||||
|
||||
namespace {
|
||||
|
||||
class BordersTest : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
class BordersTest
|
||||
: public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
protected:
|
||||
BordersTest() : EncoderTest(GET_PARAM(0)) {}
|
||||
virtual ~BordersTest() {}
|
||||
@ -78,6 +79,6 @@ TEST_P(BordersTest, TestLowBitrate) {
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(BordersTest, ::testing::Values(
|
||||
::libvpx_test::kTwoPassGood));
|
||||
VP9_INSTANTIATE_TEST_CASE(BordersTest,
|
||||
::testing::Values(::libvpx_test::kTwoPassGood));
|
||||
} // namespace
|
||||
|
@ -36,29 +36,26 @@ struct ByteAlignmentTestParam {
|
||||
};
|
||||
|
||||
const ByteAlignmentTestParam kBaTestParams[] = {
|
||||
{kLegacyByteAlignment, VPX_CODEC_OK, true},
|
||||
{32, VPX_CODEC_OK, true},
|
||||
{64, VPX_CODEC_OK, true},
|
||||
{128, VPX_CODEC_OK, true},
|
||||
{256, VPX_CODEC_OK, true},
|
||||
{512, VPX_CODEC_OK, true},
|
||||
{1024, VPX_CODEC_OK, true},
|
||||
{1, VPX_CODEC_INVALID_PARAM, false},
|
||||
{-2, VPX_CODEC_INVALID_PARAM, false},
|
||||
{4, VPX_CODEC_INVALID_PARAM, false},
|
||||
{16, VPX_CODEC_INVALID_PARAM, false},
|
||||
{255, VPX_CODEC_INVALID_PARAM, false},
|
||||
{2048, VPX_CODEC_INVALID_PARAM, false},
|
||||
{ kLegacyByteAlignment, VPX_CODEC_OK, true },
|
||||
{ 32, VPX_CODEC_OK, true },
|
||||
{ 64, VPX_CODEC_OK, true },
|
||||
{ 128, VPX_CODEC_OK, true },
|
||||
{ 256, VPX_CODEC_OK, true },
|
||||
{ 512, VPX_CODEC_OK, true },
|
||||
{ 1024, VPX_CODEC_OK, true },
|
||||
{ 1, VPX_CODEC_INVALID_PARAM, false },
|
||||
{ -2, VPX_CODEC_INVALID_PARAM, false },
|
||||
{ 4, VPX_CODEC_INVALID_PARAM, false },
|
||||
{ 16, VPX_CODEC_INVALID_PARAM, false },
|
||||
{ 255, VPX_CODEC_INVALID_PARAM, false },
|
||||
{ 2048, VPX_CODEC_INVALID_PARAM, false },
|
||||
};
|
||||
|
||||
// Class for testing byte alignment of reference buffers.
|
||||
class ByteAlignmentTest
|
||||
: public ::testing::TestWithParam<ByteAlignmentTestParam> {
|
||||
protected:
|
||||
ByteAlignmentTest()
|
||||
: video_(NULL),
|
||||
decoder_(NULL),
|
||||
md5_file_(NULL) {}
|
||||
ByteAlignmentTest() : video_(NULL), decoder_(NULL), md5_file_(NULL) {}
|
||||
|
||||
virtual void SetUp() {
|
||||
video_ = new libvpx_test::WebMVideoSource(kVP9TestFile);
|
||||
@ -74,8 +71,7 @@ class ByteAlignmentTest
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
if (md5_file_ != NULL)
|
||||
fclose(md5_file_);
|
||||
if (md5_file_ != NULL) fclose(md5_file_);
|
||||
|
||||
delete decoder_;
|
||||
delete video_;
|
||||
@ -89,8 +85,7 @@ class ByteAlignmentTest
|
||||
const vpx_codec_err_t res =
|
||||
decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
|
||||
CheckDecodedFrames(byte_alignment_to_check);
|
||||
if (res == VPX_CODEC_OK)
|
||||
video_->Next();
|
||||
if (res == VPX_CODEC_OK) video_->Next();
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -98,8 +93,7 @@ class ByteAlignmentTest
|
||||
for (; video_->cxdata() != NULL; video_->Next()) {
|
||||
const vpx_codec_err_t res =
|
||||
decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
|
||||
if (res != VPX_CODEC_OK)
|
||||
return res;
|
||||
if (res != VPX_CODEC_OK) return res;
|
||||
CheckDecodedFrames(byte_alignment_to_check);
|
||||
}
|
||||
return VPX_CODEC_OK;
|
||||
@ -135,7 +129,7 @@ class ByteAlignmentTest
|
||||
void OpenMd5File(const std::string &md5_file_name_) {
|
||||
md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name_);
|
||||
ASSERT_TRUE(md5_file_ != NULL) << "MD5 file open failed. Filename: "
|
||||
<< md5_file_name_;
|
||||
<< md5_file_name_;
|
||||
}
|
||||
|
||||
void CheckMd5(const vpx_image_t &img) {
|
||||
@ -163,8 +157,8 @@ class ByteAlignmentTest
|
||||
|
||||
TEST_F(ByteAlignmentTest, SwitchByteAlignment) {
|
||||
const int num_elements = 14;
|
||||
const int byte_alignments[] = { 0, 32, 64, 128, 256, 512, 1024,
|
||||
0, 1024, 32, 512, 64, 256, 128 };
|
||||
const int byte_alignments[] = { 0, 32, 64, 128, 256, 512, 1024,
|
||||
0, 1024, 32, 512, 64, 256, 128 };
|
||||
|
||||
for (int i = 0; i < num_elements; ++i) {
|
||||
SetByteAlignment(byte_alignments[i], VPX_CODEC_OK);
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#if ARCH_X86 || ARCH_X86_64
|
||||
# include "vpx_ports/x86.h"
|
||||
#include "vpx_ports/x86.h"
|
||||
#endif
|
||||
|
||||
namespace libvpx_test {
|
||||
|
@ -32,15 +32,15 @@ class CodecFactory {
|
||||
|
||||
virtual ~CodecFactory() {}
|
||||
|
||||
virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,
|
||||
virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
|
||||
unsigned long deadline) const = 0;
|
||||
|
||||
virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,
|
||||
virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
|
||||
const vpx_codec_flags_t flags,
|
||||
unsigned long deadline) // NOLINT(runtime/int)
|
||||
const = 0;
|
||||
const = 0;
|
||||
|
||||
virtual Encoder* CreateEncoder(vpx_codec_enc_cfg_t cfg,
|
||||
virtual Encoder *CreateEncoder(vpx_codec_enc_cfg_t cfg,
|
||||
unsigned long deadline,
|
||||
const unsigned long init_flags,
|
||||
TwopassStatsStore *stats) const = 0;
|
||||
@ -53,20 +53,20 @@ class CodecFactory {
|
||||
* to avoid having to include a pointer to the CodecFactory in every test
|
||||
* definition.
|
||||
*/
|
||||
template<class T1>
|
||||
class CodecTestWithParam : public ::testing::TestWithParam<
|
||||
std::tr1::tuple< const libvpx_test::CodecFactory*, T1 > > {
|
||||
};
|
||||
template <class T1>
|
||||
class CodecTestWithParam
|
||||
: public ::testing::TestWithParam<
|
||||
std::tr1::tuple<const libvpx_test::CodecFactory *, T1> > {};
|
||||
|
||||
template<class T1, class T2>
|
||||
class CodecTestWith2Params : public ::testing::TestWithParam<
|
||||
std::tr1::tuple< const libvpx_test::CodecFactory*, T1, T2 > > {
|
||||
};
|
||||
template <class T1, class T2>
|
||||
class CodecTestWith2Params
|
||||
: public ::testing::TestWithParam<
|
||||
std::tr1::tuple<const libvpx_test::CodecFactory *, T1, T2> > {};
|
||||
|
||||
template<class T1, class T2, class T3>
|
||||
class CodecTestWith3Params : public ::testing::TestWithParam<
|
||||
std::tr1::tuple< const libvpx_test::CodecFactory*, T1, T2, T3 > > {
|
||||
};
|
||||
template <class T1, class T2, class T3>
|
||||
class CodecTestWith3Params
|
||||
: public ::testing::TestWithParam<
|
||||
std::tr1::tuple<const libvpx_test::CodecFactory *, T1, T2, T3> > {};
|
||||
|
||||
/*
|
||||
* VP8 Codec Definitions
|
||||
@ -82,7 +82,7 @@ class VP8Decoder : public Decoder {
|
||||
: Decoder(cfg, flag, deadline) {}
|
||||
|
||||
protected:
|
||||
virtual vpx_codec_iface_t* CodecInterface() const {
|
||||
virtual vpx_codec_iface_t *CodecInterface() const {
|
||||
#if CONFIG_VP8_DECODER
|
||||
return &vpx_codec_vp8_dx_algo;
|
||||
#else
|
||||
@ -98,7 +98,7 @@ class VP8Encoder : public Encoder {
|
||||
: Encoder(cfg, deadline, init_flags, stats) {}
|
||||
|
||||
protected:
|
||||
virtual vpx_codec_iface_t* CodecInterface() const {
|
||||
virtual vpx_codec_iface_t *CodecInterface() const {
|
||||
#if CONFIG_VP8_ENCODER
|
||||
return &vpx_codec_vp8_cx_algo;
|
||||
#else
|
||||
@ -111,12 +111,12 @@ class VP8CodecFactory : public CodecFactory {
|
||||
public:
|
||||
VP8CodecFactory() : CodecFactory() {}
|
||||
|
||||
virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,
|
||||
virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
|
||||
unsigned long deadline) const {
|
||||
return CreateDecoder(cfg, 0, deadline);
|
||||
}
|
||||
|
||||
virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,
|
||||
virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
|
||||
const vpx_codec_flags_t flags,
|
||||
unsigned long deadline) const { // NOLINT
|
||||
#if CONFIG_VP8_DECODER
|
||||
@ -126,7 +126,7 @@ class VP8CodecFactory : public CodecFactory {
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual Encoder* CreateEncoder(vpx_codec_enc_cfg_t cfg,
|
||||
virtual Encoder *CreateEncoder(vpx_codec_enc_cfg_t cfg,
|
||||
unsigned long deadline,
|
||||
const unsigned long init_flags,
|
||||
TwopassStatsStore *stats) const {
|
||||
@ -149,17 +149,17 @@ class VP8CodecFactory : public CodecFactory {
|
||||
|
||||
const libvpx_test::VP8CodecFactory kVP8;
|
||||
|
||||
#define VP8_INSTANTIATE_TEST_CASE(test, ...)\
|
||||
INSTANTIATE_TEST_CASE_P(VP8, test, \
|
||||
::testing::Combine( \
|
||||
::testing::Values(static_cast<const libvpx_test::CodecFactory*>( \
|
||||
&libvpx_test::kVP8)), \
|
||||
#define VP8_INSTANTIATE_TEST_CASE(test, ...) \
|
||||
INSTANTIATE_TEST_CASE_P( \
|
||||
VP8, test, \
|
||||
::testing::Combine( \
|
||||
::testing::Values(static_cast<const libvpx_test::CodecFactory *>( \
|
||||
&libvpx_test::kVP8)), \
|
||||
__VA_ARGS__))
|
||||
#else
|
||||
#define VP8_INSTANTIATE_TEST_CASE(test, ...)
|
||||
#endif // CONFIG_VP8
|
||||
|
||||
|
||||
/*
|
||||
* VP9 Codec Definitions
|
||||
*/
|
||||
@ -174,7 +174,7 @@ class VP9Decoder : public Decoder {
|
||||
: Decoder(cfg, flag, deadline) {}
|
||||
|
||||
protected:
|
||||
virtual vpx_codec_iface_t* CodecInterface() const {
|
||||
virtual vpx_codec_iface_t *CodecInterface() const {
|
||||
#if CONFIG_VP9_DECODER
|
||||
return &vpx_codec_vp9_dx_algo;
|
||||
#else
|
||||
@ -190,7 +190,7 @@ class VP9Encoder : public Encoder {
|
||||
: Encoder(cfg, deadline, init_flags, stats) {}
|
||||
|
||||
protected:
|
||||
virtual vpx_codec_iface_t* CodecInterface() const {
|
||||
virtual vpx_codec_iface_t *CodecInterface() const {
|
||||
#if CONFIG_VP9_ENCODER
|
||||
return &vpx_codec_vp9_cx_algo;
|
||||
#else
|
||||
@ -203,12 +203,12 @@ class VP9CodecFactory : public CodecFactory {
|
||||
public:
|
||||
VP9CodecFactory() : CodecFactory() {}
|
||||
|
||||
virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,
|
||||
virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
|
||||
unsigned long deadline) const {
|
||||
return CreateDecoder(cfg, 0, deadline);
|
||||
}
|
||||
|
||||
virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,
|
||||
virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
|
||||
const vpx_codec_flags_t flags,
|
||||
unsigned long deadline) const { // NOLINT
|
||||
#if CONFIG_VP9_DECODER
|
||||
@ -218,7 +218,7 @@ class VP9CodecFactory : public CodecFactory {
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual Encoder* CreateEncoder(vpx_codec_enc_cfg_t cfg,
|
||||
virtual Encoder *CreateEncoder(vpx_codec_enc_cfg_t cfg,
|
||||
unsigned long deadline,
|
||||
const unsigned long init_flags,
|
||||
TwopassStatsStore *stats) const {
|
||||
@ -241,11 +241,12 @@ class VP9CodecFactory : public CodecFactory {
|
||||
|
||||
const libvpx_test::VP9CodecFactory kVP9;
|
||||
|
||||
#define VP9_INSTANTIATE_TEST_CASE(test, ...)\
|
||||
INSTANTIATE_TEST_CASE_P(VP9, test, \
|
||||
::testing::Combine( \
|
||||
::testing::Values(static_cast<const libvpx_test::CodecFactory*>( \
|
||||
&libvpx_test::kVP9)), \
|
||||
#define VP9_INSTANTIATE_TEST_CASE(test, ...) \
|
||||
INSTANTIATE_TEST_CASE_P( \
|
||||
VP9, test, \
|
||||
::testing::Combine( \
|
||||
::testing::Values(static_cast<const libvpx_test::CodecFactory *>( \
|
||||
&libvpx_test::kVP9)), \
|
||||
__VA_ARGS__))
|
||||
#else
|
||||
#define VP9_INSTANTIATE_TEST_CASE(test, ...)
|
||||
|
@ -15,11 +15,13 @@
|
||||
|
||||
namespace {
|
||||
|
||||
class ConfigTest : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
class ConfigTest
|
||||
: public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
protected:
|
||||
ConfigTest() : EncoderTest(GET_PARAM(0)),
|
||||
frame_count_in_(0), frame_count_out_(0), frame_count_max_(0) {}
|
||||
ConfigTest()
|
||||
: EncoderTest(GET_PARAM(0)), frame_count_in_(0), frame_count_out_(0),
|
||||
frame_count_max_(0) {}
|
||||
virtual ~ConfigTest() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
@ -32,12 +34,12 @@ class ConfigTest : public ::libvpx_test::EncoderTest,
|
||||
frame_count_out_ = 0;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource* /*video*/) {
|
||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource * /*video*/) {
|
||||
++frame_count_in_;
|
||||
abort_ |= (frame_count_in_ >= frame_count_max_);
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t* /*pkt*/) {
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t * /*pkt*/) {
|
||||
++frame_count_out_;
|
||||
}
|
||||
|
||||
|
@ -26,12 +26,10 @@
|
||||
#include "vpx_dsp/ssim.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
extern "C"
|
||||
double vpx_get_ssim_metrics(uint8_t *img1, int img1_pitch,
|
||||
uint8_t *img2, int img2_pitch,
|
||||
int width, int height,
|
||||
Ssimv *sv2, Metrics *m,
|
||||
int do_inconsistency);
|
||||
extern "C" double vpx_get_ssim_metrics(uint8_t *img1, int img1_pitch,
|
||||
uint8_t *img2, int img2_pitch, int width,
|
||||
int height, Ssimv *sv2, Metrics *m,
|
||||
int do_inconsistency);
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
@ -41,20 +39,18 @@ class ConsistencyTestBase : public ::testing::Test {
|
||||
ConsistencyTestBase(int width, int height) : width_(width), height_(height) {}
|
||||
|
||||
static void SetUpTestCase() {
|
||||
source_data_[0] = reinterpret_cast<uint8_t*>(
|
||||
source_data_[0] = reinterpret_cast<uint8_t *>(
|
||||
vpx_memalign(kDataAlignment, kDataBufferSize));
|
||||
reference_data_[0] = reinterpret_cast<uint8_t*>(
|
||||
reference_data_[0] = reinterpret_cast<uint8_t *>(
|
||||
vpx_memalign(kDataAlignment, kDataBufferSize));
|
||||
source_data_[1] = reinterpret_cast<uint8_t*>(
|
||||
source_data_[1] = reinterpret_cast<uint8_t *>(
|
||||
vpx_memalign(kDataAlignment, kDataBufferSize));
|
||||
reference_data_[1] = reinterpret_cast<uint8_t*>(
|
||||
reference_data_[1] = reinterpret_cast<uint8_t *>(
|
||||
vpx_memalign(kDataAlignment, kDataBufferSize));
|
||||
ssim_array_ = new Ssimv[kDataBufferSize / 16];
|
||||
}
|
||||
|
||||
static void ClearSsim() {
|
||||
memset(ssim_array_, 0, kDataBufferSize / 16);
|
||||
}
|
||||
static void ClearSsim() { memset(ssim_array_, 0, kDataBufferSize / 16); }
|
||||
static void TearDownTestCase() {
|
||||
vpx_free(source_data_[0]);
|
||||
source_data_[0] = NULL;
|
||||
@ -68,14 +64,12 @@ class ConsistencyTestBase : public ::testing::Test {
|
||||
delete[] ssim_array_;
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
libvpx_test::ClearSystemState();
|
||||
}
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
// Handle frames up to 640x480
|
||||
static const int kDataAlignment = 16;
|
||||
static const int kDataBufferSize = 640*480;
|
||||
static const int kDataBufferSize = 640 * 480;
|
||||
|
||||
virtual void SetUp() {
|
||||
source_stride_ = (width_ + 31) & ~31;
|
||||
@ -122,9 +116,9 @@ class ConsistencyTestBase : public ::testing::Test {
|
||||
}
|
||||
}
|
||||
int width_, height_;
|
||||
static uint8_t* source_data_[2];
|
||||
static uint8_t *source_data_[2];
|
||||
int source_stride_;
|
||||
static uint8_t* reference_data_[2];
|
||||
static uint8_t *reference_data_[2];
|
||||
int reference_stride_;
|
||||
static Ssimv *ssim_array_;
|
||||
Metrics metrics_;
|
||||
@ -142,18 +136,17 @@ class ConsistencyVP9Test
|
||||
|
||||
protected:
|
||||
double CheckConsistency(int frame) {
|
||||
EXPECT_LT(frame, 2)<< "Frame to check has to be less than 2.";
|
||||
return
|
||||
vpx_get_ssim_metrics(source_data_[frame], source_stride_,
|
||||
reference_data_[frame], reference_stride_,
|
||||
width_, height_, ssim_array_, &metrics_, 1);
|
||||
EXPECT_LT(frame, 2) << "Frame to check has to be less than 2.";
|
||||
return vpx_get_ssim_metrics(source_data_[frame], source_stride_,
|
||||
reference_data_[frame], reference_stride_,
|
||||
width_, height_, ssim_array_, &metrics_, 1);
|
||||
}
|
||||
};
|
||||
#endif // CONFIG_VP9_ENCODER
|
||||
|
||||
uint8_t* ConsistencyTestBase::source_data_[2] = {NULL, NULL};
|
||||
uint8_t* ConsistencyTestBase::reference_data_[2] = {NULL, NULL};
|
||||
Ssimv* ConsistencyTestBase::ssim_array_ = NULL;
|
||||
uint8_t *ConsistencyTestBase::source_data_[2] = { NULL, NULL };
|
||||
uint8_t *ConsistencyTestBase::reference_data_[2] = { NULL, NULL };
|
||||
Ssimv *ConsistencyTestBase::ssim_array_ = NULL;
|
||||
|
||||
#if CONFIG_VP9_ENCODER
|
||||
TEST_P(ConsistencyVP9Test, ConsistencyIsZero) {
|
||||
@ -205,7 +198,6 @@ TEST_P(ConsistencyVP9Test, ConsistencyIsZero) {
|
||||
}
|
||||
#endif // CONFIG_VP9_ENCODER
|
||||
|
||||
|
||||
using std::tr1::make_tuple;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -213,9 +205,7 @@ using std::tr1::make_tuple;
|
||||
|
||||
#if CONFIG_VP9_ENCODER
|
||||
const ConsistencyParam c_vp9_tests[] = {
|
||||
make_tuple(320, 240),
|
||||
make_tuple(318, 242),
|
||||
make_tuple(318, 238),
|
||||
make_tuple(320, 240), make_tuple(318, 242), make_tuple(318, 238),
|
||||
};
|
||||
INSTANTIATE_TEST_CASE_P(C, ConsistencyVP9Test,
|
||||
::testing::ValuesIn(c_vp9_tests));
|
||||
|
@ -37,14 +37,12 @@ typedef void (*ConvolveFunc)(const uint8_t *src, ptrdiff_t src_stride,
|
||||
int w, int h);
|
||||
|
||||
struct ConvolveFunctions {
|
||||
ConvolveFunctions(ConvolveFunc copy, ConvolveFunc avg,
|
||||
ConvolveFunc h8, ConvolveFunc h8_avg,
|
||||
ConvolveFunc v8, ConvolveFunc v8_avg,
|
||||
ConvolveFunc hv8, ConvolveFunc hv8_avg,
|
||||
ConvolveFunc sh8, ConvolveFunc sh8_avg,
|
||||
ConvolveFunc sv8, ConvolveFunc sv8_avg,
|
||||
ConvolveFunc shv8, ConvolveFunc shv8_avg,
|
||||
int bd)
|
||||
ConvolveFunctions(ConvolveFunc copy, ConvolveFunc avg, ConvolveFunc h8,
|
||||
ConvolveFunc h8_avg, ConvolveFunc v8, ConvolveFunc v8_avg,
|
||||
ConvolveFunc hv8, ConvolveFunc hv8_avg, ConvolveFunc sh8,
|
||||
ConvolveFunc sh8_avg, ConvolveFunc sv8,
|
||||
ConvolveFunc sv8_avg, ConvolveFunc shv8,
|
||||
ConvolveFunc shv8_avg, int bd)
|
||||
: 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),
|
||||
sh8_avg_(sh8_avg), sv8_avg_(sv8_avg), shv8_avg_(shv8_avg),
|
||||
@ -58,49 +56,35 @@ struct ConvolveFunctions {
|
||||
ConvolveFunc h8_avg_;
|
||||
ConvolveFunc v8_avg_;
|
||||
ConvolveFunc hv8_avg_;
|
||||
ConvolveFunc sh8_; // scaled horiz
|
||||
ConvolveFunc sv8_; // scaled vert
|
||||
ConvolveFunc shv8_; // scaled horiz/vert
|
||||
ConvolveFunc sh8_avg_; // scaled avg horiz
|
||||
ConvolveFunc sv8_avg_; // scaled avg vert
|
||||
ConvolveFunc shv8_avg_; // scaled avg horiz/vert
|
||||
ConvolveFunc sh8_; // scaled horiz
|
||||
ConvolveFunc sv8_; // scaled vert
|
||||
ConvolveFunc shv8_; // scaled horiz/vert
|
||||
ConvolveFunc sh8_avg_; // scaled avg horiz
|
||||
ConvolveFunc sv8_avg_; // scaled avg vert
|
||||
ConvolveFunc shv8_avg_; // scaled avg horiz/vert
|
||||
int use_highbd_; // 0 if high bitdepth not used, else the actual bit depth.
|
||||
};
|
||||
|
||||
typedef std::tr1::tuple<int, int, const ConvolveFunctions *> ConvolveParam;
|
||||
|
||||
#define ALL_SIZES(convolve_fn) \
|
||||
make_tuple(4, 4, &convolve_fn), \
|
||||
make_tuple(8, 4, &convolve_fn), \
|
||||
make_tuple(4, 8, &convolve_fn), \
|
||||
make_tuple(8, 8, &convolve_fn), \
|
||||
make_tuple(16, 8, &convolve_fn), \
|
||||
make_tuple(8, 16, &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)
|
||||
#define ALL_SIZES(convolve_fn) \
|
||||
make_tuple(4, 4, &convolve_fn), make_tuple(8, 4, &convolve_fn), \
|
||||
make_tuple(4, 8, &convolve_fn), make_tuple(8, 8, &convolve_fn), \
|
||||
make_tuple(16, 8, &convolve_fn), make_tuple(8, 16, &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)
|
||||
|
||||
// Reference 8-tap subpixel filter, slightly modified to fit into this test.
|
||||
#define VP9_FILTER_WEIGHT 128
|
||||
#define VP9_FILTER_SHIFT 7
|
||||
uint8_t clip_pixel(int x) {
|
||||
return x < 0 ? 0 :
|
||||
x > 255 ? 255 :
|
||||
x;
|
||||
}
|
||||
uint8_t clip_pixel(int x) { return x < 0 ? 0 : x > 255 ? 255 : x; }
|
||||
|
||||
void filter_block2d_8_c(const uint8_t *src_ptr,
|
||||
const unsigned int src_stride,
|
||||
const int16_t *HFilter,
|
||||
const int16_t *VFilter,
|
||||
uint8_t *dst_ptr,
|
||||
unsigned int dst_stride,
|
||||
unsigned int output_width,
|
||||
unsigned int output_height) {
|
||||
void filter_block2d_8_c(const uint8_t *src_ptr, const unsigned int src_stride,
|
||||
const int16_t *HFilter, const int16_t *VFilter,
|
||||
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
|
||||
// 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
|
||||
@ -128,15 +112,11 @@ void filter_block2d_8_c(const uint8_t *src_ptr,
|
||||
for (i = 0; i < intermediate_height; ++i) {
|
||||
for (j = 0; j < output_width; ++j) {
|
||||
// Apply filter...
|
||||
const int temp = (src_ptr[0] * HFilter[0]) +
|
||||
(src_ptr[1] * HFilter[1]) +
|
||||
(src_ptr[2] * HFilter[2]) +
|
||||
(src_ptr[3] * HFilter[3]) +
|
||||
(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
|
||||
const int temp = (src_ptr[0] * HFilter[0]) + (src_ptr[1] * HFilter[1]) +
|
||||
(src_ptr[2] * HFilter[2]) + (src_ptr[3] * HFilter[3]) +
|
||||
(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
|
||||
|
||||
// Normalize back to 0-255...
|
||||
*output_ptr = clip_pixel(temp >> VP9_FILTER_SHIFT);
|
||||
@ -153,15 +133,11 @@ void filter_block2d_8_c(const uint8_t *src_ptr,
|
||||
for (i = 0; i < output_height; ++i) {
|
||||
for (j = 0; j < output_width; ++j) {
|
||||
// Apply filter...
|
||||
const int temp = (src_ptr[0] * VFilter[0]) +
|
||||
(src_ptr[1] * VFilter[1]) +
|
||||
(src_ptr[2] * VFilter[2]) +
|
||||
(src_ptr[3] * VFilter[3]) +
|
||||
(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
|
||||
const int temp = (src_ptr[0] * VFilter[0]) + (src_ptr[1] * VFilter[1]) +
|
||||
(src_ptr[2] * VFilter[2]) + (src_ptr[3] * VFilter[3]) +
|
||||
(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
|
||||
|
||||
// Normalize back to 0-255...
|
||||
*dst_ptr++ = clip_pixel(temp >> VP9_FILTER_SHIFT);
|
||||
@ -172,12 +148,9 @@ void filter_block2d_8_c(const uint8_t *src_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void block2d_average_c(uint8_t *src,
|
||||
unsigned int src_stride,
|
||||
uint8_t *output_ptr,
|
||||
unsigned int output_stride,
|
||||
unsigned int output_width,
|
||||
unsigned int output_height) {
|
||||
void block2d_average_c(uint8_t *src, unsigned int src_stride,
|
||||
uint8_t *output_ptr, unsigned int output_stride,
|
||||
unsigned int output_width, unsigned int output_height) {
|
||||
unsigned int i, j;
|
||||
for (i = 0; i < output_height; ++i) {
|
||||
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,
|
||||
const unsigned int src_stride,
|
||||
const int16_t *HFilter,
|
||||
const int16_t *VFilter,
|
||||
uint8_t *dst_ptr,
|
||||
unsigned int dst_stride,
|
||||
const int16_t *HFilter, const int16_t *VFilter,
|
||||
uint8_t *dst_ptr, unsigned int dst_stride,
|
||||
unsigned int output_width,
|
||||
unsigned int output_height) {
|
||||
uint8_t tmp[kMaxDimension * kMaxDimension];
|
||||
@ -201,20 +172,16 @@ void filter_average_block2d_8_c(const uint8_t *src_ptr,
|
||||
assert(output_height <= kMaxDimension);
|
||||
filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, tmp, 64,
|
||||
output_width, output_height);
|
||||
block2d_average_c(tmp, 64, dst_ptr, dst_stride,
|
||||
output_width, output_height);
|
||||
block2d_average_c(tmp, 64, dst_ptr, dst_stride, output_width, output_height);
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
void highbd_filter_block2d_8_c(const uint16_t *src_ptr,
|
||||
const unsigned int src_stride,
|
||||
const int16_t *HFilter,
|
||||
const int16_t *VFilter,
|
||||
uint16_t *dst_ptr,
|
||||
unsigned int dst_stride,
|
||||
const int16_t *HFilter, const int16_t *VFilter,
|
||||
uint16_t *dst_ptr, unsigned int dst_stride,
|
||||
unsigned int output_width,
|
||||
unsigned int output_height,
|
||||
int bd) {
|
||||
unsigned int output_height, int bd) {
|
||||
// Between passes, we use an intermediate buffer whose height is extended to
|
||||
// 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
|
||||
@ -243,14 +210,10 @@ void highbd_filter_block2d_8_c(const uint16_t *src_ptr,
|
||||
for (i = 0; i < intermediate_height; ++i) {
|
||||
for (j = 0; j < output_width; ++j) {
|
||||
// Apply filter...
|
||||
const int temp = (src_ptr[0] * HFilter[0]) +
|
||||
(src_ptr[1] * HFilter[1]) +
|
||||
(src_ptr[2] * HFilter[2]) +
|
||||
(src_ptr[3] * HFilter[3]) +
|
||||
(src_ptr[4] * HFilter[4]) +
|
||||
(src_ptr[5] * HFilter[5]) +
|
||||
(src_ptr[6] * HFilter[6]) +
|
||||
(src_ptr[7] * HFilter[7]) +
|
||||
const int temp = (src_ptr[0] * HFilter[0]) + (src_ptr[1] * HFilter[1]) +
|
||||
(src_ptr[2] * HFilter[2]) + (src_ptr[3] * HFilter[3]) +
|
||||
(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
|
||||
|
||||
// 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 (j = 0; j < output_width; ++j) {
|
||||
// Apply filter...
|
||||
const int temp = (src_ptr[0] * VFilter[0]) +
|
||||
(src_ptr[1] * VFilter[1]) +
|
||||
(src_ptr[2] * VFilter[2]) +
|
||||
(src_ptr[3] * VFilter[3]) +
|
||||
(src_ptr[4] * VFilter[4]) +
|
||||
(src_ptr[5] * VFilter[5]) +
|
||||
(src_ptr[6] * VFilter[6]) +
|
||||
(src_ptr[7] * VFilter[7]) +
|
||||
const int temp = (src_ptr[0] * VFilter[0]) + (src_ptr[1] * VFilter[1]) +
|
||||
(src_ptr[2] * VFilter[2]) + (src_ptr[3] * VFilter[3]) +
|
||||
(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
|
||||
|
||||
// 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,
|
||||
unsigned int src_stride,
|
||||
uint16_t *output_ptr,
|
||||
unsigned int output_stride,
|
||||
void highbd_block2d_average_c(uint16_t *src, unsigned int src_stride,
|
||||
uint16_t *output_ptr, unsigned int output_stride,
|
||||
unsigned int output_width,
|
||||
unsigned int output_height) {
|
||||
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,
|
||||
const unsigned int src_stride,
|
||||
const int16_t *HFilter,
|
||||
const int16_t *VFilter,
|
||||
uint16_t *dst_ptr,
|
||||
unsigned int dst_stride,
|
||||
unsigned int output_width,
|
||||
unsigned int output_height,
|
||||
int bd) {
|
||||
void highbd_filter_average_block2d_8_c(
|
||||
const uint16_t *src_ptr, const unsigned int src_stride,
|
||||
const int16_t *HFilter, const int16_t *VFilter, uint16_t *dst_ptr,
|
||||
unsigned int dst_stride, unsigned int output_width,
|
||||
unsigned int output_height, int bd) {
|
||||
uint16_t tmp[kMaxDimension * kMaxDimension];
|
||||
|
||||
assert(output_width <= kMaxDimension);
|
||||
assert(output_height <= kMaxDimension);
|
||||
highbd_filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, tmp, 64,
|
||||
output_width, output_height, bd);
|
||||
highbd_block2d_average_c(tmp, 64, dst_ptr, dst_stride,
|
||||
output_width, output_height);
|
||||
highbd_block2d_average_c(tmp, 64, dst_ptr, dst_stride, output_width,
|
||||
output_height);
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
@ -330,19 +283,20 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
||||
public:
|
||||
static void SetUpTestCase() {
|
||||
// Force input_ to be unaligned, output to be 16 byte aligned.
|
||||
input_ = reinterpret_cast<uint8_t*>(
|
||||
vpx_memalign(kDataAlignment, kInputBufferSize + 1)) + 1;
|
||||
output_ = reinterpret_cast<uint8_t*>(
|
||||
input_ = reinterpret_cast<uint8_t *>(
|
||||
vpx_memalign(kDataAlignment, kInputBufferSize + 1)) +
|
||||
1;
|
||||
output_ = reinterpret_cast<uint8_t *>(
|
||||
vpx_memalign(kDataAlignment, kOutputBufferSize));
|
||||
output_ref_ = reinterpret_cast<uint8_t*>(
|
||||
output_ref_ = reinterpret_cast<uint8_t *>(
|
||||
vpx_memalign(kDataAlignment, kOutputBufferSize));
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
input16_ = reinterpret_cast<uint16_t*>(
|
||||
vpx_memalign(kDataAlignment,
|
||||
(kInputBufferSize + 1) * sizeof(uint16_t))) + 1;
|
||||
output16_ = reinterpret_cast<uint16_t*>(
|
||||
input16_ = reinterpret_cast<uint16_t *>(vpx_memalign(
|
||||
kDataAlignment, (kInputBufferSize + 1) * sizeof(uint16_t))) +
|
||||
1;
|
||||
output16_ = reinterpret_cast<uint16_t *>(
|
||||
vpx_memalign(kDataAlignment, (kOutputBufferSize) * sizeof(uint16_t)));
|
||||
output16_ref_ = reinterpret_cast<uint16_t*>(
|
||||
output16_ref_ = reinterpret_cast<uint16_t *>(
|
||||
vpx_memalign(kDataAlignment, (kOutputBufferSize) * sizeof(uint16_t)));
|
||||
#endif
|
||||
}
|
||||
@ -438,8 +392,7 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
||||
|
||||
void CheckGuardBlocks() {
|
||||
for (int i = 0; i < kOutputBufferSize; ++i) {
|
||||
if (IsIndexInBorder(i))
|
||||
EXPECT_EQ(255, output_[i]);
|
||||
if (IsIndexInBorder(i)) EXPECT_EQ(255, output_[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -497,98 +450,88 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
|
||||
void assign_val(uint8_t *list, int index, uint16_t val) const {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (UUT_->use_highbd_ == 0) {
|
||||
list[index] = (uint8_t) val;
|
||||
list[index] = (uint8_t)val;
|
||||
} else {
|
||||
CONVERT_TO_SHORTPTR(list)[index] = val;
|
||||
}
|
||||
#else
|
||||
list[index] = (uint8_t) val;
|
||||
list[index] = (uint8_t)val;
|
||||
#endif
|
||||
}
|
||||
|
||||
void wrapper_filter_average_block2d_8_c(const uint8_t *src_ptr,
|
||||
const unsigned int src_stride,
|
||||
const int16_t *HFilter,
|
||||
const int16_t *VFilter,
|
||||
uint8_t *dst_ptr,
|
||||
unsigned int dst_stride,
|
||||
unsigned int output_width,
|
||||
unsigned int output_height) {
|
||||
void wrapper_filter_average_block2d_8_c(
|
||||
const uint8_t *src_ptr, const unsigned int src_stride,
|
||||
const int16_t *HFilter, const int16_t *VFilter, uint8_t *dst_ptr,
|
||||
unsigned int dst_stride, unsigned int output_width,
|
||||
unsigned int output_height) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (UUT_->use_highbd_ == 0) {
|
||||
filter_average_block2d_8_c(src_ptr, src_stride, HFilter, VFilter,
|
||||
dst_ptr, dst_stride, output_width,
|
||||
output_height);
|
||||
filter_average_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, dst_ptr,
|
||||
dst_stride, output_width, output_height);
|
||||
} else {
|
||||
highbd_filter_average_block2d_8_c(CONVERT_TO_SHORTPTR(src_ptr),
|
||||
src_stride, HFilter, VFilter,
|
||||
CONVERT_TO_SHORTPTR(dst_ptr),
|
||||
dst_stride, output_width, output_height,
|
||||
UUT_->use_highbd_);
|
||||
highbd_filter_average_block2d_8_c(
|
||||
CONVERT_TO_SHORTPTR(src_ptr), src_stride, HFilter, VFilter,
|
||||
CONVERT_TO_SHORTPTR(dst_ptr), dst_stride, output_width, output_height,
|
||||
UUT_->use_highbd_);
|
||||
}
|
||||
#else
|
||||
filter_average_block2d_8_c(src_ptr, src_stride, HFilter, VFilter,
|
||||
dst_ptr, dst_stride, output_width,
|
||||
output_height);
|
||||
filter_average_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, dst_ptr,
|
||||
dst_stride, output_width, output_height);
|
||||
#endif
|
||||
}
|
||||
|
||||
void wrapper_filter_block2d_8_c(const uint8_t *src_ptr,
|
||||
const unsigned int src_stride,
|
||||
const int16_t *HFilter,
|
||||
const int16_t *VFilter,
|
||||
uint8_t *dst_ptr,
|
||||
const int16_t *VFilter, uint8_t *dst_ptr,
|
||||
unsigned int dst_stride,
|
||||
unsigned int output_width,
|
||||
unsigned int output_height) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (UUT_->use_highbd_ == 0) {
|
||||
filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter,
|
||||
dst_ptr, dst_stride, output_width, output_height);
|
||||
filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, dst_ptr,
|
||||
dst_stride, output_width, output_height);
|
||||
} else {
|
||||
highbd_filter_block2d_8_c(CONVERT_TO_SHORTPTR(src_ptr), src_stride,
|
||||
HFilter, VFilter,
|
||||
CONVERT_TO_SHORTPTR(dst_ptr), dst_stride,
|
||||
output_width, output_height, UUT_->use_highbd_);
|
||||
HFilter, VFilter, CONVERT_TO_SHORTPTR(dst_ptr),
|
||||
dst_stride, output_width, output_height,
|
||||
UUT_->use_highbd_);
|
||||
}
|
||||
#else
|
||||
filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter,
|
||||
dst_ptr, dst_stride, output_width, output_height);
|
||||
filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, dst_ptr,
|
||||
dst_stride, output_width, output_height);
|
||||
#endif
|
||||
}
|
||||
|
||||
const ConvolveFunctions* UUT_;
|
||||
static uint8_t* input_;
|
||||
static uint8_t* output_;
|
||||
static uint8_t* output_ref_;
|
||||
const ConvolveFunctions *UUT_;
|
||||
static uint8_t *input_;
|
||||
static uint8_t *output_;
|
||||
static uint8_t *output_ref_;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
static uint16_t* input16_;
|
||||
static uint16_t* output16_;
|
||||
static uint16_t* output16_ref_;
|
||||
static uint16_t *input16_;
|
||||
static uint16_t *output16_;
|
||||
static uint16_t *output16_ref_;
|
||||
int mask_;
|
||||
#endif
|
||||
};
|
||||
|
||||
uint8_t* ConvolveTest::input_ = NULL;
|
||||
uint8_t* ConvolveTest::output_ = NULL;
|
||||
uint8_t* ConvolveTest::output_ref_ = NULL;
|
||||
uint8_t *ConvolveTest::input_ = NULL;
|
||||
uint8_t *ConvolveTest::output_ = NULL;
|
||||
uint8_t *ConvolveTest::output_ref_ = NULL;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
uint16_t* ConvolveTest::input16_ = NULL;
|
||||
uint16_t* ConvolveTest::output16_ = NULL;
|
||||
uint16_t* ConvolveTest::output16_ref_ = NULL;
|
||||
uint16_t *ConvolveTest::input16_ = NULL;
|
||||
uint16_t *ConvolveTest::output16_ = NULL;
|
||||
uint16_t *ConvolveTest::output16_ref_ = NULL;
|
||||
#endif
|
||||
|
||||
TEST_P(ConvolveTest, GuardBlocks) {
|
||||
CheckGuardBlocks();
|
||||
}
|
||||
TEST_P(ConvolveTest, GuardBlocks) { CheckGuardBlocks(); }
|
||||
|
||||
TEST_P(ConvolveTest, Copy) {
|
||||
uint8_t* const in = input();
|
||||
uint8_t* const out = output();
|
||||
uint8_t *const in = input();
|
||||
uint8_t *const out = output();
|
||||
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->copy_(in, kInputStride, out, kOutputStride, NULL, 0, NULL, 0,
|
||||
Width(), Height()));
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->copy_(in, kInputStride, out, kOutputStride,
|
||||
NULL, 0, NULL, 0, Width(), Height()));
|
||||
|
||||
CheckGuardBlocks();
|
||||
|
||||
@ -600,14 +543,13 @@ TEST_P(ConvolveTest, Copy) {
|
||||
}
|
||||
|
||||
TEST_P(ConvolveTest, Avg) {
|
||||
uint8_t* const in = input();
|
||||
uint8_t* const out = output();
|
||||
uint8_t* const out_ref = output_ref();
|
||||
uint8_t *const in = input();
|
||||
uint8_t *const out = output();
|
||||
uint8_t *const out_ref = output_ref();
|
||||
CopyOutputToRef();
|
||||
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->avg_(in, kInputStride, out, kOutputStride, NULL, 0, NULL, 0,
|
||||
Width(), Height()));
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->avg_(in, kInputStride, out, kOutputStride,
|
||||
NULL, 0, NULL, 0, Width(), Height()));
|
||||
|
||||
CheckGuardBlocks();
|
||||
|
||||
@ -615,18 +557,20 @@ TEST_P(ConvolveTest, Avg) {
|
||||
for (int x = 0; x < Width(); ++x)
|
||||
ASSERT_EQ(lookup(out, y * kOutputStride + 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 << ")";
|
||||
}
|
||||
|
||||
TEST_P(ConvolveTest, CopyHoriz) {
|
||||
uint8_t* const in = input();
|
||||
uint8_t* const out = output();
|
||||
DECLARE_ALIGNED(256, const int16_t, filter8[8]) = {0, 0, 0, 128, 0, 0, 0, 0};
|
||||
uint8_t *const in = input();
|
||||
uint8_t *const out = output();
|
||||
DECLARE_ALIGNED(256, const int16_t,
|
||||
filter8[8]) = { 0, 0, 0, 128, 0, 0, 0, 0 };
|
||||
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->sh8_(in, kInputStride, out, kOutputStride, filter8, 16, filter8, 16,
|
||||
Width(), Height()));
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->sh8_(in, kInputStride, out, kOutputStride,
|
||||
filter8, 16, filter8, 16, Width(),
|
||||
Height()));
|
||||
|
||||
CheckGuardBlocks();
|
||||
|
||||
@ -638,13 +582,14 @@ TEST_P(ConvolveTest, CopyHoriz) {
|
||||
}
|
||||
|
||||
TEST_P(ConvolveTest, CopyVert) {
|
||||
uint8_t* const in = input();
|
||||
uint8_t* const out = output();
|
||||
DECLARE_ALIGNED(256, const int16_t, filter8[8]) = {0, 0, 0, 128, 0, 0, 0, 0};
|
||||
uint8_t *const in = input();
|
||||
uint8_t *const out = output();
|
||||
DECLARE_ALIGNED(256, const int16_t,
|
||||
filter8[8]) = { 0, 0, 0, 128, 0, 0, 0, 0 };
|
||||
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->sv8_(in, kInputStride, out, kOutputStride, filter8, 16, filter8, 16,
|
||||
Width(), Height()));
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->sv8_(in, kInputStride, out, kOutputStride,
|
||||
filter8, 16, filter8, 16, Width(),
|
||||
Height()));
|
||||
|
||||
CheckGuardBlocks();
|
||||
|
||||
@ -656,13 +601,14 @@ TEST_P(ConvolveTest, CopyVert) {
|
||||
}
|
||||
|
||||
TEST_P(ConvolveTest, Copy2D) {
|
||||
uint8_t* const in = input();
|
||||
uint8_t* const out = output();
|
||||
DECLARE_ALIGNED(256, const int16_t, filter8[8]) = {0, 0, 0, 128, 0, 0, 0, 0};
|
||||
uint8_t *const in = input();
|
||||
uint8_t *const out = output();
|
||||
DECLARE_ALIGNED(256, const int16_t,
|
||||
filter8[8]) = { 0, 0, 0, 128, 0, 0, 0, 0 };
|
||||
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->shv8_(in, kInputStride, out, kOutputStride, filter8, 16, filter8,
|
||||
16, Width(), Height()));
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->shv8_(in, kInputStride, out, kOutputStride,
|
||||
filter8, 16, filter8, 16, Width(),
|
||||
Height()));
|
||||
|
||||
CheckGuardBlocks();
|
||||
|
||||
@ -700,12 +646,12 @@ TEST(ConvolveTest, FiltersWontSaturateWhenAddedPairwise) {
|
||||
const int16_t kInvalidFilter[8] = { 0 };
|
||||
|
||||
TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) {
|
||||
uint8_t* const in = input();
|
||||
uint8_t* const out = output();
|
||||
uint8_t *const in = input();
|
||||
uint8_t *const out = output();
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
uint8_t ref8[kOutputStride * kMaxDimension];
|
||||
uint16_t ref16[kOutputStride * kMaxDimension];
|
||||
uint8_t* ref;
|
||||
uint8_t *ref;
|
||||
if (UUT_->use_highbd_ == 0) {
|
||||
ref = ref8;
|
||||
} else {
|
||||
@ -721,31 +667,26 @@ TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) {
|
||||
|
||||
for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
|
||||
for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
|
||||
wrapper_filter_block2d_8_c(in, kInputStride,
|
||||
filters[filter_x], filters[filter_y],
|
||||
ref, kOutputStride,
|
||||
wrapper_filter_block2d_8_c(in, kInputStride, filters[filter_x],
|
||||
filters[filter_y], ref, kOutputStride,
|
||||
Width(), Height());
|
||||
|
||||
if (filter_x && filter_y)
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->hv8_(in, kInputStride, out, kOutputStride,
|
||||
filters[filter_x], 16, filters[filter_y], 16,
|
||||
Width(), Height()));
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->hv8_(
|
||||
in, kInputStride, out, kOutputStride, filters[filter_x], 16,
|
||||
filters[filter_y], 16, Width(), Height()));
|
||||
else if (filter_y)
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->v8_(in, kInputStride, out, kOutputStride,
|
||||
kInvalidFilter, 16, filters[filter_y], 16,
|
||||
Width(), Height()));
|
||||
UUT_->v8_(in, kInputStride, out, kOutputStride, kInvalidFilter,
|
||||
16, filters[filter_y], 16, Width(), Height()));
|
||||
else if (filter_x)
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->h8_(in, kInputStride, out, kOutputStride,
|
||||
filters[filter_x], 16, kInvalidFilter, 16,
|
||||
Width(), Height()));
|
||||
UUT_->h8_(in, kInputStride, out, kOutputStride, filters[filter_x],
|
||||
16, kInvalidFilter, 16, Width(), Height()));
|
||||
else
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->copy_(in, kInputStride, out, kOutputStride,
|
||||
kInvalidFilter, 0, kInvalidFilter, 0,
|
||||
Width(), Height()));
|
||||
UUT_->copy_(in, kInputStride, out, kOutputStride, kInvalidFilter,
|
||||
0, kInvalidFilter, 0, Width(), Height()));
|
||||
|
||||
CheckGuardBlocks();
|
||||
|
||||
@ -754,20 +695,20 @@ TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) {
|
||||
ASSERT_EQ(lookup(ref, y * kOutputStride + x),
|
||||
lookup(out, y * kOutputStride + x))
|
||||
<< "mismatch at (" << x << "," << y << "), "
|
||||
<< "filters (" << filter_bank << ","
|
||||
<< filter_x << "," << filter_y << ")";
|
||||
<< "filters (" << filter_bank << "," << filter_x << ","
|
||||
<< filter_y << ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(ConvolveTest, MatchesReferenceAveragingSubpixelFilter) {
|
||||
uint8_t* const in = input();
|
||||
uint8_t* const out = output();
|
||||
uint8_t *const in = input();
|
||||
uint8_t *const out = output();
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
uint8_t ref8[kOutputStride * kMaxDimension];
|
||||
uint16_t ref16[kOutputStride * kMaxDimension];
|
||||
uint8_t* ref;
|
||||
uint8_t *ref;
|
||||
if (UUT_->use_highbd_ == 0) {
|
||||
ref = ref8;
|
||||
} else {
|
||||
@ -803,31 +744,26 @@ TEST_P(ConvolveTest, MatchesReferenceAveragingSubpixelFilter) {
|
||||
|
||||
for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
|
||||
for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
|
||||
wrapper_filter_average_block2d_8_c(in, kInputStride,
|
||||
filters[filter_x], filters[filter_y],
|
||||
ref, kOutputStride,
|
||||
Width(), Height());
|
||||
wrapper_filter_average_block2d_8_c(in, kInputStride, filters[filter_x],
|
||||
filters[filter_y], ref,
|
||||
kOutputStride, Width(), Height());
|
||||
|
||||
if (filter_x && filter_y)
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->hv8_avg_(in, kInputStride, out, kOutputStride,
|
||||
filters[filter_x], 16, filters[filter_y], 16,
|
||||
Width(), Height()));
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->hv8_avg_(
|
||||
in, kInputStride, out, kOutputStride, filters[filter_x], 16,
|
||||
filters[filter_y], 16, Width(), Height()));
|
||||
else if (filter_y)
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->v8_avg_(in, kInputStride, out, kOutputStride,
|
||||
kInvalidFilter, 16, filters[filter_y], 16,
|
||||
Width(), Height()));
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->v8_avg_(
|
||||
in, kInputStride, out, kOutputStride, kInvalidFilter, 16,
|
||||
filters[filter_y], 16, Width(), Height()));
|
||||
else if (filter_x)
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->h8_avg_(in, kInputStride, out, kOutputStride,
|
||||
filters[filter_x], 16, kInvalidFilter, 16,
|
||||
Width(), Height()));
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->h8_avg_(
|
||||
in, kInputStride, out, kOutputStride, filters[filter_x], 16,
|
||||
kInvalidFilter, 16, Width(), Height()));
|
||||
else
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->avg_(in, kInputStride, out, kOutputStride,
|
||||
kInvalidFilter, 0, kInvalidFilter, 0,
|
||||
Width(), Height()));
|
||||
UUT_->avg_(in, kInputStride, out, kOutputStride, kInvalidFilter,
|
||||
0, kInvalidFilter, 0, Width(), Height()));
|
||||
|
||||
CheckGuardBlocks();
|
||||
|
||||
@ -836,8 +772,8 @@ TEST_P(ConvolveTest, MatchesReferenceAveragingSubpixelFilter) {
|
||||
ASSERT_EQ(lookup(ref, y * kOutputStride + x),
|
||||
lookup(out, y * kOutputStride + x))
|
||||
<< "mismatch at (" << x << "," << y << "), "
|
||||
<< "filters (" << filter_bank << ","
|
||||
<< filter_x << "," << filter_y << ")";
|
||||
<< "filters (" << filter_bank << "," << filter_x << ","
|
||||
<< filter_y << ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -884,16 +820,16 @@ TEST_P(ConvolveTest, FilterExtremes) {
|
||||
for (int y = 0; y < 8; ++y) {
|
||||
for (int x = 0; x < 8; ++x) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
assign_val(in, y * kOutputStride + x - SUBPEL_TAPS / 2 + 1,
|
||||
((seed_val >> (axis ? y : x)) & 1) * mask_);
|
||||
assign_val(in, y * kOutputStride + x - SUBPEL_TAPS / 2 + 1,
|
||||
((seed_val >> (axis ? y : x)) & 1) * mask_);
|
||||
#else
|
||||
assign_val(in, y * kOutputStride + x - SUBPEL_TAPS / 2 + 1,
|
||||
((seed_val >> (axis ? y : x)) & 1) * 255);
|
||||
assign_val(in, y * kOutputStride + x - SUBPEL_TAPS / 2 + 1,
|
||||
((seed_val >> (axis ? y : x)) & 1) * 255);
|
||||
#endif
|
||||
if (axis) seed_val++;
|
||||
}
|
||||
if (axis)
|
||||
seed_val-= 8;
|
||||
seed_val -= 8;
|
||||
else
|
||||
seed_val++;
|
||||
}
|
||||
@ -904,38 +840,33 @@ TEST_P(ConvolveTest, FilterExtremes) {
|
||||
vp9_filter_kernels[static_cast<INTERP_FILTER>(filter_bank)];
|
||||
for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
|
||||
for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
|
||||
wrapper_filter_block2d_8_c(in, kInputStride,
|
||||
filters[filter_x], filters[filter_y],
|
||||
ref, kOutputStride,
|
||||
wrapper_filter_block2d_8_c(in, kInputStride, filters[filter_x],
|
||||
filters[filter_y], ref, kOutputStride,
|
||||
Width(), Height());
|
||||
if (filter_x && filter_y)
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->hv8_(in, kInputStride, out, kOutputStride,
|
||||
filters[filter_x], 16, filters[filter_y], 16,
|
||||
Width(), Height()));
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->hv8_(
|
||||
in, kInputStride, out, kOutputStride, filters[filter_x], 16,
|
||||
filters[filter_y], 16, Width(), Height()));
|
||||
else if (filter_y)
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->v8_(in, kInputStride, out, kOutputStride,
|
||||
kInvalidFilter, 16, filters[filter_y], 16,
|
||||
Width(), Height()));
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->v8_(
|
||||
in, kInputStride, out, kOutputStride, kInvalidFilter, 16,
|
||||
filters[filter_y], 16, Width(), Height()));
|
||||
else if (filter_x)
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->h8_(in, kInputStride, out, kOutputStride,
|
||||
filters[filter_x], 16, kInvalidFilter, 16,
|
||||
Width(), Height()));
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->h8_(
|
||||
in, kInputStride, out, kOutputStride, filters[filter_x], 16,
|
||||
kInvalidFilter, 16, Width(), Height()));
|
||||
else
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
UUT_->copy_(in, kInputStride, out, kOutputStride,
|
||||
kInvalidFilter, 0, kInvalidFilter, 0,
|
||||
Width(), Height()));
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->copy_(
|
||||
in, kInputStride, out, kOutputStride, kInvalidFilter, 0,
|
||||
kInvalidFilter, 0, Width(), Height()));
|
||||
|
||||
for (int y = 0; y < Height(); ++y)
|
||||
for (int x = 0; x < Width(); ++x)
|
||||
ASSERT_EQ(lookup(ref, y * kOutputStride + x),
|
||||
lookup(out, y * kOutputStride + x))
|
||||
<< "mismatch at (" << x << "," << y << "), "
|
||||
<< "filters (" << filter_bank << ","
|
||||
<< filter_x << "," << filter_y << ")";
|
||||
<< "filters (" << filter_bank << "," << filter_x << ","
|
||||
<< filter_y << ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -946,8 +877,8 @@ TEST_P(ConvolveTest, FilterExtremes) {
|
||||
/* This test exercises that enough rows and columns are filtered with every
|
||||
possible initial fractional positions and scaling steps. */
|
||||
TEST_P(ConvolveTest, CheckScalingFiltering) {
|
||||
uint8_t* const in = input();
|
||||
uint8_t* const out = output();
|
||||
uint8_t *const in = input();
|
||||
uint8_t *const out = output();
|
||||
const InterpKernel *const eighttap = vp9_filter_kernels[EIGHTTAP];
|
||||
|
||||
SetConstantInput(127);
|
||||
@ -956,9 +887,8 @@ TEST_P(ConvolveTest, CheckScalingFiltering) {
|
||||
for (int step = 1; step <= 32; ++step) {
|
||||
/* Test the horizontal and vertical filters in combination. */
|
||||
ASM_REGISTER_STATE_CHECK(UUT_->shv8_(in, kInputStride, out, kOutputStride,
|
||||
eighttap[frac], step,
|
||||
eighttap[frac], step,
|
||||
Width(), Height()));
|
||||
eighttap[frac], step, eighttap[frac],
|
||||
step, Width(), Height()));
|
||||
|
||||
CheckGuardBlocks();
|
||||
|
||||
@ -966,8 +896,8 @@ TEST_P(ConvolveTest, CheckScalingFiltering) {
|
||||
for (int x = 0; x < Width(); ++x) {
|
||||
ASSERT_EQ(lookup(in, y * kInputStride + x),
|
||||
lookup(out, y * kOutputStride + x))
|
||||
<< "x == " << x << ", y == " << y
|
||||
<< ", frac == " << frac << ", step == " << step;
|
||||
<< "x == " << x << ", y == " << y << ", frac == " << frac
|
||||
<< ", step == " << step;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -977,18 +907,14 @@ TEST_P(ConvolveTest, CheckScalingFiltering) {
|
||||
using std::tr1::make_tuple;
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
#define WRAP(func, bd) \
|
||||
void wrap_ ## func ## _ ## bd(const uint8_t *src, ptrdiff_t src_stride, \
|
||||
uint8_t *dst, ptrdiff_t dst_stride, \
|
||||
const int16_t *filter_x, \
|
||||
int filter_x_stride, \
|
||||
const int16_t *filter_y, \
|
||||
int filter_y_stride, \
|
||||
int w, int h) { \
|
||||
vpx_highbd_ ## func(src, src_stride, dst, dst_stride, filter_x, \
|
||||
filter_x_stride, filter_y, filter_y_stride, \
|
||||
w, h, bd); \
|
||||
}
|
||||
#define WRAP(func, bd) \
|
||||
void wrap_##func##_##bd( \
|
||||
const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, \
|
||||
ptrdiff_t dst_stride, const int16_t *filter_x, int filter_x_stride, \
|
||||
const int16_t *filter_y, int filter_y_stride, int w, int h) { \
|
||||
vpx_highbd_##func(src, src_stride, dst, dst_stride, filter_x, \
|
||||
filter_x_stride, filter_y, filter_y_stride, w, h, bd); \
|
||||
}
|
||||
#if HAVE_SSE2 && ARCH_X86_64
|
||||
WRAP(convolve_copy_sse2, 8)
|
||||
WRAP(convolve_avg_sse2, 8)
|
||||
@ -1043,48 +969,40 @@ WRAP(convolve8_avg_c, 12)
|
||||
#undef WRAP
|
||||
|
||||
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_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_vert_c_8, wrap_convolve8_avg_vert_c_8,
|
||||
wrap_convolve8_c_8, wrap_convolve8_avg_c_8, 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(
|
||||
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_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_vert_c_10, wrap_convolve8_avg_vert_c_10,
|
||||
wrap_convolve8_c_10, wrap_convolve8_avg_c_10, 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(
|
||||
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_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_vert_c_12, wrap_convolve8_avg_vert_c_12,
|
||||
wrap_convolve8_c_12, wrap_convolve8_avg_c_12, 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[] = {
|
||||
ALL_SIZES(convolve8_c),
|
||||
ALL_SIZES(convolve10_c),
|
||||
ALL_SIZES(convolve12_c)
|
||||
ALL_SIZES(convolve8_c), ALL_SIZES(convolve10_c), ALL_SIZES(convolve12_c)
|
||||
};
|
||||
|
||||
#else
|
||||
const ConvolveFunctions convolve8_c(
|
||||
vpx_convolve_copy_c, vpx_convolve_avg_c,
|
||||
vpx_convolve8_horiz_c, vpx_convolve8_avg_horiz_c,
|
||||
vpx_convolve8_vert_c, vpx_convolve8_avg_vert_c,
|
||||
vpx_convolve8_c, vpx_convolve8_avg_c,
|
||||
vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c,
|
||||
vpx_scaled_vert_c, vpx_scaled_avg_vert_c,
|
||||
vpx_convolve_copy_c, vpx_convolve_avg_c, vpx_convolve8_horiz_c,
|
||||
vpx_convolve8_avg_horiz_c, vpx_convolve8_vert_c, vpx_convolve8_avg_vert_c,
|
||||
vpx_convolve8_c, vpx_convolve8_avg_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);
|
||||
const ConvolveParam kArrayConvolve_c[] = { ALL_SIZES(convolve8_c) };
|
||||
#endif
|
||||
INSTANTIATE_TEST_CASE_P(C, ConvolveTest,
|
||||
::testing::ValuesIn(kArrayConvolve_c));
|
||||
INSTANTIATE_TEST_CASE_P(C, ConvolveTest, ::testing::ValuesIn(kArrayConvolve_c));
|
||||
|
||||
#if HAVE_SSE2 && ARCH_X86_64
|
||||
#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_vert_sse2_12, wrap_convolve8_avg_vert_sse2_12,
|
||||
wrap_convolve8_sse2_12, wrap_convolve8_avg_sse2_12, 12);
|
||||
const ConvolveParam kArrayConvolve_sse2[] = {
|
||||
ALL_SIZES(convolve8_sse2),
|
||||
ALL_SIZES(convolve10_sse2),
|
||||
ALL_SIZES(convolve12_sse2)
|
||||
};
|
||||
const ConvolveParam kArrayConvolve_sse2[] = { ALL_SIZES(convolve8_sse2),
|
||||
ALL_SIZES(convolve10_sse2),
|
||||
ALL_SIZES(convolve12_sse2) };
|
||||
#else
|
||||
const ConvolveFunctions convolve8_sse2(
|
||||
vpx_convolve_copy_sse2, vpx_convolve_avg_sse2,
|
||||
vpx_convolve8_horiz_sse2, vpx_convolve8_avg_horiz_sse2,
|
||||
vpx_convolve8_vert_sse2, vpx_convolve8_avg_vert_sse2,
|
||||
vpx_convolve8_sse2, vpx_convolve8_avg_sse2,
|
||||
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_convolve_copy_sse2, vpx_convolve_avg_sse2, vpx_convolve8_horiz_sse2,
|
||||
vpx_convolve8_avg_horiz_sse2, vpx_convolve8_vert_sse2,
|
||||
vpx_convolve8_avg_vert_sse2, vpx_convolve8_sse2, vpx_convolve8_avg_sse2,
|
||||
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);
|
||||
|
||||
const ConvolveParam kArrayConvolve_sse2[] = { ALL_SIZES(convolve8_sse2) };
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
@ -1135,13 +1049,11 @@ INSTANTIATE_TEST_CASE_P(SSE2, ConvolveTest,
|
||||
|
||||
#if HAVE_SSSE3
|
||||
const ConvolveFunctions convolve8_ssse3(
|
||||
vpx_convolve_copy_c, vpx_convolve_avg_c,
|
||||
vpx_convolve8_horiz_ssse3, vpx_convolve8_avg_horiz_ssse3,
|
||||
vpx_convolve8_vert_ssse3, vpx_convolve8_avg_vert_ssse3,
|
||||
vpx_convolve8_ssse3, vpx_convolve8_avg_ssse3,
|
||||
vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c,
|
||||
vpx_scaled_vert_c, vpx_scaled_avg_vert_c,
|
||||
vpx_scaled_2d_ssse3, vpx_scaled_avg_2d_c, 0);
|
||||
vpx_convolve_copy_c, vpx_convolve_avg_c, vpx_convolve8_horiz_ssse3,
|
||||
vpx_convolve8_avg_horiz_ssse3, vpx_convolve8_vert_ssse3,
|
||||
vpx_convolve8_avg_vert_ssse3, vpx_convolve8_ssse3, vpx_convolve8_avg_ssse3,
|
||||
vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, 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) };
|
||||
INSTANTIATE_TEST_CASE_P(SSSE3, ConvolveTest,
|
||||
@ -1150,13 +1062,11 @@ INSTANTIATE_TEST_CASE_P(SSSE3, ConvolveTest,
|
||||
|
||||
#if HAVE_AVX2 && HAVE_SSSE3
|
||||
const ConvolveFunctions convolve8_avx2(
|
||||
vpx_convolve_copy_c, vpx_convolve_avg_c,
|
||||
vpx_convolve8_horiz_avx2, vpx_convolve8_avg_horiz_ssse3,
|
||||
vpx_convolve8_vert_avx2, vpx_convolve8_avg_vert_ssse3,
|
||||
vpx_convolve8_avx2, vpx_convolve8_avg_ssse3,
|
||||
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_convolve_copy_c, vpx_convolve_avg_c, vpx_convolve8_horiz_avx2,
|
||||
vpx_convolve8_avg_horiz_ssse3, vpx_convolve8_vert_avx2,
|
||||
vpx_convolve8_avg_vert_ssse3, vpx_convolve8_avx2, vpx_convolve8_avg_ssse3,
|
||||
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);
|
||||
|
||||
const ConvolveParam kArrayConvolve8_avx2[] = { ALL_SIZES(convolve8_avx2) };
|
||||
INSTANTIATE_TEST_CASE_P(AVX2, ConvolveTest,
|
||||
@ -1166,22 +1076,18 @@ INSTANTIATE_TEST_CASE_P(AVX2, ConvolveTest,
|
||||
#if HAVE_NEON
|
||||
#if HAVE_NEON_ASM
|
||||
const ConvolveFunctions convolve8_neon(
|
||||
vpx_convolve_copy_neon, vpx_convolve_avg_neon,
|
||||
vpx_convolve8_horiz_neon, vpx_convolve8_avg_horiz_neon,
|
||||
vpx_convolve8_vert_neon, vpx_convolve8_avg_vert_neon,
|
||||
vpx_convolve8_neon, vpx_convolve8_avg_neon,
|
||||
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);
|
||||
#else // HAVE_NEON
|
||||
vpx_convolve_copy_neon, vpx_convolve_avg_neon, vpx_convolve8_horiz_neon,
|
||||
vpx_convolve8_avg_horiz_neon, vpx_convolve8_vert_neon,
|
||||
vpx_convolve8_avg_vert_neon, vpx_convolve8_neon, vpx_convolve8_avg_neon,
|
||||
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);
|
||||
#else // HAVE_NEON
|
||||
const ConvolveFunctions convolve8_neon(
|
||||
vpx_convolve_copy_neon, vpx_convolve_avg_neon,
|
||||
vpx_convolve8_horiz_neon, vpx_convolve8_avg_horiz_neon,
|
||||
vpx_convolve8_vert_neon, vpx_convolve8_avg_vert_neon,
|
||||
vpx_convolve8_neon, vpx_convolve8_avg_neon,
|
||||
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_convolve_copy_neon, vpx_convolve_avg_neon, vpx_convolve8_horiz_neon,
|
||||
vpx_convolve8_avg_horiz_neon, vpx_convolve8_vert_neon,
|
||||
vpx_convolve8_avg_vert_neon, vpx_convolve8_neon, vpx_convolve8_avg_neon,
|
||||
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);
|
||||
#endif // HAVE_NEON_ASM
|
||||
|
||||
const ConvolveParam kArrayConvolve8_neon[] = { ALL_SIZES(convolve8_neon) };
|
||||
@ -1191,13 +1097,11 @@ INSTANTIATE_TEST_CASE_P(NEON, ConvolveTest,
|
||||
|
||||
#if HAVE_DSPR2
|
||||
const ConvolveFunctions convolve8_dspr2(
|
||||
vpx_convolve_copy_dspr2, vpx_convolve_avg_dspr2,
|
||||
vpx_convolve8_horiz_dspr2, vpx_convolve8_avg_horiz_dspr2,
|
||||
vpx_convolve8_vert_dspr2, vpx_convolve8_avg_vert_dspr2,
|
||||
vpx_convolve8_dspr2, vpx_convolve8_avg_dspr2,
|
||||
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_convolve_copy_dspr2, vpx_convolve_avg_dspr2, vpx_convolve8_horiz_dspr2,
|
||||
vpx_convolve8_avg_horiz_dspr2, vpx_convolve8_vert_dspr2,
|
||||
vpx_convolve8_avg_vert_dspr2, vpx_convolve8_dspr2, vpx_convolve8_avg_dspr2,
|
||||
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);
|
||||
|
||||
const ConvolveParam kArrayConvolve8_dspr2[] = { ALL_SIZES(convolve8_dspr2) };
|
||||
INSTANTIATE_TEST_CASE_P(DSPR2, ConvolveTest,
|
||||
@ -1206,13 +1110,11 @@ INSTANTIATE_TEST_CASE_P(DSPR2, ConvolveTest,
|
||||
|
||||
#if HAVE_MSA
|
||||
const ConvolveFunctions convolve8_msa(
|
||||
vpx_convolve_copy_msa, vpx_convolve_avg_msa,
|
||||
vpx_convolve8_horiz_msa, vpx_convolve8_avg_horiz_msa,
|
||||
vpx_convolve8_vert_msa, vpx_convolve8_avg_vert_msa,
|
||||
vpx_convolve8_msa, vpx_convolve8_avg_msa,
|
||||
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_convolve_copy_msa, vpx_convolve_avg_msa, vpx_convolve8_horiz_msa,
|
||||
vpx_convolve8_avg_horiz_msa, vpx_convolve8_vert_msa,
|
||||
vpx_convolve8_avg_vert_msa, vpx_convolve8_msa, vpx_convolve8_avg_msa,
|
||||
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);
|
||||
|
||||
const ConvolveParam kArrayConvolve8_msa[] = { ALL_SIZES(convolve8_msa) };
|
||||
INSTANTIATE_TEST_CASE_P(MSA, ConvolveTest,
|
||||
|
@ -23,10 +23,8 @@ class CpuSpeedTest
|
||||
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
|
||||
protected:
|
||||
CpuSpeedTest()
|
||||
: EncoderTest(GET_PARAM(0)),
|
||||
encoding_mode_(GET_PARAM(1)),
|
||||
set_cpu_used_(GET_PARAM(2)),
|
||||
min_psnr_(kMaxPSNR),
|
||||
: EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)),
|
||||
set_cpu_used_(GET_PARAM(2)), min_psnr_(kMaxPSNR),
|
||||
tune_content_(VP9E_CONTENT_DEFAULT) {}
|
||||
virtual ~CpuSpeedTest() {}
|
||||
|
||||
@ -42,9 +40,7 @@ class CpuSpeedTest
|
||||
}
|
||||
}
|
||||
|
||||
virtual void BeginPassHook(unsigned int /*pass*/) {
|
||||
min_psnr_ = kMaxPSNR;
|
||||
}
|
||||
virtual void BeginPassHook(unsigned int /*pass*/) { min_psnr_ = kMaxPSNR; }
|
||||
|
||||
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) {
|
||||
@ -61,8 +57,7 @@ class CpuSpeedTest
|
||||
}
|
||||
|
||||
virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
if (pkt->data.psnr.psnr[0] < min_psnr_)
|
||||
min_psnr_ = pkt->data.psnr.psnr[0];
|
||||
if (pkt->data.psnr.psnr[0] < min_psnr_) min_psnr_ = pkt->data.psnr.psnr[0];
|
||||
}
|
||||
|
||||
::libvpx_test::TestMode encoding_mode_;
|
||||
@ -153,9 +148,9 @@ TEST_P(CpuSpeedTest, TestLowBitrate) {
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(
|
||||
CpuSpeedTest,
|
||||
::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood,
|
||||
::libvpx_test::kRealTime),
|
||||
::testing::Range(0, 9));
|
||||
VP9_INSTANTIATE_TEST_CASE(CpuSpeedTest,
|
||||
::testing::Values(::libvpx_test::kTwoPassGood,
|
||||
::libvpx_test::kOnePassGood,
|
||||
::libvpx_test::kRealTime),
|
||||
::testing::Range(0, 9));
|
||||
} // namespace
|
||||
|
@ -24,14 +24,12 @@ const int kCQLevelStep = 8;
|
||||
const unsigned int kCQTargetBitrate = 2000;
|
||||
|
||||
class CQTest : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<int> {
|
||||
public ::libvpx_test::CodecTestWithParam<int> {
|
||||
public:
|
||||
// maps the cqlevel to the bitrate produced.
|
||||
typedef std::map<int, uint32_t> BitrateMap;
|
||||
|
||||
static void SetUpTestCase() {
|
||||
bitrates_.clear();
|
||||
}
|
||||
static void SetUpTestCase() { bitrates_.clear(); }
|
||||
|
||||
static void TearDownTestCase() {
|
||||
ASSERT_TRUE(!HasFailure())
|
||||
@ -128,7 +126,6 @@ TEST_P(CQTest, LinearPSNRIsHigherForCQLevel) {
|
||||
EXPECT_GE(cq_psnr_lin, vbr_psnr_lin);
|
||||
}
|
||||
|
||||
VP8_INSTANTIATE_TEST_CASE(CQTest,
|
||||
::testing::Range(kCQLevelMin, kCQLevelMax,
|
||||
kCQLevelStep));
|
||||
VP8_INSTANTIATE_TEST_CASE(CQTest, ::testing::Range(kCQLevelMin, kCQLevelMax,
|
||||
kCQLevelStep));
|
||||
} // namespace
|
||||
|
@ -18,8 +18,9 @@
|
||||
|
||||
namespace {
|
||||
|
||||
class DatarateTestLarge : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
class DatarateTestLarge
|
||||
: public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
public:
|
||||
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.
|
||||
// For now the codec assumes buffer starts at starting buffer rate
|
||||
// plus one frame's time.
|
||||
if (last_pts_ == 0)
|
||||
duration = 1;
|
||||
if (last_pts_ == 0) duration = 1;
|
||||
|
||||
// Add to the buffer the bits we'd expect from a constant bitrate server.
|
||||
bits_in_buffer_model_ += static_cast<int64_t>(
|
||||
@ -83,11 +83,11 @@ class DatarateTestLarge : public ::libvpx_test::EncoderTest,
|
||||
* 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
|
||||
* apply to key frames. For now exclude key frames in condition below. */
|
||||
const bool key_frame = (pkt->data.frame.flags & VPX_FRAME_IS_KEY)
|
||||
? true: false;
|
||||
const bool key_frame =
|
||||
(pkt->data.frame.flags & VPX_FRAME_IS_KEY) ? true : false;
|
||||
if (!key_frame) {
|
||||
ASSERT_GE(bits_in_buffer_model_, 0) << "Buffer Underrun at frame "
|
||||
<< pkt->data.frame.pts;
|
||||
<< pkt->data.frame.pts;
|
||||
}
|
||||
|
||||
const int64_t frame_size_in_bits = pkt->data.frame.sz * 8;
|
||||
@ -99,8 +99,7 @@ class DatarateTestLarge : public ::libvpx_test::EncoderTest,
|
||||
bits_total_ += frame_size_in_bits;
|
||||
|
||||
// If first drop not set and we have a drop set it to this time.
|
||||
if (!first_drop_ && duration > 1)
|
||||
first_drop_ = last_pts_ + 1;
|
||||
if (!first_drop_ && duration > 1) first_drop_ = last_pts_ + 1;
|
||||
|
||||
// Update the most recent pts.
|
||||
last_pts_ = pkt->data.frame.pts;
|
||||
@ -119,8 +118,8 @@ class DatarateTestLarge : public ::libvpx_test::EncoderTest,
|
||||
duration_ = (last_pts_ + 1) * timebase_;
|
||||
|
||||
// Effective file datarate includes the time spent prebuffering.
|
||||
effective_datarate_ = (bits_total_ - bits_in_last_frame_) / 1000.0
|
||||
/ (cfg_.rc_buf_initial_sz / 1000.0 + duration_);
|
||||
effective_datarate_ = (bits_total_ - bits_in_last_frame_) / 1000.0 /
|
||||
(cfg_.rc_buf_initial_sz / 1000.0 + duration_);
|
||||
|
||||
file_datarate_ = file_size_in_kb / duration_;
|
||||
}
|
||||
@ -256,8 +255,9 @@ TEST_P(DatarateTestLarge, ChangingDropFrameThresh) {
|
||||
}
|
||||
}
|
||||
|
||||
class DatarateTestVP9Large : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
|
||||
class DatarateTestVP9Large
|
||||
: public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
|
||||
public:
|
||||
DatarateTestVP9Large() : EncoderTest(GET_PARAM(0)) {}
|
||||
|
||||
@ -307,8 +307,8 @@ class DatarateTestVP9Large : public ::libvpx_test::EncoderTest,
|
||||
if (num_temp_layers == 2) {
|
||||
if (frame_num % 2 == 0) {
|
||||
// Layer 0: predict from L and ARF, update L.
|
||||
frame_flags = VP8_EFLAG_NO_REF_GF | 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;
|
||||
} else {
|
||||
// Layer 1: predict from L, G and ARF, and update G.
|
||||
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) {
|
||||
if (frame_num % 4 == 0) {
|
||||
// Layer 0: predict from L and ARF; update L.
|
||||
frame_flags = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF |
|
||||
VP8_EFLAG_NO_REF_GF;
|
||||
frame_flags =
|
||||
VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_REF_GF;
|
||||
} else if ((frame_num - 2) % 4 == 0) {
|
||||
// Layer 1: predict from L, G, ARF; update G.
|
||||
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.
|
||||
frame_flags = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF |
|
||||
VP8_EFLAG_NO_UPD_LAST;
|
||||
frame_flags =
|
||||
VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST;
|
||||
}
|
||||
}
|
||||
return frame_flags;
|
||||
@ -353,8 +353,7 @@ class DatarateTestVP9Large : public ::libvpx_test::EncoderTest,
|
||||
|
||||
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) {
|
||||
if (video->frame() == 0)
|
||||
encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
|
||||
if (video->frame() == 0) encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
|
||||
|
||||
if (denoiser_offon_test_) {
|
||||
ASSERT_GT(denoiser_offon_period_, 0)
|
||||
@ -374,8 +373,8 @@ class DatarateTestVP9Large : public ::libvpx_test::EncoderTest,
|
||||
vpx_svc_layer_id_t layer_id;
|
||||
layer_id.spatial_layer_id = 0;
|
||||
frame_flags_ = SetFrameFlags(video->frame(), cfg_.ts_number_layers);
|
||||
layer_id.temporal_layer_id = SetLayerId(video->frame(),
|
||||
cfg_.ts_number_layers);
|
||||
layer_id.temporal_layer_id =
|
||||
SetLayerId(video->frame(), cfg_.ts_number_layers);
|
||||
encoder->Control(VP9E_SET_SVC_LAYER_ID, &layer_id);
|
||||
}
|
||||
const vpx_rational_t tb = video->timebase();
|
||||
@ -383,15 +382,13 @@ class DatarateTestVP9Large : public ::libvpx_test::EncoderTest,
|
||||
duration_ = 0;
|
||||
}
|
||||
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
// Time since last timestamp = duration.
|
||||
vpx_codec_pts_t duration = pkt->data.frame.pts - last_pts_;
|
||||
|
||||
if (duration > 1) {
|
||||
// If first drop not set and we have a drop set it to this time.
|
||||
if (!first_drop_)
|
||||
first_drop_ = last_pts_ + 1;
|
||||
if (!first_drop_) first_drop_ = last_pts_ + 1;
|
||||
// Update the number of frame drops.
|
||||
num_drops_ += static_cast<int>(duration - 1);
|
||||
// Update counter for total number of frames (#frames input to encoder).
|
||||
@ -407,7 +404,7 @@ class DatarateTestVP9Large : public ::libvpx_test::EncoderTest,
|
||||
|
||||
// Buffer should not go negative.
|
||||
ASSERT_GE(bits_in_buffer_model_, 0) << "Buffer Underrun at frame "
|
||||
<< pkt->data.frame.pts;
|
||||
<< pkt->data.frame.pts;
|
||||
|
||||
const size_t frame_size_in_bits = pkt->data.frame.sz * 8;
|
||||
|
||||
@ -425,7 +422,7 @@ class DatarateTestVP9Large : public ::libvpx_test::EncoderTest,
|
||||
|
||||
virtual void EndPassHook(void) {
|
||||
for (int layer = 0; layer < static_cast<int>(cfg_.ts_number_layers);
|
||||
++layer) {
|
||||
++layer) {
|
||||
duration_ = (last_pts_ + 1) * timebase_;
|
||||
if (bits_total_[layer]) {
|
||||
// Effective file datarate:
|
||||
@ -546,7 +543,7 @@ TEST_P(DatarateTestVP9Large, BasicRateTargeting444) {
|
||||
ASSERT_LE(static_cast<double>(cfg_.rc_target_bitrate),
|
||||
effective_datarate_[0] * 1.15)
|
||||
<< " The datarate for the file missed the target!"
|
||||
<< cfg_.rc_target_bitrate << " "<< effective_datarate_;
|
||||
<< cfg_.rc_target_bitrate << " " << effective_datarate_;
|
||||
}
|
||||
}
|
||||
|
||||
@ -616,8 +613,7 @@ TEST_P(DatarateTestVP9Large, BasicRateTargeting2TemporalLayers) {
|
||||
|
||||
cfg_.temporal_layering_mode = VP9E_TEMPORAL_LAYERING_MODE_BYPASS;
|
||||
|
||||
if (deadline_ == VPX_DL_REALTIME)
|
||||
cfg_.g_error_resilient = 1;
|
||||
if (deadline_ == VPX_DL_REALTIME) cfg_.g_error_resilient = 1;
|
||||
|
||||
::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
|
||||
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) {
|
||||
ASSERT_GE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 0.85)
|
||||
<< " 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)
|
||||
<< " 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.
|
||||
ASSERT_GE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 0.75)
|
||||
<< " 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
|
||||
// Adjust the thresholds to be tighter than 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, "
|
||||
"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) {
|
||||
ASSERT_GE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 0.85)
|
||||
<< " 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)
|
||||
<< " 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 at least 10% and not more than 60% drops.
|
||||
ASSERT_GE(num_drops_, 20);
|
||||
@ -792,11 +794,13 @@ TEST_P(DatarateTestVP9Large, DenoiserOffOn) {
|
||||
}
|
||||
#endif // CONFIG_VP9_TEMPORAL_DENOISING
|
||||
|
||||
class DatarateOnePassCbrSvc : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
|
||||
class DatarateOnePassCbrSvc
|
||||
: public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
|
||||
public:
|
||||
DatarateOnePassCbrSvc() : EncoderTest(GET_PARAM(0)) {}
|
||||
virtual ~DatarateOnePassCbrSvc() {}
|
||||
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
InitializeConfig();
|
||||
@ -814,8 +818,7 @@ class DatarateOnePassCbrSvc : public ::libvpx_test::EncoderTest,
|
||||
mismatch_psnr_ = 0.0;
|
||||
mismatch_nframes_ = 0;
|
||||
}
|
||||
virtual void BeginPassHook(unsigned int /*pass*/) {
|
||||
}
|
||||
virtual void BeginPassHook(unsigned int /*pass*/) {}
|
||||
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) {
|
||||
if (video->frame() == 0) {
|
||||
@ -837,21 +840,19 @@ class DatarateOnePassCbrSvc : public ::libvpx_test::EncoderTest,
|
||||
}
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
vpx_codec_pts_t duration = pkt->data.frame.pts - last_pts_;
|
||||
if (last_pts_ == 0)
|
||||
duration = 1;
|
||||
if (last_pts_ == 0) duration = 1;
|
||||
bits_in_buffer_model_ += static_cast<int64_t>(
|
||||
duration * timebase_ * cfg_.rc_target_bitrate * 1000);
|
||||
const bool key_frame = (pkt->data.frame.flags & VPX_FRAME_IS_KEY)
|
||||
? true: false;
|
||||
const bool key_frame =
|
||||
(pkt->data.frame.flags & VPX_FRAME_IS_KEY) ? true : false;
|
||||
if (!key_frame) {
|
||||
ASSERT_GE(bits_in_buffer_model_, 0) << "Buffer Underrun at frame "
|
||||
<< pkt->data.frame.pts;
|
||||
<< pkt->data.frame.pts;
|
||||
}
|
||||
const size_t frame_size_in_bits = pkt->data.frame.sz * 8;
|
||||
bits_in_buffer_model_ -= frame_size_in_bits;
|
||||
bits_total_ += frame_size_in_bits;
|
||||
if (!first_drop_ && duration > 1)
|
||||
first_drop_ = last_pts_ + 1;
|
||||
if (!first_drop_ && duration > 1) first_drop_ = last_pts_ + 1;
|
||||
last_pts_ = pkt->data.frame.pts;
|
||||
bits_in_last_frame_ = frame_size_in_bits;
|
||||
++frame_number_;
|
||||
@ -864,16 +865,13 @@ class DatarateOnePassCbrSvc : public ::libvpx_test::EncoderTest,
|
||||
}
|
||||
}
|
||||
|
||||
virtual void MismatchHook(const vpx_image_t *img1,
|
||||
const vpx_image_t *img2) {
|
||||
virtual void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2) {
|
||||
double mismatch_psnr = compute_psnr(img1, img2);
|
||||
mismatch_psnr_ += mismatch_psnr;
|
||||
++mismatch_nframes_;
|
||||
}
|
||||
|
||||
unsigned int GetMismatchFrames() {
|
||||
return mismatch_nframes_;
|
||||
}
|
||||
unsigned int GetMismatchFrames() { return mismatch_nframes_; }
|
||||
|
||||
vpx_codec_pts_t last_pts_;
|
||||
int64_t bits_in_buffer_model_;
|
||||
@ -890,37 +888,31 @@ class DatarateOnePassCbrSvc : public ::libvpx_test::EncoderTest,
|
||||
int mismatch_nframes_;
|
||||
};
|
||||
static void assign_layer_bitrates(vpx_codec_enc_cfg_t *const enc_cfg,
|
||||
const vpx_svc_extra_cfg_t *svc_params,
|
||||
int spatial_layers,
|
||||
int temporal_layers,
|
||||
int temporal_layering_mode) {
|
||||
const vpx_svc_extra_cfg_t *svc_params,
|
||||
int spatial_layers, int temporal_layers,
|
||||
int temporal_layering_mode) {
|
||||
int sl, spatial_layer_target;
|
||||
float total = 0;
|
||||
float alloc_ratio[VPX_MAX_LAYERS] = {0};
|
||||
float alloc_ratio[VPX_MAX_LAYERS] = { 0 };
|
||||
for (sl = 0; sl < spatial_layers; ++sl) {
|
||||
if (svc_params->scaling_factor_den[sl] > 0) {
|
||||
alloc_ratio[sl] = (float)(svc_params->scaling_factor_num[sl] *
|
||||
1.0 / svc_params->scaling_factor_den[sl]);
|
||||
alloc_ratio[sl] = (float)(svc_params->scaling_factor_num[sl] * 1.0 /
|
||||
svc_params->scaling_factor_den[sl]);
|
||||
total += alloc_ratio[sl];
|
||||
}
|
||||
}
|
||||
for (sl = 0; sl < spatial_layers; ++sl) {
|
||||
enc_cfg->ss_target_bitrate[sl] = spatial_layer_target =
|
||||
(unsigned int)(enc_cfg->rc_target_bitrate *
|
||||
alloc_ratio[sl] / total);
|
||||
(unsigned int)(enc_cfg->rc_target_bitrate * alloc_ratio[sl] / total);
|
||||
const int index = sl * temporal_layers;
|
||||
if (temporal_layering_mode == 3) {
|
||||
enc_cfg->layer_target_bitrate[index] =
|
||||
spatial_layer_target >> 1;
|
||||
enc_cfg->layer_target_bitrate[index] = spatial_layer_target >> 1;
|
||||
enc_cfg->layer_target_bitrate[index + 1] =
|
||||
(spatial_layer_target >> 1) + (spatial_layer_target >> 2);
|
||||
enc_cfg->layer_target_bitrate[index + 2] =
|
||||
spatial_layer_target;
|
||||
enc_cfg->layer_target_bitrate[index + 2] = spatial_layer_target;
|
||||
} else if (temporal_layering_mode == 2) {
|
||||
enc_cfg->layer_target_bitrate[index] =
|
||||
spatial_layer_target * 2 / 3;
|
||||
enc_cfg->layer_target_bitrate[index + 1] =
|
||||
spatial_layer_target;
|
||||
enc_cfg->layer_target_bitrate[index] = spatial_layer_target * 2 / 3;
|
||||
enc_cfg->layer_target_bitrate[index + 1] = spatial_layer_target;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -957,10 +949,10 @@ TEST_P(DatarateOnePassCbrSvc, OnePassCbrSvc2SpatialLayers) {
|
||||
cfg_.rc_target_bitrate = i;
|
||||
ResetModel();
|
||||
assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers,
|
||||
cfg_.ts_number_layers, cfg_.temporal_layering_mode);
|
||||
cfg_.ts_number_layers, cfg_.temporal_layering_mode);
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
ASSERT_GE(cfg_.rc_target_bitrate, file_datarate_ * 0.85)
|
||||
<< " The datarate for the file exceeds the target by too much!";
|
||||
<< " The datarate for the file exceeds the target by too much!";
|
||||
ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.15)
|
||||
<< " The datarate for the file is lower than the target by too much!";
|
||||
EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
|
||||
@ -999,10 +991,10 @@ TEST_P(DatarateOnePassCbrSvc, OnePassCbrSvc2SpatialLayersSmallKf) {
|
||||
cfg_.kf_max_dist = j;
|
||||
ResetModel();
|
||||
assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers,
|
||||
cfg_.ts_number_layers, cfg_.temporal_layering_mode);
|
||||
cfg_.ts_number_layers, cfg_.temporal_layering_mode);
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
ASSERT_GE(cfg_.rc_target_bitrate, file_datarate_ * 0.85)
|
||||
<< " The datarate for the file exceeds the target by too much!";
|
||||
<< " The datarate for the file exceeds the target by too much!";
|
||||
ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.15)
|
||||
<< " The datarate for the file is lower than the target by too much!";
|
||||
EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
|
||||
@ -1033,15 +1025,15 @@ TEST_P(DatarateOnePassCbrSvc, OnePassCbrSvc2SpatialLayers4threads) {
|
||||
svc_params_.scaling_factor_den[1] = 288;
|
||||
cfg_.rc_dropframe_thresh = 10;
|
||||
cfg_.kf_max_dist = 9999;
|
||||
::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720,
|
||||
30, 1, 0, 300);
|
||||
::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720, 30,
|
||||
1, 0, 300);
|
||||
cfg_.rc_target_bitrate = 800;
|
||||
ResetModel();
|
||||
assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers,
|
||||
cfg_.ts_number_layers, cfg_.temporal_layering_mode);
|
||||
cfg_.ts_number_layers, cfg_.temporal_layering_mode);
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
ASSERT_GE(cfg_.rc_target_bitrate, file_datarate_ * 0.85)
|
||||
<< " The datarate for the file exceeds the target by too much!";
|
||||
<< " The datarate for the file exceeds the target by too much!";
|
||||
ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.15)
|
||||
<< " The datarate for the file is lower than the target by too much!";
|
||||
EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
|
||||
@ -1073,15 +1065,15 @@ TEST_P(DatarateOnePassCbrSvc, OnePassCbrSvc3SpatialLayers) {
|
||||
svc_params_.scaling_factor_den[2] = 288;
|
||||
cfg_.rc_dropframe_thresh = 10;
|
||||
cfg_.kf_max_dist = 9999;
|
||||
::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720,
|
||||
30, 1, 0, 300);
|
||||
::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720, 30,
|
||||
1, 0, 300);
|
||||
cfg_.rc_target_bitrate = 800;
|
||||
ResetModel();
|
||||
assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers,
|
||||
cfg_.ts_number_layers, cfg_.temporal_layering_mode);
|
||||
cfg_.ts_number_layers, cfg_.temporal_layering_mode);
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
ASSERT_GE(cfg_.rc_target_bitrate, file_datarate_ * 0.85)
|
||||
<< " The datarate for the file exceeds the target by too much!";
|
||||
<< " The datarate for the file exceeds the target by too much!";
|
||||
ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.22)
|
||||
<< " The datarate for the file is lower than the target by too much!";
|
||||
EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
|
||||
@ -1112,8 +1104,8 @@ TEST_P(DatarateOnePassCbrSvc, OnePassCbrSvc3SpatialLayersSmallKf) {
|
||||
svc_params_.scaling_factor_num[2] = 288;
|
||||
svc_params_.scaling_factor_den[2] = 288;
|
||||
cfg_.rc_dropframe_thresh = 10;
|
||||
::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720,
|
||||
30, 1, 0, 300);
|
||||
::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720, 30,
|
||||
1, 0, 300);
|
||||
cfg_.rc_target_bitrate = 800;
|
||||
// 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).
|
||||
@ -1121,10 +1113,10 @@ TEST_P(DatarateOnePassCbrSvc, OnePassCbrSvc3SpatialLayersSmallKf) {
|
||||
cfg_.kf_max_dist = j;
|
||||
ResetModel();
|
||||
assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers,
|
||||
cfg_.ts_number_layers, cfg_.temporal_layering_mode);
|
||||
cfg_.ts_number_layers, cfg_.temporal_layering_mode);
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
ASSERT_GE(cfg_.rc_target_bitrate, file_datarate_ * 0.85)
|
||||
<< " The datarate for the file exceeds the target by too much!";
|
||||
<< " The datarate for the file exceeds the target by too much!";
|
||||
ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.30)
|
||||
<< " The datarate for the file is lower than the target by too much!";
|
||||
EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
|
||||
@ -1157,15 +1149,15 @@ TEST_P(DatarateOnePassCbrSvc, OnePassCbrSvc3SpatialLayers4threads) {
|
||||
svc_params_.scaling_factor_den[2] = 288;
|
||||
cfg_.rc_dropframe_thresh = 10;
|
||||
cfg_.kf_max_dist = 9999;
|
||||
::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720,
|
||||
30, 1, 0, 300);
|
||||
::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720, 30,
|
||||
1, 0, 300);
|
||||
cfg_.rc_target_bitrate = 800;
|
||||
ResetModel();
|
||||
assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers,
|
||||
cfg_.ts_number_layers, cfg_.temporal_layering_mode);
|
||||
cfg_.ts_number_layers, cfg_.temporal_layering_mode);
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
ASSERT_GE(cfg_.rc_target_bitrate, file_datarate_ * 0.85)
|
||||
<< " The datarate for the file exceeds the target by too much!";
|
||||
<< " The datarate for the file exceeds the target by too much!";
|
||||
ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.22)
|
||||
<< " The datarate for the file is lower than the target by too much!";
|
||||
EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
|
||||
|
@ -54,16 +54,16 @@ void butterfly_16x16_dct_1d(double input[16], double output[16]) {
|
||||
double temp1, temp2;
|
||||
|
||||
// step 1
|
||||
step[ 0] = input[0] + input[15];
|
||||
step[ 1] = input[1] + input[14];
|
||||
step[ 2] = input[2] + input[13];
|
||||
step[ 3] = input[3] + input[12];
|
||||
step[ 4] = input[4] + input[11];
|
||||
step[ 5] = input[5] + input[10];
|
||||
step[ 6] = input[6] + input[ 9];
|
||||
step[ 7] = input[7] + input[ 8];
|
||||
step[ 8] = input[7] - input[ 8];
|
||||
step[ 9] = input[6] - input[ 9];
|
||||
step[0] = input[0] + input[15];
|
||||
step[1] = input[1] + input[14];
|
||||
step[2] = input[2] + input[13];
|
||||
step[3] = input[3] + input[12];
|
||||
step[4] = input[4] + input[11];
|
||||
step[5] = input[5] + input[10];
|
||||
step[6] = input[6] + input[9];
|
||||
step[7] = input[7] + input[8];
|
||||
step[8] = input[7] - input[8];
|
||||
step[9] = input[6] - input[9];
|
||||
step[10] = input[5] - input[10];
|
||||
step[11] = input[4] - input[11];
|
||||
step[12] = input[3] - input[12];
|
||||
@ -81,13 +81,13 @@ void butterfly_16x16_dct_1d(double input[16], double output[16]) {
|
||||
output[6] = step[1] - step[6];
|
||||
output[7] = step[0] - step[7];
|
||||
|
||||
temp1 = step[ 8] * C7;
|
||||
temp1 = step[8] * C7;
|
||||
temp2 = step[15] * C9;
|
||||
output[ 8] = temp1 + temp2;
|
||||
output[8] = temp1 + temp2;
|
||||
|
||||
temp1 = step[ 9] * C11;
|
||||
temp1 = step[9] * C11;
|
||||
temp2 = step[14] * C5;
|
||||
output[ 9] = temp1 - temp2;
|
||||
output[9] = temp1 - temp2;
|
||||
|
||||
temp1 = step[10] * C3;
|
||||
temp2 = step[13] * C13;
|
||||
@ -105,40 +105,40 @@ void butterfly_16x16_dct_1d(double input[16], double output[16]) {
|
||||
temp2 = step[13] * C3;
|
||||
output[13] = temp2 - temp1;
|
||||
|
||||
temp1 = step[ 9] * C5;
|
||||
temp1 = step[9] * C5;
|
||||
temp2 = step[14] * C11;
|
||||
output[14] = temp2 + temp1;
|
||||
|
||||
temp1 = step[ 8] * C9;
|
||||
temp1 = step[8] * C9;
|
||||
temp2 = step[15] * C7;
|
||||
output[15] = temp2 - temp1;
|
||||
|
||||
// step 3
|
||||
step[ 0] = output[0] + output[3];
|
||||
step[ 1] = output[1] + output[2];
|
||||
step[ 2] = output[1] - output[2];
|
||||
step[ 3] = output[0] - output[3];
|
||||
step[0] = output[0] + output[3];
|
||||
step[1] = output[1] + output[2];
|
||||
step[2] = output[1] - output[2];
|
||||
step[3] = output[0] - output[3];
|
||||
|
||||
temp1 = output[4] * C14;
|
||||
temp2 = output[7] * C2;
|
||||
step[ 4] = temp1 + temp2;
|
||||
step[4] = temp1 + temp2;
|
||||
|
||||
temp1 = output[5] * C10;
|
||||
temp2 = output[6] * C6;
|
||||
step[ 5] = temp1 + temp2;
|
||||
step[5] = temp1 + temp2;
|
||||
|
||||
temp1 = output[5] * C6;
|
||||
temp2 = output[6] * C10;
|
||||
step[ 6] = temp2 - temp1;
|
||||
step[6] = temp2 - temp1;
|
||||
|
||||
temp1 = output[4] * C2;
|
||||
temp2 = output[7] * C14;
|
||||
step[ 7] = temp2 - temp1;
|
||||
step[7] = temp2 - temp1;
|
||||
|
||||
step[ 8] = output[ 8] + output[11];
|
||||
step[ 9] = output[ 9] + output[10];
|
||||
step[10] = output[ 9] - output[10];
|
||||
step[11] = output[ 8] - output[11];
|
||||
step[8] = output[8] + output[11];
|
||||
step[9] = output[9] + output[10];
|
||||
step[10] = output[9] - output[10];
|
||||
step[11] = output[8] - output[11];
|
||||
|
||||
step[12] = output[12] + output[15];
|
||||
step[13] = output[13] + output[14];
|
||||
@ -146,25 +146,25 @@ void butterfly_16x16_dct_1d(double input[16], double output[16]) {
|
||||
step[15] = output[12] - output[15];
|
||||
|
||||
// step 4
|
||||
output[ 0] = (step[ 0] + step[ 1]);
|
||||
output[ 8] = (step[ 0] - step[ 1]);
|
||||
output[0] = (step[0] + step[1]);
|
||||
output[8] = (step[0] - step[1]);
|
||||
|
||||
temp1 = step[2] * C12;
|
||||
temp2 = step[3] * C4;
|
||||
temp1 = temp1 + temp2;
|
||||
output[ 4] = 2*(temp1 * C8);
|
||||
output[4] = 2 * (temp1 * C8);
|
||||
|
||||
temp1 = step[2] * C4;
|
||||
temp2 = step[3] * C12;
|
||||
temp1 = temp2 - temp1;
|
||||
output[12] = 2 * (temp1 * C8);
|
||||
|
||||
output[ 2] = 2 * ((step[4] + step[ 5]) * C8);
|
||||
output[14] = 2 * ((step[7] - step[ 6]) * C8);
|
||||
output[2] = 2 * ((step[4] + step[5]) * C8);
|
||||
output[14] = 2 * ((step[7] - step[6]) * C8);
|
||||
|
||||
temp1 = step[4] - step[5];
|
||||
temp2 = step[6] + step[7];
|
||||
output[ 6] = (temp1 + temp2);
|
||||
output[6] = (temp1 + temp2);
|
||||
output[10] = (temp1 - temp2);
|
||||
|
||||
intermediate[8] = step[8] + step[14];
|
||||
@ -180,18 +180,18 @@ void butterfly_16x16_dct_1d(double input[16], double output[16]) {
|
||||
temp1 = temp2 + temp1;
|
||||
output[13] = 2 * (temp1 * C8);
|
||||
|
||||
output[ 9] = 2 * ((step[10] + step[11]) * C8);
|
||||
output[9] = 2 * ((step[10] + step[11]) * C8);
|
||||
|
||||
intermediate[11] = step[10] - step[11];
|
||||
intermediate[12] = step[12] + step[13];
|
||||
intermediate[13] = step[12] - step[13];
|
||||
intermediate[14] = step[ 8] - step[14];
|
||||
intermediate[15] = step[ 9] - step[15];
|
||||
intermediate[14] = step[8] - step[14];
|
||||
intermediate[15] = step[9] - step[15];
|
||||
|
||||
output[15] = (intermediate[11] + intermediate[12]);
|
||||
output[ 1] = -(intermediate[11] - intermediate[12]);
|
||||
output[1] = -(intermediate[11] - intermediate[12]);
|
||||
|
||||
output[ 7] = 2 * (intermediate[13] * C8);
|
||||
output[7] = 2 * (intermediate[13] * C8);
|
||||
|
||||
temp1 = intermediate[14] * C12;
|
||||
temp2 = intermediate[15] * C4;
|
||||
@ -201,28 +201,24 @@ void butterfly_16x16_dct_1d(double input[16], double output[16]) {
|
||||
temp1 = intermediate[14] * C4;
|
||||
temp2 = intermediate[15] * C12;
|
||||
temp1 = temp2 + temp1;
|
||||
output[ 5] = 2 * (temp1 * C8);
|
||||
output[5] = 2 * (temp1 * C8);
|
||||
}
|
||||
|
||||
void reference_16x16_dct_2d(int16_t input[256], double output[256]) {
|
||||
// First transform columns
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
double temp_in[16], temp_out[16];
|
||||
for (int j = 0; j < 16; ++j)
|
||||
temp_in[j] = input[j * 16 + i];
|
||||
for (int j = 0; j < 16; ++j) temp_in[j] = input[j * 16 + i];
|
||||
butterfly_16x16_dct_1d(temp_in, temp_out);
|
||||
for (int j = 0; j < 16; ++j)
|
||||
output[j * 16 + i] = temp_out[j];
|
||||
for (int j = 0; j < 16; ++j) output[j * 16 + i] = temp_out[j];
|
||||
}
|
||||
// Then transform rows
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
double temp_in[16], temp_out[16];
|
||||
for (int j = 0; j < 16; ++j)
|
||||
temp_in[j] = output[j + i * 16];
|
||||
for (int j = 0; j < 16; ++j) temp_in[j] = output[j + i * 16];
|
||||
butterfly_16x16_dct_1d(temp_in, temp_out);
|
||||
// Scale by some magic number
|
||||
for (int j = 0; j < 16; ++j)
|
||||
output[j + i * 16] = temp_out[j]/2;
|
||||
for (int j = 0; j < 16; ++j) 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);
|
||||
}
|
||||
|
||||
void fht16x16_ref(const int16_t *in, tran_low_t *out, int stride,
|
||||
int tx_type) {
|
||||
void fht16x16_ref(const int16_t *in, tran_low_t *out, int stride, int 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_));
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
RunFwdTxfm(test_input_block, test_temp_block, pitch_));
|
||||
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
|
||||
} else {
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
@ -366,18 +360,17 @@ class Trans16x16TestBase {
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
const int32_t diff =
|
||||
bit_depth_ == VPX_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
|
||||
bit_depth_ == VPX_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
|
||||
#else
|
||||
const int32_t diff = dst[j] - src[j];
|
||||
#endif
|
||||
const uint32_t error = diff * diff;
|
||||
if (max_error < error)
|
||||
max_error = error;
|
||||
if (max_error < error) max_error = error;
|
||||
total_error += error;
|
||||
}
|
||||
}
|
||||
|
||||
EXPECT_GE(1u << 2 * (bit_depth_ - 8), max_error)
|
||||
EXPECT_GE(1u << 2 * (bit_depth_ - 8), max_error)
|
||||
<< "Error: 16x16 FHT/IHT has an individual round trip error > 1";
|
||||
|
||||
EXPECT_GE(count_test_block << 2 * (bit_depth_ - 8), total_error)
|
||||
@ -418,16 +411,14 @@ class Trans16x16TestBase {
|
||||
input_extreme_block[j] = rnd.Rand8() % 2 ? mask_ : -mask_;
|
||||
}
|
||||
if (i == 0) {
|
||||
for (int j = 0; j < kNumCoeffs; ++j)
|
||||
input_extreme_block[j] = mask_;
|
||||
for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = mask_;
|
||||
} else if (i == 1) {
|
||||
for (int j = 0; j < kNumCoeffs; ++j)
|
||||
input_extreme_block[j] = -mask_;
|
||||
for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = -mask_;
|
||||
}
|
||||
|
||||
fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_);
|
||||
ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_extreme_block,
|
||||
output_block, pitch_));
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
RunFwdTxfm(input_extreme_block, output_block, pitch_));
|
||||
|
||||
// The minimum quant value is 4.
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
@ -457,11 +448,9 @@ class Trans16x16TestBase {
|
||||
input_extreme_block[j] = rnd.Rand8() % 2 ? mask_ : -mask_;
|
||||
}
|
||||
if (i == 0)
|
||||
for (int j = 0; j < kNumCoeffs; ++j)
|
||||
input_extreme_block[j] = mask_;
|
||||
for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = mask_;
|
||||
if (i == 1)
|
||||
for (int j = 0; j < kNumCoeffs; ++j)
|
||||
input_extreme_block[j] = -mask_;
|
||||
for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = -mask_;
|
||||
|
||||
fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_);
|
||||
|
||||
@ -484,17 +473,15 @@ class Trans16x16TestBase {
|
||||
} else {
|
||||
inv_txfm_ref(output_ref_block, CONVERT_TO_BYTEPTR(ref16), pitch_,
|
||||
tx_type_);
|
||||
ASM_REGISTER_STATE_CHECK(RunInvTxfm(output_ref_block,
|
||||
CONVERT_TO_BYTEPTR(dst16), pitch_));
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
RunInvTxfm(output_ref_block, CONVERT_TO_BYTEPTR(dst16), pitch_));
|
||||
#endif
|
||||
}
|
||||
if (bit_depth_ == VPX_BITS_8) {
|
||||
for (int j = 0; j < kNumCoeffs; ++j)
|
||||
EXPECT_EQ(ref[j], dst[j]);
|
||||
for (int j = 0; j < kNumCoeffs; ++j) EXPECT_EQ(ref[j], dst[j]);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
} else {
|
||||
for (int j = 0; j < kNumCoeffs; ++j)
|
||||
EXPECT_EQ(ref16[j], dst16[j]);
|
||||
for (int j = 0; j < kNumCoeffs; ++j) EXPECT_EQ(ref16[j], dst16[j]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -538,8 +525,8 @@ class Trans16x16TestBase {
|
||||
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, 16));
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
} else {
|
||||
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16),
|
||||
16));
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), 16));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
}
|
||||
|
||||
@ -551,9 +538,8 @@ class Trans16x16TestBase {
|
||||
const uint32_t diff = dst[j] - src[j];
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
const uint32_t error = diff * diff;
|
||||
EXPECT_GE(1u, error)
|
||||
<< "Error: 16x16 IDCT has error " << error
|
||||
<< " at index " << j;
|
||||
EXPECT_GE(1u, error) << "Error: 16x16 IDCT has error " << error
|
||||
<< " at index " << j;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -595,8 +581,8 @@ class Trans16x16TestBase {
|
||||
} else {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
ref_txfm(coeff, CONVERT_TO_BYTEPTR(ref16), pitch_);
|
||||
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16),
|
||||
pitch_));
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
}
|
||||
|
||||
@ -608,9 +594,8 @@ class Trans16x16TestBase {
|
||||
const uint32_t diff = dst[j] - ref[j];
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
const uint32_t error = diff * diff;
|
||||
EXPECT_EQ(0u, error)
|
||||
<< "Error: 16x16 IDCT Comparison has error " << error
|
||||
<< " at index " << j;
|
||||
EXPECT_EQ(0u, error) << "Error: 16x16 IDCT Comparison has error "
|
||||
<< error << " at index " << j;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -623,32 +608,25 @@ class Trans16x16TestBase {
|
||||
IhtFunc inv_txfm_ref;
|
||||
};
|
||||
|
||||
class Trans16x16DCT
|
||||
: public Trans16x16TestBase,
|
||||
public ::testing::TestWithParam<Dct16x16Param> {
|
||||
class Trans16x16DCT : public Trans16x16TestBase,
|
||||
public ::testing::TestWithParam<Dct16x16Param> {
|
||||
public:
|
||||
virtual ~Trans16x16DCT() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
fwd_txfm_ = GET_PARAM(0);
|
||||
inv_txfm_ = GET_PARAM(1);
|
||||
tx_type_ = GET_PARAM(2);
|
||||
tx_type_ = GET_PARAM(2);
|
||||
bit_depth_ = GET_PARAM(3);
|
||||
pitch_ = 16;
|
||||
pitch_ = 16;
|
||||
fwd_txfm_ref = fdct16x16_ref;
|
||||
inv_txfm_ref = idct16x16_ref;
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
switch (bit_depth_) {
|
||||
case VPX_BITS_10:
|
||||
inv_txfm_ref = idct16x16_10_ref;
|
||||
break;
|
||||
case VPX_BITS_12:
|
||||
inv_txfm_ref = idct16x16_12_ref;
|
||||
break;
|
||||
default:
|
||||
inv_txfm_ref = idct16x16_ref;
|
||||
break;
|
||||
case VPX_BITS_10: inv_txfm_ref = idct16x16_10_ref; break;
|
||||
case VPX_BITS_12: inv_txfm_ref = idct16x16_12_ref; break;
|
||||
default: inv_txfm_ref = idct16x16_ref; break;
|
||||
}
|
||||
#else
|
||||
inv_txfm_ref = idct16x16_ref;
|
||||
@ -668,17 +646,11 @@ class Trans16x16DCT
|
||||
IdctFunc inv_txfm_;
|
||||
};
|
||||
|
||||
TEST_P(Trans16x16DCT, AccuracyCheck) {
|
||||
RunAccuracyCheck();
|
||||
}
|
||||
TEST_P(Trans16x16DCT, AccuracyCheck) { RunAccuracyCheck(); }
|
||||
|
||||
TEST_P(Trans16x16DCT, CoeffCheck) {
|
||||
RunCoeffCheck();
|
||||
}
|
||||
TEST_P(Trans16x16DCT, CoeffCheck) { RunCoeffCheck(); }
|
||||
|
||||
TEST_P(Trans16x16DCT, MemCheck) {
|
||||
RunMemCheck();
|
||||
}
|
||||
TEST_P(Trans16x16DCT, MemCheck) { RunMemCheck(); }
|
||||
|
||||
TEST_P(Trans16x16DCT, QuantCheck) {
|
||||
// Use maximally allowed quantization step sizes for DC and AC
|
||||
@ -686,36 +658,27 @@ TEST_P(Trans16x16DCT, QuantCheck) {
|
||||
RunQuantCheck(1336, 1828);
|
||||
}
|
||||
|
||||
TEST_P(Trans16x16DCT, InvAccuracyCheck) {
|
||||
RunInvAccuracyCheck();
|
||||
}
|
||||
TEST_P(Trans16x16DCT, InvAccuracyCheck) { RunInvAccuracyCheck(); }
|
||||
|
||||
class Trans16x16HT
|
||||
: public Trans16x16TestBase,
|
||||
public ::testing::TestWithParam<Ht16x16Param> {
|
||||
class Trans16x16HT : public Trans16x16TestBase,
|
||||
public ::testing::TestWithParam<Ht16x16Param> {
|
||||
public:
|
||||
virtual ~Trans16x16HT() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
fwd_txfm_ = GET_PARAM(0);
|
||||
inv_txfm_ = GET_PARAM(1);
|
||||
tx_type_ = GET_PARAM(2);
|
||||
tx_type_ = GET_PARAM(2);
|
||||
bit_depth_ = GET_PARAM(3);
|
||||
pitch_ = 16;
|
||||
pitch_ = 16;
|
||||
fwd_txfm_ref = fht16x16_ref;
|
||||
inv_txfm_ref = iht16x16_ref;
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
switch (bit_depth_) {
|
||||
case VPX_BITS_10:
|
||||
inv_txfm_ref = iht16x16_10;
|
||||
break;
|
||||
case VPX_BITS_12:
|
||||
inv_txfm_ref = iht16x16_12;
|
||||
break;
|
||||
default:
|
||||
inv_txfm_ref = iht16x16_ref;
|
||||
break;
|
||||
case VPX_BITS_10: inv_txfm_ref = iht16x16_10; break;
|
||||
case VPX_BITS_12: inv_txfm_ref = iht16x16_12; break;
|
||||
default: inv_txfm_ref = iht16x16_ref; break;
|
||||
}
|
||||
#else
|
||||
inv_txfm_ref = iht16x16_ref;
|
||||
@ -735,17 +698,11 @@ class Trans16x16HT
|
||||
IhtFunc inv_txfm_;
|
||||
};
|
||||
|
||||
TEST_P(Trans16x16HT, AccuracyCheck) {
|
||||
RunAccuracyCheck();
|
||||
}
|
||||
TEST_P(Trans16x16HT, AccuracyCheck) { RunAccuracyCheck(); }
|
||||
|
||||
TEST_P(Trans16x16HT, CoeffCheck) {
|
||||
RunCoeffCheck();
|
||||
}
|
||||
TEST_P(Trans16x16HT, CoeffCheck) { RunCoeffCheck(); }
|
||||
|
||||
TEST_P(Trans16x16HT, MemCheck) {
|
||||
RunMemCheck();
|
||||
}
|
||||
TEST_P(Trans16x16HT, MemCheck) { RunMemCheck(); }
|
||||
|
||||
TEST_P(Trans16x16HT, QuantCheck) {
|
||||
// The encoder skips any non-DC intra prediction modes,
|
||||
@ -753,9 +710,8 @@ TEST_P(Trans16x16HT, QuantCheck) {
|
||||
RunQuantCheck(429, 729);
|
||||
}
|
||||
|
||||
class InvTrans16x16DCT
|
||||
: public Trans16x16TestBase,
|
||||
public ::testing::TestWithParam<Idct16x16Param> {
|
||||
class InvTrans16x16DCT : public Trans16x16TestBase,
|
||||
public ::testing::TestWithParam<Idct16x16Param> {
|
||||
public:
|
||||
virtual ~InvTrans16x16DCT() {}
|
||||
|
||||
@ -766,7 +722,7 @@ class InvTrans16x16DCT
|
||||
bit_depth_ = GET_PARAM(3);
|
||||
pitch_ = 16;
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
}
|
||||
}
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
@ -784,9 +740,8 @@ TEST_P(InvTrans16x16DCT, CompareReference) {
|
||||
CompareInvReference(ref_txfm_, thresh_);
|
||||
}
|
||||
|
||||
class PartialTrans16x16Test
|
||||
: public ::testing::TestWithParam<
|
||||
std::tr1::tuple<FdctFunc, vpx_bit_depth_t> > {
|
||||
class PartialTrans16x16Test : public ::testing::TestWithParam<
|
||||
std::tr1::tuple<FdctFunc, vpx_bit_depth_t> > {
|
||||
public:
|
||||
virtual ~PartialTrans16x16Test() {}
|
||||
virtual void SetUp() {
|
||||
@ -855,10 +810,10 @@ INSTANTIATE_TEST_CASE_P(
|
||||
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)));
|
||||
#else
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, Trans16x16DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c, 0, VPX_BITS_8)));
|
||||
INSTANTIATE_TEST_CASE_P(C, Trans16x16DCT,
|
||||
::testing::Values(make_tuple(&vpx_fdct16x16_c,
|
||||
&vpx_idct16x16_256_add_c,
|
||||
0, VPX_BITS_8)));
|
||||
#endif // 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
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, Trans16x16DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct16x16_c,
|
||||
&vpx_idct16x16_256_add_neon, 0, VPX_BITS_8)));
|
||||
::testing::Values(make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_neon,
|
||||
0, VPX_BITS_8)));
|
||||
#endif
|
||||
|
||||
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Trans16x16DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct16x16_sse2,
|
||||
&vpx_idct16x16_256_add_sse2, 0, VPX_BITS_8)));
|
||||
::testing::Values(make_tuple(&vpx_fdct16x16_sse2,
|
||||
&vpx_idct16x16_256_add_sse2, 0, VPX_BITS_8)));
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Trans16x16HT,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 0,
|
||||
VPX_BITS_8),
|
||||
make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 1,
|
||||
VPX_BITS_8),
|
||||
make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 2,
|
||||
VPX_BITS_8),
|
||||
make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 3,
|
||||
VPX_BITS_8)));
|
||||
::testing::Values(make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2,
|
||||
0, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2,
|
||||
1, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2,
|
||||
2, VPX_BITS_8),
|
||||
make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2,
|
||||
3, VPX_BITS_8)));
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, PartialTrans16x16Test,
|
||||
::testing::Values(make_tuple(&vpx_fdct16x16_1_sse2,
|
||||
VPX_BITS_8)));
|
||||
@ -929,16 +881,14 @@ INSTANTIATE_TEST_CASE_P(SSE2, PartialTrans16x16Test,
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Trans16x16DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_highbd_fdct16x16_sse2,
|
||||
&idct16x16_10, 0, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_fdct16x16_c,
|
||||
&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_c,
|
||||
&idct16x16_256_add_12_sse2, 0, VPX_BITS_12),
|
||||
make_tuple(&vpx_fdct16x16_sse2,
|
||||
&vpx_idct16x16_256_add_c, 0, VPX_BITS_8)));
|
||||
make_tuple(&vpx_highbd_fdct16x16_sse2, &idct16x16_10, 0, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_fdct16x16_c, &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_c, &idct16x16_256_add_12_sse2, 0,
|
||||
VPX_BITS_12),
|
||||
make_tuple(&vpx_fdct16x16_sse2, &vpx_idct16x16_256_add_c, 0,
|
||||
VPX_BITS_8)));
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Trans16x16HT,
|
||||
::testing::Values(
|
||||
@ -951,26 +901,24 @@ INSTANTIATE_TEST_CASE_P(
|
||||
// that to test both branches.
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, InvTrans16x16DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&idct16x16_10_add_10_c,
|
||||
&idct16x16_10_add_10_sse2, 3167, VPX_BITS_10),
|
||||
make_tuple(&idct16x16_10,
|
||||
&idct16x16_256_add_10_sse2, 3167, VPX_BITS_10),
|
||||
make_tuple(&idct16x16_10_add_12_c,
|
||||
&idct16x16_10_add_12_sse2, 3167, VPX_BITS_12),
|
||||
make_tuple(&idct16x16_12,
|
||||
&idct16x16_256_add_12_sse2, 3167, VPX_BITS_12)));
|
||||
::testing::Values(make_tuple(&idct16x16_10_add_10_c,
|
||||
&idct16x16_10_add_10_sse2, 3167, VPX_BITS_10),
|
||||
make_tuple(&idct16x16_10, &idct16x16_256_add_10_sse2,
|
||||
3167, VPX_BITS_10),
|
||||
make_tuple(&idct16x16_10_add_12_c,
|
||||
&idct16x16_10_add_12_sse2, 3167, VPX_BITS_12),
|
||||
make_tuple(&idct16x16_12, &idct16x16_256_add_12_sse2,
|
||||
3167, VPX_BITS_12)));
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, PartialTrans16x16Test,
|
||||
::testing::Values(make_tuple(&vpx_fdct16x16_1_sse2,
|
||||
VPX_BITS_8)));
|
||||
#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, Trans16x16DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct16x16_msa,
|
||||
&vpx_idct16x16_256_add_msa, 0, VPX_BITS_8)));
|
||||
INSTANTIATE_TEST_CASE_P(MSA, Trans16x16DCT,
|
||||
::testing::Values(make_tuple(&vpx_fdct16x16_msa,
|
||||
&vpx_idct16x16_256_add_msa,
|
||||
0, VPX_BITS_8)));
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, Trans16x16HT,
|
||||
::testing::Values(
|
||||
|
@ -39,8 +39,7 @@ void reference_32x32_dct_1d(const double in[32], double out[32]) {
|
||||
out[k] = 0.0;
|
||||
for (int n = 0; n < 32; n++)
|
||||
out[k] += in[n] * cos(kPi * (2 * n + 1) * k / 64.0);
|
||||
if (k == 0)
|
||||
out[k] = out[k] * kInvSqrt2;
|
||||
if (k == 0) out[k] = out[k] * kInvSqrt2;
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,21 +48,17 @@ void reference_32x32_dct_2d(const int16_t input[kNumCoeffs],
|
||||
// First transform columns
|
||||
for (int i = 0; i < 32; ++i) {
|
||||
double temp_in[32], temp_out[32];
|
||||
for (int j = 0; j < 32; ++j)
|
||||
temp_in[j] = input[j*32 + i];
|
||||
for (int j = 0; j < 32; ++j) temp_in[j] = input[j * 32 + i];
|
||||
reference_32x32_dct_1d(temp_in, temp_out);
|
||||
for (int j = 0; j < 32; ++j)
|
||||
output[j * 32 + i] = temp_out[j];
|
||||
for (int j = 0; j < 32; ++j) output[j * 32 + i] = temp_out[j];
|
||||
}
|
||||
// Then transform rows
|
||||
for (int i = 0; i < 32; ++i) {
|
||||
double temp_in[32], temp_out[32];
|
||||
for (int j = 0; j < 32; ++j)
|
||||
temp_in[j] = output[j + i*32];
|
||||
for (int j = 0; j < 32; ++j) temp_in[j] = output[j + i * 32];
|
||||
reference_32x32_dct_1d(temp_in, temp_out);
|
||||
// Scale by some magic number
|
||||
for (int j = 0; j < 32; ++j)
|
||||
output[j + i * 32] = temp_out[j] / 4;
|
||||
for (int j = 0; j < 32; ++j) output[j + i * 32] = temp_out[j] / 4;
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,8 +84,8 @@ class Trans32x32Test : public ::testing::TestWithParam<Trans32x32Param> {
|
||||
virtual void SetUp() {
|
||||
fwd_txfm_ = GET_PARAM(0);
|
||||
inv_txfm_ = GET_PARAM(1);
|
||||
version_ = GET_PARAM(2); // 0: high precision forward transform
|
||||
// 1: low precision version for rd loop
|
||||
version_ = GET_PARAM(2); // 0: high precision forward transform
|
||||
// 1: low precision version for rd loop
|
||||
bit_depth_ = GET_PARAM(3);
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
}
|
||||
@ -140,8 +135,8 @@ TEST_P(Trans32x32Test, AccuracyCheck) {
|
||||
ASM_REGISTER_STATE_CHECK(inv_txfm_(test_temp_block, dst, 32));
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
} else {
|
||||
ASM_REGISTER_STATE_CHECK(inv_txfm_(test_temp_block,
|
||||
CONVERT_TO_BYTEPTR(dst16), 32));
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
inv_txfm_(test_temp_block, CONVERT_TO_BYTEPTR(dst16), 32));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -153,8 +148,7 @@ TEST_P(Trans32x32Test, AccuracyCheck) {
|
||||
const int32_t diff = dst[j] - src[j];
|
||||
#endif
|
||||
const uint32_t error = diff * diff;
|
||||
if (max_error < error)
|
||||
max_error = error;
|
||||
if (max_error < error) max_error = error;
|
||||
total_error += error;
|
||||
}
|
||||
}
|
||||
@ -213,11 +207,9 @@ TEST_P(Trans32x32Test, MemCheck) {
|
||||
input_extreme_block[j] = rnd.Rand8() & 1 ? mask_ : -mask_;
|
||||
}
|
||||
if (i == 0) {
|
||||
for (int j = 0; j < kNumCoeffs; ++j)
|
||||
input_extreme_block[j] = mask_;
|
||||
for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = mask_;
|
||||
} else if (i == 1) {
|
||||
for (int j = 0; j < kNumCoeffs; ++j)
|
||||
input_extreme_block[j] = -mask_;
|
||||
for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = -mask_;
|
||||
}
|
||||
|
||||
const int stride = 32;
|
||||
@ -291,9 +283,8 @@ TEST_P(Trans32x32Test, InverseAccuracy) {
|
||||
const int diff = dst[j] - src[j];
|
||||
#endif
|
||||
const int error = diff * diff;
|
||||
EXPECT_GE(1, error)
|
||||
<< "Error: 32x32 IDCT has error " << error
|
||||
<< " at index " << j;
|
||||
EXPECT_GE(1, error) << "Error: 32x32 IDCT has error " << error
|
||||
<< " at index " << j;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -365,18 +356,13 @@ using std::tr1::make_tuple;
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, Trans32x32Test,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_highbd_fdct32x32_c,
|
||||
&idct32x32_10, 0, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_fdct32x32_rd_c,
|
||||
&idct32x32_10, 1, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_fdct32x32_c,
|
||||
&idct32x32_12, 0, VPX_BITS_12),
|
||||
make_tuple(&vpx_highbd_fdct32x32_rd_c,
|
||||
&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)));
|
||||
make_tuple(&vpx_highbd_fdct32x32_c, &idct32x32_10, 0, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_fdct32x32_rd_c, &idct32x32_10, 1, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_fdct32x32_c, &idct32x32_12, 0, VPX_BITS_12),
|
||||
make_tuple(&vpx_highbd_fdct32x32_rd_c, &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(
|
||||
C, PartialTrans32x32Test,
|
||||
::testing::Values(make_tuple(&vpx_highbd_fdct32x32_1_c, VPX_BITS_8),
|
||||
@ -385,11 +371,10 @@ INSTANTIATE_TEST_CASE_P(
|
||||
#else
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, Trans32x32Test,
|
||||
::testing::Values(
|
||||
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)));
|
||||
::testing::Values(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(C, PartialTrans32x32Test,
|
||||
::testing::Values(make_tuple(&vpx_fdct32x32_1_c,
|
||||
VPX_BITS_8)));
|
||||
@ -398,21 +383,19 @@ INSTANTIATE_TEST_CASE_P(C, PartialTrans32x32Test,
|
||||
#if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, Trans32x32Test,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct32x32_c,
|
||||
&vpx_idct32x32_1024_add_neon, 0, VPX_BITS_8),
|
||||
make_tuple(&vpx_fdct32x32_rd_c,
|
||||
&vpx_idct32x32_1024_add_neon, 1, VPX_BITS_8)));
|
||||
::testing::Values(make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_neon,
|
||||
0, VPX_BITS_8),
|
||||
make_tuple(&vpx_fdct32x32_rd_c,
|
||||
&vpx_idct32x32_1024_add_neon, 1, VPX_BITS_8)));
|
||||
#endif // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Trans32x32Test,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct32x32_sse2,
|
||||
&vpx_idct32x32_1024_add_sse2, 0, VPX_BITS_8),
|
||||
make_tuple(&vpx_fdct32x32_rd_sse2,
|
||||
&vpx_idct32x32_1024_add_sse2, 1, VPX_BITS_8)));
|
||||
::testing::Values(make_tuple(&vpx_fdct32x32_sse2,
|
||||
&vpx_idct32x32_1024_add_sse2, 0, VPX_BITS_8),
|
||||
make_tuple(&vpx_fdct32x32_rd_sse2,
|
||||
&vpx_idct32x32_1024_add_sse2, 1, VPX_BITS_8)));
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, PartialTrans32x32Test,
|
||||
::testing::Values(make_tuple(&vpx_fdct32x32_1_sse2,
|
||||
VPX_BITS_8)));
|
||||
@ -440,21 +423,19 @@ INSTANTIATE_TEST_CASE_P(SSE2, PartialTrans32x32Test,
|
||||
#if HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
AVX2, Trans32x32Test,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct32x32_avx2,
|
||||
&vpx_idct32x32_1024_add_sse2, 0, VPX_BITS_8),
|
||||
make_tuple(&vpx_fdct32x32_rd_avx2,
|
||||
&vpx_idct32x32_1024_add_sse2, 1, VPX_BITS_8)));
|
||||
::testing::Values(make_tuple(&vpx_fdct32x32_avx2,
|
||||
&vpx_idct32x32_1024_add_sse2, 0, VPX_BITS_8),
|
||||
make_tuple(&vpx_fdct32x32_rd_avx2,
|
||||
&vpx_idct32x32_1024_add_sse2, 1, VPX_BITS_8)));
|
||||
#endif // HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, Trans32x32Test,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct32x32_msa,
|
||||
&vpx_idct32x32_1024_add_msa, 0, VPX_BITS_8),
|
||||
make_tuple(&vpx_fdct32x32_rd_msa,
|
||||
&vpx_idct32x32_1024_add_msa, 1, VPX_BITS_8)));
|
||||
::testing::Values(make_tuple(&vpx_fdct32x32_msa,
|
||||
&vpx_idct32x32_1024_add_msa, 0, VPX_BITS_8),
|
||||
make_tuple(&vpx_fdct32x32_rd_msa,
|
||||
&vpx_idct32x32_1024_add_msa, 1, VPX_BITS_8)));
|
||||
INSTANTIATE_TEST_CASE_P(MSA, PartialTrans32x32Test,
|
||||
::testing::Values(make_tuple(&vpx_fdct32x32_1_msa,
|
||||
VPX_BITS_8)));
|
||||
|
@ -28,7 +28,7 @@ TEST(DecodeAPI, InvalidParams) {
|
||||
&vpx_codec_vp9_dx_algo,
|
||||
#endif
|
||||
};
|
||||
uint8_t buf[1] = {0};
|
||||
uint8_t buf[1] = { 0 };
|
||||
vpx_codec_ctx_t dec;
|
||||
|
||||
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_dec_init(NULL, NULL, NULL, 0));
|
||||
@ -51,8 +51,7 @@ TEST(DecodeAPI, InvalidParams) {
|
||||
vpx_codec_decode(&dec, buf, NELEMENTS(buf), NULL, 0));
|
||||
EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
|
||||
vpx_codec_decode(&dec, NULL, NELEMENTS(buf), NULL, 0));
|
||||
EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
|
||||
vpx_codec_decode(&dec, buf, 0, NULL, 0));
|
||||
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_decode(&dec, buf, 0, NULL, 0));
|
||||
|
||||
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
|
||||
// misbehave.
|
||||
void TestVp9Controls(vpx_codec_ctx_t *dec) {
|
||||
static const int kControls[] = {
|
||||
VP8D_GET_LAST_REF_UPDATES,
|
||||
VP8D_GET_FRAME_CORRUPTED,
|
||||
VP9D_GET_DISPLAY_SIZE,
|
||||
VP9D_GET_FRAME_SIZE
|
||||
};
|
||||
static const int kControls[] = { VP8D_GET_LAST_REF_UPDATES,
|
||||
VP8D_GET_FRAME_CORRUPTED,
|
||||
VP9D_GET_DISPLAY_SIZE, VP9D_GET_FRAME_SIZE };
|
||||
int val[2];
|
||||
|
||||
for (int i = 0; i < NELEMENTS(kControls); ++i) {
|
||||
@ -91,9 +87,7 @@ void TestVp9Controls(vpx_codec_ctx_t *dec) {
|
||||
case VP8D_GET_FRAME_CORRUPTED:
|
||||
EXPECT_EQ(VPX_CODEC_ERROR, res) << kControls[i];
|
||||
break;
|
||||
default:
|
||||
EXPECT_EQ(VPX_CODEC_OK, res) << kControls[i];
|
||||
break;
|
||||
default: EXPECT_EQ(VPX_CODEC_OK, res) << kControls[i]; break;
|
||||
}
|
||||
EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
|
||||
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
|
||||
// should return VPX_CODEC_CORRUPT_FRAME.
|
||||
const uint8_t data[32] = {
|
||||
0x85, 0xa4, 0xc1, 0xa1, 0x38, 0x81, 0xa3, 0x49,
|
||||
0x83, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0x85, 0xa4, 0xc1, 0xa1, 0x38, 0x81, 0xa3, 0x49, 0x83, 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) {
|
||||
@ -162,9 +155,9 @@ TEST(DecodeAPI, Vp9PeekSI) {
|
||||
if (data_sz >= 8) {
|
||||
vpx_codec_ctx_t dec;
|
||||
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_dec_init(&dec, codec, NULL, 0));
|
||||
EXPECT_EQ((data_sz < 10) ?
|
||||
VPX_CODEC_UNSUP_BITSTREAM : VPX_CODEC_CORRUPT_FRAME,
|
||||
vpx_codec_decode(&dec, data, data_sz, NULL, 0));
|
||||
EXPECT_EQ(
|
||||
(data_sz < 10) ? VPX_CODEC_UNSUP_BITSTREAM : VPX_CODEC_CORRUPT_FRAME,
|
||||
vpx_codec_decode(&dec, data, data_sz, NULL, 0));
|
||||
vpx_codec_iter_t iter = NULL;
|
||||
EXPECT_EQ(NULL, vpx_codec_get_frame(&dec, &iter));
|
||||
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec));
|
||||
|
@ -70,8 +70,7 @@ const DecodePerfParam kVP9DecodePerfVectors[] = {
|
||||
power/temp/min max frame decode times/etc
|
||||
*/
|
||||
|
||||
class DecodePerfTest : public ::testing::TestWithParam<DecodePerfParam> {
|
||||
};
|
||||
class DecodePerfTest : public ::testing::TestWithParam<DecodePerfParam> {};
|
||||
|
||||
TEST_P(DecodePerfTest, PerfTest) {
|
||||
const char *const video_name = GET_PARAM(VIDEO_NAME);
|
||||
@ -92,8 +91,7 @@ TEST_P(DecodePerfTest, PerfTest) {
|
||||
}
|
||||
|
||||
vpx_usec_timer_mark(&t);
|
||||
const double elapsed_secs = double(vpx_usec_timer_elapsed(&t))
|
||||
/ kUsecsInSec;
|
||||
const double elapsed_secs = double(vpx_usec_timer_elapsed(&t)) / kUsecsInSec;
|
||||
const unsigned frames = video.frame_number();
|
||||
const double fps = double(frames) / elapsed_secs;
|
||||
|
||||
@ -111,17 +109,13 @@ TEST_P(DecodePerfTest, PerfTest) {
|
||||
INSTANTIATE_TEST_CASE_P(VP9, DecodePerfTest,
|
||||
::testing::ValuesIn(kVP9DecodePerfVectors));
|
||||
|
||||
class VP9NewEncodeDecodePerfTest :
|
||||
public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
class VP9NewEncodeDecodePerfTest
|
||||
: public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
protected:
|
||||
VP9NewEncodeDecodePerfTest()
|
||||
: EncoderTest(GET_PARAM(0)),
|
||||
encoding_mode_(GET_PARAM(1)),
|
||||
speed_(0),
|
||||
outfile_(0),
|
||||
out_frames_(0) {
|
||||
}
|
||||
: EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)), speed_(0),
|
||||
outfile_(0), out_frames_(0) {}
|
||||
|
||||
virtual ~VP9NewEncodeDecodePerfTest() {}
|
||||
|
||||
@ -182,9 +176,7 @@ class VP9NewEncodeDecodePerfTest :
|
||||
|
||||
virtual bool DoDecode() { return false; }
|
||||
|
||||
void set_speed(unsigned int speed) {
|
||||
speed_ = speed;
|
||||
}
|
||||
void set_speed(unsigned int speed) { speed_ = speed; }
|
||||
|
||||
private:
|
||||
libvpx_test::TestMode encoding_mode_;
|
||||
@ -196,10 +188,7 @@ class VP9NewEncodeDecodePerfTest :
|
||||
struct EncodePerfTestVideo {
|
||||
EncodePerfTestVideo(const char *name_, uint32_t width_, uint32_t height_,
|
||||
uint32_t bitrate_, int frames_)
|
||||
: name(name_),
|
||||
width(width_),
|
||||
height(height_),
|
||||
bitrate(bitrate_),
|
||||
: name(name_), width(width_), height(height_), bitrate(bitrate_),
|
||||
frames(frames_) {}
|
||||
const char *name;
|
||||
uint32_t width;
|
||||
@ -225,10 +214,8 @@ TEST_P(VP9NewEncodeDecodePerfTest, PerfTest) {
|
||||
|
||||
const char *video_name = kVP9EncodePerfTestVectors[i].name;
|
||||
libvpx_test::I420VideoSource video(
|
||||
video_name,
|
||||
kVP9EncodePerfTestVectors[i].width,
|
||||
kVP9EncodePerfTestVectors[i].height,
|
||||
timebase.den, timebase.num, 0,
|
||||
video_name, kVP9EncodePerfTestVectors[i].width,
|
||||
kVP9EncodePerfTestVectors[i].height, timebase.den, timebase.num, 0,
|
||||
kVP9EncodePerfTestVectors[i].frames);
|
||||
set_speed(2);
|
||||
|
||||
@ -268,6 +255,6 @@ TEST_P(VP9NewEncodeDecodePerfTest, PerfTest) {
|
||||
printf("}\n");
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(
|
||||
VP9NewEncodeDecodePerfTest, ::testing::Values(::libvpx_test::kTwoPassGood));
|
||||
VP9_INSTANTIATE_TEST_CASE(VP9NewEncodeDecodePerfTest,
|
||||
::testing::Values(::libvpx_test::kTwoPassGood));
|
||||
} // namespace
|
||||
|
@ -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_stream_info_t *stream_info) {
|
||||
return vpx_codec_peek_stream_info(CodecInterface(),
|
||||
cxdata, static_cast<unsigned int>(size),
|
||||
stream_info);
|
||||
return vpx_codec_peek_stream_info(
|
||||
CodecInterface(), cxdata, static_cast<unsigned int>(size), stream_info);
|
||||
}
|
||||
|
||||
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;
|
||||
InitOnce();
|
||||
API_REGISTER_STATE_CHECK(
|
||||
res_dec = vpx_codec_decode(&decoder_,
|
||||
cxdata, static_cast<unsigned int>(size),
|
||||
user_priv, 0));
|
||||
res_dec = vpx_codec_decode(
|
||||
&decoder_, cxdata, static_cast<unsigned int>(size), user_priv, 0));
|
||||
return res_dec;
|
||||
}
|
||||
|
||||
@ -67,7 +65,7 @@ void DecoderTest::HandlePeekResult(Decoder *const decoder,
|
||||
|
||||
void DecoderTest::RunLoop(CompressedVideoSource *video,
|
||||
const vpx_codec_dec_cfg_t &dec_cfg) {
|
||||
Decoder* const decoder = codec_->CreateDecoder(dec_cfg, flags_, 0);
|
||||
Decoder *const decoder = codec_->CreateDecoder(dec_cfg, flags_, 0);
|
||||
ASSERT_TRUE(decoder != NULL);
|
||||
bool end_of_file = false;
|
||||
|
||||
@ -80,16 +78,14 @@ void DecoderTest::RunLoop(CompressedVideoSource *video,
|
||||
stream_info.sz = sizeof(stream_info);
|
||||
|
||||
if (video->cxdata() != NULL) {
|
||||
const vpx_codec_err_t res_peek = decoder->PeekStream(video->cxdata(),
|
||||
video->frame_size(),
|
||||
&stream_info);
|
||||
const vpx_codec_err_t res_peek = decoder->PeekStream(
|
||||
video->cxdata(), video->frame_size(), &stream_info);
|
||||
HandlePeekResult(decoder, video, res_peek);
|
||||
ASSERT_FALSE(::testing::Test::HasFailure());
|
||||
|
||||
vpx_codec_err_t res_dec = decoder->DecodeFrame(video->cxdata(),
|
||||
video->frame_size());
|
||||
if (!HandleDecodeResult(res_dec, *video, decoder))
|
||||
break;
|
||||
vpx_codec_err_t res_dec =
|
||||
decoder->DecodeFrame(video->cxdata(), video->frame_size());
|
||||
if (!HandleDecodeResult(res_dec, *video, decoder)) break;
|
||||
} else {
|
||||
// Signal end of the file to the decoder.
|
||||
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_));
|
||||
}
|
||||
|
||||
void DecoderTest::set_flags(const vpx_codec_flags_t flags) {
|
||||
flags_ = flags;
|
||||
}
|
||||
void DecoderTest::set_flags(const vpx_codec_flags_t flags) { flags_ = flags; }
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
@ -26,13 +26,11 @@ class DxDataIterator {
|
||||
explicit DxDataIterator(vpx_codec_ctx_t *decoder)
|
||||
: decoder_(decoder), iter_(NULL) {}
|
||||
|
||||
const vpx_image_t *Next() {
|
||||
return vpx_codec_get_frame(decoder_, &iter_);
|
||||
}
|
||||
const vpx_image_t *Next() { return vpx_codec_get_frame(decoder_, &iter_); }
|
||||
|
||||
private:
|
||||
vpx_codec_ctx_t *decoder_;
|
||||
vpx_codec_iter_t iter_;
|
||||
vpx_codec_ctx_t *decoder_;
|
||||
vpx_codec_iter_t iter_;
|
||||
};
|
||||
|
||||
// Provides a simplified interface to manage one video decoding.
|
||||
@ -47,13 +45,14 @@ class Decoder {
|
||||
|
||||
Decoder(vpx_codec_dec_cfg_t cfg, const vpx_codec_flags_t flag,
|
||||
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_));
|
||||
}
|
||||
|
||||
virtual ~Decoder() {
|
||||
vpx_codec_destroy(&decoder_);
|
||||
}
|
||||
virtual ~Decoder() { vpx_codec_destroy(&decoder_); }
|
||||
|
||||
vpx_codec_err_t PeekStream(const uint8_t *cxdata, size_t size,
|
||||
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,
|
||||
void *user_priv);
|
||||
|
||||
DxDataIterator GetDxData() {
|
||||
return DxDataIterator(&decoder_);
|
||||
}
|
||||
DxDataIterator GetDxData() { return DxDataIterator(&decoder_); }
|
||||
|
||||
void set_deadline(unsigned long deadline) {
|
||||
deadline_ = deadline;
|
||||
}
|
||||
void set_deadline(unsigned long deadline) { deadline_ = deadline; }
|
||||
|
||||
void Control(int ctrl_id, int arg) {
|
||||
Control(ctrl_id, arg, VPX_CODEC_OK);
|
||||
}
|
||||
void Control(int ctrl_id, int arg) { Control(ctrl_id, arg, VPX_CODEC_OK); }
|
||||
|
||||
void Control(int ctrl_id, const void *arg) {
|
||||
InitOnce();
|
||||
@ -87,7 +80,7 @@ class Decoder {
|
||||
ASSERT_EQ(expected_value, res) << DecodeError();
|
||||
}
|
||||
|
||||
const char* DecodeError() {
|
||||
const char *DecodeError() {
|
||||
const char *detail = vpx_codec_error_detail(&decoder_);
|
||||
return detail ? detail : vpx_codec_error(&decoder_);
|
||||
}
|
||||
@ -97,38 +90,35 @@ class Decoder {
|
||||
vpx_get_frame_buffer_cb_fn_t cb_get,
|
||||
vpx_release_frame_buffer_cb_fn_t cb_release, void *user_priv) {
|
||||
InitOnce();
|
||||
return vpx_codec_set_frame_buffer_functions(
|
||||
&decoder_, cb_get, cb_release, user_priv);
|
||||
return vpx_codec_set_frame_buffer_functions(&decoder_, cb_get, cb_release,
|
||||
user_priv);
|
||||
}
|
||||
|
||||
const char* GetDecoderName() const {
|
||||
const char *GetDecoderName() const {
|
||||
return vpx_codec_iface_name(CodecInterface());
|
||||
}
|
||||
|
||||
bool IsVP8() const;
|
||||
|
||||
vpx_codec_ctx_t * GetDecoder() {
|
||||
return &decoder_;
|
||||
}
|
||||
vpx_codec_ctx_t *GetDecoder() { return &decoder_; }
|
||||
|
||||
protected:
|
||||
virtual vpx_codec_iface_t* CodecInterface() const = 0;
|
||||
virtual vpx_codec_iface_t *CodecInterface() const = 0;
|
||||
|
||||
void InitOnce() {
|
||||
if (!init_done_) {
|
||||
const vpx_codec_err_t res = vpx_codec_dec_init(&decoder_,
|
||||
CodecInterface(),
|
||||
&cfg_, flags_);
|
||||
const vpx_codec_err_t res =
|
||||
vpx_codec_dec_init(&decoder_, CodecInterface(), &cfg_, flags_);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError();
|
||||
init_done_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
vpx_codec_ctx_t decoder_;
|
||||
vpx_codec_ctx_t decoder_;
|
||||
vpx_codec_dec_cfg_t cfg_;
|
||||
vpx_codec_flags_t flags_;
|
||||
unsigned int deadline_;
|
||||
bool init_done_;
|
||||
vpx_codec_flags_t flags_;
|
||||
unsigned int deadline_;
|
||||
bool init_done_;
|
||||
};
|
||||
|
||||
// Common test functionality for all Decoder tests.
|
||||
@ -143,37 +133,35 @@ class DecoderTest {
|
||||
virtual void set_flags(const vpx_codec_flags_t flags);
|
||||
|
||||
// Hook to be called before decompressing every frame.
|
||||
virtual void PreDecodeFrameHook(const CompressedVideoSource& /*video*/,
|
||||
Decoder* /*decoder*/) {}
|
||||
virtual void PreDecodeFrameHook(const CompressedVideoSource & /*video*/,
|
||||
Decoder * /*decoder*/) {}
|
||||
|
||||
// Hook to be called to handle decode result. Return true to continue.
|
||||
virtual bool HandleDecodeResult(const vpx_codec_err_t res_dec,
|
||||
const CompressedVideoSource& /*video*/,
|
||||
const CompressedVideoSource & /*video*/,
|
||||
Decoder *decoder) {
|
||||
EXPECT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError();
|
||||
return VPX_CODEC_OK == res_dec;
|
||||
}
|
||||
|
||||
// Hook to be called on every decompressed frame.
|
||||
virtual void DecompressedFrameHook(const vpx_image_t& /*img*/,
|
||||
virtual void DecompressedFrameHook(const vpx_image_t & /*img*/,
|
||||
const unsigned int /*frame_number*/) {}
|
||||
|
||||
// Hook to be called on peek result
|
||||
virtual void HandlePeekResult(Decoder* const decoder,
|
||||
virtual void HandlePeekResult(Decoder *const decoder,
|
||||
CompressedVideoSource *video,
|
||||
const vpx_codec_err_t res_peek);
|
||||
|
||||
protected:
|
||||
explicit DecoderTest(const CodecFactory *codec)
|
||||
: codec_(codec),
|
||||
cfg_(),
|
||||
flags_(0) {}
|
||||
: codec_(codec), cfg_(), flags_(0) {}
|
||||
|
||||
virtual ~DecoderTest() {}
|
||||
|
||||
const CodecFactory *codec_;
|
||||
vpx_codec_dec_cfg_t cfg_;
|
||||
vpx_codec_flags_t flags_;
|
||||
vpx_codec_flags_t flags_;
|
||||
};
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
@ -27,7 +27,7 @@ TEST(EncodeAPI, InvalidParams) {
|
||||
&vpx_codec_vp9_cx_algo,
|
||||
#endif
|
||||
};
|
||||
uint8_t buf[1] = {0};
|
||||
uint8_t buf[1] = { 0 };
|
||||
vpx_image_t img;
|
||||
vpx_codec_ctx_t enc;
|
||||
vpx_codec_enc_cfg_t cfg;
|
||||
|
@ -26,10 +26,7 @@ const double kUsecsInSec = 1000000.0;
|
||||
struct EncodePerfTestVideo {
|
||||
EncodePerfTestVideo(const char *name_, uint32_t width_, uint32_t height_,
|
||||
uint32_t bitrate_, int frames_)
|
||||
: name(name_),
|
||||
width(width_),
|
||||
height(height_),
|
||||
bitrate(bitrate_),
|
||||
: name(name_), width(width_), height(height_), bitrate(bitrate_),
|
||||
frames(frames_) {}
|
||||
const char *name;
|
||||
uint32_t width;
|
||||
@ -45,8 +42,8 @@ const EncodePerfTestVideo kVP9EncodePerfTestVectors[] = {
|
||||
EncodePerfTestVideo("macmarcostationary_640_480_30.yuv", 640, 480, 200, 718),
|
||||
EncodePerfTestVideo("niklas_640_480_30.yuv", 640, 480, 200, 471),
|
||||
EncodePerfTestVideo("tacomanarrows_640_480_30.yuv", 640, 480, 200, 300),
|
||||
EncodePerfTestVideo("tacomasmallcameramovement_640_480_30.yuv",
|
||||
640, 480, 200, 300),
|
||||
EncodePerfTestVideo("tacomasmallcameramovement_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),
|
||||
};
|
||||
@ -61,12 +58,8 @@ class VP9EncodePerfTest
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
protected:
|
||||
VP9EncodePerfTest()
|
||||
: EncoderTest(GET_PARAM(0)),
|
||||
min_psnr_(kMaxPsnr),
|
||||
nframes_(0),
|
||||
encoding_mode_(GET_PARAM(1)),
|
||||
speed_(0),
|
||||
threads_(1) {}
|
||||
: EncoderTest(GET_PARAM(0)), min_psnr_(kMaxPsnr), nframes_(0),
|
||||
encoding_mode_(GET_PARAM(1)), speed_(0), threads_(1) {}
|
||||
|
||||
virtual ~VP9EncodePerfTest() {}
|
||||
|
||||
@ -107,24 +100,18 @@ class VP9EncodePerfTest
|
||||
|
||||
virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
if (pkt->data.psnr.psnr[0] < min_psnr_) {
|
||||
min_psnr_= pkt->data.psnr.psnr[0];
|
||||
min_psnr_ = pkt->data.psnr.psnr[0];
|
||||
}
|
||||
}
|
||||
|
||||
// for performance reasons don't decode
|
||||
virtual bool DoDecode() { return 0; }
|
||||
|
||||
double min_psnr() const {
|
||||
return min_psnr_;
|
||||
}
|
||||
double min_psnr() const { return min_psnr_; }
|
||||
|
||||
void set_speed(unsigned int speed) {
|
||||
speed_ = speed;
|
||||
}
|
||||
void set_speed(unsigned int speed) { speed_ = speed; }
|
||||
|
||||
void set_threads(unsigned int threads) {
|
||||
threads_ = threads;
|
||||
}
|
||||
void set_threads(unsigned int threads) { threads_ = threads; }
|
||||
|
||||
private:
|
||||
double min_psnr_;
|
||||
@ -157,10 +144,8 @@ TEST_P(VP9EncodePerfTest, PerfTest) {
|
||||
const unsigned frames = kVP9EncodePerfTestVectors[i].frames;
|
||||
const char *video_name = kVP9EncodePerfTestVectors[i].name;
|
||||
libvpx_test::I420VideoSource video(
|
||||
video_name,
|
||||
kVP9EncodePerfTestVectors[i].width,
|
||||
kVP9EncodePerfTestVectors[i].height,
|
||||
timebase.den, timebase.num, 0,
|
||||
video_name, kVP9EncodePerfTestVectors[i].width,
|
||||
kVP9EncodePerfTestVectors[i].height, timebase.den, timebase.num, 0,
|
||||
kVP9EncodePerfTestVectors[i].frames);
|
||||
set_speed(kEncodePerfTestSpeeds[j]);
|
||||
|
||||
@ -197,6 +182,6 @@ TEST_P(VP9EncodePerfTest, PerfTest) {
|
||||
}
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(
|
||||
VP9EncodePerfTest, ::testing::Values(::libvpx_test::kRealTime));
|
||||
VP9_INSTANTIATE_TEST_CASE(VP9EncodePerfTest,
|
||||
::testing::Values(::libvpx_test::kRealTime));
|
||||
} // namespace
|
||||
|
@ -30,8 +30,7 @@ void Encoder::InitEncoder(VideoSource *video) {
|
||||
cfg_.g_timebase = video->timebase();
|
||||
cfg_.rc_twopass_stats_in = stats_->buf();
|
||||
|
||||
res = vpx_codec_enc_init(&encoder_, CodecInterface(), &cfg_,
|
||||
init_flags_);
|
||||
res = vpx_codec_enc_init(&encoder_, CodecInterface(), &cfg_, init_flags_);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
|
||||
|
||||
#if CONFIG_VP9_ENCODER
|
||||
@ -62,8 +61,7 @@ void Encoder::EncodeFrame(VideoSource *video, const unsigned long frame_flags) {
|
||||
CxDataIterator iter = GetCxData();
|
||||
|
||||
while (const vpx_codec_cx_pkt_t *pkt = iter.Next()) {
|
||||
if (pkt->kind != VPX_CODEC_STATS_PKT)
|
||||
continue;
|
||||
if (pkt->kind != VPX_CODEC_STATS_PKT) continue;
|
||||
|
||||
stats_->Append(*pkt);
|
||||
}
|
||||
@ -83,15 +81,15 @@ void Encoder::EncodeFrameInternal(const VideoSource &video,
|
||||
}
|
||||
|
||||
// Encode the frame
|
||||
API_REGISTER_STATE_CHECK(
|
||||
res = vpx_codec_encode(&encoder_, img, video.pts(), video.duration(),
|
||||
frame_flags, deadline_));
|
||||
API_REGISTER_STATE_CHECK(res = vpx_codec_encode(&encoder_, img, video.pts(),
|
||||
video.duration(), frame_flags,
|
||||
deadline_));
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
|
||||
}
|
||||
|
||||
void Encoder::Flush() {
|
||||
const vpx_codec_err_t res = vpx_codec_encode(&encoder_, NULL, 0, 0, 0,
|
||||
deadline_);
|
||||
const vpx_codec_err_t res =
|
||||
vpx_codec_encode(&encoder_, NULL, 0, 0, 0, deadline_);
|
||||
if (!encoder_.priv)
|
||||
ASSERT_EQ(VPX_CODEC_ERROR, res) << EncoderError();
|
||||
else
|
||||
@ -106,22 +104,15 @@ void EncoderTest::InitializeConfig() {
|
||||
|
||||
void EncoderTest::SetMode(TestMode mode) {
|
||||
switch (mode) {
|
||||
case kRealTime:
|
||||
deadline_ = VPX_DL_REALTIME;
|
||||
break;
|
||||
case kRealTime: deadline_ = VPX_DL_REALTIME; break;
|
||||
|
||||
case kOnePassGood:
|
||||
case kTwoPassGood:
|
||||
deadline_ = VPX_DL_GOOD_QUALITY;
|
||||
break;
|
||||
case kTwoPassGood: deadline_ = VPX_DL_GOOD_QUALITY; break;
|
||||
|
||||
case kOnePassBest:
|
||||
case kTwoPassBest:
|
||||
deadline_ = VPX_DL_BEST_QUALITY;
|
||||
break;
|
||||
case kTwoPassBest: deadline_ = VPX_DL_BEST_QUALITY; break;
|
||||
|
||||
default:
|
||||
ASSERT_TRUE(false) << "Unexpected mode " << mode;
|
||||
default: ASSERT_TRUE(false) << "Unexpected mode " << mode;
|
||||
}
|
||||
|
||||
if (mode == kTwoPassGood || mode == kTwoPassBest)
|
||||
@ -131,35 +122,35 @@ void EncoderTest::SetMode(TestMode mode) {
|
||||
}
|
||||
// The function should return "true" most of the time, therefore no early
|
||||
// break-out is implemented within the match checking process.
|
||||
static bool compare_img(const vpx_image_t *img1,
|
||||
const vpx_image_t *img2) {
|
||||
bool match = (img1->fmt == img2->fmt) &&
|
||||
(img1->cs == img2->cs) &&
|
||||
(img1->d_w == img2->d_w) &&
|
||||
(img1->d_h == img2->d_h);
|
||||
static bool compare_img(const vpx_image_t *img1, const vpx_image_t *img2) {
|
||||
bool match = (img1->fmt == img2->fmt) && (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;
|
||||
unsigned int i;
|
||||
for (i = 0; i < height_y; ++i)
|
||||
match = (memcmp(img1->planes[VPX_PLANE_Y] + i * img1->stride[VPX_PLANE_Y],
|
||||
img2->planes[VPX_PLANE_Y] + i * img2->stride[VPX_PLANE_Y],
|
||||
width_y) == 0) && match;
|
||||
const unsigned int width_uv = (img1->d_w + 1) >> 1;
|
||||
width_y) == 0) &&
|
||||
match;
|
||||
const unsigned int width_uv = (img1->d_w + 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],
|
||||
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)
|
||||
match = (memcmp(img1->planes[VPX_PLANE_V] + i * img1->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;
|
||||
}
|
||||
|
||||
void EncoderTest::MismatchHook(const vpx_image_t* /*img1*/,
|
||||
const vpx_image_t* /*img2*/) {
|
||||
void EncoderTest::MismatchHook(const vpx_image_t * /*img1*/,
|
||||
const vpx_image_t * /*img2*/) {
|
||||
ASSERT_TRUE(0) << "Encode/Decode mismatch found";
|
||||
}
|
||||
|
||||
@ -215,10 +206,9 @@ void EncoderTest::RunLoop(VideoSource *video) {
|
||||
has_cxdata = true;
|
||||
if (decoder.get() != NULL && DoDecode()) {
|
||||
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()))
|
||||
break;
|
||||
if (!HandleDecodeResult(res_dec, *video, decoder.get())) break;
|
||||
|
||||
has_dxdata = true;
|
||||
}
|
||||
@ -227,20 +217,16 @@ void EncoderTest::RunLoop(VideoSource *video) {
|
||||
FramePktHook(pkt);
|
||||
break;
|
||||
|
||||
case VPX_CODEC_PSNR_PKT:
|
||||
PSNRPktHook(pkt);
|
||||
break;
|
||||
case VPX_CODEC_PSNR_PKT: PSNRPktHook(pkt); break;
|
||||
|
||||
default:
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
// Flush the decoder when there are no more fragments.
|
||||
if ((init_flags_ & VPX_CODEC_USE_OUTPUT_PARTITION) && has_dxdata) {
|
||||
const vpx_codec_err_t res_dec = decoder->DecodeFrame(NULL, 0);
|
||||
if (!HandleDecodeResult(res_dec, *video, decoder.get()))
|
||||
break;
|
||||
if (!HandleDecodeResult(res_dec, *video, decoder.get())) break;
|
||||
}
|
||||
|
||||
if (has_dxdata && has_cxdata) {
|
||||
@ -253,17 +239,14 @@ void EncoderTest::RunLoop(VideoSource *video) {
|
||||
MismatchHook(img_enc, img_dec);
|
||||
}
|
||||
}
|
||||
if (img_dec)
|
||||
DecompressedFrameHook(*img_dec, video->pts());
|
||||
if (img_dec) DecompressedFrameHook(*img_dec, video->pts());
|
||||
}
|
||||
if (!Continue())
|
||||
break;
|
||||
if (!Continue()) break;
|
||||
}
|
||||
|
||||
EndPassHook();
|
||||
|
||||
if (!Continue())
|
||||
break;
|
||||
if (!Continue()) break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,19 +33,17 @@ enum TestMode {
|
||||
kTwoPassGood,
|
||||
kTwoPassBest
|
||||
};
|
||||
#define ALL_TEST_MODES ::testing::Values(::libvpx_test::kRealTime, \
|
||||
::libvpx_test::kOnePassGood, \
|
||||
::libvpx_test::kOnePassBest, \
|
||||
::libvpx_test::kTwoPassGood, \
|
||||
::libvpx_test::kTwoPassBest)
|
||||
#define ALL_TEST_MODES \
|
||||
::testing::Values(::libvpx_test::kRealTime, ::libvpx_test::kOnePassGood, \
|
||||
::libvpx_test::kOnePassBest, ::libvpx_test::kTwoPassGood, \
|
||||
::libvpx_test::kTwoPassBest)
|
||||
|
||||
#define ONE_PASS_TEST_MODES ::testing::Values(::libvpx_test::kRealTime, \
|
||||
::libvpx_test::kOnePassGood, \
|
||||
::libvpx_test::kOnePassBest)
|
||||
|
||||
#define TWO_PASS_TEST_MODES ::testing::Values(::libvpx_test::kTwoPassGood, \
|
||||
::libvpx_test::kTwoPassBest)
|
||||
#define ONE_PASS_TEST_MODES \
|
||||
::testing::Values(::libvpx_test::kRealTime, ::libvpx_test::kOnePassGood, \
|
||||
::libvpx_test::kOnePassBest)
|
||||
|
||||
#define TWO_PASS_TEST_MODES \
|
||||
::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kTwoPassBest)
|
||||
|
||||
// Provides an object to handle the libvpx get_cx_data() iteration pattern
|
||||
class CxDataIterator {
|
||||
@ -58,8 +56,8 @@ class CxDataIterator {
|
||||
}
|
||||
|
||||
private:
|
||||
vpx_codec_ctx_t *encoder_;
|
||||
vpx_codec_iter_t iter_;
|
||||
vpx_codec_ctx_t *encoder_;
|
||||
vpx_codec_iter_t iter_;
|
||||
};
|
||||
|
||||
// Implements an in-memory store for libvpx twopass statistics
|
||||
@ -75,15 +73,12 @@ class TwopassStatsStore {
|
||||
return buf;
|
||||
}
|
||||
|
||||
void Reset() {
|
||||
buffer_.clear();
|
||||
}
|
||||
void Reset() { buffer_.clear(); }
|
||||
|
||||
protected:
|
||||
std::string buffer_;
|
||||
std::string buffer_;
|
||||
};
|
||||
|
||||
|
||||
// Provides a simplified interface to manage one video encoding pass, given
|
||||
// a configuration and video source.
|
||||
//
|
||||
@ -97,13 +92,9 @@ class Encoder {
|
||||
memset(&encoder_, 0, sizeof(encoder_));
|
||||
}
|
||||
|
||||
virtual ~Encoder() {
|
||||
vpx_codec_destroy(&encoder_);
|
||||
}
|
||||
virtual ~Encoder() { vpx_codec_destroy(&encoder_); }
|
||||
|
||||
CxDataIterator GetCxData() {
|
||||
return CxDataIterator(&encoder_);
|
||||
}
|
||||
CxDataIterator GetCxData() { return CxDataIterator(&encoder_); }
|
||||
|
||||
void InitEncoder(VideoSource *video);
|
||||
|
||||
@ -115,9 +106,7 @@ class Encoder {
|
||||
void EncodeFrame(VideoSource *video, const unsigned long frame_flags);
|
||||
|
||||
// Convenience wrapper for EncodeFrame()
|
||||
void EncodeFrame(VideoSource *video) {
|
||||
EncodeFrame(video, 0);
|
||||
}
|
||||
void EncodeFrame(VideoSource *video) { EncodeFrame(video, 0); }
|
||||
|
||||
void Control(int ctrl_id, int arg) {
|
||||
const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg);
|
||||
@ -156,12 +145,10 @@ class Encoder {
|
||||
cfg_ = *cfg;
|
||||
}
|
||||
|
||||
void set_deadline(unsigned long deadline) {
|
||||
deadline_ = deadline;
|
||||
}
|
||||
void set_deadline(unsigned long deadline) { deadline_ = deadline; }
|
||||
|
||||
protected:
|
||||
virtual vpx_codec_iface_t* CodecInterface() const = 0;
|
||||
virtual vpx_codec_iface_t *CodecInterface() const = 0;
|
||||
|
||||
const char *EncoderError() {
|
||||
const char *detail = vpx_codec_error_detail(&encoder_);
|
||||
@ -175,11 +162,11 @@ class Encoder {
|
||||
// Flush the encoder on EOS
|
||||
void Flush();
|
||||
|
||||
vpx_codec_ctx_t encoder_;
|
||||
vpx_codec_enc_cfg_t cfg_;
|
||||
unsigned long deadline_;
|
||||
unsigned long init_flags_;
|
||||
TwopassStatsStore *stats_;
|
||||
vpx_codec_ctx_t encoder_;
|
||||
vpx_codec_enc_cfg_t cfg_;
|
||||
unsigned long deadline_;
|
||||
unsigned long init_flags_;
|
||||
TwopassStatsStore *stats_;
|
||||
};
|
||||
|
||||
// Common test functionality for all Encoder tests.
|
||||
@ -221,36 +208,35 @@ class EncoderTest {
|
||||
virtual void EndPassHook() {}
|
||||
|
||||
// Hook to be called before encoding a frame.
|
||||
virtual void PreEncodeFrameHook(VideoSource* /*video*/) {}
|
||||
virtual void PreEncodeFrameHook(VideoSource* /*video*/,
|
||||
Encoder* /*encoder*/) {}
|
||||
virtual void PreEncodeFrameHook(VideoSource * /*video*/) {}
|
||||
virtual void PreEncodeFrameHook(VideoSource * /*video*/,
|
||||
Encoder * /*encoder*/) {}
|
||||
|
||||
// Hook to be called on every compressed data packet.
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t* /*pkt*/) {}
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t * /*pkt*/) {}
|
||||
|
||||
// Hook to be called on every PSNR packet.
|
||||
virtual void PSNRPktHook(const vpx_codec_cx_pkt_t* /*pkt*/) {}
|
||||
virtual void PSNRPktHook(const vpx_codec_cx_pkt_t * /*pkt*/) {}
|
||||
|
||||
// Hook to determine whether the encode loop should continue.
|
||||
virtual bool Continue() const {
|
||||
return !(::testing::Test::HasFatalFailure() || abort_);
|
||||
}
|
||||
|
||||
const CodecFactory *codec_;
|
||||
const CodecFactory *codec_;
|
||||
// Hook to determine whether to decode frame after encoding
|
||||
virtual bool DoDecode() const { return 1; }
|
||||
|
||||
// Hook to handle encode/decode mismatch
|
||||
virtual void MismatchHook(const vpx_image_t *img1,
|
||||
const vpx_image_t *img2);
|
||||
virtual void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2);
|
||||
|
||||
// Hook to be called on every decompressed frame.
|
||||
virtual void DecompressedFrameHook(const vpx_image_t& /*img*/,
|
||||
virtual void DecompressedFrameHook(const vpx_image_t & /*img*/,
|
||||
vpx_codec_pts_t /*pts*/) {}
|
||||
|
||||
// Hook to be called to handle decode result. Return true to continue.
|
||||
virtual bool HandleDecodeResult(const vpx_codec_err_t res_dec,
|
||||
const VideoSource& /*video*/,
|
||||
const VideoSource & /*video*/,
|
||||
Decoder *decoder) {
|
||||
EXPECT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError();
|
||||
return VPX_CODEC_OK == res_dec;
|
||||
@ -262,15 +248,15 @@ class EncoderTest {
|
||||
return pkt;
|
||||
}
|
||||
|
||||
bool abort_;
|
||||
vpx_codec_enc_cfg_t cfg_;
|
||||
vpx_codec_dec_cfg_t dec_cfg_;
|
||||
unsigned int passes_;
|
||||
unsigned long deadline_;
|
||||
TwopassStatsStore stats_;
|
||||
unsigned long init_flags_;
|
||||
unsigned long frame_flags_;
|
||||
vpx_codec_pts_t last_pts_;
|
||||
bool abort_;
|
||||
vpx_codec_enc_cfg_t cfg_;
|
||||
vpx_codec_dec_cfg_t dec_cfg_;
|
||||
unsigned int passes_;
|
||||
unsigned long deadline_;
|
||||
TwopassStatsStore stats_;
|
||||
unsigned long init_flags_;
|
||||
unsigned long frame_flags_;
|
||||
vpx_codec_pts_t last_pts_;
|
||||
};
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
@ -19,16 +19,13 @@ namespace {
|
||||
const int kMaxErrorFrames = 12;
|
||||
const int kMaxDroppableFrames = 12;
|
||||
|
||||
class ErrorResilienceTestLarge : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, bool> {
|
||||
class ErrorResilienceTestLarge
|
||||
: public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, bool> {
|
||||
protected:
|
||||
ErrorResilienceTestLarge()
|
||||
: EncoderTest(GET_PARAM(0)),
|
||||
svc_support_(GET_PARAM(2)),
|
||||
psnr_(0.0),
|
||||
nframes_(0),
|
||||
mismatch_psnr_(0.0),
|
||||
mismatch_nframes_(0),
|
||||
: EncoderTest(GET_PARAM(0)), svc_support_(GET_PARAM(2)), psnr_(0.0),
|
||||
nframes_(0), mismatch_psnr_(0.0), mismatch_nframes_(0),
|
||||
encoding_mode_(GET_PARAM(1)) {
|
||||
Reset();
|
||||
}
|
||||
@ -66,81 +63,70 @@ class ErrorResilienceTestLarge : public ::libvpx_test::EncoderTest,
|
||||
// LAST is updated on base/layer 0, GOLDEN updated on layer 1.
|
||||
// Non-zero pattern_switch parameter means pattern will switch to
|
||||
// not using LAST for frame_num >= pattern_switch.
|
||||
int SetFrameFlags(int frame_num,
|
||||
int num_temp_layers,
|
||||
int pattern_switch) {
|
||||
int SetFrameFlags(int frame_num, int num_temp_layers, int pattern_switch) {
|
||||
int frame_flags = 0;
|
||||
if (num_temp_layers == 2) {
|
||||
if (frame_num % 2 == 0) {
|
||||
if (frame_num < pattern_switch || pattern_switch == 0) {
|
||||
// Layer 0: predict from LAST and ARF, update LAST.
|
||||
frame_flags = VP8_EFLAG_NO_REF_GF |
|
||||
VP8_EFLAG_NO_UPD_GF |
|
||||
VP8_EFLAG_NO_UPD_ARF;
|
||||
} else {
|
||||
// Layer 0: predict from GF and ARF, update GF.
|
||||
frame_flags = VP8_EFLAG_NO_REF_LAST |
|
||||
VP8_EFLAG_NO_UPD_LAST |
|
||||
VP8_EFLAG_NO_UPD_ARF;
|
||||
}
|
||||
if (frame_num % 2 == 0) {
|
||||
if (frame_num < pattern_switch || pattern_switch == 0) {
|
||||
// Layer 0: predict from LAST and ARF, update LAST.
|
||||
frame_flags =
|
||||
VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
|
||||
} else {
|
||||
if (frame_num < pattern_switch || pattern_switch == 0) {
|
||||
// Layer 1: predict from L, GF, and ARF, update GF.
|
||||
frame_flags = VP8_EFLAG_NO_UPD_ARF |
|
||||
VP8_EFLAG_NO_UPD_LAST;
|
||||
} else {
|
||||
// Layer 1: predict from GF and ARF, update GF.
|
||||
frame_flags = VP8_EFLAG_NO_REF_LAST |
|
||||
VP8_EFLAG_NO_UPD_LAST |
|
||||
VP8_EFLAG_NO_UPD_ARF;
|
||||
}
|
||||
// Layer 0: predict from GF and ARF, update GF.
|
||||
frame_flags = VP8_EFLAG_NO_REF_LAST | VP8_EFLAG_NO_UPD_LAST |
|
||||
VP8_EFLAG_NO_UPD_ARF;
|
||||
}
|
||||
} else {
|
||||
if (frame_num < pattern_switch || pattern_switch == 0) {
|
||||
// Layer 1: predict from L, GF, and ARF, update GF.
|
||||
frame_flags = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST;
|
||||
} else {
|
||||
// Layer 1: predict from GF and ARF, update GF.
|
||||
frame_flags = VP8_EFLAG_NO_REF_LAST | VP8_EFLAG_NO_UPD_LAST |
|
||||
VP8_EFLAG_NO_UPD_ARF;
|
||||
}
|
||||
}
|
||||
}
|
||||
return frame_flags;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder * /*encoder*/) {
|
||||
frame_flags_ &= ~(VP8_EFLAG_NO_UPD_LAST |
|
||||
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);
|
||||
// For temporal layer case.
|
||||
if (cfg_.ts_number_layers > 1) {
|
||||
frame_flags_ = SetFrameFlags(video->frame(),
|
||||
cfg_.ts_number_layers,
|
||||
pattern_switch_);
|
||||
frame_flags_ =
|
||||
SetFrameFlags(video->frame(), cfg_.ts_number_layers, pattern_switch_);
|
||||
for (unsigned int i = 0; i < droppable_nframes_; ++i) {
|
||||
if (droppable_frames_[i] == video->frame()) {
|
||||
std::cout << "Encoding droppable frame: "
|
||||
<< droppable_frames_[i] << "\n";
|
||||
std::cout << "Encoding droppable frame: " << droppable_frames_[i]
|
||||
<< "\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (droppable_nframes_ > 0 &&
|
||||
(cfg_.g_pass == VPX_RC_LAST_PASS || cfg_.g_pass == VPX_RC_ONE_PASS)) {
|
||||
for (unsigned int i = 0; i < droppable_nframes_; ++i) {
|
||||
if (droppable_frames_[i] == video->frame()) {
|
||||
std::cout << "Encoding droppable frame: "
|
||||
<< droppable_frames_[i] << "\n";
|
||||
frame_flags_ |= (VP8_EFLAG_NO_UPD_LAST |
|
||||
VP8_EFLAG_NO_UPD_GF |
|
||||
VP8_EFLAG_NO_UPD_ARF);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (droppable_nframes_ > 0 &&
|
||||
(cfg_.g_pass == VPX_RC_LAST_PASS || cfg_.g_pass == VPX_RC_ONE_PASS)) {
|
||||
for (unsigned int i = 0; i < droppable_nframes_; ++i) {
|
||||
if (droppable_frames_[i] == video->frame()) {
|
||||
std::cout << "Encoding droppable frame: " << droppable_frames_[i]
|
||||
<< "\n";
|
||||
frame_flags_ |= (VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF |
|
||||
VP8_EFLAG_NO_UPD_ARF);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double GetAveragePsnr() const {
|
||||
if (nframes_)
|
||||
return psnr_ / nframes_;
|
||||
if (nframes_) return psnr_ / nframes_;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
double GetAverageMismatchPsnr() const {
|
||||
if (mismatch_nframes_)
|
||||
return mismatch_psnr_ / mismatch_nframes_;
|
||||
if (mismatch_nframes_) return mismatch_psnr_ / mismatch_nframes_;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
@ -158,8 +144,7 @@ class ErrorResilienceTestLarge : public ::libvpx_test::EncoderTest,
|
||||
return 1;
|
||||
}
|
||||
|
||||
virtual void MismatchHook(const vpx_image_t *img1,
|
||||
const vpx_image_t *img2) {
|
||||
virtual void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2) {
|
||||
double mismatch_psnr = compute_psnr(img1, img2);
|
||||
mismatch_psnr_ += mismatch_psnr;
|
||||
++mismatch_nframes_;
|
||||
@ -186,13 +171,9 @@ class ErrorResilienceTestLarge : public ::libvpx_test::EncoderTest,
|
||||
droppable_frames_[i] = list[i];
|
||||
}
|
||||
|
||||
unsigned int GetMismatchFrames() {
|
||||
return mismatch_nframes_;
|
||||
}
|
||||
unsigned int GetMismatchFrames() { return mismatch_nframes_; }
|
||||
|
||||
void SetPatternSwitch(int frame_switch) {
|
||||
pattern_switch_ = frame_switch;
|
||||
}
|
||||
void SetPatternSwitch(int frame_switch) { pattern_switch_ = frame_switch; }
|
||||
|
||||
bool svc_support_;
|
||||
|
||||
@ -265,15 +246,14 @@ TEST_P(ErrorResilienceTestLarge, DropFramesWithoutRecovery) {
|
||||
// In addition to isolated loss/drop, add a long consecutive series
|
||||
// (of size 9) of dropped frames.
|
||||
unsigned int num_droppable_frames = 11;
|
||||
unsigned int droppable_frame_list[] = {5, 16, 22, 23, 24, 25, 26, 27, 28,
|
||||
29, 30};
|
||||
unsigned int droppable_frame_list[] = { 5, 16, 22, 23, 24, 25,
|
||||
26, 27, 28, 29, 30 };
|
||||
SetDroppableFrames(num_droppable_frames, droppable_frame_list);
|
||||
SetErrorFrames(num_droppable_frames, droppable_frame_list);
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
// Test that no mismatches have been found
|
||||
std::cout << " Mismatch frames: "
|
||||
<< GetMismatchFrames() << "\n";
|
||||
EXPECT_EQ(GetMismatchFrames(), (unsigned int) 0);
|
||||
std::cout << " Mismatch frames: " << GetMismatchFrames() << "\n";
|
||||
EXPECT_EQ(GetMismatchFrames(), (unsigned int)0);
|
||||
|
||||
// Reset previously set of error/droppable frames.
|
||||
Reset();
|
||||
@ -306,8 +286,7 @@ TEST_P(ErrorResilienceTestLarge, DropFramesWithoutRecovery) {
|
||||
// layer, so successful decoding is expected.
|
||||
TEST_P(ErrorResilienceTestLarge, 2LayersDropEnhancement) {
|
||||
// This test doesn't run if SVC is not supported.
|
||||
if (!svc_support_)
|
||||
return;
|
||||
if (!svc_support_) return;
|
||||
|
||||
const vpx_rational timebase = { 33333333, 1000000000 };
|
||||
cfg_.g_timebase = timebase;
|
||||
@ -337,14 +316,13 @@ TEST_P(ErrorResilienceTestLarge, 2LayersDropEnhancement) {
|
||||
// The odd frames are the enhancement layer for 2 layer pattern, so set
|
||||
// those frames as droppable. Drop the last 7 frames.
|
||||
unsigned int num_droppable_frames = 7;
|
||||
unsigned int droppable_frame_list[] = {27, 29, 31, 33, 35, 37, 39};
|
||||
unsigned int droppable_frame_list[] = { 27, 29, 31, 33, 35, 37, 39 };
|
||||
SetDroppableFrames(num_droppable_frames, droppable_frame_list);
|
||||
SetErrorFrames(num_droppable_frames, droppable_frame_list);
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
// Test that no mismatches have been found
|
||||
std::cout << " Mismatch frames: "
|
||||
<< GetMismatchFrames() << "\n";
|
||||
EXPECT_EQ(GetMismatchFrames(), (unsigned int) 0);
|
||||
std::cout << " Mismatch frames: " << GetMismatchFrames() << "\n";
|
||||
EXPECT_EQ(GetMismatchFrames(), (unsigned int)0);
|
||||
|
||||
// Reset previously set of error/droppable frames.
|
||||
Reset();
|
||||
@ -355,8 +333,7 @@ TEST_P(ErrorResilienceTestLarge, 2LayersDropEnhancement) {
|
||||
// sequence, the LAST ref is not used anymore.
|
||||
TEST_P(ErrorResilienceTestLarge, 2LayersNoRefLast) {
|
||||
// This test doesn't run if SVC is not supported.
|
||||
if (!svc_support_)
|
||||
return;
|
||||
if (!svc_support_) return;
|
||||
|
||||
const vpx_rational timebase = { 33333333, 1000000000 };
|
||||
cfg_.g_timebase = timebase;
|
||||
@ -385,20 +362,19 @@ TEST_P(ErrorResilienceTestLarge, 2LayersNoRefLast) {
|
||||
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
// Test that no mismatches have been found
|
||||
std::cout << " Mismatch frames: "
|
||||
<< GetMismatchFrames() << "\n";
|
||||
EXPECT_EQ(GetMismatchFrames(), (unsigned int) 0);
|
||||
std::cout << " Mismatch frames: " << GetMismatchFrames() << "\n";
|
||||
EXPECT_EQ(GetMismatchFrames(), (unsigned int)0);
|
||||
|
||||
// Reset previously set of error/droppable frames.
|
||||
Reset();
|
||||
}
|
||||
|
||||
class ErrorResilienceTestLargeCodecControls : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
class ErrorResilienceTestLargeCodecControls
|
||||
: public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
protected:
|
||||
ErrorResilienceTestLargeCodecControls()
|
||||
: EncoderTest(GET_PARAM(0)),
|
||||
encoding_mode_(GET_PARAM(1)) {
|
||||
: EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)) {
|
||||
Reset();
|
||||
}
|
||||
|
||||
@ -437,8 +413,8 @@ class ErrorResilienceTestLargeCodecControls : public ::libvpx_test::EncoderTest,
|
||||
if (num_temp_layers == 2) {
|
||||
if (frame_num % 2 == 0) {
|
||||
// Layer 0: predict from L and ARF, update L.
|
||||
frame_flags = VP8_EFLAG_NO_REF_GF | 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;
|
||||
} else {
|
||||
// Layer 1: predict from L, G and ARF, and update G.
|
||||
frame_flags = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST |
|
||||
@ -451,9 +427,9 @@ class ErrorResilienceTestLargeCodecControls : public ::libvpx_test::EncoderTest,
|
||||
VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF;
|
||||
} else if ((frame_num - 2) % 4 == 0) {
|
||||
// Layer 1: predict from L, G, update G.
|
||||
frame_flags = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST |
|
||||
VP8_EFLAG_NO_REF_ARF;
|
||||
} else if ((frame_num - 1) % 2 == 0) {
|
||||
frame_flags =
|
||||
VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_REF_ARF;
|
||||
} else if ((frame_num - 1) % 2 == 0) {
|
||||
// Layer 2: predict from L, G, ARF; update ARG.
|
||||
frame_flags = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_LAST;
|
||||
}
|
||||
@ -467,7 +443,7 @@ class ErrorResilienceTestLargeCodecControls : public ::libvpx_test::EncoderTest,
|
||||
if (frame_num % 2 == 0) {
|
||||
layer_id = 0;
|
||||
} else {
|
||||
layer_id = 1;
|
||||
layer_id = 1;
|
||||
}
|
||||
} else if (num_temp_layers == 3) {
|
||||
if (frame_num % 4 == 0) {
|
||||
@ -484,16 +460,16 @@ class ErrorResilienceTestLargeCodecControls : public ::libvpx_test::EncoderTest,
|
||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
||||
libvpx_test::Encoder *encoder) {
|
||||
if (cfg_.ts_number_layers > 1) {
|
||||
int layer_id = SetLayerId(video->frame(), cfg_.ts_number_layers);
|
||||
int frame_flags = SetFrameFlags(video->frame(), cfg_.ts_number_layers);
|
||||
if (video->frame() > 0) {
|
||||
encoder->Control(VP8E_SET_TEMPORAL_LAYER_ID, layer_id);
|
||||
encoder->Control(VP8E_SET_FRAME_FLAGS, frame_flags);
|
||||
}
|
||||
const vpx_rational_t tb = video->timebase();
|
||||
timebase_ = static_cast<double>(tb.num) / tb.den;
|
||||
duration_ = 0;
|
||||
return;
|
||||
int layer_id = SetLayerId(video->frame(), cfg_.ts_number_layers);
|
||||
int frame_flags = SetFrameFlags(video->frame(), cfg_.ts_number_layers);
|
||||
if (video->frame() > 0) {
|
||||
encoder->Control(VP8E_SET_TEMPORAL_LAYER_ID, layer_id);
|
||||
encoder->Control(VP8E_SET_FRAME_FLAGS, frame_flags);
|
||||
}
|
||||
const vpx_rational_t tb = video->timebase();
|
||||
timebase_ = static_cast<double>(tb.num) / tb.den;
|
||||
duration_ = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -519,26 +495,28 @@ class ErrorResilienceTestLargeCodecControls : public ::libvpx_test::EncoderTest,
|
||||
|
||||
virtual void EndPassHook(void) {
|
||||
duration_ = (last_pts_ + 1) * timebase_;
|
||||
if (cfg_.ts_number_layers > 1) {
|
||||
if (cfg_.ts_number_layers > 1) {
|
||||
for (int layer = 0; layer < static_cast<int>(cfg_.ts_number_layers);
|
||||
++layer) {
|
||||
++layer) {
|
||||
if (bits_total_[layer]) {
|
||||
// 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];
|
||||
private:
|
||||
libvpx_test::TestMode encoding_mode_;
|
||||
vpx_codec_pts_t last_pts_;
|
||||
double timebase_;
|
||||
int64_t bits_total_[3];
|
||||
double duration_;
|
||||
int tot_frame_number_;
|
||||
};
|
||||
|
||||
private:
|
||||
libvpx_test::TestMode encoding_mode_;
|
||||
vpx_codec_pts_t last_pts_;
|
||||
double timebase_;
|
||||
int64_t bits_total_[3];
|
||||
double duration_;
|
||||
int tot_frame_number_;
|
||||
};
|
||||
|
||||
// Check two codec controls used for:
|
||||
// (1) for setting temporal layer id, and (2) for settings encoder flags.
|
||||
@ -582,10 +560,12 @@ TEST_P(ErrorResilienceTestLargeCodecControls, CodecControl3TemporalLayers) {
|
||||
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)
|
||||
<< " 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)
|
||||
<< " The datarate for the file is greater than target by too much, "
|
||||
"for layer: " << j;
|
||||
"for layer: "
|
||||
<< j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,21 +34,18 @@ struct ExternalFrameBuffer {
|
||||
// Class to manipulate a list of external frame buffers.
|
||||
class ExternalFrameBufferList {
|
||||
public:
|
||||
ExternalFrameBufferList()
|
||||
: num_buffers_(0),
|
||||
ext_fb_list_(NULL) {}
|
||||
ExternalFrameBufferList() : num_buffers_(0), ext_fb_list_(NULL) {}
|
||||
|
||||
virtual ~ExternalFrameBufferList() {
|
||||
for (int i = 0; i < num_buffers_; ++i) {
|
||||
delete [] ext_fb_list_[i].data;
|
||||
delete[] ext_fb_list_[i].data;
|
||||
}
|
||||
delete [] ext_fb_list_;
|
||||
delete[] ext_fb_list_;
|
||||
}
|
||||
|
||||
// Creates the list to hold the external buffers. Returns true on success.
|
||||
bool CreateBufferList(int num_buffers) {
|
||||
if (num_buffers < 0)
|
||||
return false;
|
||||
if (num_buffers < 0) return false;
|
||||
|
||||
num_buffers_ = num_buffers;
|
||||
ext_fb_list_ = new ExternalFrameBuffer[num_buffers_];
|
||||
@ -64,11 +61,10 @@ class ExternalFrameBufferList {
|
||||
int GetFreeFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) {
|
||||
EXPECT_TRUE(fb != NULL);
|
||||
const int idx = FindFreeBufferIndex();
|
||||
if (idx == num_buffers_)
|
||||
return -1;
|
||||
if (idx == num_buffers_) return -1;
|
||||
|
||||
if (ext_fb_list_[idx].size < min_size) {
|
||||
delete [] ext_fb_list_[idx].data;
|
||||
delete[] ext_fb_list_[idx].data;
|
||||
ext_fb_list_[idx].data = new uint8_t[min_size];
|
||||
memset(ext_fb_list_[idx].data, 0, min_size);
|
||||
ext_fb_list_[idx].size = min_size;
|
||||
@ -83,11 +79,10 @@ class ExternalFrameBufferList {
|
||||
int GetZeroFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) {
|
||||
EXPECT_TRUE(fb != NULL);
|
||||
const int idx = FindFreeBufferIndex();
|
||||
if (idx == num_buffers_)
|
||||
return -1;
|
||||
if (idx == num_buffers_) return -1;
|
||||
|
||||
if (ext_fb_list_[idx].size < min_size) {
|
||||
delete [] ext_fb_list_[idx].data;
|
||||
delete[] ext_fb_list_[idx].data;
|
||||
ext_fb_list_[idx].data = NULL;
|
||||
ext_fb_list_[idx].size = min_size;
|
||||
}
|
||||
@ -104,7 +99,7 @@ class ExternalFrameBufferList {
|
||||
return -1;
|
||||
}
|
||||
ExternalFrameBuffer *const ext_fb =
|
||||
reinterpret_cast<ExternalFrameBuffer*>(fb->priv);
|
||||
reinterpret_cast<ExternalFrameBuffer *>(fb->priv);
|
||||
if (ext_fb == NULL) {
|
||||
EXPECT_TRUE(ext_fb != NULL);
|
||||
return -1;
|
||||
@ -119,7 +114,7 @@ class ExternalFrameBufferList {
|
||||
void CheckXImageFrameBuffer(const vpx_image_t *img) {
|
||||
if (img->fb_priv != NULL) {
|
||||
const struct ExternalFrameBuffer *const ext_fb =
|
||||
reinterpret_cast<ExternalFrameBuffer*>(img->fb_priv);
|
||||
reinterpret_cast<ExternalFrameBuffer *>(img->fb_priv);
|
||||
|
||||
ASSERT_TRUE(img->planes[0] >= ext_fb->data &&
|
||||
img->planes[0] < (ext_fb->data + ext_fb->size));
|
||||
@ -133,8 +128,7 @@ class ExternalFrameBufferList {
|
||||
int i;
|
||||
// Find a free frame buffer.
|
||||
for (i = 0; i < num_buffers_; ++i) {
|
||||
if (!ext_fb_list_[i].in_use)
|
||||
break;
|
||||
if (!ext_fb_list_[i].in_use) break;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
@ -161,16 +155,15 @@ class ExternalFrameBufferList {
|
||||
int get_vp9_frame_buffer(void *user_priv, size_t min_size,
|
||||
vpx_codec_frame_buffer_t *fb) {
|
||||
ExternalFrameBufferList *const fb_list =
|
||||
reinterpret_cast<ExternalFrameBufferList*>(user_priv);
|
||||
reinterpret_cast<ExternalFrameBufferList *>(user_priv);
|
||||
return fb_list->GetFreeFrameBuffer(min_size, fb);
|
||||
}
|
||||
|
||||
// Callback used by libvpx to tell the application that |fb| is not needed
|
||||
// anymore.
|
||||
int release_vp9_frame_buffer(void *user_priv,
|
||||
vpx_codec_frame_buffer_t *fb) {
|
||||
int release_vp9_frame_buffer(void *user_priv, vpx_codec_frame_buffer_t *fb) {
|
||||
ExternalFrameBufferList *const fb_list =
|
||||
reinterpret_cast<ExternalFrameBufferList*>(user_priv);
|
||||
reinterpret_cast<ExternalFrameBufferList *>(user_priv);
|
||||
return fb_list->ReturnFrameBuffer(fb);
|
||||
}
|
||||
|
||||
@ -178,7 +171,7 @@ int release_vp9_frame_buffer(void *user_priv,
|
||||
int get_vp9_zero_frame_buffer(void *user_priv, size_t min_size,
|
||||
vpx_codec_frame_buffer_t *fb) {
|
||||
ExternalFrameBufferList *const fb_list =
|
||||
reinterpret_cast<ExternalFrameBufferList*>(user_priv);
|
||||
reinterpret_cast<ExternalFrameBufferList *>(user_priv);
|
||||
return fb_list->GetZeroFrameBuffer(min_size, fb);
|
||||
}
|
||||
|
||||
@ -186,7 +179,7 @@ int get_vp9_zero_frame_buffer(void *user_priv, size_t min_size,
|
||||
int get_vp9_one_less_byte_frame_buffer(void *user_priv, size_t min_size,
|
||||
vpx_codec_frame_buffer_t *fb) {
|
||||
ExternalFrameBufferList *const fb_list =
|
||||
reinterpret_cast<ExternalFrameBufferList*>(user_priv);
|
||||
reinterpret_cast<ExternalFrameBufferList *>(user_priv);
|
||||
return fb_list->GetFreeFrameBuffer(min_size - 1, fb);
|
||||
}
|
||||
|
||||
@ -203,16 +196,14 @@ int do_not_release_vp9_frame_buffer(void *user_priv,
|
||||
// Class for testing passing in external frame buffers to libvpx.
|
||||
class ExternalFrameBufferMD5Test
|
||||
: public ::libvpx_test::DecoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<const char*> {
|
||||
public ::libvpx_test::CodecTestWithParam<const char *> {
|
||||
protected:
|
||||
ExternalFrameBufferMD5Test()
|
||||
: DecoderTest(GET_PARAM(::libvpx_test::kCodecFactoryParam)),
|
||||
md5_file_(NULL),
|
||||
num_buffers_(0) {}
|
||||
md5_file_(NULL), num_buffers_(0) {}
|
||||
|
||||
virtual ~ExternalFrameBufferMD5Test() {
|
||||
if (md5_file_ != NULL)
|
||||
fclose(md5_file_);
|
||||
if (md5_file_ != NULL) fclose(md5_file_);
|
||||
}
|
||||
|
||||
virtual void PreDecodeFrameHook(
|
||||
@ -222,15 +213,15 @@ class ExternalFrameBufferMD5Test
|
||||
// Have libvpx use frame buffers we create.
|
||||
ASSERT_TRUE(fb_list_.CreateBufferList(num_buffers_));
|
||||
ASSERT_EQ(VPX_CODEC_OK,
|
||||
decoder->SetFrameBufferFunctions(
|
||||
GetVP9FrameBuffer, ReleaseVP9FrameBuffer, this));
|
||||
decoder->SetFrameBufferFunctions(GetVP9FrameBuffer,
|
||||
ReleaseVP9FrameBuffer, this));
|
||||
}
|
||||
}
|
||||
|
||||
void OpenMD5File(const std::string &md5_file_name_) {
|
||||
md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name_);
|
||||
ASSERT_TRUE(md5_file_ != NULL) << "Md5 file open failed. Filename: "
|
||||
<< md5_file_name_;
|
||||
<< md5_file_name_;
|
||||
}
|
||||
|
||||
virtual void DecompressedFrameHook(const vpx_image_t &img,
|
||||
@ -258,7 +249,7 @@ class ExternalFrameBufferMD5Test
|
||||
static int GetVP9FrameBuffer(void *user_priv, size_t min_size,
|
||||
vpx_codec_frame_buffer_t *fb) {
|
||||
ExternalFrameBufferMD5Test *const md5Test =
|
||||
reinterpret_cast<ExternalFrameBufferMD5Test*>(user_priv);
|
||||
reinterpret_cast<ExternalFrameBufferMD5Test *>(user_priv);
|
||||
return md5Test->fb_list_.GetFreeFrameBuffer(min_size, fb);
|
||||
}
|
||||
|
||||
@ -267,7 +258,7 @@ class ExternalFrameBufferMD5Test
|
||||
static int ReleaseVP9FrameBuffer(void *user_priv,
|
||||
vpx_codec_frame_buffer_t *fb) {
|
||||
ExternalFrameBufferMD5Test *const md5Test =
|
||||
reinterpret_cast<ExternalFrameBufferMD5Test*>(user_priv);
|
||||
reinterpret_cast<ExternalFrameBufferMD5Test *>(user_priv);
|
||||
return md5Test->fb_list_.ReturnFrameBuffer(fb);
|
||||
}
|
||||
|
||||
@ -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 ExternalFrameBufferTest : public ::testing::Test {
|
||||
protected:
|
||||
ExternalFrameBufferTest()
|
||||
: video_(NULL),
|
||||
decoder_(NULL),
|
||||
num_buffers_(0) {}
|
||||
ExternalFrameBufferTest() : video_(NULL), decoder_(NULL), num_buffers_(0) {}
|
||||
|
||||
virtual void SetUp() {
|
||||
video_ = new libvpx_test::WebMVideoSource(kVP9TestFile);
|
||||
@ -309,8 +297,7 @@ class ExternalFrameBufferTest : public ::testing::Test {
|
||||
|
||||
// Passes the external frame buffer information to libvpx.
|
||||
vpx_codec_err_t SetFrameBufferFunctions(
|
||||
int num_buffers,
|
||||
vpx_get_frame_buffer_cb_fn_t cb_get,
|
||||
int num_buffers, vpx_get_frame_buffer_cb_fn_t cb_get,
|
||||
vpx_release_frame_buffer_cb_fn_t cb_release) {
|
||||
if (num_buffers > 0) {
|
||||
num_buffers_ = num_buffers;
|
||||
@ -324,8 +311,7 @@ class ExternalFrameBufferTest : public ::testing::Test {
|
||||
const vpx_codec_err_t res =
|
||||
decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
|
||||
CheckDecodedFrames();
|
||||
if (res == VPX_CODEC_OK)
|
||||
video_->Next();
|
||||
if (res == VPX_CODEC_OK) video_->Next();
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -333,8 +319,7 @@ class ExternalFrameBufferTest : public ::testing::Test {
|
||||
for (; video_->cxdata() != NULL; video_->Next()) {
|
||||
const vpx_codec_err_t res =
|
||||
decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
|
||||
if (res != VPX_CODEC_OK)
|
||||
return res;
|
||||
if (res != VPX_CODEC_OK) return res;
|
||||
CheckDecodedFrames();
|
||||
}
|
||||
return VPX_CODEC_OK;
|
||||
@ -409,8 +394,8 @@ TEST_F(ExternalFrameBufferTest, MinFrameBuffers) {
|
||||
// #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,
|
||||
SetFrameBufferFunctions(
|
||||
num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer));
|
||||
SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer,
|
||||
release_vp9_frame_buffer));
|
||||
ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames());
|
||||
}
|
||||
|
||||
@ -421,8 +406,8 @@ TEST_F(ExternalFrameBufferTest, EightJitterBuffers) {
|
||||
const int num_buffers =
|
||||
VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS + jitter_buffers;
|
||||
ASSERT_EQ(VPX_CODEC_OK,
|
||||
SetFrameBufferFunctions(
|
||||
num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer));
|
||||
SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer,
|
||||
release_vp9_frame_buffer));
|
||||
ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames());
|
||||
}
|
||||
|
||||
@ -432,8 +417,8 @@ TEST_F(ExternalFrameBufferTest, NotEnoughBuffers) {
|
||||
// only use 5 frame buffers at one time.
|
||||
const int num_buffers = 2;
|
||||
ASSERT_EQ(VPX_CODEC_OK,
|
||||
SetFrameBufferFunctions(
|
||||
num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer));
|
||||
SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer,
|
||||
release_vp9_frame_buffer));
|
||||
ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame());
|
||||
ASSERT_EQ(VPX_CODEC_MEM_ERROR, DecodeRemainingFrames());
|
||||
}
|
||||
@ -457,18 +442,17 @@ TEST_F(ExternalFrameBufferTest, NullRealloc) {
|
||||
|
||||
TEST_F(ExternalFrameBufferTest, ReallocOneLessByte) {
|
||||
const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
|
||||
ASSERT_EQ(VPX_CODEC_OK,
|
||||
SetFrameBufferFunctions(
|
||||
num_buffers, get_vp9_one_less_byte_frame_buffer,
|
||||
release_vp9_frame_buffer));
|
||||
ASSERT_EQ(VPX_CODEC_OK, SetFrameBufferFunctions(
|
||||
num_buffers, get_vp9_one_less_byte_frame_buffer,
|
||||
release_vp9_frame_buffer));
|
||||
ASSERT_EQ(VPX_CODEC_MEM_ERROR, DecodeOneFrame());
|
||||
}
|
||||
|
||||
TEST_F(ExternalFrameBufferTest, NullGetFunction) {
|
||||
const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
|
||||
ASSERT_EQ(VPX_CODEC_INVALID_PARAM,
|
||||
SetFrameBufferFunctions(num_buffers, NULL,
|
||||
release_vp9_frame_buffer));
|
||||
ASSERT_EQ(
|
||||
VPX_CODEC_INVALID_PARAM,
|
||||
SetFrameBufferFunctions(num_buffers, NULL, release_vp9_frame_buffer));
|
||||
}
|
||||
|
||||
TEST_F(ExternalFrameBufferTest, NullReleaseFunction) {
|
||||
@ -481,13 +465,14 @@ TEST_F(ExternalFrameBufferTest, SetAfterDecode) {
|
||||
const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
|
||||
ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame());
|
||||
ASSERT_EQ(VPX_CODEC_ERROR,
|
||||
SetFrameBufferFunctions(
|
||||
num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer));
|
||||
SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer,
|
||||
release_vp9_frame_buffer));
|
||||
}
|
||||
#endif // CONFIG_WEBM_IO
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(ExternalFrameBufferMD5Test,
|
||||
::testing::ValuesIn(libvpx_test::kVP9TestVectors,
|
||||
libvpx_test::kVP9TestVectors +
|
||||
libvpx_test::kNumVP9TestVectors));
|
||||
VP9_INSTANTIATE_TEST_CASE(
|
||||
ExternalFrameBufferMD5Test,
|
||||
::testing::ValuesIn(libvpx_test::kVP9TestVectors,
|
||||
libvpx_test::kVP9TestVectors +
|
||||
libvpx_test::kNumVP9TestVectors));
|
||||
} // namespace
|
||||
|
@ -128,14 +128,14 @@ class Trans4x4TestBase {
|
||||
}
|
||||
}
|
||||
|
||||
ASM_REGISTER_STATE_CHECK(RunFwdTxfm(test_input_block,
|
||||
test_temp_block, pitch_));
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
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
|
||||
} else {
|
||||
ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block,
|
||||
CONVERT_TO_BYTEPTR(dst16), pitch_));
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
RunInvTxfm(test_temp_block, CONVERT_TO_BYTEPTR(dst16), pitch_));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -148,15 +148,13 @@ class Trans4x4TestBase {
|
||||
const int diff = dst[j] - src[j];
|
||||
#endif
|
||||
const uint32_t error = diff * diff;
|
||||
if (max_error < error)
|
||||
max_error = error;
|
||||
if (max_error < error) max_error = error;
|
||||
total_error += error;
|
||||
}
|
||||
}
|
||||
|
||||
EXPECT_GE(static_cast<uint32_t>(limit), max_error)
|
||||
<< "Error: 4x4 FHT/IHT has an individual round trip error > "
|
||||
<< limit;
|
||||
<< "Error: 4x4 FHT/IHT has an individual round trip error > " << limit;
|
||||
|
||||
EXPECT_GE(count_test_block * limit, total_error)
|
||||
<< "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_;
|
||||
}
|
||||
if (i == 0) {
|
||||
for (int j = 0; j < kNumCoeffs; ++j)
|
||||
input_extreme_block[j] = mask_;
|
||||
for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = mask_;
|
||||
} else if (i == 1) {
|
||||
for (int j = 0; j < kNumCoeffs; ++j)
|
||||
input_extreme_block[j] = -mask_;
|
||||
for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = -mask_;
|
||||
}
|
||||
|
||||
fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_);
|
||||
ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_extreme_block,
|
||||
output_block, pitch_));
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
RunFwdTxfm(input_extreme_block, output_block, pitch_));
|
||||
|
||||
// The minimum quant value is 4.
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
@ -251,8 +247,8 @@ class Trans4x4TestBase {
|
||||
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_));
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
} else {
|
||||
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16),
|
||||
pitch_));
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -265,8 +261,7 @@ class Trans4x4TestBase {
|
||||
#endif
|
||||
const uint32_t error = diff * diff;
|
||||
EXPECT_GE(static_cast<uint32_t>(limit), error)
|
||||
<< "Error: 4x4 IDCT has error " << error
|
||||
<< " at index " << j;
|
||||
<< "Error: 4x4 IDCT has error " << error << " at index " << j;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -278,17 +273,16 @@ class Trans4x4TestBase {
|
||||
int mask_;
|
||||
};
|
||||
|
||||
class Trans4x4DCT
|
||||
: public Trans4x4TestBase,
|
||||
public ::testing::TestWithParam<Dct4x4Param> {
|
||||
class Trans4x4DCT : public Trans4x4TestBase,
|
||||
public ::testing::TestWithParam<Dct4x4Param> {
|
||||
public:
|
||||
virtual ~Trans4x4DCT() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
fwd_txfm_ = GET_PARAM(0);
|
||||
inv_txfm_ = GET_PARAM(1);
|
||||
tx_type_ = GET_PARAM(2);
|
||||
pitch_ = 4;
|
||||
tx_type_ = GET_PARAM(2);
|
||||
pitch_ = 4;
|
||||
fwd_txfm_ref = fdct4x4_ref;
|
||||
bit_depth_ = GET_PARAM(3);
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
@ -307,33 +301,24 @@ class Trans4x4DCT
|
||||
IdctFunc inv_txfm_;
|
||||
};
|
||||
|
||||
TEST_P(Trans4x4DCT, AccuracyCheck) {
|
||||
RunAccuracyCheck(1);
|
||||
}
|
||||
TEST_P(Trans4x4DCT, AccuracyCheck) { RunAccuracyCheck(1); }
|
||||
|
||||
TEST_P(Trans4x4DCT, CoeffCheck) {
|
||||
RunCoeffCheck();
|
||||
}
|
||||
TEST_P(Trans4x4DCT, CoeffCheck) { RunCoeffCheck(); }
|
||||
|
||||
TEST_P(Trans4x4DCT, MemCheck) {
|
||||
RunMemCheck();
|
||||
}
|
||||
TEST_P(Trans4x4DCT, MemCheck) { RunMemCheck(); }
|
||||
|
||||
TEST_P(Trans4x4DCT, InvAccuracyCheck) {
|
||||
RunInvAccuracyCheck(1);
|
||||
}
|
||||
TEST_P(Trans4x4DCT, InvAccuracyCheck) { RunInvAccuracyCheck(1); }
|
||||
|
||||
class Trans4x4HT
|
||||
: public Trans4x4TestBase,
|
||||
public ::testing::TestWithParam<Ht4x4Param> {
|
||||
class Trans4x4HT : public Trans4x4TestBase,
|
||||
public ::testing::TestWithParam<Ht4x4Param> {
|
||||
public:
|
||||
virtual ~Trans4x4HT() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
fwd_txfm_ = GET_PARAM(0);
|
||||
inv_txfm_ = GET_PARAM(1);
|
||||
tx_type_ = GET_PARAM(2);
|
||||
pitch_ = 4;
|
||||
tx_type_ = GET_PARAM(2);
|
||||
pitch_ = 4;
|
||||
fwd_txfm_ref = fht4x4_ref;
|
||||
bit_depth_ = GET_PARAM(3);
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
@ -353,33 +338,24 @@ class Trans4x4HT
|
||||
IhtFunc inv_txfm_;
|
||||
};
|
||||
|
||||
TEST_P(Trans4x4HT, AccuracyCheck) {
|
||||
RunAccuracyCheck(1);
|
||||
}
|
||||
TEST_P(Trans4x4HT, AccuracyCheck) { RunAccuracyCheck(1); }
|
||||
|
||||
TEST_P(Trans4x4HT, CoeffCheck) {
|
||||
RunCoeffCheck();
|
||||
}
|
||||
TEST_P(Trans4x4HT, CoeffCheck) { RunCoeffCheck(); }
|
||||
|
||||
TEST_P(Trans4x4HT, MemCheck) {
|
||||
RunMemCheck();
|
||||
}
|
||||
TEST_P(Trans4x4HT, MemCheck) { RunMemCheck(); }
|
||||
|
||||
TEST_P(Trans4x4HT, InvAccuracyCheck) {
|
||||
RunInvAccuracyCheck(1);
|
||||
}
|
||||
TEST_P(Trans4x4HT, InvAccuracyCheck) { RunInvAccuracyCheck(1); }
|
||||
|
||||
class Trans4x4WHT
|
||||
: public Trans4x4TestBase,
|
||||
public ::testing::TestWithParam<Dct4x4Param> {
|
||||
class Trans4x4WHT : public Trans4x4TestBase,
|
||||
public ::testing::TestWithParam<Dct4x4Param> {
|
||||
public:
|
||||
virtual ~Trans4x4WHT() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
fwd_txfm_ = GET_PARAM(0);
|
||||
inv_txfm_ = GET_PARAM(1);
|
||||
tx_type_ = GET_PARAM(2);
|
||||
pitch_ = 4;
|
||||
tx_type_ = GET_PARAM(2);
|
||||
pitch_ = 4;
|
||||
fwd_txfm_ref = fwht4x4_ref;
|
||||
bit_depth_ = GET_PARAM(3);
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
@ -398,21 +374,13 @@ class Trans4x4WHT
|
||||
IdctFunc inv_txfm_;
|
||||
};
|
||||
|
||||
TEST_P(Trans4x4WHT, AccuracyCheck) {
|
||||
RunAccuracyCheck(0);
|
||||
}
|
||||
TEST_P(Trans4x4WHT, AccuracyCheck) { RunAccuracyCheck(0); }
|
||||
|
||||
TEST_P(Trans4x4WHT, CoeffCheck) {
|
||||
RunCoeffCheck();
|
||||
}
|
||||
TEST_P(Trans4x4WHT, CoeffCheck) { RunCoeffCheck(); }
|
||||
|
||||
TEST_P(Trans4x4WHT, MemCheck) {
|
||||
RunMemCheck();
|
||||
}
|
||||
TEST_P(Trans4x4WHT, MemCheck) { RunMemCheck(); }
|
||||
|
||||
TEST_P(Trans4x4WHT, InvAccuracyCheck) {
|
||||
RunInvAccuracyCheck(0);
|
||||
}
|
||||
TEST_P(Trans4x4WHT, InvAccuracyCheck) { RunInvAccuracyCheck(0); }
|
||||
using std::tr1::make_tuple;
|
||||
|
||||
#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_fdct4x4_c, &vpx_idct4x4_16_add_c, 0, VPX_BITS_8)));
|
||||
#else
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, Trans4x4DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct4x4_c, &vpx_idct4x4_16_add_c, 0, VPX_BITS_8)));
|
||||
INSTANTIATE_TEST_CASE_P(C, Trans4x4DCT,
|
||||
::testing::Values(make_tuple(&vpx_fdct4x4_c,
|
||||
&vpx_idct4x4_16_add_c, 0,
|
||||
VPX_BITS_8)));
|
||||
#endif // 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_fwht4x4_c, &vpx_iwht4x4_16_add_c, 0, VPX_BITS_8)));
|
||||
#else
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, Trans4x4WHT,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_fwht4x4_c, &vpx_iwht4x4_16_add_c, 0, VPX_BITS_8)));
|
||||
INSTANTIATE_TEST_CASE_P(C, Trans4x4WHT,
|
||||
::testing::Values(make_tuple(&vp9_fwht4x4_c,
|
||||
&vpx_iwht4x4_16_add_c, 0,
|
||||
VPX_BITS_8)));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
#if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, Trans4x4DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct4x4_c,
|
||||
&vpx_idct4x4_16_add_neon, 0, VPX_BITS_8)));
|
||||
INSTANTIATE_TEST_CASE_P(NEON, Trans4x4DCT,
|
||||
::testing::Values(make_tuple(&vpx_fdct4x4_c,
|
||||
&vpx_idct4x4_16_add_neon,
|
||||
0, VPX_BITS_8)));
|
||||
#endif // HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
@ -496,11 +463,10 @@ INSTANTIATE_TEST_CASE_P(
|
||||
#endif
|
||||
|
||||
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Trans4x4DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct4x4_sse2,
|
||||
&vpx_idct4x4_16_add_sse2, 0, VPX_BITS_8)));
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, Trans4x4DCT,
|
||||
::testing::Values(make_tuple(&vpx_fdct4x4_sse2,
|
||||
&vpx_idct4x4_16_add_sse2,
|
||||
0, VPX_BITS_8)));
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Trans4x4HT,
|
||||
::testing::Values(
|
||||
@ -514,12 +480,11 @@ INSTANTIATE_TEST_CASE_P(
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Trans4x4DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_highbd_fdct4x4_c, &idct4x4_10_sse2, 0, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_fdct4x4_c, &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_fdct4x4_sse2, &vpx_idct4x4_16_add_c, 0,
|
||||
VPX_BITS_8)));
|
||||
make_tuple(&vpx_fdct4x4_sse2, &vpx_idct4x4_16_add_c, 0, VPX_BITS_8)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Trans4x4HT,
|
||||
@ -531,10 +496,10 @@ INSTANTIATE_TEST_CASE_P(
|
||||
#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
|
||||
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, Trans4x4DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct4x4_msa, &vpx_idct4x4_16_add_msa, 0, VPX_BITS_8)));
|
||||
INSTANTIATE_TEST_CASE_P(MSA, Trans4x4DCT,
|
||||
::testing::Values(make_tuple(&vpx_fdct4x4_msa,
|
||||
&vpx_idct4x4_16_add_msa, 0,
|
||||
VPX_BITS_8)));
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, Trans4x4HT,
|
||||
::testing::Values(
|
||||
|
@ -53,8 +53,7 @@ void reference_8x8_dct_1d(const double in[8], double out[8]) {
|
||||
out[k] = 0.0;
|
||||
for (int n = 0; n < 8; n++)
|
||||
out[k] += in[n] * cos(kPi * (2 * n + 1) * k / 16.0);
|
||||
if (k == 0)
|
||||
out[k] = out[k] * kInvSqrt2;
|
||||
if (k == 0) out[k] = out[k] * kInvSqrt2;
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,25 +62,20 @@ void reference_8x8_dct_2d(const int16_t input[kNumCoeffs],
|
||||
// First transform columns
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
double temp_in[8], temp_out[8];
|
||||
for (int j = 0; j < 8; ++j)
|
||||
temp_in[j] = input[j*8 + i];
|
||||
for (int j = 0; j < 8; ++j) temp_in[j] = input[j * 8 + i];
|
||||
reference_8x8_dct_1d(temp_in, temp_out);
|
||||
for (int j = 0; j < 8; ++j)
|
||||
output[j * 8 + i] = temp_out[j];
|
||||
for (int j = 0; j < 8; ++j) output[j * 8 + i] = temp_out[j];
|
||||
}
|
||||
// Then transform rows
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
double temp_in[8], temp_out[8];
|
||||
for (int j = 0; j < 8; ++j)
|
||||
temp_in[j] = output[j + i*8];
|
||||
for (int j = 0; j < 8; ++j) temp_in[j] = output[j + i * 8];
|
||||
reference_8x8_dct_1d(temp_in, temp_out);
|
||||
// Scale by some magic number
|
||||
for (int j = 0; j < 8; ++j)
|
||||
output[j + i * 8] = temp_out[j] * 2;
|
||||
for (int j = 0; j < 8; ++j) output[j + i * 8] = temp_out[j] * 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void fdct8x8_ref(const int16_t *in, tran_low_t *out, int stride,
|
||||
int /*tx_type*/) {
|
||||
vpx_fdct8x8_c(in, out, stride);
|
||||
@ -177,8 +171,7 @@ class FwdTrans8x8TestBase {
|
||||
<< 1. * max_diff / count_test_block * 100 << "%"
|
||||
<< " for input range [-255, 255] at index " << j
|
||||
<< " count0: " << count_sign_block[j][0]
|
||||
<< " count1: " << count_sign_block[j][1]
|
||||
<< " diff: " << diff;
|
||||
<< " count1: " << count_sign_block[j][1] << " diff: " << diff;
|
||||
}
|
||||
|
||||
memset(count_sign_block, 0, sizeof(count_sign_block));
|
||||
@ -186,8 +179,8 @@ class FwdTrans8x8TestBase {
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
// Initialize a test block with input range [-mask_ / 16, mask_ / 16].
|
||||
for (int j = 0; j < 64; ++j)
|
||||
test_input_block[j] = ((rnd.Rand16() & mask_) >> 4) -
|
||||
((rnd.Rand16() & mask_) >> 4);
|
||||
test_input_block[j] =
|
||||
((rnd.Rand16() & mask_) >> 4) - ((rnd.Rand16() & mask_) >> 4);
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
RunFwdTxfm(test_input_block, test_output_block, pitch_));
|
||||
|
||||
@ -207,8 +200,7 @@ class FwdTrans8x8TestBase {
|
||||
<< 1. * max_diff / count_test_block * 100 << "%"
|
||||
<< " for input range [-15, 15] at index " << j
|
||||
<< " count0: " << count_sign_block[j][0]
|
||||
<< " count1: " << count_sign_block[j][1]
|
||||
<< " diff: " << diff;
|
||||
<< " count1: " << count_sign_block[j][1] << " diff: " << diff;
|
||||
}
|
||||
}
|
||||
|
||||
@ -245,19 +237,18 @@ class FwdTrans8x8TestBase {
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
RunFwdTxfm(test_input_block, test_temp_block, pitch_));
|
||||
for (int j = 0; j < 64; ++j) {
|
||||
if (test_temp_block[j] > 0) {
|
||||
test_temp_block[j] += 2;
|
||||
test_temp_block[j] /= 4;
|
||||
test_temp_block[j] *= 4;
|
||||
} else {
|
||||
test_temp_block[j] -= 2;
|
||||
test_temp_block[j] /= 4;
|
||||
test_temp_block[j] *= 4;
|
||||
}
|
||||
if (test_temp_block[j] > 0) {
|
||||
test_temp_block[j] += 2;
|
||||
test_temp_block[j] /= 4;
|
||||
test_temp_block[j] *= 4;
|
||||
} else {
|
||||
test_temp_block[j] -= 2;
|
||||
test_temp_block[j] /= 4;
|
||||
test_temp_block[j] *= 4;
|
||||
}
|
||||
}
|
||||
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
|
||||
} else {
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
@ -273,19 +264,18 @@ class FwdTrans8x8TestBase {
|
||||
const int diff = dst[j] - src[j];
|
||||
#endif
|
||||
const int error = diff * diff;
|
||||
if (max_error < error)
|
||||
max_error = error;
|
||||
if (max_error < error) max_error = error;
|
||||
total_error += error;
|
||||
}
|
||||
}
|
||||
|
||||
EXPECT_GE(1 << 2 * (bit_depth_ - 8), max_error)
|
||||
<< "Error: 8x8 FDCT/IDCT or FHT/IHT has an individual"
|
||||
<< " roundtrip error > 1";
|
||||
<< "Error: 8x8 FDCT/IDCT or FHT/IHT has an individual"
|
||||
<< " roundtrip error > 1";
|
||||
|
||||
EXPECT_GE((count_test_block << 2 * (bit_depth_ - 8))/5, total_error)
|
||||
<< "Error: 8x8 FDCT/IDCT or FHT/IHT has average roundtrip "
|
||||
<< "error > 1/5 per block";
|
||||
EXPECT_GE((count_test_block << 2 * (bit_depth_ - 8)) / 5, total_error)
|
||||
<< "Error: 8x8 FDCT/IDCT or FHT/IHT has average roundtrip "
|
||||
<< "error > 1/5 per block";
|
||||
}
|
||||
|
||||
void RunExtremalCheck() {
|
||||
@ -341,8 +331,7 @@ class FwdTrans8x8TestBase {
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
fwd_txfm_ref(test_input_block, ref_temp_block, pitch_, tx_type_));
|
||||
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
|
||||
} else {
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
@ -358,8 +347,7 @@ class FwdTrans8x8TestBase {
|
||||
const int diff = dst[j] - src[j];
|
||||
#endif
|
||||
const int error = diff * diff;
|
||||
if (max_error < error)
|
||||
max_error = error;
|
||||
if (max_error < error) max_error = error;
|
||||
total_error += error;
|
||||
|
||||
const int coeff_diff = test_temp_block[j] - ref_temp_block[j];
|
||||
@ -370,7 +358,7 @@ class FwdTrans8x8TestBase {
|
||||
<< "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has"
|
||||
<< "an individual roundtrip error > 1";
|
||||
|
||||
EXPECT_GE((count_test_block << 2 * (bit_depth_ - 8))/5, total_error)
|
||||
EXPECT_GE((count_test_block << 2 * (bit_depth_ - 8)) / 5, total_error)
|
||||
<< "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has average"
|
||||
<< " roundtrip error > 1/5 per block";
|
||||
|
||||
@ -418,8 +406,8 @@ class FwdTrans8x8TestBase {
|
||||
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_));
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
} else {
|
||||
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16),
|
||||
pitch_));
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -432,8 +420,7 @@ class FwdTrans8x8TestBase {
|
||||
#endif
|
||||
const uint32_t error = diff * diff;
|
||||
EXPECT_GE(1u << 2 * (bit_depth_ - 8), error)
|
||||
<< "Error: 8x8 IDCT has error " << error
|
||||
<< " at index " << j;
|
||||
<< "Error: 8x8 IDCT has error " << error << " at index " << j;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -461,13 +448,12 @@ class FwdTrans8x8TestBase {
|
||||
const int32_t diff = coeff[j] - coeff_r[j];
|
||||
const uint32_t error = diff * diff;
|
||||
EXPECT_GE(9u << 2 * (bit_depth_ - 8), error)
|
||||
<< "Error: 8x8 DCT has error " << error
|
||||
<< " at index " << j;
|
||||
<< "Error: 8x8 DCT has error " << error << " at index " << j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CompareInvReference(IdctFunc ref_txfm, int thresh) {
|
||||
void CompareInvReference(IdctFunc ref_txfm, int thresh) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
const int count_test_block = 10000;
|
||||
const int eob = 12;
|
||||
@ -484,7 +470,7 @@ void CompareInvReference(IdctFunc ref_txfm, int thresh) {
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
if (j < eob) {
|
||||
// Random values less than the threshold, either positive or negative
|
||||
coeff[scan[j]] = rnd(thresh) * (1-2*(i%2));
|
||||
coeff[scan[j]] = rnd(thresh) * (1 - 2 * (i % 2));
|
||||
} else {
|
||||
coeff[scan[j]] = 0;
|
||||
}
|
||||
@ -504,8 +490,8 @@ void CompareInvReference(IdctFunc ref_txfm, int thresh) {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
} else {
|
||||
ref_txfm(coeff, CONVERT_TO_BYTEPTR(ref16), pitch_);
|
||||
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16),
|
||||
pitch_));
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -517,9 +503,8 @@ void CompareInvReference(IdctFunc ref_txfm, int thresh) {
|
||||
const int diff = dst[j] - ref[j];
|
||||
#endif
|
||||
const uint32_t error = diff * diff;
|
||||
EXPECT_EQ(0u, error)
|
||||
<< "Error: 8x8 IDCT has error " << error
|
||||
<< " at index " << j;
|
||||
EXPECT_EQ(0u, error) << "Error: 8x8 IDCT has error " << error
|
||||
<< " at index " << j;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -530,17 +515,16 @@ void CompareInvReference(IdctFunc ref_txfm, int thresh) {
|
||||
int mask_;
|
||||
};
|
||||
|
||||
class FwdTrans8x8DCT
|
||||
: public FwdTrans8x8TestBase,
|
||||
public ::testing::TestWithParam<Dct8x8Param> {
|
||||
class FwdTrans8x8DCT : public FwdTrans8x8TestBase,
|
||||
public ::testing::TestWithParam<Dct8x8Param> {
|
||||
public:
|
||||
virtual ~FwdTrans8x8DCT() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
fwd_txfm_ = GET_PARAM(0);
|
||||
inv_txfm_ = GET_PARAM(1);
|
||||
tx_type_ = GET_PARAM(2);
|
||||
pitch_ = 8;
|
||||
tx_type_ = GET_PARAM(2);
|
||||
pitch_ = 8;
|
||||
fwd_txfm_ref = fdct8x8_ref;
|
||||
bit_depth_ = GET_PARAM(3);
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
@ -560,37 +544,26 @@ class FwdTrans8x8DCT
|
||||
IdctFunc inv_txfm_;
|
||||
};
|
||||
|
||||
TEST_P(FwdTrans8x8DCT, SignBiasCheck) {
|
||||
RunSignBiasCheck();
|
||||
}
|
||||
TEST_P(FwdTrans8x8DCT, SignBiasCheck) { RunSignBiasCheck(); }
|
||||
|
||||
TEST_P(FwdTrans8x8DCT, RoundTripErrorCheck) {
|
||||
RunRoundTripErrorCheck();
|
||||
}
|
||||
TEST_P(FwdTrans8x8DCT, RoundTripErrorCheck) { RunRoundTripErrorCheck(); }
|
||||
|
||||
TEST_P(FwdTrans8x8DCT, ExtremalCheck) {
|
||||
RunExtremalCheck();
|
||||
}
|
||||
TEST_P(FwdTrans8x8DCT, ExtremalCheck) { RunExtremalCheck(); }
|
||||
|
||||
TEST_P(FwdTrans8x8DCT, FwdAccuracyCheck) {
|
||||
RunFwdAccuracyCheck();
|
||||
}
|
||||
TEST_P(FwdTrans8x8DCT, FwdAccuracyCheck) { RunFwdAccuracyCheck(); }
|
||||
|
||||
TEST_P(FwdTrans8x8DCT, InvAccuracyCheck) {
|
||||
RunInvAccuracyCheck();
|
||||
}
|
||||
TEST_P(FwdTrans8x8DCT, InvAccuracyCheck) { RunInvAccuracyCheck(); }
|
||||
|
||||
class FwdTrans8x8HT
|
||||
: public FwdTrans8x8TestBase,
|
||||
public ::testing::TestWithParam<Ht8x8Param> {
|
||||
class FwdTrans8x8HT : public FwdTrans8x8TestBase,
|
||||
public ::testing::TestWithParam<Ht8x8Param> {
|
||||
public:
|
||||
virtual ~FwdTrans8x8HT() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
fwd_txfm_ = GET_PARAM(0);
|
||||
inv_txfm_ = GET_PARAM(1);
|
||||
tx_type_ = GET_PARAM(2);
|
||||
pitch_ = 8;
|
||||
tx_type_ = GET_PARAM(2);
|
||||
pitch_ = 8;
|
||||
fwd_txfm_ref = fht8x8_ref;
|
||||
bit_depth_ = GET_PARAM(3);
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
@ -610,21 +583,14 @@ class FwdTrans8x8HT
|
||||
IhtFunc inv_txfm_;
|
||||
};
|
||||
|
||||
TEST_P(FwdTrans8x8HT, SignBiasCheck) {
|
||||
RunSignBiasCheck();
|
||||
}
|
||||
TEST_P(FwdTrans8x8HT, SignBiasCheck) { RunSignBiasCheck(); }
|
||||
|
||||
TEST_P(FwdTrans8x8HT, RoundTripErrorCheck) {
|
||||
RunRoundTripErrorCheck();
|
||||
}
|
||||
TEST_P(FwdTrans8x8HT, RoundTripErrorCheck) { RunRoundTripErrorCheck(); }
|
||||
|
||||
TEST_P(FwdTrans8x8HT, ExtremalCheck) {
|
||||
RunExtremalCheck();
|
||||
}
|
||||
TEST_P(FwdTrans8x8HT, ExtremalCheck) { RunExtremalCheck(); }
|
||||
|
||||
class InvTrans8x8DCT
|
||||
: public FwdTrans8x8TestBase,
|
||||
public ::testing::TestWithParam<Idct8x8Param> {
|
||||
class InvTrans8x8DCT : public FwdTrans8x8TestBase,
|
||||
public ::testing::TestWithParam<Idct8x8Param> {
|
||||
public:
|
||||
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_12, 0, VPX_BITS_12)));
|
||||
#else
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, FwdTrans8x8DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c, 0, VPX_BITS_8)));
|
||||
INSTANTIATE_TEST_CASE_P(C, FwdTrans8x8DCT,
|
||||
::testing::Values(make_tuple(&vpx_fdct8x8_c,
|
||||
&vpx_idct8x8_64_add_c, 0,
|
||||
VPX_BITS_8)));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
@ -697,11 +663,10 @@ INSTANTIATE_TEST_CASE_P(
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
#if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, FwdTrans8x8DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct8x8_neon, &vpx_idct8x8_64_add_neon, 0,
|
||||
VPX_BITS_8)));
|
||||
INSTANTIATE_TEST_CASE_P(NEON, FwdTrans8x8DCT,
|
||||
::testing::Values(make_tuple(&vpx_fdct8x8_neon,
|
||||
&vpx_idct8x8_64_add_neon,
|
||||
0, VPX_BITS_8)));
|
||||
#endif // HAVE_NEON_ASM && !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
|
||||
|
||||
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, FwdTrans8x8DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct8x8_sse2, &vpx_idct8x8_64_add_sse2, 0,
|
||||
VPX_BITS_8)));
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, FwdTrans8x8DCT,
|
||||
::testing::Values(make_tuple(&vpx_fdct8x8_sse2,
|
||||
&vpx_idct8x8_64_add_sse2,
|
||||
0, VPX_BITS_8)));
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, FwdTrans8x8HT,
|
||||
::testing::Values(
|
||||
@ -732,16 +696,16 @@ INSTANTIATE_TEST_CASE_P(
|
||||
#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, FwdTrans8x8DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct8x8_sse2, &vpx_idct8x8_64_add_c, 0, VPX_BITS_8),
|
||||
make_tuple(&vpx_highbd_fdct8x8_c,
|
||||
&idct8x8_64_add_10_sse2, 12, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_fdct8x8_sse2,
|
||||
&idct8x8_64_add_10_sse2, 12, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_fdct8x8_c,
|
||||
&idct8x8_64_add_12_sse2, 12, VPX_BITS_12),
|
||||
make_tuple(&vpx_highbd_fdct8x8_sse2,
|
||||
&idct8x8_64_add_12_sse2, 12, VPX_BITS_12)));
|
||||
::testing::Values(make_tuple(&vpx_fdct8x8_sse2, &vpx_idct8x8_64_add_c, 0,
|
||||
VPX_BITS_8),
|
||||
make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_64_add_10_sse2,
|
||||
12, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_fdct8x8_sse2,
|
||||
&idct8x8_64_add_10_sse2, 12, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_64_add_12_sse2,
|
||||
12, VPX_BITS_12),
|
||||
make_tuple(&vpx_highbd_fdct8x8_sse2,
|
||||
&idct8x8_64_add_12_sse2, 12, VPX_BITS_12)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, FwdTrans8x8HT,
|
||||
@ -756,30 +720,27 @@ INSTANTIATE_TEST_CASE_P(
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, InvTrans8x8DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&idct8x8_10_add_10_c,
|
||||
&idct8x8_10_add_10_sse2, 6225, VPX_BITS_10),
|
||||
make_tuple(&idct8x8_10,
|
||||
&idct8x8_64_add_10_sse2, 6225, VPX_BITS_10),
|
||||
make_tuple(&idct8x8_10_add_12_c,
|
||||
&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_10_add_10_c, &idct8x8_10_add_10_sse2, 6225,
|
||||
VPX_BITS_10),
|
||||
make_tuple(&idct8x8_10, &idct8x8_64_add_10_sse2, 6225, VPX_BITS_10),
|
||||
make_tuple(&idct8x8_10_add_12_c, &idct8x8_10_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
|
||||
|
||||
#if HAVE_SSSE3 && ARCH_X86_64 && \
|
||||
!CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSSE3, FwdTrans8x8DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct8x8_ssse3, &vpx_idct8x8_64_add_ssse3, 0,
|
||||
VPX_BITS_8)));
|
||||
#if HAVE_SSSE3 && ARCH_X86_64 && !CONFIG_VP9_HIGHBITDEPTH && \
|
||||
!CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(SSSE3, FwdTrans8x8DCT,
|
||||
::testing::Values(make_tuple(&vpx_fdct8x8_ssse3,
|
||||
&vpx_idct8x8_64_add_ssse3,
|
||||
0, VPX_BITS_8)));
|
||||
#endif
|
||||
|
||||
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, FwdTrans8x8DCT,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct8x8_msa, &vpx_idct8x8_64_add_msa, 0, VPX_BITS_8)));
|
||||
INSTANTIATE_TEST_CASE_P(MSA, FwdTrans8x8DCT,
|
||||
::testing::Values(make_tuple(&vpx_fdct8x8_msa,
|
||||
&vpx_idct8x8_64_add_msa, 0,
|
||||
VPX_BITS_8)));
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, FwdTrans8x8HT,
|
||||
::testing::Values(
|
||||
|
@ -13,12 +13,11 @@
|
||||
|
||||
namespace {
|
||||
|
||||
class VP9FrameSizeTestsLarge
|
||||
: public ::libvpx_test::EncoderTest,
|
||||
public ::testing::Test {
|
||||
class VP9FrameSizeTestsLarge : public ::libvpx_test::EncoderTest,
|
||||
public ::testing::Test {
|
||||
protected:
|
||||
VP9FrameSizeTestsLarge() : EncoderTest(&::libvpx_test::kVP9),
|
||||
expected_res_(VPX_CODEC_OK) {}
|
||||
VP9FrameSizeTestsLarge()
|
||||
: EncoderTest(&::libvpx_test::kVP9), expected_res_(VPX_CODEC_OK) {}
|
||||
virtual ~VP9FrameSizeTestsLarge() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
@ -27,7 +26,7 @@ class VP9FrameSizeTestsLarge
|
||||
}
|
||||
|
||||
virtual bool HandleDecodeResult(const vpx_codec_err_t res_dec,
|
||||
const libvpx_test::VideoSource& /*video*/,
|
||||
const libvpx_test::VideoSource & /*video*/,
|
||||
libvpx_test::Decoder *decoder) {
|
||||
EXPECT_EQ(expected_res_, res_dec) << decoder->DecodeError();
|
||||
return !::testing::Test::HasFailure();
|
||||
@ -67,13 +66,13 @@ TEST_F(VP9FrameSizeTestsLarge, ValidSizes) {
|
||||
expected_res_ = VPX_CODEC_OK;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
#else
|
||||
// This test produces a pretty large single frame allocation, (roughly
|
||||
// 25 megabits). The encoder allocates a good number of these frames
|
||||
// one for each lag in frames (for 2 pass), and then one for each possible
|
||||
// reference buffer (8) - we can end up with up to 30 buffers of roughly this
|
||||
// size or almost 1 gig of memory.
|
||||
// In total the allocations will exceed 2GiB which may cause a failure with
|
||||
// mingw + wine, use a smaller size in that case.
|
||||
// This test produces a pretty large single frame allocation, (roughly
|
||||
// 25 megabits). The encoder allocates a good number of these frames
|
||||
// one for each lag in frames (for 2 pass), and then one for each possible
|
||||
// reference buffer (8) - we can end up with up to 30 buffers of roughly this
|
||||
// size or almost 1 gig of memory.
|
||||
// In total the allocations will exceed 2GiB which may cause a failure with
|
||||
// mingw + wine, use a smaller size in that case.
|
||||
#if defined(_WIN32) && !defined(_WIN64) || defined(__OS2__)
|
||||
video.SetSize(4096, 3072);
|
||||
#else
|
||||
|
@ -80,8 +80,8 @@ void reference_hadamard16x16(const int16_t *a, int a_stride, int16_t *b) {
|
||||
const int16_t b3 = (a2 - a3) >> 1;
|
||||
|
||||
/* Store a 16 bit value. */
|
||||
b[ 0] = b0 + b2;
|
||||
b[ 64] = b1 + b3;
|
||||
b[0] = b0 + b2;
|
||||
b[64] = b1 + b3;
|
||||
b[128] = b0 - b2;
|
||||
b[192] = b1 - b3;
|
||||
|
||||
|
@ -21,14 +21,11 @@ namespace libvpx_test {
|
||||
// so that we can do actual file encodes.
|
||||
class I420VideoSource : public YUVVideoSource {
|
||||
public:
|
||||
I420VideoSource(const std::string &file_name,
|
||||
unsigned int width, unsigned int height,
|
||||
int rate_numerator, int rate_denominator,
|
||||
I420VideoSource(const std::string &file_name, unsigned int width,
|
||||
unsigned int height, int rate_numerator, int rate_denominator,
|
||||
unsigned int start, int limit)
|
||||
: YUVVideoSource(file_name, VPX_IMG_FMT_I420,
|
||||
width, height,
|
||||
rate_numerator, rate_denominator,
|
||||
start, limit) {}
|
||||
: YUVVideoSource(file_name, VPX_IMG_FMT_I420, width, height,
|
||||
rate_numerator, rate_denominator, start, limit) {}
|
||||
};
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
@ -29,9 +29,8 @@ void reference_dct_1d(double input[8], double output[8]) {
|
||||
for (int k = 0; k < 8; k++) {
|
||||
output[k] = 0.0;
|
||||
for (int n = 0; n < 8; n++)
|
||||
output[k] += input[n]*cos(kPi*(2*n+1)*k/16.0);
|
||||
if (k == 0)
|
||||
output[k] = output[k]*kInvSqrt2;
|
||||
output[k] += input[n] * cos(kPi * (2 * n + 1) * k / 16.0);
|
||||
if (k == 0) output[k] = output[k] * kInvSqrt2;
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,24 +38,19 @@ void reference_dct_2d(int16_t input[64], double output[64]) {
|
||||
// First transform columns
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
double temp_in[8], temp_out[8];
|
||||
for (int j = 0; j < 8; ++j)
|
||||
temp_in[j] = input[j*8 + i];
|
||||
for (int j = 0; j < 8; ++j) temp_in[j] = input[j * 8 + i];
|
||||
reference_dct_1d(temp_in, temp_out);
|
||||
for (int j = 0; j < 8; ++j)
|
||||
output[j*8 + i] = temp_out[j];
|
||||
for (int j = 0; j < 8; ++j) output[j * 8 + i] = temp_out[j];
|
||||
}
|
||||
// Then transform rows
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
double temp_in[8], temp_out[8];
|
||||
for (int j = 0; j < 8; ++j)
|
||||
temp_in[j] = output[j + i*8];
|
||||
for (int j = 0; j < 8; ++j) temp_in[j] = output[j + i * 8];
|
||||
reference_dct_1d(temp_in, temp_out);
|
||||
for (int j = 0; j < 8; ++j)
|
||||
output[j + i*8] = temp_out[j];
|
||||
for (int j = 0; j < 8; ++j) output[j + i * 8] = temp_out[j];
|
||||
}
|
||||
// Scale by some magic number
|
||||
for (int i = 0; i < 64; ++i)
|
||||
output[i] *= 2;
|
||||
for (int i = 0; i < 64; ++i) output[i] *= 2;
|
||||
}
|
||||
|
||||
TEST(VP9Idct8x8Test, AccuracyCheck) {
|
||||
@ -73,8 +67,7 @@ TEST(VP9Idct8x8Test, AccuracyCheck) {
|
||||
dst[j] = rnd.Rand8();
|
||||
}
|
||||
// Initialize a test block with input range [-255, 255].
|
||||
for (int j = 0; j < 64; ++j)
|
||||
input[j] = src[j] - dst[j];
|
||||
for (int j = 0; j < 64; ++j) input[j] = src[j] - dst[j];
|
||||
|
||||
reference_dct_2d(input, output_r);
|
||||
for (int j = 0; j < 64; ++j)
|
||||
@ -83,9 +76,8 @@ TEST(VP9Idct8x8Test, AccuracyCheck) {
|
||||
for (int j = 0; j < 64; ++j) {
|
||||
const int diff = dst[j] - src[j];
|
||||
const int error = diff * diff;
|
||||
EXPECT_GE(1, error)
|
||||
<< "Error: 8x8 FDCT/IDCT has error " << error
|
||||
<< " at index " << j;
|
||||
EXPECT_GE(1, error) << "Error: 8x8 FDCT/IDCT has error " << error
|
||||
<< " at index " << j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,21 +34,19 @@ std::ostream &operator<<(std::ostream &os, const DecodeParam &dp) {
|
||||
return os << "threads: " << dp.threads << " file: " << dp.filename;
|
||||
}
|
||||
|
||||
class InvalidFileTest
|
||||
: public ::libvpx_test::DecoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<DecodeParam> {
|
||||
class InvalidFileTest : public ::libvpx_test::DecoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<DecodeParam> {
|
||||
protected:
|
||||
InvalidFileTest() : DecoderTest(GET_PARAM(0)), res_file_(NULL) {}
|
||||
|
||||
virtual ~InvalidFileTest() {
|
||||
if (res_file_ != NULL)
|
||||
fclose(res_file_);
|
||||
if (res_file_ != NULL) fclose(res_file_);
|
||||
}
|
||||
|
||||
void OpenResFile(const std::string &res_file_name_) {
|
||||
res_file_ = libvpx_test::OpenTestDataFile(res_file_name_);
|
||||
ASSERT_TRUE(res_file_ != NULL) << "Result file open failed. Filename: "
|
||||
<< res_file_name_;
|
||||
<< res_file_name_;
|
||||
}
|
||||
|
||||
virtual bool HandleDecodeResult(
|
||||
@ -72,8 +70,9 @@ class InvalidFileTest
|
||||
EXPECT_TRUE(res_dec == expected_res_dec ||
|
||||
res_dec == VPX_CODEC_CORRUPT_FRAME)
|
||||
<< "Results don't match: frame number = " << video.frame_number()
|
||||
<< ". (" << decoder->DecodeError() << "). Expected: "
|
||||
<< expected_res_dec << " or " << VPX_CODEC_CORRUPT_FRAME;
|
||||
<< ". (" << decoder->DecodeError()
|
||||
<< "). Expected: " << expected_res_dec << " or "
|
||||
<< VPX_CODEC_CORRUPT_FRAME;
|
||||
} else {
|
||||
EXPECT_EQ(expected_res_dec, res_dec)
|
||||
<< "Results don't match: frame number = " << video.frame_number()
|
||||
@ -119,25 +118,23 @@ class InvalidFileTest
|
||||
FILE *res_file_;
|
||||
};
|
||||
|
||||
TEST_P(InvalidFileTest, ReturnCode) {
|
||||
RunTest();
|
||||
}
|
||||
TEST_P(InvalidFileTest, ReturnCode) { RunTest(); }
|
||||
|
||||
const DecodeParam kVP9InvalidFileTests[] = {
|
||||
{1, "invalid-vp90-02-v2.webm"},
|
||||
{ 1, "invalid-vp90-02-v2.webm" },
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
{1, "invalid-vp90-2-00-quantizer-00.webm.ivf.s5861_r01-05_b6-.v2.ivf"},
|
||||
{ 1, "invalid-vp90-2-00-quantizer-00.webm.ivf.s5861_r01-05_b6-.v2.ivf" },
|
||||
#endif
|
||||
{1, "invalid-vp90-03-v3.webm"},
|
||||
{1, "invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-.ivf"},
|
||||
{1, "invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-z.ivf"},
|
||||
{1, "invalid-vp90-2-12-droppable_1.ivf.s3676_r01-05_b6-.ivf"},
|
||||
{1, "invalid-vp90-2-05-resize.ivf.s59293_r01-05_b6-.ivf"},
|
||||
{1, "invalid-vp90-2-09-subpixel-00.ivf.s20492_r01-05_b6-.v2.ivf"},
|
||||
{1, "invalid-vp91-2-mixedrefcsp-444to420.ivf"},
|
||||
{1, "invalid-vp90-2-12-droppable_1.ivf.s73804_r01-05_b6-.ivf"},
|
||||
{1, "invalid-vp90-2-03-size-224x196.webm.ivf.s44156_r01-05_b6-.ivf"},
|
||||
{1, "invalid-vp90-2-03-size-202x210.webm.ivf.s113306_r01-05_b6-.ivf"},
|
||||
{ 1, "invalid-vp90-03-v3.webm" },
|
||||
{ 1, "invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-.ivf" },
|
||||
{ 1, "invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-z.ivf" },
|
||||
{ 1, "invalid-vp90-2-12-droppable_1.ivf.s3676_r01-05_b6-.ivf" },
|
||||
{ 1, "invalid-vp90-2-05-resize.ivf.s59293_r01-05_b6-.ivf" },
|
||||
{ 1, "invalid-vp90-2-09-subpixel-00.ivf.s20492_r01-05_b6-.v2.ivf" },
|
||||
{ 1, "invalid-vp91-2-mixedrefcsp-444to420.ivf" },
|
||||
{ 1, "invalid-vp90-2-12-droppable_1.ivf.s73804_r01-05_b6-.ivf" },
|
||||
{ 1, "invalid-vp90-2-03-size-224x196.webm.ivf.s44156_r01-05_b6-.ivf" },
|
||||
{ 1, "invalid-vp90-2-03-size-202x210.webm.ivf.s113306_r01-05_b6-.ivf" },
|
||||
};
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(InvalidFileTest,
|
||||
@ -149,34 +146,34 @@ class InvalidFileInvalidPeekTest : public InvalidFileTest {
|
||||
protected:
|
||||
InvalidFileInvalidPeekTest() : InvalidFileTest() {}
|
||||
virtual void HandlePeekResult(libvpx_test::Decoder *const /*decoder*/,
|
||||
libvpx_test::CompressedVideoSource* /*video*/,
|
||||
libvpx_test::CompressedVideoSource * /*video*/,
|
||||
const vpx_codec_err_t /*res_peek*/) {}
|
||||
};
|
||||
|
||||
TEST_P(InvalidFileInvalidPeekTest, ReturnCode) {
|
||||
RunTest();
|
||||
}
|
||||
TEST_P(InvalidFileInvalidPeekTest, ReturnCode) { RunTest(); }
|
||||
|
||||
const DecodeParam kVP9InvalidFileInvalidPeekTests[] = {
|
||||
{1, "invalid-vp90-01-v3.webm"},
|
||||
{ 1, "invalid-vp90-01-v3.webm" },
|
||||
};
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(InvalidFileInvalidPeekTest,
|
||||
::testing::ValuesIn(kVP9InvalidFileInvalidPeekTests));
|
||||
|
||||
const DecodeParam kMultiThreadedVP9InvalidFileTests[] = {
|
||||
{4, "invalid-vp90-2-08-tile_1x4_frame_parallel_all_key.webm"},
|
||||
{4, "invalid-"
|
||||
"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"},
|
||||
{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-08-tile_1x4_frame_parallel_all_key.webm" },
|
||||
{ 4,
|
||||
"invalid-"
|
||||
"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" },
|
||||
{ 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" },
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
VP9MultiThreaded, InvalidFileTest,
|
||||
::testing::Combine(
|
||||
::testing::Values(
|
||||
static_cast<const libvpx_test::CodecFactory*>(&libvpx_test::kVP9)),
|
||||
static_cast<const libvpx_test::CodecFactory *>(&libvpx_test::kVP9)),
|
||||
::testing::ValuesIn(kMultiThreadedVP9InvalidFileTests)));
|
||||
} // namespace
|
||||
|
@ -29,19 +29,13 @@ static unsigned int MemGetLe32(const uint8_t *mem) {
|
||||
class IVFVideoSource : public CompressedVideoSource {
|
||||
public:
|
||||
explicit IVFVideoSource(const std::string &file_name)
|
||||
: file_name_(file_name),
|
||||
input_file_(NULL),
|
||||
compressed_frame_buf_(NULL),
|
||||
frame_sz_(0),
|
||||
frame_(0),
|
||||
end_of_file_(false) {
|
||||
}
|
||||
: file_name_(file_name), input_file_(NULL), compressed_frame_buf_(NULL),
|
||||
frame_sz_(0), frame_(0), end_of_file_(false) {}
|
||||
|
||||
virtual ~IVFVideoSource() {
|
||||
delete[] compressed_frame_buf_;
|
||||
|
||||
if (input_file_)
|
||||
fclose(input_file_);
|
||||
if (input_file_) fclose(input_file_);
|
||||
}
|
||||
|
||||
virtual void Init() {
|
||||
@ -54,15 +48,16 @@ class IVFVideoSource : public CompressedVideoSource {
|
||||
virtual void Begin() {
|
||||
input_file_ = OpenTestDataFile(file_name_);
|
||||
ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: "
|
||||
<< file_name_;
|
||||
<< file_name_;
|
||||
|
||||
// Read file header
|
||||
uint8_t file_hdr[kIvfFileHdrSize];
|
||||
ASSERT_EQ(kIvfFileHdrSize, fread(file_hdr, 1, kIvfFileHdrSize, input_file_))
|
||||
<< "File header read failed.";
|
||||
// Check file header
|
||||
ASSERT_TRUE(file_hdr[0] == 'D' && file_hdr[1] == 'K' && file_hdr[2] == 'I'
|
||||
&& file_hdr[3] == 'F') << "Input is not an IVF file.";
|
||||
ASSERT_TRUE(file_hdr[0] == 'D' && file_hdr[1] == 'K' &&
|
||||
file_hdr[2] == 'I' && file_hdr[3] == 'F')
|
||||
<< "Input is not an IVF file.";
|
||||
|
||||
FillFrame();
|
||||
}
|
||||
@ -76,8 +71,8 @@ class IVFVideoSource : public CompressedVideoSource {
|
||||
ASSERT_TRUE(input_file_ != NULL);
|
||||
uint8_t frame_hdr[kIvfFrameHdrSize];
|
||||
// Check frame header and read a frame from input_file.
|
||||
if (fread(frame_hdr, 1, kIvfFrameHdrSize, input_file_)
|
||||
!= kIvfFrameHdrSize) {
|
||||
if (fread(frame_hdr, 1, kIvfFrameHdrSize, input_file_) !=
|
||||
kIvfFrameHdrSize) {
|
||||
end_of_file_ = true;
|
||||
} else {
|
||||
end_of_file_ = false;
|
||||
|
@ -17,8 +17,9 @@
|
||||
|
||||
namespace {
|
||||
|
||||
class KeyframeTest : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
class KeyframeTest
|
||||
: public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
protected:
|
||||
KeyframeTest() : EncoderTest(GET_PARAM(0)) {}
|
||||
virtual ~KeyframeTest() {}
|
||||
@ -65,8 +66,7 @@ TEST_P(KeyframeTest, TestRandomVideoSource) {
|
||||
|
||||
// In realtime mode - auto placed keyframes are exceedingly rare, don't
|
||||
// bother with this check if(GetParam() > 0)
|
||||
if (GET_PARAM(1) > 0)
|
||||
EXPECT_GT(kf_count_, 1);
|
||||
if (GET_PARAM(1) > 0) EXPECT_GT(kf_count_, 1);
|
||||
}
|
||||
|
||||
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
|
||||
// on very slow environments (like Valgrind). The step -11 was determined
|
||||
// experimentally as the fastest mode that still throws the keyframe.
|
||||
if (deadline_ == VPX_DL_REALTIME)
|
||||
set_cpu_used_ = -11;
|
||||
if (deadline_ == VPX_DL_REALTIME) set_cpu_used_ = -11;
|
||||
|
||||
// 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
|
||||
@ -135,7 +134,7 @@ TEST_P(KeyframeTest, TestAutoKeyframe) {
|
||||
iter != kf_pts_list_.end(); ++iter) {
|
||||
if (deadline_ == VPX_DL_REALTIME && *iter > 0)
|
||||
EXPECT_EQ(0, (*iter - 1) % 30) << "Unexpected keyframe at frame "
|
||||
<< *iter;
|
||||
<< *iter;
|
||||
else
|
||||
EXPECT_EQ(0, *iter % 30) << "Unexpected keyframe at frame " << *iter;
|
||||
}
|
||||
|
@ -19,12 +19,9 @@ class LevelTest
|
||||
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
|
||||
protected:
|
||||
LevelTest()
|
||||
: EncoderTest(GET_PARAM(0)),
|
||||
encoding_mode_(GET_PARAM(1)),
|
||||
cpu_used_(GET_PARAM(2)),
|
||||
min_gf_internal_(24),
|
||||
target_level_(0),
|
||||
level_(0) {}
|
||||
: EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)),
|
||||
cpu_used_(GET_PARAM(2)), min_gf_internal_(24), target_level_(0),
|
||||
level_(0) {}
|
||||
virtual ~LevelTest() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
|
@ -36,8 +36,7 @@ const int number_of_iterations = 10000;
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
typedef void (*loop_op_t)(uint16_t *s, int p, const uint8_t *blimit,
|
||||
const uint8_t *limit, const uint8_t *thresh,
|
||||
int bd);
|
||||
const uint8_t *limit, const uint8_t *thresh, int bd);
|
||||
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 *blimit1, const uint8_t *limit1,
|
||||
@ -108,21 +107,18 @@ TEST_P(Loop8Test6Param, OperationCheck) {
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
int err_count = 0;
|
||||
uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4));
|
||||
DECLARE_ALIGNED(16, const uint8_t, blimit[16]) = {
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp
|
||||
};
|
||||
DECLARE_ALIGNED(16, const uint8_t,
|
||||
blimit[16]) = { 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));
|
||||
DECLARE_ALIGNED(16, const uint8_t, limit[16]) = {
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp
|
||||
};
|
||||
DECLARE_ALIGNED(16, const uint8_t,
|
||||
limit[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
|
||||
tmp = rnd.Rand8();
|
||||
DECLARE_ALIGNED(16, const uint8_t, thresh[16]) = {
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp
|
||||
};
|
||||
int32_t p = kNumCoeffs/32;
|
||||
DECLARE_ALIGNED(16, const uint8_t,
|
||||
thresh[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
|
||||
int32_t p = kNumCoeffs / 32;
|
||||
|
||||
uint16_t tmp_s[kNumCoeffs];
|
||||
int j = 0;
|
||||
@ -158,7 +154,7 @@ TEST_P(Loop8Test6Param, OperationCheck) {
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh, bd));
|
||||
#else
|
||||
ref_loopfilter_op_(ref_s+8+p*8, p, blimit, limit, thresh);
|
||||
ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit, limit, thresh);
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
@ -206,20 +202,17 @@ TEST_P(Loop8Test6Param, ValueCheck) {
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
int err_count = 0;
|
||||
uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4));
|
||||
DECLARE_ALIGNED(16, const uint8_t, blimit[16]) = {
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp
|
||||
};
|
||||
DECLARE_ALIGNED(16, const uint8_t,
|
||||
blimit[16]) = { 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));
|
||||
DECLARE_ALIGNED(16, const uint8_t, limit[16]) = {
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp
|
||||
};
|
||||
DECLARE_ALIGNED(16, const uint8_t,
|
||||
limit[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
|
||||
tmp = rnd.Rand8();
|
||||
DECLARE_ALIGNED(16, const uint8_t, thresh[16]) = {
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp
|
||||
};
|
||||
DECLARE_ALIGNED(16, const uint8_t,
|
||||
thresh[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
|
||||
int32_t p = kNumCoeffs / 32;
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
s[j] = rnd.Rand16() & mask_;
|
||||
@ -230,7 +223,7 @@ TEST_P(Loop8Test6Param, ValueCheck) {
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh, bd));
|
||||
#else
|
||||
ref_loopfilter_op_(ref_s+8+p*8, p, blimit, limit, thresh);
|
||||
ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit, limit, thresh);
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
@ -256,43 +249,37 @@ TEST_P(Loop8Test9Param, OperationCheck) {
|
||||
DECLARE_ALIGNED(16, uint16_t, s[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint16_t, ref_s[kNumCoeffs]);
|
||||
#else
|
||||
DECLARE_ALIGNED(8, uint8_t, s[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(8, uint8_t, ref_s[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(8, uint8_t, s[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(8, uint8_t, ref_s[kNumCoeffs]);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
int err_count_total = 0;
|
||||
int first_failure = -1;
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
int err_count = 0;
|
||||
uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4));
|
||||
DECLARE_ALIGNED(16, const uint8_t, blimit0[16]) = {
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp
|
||||
};
|
||||
DECLARE_ALIGNED(16, const uint8_t,
|
||||
blimit0[16]) = { 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));
|
||||
DECLARE_ALIGNED(16, const uint8_t, limit0[16]) = {
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp
|
||||
};
|
||||
DECLARE_ALIGNED(16, const uint8_t,
|
||||
limit0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
|
||||
tmp = rnd.Rand8();
|
||||
DECLARE_ALIGNED(16, const uint8_t, thresh0[16]) = {
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp
|
||||
};
|
||||
DECLARE_ALIGNED(16, const uint8_t,
|
||||
thresh0[16]) = { 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));
|
||||
DECLARE_ALIGNED(16, const uint8_t, blimit1[16]) = {
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp
|
||||
};
|
||||
DECLARE_ALIGNED(16, const uint8_t,
|
||||
blimit1[16]) = { 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));
|
||||
DECLARE_ALIGNED(16, const uint8_t, limit1[16]) = {
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp
|
||||
};
|
||||
DECLARE_ALIGNED(16, const uint8_t,
|
||||
limit1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
|
||||
tmp = rnd.Rand8();
|
||||
DECLARE_ALIGNED(16, const uint8_t, thresh1[16]) = {
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp
|
||||
};
|
||||
DECLARE_ALIGNED(16, const uint8_t,
|
||||
thresh1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
|
||||
int32_t p = kNumCoeffs / 32;
|
||||
uint16_t tmp_s[kNumCoeffs];
|
||||
int j = 0;
|
||||
@ -325,17 +312,16 @@ TEST_P(Loop8Test9Param, OperationCheck) {
|
||||
ref_s[j] = s[j];
|
||||
}
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0,
|
||||
blimit1, limit1, thresh1, bd);
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0, thresh0,
|
||||
blimit1, limit1, thresh1, bd));
|
||||
ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, blimit1,
|
||||
limit1, thresh1, bd);
|
||||
ASM_REGISTER_STATE_CHECK(loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0,
|
||||
thresh0, blimit1, limit1, thresh1,
|
||||
bd));
|
||||
#else
|
||||
ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0,
|
||||
blimit1, limit1, thresh1);
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0, thresh0,
|
||||
blimit1, limit1, thresh1));
|
||||
ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, blimit1,
|
||||
limit1, thresh1);
|
||||
ASM_REGISTER_STATE_CHECK(loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0,
|
||||
thresh0, blimit1, limit1, thresh1));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
err_count += ref_s[j] != s[j];
|
||||
@ -358,43 +344,37 @@ TEST_P(Loop8Test9Param, ValueCheck) {
|
||||
DECLARE_ALIGNED(16, uint16_t, s[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(16, uint16_t, ref_s[kNumCoeffs]);
|
||||
#else
|
||||
DECLARE_ALIGNED(8, uint8_t, s[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(8, uint8_t, ref_s[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(8, uint8_t, s[kNumCoeffs]);
|
||||
DECLARE_ALIGNED(8, uint8_t, ref_s[kNumCoeffs]);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
int err_count_total = 0;
|
||||
int first_failure = -1;
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
int err_count = 0;
|
||||
uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4));
|
||||
DECLARE_ALIGNED(16, const uint8_t, blimit0[16]) = {
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp
|
||||
};
|
||||
DECLARE_ALIGNED(16, const uint8_t,
|
||||
blimit0[16]) = { 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));
|
||||
DECLARE_ALIGNED(16, const uint8_t, limit0[16]) = {
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp
|
||||
};
|
||||
DECLARE_ALIGNED(16, const uint8_t,
|
||||
limit0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
|
||||
tmp = rnd.Rand8();
|
||||
DECLARE_ALIGNED(16, const uint8_t, thresh0[16]) = {
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp
|
||||
};
|
||||
DECLARE_ALIGNED(16, const uint8_t,
|
||||
thresh0[16]) = { 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));
|
||||
DECLARE_ALIGNED(16, const uint8_t, blimit1[16]) = {
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp
|
||||
};
|
||||
DECLARE_ALIGNED(16, const uint8_t,
|
||||
blimit1[16]) = { 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));
|
||||
DECLARE_ALIGNED(16, const uint8_t, limit1[16]) = {
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp
|
||||
};
|
||||
DECLARE_ALIGNED(16, const uint8_t,
|
||||
limit1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
|
||||
tmp = rnd.Rand8();
|
||||
DECLARE_ALIGNED(16, const uint8_t, thresh1[16]) = {
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
|
||||
tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp
|
||||
};
|
||||
DECLARE_ALIGNED(16, const uint8_t,
|
||||
thresh1[16]) = { 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?
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
s[j] = rnd.Rand16() & mask_;
|
||||
@ -402,17 +382,16 @@ TEST_P(Loop8Test9Param, ValueCheck) {
|
||||
}
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
const int32_t bd = bit_depth_;
|
||||
ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0,
|
||||
blimit1, limit1, thresh1, bd);
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0,
|
||||
thresh0, blimit1, limit1, thresh1, bd));
|
||||
ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, blimit1,
|
||||
limit1, thresh1, bd);
|
||||
ASM_REGISTER_STATE_CHECK(loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0,
|
||||
thresh0, blimit1, limit1, thresh1,
|
||||
bd));
|
||||
#else
|
||||
ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0,
|
||||
blimit1, limit1, thresh1);
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0, thresh0,
|
||||
blimit1, limit1, thresh1));
|
||||
ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, blimit1,
|
||||
limit1, thresh1);
|
||||
ASM_REGISTER_STATE_CHECK(loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0,
|
||||
thresh0, blimit1, limit1, thresh1));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
for (int j = 0; j < kNumCoeffs; ++j) {
|
||||
err_count += ref_s[j] != s[j];
|
||||
@ -434,129 +413,120 @@ using std::tr1::make_tuple;
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Loop8Test6Param,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_4_sse2,
|
||||
&vpx_highbd_lpf_horizontal_4_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_4_sse2,
|
||||
&vpx_highbd_lpf_vertical_4_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_8_sse2,
|
||||
&vpx_highbd_lpf_horizontal_8_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_edge_8_sse2,
|
||||
&vpx_highbd_lpf_horizontal_edge_8_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_edge_16_sse2,
|
||||
&vpx_highbd_lpf_horizontal_edge_16_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_8_sse2,
|
||||
&vpx_highbd_lpf_vertical_8_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_16_sse2,
|
||||
&vpx_highbd_lpf_vertical_16_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_4_sse2,
|
||||
&vpx_highbd_lpf_horizontal_4_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_4_sse2,
|
||||
&vpx_highbd_lpf_vertical_4_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_8_sse2,
|
||||
&vpx_highbd_lpf_horizontal_8_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_edge_8_sse2,
|
||||
&vpx_highbd_lpf_horizontal_edge_8_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_edge_16_sse2,
|
||||
&vpx_highbd_lpf_horizontal_edge_16_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_8_sse2,
|
||||
&vpx_highbd_lpf_vertical_8_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_16_sse2,
|
||||
&vpx_highbd_lpf_vertical_16_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_4_sse2,
|
||||
&vpx_highbd_lpf_horizontal_4_c, 12),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_4_sse2,
|
||||
&vpx_highbd_lpf_vertical_4_c, 12),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_8_sse2,
|
||||
&vpx_highbd_lpf_horizontal_8_c, 12),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_edge_8_sse2,
|
||||
&vpx_highbd_lpf_horizontal_edge_8_c, 12),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_edge_16_sse2,
|
||||
&vpx_highbd_lpf_horizontal_edge_16_c, 12),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_8_sse2,
|
||||
&vpx_highbd_lpf_vertical_8_c, 12),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_16_sse2,
|
||||
&vpx_highbd_lpf_vertical_16_c, 12),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_16_dual_sse2,
|
||||
&vpx_highbd_lpf_vertical_16_dual_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_16_dual_sse2,
|
||||
&vpx_highbd_lpf_vertical_16_dual_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_16_dual_sse2,
|
||||
&vpx_highbd_lpf_vertical_16_dual_c, 12)));
|
||||
::testing::Values(make_tuple(&vpx_highbd_lpf_horizontal_4_sse2,
|
||||
&vpx_highbd_lpf_horizontal_4_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_4_sse2,
|
||||
&vpx_highbd_lpf_vertical_4_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_8_sse2,
|
||||
&vpx_highbd_lpf_horizontal_8_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_edge_8_sse2,
|
||||
&vpx_highbd_lpf_horizontal_edge_8_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_edge_16_sse2,
|
||||
&vpx_highbd_lpf_horizontal_edge_16_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_8_sse2,
|
||||
&vpx_highbd_lpf_vertical_8_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_16_sse2,
|
||||
&vpx_highbd_lpf_vertical_16_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_4_sse2,
|
||||
&vpx_highbd_lpf_horizontal_4_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_4_sse2,
|
||||
&vpx_highbd_lpf_vertical_4_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_8_sse2,
|
||||
&vpx_highbd_lpf_horizontal_8_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_edge_8_sse2,
|
||||
&vpx_highbd_lpf_horizontal_edge_8_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_edge_16_sse2,
|
||||
&vpx_highbd_lpf_horizontal_edge_16_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_8_sse2,
|
||||
&vpx_highbd_lpf_vertical_8_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_16_sse2,
|
||||
&vpx_highbd_lpf_vertical_16_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_4_sse2,
|
||||
&vpx_highbd_lpf_horizontal_4_c, 12),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_4_sse2,
|
||||
&vpx_highbd_lpf_vertical_4_c, 12),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_8_sse2,
|
||||
&vpx_highbd_lpf_horizontal_8_c, 12),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_edge_8_sse2,
|
||||
&vpx_highbd_lpf_horizontal_edge_8_c, 12),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_edge_16_sse2,
|
||||
&vpx_highbd_lpf_horizontal_edge_16_c, 12),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_8_sse2,
|
||||
&vpx_highbd_lpf_vertical_8_c, 12),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_16_sse2,
|
||||
&vpx_highbd_lpf_vertical_16_c, 12),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_16_dual_sse2,
|
||||
&vpx_highbd_lpf_vertical_16_dual_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_16_dual_sse2,
|
||||
&vpx_highbd_lpf_vertical_16_dual_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_16_dual_sse2,
|
||||
&vpx_highbd_lpf_vertical_16_dual_c, 12)));
|
||||
#else
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Loop8Test6Param,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_lpf_horizontal_4_sse2,
|
||||
&vpx_lpf_horizontal_4_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_8_sse2,
|
||||
&vpx_lpf_horizontal_8_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_4_sse2, &vpx_lpf_horizontal_4_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_8_sse2, &vpx_lpf_horizontal_8_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_edge_8_sse2,
|
||||
&vpx_lpf_horizontal_edge_8_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_edge_16_sse2,
|
||||
&vpx_lpf_horizontal_edge_16_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_4_sse2,
|
||||
&vpx_lpf_vertical_4_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_8_sse2,
|
||||
&vpx_lpf_vertical_8_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_16_sse2,
|
||||
&vpx_lpf_vertical_16_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_16_dual_sse2,
|
||||
&vpx_lpf_vertical_16_dual_c, 8)));
|
||||
make_tuple(&vpx_lpf_vertical_4_sse2, &vpx_lpf_vertical_4_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_8_sse2, &vpx_lpf_vertical_8_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_16_sse2, &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
|
||||
|
||||
#if HAVE_AVX2 && (!CONFIG_VP9_HIGHBITDEPTH)
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
AVX2, Loop8Test6Param,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_lpf_horizontal_edge_8_avx2,
|
||||
&vpx_lpf_horizontal_edge_8_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_edge_16_avx2,
|
||||
&vpx_lpf_horizontal_edge_16_c, 8)));
|
||||
::testing::Values(make_tuple(&vpx_lpf_horizontal_edge_8_avx2,
|
||||
&vpx_lpf_horizontal_edge_8_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_edge_16_avx2,
|
||||
&vpx_lpf_horizontal_edge_16_c, 8)));
|
||||
#endif
|
||||
|
||||
#if HAVE_SSE2
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Loop8Test9Param,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_4_dual_sse2,
|
||||
&vpx_highbd_lpf_horizontal_4_dual_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_8_dual_sse2,
|
||||
&vpx_highbd_lpf_horizontal_8_dual_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_4_dual_sse2,
|
||||
&vpx_highbd_lpf_vertical_4_dual_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_8_dual_sse2,
|
||||
&vpx_highbd_lpf_vertical_8_dual_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_4_dual_sse2,
|
||||
&vpx_highbd_lpf_horizontal_4_dual_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_8_dual_sse2,
|
||||
&vpx_highbd_lpf_horizontal_8_dual_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_4_dual_sse2,
|
||||
&vpx_highbd_lpf_vertical_4_dual_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_8_dual_sse2,
|
||||
&vpx_highbd_lpf_vertical_8_dual_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_4_dual_sse2,
|
||||
&vpx_highbd_lpf_horizontal_4_dual_c, 12),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_8_dual_sse2,
|
||||
&vpx_highbd_lpf_horizontal_8_dual_c, 12),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_4_dual_sse2,
|
||||
&vpx_highbd_lpf_vertical_4_dual_c, 12),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_8_dual_sse2,
|
||||
&vpx_highbd_lpf_vertical_8_dual_c, 12)));
|
||||
::testing::Values(make_tuple(&vpx_highbd_lpf_horizontal_4_dual_sse2,
|
||||
&vpx_highbd_lpf_horizontal_4_dual_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_8_dual_sse2,
|
||||
&vpx_highbd_lpf_horizontal_8_dual_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_4_dual_sse2,
|
||||
&vpx_highbd_lpf_vertical_4_dual_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_8_dual_sse2,
|
||||
&vpx_highbd_lpf_vertical_8_dual_c, 8),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_4_dual_sse2,
|
||||
&vpx_highbd_lpf_horizontal_4_dual_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_8_dual_sse2,
|
||||
&vpx_highbd_lpf_horizontal_8_dual_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_4_dual_sse2,
|
||||
&vpx_highbd_lpf_vertical_4_dual_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_8_dual_sse2,
|
||||
&vpx_highbd_lpf_vertical_8_dual_c, 10),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_4_dual_sse2,
|
||||
&vpx_highbd_lpf_horizontal_4_dual_c, 12),
|
||||
make_tuple(&vpx_highbd_lpf_horizontal_8_dual_sse2,
|
||||
&vpx_highbd_lpf_horizontal_8_dual_c, 12),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_4_dual_sse2,
|
||||
&vpx_highbd_lpf_vertical_4_dual_c, 12),
|
||||
make_tuple(&vpx_highbd_lpf_vertical_8_dual_sse2,
|
||||
&vpx_highbd_lpf_vertical_8_dual_c, 12)));
|
||||
#else
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, Loop8Test9Param,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_lpf_horizontal_4_dual_sse2,
|
||||
&vpx_lpf_horizontal_4_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_8_dual_sse2,
|
||||
&vpx_lpf_horizontal_8_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_4_dual_sse2,
|
||||
&vpx_lpf_vertical_4_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_8_dual_sse2,
|
||||
&vpx_lpf_vertical_8_dual_c, 8)));
|
||||
::testing::Values(make_tuple(&vpx_lpf_horizontal_4_dual_sse2,
|
||||
&vpx_lpf_horizontal_4_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_8_dual_sse2,
|
||||
&vpx_lpf_horizontal_8_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_4_dual_sse2,
|
||||
&vpx_lpf_vertical_4_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_8_dual_sse2,
|
||||
&vpx_lpf_vertical_8_dual_c, 8)));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif
|
||||
|
||||
@ -567,39 +537,33 @@ INSTANTIATE_TEST_CASE_P(
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, Loop8Test6Param,
|
||||
::testing::Values(
|
||||
#if HAVE_NEON_ASM
|
||||
// Using #if inside the macro is unsupported on MSVS but the tests are not
|
||||
// currently built for MSVS with ARM and NEON.
|
||||
#if HAVE_NEON_ASM
|
||||
make_tuple(&vpx_lpf_horizontal_edge_8_neon,
|
||||
&vpx_lpf_horizontal_edge_8_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_edge_16_neon,
|
||||
&vpx_lpf_horizontal_edge_16_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_16_neon,
|
||||
&vpx_lpf_vertical_16_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_16_dual_neon,
|
||||
&vpx_lpf_vertical_16_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_16_neon, &vpx_lpf_vertical_16_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_16_dual_neon, &vpx_lpf_vertical_16_dual_c,
|
||||
8),
|
||||
#endif // HAVE_NEON_ASM
|
||||
make_tuple(&vpx_lpf_horizontal_8_neon,
|
||||
&vpx_lpf_horizontal_8_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_8_neon,
|
||||
&vpx_lpf_vertical_8_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_4_neon,
|
||||
&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(
|
||||
make_tuple(&vpx_lpf_horizontal_8_neon, &vpx_lpf_horizontal_8_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_8_neon, &vpx_lpf_vertical_8_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_4_neon, &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(
|
||||
#if HAVE_NEON_ASM
|
||||
make_tuple(&vpx_lpf_horizontal_8_dual_neon,
|
||||
&vpx_lpf_horizontal_8_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_8_dual_neon,
|
||||
&vpx_lpf_vertical_8_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_8_dual_neon,
|
||||
&vpx_lpf_horizontal_8_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_8_dual_neon,
|
||||
&vpx_lpf_vertical_8_dual_c, 8),
|
||||
#endif // HAVE_NEON_ASM
|
||||
make_tuple(&vpx_lpf_horizontal_4_dual_neon,
|
||||
&vpx_lpf_horizontal_4_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_4_dual_neon,
|
||||
&vpx_lpf_vertical_4_dual_c, 8)));
|
||||
make_tuple(&vpx_lpf_horizontal_4_dual_neon,
|
||||
&vpx_lpf_horizontal_4_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_4_dual_neon,
|
||||
&vpx_lpf_vertical_4_dual_c, 8)));
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // HAVE_NEON
|
||||
|
||||
@ -607,66 +571,52 @@ INSTANTIATE_TEST_CASE_P(
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
DSPR2, Loop8Test6Param,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_lpf_horizontal_4_dspr2,
|
||||
&vpx_lpf_horizontal_4_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_8_dspr2,
|
||||
&vpx_lpf_horizontal_8_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_edge_8,
|
||||
&vpx_lpf_horizontal_edge_8, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_edge_16,
|
||||
&vpx_lpf_horizontal_edge_16, 8),
|
||||
make_tuple(&vpx_lpf_vertical_4_dspr2,
|
||||
&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)));
|
||||
make_tuple(&vpx_lpf_horizontal_4_dspr2, &vpx_lpf_horizontal_4_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_8_dspr2, &vpx_lpf_horizontal_8_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_edge_8, &vpx_lpf_horizontal_edge_8, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_edge_16, &vpx_lpf_horizontal_edge_16, 8),
|
||||
make_tuple(&vpx_lpf_vertical_4_dspr2, &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(
|
||||
DSPR2, Loop8Test9Param,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_lpf_horizontal_4_dual_dspr2,
|
||||
&vpx_lpf_horizontal_4_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_8_dual_dspr2,
|
||||
&vpx_lpf_horizontal_8_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_4_dual_dspr2,
|
||||
&vpx_lpf_vertical_4_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_8_dual_dspr2,
|
||||
&vpx_lpf_vertical_8_dual_c, 8)));
|
||||
::testing::Values(make_tuple(&vpx_lpf_horizontal_4_dual_dspr2,
|
||||
&vpx_lpf_horizontal_4_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_8_dual_dspr2,
|
||||
&vpx_lpf_horizontal_8_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_4_dual_dspr2,
|
||||
&vpx_lpf_vertical_4_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_8_dual_dspr2,
|
||||
&vpx_lpf_vertical_8_dual_c, 8)));
|
||||
#endif // HAVE_DSPR2 && !CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
#if HAVE_MSA && (!CONFIG_VP9_HIGHBITDEPTH)
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, Loop8Test6Param,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_lpf_horizontal_4_msa,
|
||||
&vpx_lpf_horizontal_4_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_8_msa,
|
||||
&vpx_lpf_horizontal_8_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_edge_8_msa,
|
||||
&vpx_lpf_horizontal_edge_8_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_4_msa, &vpx_lpf_horizontal_4_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_8_msa, &vpx_lpf_horizontal_8_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_edge_8_msa, &vpx_lpf_horizontal_edge_8_c,
|
||||
8),
|
||||
make_tuple(&vpx_lpf_horizontal_edge_16_msa,
|
||||
&vpx_lpf_horizontal_edge_16_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_4_msa,
|
||||
&vpx_lpf_vertical_4_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_8_msa,
|
||||
&vpx_lpf_vertical_8_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_16_msa,
|
||||
&vpx_lpf_vertical_16_c, 8)));
|
||||
make_tuple(&vpx_lpf_vertical_4_msa, &vpx_lpf_vertical_4_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_8_msa, &vpx_lpf_vertical_8_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_16_msa, &vpx_lpf_vertical_16_c, 8)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, Loop8Test9Param,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_lpf_horizontal_4_dual_msa,
|
||||
&vpx_lpf_horizontal_4_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_8_dual_msa,
|
||||
&vpx_lpf_horizontal_8_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_4_dual_msa,
|
||||
&vpx_lpf_vertical_4_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_8_dual_msa,
|
||||
&vpx_lpf_vertical_8_dual_c, 8)));
|
||||
::testing::Values(make_tuple(&vpx_lpf_horizontal_4_dual_msa,
|
||||
&vpx_lpf_horizontal_4_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_horizontal_8_dual_msa,
|
||||
&vpx_lpf_horizontal_8_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_4_dual_msa,
|
||||
&vpx_lpf_vertical_4_dual_c, 8),
|
||||
make_tuple(&vpx_lpf_vertical_8_dual_msa,
|
||||
&vpx_lpf_vertical_8_dual_c, 8)));
|
||||
#endif // HAVE_MSA && (!CONFIG_VP9_HIGHBITDEPTH)
|
||||
|
||||
} // namespace
|
||||
|
@ -17,9 +17,7 @@
|
||||
namespace libvpx_test {
|
||||
class MD5 {
|
||||
public:
|
||||
MD5() {
|
||||
MD5Init(&md5_);
|
||||
}
|
||||
MD5() { MD5Init(&md5_); }
|
||||
|
||||
void Add(const vpx_image_t *img) {
|
||||
for (int plane = 0; plane < 3; ++plane) {
|
||||
@ -30,10 +28,13 @@ class MD5 {
|
||||
// This works only for chroma_shift of 0 and 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) >>
|
||||
img->y_chroma_shift : img->d_h;
|
||||
const int w = (plane ? (img->d_w + img->x_chroma_shift) >>
|
||||
img->x_chroma_shift : img->d_w) * bytes_per_sample;
|
||||
const int h =
|
||||
plane ? (img->d_h + img->y_chroma_shift) >> img->y_chroma_shift
|
||||
: img->d_h;
|
||||
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) {
|
||||
MD5Update(&md5_, buf, w);
|
||||
@ -56,8 +57,8 @@ class MD5 {
|
||||
|
||||
MD5Final(tmp, &ctx_tmp);
|
||||
for (int i = 0; i < 16; i++) {
|
||||
res_[i * 2 + 0] = hex[tmp[i] >> 4];
|
||||
res_[i * 2 + 1] = hex[tmp[i] & 0xf];
|
||||
res_[i * 2 + 0] = hex[tmp[i] >> 4];
|
||||
res_[i * 2 + 1] = hex[tmp[i] & 0xf];
|
||||
}
|
||||
res_[32] = 0;
|
||||
|
||||
|
@ -23,9 +23,8 @@ namespace {
|
||||
|
||||
using ::libvpx_test::ACMRandom;
|
||||
|
||||
typedef void (*MinMaxFunc)(const uint8_t *a, int a_stride,
|
||||
const uint8_t *b, int b_stride,
|
||||
int *min, int *max);
|
||||
typedef void (*MinMaxFunc)(const uint8_t *a, int a_stride, const uint8_t *b,
|
||||
int b_stride, int *min, int *max);
|
||||
|
||||
class MinMaxTest : public ::testing::TestWithParam<MinMaxFunc> {
|
||||
public:
|
||||
@ -39,9 +38,8 @@ class MinMaxTest : public ::testing::TestWithParam<MinMaxFunc> {
|
||||
ACMRandom rnd_;
|
||||
};
|
||||
|
||||
void reference_minmax(const uint8_t *a, int a_stride,
|
||||
const uint8_t *b, int b_stride,
|
||||
int *min_ret, int *max_ret) {
|
||||
void reference_minmax(const uint8_t *a, int a_stride, const uint8_t *b,
|
||||
int b_stride, int *min_ret, int *max_ret) {
|
||||
int min = 255;
|
||||
int max = 0;
|
||||
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);
|
||||
ASM_REGISTER_STATE_CHECK(mm_func_(a, a_stride, b, b_stride, &min, &max));
|
||||
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
|
||||
<< " and b_stride = " << b_stride;;
|
||||
<< " and b_stride = " << b_stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,10 +29,8 @@ using libvpx_test::ACMRandom;
|
||||
namespace {
|
||||
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 std::tr1::tuple<FwdTxfmFunc,
|
||||
InvTxfmFunc,
|
||||
InvTxfmFunc,
|
||||
TX_SIZE, int> PartialInvTxfmParam;
|
||||
typedef std::tr1::tuple<FwdTxfmFunc, InvTxfmFunc, InvTxfmFunc, TX_SIZE, int>
|
||||
PartialInvTxfmParam;
|
||||
const int kMaxNumCoeffs = 1024;
|
||||
class PartialIDctTest : public ::testing::TestWithParam<PartialInvTxfmParam> {
|
||||
public:
|
||||
@ -41,7 +39,7 @@ class PartialIDctTest : public ::testing::TestWithParam<PartialInvTxfmParam> {
|
||||
ftxfm_ = GET_PARAM(0);
|
||||
full_itxfm_ = GET_PARAM(1);
|
||||
partial_itxfm_ = GET_PARAM(2);
|
||||
tx_size_ = GET_PARAM(3);
|
||||
tx_size_ = GET_PARAM(3);
|
||||
last_nonzero_ = GET_PARAM(4);
|
||||
}
|
||||
|
||||
@ -59,21 +57,11 @@ TEST_P(PartialIDctTest, RunQuantCheck) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
int size;
|
||||
switch (tx_size_) {
|
||||
case TX_4X4:
|
||||
size = 4;
|
||||
break;
|
||||
case TX_8X8:
|
||||
size = 8;
|
||||
break;
|
||||
case TX_16X16:
|
||||
size = 16;
|
||||
break;
|
||||
case TX_32X32:
|
||||
size = 32;
|
||||
break;
|
||||
default:
|
||||
FAIL() << "Wrong Size!";
|
||||
break;
|
||||
case TX_4X4: size = 4; break;
|
||||
case TX_8X8: size = 8; 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_block2[kMaxNumCoeffs]);
|
||||
@ -99,11 +87,9 @@ TEST_P(PartialIDctTest, RunQuantCheck) {
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
// Initialize a test block with input range [-255, 255].
|
||||
if (i == 0) {
|
||||
for (int j = 0; j < block_size; ++j)
|
||||
input_extreme_block[j] = 255;
|
||||
for (int j = 0; j < block_size; ++j) input_extreme_block[j] = 255;
|
||||
} else if (i == 1) {
|
||||
for (int j = 0; j < block_size; ++j)
|
||||
input_extreme_block[j] = -255;
|
||||
for (int j = 0; j < block_size; ++j) input_extreme_block[j] = -255;
|
||||
} else {
|
||||
for (int j = 0; j < block_size; ++j) {
|
||||
input_extreme_block[j] = rnd.Rand8() % 2 ? 255 : -255;
|
||||
@ -115,8 +101,8 @@ TEST_P(PartialIDctTest, RunQuantCheck) {
|
||||
// quantization with maximum allowed step sizes
|
||||
test_coef_block1[0] = (output_ref_block[0] / 1336) * 1336;
|
||||
for (int j = 1; j < last_nonzero_; ++j)
|
||||
test_coef_block1[vp9_default_scan_orders[tx_size_].scan[j]]
|
||||
= (output_ref_block[j] / 1828) * 1828;
|
||||
test_coef_block1[vp9_default_scan_orders[tx_size_].scan[j]] =
|
||||
(output_ref_block[j] / 1828) * 1828;
|
||||
}
|
||||
|
||||
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) {
|
||||
const int diff = dst1[j] - dst2[j];
|
||||
const int error = diff * diff;
|
||||
if (max_error < error)
|
||||
max_error = error;
|
||||
if (max_error < error) max_error = error;
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,21 +123,11 @@ TEST_P(PartialIDctTest, ResultsMatch) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
int size;
|
||||
switch (tx_size_) {
|
||||
case TX_4X4:
|
||||
size = 4;
|
||||
break;
|
||||
case TX_8X8:
|
||||
size = 8;
|
||||
break;
|
||||
case TX_16X16:
|
||||
size = 16;
|
||||
break;
|
||||
case TX_32X32:
|
||||
size = 32;
|
||||
break;
|
||||
default:
|
||||
FAIL() << "Wrong Size!";
|
||||
break;
|
||||
case TX_4X4: size = 4; break;
|
||||
case TX_8X8: size = 8; 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_block2[kMaxNumCoeffs]);
|
||||
@ -189,8 +164,7 @@ TEST_P(PartialIDctTest, ResultsMatch) {
|
||||
for (int j = 0; j < block_size; ++j) {
|
||||
const int diff = dst1[j] - dst2[j];
|
||||
const int error = diff * diff;
|
||||
if (max_error < error)
|
||||
max_error = error;
|
||||
if (max_error < error) max_error = error;
|
||||
}
|
||||
}
|
||||
|
||||
@ -201,143 +175,82 @@ using std::tr1::make_tuple;
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, PartialIDctTest,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct32x32_c,
|
||||
&vpx_idct32x32_1024_add_c,
|
||||
&vpx_idct32x32_34_add_c,
|
||||
TX_32X32, 34),
|
||||
make_tuple(&vpx_fdct32x32_c,
|
||||
&vpx_idct32x32_1024_add_c,
|
||||
&vpx_idct32x32_1_add_c,
|
||||
TX_32X32, 1),
|
||||
make_tuple(&vpx_fdct16x16_c,
|
||||
&vpx_idct16x16_256_add_c,
|
||||
&vpx_idct16x16_10_add_c,
|
||||
TX_16X16, 10),
|
||||
make_tuple(&vpx_fdct16x16_c,
|
||||
&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)));
|
||||
::testing::Values(make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c,
|
||||
&vpx_idct32x32_34_add_c, TX_32X32, 34),
|
||||
make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c,
|
||||
&vpx_idct32x32_1_add_c, TX_32X32, 1),
|
||||
make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c,
|
||||
&vpx_idct16x16_10_add_c, TX_16X16, 10),
|
||||
make_tuple(&vpx_fdct16x16_c, &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
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, PartialIDctTest,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct32x32_c,
|
||||
&vpx_idct32x32_1024_add_c,
|
||||
&vpx_idct32x32_1_add_neon,
|
||||
TX_32X32, 1),
|
||||
make_tuple(&vpx_fdct16x16_c,
|
||||
&vpx_idct16x16_256_add_c,
|
||||
&vpx_idct16x16_10_add_neon,
|
||||
TX_16X16, 10),
|
||||
make_tuple(&vpx_fdct16x16_c,
|
||||
&vpx_idct16x16_256_add_c,
|
||||
&vpx_idct16x16_1_add_neon,
|
||||
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)));
|
||||
::testing::Values(make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c,
|
||||
&vpx_idct32x32_1_add_neon, TX_32X32, 1),
|
||||
make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c,
|
||||
&vpx_idct16x16_10_add_neon, TX_16X16, 10),
|
||||
make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c,
|
||||
&vpx_idct16x16_1_add_neon, 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
|
||||
|
||||
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, PartialIDctTest,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct32x32_c,
|
||||
&vpx_idct32x32_1024_add_c,
|
||||
&vpx_idct32x32_34_add_sse2,
|
||||
TX_32X32, 34),
|
||||
make_tuple(&vpx_fdct32x32_c,
|
||||
&vpx_idct32x32_1024_add_c,
|
||||
&vpx_idct32x32_1_add_sse2,
|
||||
TX_32X32, 1),
|
||||
make_tuple(&vpx_fdct16x16_c,
|
||||
&vpx_idct16x16_256_add_c,
|
||||
&vpx_idct16x16_10_add_sse2,
|
||||
TX_16X16, 10),
|
||||
make_tuple(&vpx_fdct16x16_c,
|
||||
&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)));
|
||||
::testing::Values(make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c,
|
||||
&vpx_idct32x32_34_add_sse2, TX_32X32, 34),
|
||||
make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c,
|
||||
&vpx_idct32x32_1_add_sse2, TX_32X32, 1),
|
||||
make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c,
|
||||
&vpx_idct16x16_10_add_sse2, TX_16X16, 10),
|
||||
make_tuple(&vpx_fdct16x16_c, &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
|
||||
|
||||
#if HAVE_SSSE3 && ARCH_X86_64 && \
|
||||
!CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
#if HAVE_SSSE3 && ARCH_X86_64 && !CONFIG_VP9_HIGHBITDEPTH && \
|
||||
!CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSSE3_64, PartialIDctTest,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct8x8_c,
|
||||
&vpx_idct8x8_64_add_c,
|
||||
&vpx_idct8x8_12_add_ssse3,
|
||||
TX_8X8, 12)));
|
||||
::testing::Values(make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c,
|
||||
&vpx_idct8x8_12_add_ssse3, TX_8X8, 12)));
|
||||
#endif
|
||||
|
||||
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, PartialIDctTest,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_fdct32x32_c,
|
||||
&vpx_idct32x32_1024_add_c,
|
||||
&vpx_idct32x32_34_add_msa,
|
||||
TX_32X32, 34),
|
||||
make_tuple(&vpx_fdct32x32_c,
|
||||
&vpx_idct32x32_1024_add_c,
|
||||
&vpx_idct32x32_1_add_msa,
|
||||
TX_32X32, 1),
|
||||
make_tuple(&vpx_fdct16x16_c,
|
||||
&vpx_idct16x16_256_add_c,
|
||||
&vpx_idct16x16_10_add_msa,
|
||||
TX_16X16, 10),
|
||||
make_tuple(&vpx_fdct16x16_c,
|
||||
&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)));
|
||||
::testing::Values(make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c,
|
||||
&vpx_idct32x32_34_add_msa, TX_32X32, 34),
|
||||
make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c,
|
||||
&vpx_idct32x32_1_add_msa, TX_32X32, 1),
|
||||
make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c,
|
||||
&vpx_idct16x16_10_add_msa, TX_16X16, 10),
|
||||
make_tuple(&vpx_fdct16x16_c, &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
|
||||
|
||||
} // namespace
|
||||
|
@ -15,22 +15,16 @@
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
typedef void (*PostProcFunc)(unsigned char *src_ptr,
|
||||
unsigned char *dst_ptr,
|
||||
int src_pixels_per_line,
|
||||
int dst_pixels_per_line,
|
||||
int cols,
|
||||
unsigned char *flimit,
|
||||
int size);
|
||||
typedef void (*PostProcFunc)(unsigned char *src_ptr, unsigned char *dst_ptr,
|
||||
int src_pixels_per_line, int dst_pixels_per_line,
|
||||
int cols, unsigned char *flimit, int size);
|
||||
|
||||
namespace {
|
||||
|
||||
class VPxPostProcessingFilterTest
|
||||
: public ::testing::TestWithParam<PostProcFunc> {
|
||||
public:
|
||||
virtual void TearDown() {
|
||||
libvpx_test::ClearSystemState();
|
||||
}
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
};
|
||||
|
||||
// Test routine for the VPx post-processing function
|
||||
@ -38,7 +32,7 @@ class VPxPostProcessingFilterTest
|
||||
|
||||
TEST_P(VPxPostProcessingFilterTest, FilterOutputCheck) {
|
||||
// Size of the underlying data block that will be filtered.
|
||||
const int block_width = 16;
|
||||
const int block_width = 16;
|
||||
const int block_height = 16;
|
||||
|
||||
// 5-tap filter needs 2 padding rows above and below the block in the input.
|
||||
@ -54,9 +48,9 @@ TEST_P(VPxPostProcessingFilterTest, FilterOutputCheck) {
|
||||
const int output_size = output_width * output_height;
|
||||
|
||||
uint8_t *const src_image =
|
||||
reinterpret_cast<uint8_t*>(vpx_calloc(input_size, 1));
|
||||
reinterpret_cast<uint8_t *>(vpx_calloc(input_size, 1));
|
||||
uint8_t *const dst_image =
|
||||
reinterpret_cast<uint8_t*>(vpx_calloc(output_size, 1));
|
||||
reinterpret_cast<uint8_t *>(vpx_calloc(output_size, 1));
|
||||
|
||||
// Pointers to top-left pixel of block in the input and output images.
|
||||
uint8_t *const src_image_ptr = src_image + (input_stride << 1);
|
||||
@ -80,13 +74,12 @@ TEST_P(VPxPostProcessingFilterTest, FilterOutputCheck) {
|
||||
// Initialize pixels in the output to 99.
|
||||
(void)memset(dst_image, 99, output_size);
|
||||
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
GetParam()(src_image_ptr, dst_image_ptr, input_stride,
|
||||
output_stride, block_width, flimits, 16));
|
||||
ASM_REGISTER_STATE_CHECK(GetParam()(src_image_ptr, dst_image_ptr,
|
||||
input_stride, output_stride, block_width,
|
||||
flimits, 16));
|
||||
|
||||
static const uint8_t expected_data[block_height] = {
|
||||
4, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4
|
||||
};
|
||||
static const uint8_t expected_data[block_height] = { 4, 3, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 3, 4 };
|
||||
|
||||
pixel_ptr = dst_image_ptr;
|
||||
for (int i = 0; i < block_height; ++i) {
|
||||
@ -102,16 +95,19 @@ TEST_P(VPxPostProcessingFilterTest, FilterOutputCheck) {
|
||||
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));
|
||||
|
||||
#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));
|
||||
#endif
|
||||
|
||||
#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));
|
||||
#endif
|
||||
|
||||
|
@ -23,8 +23,7 @@ class RealtimeTest
|
||||
: public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
protected:
|
||||
RealtimeTest()
|
||||
: EncoderTest(GET_PARAM(0)), frame_packets_(0) {}
|
||||
RealtimeTest() : EncoderTest(GET_PARAM(0)), frame_packets_(0) {}
|
||||
virtual ~RealtimeTest() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include <windows.h>
|
||||
#include <winnt.h>
|
||||
|
||||
inline bool operator==(const M128A& lhs, const M128A& rhs) {
|
||||
inline bool operator==(const M128A &lhs, const M128A &rhs) {
|
||||
return (lhs.Low == rhs.Low && lhs.High == rhs.High);
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ class RegisterStateCheck {
|
||||
~RegisterStateCheck() { Check(); }
|
||||
|
||||
private:
|
||||
static bool StoreRegisters(CONTEXT* const context) {
|
||||
static bool StoreRegisters(CONTEXT *const context) {
|
||||
const HANDLE this_thread = GetCurrentThread();
|
||||
EXPECT_TRUE(this_thread != NULL);
|
||||
context->ContextFlags = CONTEXT_FLOATING_POINT;
|
||||
@ -66,8 +66,8 @@ class RegisterStateCheck {
|
||||
CONTEXT post_context;
|
||||
ASSERT_TRUE(StoreRegisters(&post_context));
|
||||
|
||||
const M128A* xmm_pre = &pre_context_.Xmm6;
|
||||
const M128A* xmm_post = &post_context.Xmm6;
|
||||
const M128A *xmm_pre = &pre_context_.Xmm6;
|
||||
const M128A *xmm_post = &post_context.Xmm6;
|
||||
for (int i = 6; i <= 15; ++i) {
|
||||
EXPECT_EQ(*xmm_pre, *xmm_post) << "xmm" << i << " has been modified!";
|
||||
++xmm_pre;
|
||||
@ -79,15 +79,16 @@ class RegisterStateCheck {
|
||||
CONTEXT pre_context_;
|
||||
};
|
||||
|
||||
#define ASM_REGISTER_STATE_CHECK(statement) do { \
|
||||
libvpx_test::RegisterStateCheck reg_check; \
|
||||
statement; \
|
||||
} while (false)
|
||||
#define ASM_REGISTER_STATE_CHECK(statement) \
|
||||
do { \
|
||||
libvpx_test::RegisterStateCheck reg_check; \
|
||||
statement; \
|
||||
} while (false)
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
||||
#elif defined(CONFIG_SHARED) && defined(HAVE_NEON_ASM) && defined(CONFIG_VP9) \
|
||||
&& !CONFIG_SHARED && HAVE_NEON_ASM && CONFIG_VP9
|
||||
#elif defined(CONFIG_SHARED) && defined(HAVE_NEON_ASM) && \
|
||||
defined(CONFIG_VP9) && !CONFIG_SHARED && HAVE_NEON_ASM && CONFIG_VP9
|
||||
|
||||
extern "C" {
|
||||
// Save the d8-d15 registers into store.
|
||||
@ -110,18 +111,19 @@ class RegisterStateCheck {
|
||||
int64_t post_store[8];
|
||||
vpx_push_neon(post_store);
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
EXPECT_EQ(pre_store_[i], post_store[i]) << "d"
|
||||
<< i + 8 << " has been modified";
|
||||
EXPECT_EQ(pre_store_[i], post_store[i]) << "d" << i + 8
|
||||
<< " has been modified";
|
||||
}
|
||||
}
|
||||
|
||||
int64_t pre_store_[8];
|
||||
};
|
||||
|
||||
#define ASM_REGISTER_STATE_CHECK(statement) do { \
|
||||
libvpx_test::RegisterStateCheck reg_check; \
|
||||
statement; \
|
||||
} while (false)
|
||||
#define ASM_REGISTER_STATE_CHECK(statement) \
|
||||
do { \
|
||||
libvpx_test::RegisterStateCheck reg_check; \
|
||||
statement; \
|
||||
} while (false)
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
||||
@ -165,10 +167,11 @@ class RegisterStateCheckMMX {
|
||||
uint16_t pre_fpu_env_[14];
|
||||
};
|
||||
|
||||
#define API_REGISTER_STATE_CHECK(statement) do { \
|
||||
libvpx_test::RegisterStateCheckMMX reg_check; \
|
||||
ASM_REGISTER_STATE_CHECK(statement); \
|
||||
} while (false)
|
||||
#define API_REGISTER_STATE_CHECK(statement) \
|
||||
do { \
|
||||
libvpx_test::RegisterStateCheckMMX reg_check; \
|
||||
ASM_REGISTER_STATE_CHECK(statement); \
|
||||
} while (false)
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
||||
|
@ -44,9 +44,9 @@ static void write_ivf_file_header(const vpx_codec_enc_cfg_t *const cfg,
|
||||
header[1] = 'K';
|
||||
header[2] = 'I';
|
||||
header[3] = 'F';
|
||||
mem_put_le16(header + 4, 0); /* version */
|
||||
mem_put_le16(header + 6, 32); /* headersize */
|
||||
mem_put_le32(header + 8, 0x30395056); /* fourcc (vp9) */
|
||||
mem_put_le16(header + 4, 0); /* version */
|
||||
mem_put_le16(header + 6, 32); /* headersize */
|
||||
mem_put_le32(header + 8, 0x30395056); /* fourcc (vp9) */
|
||||
mem_put_le16(header + 12, cfg->g_w); /* width */
|
||||
mem_put_le16(header + 14, cfg->g_h); /* height */
|
||||
mem_put_le32(header + 16, cfg->g_timebase.den); /* rate */
|
||||
@ -68,8 +68,7 @@ static void write_ivf_frame_header(const vpx_codec_cx_pkt_t *const pkt,
|
||||
char header[12];
|
||||
vpx_codec_pts_t pts;
|
||||
|
||||
if (pkt->kind != VPX_CODEC_CX_FRAME_PKT)
|
||||
return;
|
||||
if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) return;
|
||||
|
||||
pts = pkt->data.frame.pts;
|
||||
mem_put_le32(header, static_cast<unsigned int>(pkt->data.frame.sz));
|
||||
@ -92,12 +91,9 @@ struct FrameInfo {
|
||||
unsigned int h;
|
||||
};
|
||||
|
||||
void ScaleForFrameNumber(unsigned int frame,
|
||||
unsigned int initial_w,
|
||||
unsigned int initial_h,
|
||||
unsigned int *w,
|
||||
unsigned int *h,
|
||||
int flag_codec) {
|
||||
void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
|
||||
unsigned int initial_h, unsigned int *w,
|
||||
unsigned int *h, int flag_codec) {
|
||||
if (frame < 10) {
|
||||
*w = initial_w;
|
||||
*h = initial_h;
|
||||
@ -219,7 +215,7 @@ void ScaleForFrameNumber(unsigned int frame,
|
||||
return;
|
||||
}
|
||||
if (frame < 250) {
|
||||
*w = initial_w / 2;
|
||||
*w = initial_w / 2;
|
||||
*h = initial_h / 2;
|
||||
return;
|
||||
}
|
||||
@ -268,8 +264,9 @@ class ResizingVideoSource : public ::libvpx_test::DummyVideoSource {
|
||||
}
|
||||
};
|
||||
|
||||
class ResizeTest : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
class ResizeTest
|
||||
: public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
protected:
|
||||
ResizeTest() : EncoderTest(GET_PARAM(0)) {}
|
||||
|
||||
@ -285,7 +282,7 @@ class ResizeTest : public ::libvpx_test::EncoderTest,
|
||||
frame_info_list_.push_back(FrameInfo(pts, img.d_w, img.d_h));
|
||||
}
|
||||
|
||||
std::vector< FrameInfo > frame_info_list_;
|
||||
std::vector<FrameInfo> frame_info_list_;
|
||||
};
|
||||
|
||||
TEST_P(ResizeTest, TestExternalResizeWorks) {
|
||||
@ -299,12 +296,12 @@ TEST_P(ResizeTest, TestExternalResizeWorks) {
|
||||
const unsigned int frame = static_cast<unsigned>(info->pts);
|
||||
unsigned int expected_w;
|
||||
unsigned int expected_h;
|
||||
ScaleForFrameNumber(frame, kInitialWidth, kInitialHeight,
|
||||
&expected_w, &expected_h, 0);
|
||||
EXPECT_EQ(expected_w, info->w)
|
||||
<< "Frame " << frame << " had unexpected width";
|
||||
EXPECT_EQ(expected_h, info->h)
|
||||
<< "Frame " << frame << " had unexpected height";
|
||||
ScaleForFrameNumber(frame, kInitialWidth, kInitialHeight, &expected_w,
|
||||
&expected_h, 0);
|
||||
EXPECT_EQ(expected_w, info->w) << "Frame " << frame
|
||||
<< " had unexpected width";
|
||||
EXPECT_EQ(expected_h, info->h) << "Frame " << frame
|
||||
<< " had unexpected height";
|
||||
}
|
||||
}
|
||||
|
||||
@ -315,10 +312,7 @@ class ResizeInternalTest : public ResizeTest {
|
||||
protected:
|
||||
#if WRITE_COMPRESSED_STREAM
|
||||
ResizeInternalTest()
|
||||
: ResizeTest(),
|
||||
frame0_psnr_(0.0),
|
||||
outfile_(NULL),
|
||||
out_frames_(0) {}
|
||||
: ResizeTest(), frame0_psnr_(0.0), outfile_(NULL), out_frames_(0) {}
|
||||
#else
|
||||
ResizeInternalTest() : ResizeTest(), frame0_psnr_(0.0) {}
|
||||
#endif
|
||||
@ -347,30 +341,29 @@ class ResizeInternalTest : public ResizeTest {
|
||||
if (change_config_) {
|
||||
int new_q = 60;
|
||||
if (video->frame() == 0) {
|
||||
struct vpx_scaling_mode mode = {VP8E_ONETWO, VP8E_ONETWO};
|
||||
struct vpx_scaling_mode mode = { VP8E_ONETWO, VP8E_ONETWO };
|
||||
encoder->Control(VP8E_SET_SCALEMODE, &mode);
|
||||
}
|
||||
if (video->frame() == 1) {
|
||||
struct vpx_scaling_mode mode = {VP8E_NORMAL, VP8E_NORMAL};
|
||||
struct vpx_scaling_mode mode = { VP8E_NORMAL, VP8E_NORMAL };
|
||||
encoder->Control(VP8E_SET_SCALEMODE, &mode);
|
||||
cfg_.rc_min_quantizer = cfg_.rc_max_quantizer = new_q;
|
||||
encoder->Config(&cfg_);
|
||||
}
|
||||
} else {
|
||||
if (video->frame() == kStepDownFrame) {
|
||||
struct vpx_scaling_mode mode = {VP8E_FOURFIVE, VP8E_THREEFIVE};
|
||||
struct vpx_scaling_mode mode = { VP8E_FOURFIVE, VP8E_THREEFIVE };
|
||||
encoder->Control(VP8E_SET_SCALEMODE, &mode);
|
||||
}
|
||||
if (video->frame() == kStepUpFrame) {
|
||||
struct vpx_scaling_mode mode = {VP8E_NORMAL, VP8E_NORMAL};
|
||||
struct vpx_scaling_mode mode = { VP8E_NORMAL, VP8E_NORMAL };
|
||||
encoder->Control(VP8E_SET_SCALEMODE, &mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
if (frame0_psnr_ == 0.)
|
||||
frame0_psnr_ = pkt->data.psnr.psnr[0];
|
||||
if (frame0_psnr_ == 0.) frame0_psnr_ = pkt->data.psnr.psnr[0];
|
||||
EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 2.0);
|
||||
}
|
||||
|
||||
@ -379,8 +372,7 @@ class ResizeInternalTest : public ResizeTest {
|
||||
++out_frames_;
|
||||
|
||||
// Write initial file header if first frame.
|
||||
if (pkt->data.frame.pts == 0)
|
||||
write_ivf_file_header(&cfg_, 0, outfile_);
|
||||
if (pkt->data.frame.pts == 0) write_ivf_file_header(&cfg_, 0, outfile_);
|
||||
|
||||
// Write frame header and data.
|
||||
write_ivf_frame_header(pkt, outfile_);
|
||||
@ -434,8 +426,9 @@ TEST_P(ResizeInternalTest, TestInternalResizeChangeConfig) {
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
}
|
||||
|
||||
class ResizeRealtimeTest : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
|
||||
class ResizeRealtimeTest
|
||||
: public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
|
||||
protected:
|
||||
ResizeRealtimeTest() : EncoderTest(GET_PARAM(0)) {}
|
||||
virtual ~ResizeRealtimeTest() {}
|
||||
@ -465,16 +458,13 @@ class ResizeRealtimeTest : public ::libvpx_test::EncoderTest,
|
||||
frame_info_list_.push_back(FrameInfo(pts, img.d_w, img.d_h));
|
||||
}
|
||||
|
||||
virtual void MismatchHook(const vpx_image_t *img1,
|
||||
const vpx_image_t *img2) {
|
||||
virtual void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2) {
|
||||
double mismatch_psnr = compute_psnr(img1, img2);
|
||||
mismatch_psnr_ += mismatch_psnr;
|
||||
++mismatch_nframes_;
|
||||
}
|
||||
|
||||
unsigned int GetMismatchFrames() {
|
||||
return mismatch_nframes_;
|
||||
}
|
||||
unsigned int GetMismatchFrames() { return mismatch_nframes_; }
|
||||
|
||||
void DefaultConfig() {
|
||||
cfg_.rc_buf_initial_sz = 500;
|
||||
@ -491,14 +481,14 @@ class ResizeRealtimeTest : public ::libvpx_test::EncoderTest,
|
||||
// Enable dropped frames.
|
||||
cfg_.rc_dropframe_thresh = 1;
|
||||
// Enable error_resilience mode.
|
||||
cfg_.g_error_resilient = 1;
|
||||
cfg_.g_error_resilient = 1;
|
||||
// Enable dynamic resizing.
|
||||
cfg_.rc_resize_allowed = 1;
|
||||
// Run at low bitrate.
|
||||
cfg_.rc_target_bitrate = 200;
|
||||
}
|
||||
|
||||
std::vector< FrameInfo > frame_info_list_;
|
||||
std::vector<FrameInfo> frame_info_list_;
|
||||
int set_cpu_used_;
|
||||
bool change_bitrate_;
|
||||
double mismatch_psnr_;
|
||||
@ -521,12 +511,12 @@ TEST_P(ResizeRealtimeTest, TestExternalResizeWorks) {
|
||||
const unsigned int frame = static_cast<unsigned>(info->pts);
|
||||
unsigned int expected_w;
|
||||
unsigned int expected_h;
|
||||
ScaleForFrameNumber(frame, kInitialWidth, kInitialHeight,
|
||||
&expected_w, &expected_h, 1);
|
||||
EXPECT_EQ(expected_w, info->w)
|
||||
<< "Frame " << frame << " had unexpected width";
|
||||
EXPECT_EQ(expected_h, info->h)
|
||||
<< "Frame " << frame << " had unexpected height";
|
||||
ScaleForFrameNumber(frame, kInitialWidth, kInitialHeight, &expected_w,
|
||||
&expected_h, 1);
|
||||
EXPECT_EQ(expected_w, info->w) << "Frame " << frame
|
||||
<< " had unexpected width";
|
||||
EXPECT_EQ(expected_h, info->h) << "Frame " << frame
|
||||
<< " had unexpected height";
|
||||
EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
|
||||
}
|
||||
}
|
||||
@ -618,10 +608,8 @@ TEST_P(ResizeRealtimeTest, TestInternalResizeDownUpChangeBitRate) {
|
||||
}
|
||||
|
||||
vpx_img_fmt_t CspForFrameNumber(int frame) {
|
||||
if (frame < 10)
|
||||
return VPX_IMG_FMT_I420;
|
||||
if (frame < 20)
|
||||
return VPX_IMG_FMT_I444;
|
||||
if (frame < 10) return VPX_IMG_FMT_I420;
|
||||
if (frame < 20) return VPX_IMG_FMT_I444;
|
||||
return VPX_IMG_FMT_I420;
|
||||
}
|
||||
|
||||
@ -629,10 +617,7 @@ class ResizeCspTest : public ResizeTest {
|
||||
protected:
|
||||
#if WRITE_COMPRESSED_STREAM
|
||||
ResizeCspTest()
|
||||
: ResizeTest(),
|
||||
frame0_psnr_(0.0),
|
||||
outfile_(NULL),
|
||||
out_frames_(0) {}
|
||||
: ResizeTest(), frame0_psnr_(0.0), outfile_(NULL), out_frames_(0) {}
|
||||
#else
|
||||
ResizeCspTest() : ResizeTest(), frame0_psnr_(0.0) {}
|
||||
#endif
|
||||
@ -671,8 +656,7 @@ class ResizeCspTest : public ResizeTest {
|
||||
}
|
||||
|
||||
virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
if (frame0_psnr_ == 0.)
|
||||
frame0_psnr_ = pkt->data.psnr.psnr[0];
|
||||
if (frame0_psnr_ == 0.) frame0_psnr_ = pkt->data.psnr.psnr[0];
|
||||
EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 2.0);
|
||||
}
|
||||
|
||||
@ -681,8 +665,7 @@ class ResizeCspTest : public ResizeTest {
|
||||
++out_frames_;
|
||||
|
||||
// Write initial file header if first frame.
|
||||
if (pkt->data.frame.pts == 0)
|
||||
write_ivf_file_header(&cfg_, 0, outfile_);
|
||||
if (pkt->data.frame.pts == 0) write_ivf_file_header(&cfg_, 0, outfile_);
|
||||
|
||||
// Write frame header and data.
|
||||
write_ivf_frame_header(pkt, outfile_);
|
||||
|
@ -8,7 +8,6 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
@ -25,7 +24,7 @@
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
#include "vpx_ports/mem.h"
|
||||
|
||||
template<typename Function>
|
||||
template <typename Function>
|
||||
struct TestParams {
|
||||
TestParams(int w, int h, Function f, int bd = -1)
|
||||
: width(w), height(h), bit_depth(bd), func(f) {}
|
||||
@ -50,24 +49,24 @@ typedef TestParams<SadMxNx4Func> SadMxNx4Param;
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
namespace {
|
||||
template<typename ParamType>
|
||||
template <typename ParamType>
|
||||
class SADTestBase : public ::testing::TestWithParam<ParamType> {
|
||||
public:
|
||||
explicit SADTestBase(const ParamType& params) : params_(params) {}
|
||||
explicit SADTestBase(const ParamType ¶ms) : params_(params) {}
|
||||
|
||||
virtual void SetUp() {
|
||||
source_data8_ = reinterpret_cast<uint8_t*>(
|
||||
source_data8_ = reinterpret_cast<uint8_t *>(
|
||||
vpx_memalign(kDataAlignment, kDataBlockSize));
|
||||
reference_data8_ = reinterpret_cast<uint8_t*>(
|
||||
reference_data8_ = reinterpret_cast<uint8_t *>(
|
||||
vpx_memalign(kDataAlignment, kDataBufferSize));
|
||||
second_pred8_ = reinterpret_cast<uint8_t*>(
|
||||
vpx_memalign(kDataAlignment, 64*64));
|
||||
source_data16_ = reinterpret_cast<uint16_t*>(
|
||||
vpx_memalign(kDataAlignment, kDataBlockSize*sizeof(uint16_t)));
|
||||
reference_data16_ = reinterpret_cast<uint16_t*>(
|
||||
vpx_memalign(kDataAlignment, kDataBufferSize*sizeof(uint16_t)));
|
||||
second_pred16_ = reinterpret_cast<uint16_t*>(
|
||||
vpx_memalign(kDataAlignment, 64*64*sizeof(uint16_t)));
|
||||
second_pred8_ =
|
||||
reinterpret_cast<uint8_t *>(vpx_memalign(kDataAlignment, 64 * 64));
|
||||
source_data16_ = reinterpret_cast<uint16_t *>(
|
||||
vpx_memalign(kDataAlignment, kDataBlockSize * sizeof(uint16_t)));
|
||||
reference_data16_ = reinterpret_cast<uint16_t *>(
|
||||
vpx_memalign(kDataAlignment, kDataBufferSize * sizeof(uint16_t)));
|
||||
second_pred16_ = reinterpret_cast<uint16_t *>(
|
||||
vpx_memalign(kDataAlignment, 64 * 64 * sizeof(uint16_t)));
|
||||
|
||||
if (params_.bit_depth == -1) {
|
||||
use_high_bit_depth_ = false;
|
||||
@ -167,13 +166,13 @@ class SADTestBase : public ::testing::TestWithParam<ParamType> {
|
||||
for (int w = 0; w < params_.width; ++w) {
|
||||
if (!use_high_bit_depth_) {
|
||||
const int tmp = second_pred8[h * params_.width + w] +
|
||||
reference8[h * reference_stride_ + w];
|
||||
reference8[h * reference_stride_ + w];
|
||||
const uint8_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
|
||||
sad += abs(source8[h * source_stride_ + w] - comp_pred);
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
} else {
|
||||
const int tmp = second_pred16[h * params_.width + w] +
|
||||
reference16[h * reference_stride_ + w];
|
||||
reference16[h * reference_stride_ + w];
|
||||
const uint16_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
|
||||
sad += abs(source16[h * source_stride_ + w] - comp_pred);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
@ -248,9 +247,8 @@ class SADx4Test : public SADTestBase<SadMxNx4Param> {
|
||||
const uint8_t *references[] = { GetReference(0), GetReference(1),
|
||||
GetReference(2), GetReference(3) };
|
||||
|
||||
ASM_REGISTER_STATE_CHECK(params_.func(source_data_, source_stride_,
|
||||
references, reference_stride_,
|
||||
results));
|
||||
ASM_REGISTER_STATE_CHECK(params_.func(
|
||||
source_data_, source_stride_, references, reference_stride_, results));
|
||||
}
|
||||
|
||||
void CheckSADs() const {
|
||||
@ -453,7 +451,7 @@ TEST_P(SADx4Test, ShortSrc) {
|
||||
}
|
||||
|
||||
TEST_P(SADx4Test, SrcAlignedByWidth) {
|
||||
uint8_t * tmp_source_data = source_data_;
|
||||
uint8_t *tmp_source_data = source_data_;
|
||||
source_data_ += params_.width;
|
||||
FillRandom(source_data_, source_stride_);
|
||||
FillRandom(GetReference(0), reference_stride_);
|
||||
|
@ -8,7 +8,6 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
|
||||
#include <math.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
@ -33,14 +32,10 @@ TEST(VP8RoiMapTest, ParameterCheck) {
|
||||
unsigned int threshold[MAX_MB_SEGMENTS] = { 0, 100, 200, 300 };
|
||||
|
||||
const int internalq_trans[] = {
|
||||
0, 1, 2, 3, 4, 5, 7, 8,
|
||||
9, 10, 12, 13, 15, 17, 18, 19,
|
||||
20, 21, 23, 24, 25, 26, 27, 28,
|
||||
29, 30, 31, 33, 35, 37, 39, 41,
|
||||
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,
|
||||
0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 12, 13, 15, 17, 18, 19,
|
||||
20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 35, 37, 39, 41,
|
||||
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.
|
||||
@ -60,17 +55,17 @@ TEST(VP8RoiMapTest, ParameterCheck) {
|
||||
|
||||
// Allocate memory for the source memory map.
|
||||
unsigned char *roi_map =
|
||||
reinterpret_cast<unsigned char *>(vpx_calloc(mbs, 1));
|
||||
reinterpret_cast<unsigned char *>(vpx_calloc(mbs, 1));
|
||||
memset(&roi_map[mbs >> 2], 1, (mbs >> 2));
|
||||
memset(&roi_map[mbs >> 1], 2, (mbs >> 2));
|
||||
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.
|
||||
int roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
|
||||
cpi.common.mb_cols, delta_q, delta_lf,
|
||||
threshold);
|
||||
int roi_retval =
|
||||
vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows, cpi.common.mb_cols,
|
||||
delta_q, delta_lf, threshold);
|
||||
EXPECT_EQ(0, roi_retval)
|
||||
<< "vp8_set_roimap roi failed with default test parameters";
|
||||
<< "vp8_set_roimap roi failed with default test parameters";
|
||||
|
||||
// Check that the values in the cpi structure get set as expected.
|
||||
if (roi_retval == 0) {
|
||||
@ -83,9 +78,9 @@ TEST(VP8RoiMapTest, ParameterCheck) {
|
||||
for (int i = 0; i < MAX_MB_SEGMENTS; ++i) {
|
||||
const int transq = internalq_trans[abs(delta_q[i])];
|
||||
if (abs(cpi.segment_feature_data[MB_LVL_ALT_Q][i]) != transq) {
|
||||
EXPECT_EQ(transq, cpi.segment_feature_data[MB_LVL_ALT_Q][i])
|
||||
<< "segment delta_q error";
|
||||
break;
|
||||
EXPECT_EQ(transq, cpi.segment_feature_data[MB_LVL_ALT_Q][i])
|
||||
<< "segment delta_q error";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,7 +88,7 @@ TEST(VP8RoiMapTest, ParameterCheck) {
|
||||
for (int i = 0; i < MAX_MB_SEGMENTS; ++i) {
|
||||
if (cpi.segment_feature_data[MB_LVL_ALT_LF][i] != delta_lf[i]) {
|
||||
EXPECT_EQ(delta_lf[i], cpi.segment_feature_data[MB_LVL_ALT_LF][i])
|
||||
<< "segment delta_lf error";
|
||||
<< "segment delta_lf error";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -101,23 +96,21 @@ TEST(VP8RoiMapTest, ParameterCheck) {
|
||||
// Check the breakout thresholds
|
||||
for (int i = 0; i < MAX_MB_SEGMENTS; ++i) {
|
||||
unsigned int breakout =
|
||||
static_cast<unsigned int>(cpi.segment_encode_breakout[i]);
|
||||
static_cast<unsigned int>(cpi.segment_encode_breakout[i]);
|
||||
|
||||
if (threshold[i] != breakout) {
|
||||
EXPECT_EQ(threshold[i], breakout)
|
||||
<< "breakout threshold error";
|
||||
EXPECT_EQ(threshold[i], breakout) << "breakout threshold error";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Segmentation, and segmentation update flages should be set.
|
||||
EXPECT_EQ(1, cpi.mb.e_mbd.segmentation_enabled)
|
||||
<< "segmentation_enabled error";
|
||||
<< "segmentation_enabled error";
|
||||
EXPECT_EQ(1, cpi.mb.e_mbd.update_mb_segmentation_map)
|
||||
<< "update_mb_segmentation_map error";
|
||||
<< "update_mb_segmentation_map error";
|
||||
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)
|
||||
for (int i = 0; i < 1000; ++i) {
|
||||
@ -128,57 +121,54 @@ TEST(VP8RoiMapTest, ParameterCheck) {
|
||||
rand_deltas[2] = rnd(160) - 80;
|
||||
rand_deltas[3] = rnd(160) - 80;
|
||||
|
||||
deltas_valid = ((abs(rand_deltas[0]) <= 63) &&
|
||||
(abs(rand_deltas[1]) <= 63) &&
|
||||
(abs(rand_deltas[2]) <= 63) &&
|
||||
(abs(rand_deltas[3]) <= 63)) ? 0 : -1;
|
||||
deltas_valid =
|
||||
((abs(rand_deltas[0]) <= 63) && (abs(rand_deltas[1]) <= 63) &&
|
||||
(abs(rand_deltas[2]) <= 63) && (abs(rand_deltas[3]) <= 63))
|
||||
? 0
|
||||
: -1;
|
||||
|
||||
// Test with random delta q values.
|
||||
roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
|
||||
cpi.common.mb_cols, rand_deltas,
|
||||
delta_lf, threshold);
|
||||
roi_retval =
|
||||
vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows, cpi.common.mb_cols,
|
||||
rand_deltas, delta_lf, threshold);
|
||||
EXPECT_EQ(deltas_valid, roi_retval) << "dq range check error";
|
||||
|
||||
// One delta_q error shown at a time
|
||||
if (deltas_valid != roi_retval)
|
||||
break;
|
||||
if (deltas_valid != roi_retval) break;
|
||||
|
||||
// Test with random loop filter values.
|
||||
roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
|
||||
cpi.common.mb_cols, delta_q,
|
||||
rand_deltas, threshold);
|
||||
roi_retval =
|
||||
vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows, cpi.common.mb_cols,
|
||||
delta_q, rand_deltas, threshold);
|
||||
EXPECT_EQ(deltas_valid, roi_retval) << "dlf range check error";
|
||||
|
||||
// One delta loop filter error shown at a time
|
||||
if (deltas_valid != roi_retval)
|
||||
break;
|
||||
if (deltas_valid != roi_retval) break;
|
||||
}
|
||||
|
||||
// Test that we report and error if cyclic refresh is enabled.
|
||||
cpi.cyclic_refresh_mode_enabled = 1;
|
||||
roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
|
||||
cpi.common.mb_cols, delta_q,
|
||||
delta_lf, threshold);
|
||||
roi_retval =
|
||||
vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows, cpi.common.mb_cols,
|
||||
delta_q, delta_lf, threshold);
|
||||
EXPECT_EQ(-1, roi_retval) << "cyclic refresh check error";
|
||||
cpi.cyclic_refresh_mode_enabled = 0;
|
||||
|
||||
// Test invalid number of rows or colums.
|
||||
roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows + 1,
|
||||
cpi.common.mb_cols, delta_q,
|
||||
delta_lf, threshold);
|
||||
roi_retval =
|
||||
vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows + 1,
|
||||
cpi.common.mb_cols, delta_q, delta_lf, threshold);
|
||||
EXPECT_EQ(-1, roi_retval) << "MB rows bounds check error";
|
||||
|
||||
roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
|
||||
cpi.common.mb_cols - 1, delta_q,
|
||||
delta_lf, threshold);
|
||||
roi_retval =
|
||||
vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
|
||||
cpi.common.mb_cols - 1, delta_q, delta_lf, threshold);
|
||||
EXPECT_EQ(-1, roi_retval) << "MB cols bounds check error";
|
||||
}
|
||||
|
||||
// Free allocated memory
|
||||
if (cpi.segmentation_map)
|
||||
vpx_free(cpi.segmentation_map);
|
||||
if (roi_map)
|
||||
vpx_free(roi_map);
|
||||
if (cpi.segmentation_map) vpx_free(cpi.segmentation_map);
|
||||
if (roi_map) vpx_free(roi_map);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
@ -25,22 +25,19 @@
|
||||
|
||||
namespace {
|
||||
|
||||
typedef void (*SixtapPredictFunc)(uint8_t *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
uint8_t *dst_ptr,
|
||||
typedef void (*SixtapPredictFunc)(uint8_t *src_ptr, int src_pixels_per_line,
|
||||
int xoffset, int yoffset, uint8_t *dst_ptr,
|
||||
int dst_pitch);
|
||||
|
||||
typedef std::tr1::tuple<int, int, SixtapPredictFunc> SixtapPredictParam;
|
||||
|
||||
class SixtapPredictTest
|
||||
: public ::testing::TestWithParam<SixtapPredictParam> {
|
||||
class SixtapPredictTest : public ::testing::TestWithParam<SixtapPredictParam> {
|
||||
public:
|
||||
static void SetUpTestCase() {
|
||||
src_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kSrcSize));
|
||||
dst_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kDstSize));
|
||||
dst_c_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kDstSize));
|
||||
src_ = reinterpret_cast<uint8_t *>(vpx_memalign(kDataAlignment, kSrcSize));
|
||||
dst_ = reinterpret_cast<uint8_t *>(vpx_memalign(kDataAlignment, kDstSize));
|
||||
dst_c_ =
|
||||
reinterpret_cast<uint8_t *>(vpx_memalign(kDataAlignment, kDstSize));
|
||||
}
|
||||
|
||||
static void TearDownTestCase() {
|
||||
@ -52,9 +49,7 @@ class SixtapPredictTest
|
||||
dst_c_ = NULL;
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
libvpx_test::ClearSystemState();
|
||||
}
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
// Make test arrays big enough for 16x16 functions. Six-tap filters
|
||||
@ -80,74 +75,76 @@ class SixtapPredictTest
|
||||
// The src stores the macroblock we will filter on, and makes it 1 byte larger
|
||||
// in order to test unaligned access. The result is stored in dst and dst_c(c
|
||||
// reference code result).
|
||||
static uint8_t* src_;
|
||||
static uint8_t* dst_;
|
||||
static uint8_t* dst_c_;
|
||||
static uint8_t *src_;
|
||||
static uint8_t *dst_;
|
||||
static uint8_t *dst_c_;
|
||||
};
|
||||
|
||||
uint8_t* SixtapPredictTest::src_ = NULL;
|
||||
uint8_t* SixtapPredictTest::dst_ = NULL;
|
||||
uint8_t* SixtapPredictTest::dst_c_ = NULL;
|
||||
uint8_t *SixtapPredictTest::src_ = NULL;
|
||||
uint8_t *SixtapPredictTest::dst_ = NULL;
|
||||
uint8_t *SixtapPredictTest::dst_c_ = NULL;
|
||||
|
||||
TEST_P(SixtapPredictTest, TestWithPresetData) {
|
||||
// Test input
|
||||
static const uint8_t test_data[kSrcSize] = {
|
||||
216, 184, 4, 191, 82, 92, 41, 0, 1, 226, 236, 172, 20, 182, 42, 226, 177,
|
||||
79, 94, 77, 179, 203, 206, 198, 22, 192, 19, 75, 17, 192, 44, 233, 120,
|
||||
48, 168, 203, 141, 210, 203, 143, 180, 184, 59, 201, 110, 102, 171, 32,
|
||||
182, 10, 109, 105, 213, 60, 47, 236, 253, 67, 55, 14, 3, 99, 247, 124,
|
||||
148, 159, 71, 34, 114, 19, 177, 38, 203, 237, 239, 58, 83, 155, 91, 10,
|
||||
166, 201, 115, 124, 5, 163, 104, 2, 231, 160, 16, 234, 4, 8, 103, 153,
|
||||
167, 174, 187, 26, 193, 109, 64, 141, 90, 48, 200, 174, 204, 36, 184,
|
||||
114, 237, 43, 238, 242, 207, 86, 245, 182, 247, 6, 161, 251, 14, 8, 148,
|
||||
182, 182, 79, 208, 120, 188, 17, 6, 23, 65, 206, 197, 13, 242, 126, 128,
|
||||
224, 170, 110, 211, 121, 197, 200, 47, 188, 207, 208, 184, 221, 216, 76,
|
||||
148, 143, 156, 100, 8, 89, 117, 14, 112, 183, 221, 54, 197, 208, 180, 69,
|
||||
176, 94, 180, 131, 215, 121, 76, 7, 54, 28, 216, 238, 249, 176, 58, 142,
|
||||
64, 215, 242, 72, 49, 104, 87, 161, 32, 52, 216, 230, 4, 141, 44, 181,
|
||||
235, 224, 57, 195, 89, 134, 203, 144, 162, 163, 126, 156, 84, 185, 42,
|
||||
148, 145, 29, 221, 194, 134, 52, 100, 166, 105, 60, 140, 110, 201, 184,
|
||||
35, 181, 153, 93, 121, 243, 227, 68, 131, 134, 232, 2, 35, 60, 187, 77,
|
||||
209, 76, 106, 174, 15, 241, 227, 115, 151, 77, 175, 36, 187, 121, 221,
|
||||
223, 47, 118, 61, 168, 105, 32, 237, 236, 167, 213, 238, 202, 17, 170,
|
||||
24, 226, 247, 131, 145, 6, 116, 117, 121, 11, 194, 41, 48, 126, 162, 13,
|
||||
93, 209, 131, 154, 122, 237, 187, 103, 217, 99, 60, 200, 45, 78, 115, 69,
|
||||
49, 106, 200, 194, 112, 60, 56, 234, 72, 251, 19, 120, 121, 182, 134, 215,
|
||||
135, 10, 114, 2, 247, 46, 105, 209, 145, 165, 153, 191, 243, 12, 5, 36,
|
||||
119, 206, 231, 231, 11, 32, 209, 83, 27, 229, 204, 149, 155, 83, 109, 35,
|
||||
93, 223, 37, 84, 14, 142, 37, 160, 52, 191, 96, 40, 204, 101, 77, 67, 52,
|
||||
53, 43, 63, 85, 253, 147, 113, 226, 96, 6, 125, 179, 115, 161, 17, 83,
|
||||
198, 101, 98, 85, 139, 3, 137, 75, 99, 178, 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
|
||||
216, 184, 4, 191, 82, 92, 41, 0, 1, 226, 236, 172, 20, 182, 42,
|
||||
226, 177, 79, 94, 77, 179, 203, 206, 198, 22, 192, 19, 75, 17, 192,
|
||||
44, 233, 120, 48, 168, 203, 141, 210, 203, 143, 180, 184, 59, 201, 110,
|
||||
102, 171, 32, 182, 10, 109, 105, 213, 60, 47, 236, 253, 67, 55, 14,
|
||||
3, 99, 247, 124, 148, 159, 71, 34, 114, 19, 177, 38, 203, 237, 239,
|
||||
58, 83, 155, 91, 10, 166, 201, 115, 124, 5, 163, 104, 2, 231, 160,
|
||||
16, 234, 4, 8, 103, 153, 167, 174, 187, 26, 193, 109, 64, 141, 90,
|
||||
48, 200, 174, 204, 36, 184, 114, 237, 43, 238, 242, 207, 86, 245, 182,
|
||||
247, 6, 161, 251, 14, 8, 148, 182, 182, 79, 208, 120, 188, 17, 6,
|
||||
23, 65, 206, 197, 13, 242, 126, 128, 224, 170, 110, 211, 121, 197, 200,
|
||||
47, 188, 207, 208, 184, 221, 216, 76, 148, 143, 156, 100, 8, 89, 117,
|
||||
14, 112, 183, 221, 54, 197, 208, 180, 69, 176, 94, 180, 131, 215, 121,
|
||||
76, 7, 54, 28, 216, 238, 249, 176, 58, 142, 64, 215, 242, 72, 49,
|
||||
104, 87, 161, 32, 52, 216, 230, 4, 141, 44, 181, 235, 224, 57, 195,
|
||||
89, 134, 203, 144, 162, 163, 126, 156, 84, 185, 42, 148, 145, 29, 221,
|
||||
194, 134, 52, 100, 166, 105, 60, 140, 110, 201, 184, 35, 181, 153, 93,
|
||||
121, 243, 227, 68, 131, 134, 232, 2, 35, 60, 187, 77, 209, 76, 106,
|
||||
174, 15, 241, 227, 115, 151, 77, 175, 36, 187, 121, 221, 223, 47, 118,
|
||||
61, 168, 105, 32, 237, 236, 167, 213, 238, 202, 17, 170, 24, 226, 247,
|
||||
131, 145, 6, 116, 117, 121, 11, 194, 41, 48, 126, 162, 13, 93, 209,
|
||||
131, 154, 122, 237, 187, 103, 217, 99, 60, 200, 45, 78, 115, 69, 49,
|
||||
106, 200, 194, 112, 60, 56, 234, 72, 251, 19, 120, 121, 182, 134, 215,
|
||||
135, 10, 114, 2, 247, 46, 105, 209, 145, 165, 153, 191, 243, 12, 5,
|
||||
36, 119, 206, 231, 231, 11, 32, 209, 83, 27, 229, 204, 149, 155, 83,
|
||||
109, 35, 93, 223, 37, 84, 14, 142, 37, 160, 52, 191, 96, 40, 204,
|
||||
101, 77, 67, 52, 53, 43, 63, 85, 253, 147, 113, 226, 96, 6, 125,
|
||||
179, 115, 161, 17, 83, 198, 101, 98, 85, 139, 3, 137, 75, 99, 178,
|
||||
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
|
||||
static const uint8_t expected_dst[kDstSize] = {
|
||||
117, 102, 74, 135, 42, 98, 175, 206, 70, 73, 222, 197, 50, 24, 39, 49, 38,
|
||||
105, 90, 47, 169, 40, 171, 215, 200, 73, 109, 141, 53, 85, 177, 164, 79,
|
||||
208, 124, 89, 212, 18, 81, 145, 151, 164, 217, 153, 91, 154, 102, 102,
|
||||
159, 75, 164, 152, 136, 51, 213, 219, 186, 116, 193, 224, 186, 36, 231,
|
||||
208, 84, 211, 155, 167, 35, 59, 42, 76, 216, 149, 73, 201, 78, 149, 184,
|
||||
100, 96, 196, 189, 198, 188, 235, 195, 117, 129, 120, 129, 49, 25, 133,
|
||||
113, 69, 221, 114, 70, 143, 99, 157, 108, 189, 140, 78, 6, 55, 65, 240,
|
||||
255, 245, 184, 72, 90, 100, 116, 131, 39, 60, 234, 167, 33, 160, 88, 185,
|
||||
200, 157, 159, 176, 127, 151, 138, 102, 168, 106, 170, 86, 82, 219, 189,
|
||||
76, 33, 115, 197, 106, 96, 198, 136, 97, 141, 237, 151, 98, 137, 191,
|
||||
185, 2, 57, 95, 142, 91, 255, 185, 97, 137, 76, 162, 94, 173, 131, 193,
|
||||
161, 81, 106, 72, 135, 222, 234, 137, 66, 137, 106, 243, 210, 147, 95,
|
||||
15, 137, 110, 85, 66, 16, 96, 167, 147, 150, 173, 203, 140, 118, 196,
|
||||
84, 147, 160, 19, 95, 101, 123, 74, 132, 202, 82, 166, 12, 131, 166,
|
||||
189, 170, 159, 85, 79, 66, 57, 152, 132, 203, 194, 0, 1, 56, 146, 180,
|
||||
224, 156, 28, 83, 181, 79, 76, 80, 46, 160, 175, 59, 106, 43, 87, 75,
|
||||
136, 85, 189, 46, 71, 200, 90
|
||||
117, 102, 74, 135, 42, 98, 175, 206, 70, 73, 222, 197, 50, 24, 39,
|
||||
49, 38, 105, 90, 47, 169, 40, 171, 215, 200, 73, 109, 141, 53, 85,
|
||||
177, 164, 79, 208, 124, 89, 212, 18, 81, 145, 151, 164, 217, 153, 91,
|
||||
154, 102, 102, 159, 75, 164, 152, 136, 51, 213, 219, 186, 116, 193, 224,
|
||||
186, 36, 231, 208, 84, 211, 155, 167, 35, 59, 42, 76, 216, 149, 73,
|
||||
201, 78, 149, 184, 100, 96, 196, 189, 198, 188, 235, 195, 117, 129, 120,
|
||||
129, 49, 25, 133, 113, 69, 221, 114, 70, 143, 99, 157, 108, 189, 140,
|
||||
78, 6, 55, 65, 240, 255, 245, 184, 72, 90, 100, 116, 131, 39, 60,
|
||||
234, 167, 33, 160, 88, 185, 200, 157, 159, 176, 127, 151, 138, 102, 168,
|
||||
106, 170, 86, 82, 219, 189, 76, 33, 115, 197, 106, 96, 198, 136, 97,
|
||||
141, 237, 151, 98, 137, 191, 185, 2, 57, 95, 142, 91, 255, 185, 97,
|
||||
137, 76, 162, 94, 173, 131, 193, 161, 81, 106, 72, 135, 222, 234, 137,
|
||||
66, 137, 106, 243, 210, 147, 95, 15, 137, 110, 85, 66, 16, 96, 167,
|
||||
147, 150, 173, 203, 140, 118, 196, 84, 147, 160, 19, 95, 101, 123, 74,
|
||||
132, 202, 82, 166, 12, 131, 166, 189, 170, 159, 85, 79, 66, 57, 152,
|
||||
132, 203, 194, 0, 1, 56, 146, 180, 224, 156, 28, 83, 181, 79, 76,
|
||||
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(
|
||||
sixtap_predict_(&src[kSrcStride * 2 + 2 + 1], kSrcStride,
|
||||
2, 2, dst_, kDstStride));
|
||||
ASM_REGISTER_STATE_CHECK(sixtap_predict_(&src[kSrcStride * 2 + 2 + 1],
|
||||
kSrcStride, 2, 2, dst_, kDstStride));
|
||||
|
||||
for (int i = 0; i < height_; ++i)
|
||||
for (int j = 0; j < width_; ++j)
|
||||
@ -159,8 +156,7 @@ using libvpx_test::ACMRandom;
|
||||
|
||||
TEST_P(SixtapPredictTest, TestWithRandomData) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
for (int i = 0; i < kSrcSize; ++i)
|
||||
src_[i] = rnd.Rand8();
|
||||
for (int i = 0; i < kSrcSize; ++i) src_[i] = rnd.Rand8();
|
||||
|
||||
// Run tests for all possible offsets.
|
||||
for (int xoffset = 0; xoffset < 8; ++xoffset) {
|
||||
@ -172,9 +168,9 @@ TEST_P(SixtapPredictTest, TestWithRandomData) {
|
||||
xoffset, yoffset, dst_c_, kDstStride);
|
||||
|
||||
// Run test.
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
sixtap_predict_(&src_[kSrcStride * 2 + 2 + 1], kSrcStride,
|
||||
xoffset, yoffset, dst_, kDstStride));
|
||||
ASM_REGISTER_STATE_CHECK(sixtap_predict_(&src_[kSrcStride * 2 + 2 + 1],
|
||||
kSrcStride, xoffset, yoffset,
|
||||
dst_, kDstStride));
|
||||
|
||||
for (int i = 0; i < height_; ++i)
|
||||
for (int j = 0; j < width_; ++j)
|
||||
@ -187,47 +183,47 @@ TEST_P(SixtapPredictTest, TestWithRandomData) {
|
||||
using std::tr1::make_tuple;
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, SixtapPredictTest, ::testing::Values(
|
||||
make_tuple(16, 16, &vp8_sixtap_predict16x16_c),
|
||||
make_tuple(8, 8, &vp8_sixtap_predict8x8_c),
|
||||
make_tuple(8, 4, &vp8_sixtap_predict8x4_c),
|
||||
make_tuple(4, 4, &vp8_sixtap_predict4x4_c)));
|
||||
C, SixtapPredictTest,
|
||||
::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_c),
|
||||
make_tuple(8, 8, &vp8_sixtap_predict8x8_c),
|
||||
make_tuple(8, 4, &vp8_sixtap_predict8x4_c),
|
||||
make_tuple(4, 4, &vp8_sixtap_predict4x4_c)));
|
||||
#if HAVE_NEON
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, SixtapPredictTest, ::testing::Values(
|
||||
make_tuple(16, 16, &vp8_sixtap_predict16x16_neon),
|
||||
make_tuple(8, 8, &vp8_sixtap_predict8x8_neon),
|
||||
make_tuple(8, 4, &vp8_sixtap_predict8x4_neon)));
|
||||
NEON, SixtapPredictTest,
|
||||
::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_neon),
|
||||
make_tuple(8, 8, &vp8_sixtap_predict8x8_neon),
|
||||
make_tuple(8, 4, &vp8_sixtap_predict8x4_neon)));
|
||||
#endif
|
||||
#if HAVE_MMX
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MMX, SixtapPredictTest, ::testing::Values(
|
||||
make_tuple(16, 16, &vp8_sixtap_predict16x16_mmx),
|
||||
make_tuple(8, 8, &vp8_sixtap_predict8x8_mmx),
|
||||
make_tuple(8, 4, &vp8_sixtap_predict8x4_mmx),
|
||||
make_tuple(4, 4, &vp8_sixtap_predict4x4_mmx)));
|
||||
MMX, SixtapPredictTest,
|
||||
::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_mmx),
|
||||
make_tuple(8, 8, &vp8_sixtap_predict8x8_mmx),
|
||||
make_tuple(8, 4, &vp8_sixtap_predict8x4_mmx),
|
||||
make_tuple(4, 4, &vp8_sixtap_predict4x4_mmx)));
|
||||
#endif
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, SixtapPredictTest, ::testing::Values(
|
||||
make_tuple(16, 16, &vp8_sixtap_predict16x16_sse2),
|
||||
make_tuple(8, 8, &vp8_sixtap_predict8x8_sse2),
|
||||
make_tuple(8, 4, &vp8_sixtap_predict8x4_sse2)));
|
||||
SSE2, SixtapPredictTest,
|
||||
::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_sse2),
|
||||
make_tuple(8, 8, &vp8_sixtap_predict8x8_sse2),
|
||||
make_tuple(8, 4, &vp8_sixtap_predict8x4_sse2)));
|
||||
#endif
|
||||
#if HAVE_SSSE3
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSSE3, SixtapPredictTest, ::testing::Values(
|
||||
make_tuple(16, 16, &vp8_sixtap_predict16x16_ssse3),
|
||||
make_tuple(8, 8, &vp8_sixtap_predict8x8_ssse3),
|
||||
make_tuple(8, 4, &vp8_sixtap_predict8x4_ssse3),
|
||||
make_tuple(4, 4, &vp8_sixtap_predict4x4_ssse3)));
|
||||
SSSE3, SixtapPredictTest,
|
||||
::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_ssse3),
|
||||
make_tuple(8, 8, &vp8_sixtap_predict8x8_ssse3),
|
||||
make_tuple(8, 4, &vp8_sixtap_predict8x4_ssse3),
|
||||
make_tuple(4, 4, &vp8_sixtap_predict4x4_ssse3)));
|
||||
#endif
|
||||
#if HAVE_MSA
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, SixtapPredictTest, ::testing::Values(
|
||||
make_tuple(16, 16, &vp8_sixtap_predict16x16_msa),
|
||||
make_tuple(8, 8, &vp8_sixtap_predict8x8_msa),
|
||||
make_tuple(8, 4, &vp8_sixtap_predict8x4_msa),
|
||||
make_tuple(4, 4, &vp8_sixtap_predict4x4_msa)));
|
||||
MSA, SixtapPredictTest,
|
||||
::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_msa),
|
||||
make_tuple(8, 8, &vp8_sixtap_predict8x8_msa),
|
||||
make_tuple(8, 4, &vp8_sixtap_predict8x4_msa),
|
||||
make_tuple(4, 4, &vp8_sixtap_predict4x4_msa)));
|
||||
#endif
|
||||
} // namespace
|
||||
|
@ -52,9 +52,9 @@ TEST_P(SumSquaresTest, OperationCheck) {
|
||||
const int limit = 1 << (msb + 1);
|
||||
|
||||
for (int k = 0; k < kNumIterations; k++) {
|
||||
const int size = 4 << rnd(6); // Up to 128x128
|
||||
int stride = 4 << rnd(7); // Up to 256 stride
|
||||
while (stride < size) { // Make sure it's valid
|
||||
const int size = 4 << rnd(6); // Up to 128x128
|
||||
int stride = 4 << rnd(7); // Up to 256 stride
|
||||
while (stride < size) { // Make sure it's valid
|
||||
stride = 4 << rnd(7);
|
||||
}
|
||||
|
||||
@ -68,9 +68,8 @@ TEST_P(SumSquaresTest, OperationCheck) {
|
||||
uint64_t res_tst;
|
||||
ASM_REGISTER_STATE_CHECK(res_tst = tst_func_(src, stride, size));
|
||||
|
||||
ASSERT_EQ(res_ref, res_tst)
|
||||
<< "Error: Sum Squares Test"
|
||||
<< " C output does not match optimized output.";
|
||||
ASSERT_EQ(res_ref, res_tst) << "Error: Sum Squares Test"
|
||||
<< " C output does not match optimized output.";
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,9 +80,9 @@ TEST_P(SumSquaresTest, ExtremeValues) {
|
||||
const int limit = 1 << (msb + 1);
|
||||
|
||||
for (int k = 0; k < kNumIterations; k++) {
|
||||
const int size = 4 << rnd(6); // Up to 128x128
|
||||
int stride = 4 << rnd(7); // Up to 256 stride
|
||||
while (stride < size) { // Make sure it's valid
|
||||
const int size = 4 << rnd(6); // Up to 128x128
|
||||
int stride = 4 << rnd(7); // Up to 256 stride
|
||||
while (stride < size) { // Make sure it's valid
|
||||
stride = 4 << rnd(7);
|
||||
}
|
||||
|
||||
@ -98,9 +97,8 @@ TEST_P(SumSquaresTest, ExtremeValues) {
|
||||
uint64_t res_tst;
|
||||
ASM_REGISTER_STATE_CHECK(res_tst = tst_func_(src, stride, size));
|
||||
|
||||
ASSERT_EQ(res_ref, res_tst)
|
||||
<< "Error: Sum Squares Test"
|
||||
<< " C output does not match optimized output.";
|
||||
ASSERT_EQ(res_ref, res_tst) << "Error: Sum Squares Test"
|
||||
<< " C output does not match optimized output.";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,13 +18,14 @@ namespace {
|
||||
|
||||
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,
|
||||
public ::libvpx_test::CodecTestWithParam<SuperframeTestParam> {
|
||||
class SuperframeTest
|
||||
: public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<SuperframeTestParam> {
|
||||
protected:
|
||||
SuperframeTest() : EncoderTest(GET_PARAM(0)), modified_buf_(NULL),
|
||||
last_sf_pts_(0) {}
|
||||
SuperframeTest()
|
||||
: EncoderTest(GET_PARAM(0)), modified_buf_(NULL), last_sf_pts_(0) {}
|
||||
virtual ~SuperframeTest() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
@ -36,9 +37,7 @@ class SuperframeTest : public ::libvpx_test::EncoderTest,
|
||||
sf_count_max_ = INT_MAX;
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
delete[] modified_buf_;
|
||||
}
|
||||
virtual void TearDown() { delete[] modified_buf_; }
|
||||
|
||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
||||
libvpx_test::Encoder *encoder) {
|
||||
@ -47,25 +46,21 @@ 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) {
|
||||
if (pkt->kind != VPX_CODEC_CX_FRAME_PKT)
|
||||
return pkt;
|
||||
if (pkt->kind != VPX_CODEC_CX_FRAME_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 int frames = (marker & 0x7) + 1;
|
||||
const int mag = ((marker >> 3) & 3) + 1;
|
||||
const unsigned int index_sz = 2 + mag * frames;
|
||||
if ((marker & 0xe0) == 0xc0 &&
|
||||
pkt->data.frame.sz >= index_sz &&
|
||||
if ((marker & 0xe0) == 0xc0 && pkt->data.frame.sz >= index_sz &&
|
||||
buffer[pkt->data.frame.sz - index_sz] == marker) {
|
||||
// frame is a superframe. strip off the index.
|
||||
if (modified_buf_)
|
||||
delete[] modified_buf_;
|
||||
if (modified_buf_) delete[] modified_buf_;
|
||||
modified_buf_ = new uint8_t[pkt->data.frame.sz - index_sz];
|
||||
memcpy(modified_buf_, pkt->data.frame.buf,
|
||||
pkt->data.frame.sz - index_sz);
|
||||
memcpy(modified_buf_, pkt->data.frame.buf, pkt->data.frame.sz - index_sz);
|
||||
modified_pkt_ = *pkt;
|
||||
modified_pkt_.data.frame.buf = modified_buf_;
|
||||
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
|
||||
abort_ |= sf_count_ > sf_count_max_ &&
|
||||
pkt->data.frame.pts - last_sf_pts_ >= 5;
|
||||
abort_ |=
|
||||
sf_count_ > sf_count_max_ && pkt->data.frame.pts - last_sf_pts_ >= 5;
|
||||
return pkt;
|
||||
}
|
||||
|
||||
@ -98,7 +93,8 @@ TEST_P(SuperframeTest, TestSuperframeIndexIsOptional) {
|
||||
EXPECT_EQ(sf_count_, 1);
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(SuperframeTest, ::testing::Combine(
|
||||
::testing::Values(::libvpx_test::kTwoPassGood),
|
||||
::testing::Values(0)));
|
||||
VP9_INSTANTIATE_TEST_CASE(
|
||||
SuperframeTest,
|
||||
::testing::Combine(::testing::Values(::libvpx_test::kTwoPassGood),
|
||||
::testing::Values(0)));
|
||||
} // namespace
|
||||
|
@ -33,10 +33,8 @@ class SvcTest : public ::testing::Test {
|
||||
static const uint32_t kHeight = 288;
|
||||
|
||||
SvcTest()
|
||||
: codec_iface_(0),
|
||||
test_file_name_("hantro_collage_w352h288.yuv"),
|
||||
codec_initialized_(false),
|
||||
decoder_(0) {
|
||||
: codec_iface_(0), test_file_name_("hantro_collage_w352h288.yuv"),
|
||||
codec_initialized_(false), decoder_(0) {
|
||||
memset(&svc_, 0, sizeof(svc_));
|
||||
memset(&codec_, 0, sizeof(codec_));
|
||||
memset(&codec_enc_, 0, sizeof(codec_enc_));
|
||||
@ -70,7 +68,7 @@ class SvcTest : public ::testing::Test {
|
||||
|
||||
virtual void TearDown() {
|
||||
ReleaseEncoder();
|
||||
delete(decoder_);
|
||||
delete (decoder_);
|
||||
}
|
||||
|
||||
void InitializeEncoder() {
|
||||
@ -97,7 +95,7 @@ class SvcTest : public ::testing::Test {
|
||||
if (cx_pkt->kind == VPX_CODEC_STATS_PKT) {
|
||||
EXPECT_GT(cx_pkt->data.twopass_stats.sz, 0U);
|
||||
ASSERT_TRUE(cx_pkt->data.twopass_stats.buf != NULL);
|
||||
stats_buf->append(static_cast<char*>(cx_pkt->data.twopass_stats.buf),
|
||||
stats_buf->append(static_cast<char *>(cx_pkt->data.twopass_stats.buf),
|
||||
cx_pkt->data.twopass_stats.sz);
|
||||
}
|
||||
}
|
||||
@ -113,10 +111,9 @@ class SvcTest : public ::testing::Test {
|
||||
codec_enc_.g_pass = VPX_RC_FIRST_PASS;
|
||||
InitializeEncoder();
|
||||
|
||||
libvpx_test::I420VideoSource video(test_file_name_,
|
||||
codec_enc_.g_w, codec_enc_.g_h,
|
||||
codec_enc_.g_timebase.den,
|
||||
codec_enc_.g_timebase.num, 0, 30);
|
||||
libvpx_test::I420VideoSource video(
|
||||
test_file_name_, codec_enc_.g_w, codec_enc_.g_h,
|
||||
codec_enc_.g_timebase.den, codec_enc_.g_timebase.num, 0, 30);
|
||||
video.Begin();
|
||||
|
||||
for (int i = 0; i < n; ++i) {
|
||||
@ -128,8 +125,8 @@ class SvcTest : public ::testing::Test {
|
||||
}
|
||||
|
||||
// Flush encoder and test EOS packet.
|
||||
res = vpx_svc_encode(&svc_, &codec_, NULL, video.pts(),
|
||||
video.duration(), VPX_DL_GOOD_QUALITY);
|
||||
res = vpx_svc_encode(&svc_, &codec_, NULL, video.pts(), video.duration(),
|
||||
VPX_DL_GOOD_QUALITY);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res);
|
||||
GetStatsData(stats_buf);
|
||||
|
||||
@ -163,8 +160,8 @@ class SvcTest : public ::testing::Test {
|
||||
}
|
||||
}
|
||||
|
||||
void Pass2EncodeNFrames(std::string *const stats_buf,
|
||||
const int n, const int layers,
|
||||
void Pass2EncodeNFrames(std::string *const stats_buf, const int n,
|
||||
const int layers,
|
||||
struct vpx_fixed_buf *const outputs) {
|
||||
vpx_codec_err_t res;
|
||||
size_t frame_received = 0;
|
||||
@ -182,10 +179,9 @@ class SvcTest : public ::testing::Test {
|
||||
}
|
||||
InitializeEncoder();
|
||||
|
||||
libvpx_test::I420VideoSource video(test_file_name_,
|
||||
codec_enc_.g_w, codec_enc_.g_h,
|
||||
codec_enc_.g_timebase.den,
|
||||
codec_enc_.g_timebase.num, 0, 30);
|
||||
libvpx_test::I420VideoSource video(
|
||||
test_file_name_, codec_enc_.g_w, codec_enc_.g_h,
|
||||
codec_enc_.g_timebase.den, codec_enc_.g_timebase.num, 0, 30);
|
||||
video.Begin();
|
||||
|
||||
for (int i = 0; i < n; ++i) {
|
||||
@ -197,8 +193,8 @@ class SvcTest : public ::testing::Test {
|
||||
}
|
||||
|
||||
// Flush encoder.
|
||||
res = vpx_svc_encode(&svc_, &codec_, NULL, 0,
|
||||
video.duration(), VPX_DL_GOOD_QUALITY);
|
||||
res = vpx_svc_encode(&svc_, &codec_, NULL, 0, video.duration(),
|
||||
VPX_DL_GOOD_QUALITY);
|
||||
EXPECT_EQ(VPX_CODEC_OK, res);
|
||||
StoreFrames(n, outputs, &frame_received);
|
||||
|
||||
@ -217,9 +213,8 @@ class SvcTest : public ::testing::Test {
|
||||
for (int i = 0; i < n; ++i) {
|
||||
ASSERT_TRUE(inputs[i].buf != NULL);
|
||||
ASSERT_GT(inputs[i].sz, 0U);
|
||||
const vpx_codec_err_t res_dec =
|
||||
decoder_->DecodeFrame(static_cast<const uint8_t *>(inputs[i].buf),
|
||||
inputs[i].sz);
|
||||
const vpx_codec_err_t res_dec = decoder_->DecodeFrame(
|
||||
static_cast<const uint8_t *>(inputs[i].buf), inputs[i].sz);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder_->DecodeError();
|
||||
++decoded_frames;
|
||||
|
||||
@ -240,17 +235,16 @@ class SvcTest : public ::testing::Test {
|
||||
ASSERT_GT(remained_spatial_layers, 0);
|
||||
|
||||
for (int i = 0; i < num_super_frames; ++i) {
|
||||
uint32_t frame_sizes[8] = {0};
|
||||
uint32_t frame_sizes[8] = { 0 };
|
||||
int frame_count = 0;
|
||||
int frames_found = 0;
|
||||
int frame;
|
||||
ASSERT_TRUE(inputs[i].buf != NULL);
|
||||
ASSERT_GT(inputs[i].sz, 0U);
|
||||
|
||||
vpx_codec_err_t res =
|
||||
vp9_parse_superframe_index(static_cast<const uint8_t*>(inputs[i].buf),
|
||||
inputs[i].sz, frame_sizes, &frame_count,
|
||||
NULL, NULL);
|
||||
vpx_codec_err_t res = vp9_parse_superframe_index(
|
||||
static_cast<const uint8_t *>(inputs[i].buf), inputs[i].sz,
|
||||
frame_sizes, &frame_count, NULL, NULL);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res);
|
||||
|
||||
if (frame_count == 0) {
|
||||
@ -258,28 +252,27 @@ class SvcTest : public ::testing::Test {
|
||||
ASSERT_EQ(1, remained_spatial_layers);
|
||||
} else {
|
||||
// Found a super frame.
|
||||
uint8_t *frame_data = static_cast<uint8_t*>(inputs[i].buf);
|
||||
uint8_t *frame_data = static_cast<uint8_t *>(inputs[i].buf);
|
||||
uint8_t *frame_start = frame_data;
|
||||
for (frame = 0; frame < frame_count; ++frame) {
|
||||
// Looking for a visible frame.
|
||||
if (frame_data[0] & 0x02) {
|
||||
++frames_found;
|
||||
if (frames_found == remained_spatial_layers)
|
||||
break;
|
||||
if (frames_found == remained_spatial_layers) break;
|
||||
}
|
||||
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
|
||||
<< " super_frame: " << i;
|
||||
if (frame == frame_count - 1)
|
||||
continue;
|
||||
if (frame == frame_count - 1) continue;
|
||||
|
||||
frame_data += frame_sizes[frame];
|
||||
|
||||
// We need to add one more frame for multiple frame contexts.
|
||||
uint8_t marker =
|
||||
static_cast<const uint8_t*>(inputs[i].buf)[inputs[i].sz - 1];
|
||||
static_cast<const uint8_t *>(inputs[i].buf)[inputs[i].sz - 1];
|
||||
const uint32_t mag = ((marker >> 3) & 0x3) + 1;
|
||||
const size_t index_sz = 2 + mag * frame_count;
|
||||
const size_t new_index_sz = 2 + mag * (frame + 1);
|
||||
@ -445,7 +438,7 @@ TEST_F(SvcTest, SetAutoAltRefOption) {
|
||||
// Test that decoder can handle an SVC frame as the first frame in a sequence.
|
||||
TEST_F(SvcTest, OnePassEncodeOneFrame) {
|
||||
codec_enc_.g_pass = VPX_RC_ONE_PASS;
|
||||
vpx_fixed_buf output = {0};
|
||||
vpx_fixed_buf output = { 0 };
|
||||
Pass2EncodeNFrames(NULL, 1, 2, &output);
|
||||
DecodeNFrames(&output, 1);
|
||||
FreeBitstreamBuffers(&output, 1);
|
||||
@ -539,8 +532,7 @@ TEST_F(SvcTest, TwoPassEncode2SNRLayers) {
|
||||
|
||||
// Second pass encode
|
||||
codec_enc_.g_pass = VPX_RC_LAST_PASS;
|
||||
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");
|
||||
vpx_fixed_buf outputs[20];
|
||||
memset(&outputs[0], 0, sizeof(outputs));
|
||||
Pass2EncodeNFrames(&stats_buf, 20, 2, &outputs[0]);
|
||||
@ -556,8 +548,7 @@ TEST_F(SvcTest, TwoPassEncode3SNRLayersDecode321Layers) {
|
||||
|
||||
// Second pass encode
|
||||
codec_enc_.g_pass = VPX_RC_LAST_PASS;
|
||||
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");
|
||||
vpx_fixed_buf outputs[20];
|
||||
memset(&outputs[0], 0, sizeof(outputs));
|
||||
Pass2EncodeNFrames(&stats_buf, 20, 3, &outputs[0]);
|
||||
@ -572,8 +563,7 @@ TEST_F(SvcTest, TwoPassEncode3SNRLayersDecode321Layers) {
|
||||
|
||||
TEST_F(SvcTest, SetMultipleFrameContextsOption) {
|
||||
svc_.spatial_layers = 5;
|
||||
vpx_codec_err_t res =
|
||||
vpx_svc_set_options(&svc_, "multi-frame-contexts=1");
|
||||
vpx_codec_err_t res = vpx_svc_set_options(&svc_, "multi-frame-contexts=1");
|
||||
EXPECT_EQ(VPX_CODEC_OK, res);
|
||||
res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
|
||||
EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
|
||||
@ -626,7 +616,8 @@ TEST_F(SvcTest, TwoPassEncode2SNRLayersWithMultipleFrameContexts) {
|
||||
// Second pass encode
|
||||
codec_enc_.g_pass = VPX_RC_LAST_PASS;
|
||||
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");
|
||||
vpx_fixed_buf outputs[10];
|
||||
memset(&outputs[0], 0, sizeof(outputs));
|
||||
@ -645,7 +636,8 @@ TEST_F(SvcTest,
|
||||
// Second pass encode
|
||||
codec_enc_.g_pass = VPX_RC_LAST_PASS;
|
||||
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");
|
||||
vpx_fixed_buf outputs[10];
|
||||
memset(&outputs[0], 0, sizeof(outputs));
|
||||
@ -689,7 +681,8 @@ TEST_F(SvcTest, TwoPassEncode2TemporalLayersWithMultipleFrameContexts) {
|
||||
codec_enc_.g_pass = VPX_RC_LAST_PASS;
|
||||
svc_.temporal_layers = 2;
|
||||
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");
|
||||
vpx_fixed_buf outputs[10];
|
||||
memset(&outputs[0], 0, sizeof(outputs));
|
||||
@ -714,8 +707,7 @@ TEST_F(SvcTest, TwoPassEncode2TemporalLayersDecodeBaseLayer) {
|
||||
Pass2EncodeNFrames(&stats_buf, 10, 1, &outputs[0]);
|
||||
|
||||
vpx_fixed_buf base_layer[5];
|
||||
for (int i = 0; i < 5; ++i)
|
||||
base_layer[i] = outputs[i * 2];
|
||||
for (int i = 0; i < 5; ++i) base_layer[i] = outputs[i * 2];
|
||||
|
||||
DecodeNFrames(&base_layer[0], 5);
|
||||
FreeBitstreamBuffers(&outputs[0], 10);
|
||||
@ -733,15 +725,15 @@ TEST_F(SvcTest,
|
||||
codec_enc_.g_pass = VPX_RC_LAST_PASS;
|
||||
svc_.temporal_layers = 2;
|
||||
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");
|
||||
vpx_fixed_buf outputs[10];
|
||||
memset(&outputs[0], 0, sizeof(outputs));
|
||||
Pass2EncodeNFrames(&stats_buf, 10, 1, &outputs[0]);
|
||||
|
||||
vpx_fixed_buf base_layer[5];
|
||||
for (int i = 0; i < 5; ++i)
|
||||
base_layer[i] = outputs[i * 2];
|
||||
for (int i = 0; i < 5; ++i) base_layer[i] = outputs[i * 2];
|
||||
|
||||
DecodeNFrames(&base_layer[0], 5);
|
||||
FreeBitstreamBuffers(&outputs[0], 10);
|
||||
@ -769,8 +761,7 @@ TEST_F(SvcTest, TwoPassEncode2TemporalLayersWithTiles) {
|
||||
FreeBitstreamBuffers(&outputs[0], 10);
|
||||
}
|
||||
|
||||
TEST_F(SvcTest,
|
||||
TwoPassEncode2TemporalLayersWithMultipleFrameContextsAndTiles) {
|
||||
TEST_F(SvcTest, TwoPassEncode2TemporalLayersWithMultipleFrameContextsAndTiles) {
|
||||
// First pass encode
|
||||
std::string stats_buf;
|
||||
vpx_svc_set_options(&svc_, "scale-factors=1/1");
|
||||
@ -785,7 +776,8 @@ TEST_F(SvcTest,
|
||||
codec_enc_.g_h = 144;
|
||||
tile_columns_ = 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");
|
||||
vpx_fixed_buf outputs[10];
|
||||
memset(&outputs[0], 0, sizeof(outputs));
|
||||
|
@ -31,9 +31,9 @@ typedef void (*VpxPredFunc)(uint8_t *dst, ptrdiff_t y_stride,
|
||||
|
||||
const int kNumVp9IntraPredFuncs = 13;
|
||||
const char *kVp9IntraPredNames[kNumVp9IntraPredFuncs] = {
|
||||
"DC_PRED", "DC_LEFT_PRED", "DC_TOP_PRED", "DC_128_PRED", "V_PRED", "H_PRED",
|
||||
"D45_PRED", "D135_PRED", "D117_PRED", "D153_PRED", "D207_PRED", "D63_PRED",
|
||||
"TM_PRED"
|
||||
"DC_PRED", "DC_LEFT_PRED", "DC_TOP_PRED", "DC_128_PRED", "V_PRED",
|
||||
"H_PRED", "D45_PRED", "D135_PRED", "D117_PRED", "D153_PRED",
|
||||
"D207_PRED", "D63_PRED", "TM_PRED"
|
||||
};
|
||||
|
||||
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) {
|
||||
static const int kNumVp9IntraFuncs = 13;
|
||||
static const char *const kSignatures[kNumVp9IntraFuncs] = {
|
||||
"4334156168b34ab599d9b5b30f522fe9",
|
||||
"bc4649d5ba47c7ff178d92e475960fb0",
|
||||
"8d316e5933326dcac24e1064794b5d12",
|
||||
"a27270fed024eafd762c95de85f4da51",
|
||||
"c33dff000d4256c2b8f3bf9e9bab14d2",
|
||||
"44d8cddc2ad8f79b8ed3306051722b4f",
|
||||
"eb54839b2bad6699d8946f01ec041cd0",
|
||||
"ecb0d56ae5f677ea45127ce9d5c058e4",
|
||||
"0b7936841f6813da818275944895b574",
|
||||
"9117972ef64f91a58ff73e1731c81db2",
|
||||
"c56d5e8c729e46825f46dd5d3b5d508a",
|
||||
"c0889e2039bcf7bcb5d2f33cdca69adc",
|
||||
"4334156168b34ab599d9b5b30f522fe9", "bc4649d5ba47c7ff178d92e475960fb0",
|
||||
"8d316e5933326dcac24e1064794b5d12", "a27270fed024eafd762c95de85f4da51",
|
||||
"c33dff000d4256c2b8f3bf9e9bab14d2", "44d8cddc2ad8f79b8ed3306051722b4f",
|
||||
"eb54839b2bad6699d8946f01ec041cd0", "ecb0d56ae5f677ea45127ce9d5c058e4",
|
||||
"0b7936841f6813da818275944895b574", "9117972ef64f91a58ff73e1731c81db2",
|
||||
"c56d5e8c729e46825f46dd5d3b5d508a", "c0889e2039bcf7bcb5d2f33cdca69adc",
|
||||
"309a618577b27c648f9c5ee45252bc8f",
|
||||
};
|
||||
TestIntraPred("Intra4", pred_funcs, kVp9IntraPredNames, kNumVp9IntraFuncs,
|
||||
@ -103,18 +97,12 @@ void TestIntraPred4(VpxPredFunc const *pred_funcs) {
|
||||
void TestIntraPred8(VpxPredFunc const *pred_funcs) {
|
||||
static const int kNumVp9IntraFuncs = 13;
|
||||
static const char *const kSignatures[kNumVp9IntraFuncs] = {
|
||||
"7694ddeeefed887faf9d339d18850928",
|
||||
"7d726b1213591b99f736be6dec65065b",
|
||||
"19c5711281357a485591aaf9c96c0a67",
|
||||
"ba6b66877a089e71cd938e3b8c40caac",
|
||||
"802440c93317e0f8ba93fab02ef74265",
|
||||
"9e09a47a15deb0b9d8372824f9805080",
|
||||
"b7c2d8c662268c0c427da412d7b0311d",
|
||||
"78339c1c60bb1d67d248ab8c4da08b7f",
|
||||
"5c97d70f7d47de1882a6cd86c165c8a9",
|
||||
"8182bf60688b42205acd95e59e967157",
|
||||
"08323400005a297f16d7e57e7fe1eaac",
|
||||
"95f7bfc262329a5849eda66d8f7c68ce",
|
||||
"7694ddeeefed887faf9d339d18850928", "7d726b1213591b99f736be6dec65065b",
|
||||
"19c5711281357a485591aaf9c96c0a67", "ba6b66877a089e71cd938e3b8c40caac",
|
||||
"802440c93317e0f8ba93fab02ef74265", "9e09a47a15deb0b9d8372824f9805080",
|
||||
"b7c2d8c662268c0c427da412d7b0311d", "78339c1c60bb1d67d248ab8c4da08b7f",
|
||||
"5c97d70f7d47de1882a6cd86c165c8a9", "8182bf60688b42205acd95e59e967157",
|
||||
"08323400005a297f16d7e57e7fe1eaac", "95f7bfc262329a5849eda66d8f7c68ce",
|
||||
"815b75c8e0d91cc1ae766dc5d3e445a3",
|
||||
};
|
||||
TestIntraPred("Intra8", pred_funcs, kVp9IntraPredNames, kNumVp9IntraFuncs,
|
||||
@ -124,18 +112,12 @@ void TestIntraPred8(VpxPredFunc const *pred_funcs) {
|
||||
void TestIntraPred16(VpxPredFunc const *pred_funcs) {
|
||||
static const int kNumVp9IntraFuncs = 13;
|
||||
static const char *const kSignatures[kNumVp9IntraFuncs] = {
|
||||
"b40dbb555d5d16a043dc361e6694fe53",
|
||||
"fb08118cee3b6405d64c1fd68be878c6",
|
||||
"6c190f341475c837cc38c2e566b64875",
|
||||
"db5c34ccbe2c7f595d9b08b0dc2c698c",
|
||||
"a62cbfd153a1f0b9fed13e62b8408a7a",
|
||||
"143df5b4c89335e281103f610f5052e4",
|
||||
"d87feb124107cdf2cfb147655aa0bb3c",
|
||||
"7841fae7d4d47b519322e6a03eeed9dc",
|
||||
"f6ebed3f71cbcf8d6d0516ce87e11093",
|
||||
"3cc480297dbfeed01a1c2d78dd03d0c5",
|
||||
"b9f69fa6532b372c545397dcb78ef311",
|
||||
"a8fe1c70432f09d0c20c67bdb6432c4d",
|
||||
"b40dbb555d5d16a043dc361e6694fe53", "fb08118cee3b6405d64c1fd68be878c6",
|
||||
"6c190f341475c837cc38c2e566b64875", "db5c34ccbe2c7f595d9b08b0dc2c698c",
|
||||
"a62cbfd153a1f0b9fed13e62b8408a7a", "143df5b4c89335e281103f610f5052e4",
|
||||
"d87feb124107cdf2cfb147655aa0bb3c", "7841fae7d4d47b519322e6a03eeed9dc",
|
||||
"f6ebed3f71cbcf8d6d0516ce87e11093", "3cc480297dbfeed01a1c2d78dd03d0c5",
|
||||
"b9f69fa6532b372c545397dcb78ef311", "a8fe1c70432f09d0c20c67bdb6432c4d",
|
||||
"b8a41aa968ec108af447af4217cba91b",
|
||||
};
|
||||
TestIntraPred("Intra16", pred_funcs, kVp9IntraPredNames, kNumVp9IntraFuncs,
|
||||
@ -145,18 +127,12 @@ void TestIntraPred16(VpxPredFunc const *pred_funcs) {
|
||||
void TestIntraPred32(VpxPredFunc const *pred_funcs) {
|
||||
static const int kNumVp9IntraFuncs = 13;
|
||||
static const char *const kSignatures[kNumVp9IntraFuncs] = {
|
||||
"558541656d84f9ae7896db655826febe",
|
||||
"b3587a1f9a01495fa38c8cd3c8e2a1bf",
|
||||
"4c6501e64f25aacc55a2a16c7e8f0255",
|
||||
"b3b01379ba08916ef6b1b35f7d9ad51c",
|
||||
"0f1eb38b6cbddb3d496199ef9f329071",
|
||||
"911c06efb9ed1c3b4c104b232b55812f",
|
||||
"9225beb0ddfa7a1d24eaa1be430a6654",
|
||||
"0a6d584a44f8db9aa7ade2e2fdb9fc9e",
|
||||
"b01c9076525216925f3456f034fb6eee",
|
||||
"d267e20ad9e5cd2915d1a47254d3d149",
|
||||
"ed012a4a5da71f36c2393023184a0e59",
|
||||
"f162b51ed618d28b936974cff4391da5",
|
||||
"558541656d84f9ae7896db655826febe", "b3587a1f9a01495fa38c8cd3c8e2a1bf",
|
||||
"4c6501e64f25aacc55a2a16c7e8f0255", "b3b01379ba08916ef6b1b35f7d9ad51c",
|
||||
"0f1eb38b6cbddb3d496199ef9f329071", "911c06efb9ed1c3b4c104b232b55812f",
|
||||
"9225beb0ddfa7a1d24eaa1be430a6654", "0a6d584a44f8db9aa7ade2e2fdb9fc9e",
|
||||
"b01c9076525216925f3456f034fb6eee", "d267e20ad9e5cd2915d1a47254d3d149",
|
||||
"ed012a4a5da71f36c2393023184a0e59", "f162b51ed618d28b936974cff4391da5",
|
||||
"9e1370c6d42e08d357d9612c93a71cfc",
|
||||
};
|
||||
TestIntraPred("Intra32", pred_funcs, kVp9IntraPredNames, kNumVp9IntraFuncs,
|
||||
@ -167,13 +143,13 @@ void TestIntraPred32(VpxPredFunc const *pred_funcs) {
|
||||
|
||||
// Defines a test case for |arch| (e.g., C, SSE2, ...) passing the predictors
|
||||
// to |test_func|. The test name is 'arch.test_func', e.g., C.TestIntraPred4.
|
||||
#define INTRA_PRED_TEST(arch, test_func, dc, dc_left, dc_top, dc_128, v, h, \
|
||||
d45, d135, d117, d153, d207, d63, tm) \
|
||||
TEST(arch, test_func) { \
|
||||
static const VpxPredFunc vpx_intra_pred[] = { \
|
||||
dc, dc_left, dc_top, dc_128, v, h, d45, \
|
||||
d135, d117, d153, d207, d63, tm}; \
|
||||
test_func(vpx_intra_pred); \
|
||||
#define INTRA_PRED_TEST(arch, test_func, dc, dc_left, dc_top, dc_128, v, h, \
|
||||
d45, d135, d117, d153, d207, d63, tm) \
|
||||
TEST(arch, test_func) { \
|
||||
static const VpxPredFunc vpx_intra_pred[] = { \
|
||||
dc, dc_left, dc_top, dc_128, v, h, d45, d135, d117, d153, d207, d63, tm \
|
||||
}; \
|
||||
test_func(vpx_intra_pred); \
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -197,9 +173,8 @@ INTRA_PRED_TEST(SSE2, TestIntraPred4, vpx_dc_predictor_4x4_sse2,
|
||||
#endif // HAVE_SSE2
|
||||
|
||||
#if HAVE_SSSE3
|
||||
INTRA_PRED_TEST(SSSE3, TestIntraPred4, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL,
|
||||
vpx_d153_predictor_4x4_ssse3, NULL,
|
||||
INTRA_PRED_TEST(SSSE3, TestIntraPred4, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, vpx_d153_predictor_4x4_ssse3, NULL,
|
||||
vpx_d63_predictor_4x4_ssse3, NULL)
|
||||
#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,
|
||||
vpx_dc_left_predictor_4x4_msa, vpx_dc_top_predictor_4x4_msa,
|
||||
vpx_dc_128_predictor_4x4_msa, vpx_v_predictor_4x4_msa,
|
||||
vpx_h_predictor_4x4_msa, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, vpx_tm_predictor_4x4_msa)
|
||||
vpx_h_predictor_4x4_msa, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
vpx_tm_predictor_4x4_msa)
|
||||
#endif // HAVE_MSA
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -246,10 +221,9 @@ INTRA_PRED_TEST(SSE2, TestIntraPred8, vpx_dc_predictor_8x8_sse2,
|
||||
#endif // HAVE_SSE2
|
||||
|
||||
#if HAVE_SSSE3
|
||||
INTRA_PRED_TEST(SSSE3, TestIntraPred8, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL,
|
||||
vpx_d153_predictor_8x8_ssse3, vpx_d207_predictor_8x8_ssse3,
|
||||
vpx_d63_predictor_8x8_ssse3, NULL)
|
||||
INTRA_PRED_TEST(SSSE3, TestIntraPred8, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, vpx_d153_predictor_8x8_ssse3,
|
||||
vpx_d207_predictor_8x8_ssse3, vpx_d63_predictor_8x8_ssse3, NULL)
|
||||
#endif // HAVE_SSSE3
|
||||
|
||||
#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,
|
||||
vpx_dc_left_predictor_8x8_msa, vpx_dc_top_predictor_8x8_msa,
|
||||
vpx_dc_128_predictor_8x8_msa, vpx_v_predictor_8x8_msa,
|
||||
vpx_h_predictor_8x8_msa, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, vpx_tm_predictor_8x8_msa)
|
||||
vpx_h_predictor_8x8_msa, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
vpx_tm_predictor_8x8_msa)
|
||||
#endif // HAVE_MSA
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -296,11 +270,10 @@ INTRA_PRED_TEST(SSE2, TestIntraPred16, vpx_dc_predictor_16x16_sse2,
|
||||
#endif // HAVE_SSE2
|
||||
|
||||
#if HAVE_SSSE3
|
||||
INTRA_PRED_TEST(SSSE3, TestIntraPred16, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, vpx_d45_predictor_16x16_ssse3,
|
||||
NULL, NULL, vpx_d153_predictor_16x16_ssse3,
|
||||
vpx_d207_predictor_16x16_ssse3, vpx_d63_predictor_16x16_ssse3,
|
||||
NULL)
|
||||
INTRA_PRED_TEST(SSSE3, TestIntraPred16, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
vpx_d45_predictor_16x16_ssse3, NULL, NULL,
|
||||
vpx_d153_predictor_16x16_ssse3, vpx_d207_predictor_16x16_ssse3,
|
||||
vpx_d63_predictor_16x16_ssse3, NULL)
|
||||
#endif // HAVE_SSSE3
|
||||
|
||||
#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,
|
||||
vpx_dc_left_predictor_16x16_msa, vpx_dc_top_predictor_16x16_msa,
|
||||
vpx_dc_128_predictor_16x16_msa, vpx_v_predictor_16x16_msa,
|
||||
vpx_h_predictor_16x16_msa, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, vpx_tm_predictor_16x16_msa)
|
||||
vpx_h_predictor_16x16_msa, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
vpx_tm_predictor_16x16_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_top_predictor_32x32_sse2,
|
||||
vpx_dc_128_predictor_32x32_sse2, vpx_v_predictor_32x32_sse2,
|
||||
vpx_h_predictor_32x32_sse2, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, vpx_tm_predictor_32x32_sse2)
|
||||
vpx_h_predictor_32x32_sse2, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
vpx_tm_predictor_32x32_sse2)
|
||||
#endif // HAVE_SSE2
|
||||
|
||||
#if HAVE_SSSE3
|
||||
INTRA_PRED_TEST(SSSE3, TestIntraPred32, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, vpx_d45_predictor_32x32_ssse3, NULL, NULL,
|
||||
INTRA_PRED_TEST(SSSE3, TestIntraPred32, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
vpx_d45_predictor_32x32_ssse3, NULL, NULL,
|
||||
vpx_d153_predictor_32x32_ssse3, vpx_d207_predictor_32x32_ssse3,
|
||||
vpx_d63_predictor_32x32_ssse3, NULL)
|
||||
#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,
|
||||
vpx_dc_left_predictor_32x32_msa, vpx_dc_top_predictor_32x32_msa,
|
||||
vpx_dc_128_predictor_32x32_msa, vpx_v_predictor_32x32_msa,
|
||||
vpx_h_predictor_32x32_msa, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, vpx_tm_predictor_32x32_msa)
|
||||
vpx_h_predictor_32x32_msa, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
vpx_tm_predictor_32x32_msa)
|
||||
#endif // HAVE_MSA
|
||||
|
||||
#include "test/test_libvpx.cc"
|
||||
|
@ -41,22 +41,16 @@ int main(int argc, char **argv) {
|
||||
|
||||
#if ARCH_X86 || ARCH_X86_64
|
||||
const int simd_caps = x86_simd_caps();
|
||||
if (!(simd_caps & HAS_MMX))
|
||||
append_negative_gtest_filter(":MMX.*:MMX/*");
|
||||
if (!(simd_caps & HAS_SSE))
|
||||
append_negative_gtest_filter(":SSE.*:SSE/*");
|
||||
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_MMX)) append_negative_gtest_filter(":MMX.*:MMX/*");
|
||||
if (!(simd_caps & HAS_SSE)) append_negative_gtest_filter(":SSE.*:SSE/*");
|
||||
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))
|
||||
append_negative_gtest_filter(":SSSE3.*:SSSE3/*");
|
||||
if (!(simd_caps & HAS_SSE4_1))
|
||||
append_negative_gtest_filter(":SSE4_1.*:SSE4_1/*");
|
||||
if (!(simd_caps & HAS_AVX))
|
||||
append_negative_gtest_filter(":AVX.*:AVX/*");
|
||||
if (!(simd_caps & HAS_AVX2))
|
||||
append_negative_gtest_filter(":AVX2.*:AVX2/*");
|
||||
if (!(simd_caps & HAS_AVX)) append_negative_gtest_filter(":AVX.*:AVX/*");
|
||||
if (!(simd_caps & HAS_AVX2)) append_negative_gtest_filter(":AVX2.*:AVX2/*");
|
||||
#endif // ARCH_X86 || ARCH_X86_64
|
||||
|
||||
#if !CONFIG_SHARED
|
||||
|
@ -28,43 +28,36 @@
|
||||
|
||||
namespace {
|
||||
|
||||
enum DecodeMode {
|
||||
kSerialMode,
|
||||
kFrameParallelMode
|
||||
};
|
||||
enum DecodeMode { kSerialMode, kFrameParallelMode };
|
||||
|
||||
const int kDecodeMode = 0;
|
||||
const int kThreads = 1;
|
||||
const int kFileName = 2;
|
||||
|
||||
typedef std::tr1::tuple<int, int, const char*> DecodeParam;
|
||||
typedef std::tr1::tuple<int, int, const char *> DecodeParam;
|
||||
|
||||
class TestVectorTest : public ::libvpx_test::DecoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<DecodeParam> {
|
||||
public ::libvpx_test::CodecTestWithParam<DecodeParam> {
|
||||
protected:
|
||||
TestVectorTest()
|
||||
: DecoderTest(GET_PARAM(0)),
|
||||
md5_file_(NULL) {
|
||||
TestVectorTest() : DecoderTest(GET_PARAM(0)), md5_file_(NULL) {
|
||||
#if CONFIG_VP9_DECODER
|
||||
resize_clips_.insert(
|
||||
::libvpx_test::kVP9TestVectorsResize,
|
||||
::libvpx_test::kVP9TestVectorsResize +
|
||||
::libvpx_test::kNumVP9TestVectorsResize);
|
||||
resize_clips_.insert(::libvpx_test::kVP9TestVectorsResize,
|
||||
::libvpx_test::kVP9TestVectorsResize +
|
||||
::libvpx_test::kNumVP9TestVectorsResize);
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual ~TestVectorTest() {
|
||||
if (md5_file_)
|
||||
fclose(md5_file_);
|
||||
if (md5_file_) fclose(md5_file_);
|
||||
}
|
||||
|
||||
void OpenMD5File(const std::string& md5_file_name_) {
|
||||
void OpenMD5File(const std::string &md5_file_name_) {
|
||||
md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name_);
|
||||
ASSERT_TRUE(md5_file_ != NULL) << "Md5 file open failed. Filename: "
|
||||
<< md5_file_name_;
|
||||
<< md5_file_name_;
|
||||
}
|
||||
|
||||
virtual void DecompressedFrameHook(const vpx_image_t& img,
|
||||
virtual void DecompressedFrameHook(const vpx_image_t &img,
|
||||
const unsigned int frame_number) {
|
||||
ASSERT_TRUE(md5_file_ != NULL);
|
||||
char expected_md5[33];
|
||||
@ -121,8 +114,8 @@ TEST_P(TestVectorTest, MD5Match) {
|
||||
cfg.threads = threads;
|
||||
|
||||
snprintf(str, sizeof(str) / sizeof(str[0]) - 1,
|
||||
"file: %s mode: %s threads: %d",
|
||||
filename.c_str(), mode == 0 ? "Serial" : "Parallel", threads);
|
||||
"file: %s mode: %s threads: %d", filename.c_str(),
|
||||
mode == 0 ? "Serial" : "Parallel", threads);
|
||||
SCOPED_TRACE(str);
|
||||
|
||||
// Open compressed video file.
|
||||
@ -183,8 +176,8 @@ INSTANTIATE_TEST_CASE_P(
|
||||
::testing::Values(
|
||||
static_cast<const libvpx_test::CodecFactory *>(&libvpx_test::kVP9)),
|
||||
::testing::Combine(
|
||||
::testing::Values(1), // Frame Parallel mode.
|
||||
::testing::Range(2, 9), // With 2 ~ 8 threads.
|
||||
::testing::Values(1), // Frame Parallel mode.
|
||||
::testing::Range(2, 9), // With 2 ~ 8 threads.
|
||||
::testing::ValuesIn(libvpx_test::kVP9TestVectors,
|
||||
libvpx_test::kVP9TestVectors +
|
||||
libvpx_test::kNumVP9TestVectors))));
|
||||
|
@ -16,201 +16,324 @@ namespace libvpx_test {
|
||||
|
||||
#if CONFIG_VP8_DECODER
|
||||
const char *const kVP8TestVectors[] = {
|
||||
"vp80-00-comprehensive-001.ivf",
|
||||
"vp80-00-comprehensive-002.ivf", "vp80-00-comprehensive-003.ivf",
|
||||
"vp80-00-comprehensive-004.ivf", "vp80-00-comprehensive-005.ivf",
|
||||
"vp80-00-comprehensive-006.ivf", "vp80-00-comprehensive-007.ivf",
|
||||
"vp80-00-comprehensive-008.ivf", "vp80-00-comprehensive-009.ivf",
|
||||
"vp80-00-comprehensive-010.ivf", "vp80-00-comprehensive-011.ivf",
|
||||
"vp80-00-comprehensive-012.ivf", "vp80-00-comprehensive-013.ivf",
|
||||
"vp80-00-comprehensive-014.ivf", "vp80-00-comprehensive-015.ivf",
|
||||
"vp80-00-comprehensive-016.ivf", "vp80-00-comprehensive-017.ivf",
|
||||
"vp80-00-comprehensive-018.ivf", "vp80-01-intra-1400.ivf",
|
||||
"vp80-01-intra-1411.ivf", "vp80-01-intra-1416.ivf",
|
||||
"vp80-01-intra-1417.ivf", "vp80-02-inter-1402.ivf",
|
||||
"vp80-02-inter-1412.ivf", "vp80-02-inter-1418.ivf",
|
||||
"vp80-02-inter-1424.ivf", "vp80-03-segmentation-01.ivf",
|
||||
"vp80-03-segmentation-02.ivf", "vp80-03-segmentation-03.ivf",
|
||||
"vp80-03-segmentation-04.ivf", "vp80-03-segmentation-1401.ivf",
|
||||
"vp80-03-segmentation-1403.ivf", "vp80-03-segmentation-1407.ivf",
|
||||
"vp80-03-segmentation-1408.ivf", "vp80-03-segmentation-1409.ivf",
|
||||
"vp80-03-segmentation-1410.ivf", "vp80-03-segmentation-1413.ivf",
|
||||
"vp80-03-segmentation-1414.ivf", "vp80-03-segmentation-1415.ivf",
|
||||
"vp80-03-segmentation-1425.ivf", "vp80-03-segmentation-1426.ivf",
|
||||
"vp80-03-segmentation-1427.ivf", "vp80-03-segmentation-1432.ivf",
|
||||
"vp80-03-segmentation-1435.ivf", "vp80-03-segmentation-1436.ivf",
|
||||
"vp80-03-segmentation-1437.ivf", "vp80-03-segmentation-1441.ivf",
|
||||
"vp80-03-segmentation-1442.ivf", "vp80-04-partitions-1404.ivf",
|
||||
"vp80-04-partitions-1405.ivf", "vp80-04-partitions-1406.ivf",
|
||||
"vp80-05-sharpness-1428.ivf", "vp80-05-sharpness-1429.ivf",
|
||||
"vp80-05-sharpness-1430.ivf", "vp80-05-sharpness-1431.ivf",
|
||||
"vp80-05-sharpness-1433.ivf", "vp80-05-sharpness-1434.ivf",
|
||||
"vp80-05-sharpness-1438.ivf", "vp80-05-sharpness-1439.ivf",
|
||||
"vp80-05-sharpness-1440.ivf", "vp80-05-sharpness-1443.ivf",
|
||||
"vp80-06-smallsize.ivf"
|
||||
"vp80-00-comprehensive-001.ivf", "vp80-00-comprehensive-002.ivf",
|
||||
"vp80-00-comprehensive-003.ivf", "vp80-00-comprehensive-004.ivf",
|
||||
"vp80-00-comprehensive-005.ivf", "vp80-00-comprehensive-006.ivf",
|
||||
"vp80-00-comprehensive-007.ivf", "vp80-00-comprehensive-008.ivf",
|
||||
"vp80-00-comprehensive-009.ivf", "vp80-00-comprehensive-010.ivf",
|
||||
"vp80-00-comprehensive-011.ivf", "vp80-00-comprehensive-012.ivf",
|
||||
"vp80-00-comprehensive-013.ivf", "vp80-00-comprehensive-014.ivf",
|
||||
"vp80-00-comprehensive-015.ivf", "vp80-00-comprehensive-016.ivf",
|
||||
"vp80-00-comprehensive-017.ivf", "vp80-00-comprehensive-018.ivf",
|
||||
"vp80-01-intra-1400.ivf", "vp80-01-intra-1411.ivf",
|
||||
"vp80-01-intra-1416.ivf", "vp80-01-intra-1417.ivf",
|
||||
"vp80-02-inter-1402.ivf", "vp80-02-inter-1412.ivf",
|
||||
"vp80-02-inter-1418.ivf", "vp80-02-inter-1424.ivf",
|
||||
"vp80-03-segmentation-01.ivf", "vp80-03-segmentation-02.ivf",
|
||||
"vp80-03-segmentation-03.ivf", "vp80-03-segmentation-04.ivf",
|
||||
"vp80-03-segmentation-1401.ivf", "vp80-03-segmentation-1403.ivf",
|
||||
"vp80-03-segmentation-1407.ivf", "vp80-03-segmentation-1408.ivf",
|
||||
"vp80-03-segmentation-1409.ivf", "vp80-03-segmentation-1410.ivf",
|
||||
"vp80-03-segmentation-1413.ivf", "vp80-03-segmentation-1414.ivf",
|
||||
"vp80-03-segmentation-1415.ivf", "vp80-03-segmentation-1425.ivf",
|
||||
"vp80-03-segmentation-1426.ivf", "vp80-03-segmentation-1427.ivf",
|
||||
"vp80-03-segmentation-1432.ivf", "vp80-03-segmentation-1435.ivf",
|
||||
"vp80-03-segmentation-1436.ivf", "vp80-03-segmentation-1437.ivf",
|
||||
"vp80-03-segmentation-1441.ivf", "vp80-03-segmentation-1442.ivf",
|
||||
"vp80-04-partitions-1404.ivf", "vp80-04-partitions-1405.ivf",
|
||||
"vp80-04-partitions-1406.ivf", "vp80-05-sharpness-1428.ivf",
|
||||
"vp80-05-sharpness-1429.ivf", "vp80-05-sharpness-1430.ivf",
|
||||
"vp80-05-sharpness-1431.ivf", "vp80-05-sharpness-1433.ivf",
|
||||
"vp80-05-sharpness-1434.ivf", "vp80-05-sharpness-1438.ivf",
|
||||
"vp80-05-sharpness-1439.ivf", "vp80-05-sharpness-1440.ivf",
|
||||
"vp80-05-sharpness-1443.ivf", "vp80-06-smallsize.ivf"
|
||||
};
|
||||
const int kNumVP8TestVectors = NELEMENTS(kVP8TestVectors);
|
||||
#endif // CONFIG_VP8_DECODER
|
||||
#if CONFIG_VP9_DECODER
|
||||
#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_7_1-2.webm", \
|
||||
"vp90-2-21-resize_inter_320x180_7_3-4.webm", \
|
||||
"vp90-2-21-resize_inter_320x240_5_1-2.webm", \
|
||||
"vp90-2-21-resize_inter_320x240_5_3-4.webm", \
|
||||
"vp90-2-21-resize_inter_320x240_7_1-2.webm", \
|
||||
"vp90-2-21-resize_inter_320x240_7_3-4.webm", \
|
||||
"vp90-2-21-resize_inter_640x360_5_1-2.webm", \
|
||||
"vp90-2-21-resize_inter_640x360_5_3-4.webm", \
|
||||
"vp90-2-21-resize_inter_640x360_7_1-2.webm", \
|
||||
"vp90-2-21-resize_inter_640x360_7_3-4.webm", \
|
||||
"vp90-2-21-resize_inter_640x480_5_1-2.webm", \
|
||||
"vp90-2-21-resize_inter_640x480_5_3-4.webm", \
|
||||
"vp90-2-21-resize_inter_640x480_7_1-2.webm", \
|
||||
"vp90-2-21-resize_inter_640x480_7_3-4.webm", \
|
||||
"vp90-2-21-resize_inter_1280x720_5_1-2.webm", \
|
||||
"vp90-2-21-resize_inter_1280x720_5_3-4.webm", \
|
||||
"vp90-2-21-resize_inter_1280x720_7_1-2.webm", \
|
||||
"vp90-2-21-resize_inter_1280x720_7_3-4.webm", \
|
||||
"vp90-2-21-resize_inter_1920x1080_5_1-2.webm", \
|
||||
"vp90-2-21-resize_inter_1920x1080_5_3-4.webm", \
|
||||
"vp90-2-21-resize_inter_1920x1080_7_1-2.webm", \
|
||||
"vp90-2-21-resize_inter_1920x1080_7_3-4.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_7_1-2.webm", \
|
||||
"vp90-2-21-resize_inter_320x180_7_3-4.webm", \
|
||||
"vp90-2-21-resize_inter_320x240_5_1-2.webm", \
|
||||
"vp90-2-21-resize_inter_320x240_5_3-4.webm", \
|
||||
"vp90-2-21-resize_inter_320x240_7_1-2.webm", \
|
||||
"vp90-2-21-resize_inter_320x240_7_3-4.webm", \
|
||||
"vp90-2-21-resize_inter_640x360_5_1-2.webm", \
|
||||
"vp90-2-21-resize_inter_640x360_5_3-4.webm", \
|
||||
"vp90-2-21-resize_inter_640x360_7_1-2.webm", \
|
||||
"vp90-2-21-resize_inter_640x360_7_3-4.webm", \
|
||||
"vp90-2-21-resize_inter_640x480_5_1-2.webm", \
|
||||
"vp90-2-21-resize_inter_640x480_5_3-4.webm", \
|
||||
"vp90-2-21-resize_inter_640x480_7_1-2.webm", \
|
||||
"vp90-2-21-resize_inter_640x480_7_3-4.webm", \
|
||||
"vp90-2-21-resize_inter_1280x720_5_1-2.webm", \
|
||||
"vp90-2-21-resize_inter_1280x720_5_3-4.webm", \
|
||||
"vp90-2-21-resize_inter_1280x720_7_1-2.webm", \
|
||||
"vp90-2-21-resize_inter_1280x720_7_3-4.webm", \
|
||||
"vp90-2-21-resize_inter_1920x1080_5_1-2.webm", \
|
||||
"vp90-2-21-resize_inter_1920x1080_5_3-4.webm", \
|
||||
"vp90-2-21-resize_inter_1920x1080_7_1-2.webm", \
|
||||
"vp90-2-21-resize_inter_1920x1080_7_3-4.webm",
|
||||
|
||||
const char *const kVP9TestVectors[] = {
|
||||
"vp90-2-00-quantizer-00.webm", "vp90-2-00-quantizer-01.webm",
|
||||
"vp90-2-00-quantizer-02.webm", "vp90-2-00-quantizer-03.webm",
|
||||
"vp90-2-00-quantizer-04.webm", "vp90-2-00-quantizer-05.webm",
|
||||
"vp90-2-00-quantizer-06.webm", "vp90-2-00-quantizer-07.webm",
|
||||
"vp90-2-00-quantizer-08.webm", "vp90-2-00-quantizer-09.webm",
|
||||
"vp90-2-00-quantizer-10.webm", "vp90-2-00-quantizer-11.webm",
|
||||
"vp90-2-00-quantizer-12.webm", "vp90-2-00-quantizer-13.webm",
|
||||
"vp90-2-00-quantizer-14.webm", "vp90-2-00-quantizer-15.webm",
|
||||
"vp90-2-00-quantizer-16.webm", "vp90-2-00-quantizer-17.webm",
|
||||
"vp90-2-00-quantizer-18.webm", "vp90-2-00-quantizer-19.webm",
|
||||
"vp90-2-00-quantizer-20.webm", "vp90-2-00-quantizer-21.webm",
|
||||
"vp90-2-00-quantizer-22.webm", "vp90-2-00-quantizer-23.webm",
|
||||
"vp90-2-00-quantizer-24.webm", "vp90-2-00-quantizer-25.webm",
|
||||
"vp90-2-00-quantizer-26.webm", "vp90-2-00-quantizer-27.webm",
|
||||
"vp90-2-00-quantizer-28.webm", "vp90-2-00-quantizer-29.webm",
|
||||
"vp90-2-00-quantizer-30.webm", "vp90-2-00-quantizer-31.webm",
|
||||
"vp90-2-00-quantizer-32.webm", "vp90-2-00-quantizer-33.webm",
|
||||
"vp90-2-00-quantizer-34.webm", "vp90-2-00-quantizer-35.webm",
|
||||
"vp90-2-00-quantizer-36.webm", "vp90-2-00-quantizer-37.webm",
|
||||
"vp90-2-00-quantizer-38.webm", "vp90-2-00-quantizer-39.webm",
|
||||
"vp90-2-00-quantizer-40.webm", "vp90-2-00-quantizer-41.webm",
|
||||
"vp90-2-00-quantizer-42.webm", "vp90-2-00-quantizer-43.webm",
|
||||
"vp90-2-00-quantizer-44.webm", "vp90-2-00-quantizer-45.webm",
|
||||
"vp90-2-00-quantizer-46.webm", "vp90-2-00-quantizer-47.webm",
|
||||
"vp90-2-00-quantizer-48.webm", "vp90-2-00-quantizer-49.webm",
|
||||
"vp90-2-00-quantizer-50.webm", "vp90-2-00-quantizer-51.webm",
|
||||
"vp90-2-00-quantizer-52.webm", "vp90-2-00-quantizer-53.webm",
|
||||
"vp90-2-00-quantizer-54.webm", "vp90-2-00-quantizer-55.webm",
|
||||
"vp90-2-00-quantizer-56.webm", "vp90-2-00-quantizer-57.webm",
|
||||
"vp90-2-00-quantizer-58.webm", "vp90-2-00-quantizer-59.webm",
|
||||
"vp90-2-00-quantizer-60.webm", "vp90-2-00-quantizer-61.webm",
|
||||
"vp90-2-00-quantizer-62.webm", "vp90-2-00-quantizer-63.webm",
|
||||
"vp90-2-01-sharpness-1.webm", "vp90-2-01-sharpness-2.webm",
|
||||
"vp90-2-01-sharpness-3.webm", "vp90-2-01-sharpness-4.webm",
|
||||
"vp90-2-01-sharpness-5.webm", "vp90-2-01-sharpness-6.webm",
|
||||
"vp90-2-01-sharpness-7.webm", "vp90-2-02-size-08x08.webm",
|
||||
"vp90-2-02-size-08x10.webm", "vp90-2-02-size-08x16.webm",
|
||||
"vp90-2-02-size-08x18.webm", "vp90-2-02-size-08x32.webm",
|
||||
"vp90-2-02-size-08x34.webm", "vp90-2-02-size-08x64.webm",
|
||||
"vp90-2-02-size-08x66.webm", "vp90-2-02-size-10x08.webm",
|
||||
"vp90-2-02-size-10x10.webm", "vp90-2-02-size-10x16.webm",
|
||||
"vp90-2-02-size-10x18.webm", "vp90-2-02-size-10x32.webm",
|
||||
"vp90-2-02-size-10x34.webm", "vp90-2-02-size-10x64.webm",
|
||||
"vp90-2-02-size-10x66.webm", "vp90-2-02-size-16x08.webm",
|
||||
"vp90-2-02-size-16x10.webm", "vp90-2-02-size-16x16.webm",
|
||||
"vp90-2-02-size-16x18.webm", "vp90-2-02-size-16x32.webm",
|
||||
"vp90-2-02-size-16x34.webm", "vp90-2-02-size-16x64.webm",
|
||||
"vp90-2-02-size-16x66.webm", "vp90-2-02-size-18x08.webm",
|
||||
"vp90-2-02-size-18x10.webm", "vp90-2-02-size-18x16.webm",
|
||||
"vp90-2-02-size-18x18.webm", "vp90-2-02-size-18x32.webm",
|
||||
"vp90-2-02-size-18x34.webm", "vp90-2-02-size-18x64.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-00-quantizer-00.webm",
|
||||
"vp90-2-00-quantizer-01.webm",
|
||||
"vp90-2-00-quantizer-02.webm",
|
||||
"vp90-2-00-quantizer-03.webm",
|
||||
"vp90-2-00-quantizer-04.webm",
|
||||
"vp90-2-00-quantizer-05.webm",
|
||||
"vp90-2-00-quantizer-06.webm",
|
||||
"vp90-2-00-quantizer-07.webm",
|
||||
"vp90-2-00-quantizer-08.webm",
|
||||
"vp90-2-00-quantizer-09.webm",
|
||||
"vp90-2-00-quantizer-10.webm",
|
||||
"vp90-2-00-quantizer-11.webm",
|
||||
"vp90-2-00-quantizer-12.webm",
|
||||
"vp90-2-00-quantizer-13.webm",
|
||||
"vp90-2-00-quantizer-14.webm",
|
||||
"vp90-2-00-quantizer-15.webm",
|
||||
"vp90-2-00-quantizer-16.webm",
|
||||
"vp90-2-00-quantizer-17.webm",
|
||||
"vp90-2-00-quantizer-18.webm",
|
||||
"vp90-2-00-quantizer-19.webm",
|
||||
"vp90-2-00-quantizer-20.webm",
|
||||
"vp90-2-00-quantizer-21.webm",
|
||||
"vp90-2-00-quantizer-22.webm",
|
||||
"vp90-2-00-quantizer-23.webm",
|
||||
"vp90-2-00-quantizer-24.webm",
|
||||
"vp90-2-00-quantizer-25.webm",
|
||||
"vp90-2-00-quantizer-26.webm",
|
||||
"vp90-2-00-quantizer-27.webm",
|
||||
"vp90-2-00-quantizer-28.webm",
|
||||
"vp90-2-00-quantizer-29.webm",
|
||||
"vp90-2-00-quantizer-30.webm",
|
||||
"vp90-2-00-quantizer-31.webm",
|
||||
"vp90-2-00-quantizer-32.webm",
|
||||
"vp90-2-00-quantizer-33.webm",
|
||||
"vp90-2-00-quantizer-34.webm",
|
||||
"vp90-2-00-quantizer-35.webm",
|
||||
"vp90-2-00-quantizer-36.webm",
|
||||
"vp90-2-00-quantizer-37.webm",
|
||||
"vp90-2-00-quantizer-38.webm",
|
||||
"vp90-2-00-quantizer-39.webm",
|
||||
"vp90-2-00-quantizer-40.webm",
|
||||
"vp90-2-00-quantizer-41.webm",
|
||||
"vp90-2-00-quantizer-42.webm",
|
||||
"vp90-2-00-quantizer-43.webm",
|
||||
"vp90-2-00-quantizer-44.webm",
|
||||
"vp90-2-00-quantizer-45.webm",
|
||||
"vp90-2-00-quantizer-46.webm",
|
||||
"vp90-2-00-quantizer-47.webm",
|
||||
"vp90-2-00-quantizer-48.webm",
|
||||
"vp90-2-00-quantizer-49.webm",
|
||||
"vp90-2-00-quantizer-50.webm",
|
||||
"vp90-2-00-quantizer-51.webm",
|
||||
"vp90-2-00-quantizer-52.webm",
|
||||
"vp90-2-00-quantizer-53.webm",
|
||||
"vp90-2-00-quantizer-54.webm",
|
||||
"vp90-2-00-quantizer-55.webm",
|
||||
"vp90-2-00-quantizer-56.webm",
|
||||
"vp90-2-00-quantizer-57.webm",
|
||||
"vp90-2-00-quantizer-58.webm",
|
||||
"vp90-2-00-quantizer-59.webm",
|
||||
"vp90-2-00-quantizer-60.webm",
|
||||
"vp90-2-00-quantizer-61.webm",
|
||||
"vp90-2-00-quantizer-62.webm",
|
||||
"vp90-2-00-quantizer-63.webm",
|
||||
"vp90-2-01-sharpness-1.webm",
|
||||
"vp90-2-01-sharpness-2.webm",
|
||||
"vp90-2-01-sharpness-3.webm",
|
||||
"vp90-2-01-sharpness-4.webm",
|
||||
"vp90-2-01-sharpness-5.webm",
|
||||
"vp90-2-01-sharpness-6.webm",
|
||||
"vp90-2-01-sharpness-7.webm",
|
||||
"vp90-2-02-size-08x08.webm",
|
||||
"vp90-2-02-size-08x10.webm",
|
||||
"vp90-2-02-size-08x16.webm",
|
||||
"vp90-2-02-size-08x18.webm",
|
||||
"vp90-2-02-size-08x32.webm",
|
||||
"vp90-2-02-size-08x34.webm",
|
||||
"vp90-2-02-size-08x64.webm",
|
||||
"vp90-2-02-size-08x66.webm",
|
||||
"vp90-2-02-size-10x08.webm",
|
||||
"vp90-2-02-size-10x10.webm",
|
||||
"vp90-2-02-size-10x16.webm",
|
||||
"vp90-2-02-size-10x18.webm",
|
||||
"vp90-2-02-size-10x32.webm",
|
||||
"vp90-2-02-size-10x34.webm",
|
||||
"vp90-2-02-size-10x64.webm",
|
||||
"vp90-2-02-size-10x66.webm",
|
||||
"vp90-2-02-size-16x08.webm",
|
||||
"vp90-2-02-size-16x10.webm",
|
||||
"vp90-2-02-size-16x16.webm",
|
||||
"vp90-2-02-size-16x18.webm",
|
||||
"vp90-2-02-size-16x32.webm",
|
||||
"vp90-2-02-size-16x34.webm",
|
||||
"vp90-2-02-size-16x64.webm",
|
||||
"vp90-2-02-size-16x66.webm",
|
||||
"vp90-2-02-size-18x08.webm",
|
||||
"vp90-2-02-size-18x10.webm",
|
||||
"vp90-2-02-size-18x16.webm",
|
||||
"vp90-2-02-size-18x18.webm",
|
||||
"vp90-2-02-size-18x32.webm",
|
||||
"vp90-2-02-size-18x34.webm",
|
||||
"vp90-2-02-size-18x64.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-05-resize.ivf", "vp90-2-06-bilinear.webm",
|
||||
"vp90-2-07-frame_parallel.webm", "vp90-2-08-tile_1x2_frame_parallel.webm",
|
||||
"vp90-2-08-tile_1x2.webm", "vp90-2-08-tile_1x4_frame_parallel.webm",
|
||||
"vp90-2-08-tile_1x4.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-05-resize.ivf",
|
||||
"vp90-2-06-bilinear.webm",
|
||||
"vp90-2-07-frame_parallel.webm",
|
||||
"vp90-2-08-tile_1x2_frame_parallel.webm",
|
||||
"vp90-2-08-tile_1x2.webm",
|
||||
"vp90-2-08-tile_1x4_frame_parallel.webm",
|
||||
"vp90-2-08-tile_1x4.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-11-size-351x287.webm", "vp90-2-11-size-351x288.webm",
|
||||
"vp90-2-11-size-352x287.webm", "vp90-2-12-droppable_1.ivf",
|
||||
"vp90-2-12-droppable_2.ivf", "vp90-2-12-droppable_3.ivf",
|
||||
"vp90-2-11-size-351x287.webm",
|
||||
"vp90-2-11-size-351x288.webm",
|
||||
"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 || \
|
||||
(DECODE_WIDTH_LIMIT >= 20400 && DECODE_HEIGHT_LIMIT >= 120)
|
||||
"vp90-2-13-largescaling.webm",
|
||||
#endif
|
||||
"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.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-1-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-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-2-16.webm", "vp90-2-14-resize-fp-tiles-2-1.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-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-fp-tiles-16-8.webm",
|
||||
"vp90-2-14-resize-fp-tiles-1-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-2-4.webm",
|
||||
"vp90-2-14-resize-fp-tiles-2-8.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.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-4-2-1.webm",
|
||||
"vp90-2-14-resize-10frames-fp-tiles-8-4.webm",
|
||||
"vp90-2-15-segkey.webm", "vp90-2-15-segkey_adpq.webm",
|
||||
"vp90-2-16-intra-only.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",
|
||||
"vp90-2-15-segkey.webm",
|
||||
"vp90-2-15-segkey_adpq.webm",
|
||||
"vp90-2-16-intra-only.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-yuv422.webm", "vp91-2-04-yuv440.webm",
|
||||
"vp91-2-04-yuv422.webm",
|
||||
"vp91-2-04-yuv440.webm",
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
"vp92-2-20-10bit-yuv420.webm", "vp92-2-20-12bit-yuv420.webm",
|
||||
"vp93-2-20-10bit-yuv422.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",
|
||||
"vp92-2-20-10bit-yuv420.webm",
|
||||
"vp92-2-20-12bit-yuv420.webm",
|
||||
"vp93-2-20-10bit-yuv422.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
|
||||
"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
|
||||
};
|
||||
const int kNumVP9TestVectors = NELEMENTS(kVP9TestVectors);
|
||||
const char *const kVP9TestVectorsResize[] = {
|
||||
RESIZE_TEST_VECTORS
|
||||
};
|
||||
const char *const kVP9TestVectorsResize[] = { RESIZE_TEST_VECTORS };
|
||||
const int kNumVP9TestVectorsResize = NELEMENTS(kVP9TestVectorsResize);
|
||||
#undef RESIZE_TEST_VECTORS
|
||||
#endif // CONFIG_VP9_DECODER
|
||||
|
@ -24,9 +24,7 @@ class TileIndependenceTest : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<int> {
|
||||
protected:
|
||||
TileIndependenceTest()
|
||||
: EncoderTest(GET_PARAM(0)),
|
||||
md5_fw_order_(),
|
||||
md5_inv_order_(),
|
||||
: EncoderTest(GET_PARAM(0)), md5_fw_order_(), md5_inv_order_(),
|
||||
n_tiles_(GET_PARAM(1)) {
|
||||
init_flags_ = VPX_CODEC_USE_PSNR;
|
||||
vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
|
||||
@ -58,7 +56,7 @@ class TileIndependenceTest : public ::libvpx_test::EncoderTest,
|
||||
void UpdateMD5(::libvpx_test::Decoder *dec, const vpx_codec_cx_pkt_t *pkt,
|
||||
::libvpx_test::MD5 *md5) {
|
||||
const vpx_codec_err_t res = dec->DecodeFrame(
|
||||
reinterpret_cast<uint8_t*>(pkt->data.frame.buf), pkt->data.frame.sz);
|
||||
reinterpret_cast<uint8_t *>(pkt->data.frame.buf), pkt->data.frame.sz);
|
||||
if (res != VPX_CODEC_OK) {
|
||||
abort_ = true;
|
||||
ASSERT_EQ(VPX_CODEC_OK, res);
|
||||
|
@ -34,8 +34,8 @@ using libvpx_test::ACMRandom;
|
||||
|
||||
void CheckUserPrivateData(void *user_priv, int *target) {
|
||||
// actual pointer value should be the same as expected.
|
||||
EXPECT_EQ(reinterpret_cast<void *>(target), user_priv) <<
|
||||
"user_priv pointer value does not match.";
|
||||
EXPECT_EQ(reinterpret_cast<void *>(target), user_priv)
|
||||
<< "user_priv pointer value does not match.";
|
||||
}
|
||||
|
||||
// Decodes |filename|. Passes in user_priv data when calling DecodeFrame and
|
||||
|
@ -17,14 +17,13 @@
|
||||
#include "vpx/vpx_image.h"
|
||||
|
||||
// Macros
|
||||
#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) {
|
||||
assert((img1->fmt == img2->fmt) &&
|
||||
(img1->d_w == img2->d_w) &&
|
||||
assert((img1->fmt == img2->fmt) && (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;
|
||||
unsigned int i, j;
|
||||
|
||||
|
@ -57,8 +57,7 @@ static void RoundHighBitDepth(int bit_depth, int64_t *se, uint64_t *sse) {
|
||||
*se = (*se + 2) >> 2;
|
||||
break;
|
||||
case VPX_BITS_8:
|
||||
default:
|
||||
break;
|
||||
default: 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
|
||||
* (src - ref).
|
||||
*/
|
||||
static uint32_t variance_ref(const uint8_t *src, const uint8_t *ref,
|
||||
int l2w, int l2h, int src_stride,
|
||||
int ref_stride, uint32_t *sse_ptr,
|
||||
bool use_high_bit_depth_,
|
||||
static uint32_t variance_ref(const uint8_t *src, const uint8_t *ref, int l2w,
|
||||
int l2h, int src_stride, int ref_stride,
|
||||
uint32_t *sse_ptr, bool use_high_bit_depth_,
|
||||
vpx_bit_depth_t bit_depth) {
|
||||
int64_t se = 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++) {
|
||||
int diff;
|
||||
if (!use_high_bit_depth_) {
|
||||
diff = src[y * src_stride + x] -
|
||||
ref[y * ref_stride + x];
|
||||
diff = src[y * src_stride + x] - ref[y * ref_stride + x];
|
||||
se += diff;
|
||||
sse += diff * diff;
|
||||
#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);
|
||||
*sse_ptr = static_cast<uint32_t>(sse);
|
||||
return static_cast<uint32_t>(sse -
|
||||
((static_cast<int64_t>(se) * se) >>
|
||||
(l2w + l2h)));
|
||||
return static_cast<uint32_t>(
|
||||
sse - ((static_cast<int64_t>(se) * se) >> (l2w + l2h)));
|
||||
}
|
||||
|
||||
/* 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,
|
||||
int l2w, int l2h, int xoff, int yoff,
|
||||
uint32_t *sse_ptr,
|
||||
bool use_high_bit_depth_,
|
||||
uint32_t *sse_ptr, bool use_high_bit_depth_,
|
||||
vpx_bit_depth_t bit_depth) {
|
||||
int64_t se = 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);
|
||||
*sse_ptr = static_cast<uint32_t>(sse);
|
||||
return static_cast<uint32_t>(sse -
|
||||
((static_cast<int64_t>(se) * se) >>
|
||||
(l2w + l2h)));
|
||||
return static_cast<uint32_t>(
|
||||
sse - ((static_cast<int64_t>(se) * se) >> (l2w + l2h)));
|
||||
}
|
||||
|
||||
static uint32_t subpel_avg_variance_ref(const uint8_t *ref,
|
||||
const uint8_t *src,
|
||||
const uint8_t *second_pred,
|
||||
int l2w, int l2h,
|
||||
int xoff, int yoff,
|
||||
static uint32_t subpel_avg_variance_ref(const uint8_t *ref, const uint8_t *src,
|
||||
const uint8_t *second_pred, int l2w,
|
||||
int l2h, int xoff, int yoff,
|
||||
uint32_t *sse_ptr,
|
||||
bool use_high_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);
|
||||
*sse_ptr = static_cast<uint32_t>(sse);
|
||||
return static_cast<uint32_t>(sse -
|
||||
((static_cast<int64_t>(se) * se) >>
|
||||
(l2w + l2h)));
|
||||
return static_cast<uint32_t>(
|
||||
sse - ((static_cast<int64_t>(se) * se) >> (l2w + l2h)));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -229,9 +220,7 @@ class SumOfSquaresTest : public ::testing::TestWithParam<SumOfSquaresFunction> {
|
||||
public:
|
||||
SumOfSquaresTest() : func_(GetParam()) {}
|
||||
|
||||
virtual ~SumOfSquaresTest() {
|
||||
libvpx_test::ClearSystemState();
|
||||
}
|
||||
virtual ~SumOfSquaresTest() { libvpx_test::ClearSystemState(); }
|
||||
|
||||
protected:
|
||||
void ConstTest();
|
||||
@ -272,10 +261,10 @@ void SumOfSquaresTest::RefTest() {
|
||||
// some testing context.
|
||||
// Can be used for MSE, SSE, Variance, etc.
|
||||
|
||||
template<typename Func>
|
||||
template <typename Func>
|
||||
struct TestParams {
|
||||
TestParams(int log2w = 0, int log2h = 0,
|
||||
Func function = NULL, int bit_depth_value = 0)
|
||||
TestParams(int log2w = 0, int log2h = 0, Func function = NULL,
|
||||
int bit_depth_value = 0)
|
||||
: log2width(log2w), log2height(log2h), func(function) {
|
||||
use_high_bit_depth = (bit_depth_value > 0);
|
||||
if (use_high_bit_depth) {
|
||||
@ -298,17 +287,17 @@ struct TestParams {
|
||||
uint32_t mask;
|
||||
};
|
||||
|
||||
template<typename Func>
|
||||
template <typename Func>
|
||||
std::ostream &operator<<(std::ostream &os, const TestParams<Func> &p) {
|
||||
return os << "log2width/height:" << p.log2width << "/" << p.log2height
|
||||
<< " function:" << reinterpret_cast<const void*>(p.func)
|
||||
<< " function:" << reinterpret_cast<const void *>(p.func)
|
||||
<< " bit-depth:" << p.bit_depth;
|
||||
}
|
||||
|
||||
// Main class for testing a function type
|
||||
template<typename FunctionType>
|
||||
class MainTestClass :
|
||||
public ::testing::TestWithParam<TestParams<FunctionType> > {
|
||||
template <typename FunctionType>
|
||||
class MainTestClass
|
||||
: public ::testing::TestWithParam<TestParams<FunctionType> > {
|
||||
public:
|
||||
virtual void SetUp() {
|
||||
params_ = this->GetParam();
|
||||
@ -316,7 +305,7 @@ class MainTestClass :
|
||||
rnd_.Reset(ACMRandom::DeterministicSeed());
|
||||
const size_t unit =
|
||||
use_high_bit_depth() ? sizeof(uint16_t) : sizeof(uint8_t);
|
||||
src_ = reinterpret_cast<uint8_t*>(vpx_memalign(16, block_size() * unit));
|
||||
src_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size() * unit));
|
||||
ref_ = new uint8_t[block_size() * unit];
|
||||
ASSERT_TRUE(src_ != NULL);
|
||||
ASSERT_TRUE(ref_ != NULL);
|
||||
@ -333,8 +322,8 @@ class MainTestClass :
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
if (use_high_bit_depth()) {
|
||||
// TODO(skal): remove!
|
||||
src_ = reinterpret_cast<uint8_t*>(CONVERT_TO_SHORTPTR(src_));
|
||||
ref_ = reinterpret_cast<uint8_t*>(CONVERT_TO_SHORTPTR(ref_));
|
||||
src_ = reinterpret_cast<uint8_t *>(CONVERT_TO_SHORTPTR(src_));
|
||||
ref_ = reinterpret_cast<uint8_t *>(CONVERT_TO_SHORTPTR(ref_));
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -380,20 +369,20 @@ class MainTestClass :
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Tests related to variance.
|
||||
|
||||
template<typename VarianceFunctionType>
|
||||
template <typename VarianceFunctionType>
|
||||
void MainTestClass<VarianceFunctionType>::ZeroTest() {
|
||||
for (int i = 0; i <= 255; ++i) {
|
||||
if (!use_high_bit_depth()) {
|
||||
memset(src_, i, block_size());
|
||||
} else {
|
||||
uint16_t* const src16 = CONVERT_TO_SHORTPTR(src_);
|
||||
uint16_t *const src16 = CONVERT_TO_SHORTPTR(src_);
|
||||
for (int k = 0; k < block_size(); ++k) src16[k] = i << byte_shift();
|
||||
}
|
||||
for (int j = 0; j <= 255; ++j) {
|
||||
if (!use_high_bit_depth()) {
|
||||
memset(ref_, j, block_size());
|
||||
} else {
|
||||
uint16_t* const ref16 = CONVERT_TO_SHORTPTR(ref_);
|
||||
uint16_t *const ref16 = CONVERT_TO_SHORTPTR(ref_);
|
||||
for (int k = 0; k < block_size(); ++k) ref16[k] = j << byte_shift();
|
||||
}
|
||||
unsigned int sse, var;
|
||||
@ -404,7 +393,7 @@ void MainTestClass<VarianceFunctionType>::ZeroTest() {
|
||||
}
|
||||
}
|
||||
|
||||
template<typename VarianceFunctionType>
|
||||
template <typename VarianceFunctionType>
|
||||
void MainTestClass<VarianceFunctionType>::RefTest() {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
for (int j = 0; j < block_size(); j++) {
|
||||
@ -422,15 +411,15 @@ void MainTestClass<VarianceFunctionType>::RefTest() {
|
||||
const int stride = width();
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
var1 = params_.func(src_, stride, ref_, stride, &sse1));
|
||||
var2 = variance_ref(src_, ref_, params_.log2width, params_.log2height,
|
||||
stride, stride, &sse2,
|
||||
use_high_bit_depth(), params_.bit_depth);
|
||||
var2 =
|
||||
variance_ref(src_, ref_, params_.log2width, params_.log2height, stride,
|
||||
stride, &sse2, use_high_bit_depth(), params_.bit_depth);
|
||||
EXPECT_EQ(sse1, sse2) << "Error at test index: " << i;
|
||||
EXPECT_EQ(var1, var2) << "Error at test index: " << i;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename VarianceFunctionType>
|
||||
template <typename VarianceFunctionType>
|
||||
void MainTestClass<VarianceFunctionType>::RefStrideTest() {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
const int ref_stride = (i & 1) * width();
|
||||
@ -453,16 +442,15 @@ void MainTestClass<VarianceFunctionType>::RefStrideTest() {
|
||||
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
var1 = params_.func(src_, src_stride, ref_, ref_stride, &sse1));
|
||||
var2 = variance_ref(src_, ref_,
|
||||
params_.log2width, params_.log2height,
|
||||
src_stride, ref_stride, &sse2,
|
||||
use_high_bit_depth(), params_.bit_depth);
|
||||
var2 = variance_ref(src_, ref_, params_.log2width, params_.log2height,
|
||||
src_stride, ref_stride, &sse2, use_high_bit_depth(),
|
||||
params_.bit_depth);
|
||||
EXPECT_EQ(sse1, sse2) << "Error at test index: " << i;
|
||||
EXPECT_EQ(var1, var2) << "Error at test index: " << i;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename VarianceFunctionType>
|
||||
template <typename VarianceFunctionType>
|
||||
void MainTestClass<VarianceFunctionType>::OneQuarterTest() {
|
||||
const int half = block_size() / 2;
|
||||
if (!use_high_bit_depth()) {
|
||||
@ -486,7 +474,7 @@ void MainTestClass<VarianceFunctionType>::OneQuarterTest() {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Tests related to MSE / SSE.
|
||||
|
||||
template<typename FunctionType>
|
||||
template <typename FunctionType>
|
||||
void MainTestClass<FunctionType>::RefTestMse() {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
for (int j = 0; j < block_size(); ++j) {
|
||||
@ -496,13 +484,13 @@ void MainTestClass<FunctionType>::RefTestMse() {
|
||||
unsigned int sse1, sse2;
|
||||
const int stride = width();
|
||||
ASM_REGISTER_STATE_CHECK(params_.func(src_, stride, ref_, stride, &sse1));
|
||||
variance_ref(src_, ref_, params_.log2width, params_.log2height,
|
||||
stride, stride, &sse2, false, VPX_BITS_8);
|
||||
variance_ref(src_, ref_, params_.log2width, params_.log2height, stride,
|
||||
stride, &sse2, false, VPX_BITS_8);
|
||||
EXPECT_EQ(sse1, sse2);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename FunctionType>
|
||||
template <typename FunctionType>
|
||||
void MainTestClass<FunctionType>::RefTestSse() {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
for (int j = 0; j < block_size(); ++j) {
|
||||
@ -513,13 +501,13 @@ void MainTestClass<FunctionType>::RefTestSse() {
|
||||
unsigned int var1;
|
||||
const int stride = width();
|
||||
ASM_REGISTER_STATE_CHECK(var1 = params_.func(src_, stride, ref_, stride));
|
||||
variance_ref(src_, ref_, params_.log2width, params_.log2height,
|
||||
stride, stride, &sse2, false, VPX_BITS_8);
|
||||
variance_ref(src_, ref_, params_.log2width, params_.log2height, stride,
|
||||
stride, &sse2, false, VPX_BITS_8);
|
||||
EXPECT_EQ(var1, sse2);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename FunctionType>
|
||||
template <typename FunctionType>
|
||||
void MainTestClass<FunctionType>::MaxTestMse() {
|
||||
memset(src_, 255, block_size());
|
||||
memset(ref_, 0, block_size());
|
||||
@ -529,7 +517,7 @@ void MainTestClass<FunctionType>::MaxTestMse() {
|
||||
EXPECT_EQ(expected, sse);
|
||||
}
|
||||
|
||||
template<typename FunctionType>
|
||||
template <typename FunctionType>
|
||||
void MainTestClass<FunctionType>::MaxTestSse() {
|
||||
memset(src_, 255, block_size());
|
||||
memset(ref_, 0, block_size());
|
||||
@ -545,27 +533,27 @@ using ::std::tr1::get;
|
||||
using ::std::tr1::make_tuple;
|
||||
using ::std::tr1::tuple;
|
||||
|
||||
template<typename SubpelVarianceFunctionType>
|
||||
template <typename SubpelVarianceFunctionType>
|
||||
class SubpelVarianceTest
|
||||
: public ::testing::TestWithParam<tuple<int, int,
|
||||
SubpelVarianceFunctionType, int> > {
|
||||
: public ::testing::TestWithParam<
|
||||
tuple<int, int, SubpelVarianceFunctionType, int> > {
|
||||
public:
|
||||
virtual void SetUp() {
|
||||
const tuple<int, int, SubpelVarianceFunctionType, int>& params =
|
||||
const tuple<int, int, SubpelVarianceFunctionType, int> ¶ms =
|
||||
this->GetParam();
|
||||
log2width_ = get<0>(params);
|
||||
log2width_ = get<0>(params);
|
||||
width_ = 1 << log2width_;
|
||||
log2height_ = get<1>(params);
|
||||
height_ = 1 << log2height_;
|
||||
subpel_variance_ = get<2>(params);
|
||||
if (get<3>(params)) {
|
||||
bit_depth_ = (vpx_bit_depth_t) get<3>(params);
|
||||
bit_depth_ = (vpx_bit_depth_t)get<3>(params);
|
||||
use_high_bit_depth_ = true;
|
||||
} else {
|
||||
bit_depth_ = VPX_BITS_8;
|
||||
use_high_bit_depth_ = false;
|
||||
}
|
||||
mask_ = (1 << bit_depth_)-1;
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
|
||||
rnd_.Reset(ACMRandom::DeterministicSeed());
|
||||
block_size_ = width_ * height_;
|
||||
@ -575,14 +563,12 @@ class SubpelVarianceTest
|
||||
ref_ = new uint8_t[block_size_ + width_ + height_ + 1];
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
} else {
|
||||
src_ = CONVERT_TO_BYTEPTR(
|
||||
reinterpret_cast<uint16_t *>(
|
||||
vpx_memalign(16, block_size_*sizeof(uint16_t))));
|
||||
sec_ = CONVERT_TO_BYTEPTR(
|
||||
reinterpret_cast<uint16_t *>(
|
||||
vpx_memalign(16, block_size_*sizeof(uint16_t))));
|
||||
ref_ = CONVERT_TO_BYTEPTR(
|
||||
new uint16_t[block_size_ + width_ + height_ + 1]);
|
||||
src_ = CONVERT_TO_BYTEPTR(reinterpret_cast<uint16_t *>(
|
||||
vpx_memalign(16, block_size_ * sizeof(uint16_t))));
|
||||
sec_ = CONVERT_TO_BYTEPTR(reinterpret_cast<uint16_t *>(
|
||||
vpx_memalign(16, block_size_ * sizeof(uint16_t))));
|
||||
ref_ =
|
||||
CONVERT_TO_BYTEPTR(new uint16_t[block_size_ + width_ + height_ + 1]);
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
}
|
||||
ASSERT_TRUE(src_ != NULL);
|
||||
@ -617,11 +603,11 @@ class SubpelVarianceTest
|
||||
vpx_bit_depth_t bit_depth_;
|
||||
int width_, log2width_;
|
||||
int height_, log2height_;
|
||||
int block_size_, mask_;
|
||||
int block_size_, mask_;
|
||||
SubpelVarianceFunctionType subpel_variance_;
|
||||
};
|
||||
|
||||
template<typename SubpelVarianceFunctionType>
|
||||
template <typename SubpelVarianceFunctionType>
|
||||
void SubpelVarianceTest<SubpelVarianceFunctionType>::RefTest() {
|
||||
for (int x = 0; x < 8; ++x) {
|
||||
for (int y = 0; y < 8; ++y) {
|
||||
@ -644,20 +630,18 @@ void SubpelVarianceTest<SubpelVarianceFunctionType>::RefTest() {
|
||||
}
|
||||
unsigned int sse1, sse2;
|
||||
unsigned int var1;
|
||||
ASM_REGISTER_STATE_CHECK(var1 = subpel_variance_(ref_, width_ + 1, x, y,
|
||||
src_, width_, &sse1));
|
||||
const unsigned int var2 = subpel_variance_ref(ref_, src_,
|
||||
log2width_, log2height_,
|
||||
x, y, &sse2,
|
||||
use_high_bit_depth_,
|
||||
bit_depth_);
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
var1 = subpel_variance_(ref_, width_ + 1, x, y, src_, width_, &sse1));
|
||||
const unsigned int var2 =
|
||||
subpel_variance_ref(ref_, src_, log2width_, log2height_, x, y, &sse2,
|
||||
use_high_bit_depth_, bit_depth_);
|
||||
EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;
|
||||
EXPECT_EQ(var1, var2) << "at position " << x << ", " << y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename SubpelVarianceFunctionType>
|
||||
template <typename SubpelVarianceFunctionType>
|
||||
void SubpelVarianceTest<SubpelVarianceFunctionType>::ExtremeRefTest() {
|
||||
// Compare against reference.
|
||||
// Src: Set the first half of values to 0, the second half to the maximum.
|
||||
@ -684,15 +668,15 @@ void SubpelVarianceTest<SubpelVarianceFunctionType>::ExtremeRefTest() {
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
var1 = subpel_variance_(ref_, width_ + 1, x, y, src_, width_, &sse1));
|
||||
const unsigned int var2 =
|
||||
subpel_variance_ref(ref_, src_, log2width_, log2height_,
|
||||
x, y, &sse2, use_high_bit_depth_, bit_depth_);
|
||||
subpel_variance_ref(ref_, src_, log2width_, log2height_, x, y, &sse2,
|
||||
use_high_bit_depth_, bit_depth_);
|
||||
EXPECT_EQ(sse1, sse2) << "for xoffset " << x << " and yoffset " << y;
|
||||
EXPECT_EQ(var1, var2) << "for xoffset " << x << " and yoffset " << y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
template <>
|
||||
void SubpelVarianceTest<SubpixAvgVarMxNFunc>::RefTest() {
|
||||
for (int x = 0; x < 8; ++x) {
|
||||
for (int y = 0; y < 8; ++y) {
|
||||
@ -717,13 +701,11 @@ void SubpelVarianceTest<SubpixAvgVarMxNFunc>::RefTest() {
|
||||
}
|
||||
uint32_t sse1, sse2;
|
||||
uint32_t var1, var2;
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
var1 = subpel_variance_(ref_, width_ + 1, x, y,
|
||||
src_, width_, &sse1, sec_));
|
||||
var2 = subpel_avg_variance_ref(ref_, src_, sec_,
|
||||
log2width_, log2height_,
|
||||
x, y, &sse2,
|
||||
use_high_bit_depth_,
|
||||
ASM_REGISTER_STATE_CHECK(var1 =
|
||||
subpel_variance_(ref_, width_ + 1, x, y,
|
||||
src_, width_, &sse1, sec_));
|
||||
var2 = subpel_avg_variance_ref(ref_, src_, sec_, log2width_, log2height_,
|
||||
x, y, &sse2, use_high_bit_depth_,
|
||||
static_cast<vpx_bit_depth_t>(bit_depth_));
|
||||
EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;
|
||||
EXPECT_EQ(var1, var2) << "at position " << x << ", " << y;
|
||||
@ -756,14 +738,15 @@ INSTANTIATE_TEST_CASE_P(C, SumOfSquaresTest,
|
||||
|
||||
typedef TestParams<Get4x4SseFunc> SseParams;
|
||||
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;
|
||||
INSTANTIATE_TEST_CASE_P(C, VpxMseTest,
|
||||
::testing::Values(MseParams(4, 4, &vpx_mse16x16_c),
|
||||
MseParams(4, 3, &vpx_mse16x8_c),
|
||||
MseParams(3, 4, &vpx_mse8x16_c),
|
||||
MseParams(3, 3, &vpx_mse8x8_c)));
|
||||
::testing::Values(MseParams(4, 4, &vpx_mse16x16_c),
|
||||
MseParams(4, 3, &vpx_mse16x8_c),
|
||||
MseParams(3, 4, &vpx_mse8x16_c),
|
||||
MseParams(3, 3, &vpx_mse8x8_c)));
|
||||
|
||||
typedef TestParams<VarianceMxNFunc> VarianceParams;
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
@ -818,8 +801,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
typedef MainTestClass<VarianceMxNFunc> VpxHBDMseTest;
|
||||
typedef MainTestClass<VarianceMxNFunc> VpxHBDVarianceTest;
|
||||
typedef SubpelVarianceTest<SubpixVarMxNFunc> VpxHBDSubpelVarianceTest;
|
||||
typedef SubpelVarianceTest<SubpixAvgVarMxNFunc>
|
||||
VpxHBDSubpelAvgVarianceTest;
|
||||
typedef SubpelVarianceTest<SubpixAvgVarMxNFunc> VpxHBDSubpelAvgVarianceTest;
|
||||
|
||||
TEST_P(VpxHBDMseTest, RefMse) { RefTestMse(); }
|
||||
TEST_P(VpxHBDMseTest, MaxMse) { MaxTestMse(); }
|
||||
@ -982,10 +964,10 @@ INSTANTIATE_TEST_CASE_P(SSE2, SumOfSquaresTest,
|
||||
::testing::Values(vpx_get_mb_ss_sse2));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, VpxMseTest,
|
||||
::testing::Values(MseParams(4, 4, &vpx_mse16x16_sse2),
|
||||
MseParams(4, 3, &vpx_mse16x8_sse2),
|
||||
MseParams(3, 4, &vpx_mse8x16_sse2),
|
||||
MseParams(3, 3, &vpx_mse8x8_sse2)));
|
||||
::testing::Values(MseParams(4, 4, &vpx_mse16x16_sse2),
|
||||
MseParams(4, 3, &vpx_mse16x8_sse2),
|
||||
MseParams(3, 4, &vpx_mse8x16_sse2),
|
||||
MseParams(3, 3, &vpx_mse8x8_sse2)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, VpxVarianceTest,
|
||||
@ -1055,37 +1037,38 @@ INSTANTIATE_TEST_CASE_P(
|
||||
*/
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, VpxHBDVarianceTest, ::testing::Values(
|
||||
VarianceParams(6, 6, &vpx_highbd_12_variance64x64_sse2, 12),
|
||||
VarianceParams(6, 5, &vpx_highbd_12_variance64x32_sse2, 12),
|
||||
VarianceParams(5, 6, &vpx_highbd_12_variance32x64_sse2, 12),
|
||||
VarianceParams(5, 5, &vpx_highbd_12_variance32x32_sse2, 12),
|
||||
VarianceParams(5, 4, &vpx_highbd_12_variance32x16_sse2, 12),
|
||||
VarianceParams(4, 5, &vpx_highbd_12_variance16x32_sse2, 12),
|
||||
VarianceParams(4, 4, &vpx_highbd_12_variance16x16_sse2, 12),
|
||||
VarianceParams(4, 3, &vpx_highbd_12_variance16x8_sse2, 12),
|
||||
VarianceParams(3, 4, &vpx_highbd_12_variance8x16_sse2, 12),
|
||||
VarianceParams(3, 3, &vpx_highbd_12_variance8x8_sse2, 12),
|
||||
VarianceParams(6, 6, &vpx_highbd_10_variance64x64_sse2, 10),
|
||||
VarianceParams(6, 5, &vpx_highbd_10_variance64x32_sse2, 10),
|
||||
VarianceParams(5, 6, &vpx_highbd_10_variance32x64_sse2, 10),
|
||||
VarianceParams(5, 5, &vpx_highbd_10_variance32x32_sse2, 10),
|
||||
VarianceParams(5, 4, &vpx_highbd_10_variance32x16_sse2, 10),
|
||||
VarianceParams(4, 5, &vpx_highbd_10_variance16x32_sse2, 10),
|
||||
VarianceParams(4, 4, &vpx_highbd_10_variance16x16_sse2, 10),
|
||||
VarianceParams(4, 3, &vpx_highbd_10_variance16x8_sse2, 10),
|
||||
VarianceParams(3, 4, &vpx_highbd_10_variance8x16_sse2, 10),
|
||||
VarianceParams(3, 3, &vpx_highbd_10_variance8x8_sse2, 10),
|
||||
VarianceParams(6, 6, &vpx_highbd_8_variance64x64_sse2, 8),
|
||||
VarianceParams(6, 5, &vpx_highbd_8_variance64x32_sse2, 8),
|
||||
VarianceParams(5, 6, &vpx_highbd_8_variance32x64_sse2, 8),
|
||||
VarianceParams(5, 5, &vpx_highbd_8_variance32x32_sse2, 8),
|
||||
VarianceParams(5, 4, &vpx_highbd_8_variance32x16_sse2, 8),
|
||||
VarianceParams(4, 5, &vpx_highbd_8_variance16x32_sse2, 8),
|
||||
VarianceParams(4, 4, &vpx_highbd_8_variance16x16_sse2, 8),
|
||||
VarianceParams(4, 3, &vpx_highbd_8_variance16x8_sse2, 8),
|
||||
VarianceParams(3, 4, &vpx_highbd_8_variance8x16_sse2, 8),
|
||||
VarianceParams(3, 3, &vpx_highbd_8_variance8x8_sse2, 8)));
|
||||
SSE2, VpxHBDVarianceTest,
|
||||
::testing::Values(
|
||||
VarianceParams(6, 6, &vpx_highbd_12_variance64x64_sse2, 12),
|
||||
VarianceParams(6, 5, &vpx_highbd_12_variance64x32_sse2, 12),
|
||||
VarianceParams(5, 6, &vpx_highbd_12_variance32x64_sse2, 12),
|
||||
VarianceParams(5, 5, &vpx_highbd_12_variance32x32_sse2, 12),
|
||||
VarianceParams(5, 4, &vpx_highbd_12_variance32x16_sse2, 12),
|
||||
VarianceParams(4, 5, &vpx_highbd_12_variance16x32_sse2, 12),
|
||||
VarianceParams(4, 4, &vpx_highbd_12_variance16x16_sse2, 12),
|
||||
VarianceParams(4, 3, &vpx_highbd_12_variance16x8_sse2, 12),
|
||||
VarianceParams(3, 4, &vpx_highbd_12_variance8x16_sse2, 12),
|
||||
VarianceParams(3, 3, &vpx_highbd_12_variance8x8_sse2, 12),
|
||||
VarianceParams(6, 6, &vpx_highbd_10_variance64x64_sse2, 10),
|
||||
VarianceParams(6, 5, &vpx_highbd_10_variance64x32_sse2, 10),
|
||||
VarianceParams(5, 6, &vpx_highbd_10_variance32x64_sse2, 10),
|
||||
VarianceParams(5, 5, &vpx_highbd_10_variance32x32_sse2, 10),
|
||||
VarianceParams(5, 4, &vpx_highbd_10_variance32x16_sse2, 10),
|
||||
VarianceParams(4, 5, &vpx_highbd_10_variance16x32_sse2, 10),
|
||||
VarianceParams(4, 4, &vpx_highbd_10_variance16x16_sse2, 10),
|
||||
VarianceParams(4, 3, &vpx_highbd_10_variance16x8_sse2, 10),
|
||||
VarianceParams(3, 4, &vpx_highbd_10_variance8x16_sse2, 10),
|
||||
VarianceParams(3, 3, &vpx_highbd_10_variance8x8_sse2, 10),
|
||||
VarianceParams(6, 6, &vpx_highbd_8_variance64x64_sse2, 8),
|
||||
VarianceParams(6, 5, &vpx_highbd_8_variance64x32_sse2, 8),
|
||||
VarianceParams(5, 6, &vpx_highbd_8_variance32x64_sse2, 8),
|
||||
VarianceParams(5, 5, &vpx_highbd_8_variance32x32_sse2, 8),
|
||||
VarianceParams(5, 4, &vpx_highbd_8_variance32x16_sse2, 8),
|
||||
VarianceParams(4, 5, &vpx_highbd_8_variance16x32_sse2, 8),
|
||||
VarianceParams(4, 4, &vpx_highbd_8_variance16x16_sse2, 8),
|
||||
VarianceParams(4, 3, &vpx_highbd_8_variance16x8_sse2, 8),
|
||||
VarianceParams(3, 4, &vpx_highbd_8_variance8x16_sse2, 8),
|
||||
VarianceParams(3, 3, &vpx_highbd_8_variance8x8_sse2, 8)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, VpxHBDSubpelVarianceTest,
|
||||
@ -1200,7 +1183,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
|
||||
#if HAVE_AVX2
|
||||
INSTANTIATE_TEST_CASE_P(AVX2, VpxMseTest,
|
||||
::testing::Values(MseParams(4, 4, &vpx_mse16x16_avx2)));
|
||||
::testing::Values(MseParams(4, 4, &vpx_mse16x16_avx2)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
AVX2, VpxVarianceTest,
|
||||
@ -1224,7 +1207,8 @@ INSTANTIATE_TEST_CASE_P(
|
||||
|
||||
#if HAVE_MEDIA
|
||||
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(
|
||||
MEDIA, VpxVarianceTest,
|
||||
@ -1239,10 +1223,11 @@ INSTANTIATE_TEST_CASE_P(
|
||||
|
||||
#if HAVE_NEON
|
||||
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,
|
||||
::testing::Values(MseParams(4, 4, &vpx_mse16x16_neon)));
|
||||
::testing::Values(MseParams(4, 4, &vpx_mse16x16_neon)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, VpxVarianceTest,
|
||||
@ -1268,13 +1253,14 @@ INSTANTIATE_TEST_CASE_P(MSA, SumOfSquaresTest,
|
||||
::testing::Values(vpx_get_mb_ss_msa));
|
||||
|
||||
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,
|
||||
::testing::Values(MseParams(4, 4, &vpx_mse16x16_msa),
|
||||
MseParams(4, 3, &vpx_mse16x8_msa),
|
||||
MseParams(3, 4, &vpx_mse8x16_msa),
|
||||
MseParams(3, 3, &vpx_mse8x8_msa)));
|
||||
::testing::Values(MseParams(4, 4, &vpx_mse16x16_msa),
|
||||
MseParams(4, 3, &vpx_mse16x8_msa),
|
||||
MseParams(3, 4, &vpx_mse8x16_msa),
|
||||
MseParams(3, 3, &vpx_mse8x8_msa)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MSA, VpxVarianceTest,
|
||||
|
@ -51,7 +51,7 @@ static std::string GetDataPath() {
|
||||
#undef TO_STRING
|
||||
#undef STRINGIFY
|
||||
|
||||
inline FILE *OpenTestDataFile(const std::string& file_name) {
|
||||
inline FILE *OpenTestDataFile(const std::string &file_name) {
|
||||
const std::string path_to_source = GetDataPath() + "/" + file_name;
|
||||
return fopen(path_to_source.c_str(), "rb");
|
||||
}
|
||||
@ -76,21 +76,15 @@ static FILE *GetTempOutFile(std::string *file_name) {
|
||||
|
||||
class TempOutFile {
|
||||
public:
|
||||
TempOutFile() {
|
||||
file_ = GetTempOutFile(&file_name_);
|
||||
}
|
||||
TempOutFile() { file_ = GetTempOutFile(&file_name_); }
|
||||
~TempOutFile() {
|
||||
CloseFile();
|
||||
if (!file_name_.empty()) {
|
||||
EXPECT_EQ(0, remove(file_name_.c_str()));
|
||||
}
|
||||
}
|
||||
FILE *file() {
|
||||
return file_;
|
||||
}
|
||||
const std::string& file_name() {
|
||||
return file_name_;
|
||||
}
|
||||
FILE *file() { return file_; }
|
||||
const std::string &file_name() { return file_name_; }
|
||||
|
||||
protected:
|
||||
void CloseFile() {
|
||||
@ -134,14 +128,10 @@ class VideoSource {
|
||||
virtual unsigned int limit() const = 0;
|
||||
};
|
||||
|
||||
|
||||
class DummyVideoSource : public VideoSource {
|
||||
public:
|
||||
DummyVideoSource()
|
||||
: img_(NULL),
|
||||
limit_(100),
|
||||
width_(80),
|
||||
height_(64),
|
||||
: img_(NULL), limit_(100), width_(80), height_(64),
|
||||
format_(VPX_IMG_FMT_I420) {
|
||||
ReallocImage();
|
||||
}
|
||||
@ -158,9 +148,7 @@ class DummyVideoSource : public VideoSource {
|
||||
FillFrame();
|
||||
}
|
||||
|
||||
virtual vpx_image_t *img() const {
|
||||
return (frame_ < limit_) ? img_ : NULL;
|
||||
}
|
||||
virtual vpx_image_t *img() const { return (frame_ < limit_) ? img_ : NULL; }
|
||||
|
||||
// Models a stream where Timebase = 1/FPS, so pts == frame.
|
||||
virtual vpx_codec_pts_t pts() const { return frame_; }
|
||||
@ -168,7 +156,7 @@ class DummyVideoSource : public VideoSource {
|
||||
virtual unsigned long duration() const { return 1; }
|
||||
|
||||
virtual vpx_rational_t timebase() const {
|
||||
const vpx_rational_t t = {1, 30};
|
||||
const vpx_rational_t t = { 1, 30 };
|
||||
return t;
|
||||
}
|
||||
|
||||
@ -176,9 +164,7 @@ class DummyVideoSource : public VideoSource {
|
||||
|
||||
virtual unsigned int limit() const { return limit_; }
|
||||
|
||||
void set_limit(unsigned int limit) {
|
||||
limit_ = limit;
|
||||
}
|
||||
void set_limit(unsigned int limit) { limit_ = limit; }
|
||||
|
||||
void SetSize(unsigned int width, unsigned int height) {
|
||||
if (width != width_ || height != height_) {
|
||||
@ -196,7 +182,9 @@ class DummyVideoSource : public VideoSource {
|
||||
}
|
||||
|
||||
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() {
|
||||
vpx_img_free(img_);
|
||||
@ -205,7 +193,7 @@ class DummyVideoSource : public VideoSource {
|
||||
}
|
||||
|
||||
vpx_image_t *img_;
|
||||
size_t raw_sz_;
|
||||
size_t raw_sz_;
|
||||
unsigned int limit_;
|
||||
unsigned int frame_;
|
||||
unsigned int width_;
|
||||
@ -213,12 +201,10 @@ class DummyVideoSource : public VideoSource {
|
||||
vpx_img_fmt_t format_;
|
||||
};
|
||||
|
||||
|
||||
class RandomVideoSource : public DummyVideoSource {
|
||||
public:
|
||||
RandomVideoSource(int seed = ACMRandom::DeterministicSeed())
|
||||
: rnd_(seed),
|
||||
seed_(seed) { }
|
||||
: rnd_(seed), seed_(seed) {}
|
||||
|
||||
protected:
|
||||
// Reset the RNG to get a matching stream for the second pass
|
||||
@ -233,8 +219,7 @@ class RandomVideoSource : public DummyVideoSource {
|
||||
virtual void FillFrame() {
|
||||
if (img_) {
|
||||
if (frame_ % 30 < 15)
|
||||
for (size_t i = 0; i < raw_sz_; ++i)
|
||||
img_->img_data[i] = rnd_.Rand8();
|
||||
for (size_t i = 0; i < raw_sz_; ++i) img_->img_data[i] = rnd_.Rand8();
|
||||
else
|
||||
memset(img_->img_data, 0, raw_sz_);
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
|
||||
#include <math.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
@ -41,9 +40,9 @@ void encrypt_buffer(uint8_t *buffer, size_t size) {
|
||||
}
|
||||
}
|
||||
|
||||
void test_decrypt_cb(void *decrypt_state, const uint8_t *input,
|
||||
uint8_t *output, int count) {
|
||||
const size_t offset = input - reinterpret_cast<uint8_t*>(decrypt_state);
|
||||
void test_decrypt_cb(void *decrypt_state, const uint8_t *input, uint8_t *output,
|
||||
int count) {
|
||||
const size_t offset = input - reinterpret_cast<uint8_t *>(decrypt_state);
|
||||
for (int i = 0; i < count; i++) {
|
||||
output[i] = input[i] ^ secret_key[(offset + i) & 15];
|
||||
}
|
||||
@ -56,12 +55,13 @@ using libvpx_test::ACMRandom;
|
||||
TEST(VP8, TestBitIO) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
for (int n = 0; n < num_tests; ++n) {
|
||||
for (int method = 0; method <= 7; ++method) { // we generate various proba
|
||||
for (int method = 0; method <= 7; ++method) { // we generate various proba
|
||||
const int kBitsToTest = 1000;
|
||||
uint8_t probas[kBitsToTest];
|
||||
|
||||
for (int i = 0; i < kBitsToTest; ++i) {
|
||||
const int parity = i & 1;
|
||||
/* clang-format off */
|
||||
probas[i] =
|
||||
(method == 0) ? 0 : (method == 1) ? 255 :
|
||||
(method == 2) ? 128 :
|
||||
@ -72,6 +72,7 @@ TEST(VP8, TestBitIO) {
|
||||
(method == 6) ?
|
||||
(parity ? rnd(64) : 255 - rnd(64)) :
|
||||
(parity ? rnd(32) : 255 - rnd(32));
|
||||
/* clang-format on */
|
||||
}
|
||||
for (int bit_method = 0; bit_method <= 3; ++bit_method) {
|
||||
const int random_seed = 6432;
|
||||
@ -95,8 +96,7 @@ TEST(VP8, TestBitIO) {
|
||||
|
||||
BOOL_DECODER br;
|
||||
encrypt_buffer(bw_buffer, kBufferSize);
|
||||
vp8dx_start_decode(&br, bw_buffer, kBufferSize,
|
||||
test_decrypt_cb,
|
||||
vp8dx_start_decode(&br, bw_buffer, kBufferSize, test_decrypt_cb,
|
||||
reinterpret_cast<void *>(bw_buffer));
|
||||
bit_rnd.Reset(random_seed);
|
||||
for (int i = 0; i < kBitsToTest; ++i) {
|
||||
@ -106,9 +106,8 @@ TEST(VP8, TestBitIO) {
|
||||
bit = bit_rnd(2);
|
||||
}
|
||||
GTEST_ASSERT_EQ(vp8dx_decode_bool(&br, probas[i]), bit)
|
||||
<< "pos: "<< i << " / " << kBitsToTest
|
||||
<< " bit_method: " << bit_method
|
||||
<< " method: " << method;
|
||||
<< "pos: " << i << " / " << kBitsToTest
|
||||
<< " bit_method: " << bit_method << " method: " << method;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,10 +21,8 @@ namespace {
|
||||
// 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
|
||||
// the original buffer.
|
||||
const uint8_t test_key[16] = {
|
||||
0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
|
||||
0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0
|
||||
};
|
||||
const uint8_t test_key[16] = { 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
|
||||
0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0 };
|
||||
|
||||
void encrypt_buffer(const uint8_t *src, uint8_t *dst, size_t size,
|
||||
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,
|
||||
uint8_t *output, int count) {
|
||||
void test_decrypt_cb(void *decrypt_state, const uint8_t *input, uint8_t *output,
|
||||
int count) {
|
||||
encrypt_buffer(input, output, count,
|
||||
input - reinterpret_cast<uint8_t *>(decrypt_state));
|
||||
}
|
||||
|
@ -32,9 +32,7 @@ class VP8DenoiserTest : public ::testing::TestWithParam<int> {
|
||||
public:
|
||||
virtual ~VP8DenoiserTest() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
increase_denoising_ = GetParam();
|
||||
}
|
||||
virtual void SetUp() { increase_denoising_ = GetParam(); }
|
||||
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
|
||||
@ -71,8 +69,8 @@ TEST_P(VP8DenoiserTest, BitexactCheck) {
|
||||
sig_block_sse2[j] = sig_block_c[j] = rnd.Rand8();
|
||||
// The pixels in mc_avg_block are generated by adding a random
|
||||
// number in range [-19, 19] to corresponding pixels in sig_block.
|
||||
temp = sig_block_c[j] + (rnd.Rand8() % 2 == 0 ? -1 : 1) *
|
||||
(rnd.Rand8() % 20);
|
||||
temp =
|
||||
sig_block_c[j] + (rnd.Rand8() % 2 == 0 ? -1 : 1) * (rnd.Rand8() % 20);
|
||||
// Clip.
|
||||
mc_avg_block[j] = (temp < 0) ? 0 : ((temp > 255) ? 255 : temp);
|
||||
}
|
||||
|
@ -95,11 +95,12 @@ TEST(VP8FdctTest, SignBiasCheck) {
|
||||
|
||||
bool bias_acceptable = true;
|
||||
for (int j = 0; j < 16; ++j)
|
||||
bias_acceptable = bias_acceptable &&
|
||||
(abs(count_sign_block[j][0] - count_sign_block[j][1]) < 10000);
|
||||
bias_acceptable =
|
||||
bias_acceptable &&
|
||||
(abs(count_sign_block[j][0] - count_sign_block[j][1]) < 10000);
|
||||
|
||||
EXPECT_EQ(true, bias_acceptable)
|
||||
<< "Error: 4x4 FDCT has a sign bias > 1% for input range [-255, 255]";
|
||||
<< "Error: 4x4 FDCT has a sign bias > 1% for input range [-255, 255]";
|
||||
|
||||
memset(count_sign_block, 0, sizeof(count_sign_block));
|
||||
|
||||
@ -120,11 +121,12 @@ TEST(VP8FdctTest, SignBiasCheck) {
|
||||
|
||||
bias_acceptable = true;
|
||||
for (int j = 0; j < 16; ++j)
|
||||
bias_acceptable = bias_acceptable &&
|
||||
(abs(count_sign_block[j][0] - count_sign_block[j][1]) < 100000);
|
||||
bias_acceptable =
|
||||
bias_acceptable &&
|
||||
(abs(count_sign_block[j][0] - count_sign_block[j][1]) < 100000);
|
||||
|
||||
EXPECT_EQ(true, bias_acceptable)
|
||||
<< "Error: 4x4 FDCT has a sign bias > 10% for input range [-15, 15]";
|
||||
<< "Error: 4x4 FDCT has a sign bias > 10% for input range [-15, 15]";
|
||||
};
|
||||
|
||||
TEST(VP8FdctTest, RoundTripErrorCheck) {
|
||||
@ -148,17 +150,16 @@ TEST(VP8FdctTest, RoundTripErrorCheck) {
|
||||
for (int j = 0; j < 16; ++j) {
|
||||
const int diff = test_input_block[j] - test_output_block[j];
|
||||
const int error = diff * diff;
|
||||
if (max_error < error)
|
||||
max_error = error;
|
||||
if (max_error < error) max_error = error;
|
||||
total_error += error;
|
||||
}
|
||||
}
|
||||
|
||||
EXPECT_GE(1, max_error )
|
||||
<< "Error: FDCT/IDCT has an individual roundtrip error > 1";
|
||||
EXPECT_GE(1, max_error)
|
||||
<< "Error: FDCT/IDCT has an individual roundtrip error > 1";
|
||||
|
||||
EXPECT_GE(count_test_block, total_error)
|
||||
<< "Error: FDCT/IDCT has average roundtrip error > 1 per block";
|
||||
<< "Error: FDCT/IDCT has average roundtrip error > 1 per block";
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
@ -13,9 +13,8 @@
|
||||
|
||||
namespace {
|
||||
|
||||
class VP8FramgmentsTest
|
||||
: public ::libvpx_test::EncoderTest,
|
||||
public ::testing::Test {
|
||||
class VP8FramgmentsTest : public ::libvpx_test::EncoderTest,
|
||||
public ::testing::Test {
|
||||
protected:
|
||||
VP8FramgmentsTest() : EncoderTest(&::libvpx_test::kVP8) {}
|
||||
virtual ~VP8FramgmentsTest() {}
|
||||
|
@ -22,8 +22,8 @@ namespace {
|
||||
const unsigned int kFrames = 100;
|
||||
const int kBitrate = 500;
|
||||
|
||||
#define ARF_NOT_SEEN 1000001
|
||||
#define ARF_SEEN_ONCE 1000000
|
||||
#define ARF_NOT_SEEN 1000001
|
||||
#define ARF_SEEN_ONCE 1000000
|
||||
|
||||
typedef struct {
|
||||
const char *filename;
|
||||
@ -44,24 +44,20 @@ typedef struct {
|
||||
|
||||
const TestVideoParam kTestVectors[] = {
|
||||
// artificially increase framerate to trigger default check
|
||||
{"hantro_collage_w352h288.yuv", 352, 288, 5000, 1,
|
||||
8, VPX_IMG_FMT_I420, VPX_BITS_8, 0},
|
||||
{"hantro_collage_w352h288.yuv", 352, 288, 30, 1,
|
||||
8, VPX_IMG_FMT_I420, VPX_BITS_8, 0},
|
||||
{"rush_hour_444.y4m", 352, 288, 30, 1,
|
||||
8, VPX_IMG_FMT_I444, VPX_BITS_8, 1},
|
||||
{ "hantro_collage_w352h288.yuv", 352, 288, 5000, 1, 8, VPX_IMG_FMT_I420,
|
||||
VPX_BITS_8, 0 },
|
||||
{ "hantro_collage_w352h288.yuv", 352, 288, 30, 1, 8, VPX_IMG_FMT_I420,
|
||||
VPX_BITS_8, 0 },
|
||||
{ "rush_hour_444.y4m", 352, 288, 30, 1, 8, VPX_IMG_FMT_I444, VPX_BITS_8, 1 },
|
||||
#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
|
||||
};
|
||||
|
||||
const TestEncodeParam kEncodeVectors[] = {
|
||||
{::libvpx_test::kOnePassGood, 2},
|
||||
{::libvpx_test::kOnePassGood, 5},
|
||||
{::libvpx_test::kTwoPassGood, 1},
|
||||
{::libvpx_test::kTwoPassGood, 2},
|
||||
{::libvpx_test::kTwoPassGood, 5},
|
||||
{::libvpx_test::kRealTime, 5},
|
||||
{ ::libvpx_test::kOnePassGood, 2 }, { ::libvpx_test::kOnePassGood, 5 },
|
||||
{ ::libvpx_test::kTwoPassGood, 1 }, { ::libvpx_test::kTwoPassGood, 2 },
|
||||
{ ::libvpx_test::kTwoPassGood, 5 }, { ::libvpx_test::kRealTime, 5 },
|
||||
};
|
||||
|
||||
const int kMinArfVectors[] = {
|
||||
@ -80,15 +76,12 @@ int is_extension_y4m(const char *filename) {
|
||||
|
||||
class ArfFreqTest
|
||||
: public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWith3Params<TestVideoParam, \
|
||||
public ::libvpx_test::CodecTestWith3Params<TestVideoParam,
|
||||
TestEncodeParam, int> {
|
||||
protected:
|
||||
ArfFreqTest()
|
||||
: EncoderTest(GET_PARAM(0)),
|
||||
test_video_param_(GET_PARAM(1)),
|
||||
test_encode_param_(GET_PARAM(2)),
|
||||
min_arf_requested_(GET_PARAM(3)) {
|
||||
}
|
||||
: EncoderTest(GET_PARAM(0)), test_video_param_(GET_PARAM(1)),
|
||||
test_encode_param_(GET_PARAM(2)), min_arf_requested_(GET_PARAM(3)) {}
|
||||
|
||||
virtual ~ArfFreqTest() {}
|
||||
|
||||
@ -114,17 +107,16 @@ class ArfFreqTest
|
||||
}
|
||||
|
||||
int GetNumFramesInPkt(const vpx_codec_cx_pkt_t *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 int mag = ((marker >> 3) & 3) + 1;
|
||||
int frames = (marker & 0x7) + 1;
|
||||
const unsigned int index_sz = 2 + mag * frames;
|
||||
const unsigned int index_sz = 2 + mag * frames;
|
||||
// Check for superframe or not.
|
||||
// Assume superframe has only one visible frame, the rest being
|
||||
// invisible. If superframe index is not found, then there is only
|
||||
// one frame.
|
||||
if (!((marker & 0xe0) == 0xc0 &&
|
||||
pkt->data.frame.sz >= index_sz &&
|
||||
if (!((marker & 0xe0) == 0xc0 && pkt->data.frame.sz >= index_sz &&
|
||||
buffer[pkt->data.frame.sz - index_sz] == marker)) {
|
||||
frames = 1;
|
||||
}
|
||||
@ -132,8 +124,7 @@ class ArfFreqTest
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
if (pkt->kind != VPX_CODEC_CX_FRAME_PKT)
|
||||
return;
|
||||
if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) return;
|
||||
const int frames = GetNumFramesInPkt(pkt);
|
||||
if (frames == 1) {
|
||||
run_of_visible_frames_++;
|
||||
@ -167,9 +158,7 @@ class ArfFreqTest
|
||||
}
|
||||
}
|
||||
|
||||
int GetMinVisibleRun() const {
|
||||
return min_run_;
|
||||
}
|
||||
int GetMinVisibleRun() const { return min_run_; }
|
||||
|
||||
int GetMinArfDistanceRequested() const {
|
||||
if (min_arf_requested_)
|
||||
@ -178,7 +167,7 @@ class ArfFreqTest
|
||||
return vp9_rc_get_default_min_gf_interval(
|
||||
test_video_param_.width, test_video_param_.height,
|
||||
(double)test_video_param_.framerate_num /
|
||||
test_video_param_.framerate_den);
|
||||
test_video_param_.framerate_den);
|
||||
}
|
||||
|
||||
TestVideoParam test_video_param_;
|
||||
@ -197,21 +186,18 @@ TEST_P(ArfFreqTest, MinArfFreqTest) {
|
||||
cfg_.g_input_bit_depth = test_video_param_.input_bit_depth;
|
||||
cfg_.g_bit_depth = test_video_param_.bit_depth;
|
||||
init_flags_ = VPX_CODEC_USE_PSNR;
|
||||
if (cfg_.g_bit_depth > 8)
|
||||
init_flags_ |= VPX_CODEC_USE_HIGHBITDEPTH;
|
||||
if (cfg_.g_bit_depth > 8) init_flags_ |= VPX_CODEC_USE_HIGHBITDEPTH;
|
||||
|
||||
testing::internal::scoped_ptr<libvpx_test::VideoSource> video;
|
||||
if (is_extension_y4m(test_video_param_.filename)) {
|
||||
video.reset(new libvpx_test::Y4mVideoSource(test_video_param_.filename,
|
||||
0, kFrames));
|
||||
video.reset(new libvpx_test::Y4mVideoSource(test_video_param_.filename, 0,
|
||||
kFrames));
|
||||
} else {
|
||||
video.reset(new libvpx_test::YUVVideoSource(test_video_param_.filename,
|
||||
test_video_param_.fmt,
|
||||
test_video_param_.width,
|
||||
test_video_param_.height,
|
||||
test_video_param_.framerate_num,
|
||||
test_video_param_.framerate_den,
|
||||
0, kFrames));
|
||||
video.reset(new libvpx_test::YUVVideoSource(
|
||||
test_video_param_.filename, test_video_param_.fmt,
|
||||
test_video_param_.width, test_video_param_.height,
|
||||
test_video_param_.framerate_num, test_video_param_.framerate_den, 0,
|
||||
kFrames));
|
||||
}
|
||||
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
|
||||
@ -223,9 +209,7 @@ TEST_P(ArfFreqTest, MinArfFreqTest) {
|
||||
}
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(
|
||||
ArfFreqTest,
|
||||
::testing::ValuesIn(kTestVectors),
|
||||
::testing::ValuesIn(kEncodeVectors),
|
||||
::testing::ValuesIn(kMinArfVectors));
|
||||
VP9_INSTANTIATE_TEST_CASE(ArfFreqTest, ::testing::ValuesIn(kTestVectors),
|
||||
::testing::ValuesIn(kEncodeVectors),
|
||||
::testing::ValuesIn(kMinArfVectors));
|
||||
} // namespace
|
||||
|
@ -28,12 +28,13 @@ const int num_tests = 10;
|
||||
TEST(VP9, TestBitIO) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
for (int n = 0; n < num_tests; ++n) {
|
||||
for (int method = 0; method <= 7; ++method) { // we generate various proba
|
||||
for (int method = 0; method <= 7; ++method) { // we generate various proba
|
||||
const int kBitsToTest = 1000;
|
||||
uint8_t probas[kBitsToTest];
|
||||
|
||||
for (int i = 0; i < kBitsToTest; ++i) {
|
||||
const int parity = i & 1;
|
||||
/* clang-format off */
|
||||
probas[i] =
|
||||
(method == 0) ? 0 : (method == 1) ? 255 :
|
||||
(method == 2) ? 128 :
|
||||
@ -44,6 +45,7 @@ TEST(VP9, TestBitIO) {
|
||||
(method == 6) ?
|
||||
(parity ? rnd(64) : 255 - rnd(64)) :
|
||||
(parity ? rnd(32) : 255 - rnd(32));
|
||||
/* clang-format on */
|
||||
}
|
||||
for (int bit_method = 0; bit_method <= 3; ++bit_method) {
|
||||
const int random_seed = 6432;
|
||||
@ -79,8 +81,7 @@ TEST(VP9, TestBitIO) {
|
||||
}
|
||||
GTEST_ASSERT_EQ(vpx_read(&br, probas[i]), bit)
|
||||
<< "pos: " << i << " / " << kBitsToTest
|
||||
<< " bit_method: " << bit_method
|
||||
<< " method: " << method;
|
||||
<< " bit_method: " << bit_method << " method: " << method;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,10 +21,8 @@ namespace {
|
||||
// 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
|
||||
// the original buffer.
|
||||
const uint8_t test_key[16] = {
|
||||
0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
|
||||
0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0
|
||||
};
|
||||
const uint8_t test_key[16] = { 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
|
||||
0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0 };
|
||||
|
||||
void encrypt_buffer(const uint8_t *src, uint8_t *dst, size_t size,
|
||||
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,
|
||||
uint8_t *output, int count) {
|
||||
void test_decrypt_cb(void *decrypt_state, const uint8_t *input, uint8_t *output,
|
||||
int count) {
|
||||
encrypt_buffer(input, output, count,
|
||||
input - reinterpret_cast<uint8_t *>(decrypt_state));
|
||||
}
|
||||
|
@ -33,9 +33,7 @@ class VP9DenoiserTest : public ::testing::TestWithParam<BLOCK_SIZE> {
|
||||
public:
|
||||
virtual ~VP9DenoiserTest() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
bs_ = GetParam();
|
||||
}
|
||||
virtual void SetUp() { bs_ = GetParam(); }
|
||||
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
|
||||
@ -68,19 +66,19 @@ TEST_P(VP9DenoiserTest, BitexactCheck) {
|
||||
sig_block[j] = rnd.Rand8();
|
||||
// The pixels in mc_avg_block are generated by adding a random
|
||||
// number in range [-19, 19] to corresponding pixels in sig_block.
|
||||
temp = sig_block[j] + ((rnd.Rand8() % 2 == 0) ? -1 : 1) *
|
||||
(rnd.Rand8() % 20);
|
||||
temp =
|
||||
sig_block[j] + ((rnd.Rand8() % 2 == 0) ? -1 : 1) * (rnd.Rand8() % 20);
|
||||
// Clip.
|
||||
mc_avg_block[j] = (temp < 0) ? 0 : ((temp > 255) ? 255 : temp);
|
||||
}
|
||||
|
||||
ASM_REGISTER_STATE_CHECK(vp9_denoiser_filter_c(
|
||||
sig_block, 64, mc_avg_block, 64, avg_block_c,
|
||||
64, 0, bs_, motion_magnitude_random));
|
||||
ASM_REGISTER_STATE_CHECK(vp9_denoiser_filter_c(sig_block, 64, mc_avg_block,
|
||||
64, avg_block_c, 64, 0, bs_,
|
||||
motion_magnitude_random));
|
||||
|
||||
ASM_REGISTER_STATE_CHECK(vp9_denoiser_filter_sse2(
|
||||
sig_block, 64, mc_avg_block, 64, avg_block_sse2,
|
||||
64, 0, bs_, motion_magnitude_random));
|
||||
sig_block, 64, mc_avg_block, 64, avg_block_sse2, 64, 0, bs_,
|
||||
motion_magnitude_random));
|
||||
|
||||
// Test bitexactness.
|
||||
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.
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, VP9DenoiserTest,
|
||||
::testing::Values(BLOCK_8X8, BLOCK_8X16, BLOCK_16X8, BLOCK_16X16,
|
||||
BLOCK_16X32, BLOCK_32X16, BLOCK_32X32, BLOCK_32X64,
|
||||
BLOCK_64X32, BLOCK_64X64));
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, VP9DenoiserTest,
|
||||
::testing::Values(BLOCK_8X8, BLOCK_8X16, BLOCK_16X8,
|
||||
BLOCK_16X16, BLOCK_16X32, BLOCK_32X16,
|
||||
BLOCK_32X32, BLOCK_32X64, BLOCK_64X32,
|
||||
BLOCK_64X64));
|
||||
} // namespace
|
||||
|
@ -29,7 +29,7 @@ struct EncodePerfTestVideo {
|
||||
};
|
||||
|
||||
const EncodePerfTestVideo kVP9EncodePerfTestVectors[] = {
|
||||
{"niklas_1280_720_30.y4m", 1280, 720, 600, 10},
|
||||
{ "niklas_1280_720_30.y4m", 1280, 720, 600, 10 },
|
||||
};
|
||||
|
||||
struct EncodeParameters {
|
||||
@ -45,10 +45,10 @@ struct EncodeParameters {
|
||||
};
|
||||
|
||||
const EncodeParameters kVP9EncodeParameterSet[] = {
|
||||
{0, 0, 0, 1, 0, VPX_CR_STUDIO_RANGE, VPX_CS_BT_601, { 0, 0 }},
|
||||
{0, 0, 0, 0, 0, VPX_CR_FULL_RANGE, VPX_CS_BT_709, { 0, 0 }},
|
||||
{0, 0, 1, 0, 0, VPX_CR_FULL_RANGE, VPX_CS_BT_2020, { 0, 0 }},
|
||||
{0, 2, 0, 0, 1, VPX_CR_STUDIO_RANGE, VPX_CS_UNKNOWN, { 640, 480 }},
|
||||
{ 0, 0, 0, 1, 0, VPX_CR_STUDIO_RANGE, VPX_CS_BT_601, { 0, 0 } },
|
||||
{ 0, 0, 0, 0, 0, VPX_CR_FULL_RANGE, VPX_CS_BT_709, { 0, 0 } },
|
||||
{ 0, 0, 1, 0, 0, VPX_CR_FULL_RANGE, VPX_CS_BT_2020, { 0, 0 } },
|
||||
{ 0, 2, 0, 0, 1, VPX_CR_STUDIO_RANGE, VPX_CS_UNKNOWN, { 640, 480 } },
|
||||
// TODO(JBB): Test profiles (requires more work).
|
||||
};
|
||||
|
||||
|
@ -18,21 +18,17 @@
|
||||
|
||||
namespace {
|
||||
|
||||
const unsigned int kWidth = 160;
|
||||
const unsigned int kWidth = 160;
|
||||
const unsigned int kHeight = 90;
|
||||
const unsigned int kFramerate = 50;
|
||||
const unsigned int kFrames = 10;
|
||||
const int kBitrate = 500;
|
||||
// List of psnr thresholds for speed settings 0-7 and 5 encoding modes
|
||||
const double kPsnrThreshold[][5] = {
|
||||
{ 36.0, 37.0, 37.0, 37.0, 37.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 },
|
||||
{ 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 },
|
||||
{ 36.0, 37.0, 37.0, 37.0, 37.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 },
|
||||
{ 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 {
|
||||
@ -44,31 +40,30 @@ typedef struct {
|
||||
} TestVideoParam;
|
||||
|
||||
const TestVideoParam kTestVectors[] = {
|
||||
{"park_joy_90p_8_420.y4m", 8, VPX_IMG_FMT_I420, VPX_BITS_8, 0},
|
||||
{"park_joy_90p_8_422.y4m", 8, VPX_IMG_FMT_I422, VPX_BITS_8, 1},
|
||||
{"park_joy_90p_8_444.y4m", 8, VPX_IMG_FMT_I444, VPX_BITS_8, 1},
|
||||
{"park_joy_90p_8_440.yuv", 8, VPX_IMG_FMT_I440, VPX_BITS_8, 1},
|
||||
{ "park_joy_90p_8_420.y4m", 8, VPX_IMG_FMT_I420, VPX_BITS_8, 0 },
|
||||
{ "park_joy_90p_8_422.y4m", 8, VPX_IMG_FMT_I422, VPX_BITS_8, 1 },
|
||||
{ "park_joy_90p_8_444.y4m", 8, VPX_IMG_FMT_I444, VPX_BITS_8, 1 },
|
||||
{ "park_joy_90p_8_440.yuv", 8, VPX_IMG_FMT_I440, VPX_BITS_8, 1 },
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
{"park_joy_90p_10_420.y4m", 10, VPX_IMG_FMT_I42016, VPX_BITS_10, 2},
|
||||
{"park_joy_90p_10_422.y4m", 10, VPX_IMG_FMT_I42216, VPX_BITS_10, 3},
|
||||
{"park_joy_90p_10_444.y4m", 10, VPX_IMG_FMT_I44416, VPX_BITS_10, 3},
|
||||
{"park_joy_90p_10_440.yuv", 10, VPX_IMG_FMT_I44016, VPX_BITS_10, 3},
|
||||
{"park_joy_90p_12_420.y4m", 12, VPX_IMG_FMT_I42016, VPX_BITS_12, 2},
|
||||
{"park_joy_90p_12_422.y4m", 12, VPX_IMG_FMT_I42216, VPX_BITS_12, 3},
|
||||
{"park_joy_90p_12_444.y4m", 12, VPX_IMG_FMT_I44416, VPX_BITS_12, 3},
|
||||
{"park_joy_90p_12_440.yuv", 12, VPX_IMG_FMT_I44016, VPX_BITS_12, 3},
|
||||
{ "park_joy_90p_10_420.y4m", 10, VPX_IMG_FMT_I42016, VPX_BITS_10, 2 },
|
||||
{ "park_joy_90p_10_422.y4m", 10, VPX_IMG_FMT_I42216, VPX_BITS_10, 3 },
|
||||
{ "park_joy_90p_10_444.y4m", 10, VPX_IMG_FMT_I44416, VPX_BITS_10, 3 },
|
||||
{ "park_joy_90p_10_440.yuv", 10, VPX_IMG_FMT_I44016, VPX_BITS_10, 3 },
|
||||
{ "park_joy_90p_12_420.y4m", 12, VPX_IMG_FMT_I42016, VPX_BITS_12, 2 },
|
||||
{ "park_joy_90p_12_422.y4m", 12, VPX_IMG_FMT_I42216, VPX_BITS_12, 3 },
|
||||
{ "park_joy_90p_12_444.y4m", 12, VPX_IMG_FMT_I44416, VPX_BITS_12, 3 },
|
||||
{ "park_joy_90p_12_440.yuv", 12, VPX_IMG_FMT_I44016, VPX_BITS_12, 3 },
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
};
|
||||
|
||||
// Encoding modes tested
|
||||
const libvpx_test::TestMode kEncodingModeVectors[] = {
|
||||
::libvpx_test::kTwoPassGood,
|
||||
::libvpx_test::kOnePassGood,
|
||||
::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood,
|
||||
::libvpx_test::kRealTime,
|
||||
};
|
||||
|
||||
// Speed settings tested
|
||||
const int kCpuUsedVectors[] = {1, 2, 3, 5, 6};
|
||||
const int kCpuUsedVectors[] = { 1, 2, 3, 5, 6 };
|
||||
|
||||
int is_extension_y4m(const char *filename) {
|
||||
const char *dot = strrchr(filename, '.');
|
||||
@ -80,17 +75,13 @@ int is_extension_y4m(const char *filename) {
|
||||
|
||||
class EndToEndTestLarge
|
||||
: public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWith3Params<libvpx_test::TestMode, \
|
||||
public ::libvpx_test::CodecTestWith3Params<libvpx_test::TestMode,
|
||||
TestVideoParam, int> {
|
||||
protected:
|
||||
EndToEndTestLarge()
|
||||
: EncoderTest(GET_PARAM(0)),
|
||||
test_video_param_(GET_PARAM(2)),
|
||||
cpu_used_(GET_PARAM(3)),
|
||||
psnr_(0.0),
|
||||
nframes_(0),
|
||||
encoding_mode_(GET_PARAM(1)) {
|
||||
}
|
||||
: EncoderTest(GET_PARAM(0)), test_video_param_(GET_PARAM(2)),
|
||||
cpu_used_(GET_PARAM(3)), psnr_(0.0), nframes_(0),
|
||||
encoding_mode_(GET_PARAM(1)) {}
|
||||
|
||||
virtual ~EndToEndTestLarge() {}
|
||||
|
||||
@ -136,8 +127,7 @@ class EndToEndTestLarge
|
||||
}
|
||||
|
||||
double GetAveragePsnr() const {
|
||||
if (nframes_)
|
||||
return psnr_ / nframes_;
|
||||
if (nframes_) return psnr_ / nframes_;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
@ -161,29 +151,26 @@ TEST_P(EndToEndTestLarge, EndtoEndPSNRTest) {
|
||||
cfg_.g_input_bit_depth = test_video_param_.input_bit_depth;
|
||||
cfg_.g_bit_depth = test_video_param_.bit_depth;
|
||||
init_flags_ = VPX_CODEC_USE_PSNR;
|
||||
if (cfg_.g_bit_depth > 8)
|
||||
init_flags_ |= VPX_CODEC_USE_HIGHBITDEPTH;
|
||||
if (cfg_.g_bit_depth > 8) init_flags_ |= VPX_CODEC_USE_HIGHBITDEPTH;
|
||||
|
||||
libvpx_test::VideoSource *video;
|
||||
if (is_extension_y4m(test_video_param_.filename)) {
|
||||
video = new libvpx_test::Y4mVideoSource(test_video_param_.filename,
|
||||
0, kFrames);
|
||||
video =
|
||||
new libvpx_test::Y4mVideoSource(test_video_param_.filename, 0, kFrames);
|
||||
} else {
|
||||
video = new libvpx_test::YUVVideoSource(test_video_param_.filename,
|
||||
test_video_param_.fmt,
|
||||
kWidth, kHeight,
|
||||
kFramerate, 1, 0, kFrames);
|
||||
test_video_param_.fmt, kWidth,
|
||||
kHeight, kFramerate, 1, 0, kFrames);
|
||||
}
|
||||
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(video));
|
||||
const double psnr = GetAveragePsnr();
|
||||
EXPECT_GT(psnr, GetPsnrThreshold());
|
||||
delete(video);
|
||||
delete (video);
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(
|
||||
EndToEndTestLarge,
|
||||
::testing::ValuesIn(kEncodingModeVectors),
|
||||
::testing::ValuesIn(kTestVectors),
|
||||
::testing::ValuesIn(kCpuUsedVectors));
|
||||
VP9_INSTANTIATE_TEST_CASE(EndToEndTestLarge,
|
||||
::testing::ValuesIn(kEncodingModeVectors),
|
||||
::testing::ValuesIn(kTestVectors),
|
||||
::testing::ValuesIn(kCpuUsedVectors));
|
||||
} // namespace
|
||||
|
@ -32,11 +32,10 @@ const int kNumIterations = 1000;
|
||||
|
||||
typedef int64_t (*ErrorBlockFunc)(const tran_low_t *coeff,
|
||||
const tran_low_t *dqcoeff,
|
||||
intptr_t block_size,
|
||||
int64_t *ssz, int bps);
|
||||
intptr_t block_size, int64_t *ssz, int bps);
|
||||
|
||||
typedef std::tr1::tuple<ErrorBlockFunc, ErrorBlockFunc, vpx_bit_depth_t>
|
||||
ErrorBlockParam;
|
||||
ErrorBlockParam;
|
||||
|
||||
// wrapper for 8-bit block error functions without a 'bps' param.
|
||||
typedef int64_t (*HighBdBlockError8bit)(const tran_low_t *coeff,
|
||||
@ -51,14 +50,13 @@ int64_t HighBdBlockError8bitWrapper(const tran_low_t *coeff,
|
||||
return fn(coeff, dqcoeff, block_size, ssz);
|
||||
}
|
||||
|
||||
class ErrorBlockTest
|
||||
: public ::testing::TestWithParam<ErrorBlockParam> {
|
||||
class ErrorBlockTest : public ::testing::TestWithParam<ErrorBlockParam> {
|
||||
public:
|
||||
virtual ~ErrorBlockTest() {}
|
||||
virtual void SetUp() {
|
||||
error_block_op_ = GET_PARAM(0);
|
||||
error_block_op_ = GET_PARAM(0);
|
||||
ref_error_block_op_ = GET_PARAM(1);
|
||||
bit_depth_ = GET_PARAM(2);
|
||||
bit_depth_ = GET_PARAM(2);
|
||||
}
|
||||
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
@ -89,18 +87,18 @@ TEST_P(ErrorBlockTest, OperationCheck) {
|
||||
// can be used for optimization, so generate test input precisely.
|
||||
if (rnd(2)) {
|
||||
// Positive number
|
||||
coeff[j] = rnd(1 << msb);
|
||||
coeff[j] = rnd(1 << msb);
|
||||
dqcoeff[j] = rnd(1 << msb);
|
||||
} else {
|
||||
// Negative number
|
||||
coeff[j] = -rnd(1 << msb);
|
||||
coeff[j] = -rnd(1 << msb);
|
||||
dqcoeff[j] = -rnd(1 << msb);
|
||||
}
|
||||
}
|
||||
ref_ret = ref_error_block_op_(coeff, dqcoeff, block_size, &ref_ssz,
|
||||
bit_depth_);
|
||||
ASM_REGISTER_STATE_CHECK(ret = error_block_op_(coeff, dqcoeff, block_size,
|
||||
&ssz, bit_depth_));
|
||||
ref_ret =
|
||||
ref_error_block_op_(coeff, dqcoeff, block_size, &ref_ssz, bit_depth_);
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
ret = error_block_op_(coeff, dqcoeff, block_size, &ssz, bit_depth_));
|
||||
err_count += (ref_ret != ret) | (ref_ssz != ssz);
|
||||
if (err_count && !err_count_total) {
|
||||
first_failure = i;
|
||||
@ -130,35 +128,35 @@ TEST_P(ErrorBlockTest, ExtremeValues) {
|
||||
int k = (i / 9) % 9;
|
||||
|
||||
// Change the maximum coeff value, to test different bit boundaries
|
||||
if ( k == 8 && (i % 9) == 0 ) {
|
||||
if (k == 8 && (i % 9) == 0) {
|
||||
max_val >>= 1;
|
||||
}
|
||||
block_size = 16 << (i % 9); // All block sizes from 4x4, 8x4 ..64x64
|
||||
for (int j = 0; j < block_size; j++) {
|
||||
if (k < 4) {
|
||||
// Test at positive maximum values
|
||||
coeff[j] = k % 2 ? max_val : 0;
|
||||
coeff[j] = k % 2 ? max_val : 0;
|
||||
dqcoeff[j] = (k >> 1) % 2 ? max_val : 0;
|
||||
} else if (k < 8) {
|
||||
// Test at negative maximum values
|
||||
coeff[j] = k % 2 ? -max_val : 0;
|
||||
coeff[j] = k % 2 ? -max_val : 0;
|
||||
dqcoeff[j] = (k >> 1) % 2 ? -max_val : 0;
|
||||
} else {
|
||||
if (rnd(2)) {
|
||||
// Positive number
|
||||
coeff[j] = rnd(1 << 14);
|
||||
coeff[j] = rnd(1 << 14);
|
||||
dqcoeff[j] = rnd(1 << 14);
|
||||
} else {
|
||||
// Negative number
|
||||
coeff[j] = -rnd(1 << 14);
|
||||
coeff[j] = -rnd(1 << 14);
|
||||
dqcoeff[j] = -rnd(1 << 14);
|
||||
}
|
||||
}
|
||||
}
|
||||
ref_ret = ref_error_block_op_(coeff, dqcoeff, block_size, &ref_ssz,
|
||||
bit_depth_);
|
||||
ASM_REGISTER_STATE_CHECK(ret = error_block_op_(coeff, dqcoeff, block_size,
|
||||
&ssz, bit_depth_));
|
||||
ref_ret =
|
||||
ref_error_block_op_(coeff, dqcoeff, block_size, &ref_ssz, bit_depth_);
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
ret = error_block_op_(coeff, dqcoeff, block_size, &ssz, bit_depth_));
|
||||
err_count += (ref_ret != ret) | (ref_ssz != ssz);
|
||||
if (err_count && !err_count_total) {
|
||||
first_failure = i;
|
||||
@ -176,12 +174,12 @@ using std::tr1::make_tuple;
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, ErrorBlockTest,
|
||||
::testing::Values(
|
||||
make_tuple(&vp9_highbd_block_error_sse2,
|
||||
&vp9_highbd_block_error_c, VPX_BITS_10),
|
||||
make_tuple(&vp9_highbd_block_error_sse2,
|
||||
&vp9_highbd_block_error_c, VPX_BITS_12),
|
||||
make_tuple(&vp9_highbd_block_error_sse2,
|
||||
&vp9_highbd_block_error_c, VPX_BITS_8),
|
||||
make_tuple(&vp9_highbd_block_error_sse2, &vp9_highbd_block_error_c,
|
||||
VPX_BITS_10),
|
||||
make_tuple(&vp9_highbd_block_error_sse2, &vp9_highbd_block_error_c,
|
||||
VPX_BITS_12),
|
||||
make_tuple(&vp9_highbd_block_error_sse2, &vp9_highbd_block_error_c,
|
||||
VPX_BITS_8),
|
||||
make_tuple(
|
||||
&HighBdBlockError8bitWrapper<vp9_highbd_block_error_8bit_sse2>,
|
||||
&HighBdBlockError8bitWrapper<vp9_highbd_block_error_8bit_c>,
|
||||
|
@ -23,11 +23,8 @@ class VPxEncoderThreadTest
|
||||
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
|
||||
protected:
|
||||
VPxEncoderThreadTest()
|
||||
: EncoderTest(GET_PARAM(0)),
|
||||
encoder_initialized_(false),
|
||||
tiles_(2),
|
||||
encoding_mode_(GET_PARAM(1)),
|
||||
set_cpu_used_(GET_PARAM(2)) {
|
||||
: EncoderTest(GET_PARAM(0)), encoder_initialized_(false), tiles_(2),
|
||||
encoding_mode_(GET_PARAM(1)), set_cpu_used_(GET_PARAM(2)) {
|
||||
init_flags_ = VPX_CODEC_USE_PSNR;
|
||||
md5_.clear();
|
||||
}
|
||||
@ -82,7 +79,7 @@ class VPxEncoderThreadTest
|
||||
}
|
||||
|
||||
virtual bool HandleDecodeResult(const vpx_codec_err_t res,
|
||||
const libvpx_test::VideoSource& /*video*/,
|
||||
const libvpx_test::VideoSource & /*video*/,
|
||||
libvpx_test::Decoder * /*decoder*/) {
|
||||
if (res != VPX_CODEC_OK) {
|
||||
EXPECT_EQ(VPX_CODEC_OK, res);
|
||||
@ -123,9 +120,9 @@ TEST_P(VPxEncoderThreadTest, EncoderResultTest) {
|
||||
ASSERT_EQ(single_thr_md5, multi_thr_md5);
|
||||
}
|
||||
|
||||
VP9_INSTANTIATE_TEST_CASE(
|
||||
VPxEncoderThreadTest,
|
||||
::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood,
|
||||
::libvpx_test::kRealTime),
|
||||
::testing::Range(1, 9));
|
||||
VP9_INSTANTIATE_TEST_CASE(VPxEncoderThreadTest,
|
||||
::testing::Values(::libvpx_test::kTwoPassGood,
|
||||
::libvpx_test::kOnePassGood,
|
||||
::libvpx_test::kRealTime),
|
||||
::testing::Range(1, 9));
|
||||
} // namespace
|
||||
|
@ -46,7 +46,7 @@ string DecodeFileWithPause(const string &filename, int num_threads,
|
||||
int in_frames = 0;
|
||||
int out_frames = 0;
|
||||
|
||||
vpx_codec_dec_cfg_t cfg = {0};
|
||||
vpx_codec_dec_cfg_t cfg = { 0 };
|
||||
cfg.threads = num_threads;
|
||||
vpx_codec_flags_t flags = 0;
|
||||
flags |= VPX_CODEC_USE_FRAME_THREADING;
|
||||
@ -74,8 +74,7 @@ string DecodeFileWithPause(const string &filename, int num_threads,
|
||||
}
|
||||
|
||||
// Flush the decoder at the end of the video.
|
||||
if (!video.cxdata())
|
||||
decoder.DecodeFrame(NULL, 0);
|
||||
if (!video.cxdata()) decoder.DecodeFrame(NULL, 0);
|
||||
|
||||
libvpx_test::DxDataIterator dec_iter = decoder.GetDxData();
|
||||
const vpx_image_t *img;
|
||||
@ -87,8 +86,8 @@ string DecodeFileWithPause(const string &filename, int num_threads,
|
||||
}
|
||||
} while (video.cxdata() != NULL);
|
||||
|
||||
EXPECT_EQ(in_frames, out_frames) <<
|
||||
"Input frame count does not match output frame count";
|
||||
EXPECT_EQ(in_frames, out_frames)
|
||||
<< "Input frame count does not match output frame count";
|
||||
|
||||
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
|
||||
// one key frame for every ten frames.
|
||||
static const PauseFileList files[] = {
|
||||
{ "vp90-2-07-frame_parallel-1.webm",
|
||||
"6ea7c3875d67252e7caf2bc6e75b36b1", 6 },
|
||||
{ "vp90-2-07-frame_parallel-1.webm",
|
||||
"4bb634160c7356a8d7d4299b6dc83a45", 12 },
|
||||
{ "vp90-2-07-frame_parallel-1.webm",
|
||||
"89772591e6ef461f9fa754f916c78ed8", 26 },
|
||||
{ "vp90-2-07-frame_parallel-1.webm", "6ea7c3875d67252e7caf2bc6e75b36b1",
|
||||
6 },
|
||||
{ "vp90-2-07-frame_parallel-1.webm", "4bb634160c7356a8d7d4299b6dc83a45",
|
||||
12 },
|
||||
{ "vp90-2-07-frame_parallel-1.webm", "89772591e6ef461f9fa754f916c78ed8",
|
||||
26 },
|
||||
{ NULL, NULL, 0 },
|
||||
};
|
||||
DecodeFilesWithPause(files);
|
||||
@ -155,8 +154,7 @@ string DecodeFile(const string &filename, int num_threads,
|
||||
video.Next();
|
||||
|
||||
// Flush the decoder at the end of the video.
|
||||
if (!video.cxdata())
|
||||
decoder.DecodeFrame(NULL, 0);
|
||||
if (!video.cxdata()) decoder.DecodeFrame(NULL, 0);
|
||||
|
||||
libvpx_test::DxDataIterator dec_iter = decoder.GetDxData();
|
||||
const vpx_image_t *img;
|
||||
@ -168,8 +166,8 @@ string DecodeFile(const string &filename, int num_threads,
|
||||
}
|
||||
} while (video.cxdata() != NULL);
|
||||
|
||||
EXPECT_EQ(expected_frame_count, out_frames) <<
|
||||
"Input frame count does not match expected output frame count";
|
||||
EXPECT_EQ(expected_frame_count, out_frames)
|
||||
<< "Input frame count does not match expected output frame count";
|
||||
|
||||
return string(md5.Get());
|
||||
}
|
||||
@ -209,8 +207,7 @@ TEST(VP9MultiThreadedFrameParallel, InvalidFileTest) {
|
||||
TEST(VP9MultiThreadedFrameParallel, ValidFileTest) {
|
||||
static const FileList files[] = {
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
{ "vp92-2-20-10bit-yuv420.webm",
|
||||
"a16b99df180c584e8db2ffeda987d293", 10 },
|
||||
{ "vp92-2-20-10bit-yuv420.webm", "a16b99df180c584e8db2ffeda987d293", 10 },
|
||||
#endif
|
||||
{ NULL, NULL, 0 },
|
||||
};
|
||||
|
@ -28,15 +28,14 @@ using libvpx_test::ACMRandom;
|
||||
|
||||
const int count_test_block = 100000;
|
||||
|
||||
typedef void (*IntraPred)(uint16_t* dst, ptrdiff_t stride,
|
||||
const uint16_t* above, const uint16_t* left,
|
||||
int bps);
|
||||
typedef void (*IntraPred)(uint16_t *dst, ptrdiff_t stride,
|
||||
const uint16_t *above, const uint16_t *left, int bps);
|
||||
|
||||
struct IntraPredFunc {
|
||||
IntraPredFunc(IntraPred pred = NULL, IntraPred ref = NULL,
|
||||
int block_size_value = 0, int bit_depth_value = 0)
|
||||
: pred_fn(pred), ref_fn(ref),
|
||||
block_size(block_size_value), bit_depth(bit_depth_value) {}
|
||||
: pred_fn(pred), ref_fn(ref), block_size(block_size_value),
|
||||
bit_depth(bit_depth_value) {}
|
||||
|
||||
IntraPred pred_fn;
|
||||
IntraPred ref_fn;
|
||||
@ -46,8 +45,8 @@ struct IntraPredFunc {
|
||||
|
||||
class VP9IntraPredTest : public ::testing::TestWithParam<IntraPredFunc> {
|
||||
public:
|
||||
void RunTest(uint16_t* left_col, uint16_t* above_data,
|
||||
uint16_t* dst, uint16_t* ref_dst) {
|
||||
void RunTest(uint16_t *left_col, uint16_t *above_data, uint16_t *dst,
|
||||
uint16_t *ref_dst) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
const int block_size = params_.block_size;
|
||||
above_row_ = above_data + 16;
|
||||
@ -81,14 +80,14 @@ class VP9IntraPredTest : public ::testing::TestWithParam<IntraPredFunc> {
|
||||
virtual void SetUp() {
|
||||
params_ = GetParam();
|
||||
stride_ = params_.block_size * 3;
|
||||
mask_ = (1 << params_.bit_depth) - 1;
|
||||
mask_ = (1 << params_.bit_depth) - 1;
|
||||
}
|
||||
|
||||
void Predict() {
|
||||
const int bit_depth = params_.bit_depth;
|
||||
params_.ref_fn(ref_dst_, stride_, above_row_, left_col_, bit_depth);
|
||||
ASM_REGISTER_STATE_CHECK(params_.pred_fn(dst_, stride_,
|
||||
above_row_, left_col_, bit_depth));
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
params_.pred_fn(dst_, stride_, above_row_, left_col_, bit_depth));
|
||||
}
|
||||
|
||||
void CheckPrediction(int test_case_number, int *error_count) const {
|
||||
@ -99,7 +98,7 @@ class VP9IntraPredTest : public ::testing::TestWithParam<IntraPredFunc> {
|
||||
*error_count += ref_dst_[x + y * stride_] != dst_[x + y * stride_];
|
||||
if (*error_count == 1) {
|
||||
ASSERT_EQ(ref_dst_[x + y * stride_], dst_[x + y * stride_])
|
||||
<< " Failed on Test Case Number "<< test_case_number;
|
||||
<< " Failed on Test Case Number " << test_case_number;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -117,8 +116,8 @@ class VP9IntraPredTest : public ::testing::TestWithParam<IntraPredFunc> {
|
||||
|
||||
TEST_P(VP9IntraPredTest, IntraPredTests) {
|
||||
// max block size is 32
|
||||
DECLARE_ALIGNED(16, uint16_t, left_col[2*32]);
|
||||
DECLARE_ALIGNED(16, uint16_t, above_data[2*32+32]);
|
||||
DECLARE_ALIGNED(16, uint16_t, left_col[2 * 32]);
|
||||
DECLARE_ALIGNED(16, uint16_t, above_data[2 * 32 + 32]);
|
||||
DECLARE_ALIGNED(16, uint16_t, dst[3 * 32 * 32]);
|
||||
DECLARE_ALIGNED(16, uint16_t, ref_dst[3 * 32 * 32]);
|
||||
RunTest(left_col, above_data, dst, ref_dst);
|
||||
@ -126,86 +125,86 @@ TEST_P(VP9IntraPredTest, IntraPredTests) {
|
||||
|
||||
#if HAVE_SSE2
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
INSTANTIATE_TEST_CASE_P(SSE2_TO_C_8, VP9IntraPredTest,
|
||||
::testing::Values(
|
||||
IntraPredFunc(&vpx_highbd_dc_predictor_32x32_sse2,
|
||||
&vpx_highbd_dc_predictor_32x32_c, 32, 8),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_16x16_sse2,
|
||||
&vpx_highbd_tm_predictor_16x16_c, 16, 8),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_32x32_sse2,
|
||||
&vpx_highbd_tm_predictor_32x32_c, 32, 8),
|
||||
IntraPredFunc(&vpx_highbd_dc_predictor_4x4_sse2,
|
||||
&vpx_highbd_dc_predictor_4x4_c, 4, 8),
|
||||
IntraPredFunc(&vpx_highbd_dc_predictor_8x8_sse2,
|
||||
&vpx_highbd_dc_predictor_8x8_c, 8, 8),
|
||||
IntraPredFunc(&vpx_highbd_dc_predictor_16x16_sse2,
|
||||
&vpx_highbd_dc_predictor_16x16_c, 16, 8),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_4x4_sse2,
|
||||
&vpx_highbd_v_predictor_4x4_c, 4, 8),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_8x8_sse2,
|
||||
&vpx_highbd_v_predictor_8x8_c, 8, 8),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_16x16_sse2,
|
||||
&vpx_highbd_v_predictor_16x16_c, 16, 8),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_32x32_sse2,
|
||||
&vpx_highbd_v_predictor_32x32_c, 32, 8),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_4x4_sse2,
|
||||
&vpx_highbd_tm_predictor_4x4_c, 4, 8),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_8x8_sse2,
|
||||
&vpx_highbd_tm_predictor_8x8_c, 8, 8)));
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2_TO_C_8, VP9IntraPredTest,
|
||||
::testing::Values(IntraPredFunc(&vpx_highbd_dc_predictor_32x32_sse2,
|
||||
&vpx_highbd_dc_predictor_32x32_c, 32, 8),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_16x16_sse2,
|
||||
&vpx_highbd_tm_predictor_16x16_c, 16, 8),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_32x32_sse2,
|
||||
&vpx_highbd_tm_predictor_32x32_c, 32, 8),
|
||||
IntraPredFunc(&vpx_highbd_dc_predictor_4x4_sse2,
|
||||
&vpx_highbd_dc_predictor_4x4_c, 4, 8),
|
||||
IntraPredFunc(&vpx_highbd_dc_predictor_8x8_sse2,
|
||||
&vpx_highbd_dc_predictor_8x8_c, 8, 8),
|
||||
IntraPredFunc(&vpx_highbd_dc_predictor_16x16_sse2,
|
||||
&vpx_highbd_dc_predictor_16x16_c, 16, 8),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_4x4_sse2,
|
||||
&vpx_highbd_v_predictor_4x4_c, 4, 8),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_8x8_sse2,
|
||||
&vpx_highbd_v_predictor_8x8_c, 8, 8),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_16x16_sse2,
|
||||
&vpx_highbd_v_predictor_16x16_c, 16, 8),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_32x32_sse2,
|
||||
&vpx_highbd_v_predictor_32x32_c, 32, 8),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_4x4_sse2,
|
||||
&vpx_highbd_tm_predictor_4x4_c, 4, 8),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_8x8_sse2,
|
||||
&vpx_highbd_tm_predictor_8x8_c, 8, 8)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SSE2_TO_C_10, VP9IntraPredTest,
|
||||
::testing::Values(
|
||||
IntraPredFunc(&vpx_highbd_dc_predictor_32x32_sse2,
|
||||
&vpx_highbd_dc_predictor_32x32_c, 32, 10),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_16x16_sse2,
|
||||
&vpx_highbd_tm_predictor_16x16_c, 16, 10),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_32x32_sse2,
|
||||
&vpx_highbd_tm_predictor_32x32_c, 32, 10),
|
||||
IntraPredFunc(&vpx_highbd_dc_predictor_4x4_sse2,
|
||||
&vpx_highbd_dc_predictor_4x4_c, 4, 10),
|
||||
IntraPredFunc(&vpx_highbd_dc_predictor_8x8_sse2,
|
||||
&vpx_highbd_dc_predictor_8x8_c, 8, 10),
|
||||
IntraPredFunc(&vpx_highbd_dc_predictor_16x16_sse2,
|
||||
&vpx_highbd_dc_predictor_16x16_c, 16, 10),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_4x4_sse2,
|
||||
&vpx_highbd_v_predictor_4x4_c, 4, 10),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_8x8_sse2,
|
||||
&vpx_highbd_v_predictor_8x8_c, 8, 10),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_16x16_sse2,
|
||||
&vpx_highbd_v_predictor_16x16_c, 16, 10),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_32x32_sse2,
|
||||
&vpx_highbd_v_predictor_32x32_c, 32, 10),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_4x4_sse2,
|
||||
&vpx_highbd_tm_predictor_4x4_c, 4, 10),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_8x8_sse2,
|
||||
&vpx_highbd_tm_predictor_8x8_c, 8, 10)));
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2_TO_C_10, VP9IntraPredTest,
|
||||
::testing::Values(IntraPredFunc(&vpx_highbd_dc_predictor_32x32_sse2,
|
||||
&vpx_highbd_dc_predictor_32x32_c, 32, 10),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_16x16_sse2,
|
||||
&vpx_highbd_tm_predictor_16x16_c, 16, 10),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_32x32_sse2,
|
||||
&vpx_highbd_tm_predictor_32x32_c, 32, 10),
|
||||
IntraPredFunc(&vpx_highbd_dc_predictor_4x4_sse2,
|
||||
&vpx_highbd_dc_predictor_4x4_c, 4, 10),
|
||||
IntraPredFunc(&vpx_highbd_dc_predictor_8x8_sse2,
|
||||
&vpx_highbd_dc_predictor_8x8_c, 8, 10),
|
||||
IntraPredFunc(&vpx_highbd_dc_predictor_16x16_sse2,
|
||||
&vpx_highbd_dc_predictor_16x16_c, 16, 10),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_4x4_sse2,
|
||||
&vpx_highbd_v_predictor_4x4_c, 4, 10),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_8x8_sse2,
|
||||
&vpx_highbd_v_predictor_8x8_c, 8, 10),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_16x16_sse2,
|
||||
&vpx_highbd_v_predictor_16x16_c, 16, 10),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_32x32_sse2,
|
||||
&vpx_highbd_v_predictor_32x32_c, 32, 10),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_4x4_sse2,
|
||||
&vpx_highbd_tm_predictor_4x4_c, 4, 10),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_8x8_sse2,
|
||||
&vpx_highbd_tm_predictor_8x8_c, 8, 10)));
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(SSE2_TO_C_12, VP9IntraPredTest,
|
||||
::testing::Values(
|
||||
IntraPredFunc(&vpx_highbd_dc_predictor_32x32_sse2,
|
||||
&vpx_highbd_dc_predictor_32x32_c, 32, 12),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_16x16_sse2,
|
||||
&vpx_highbd_tm_predictor_16x16_c, 16, 12),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_32x32_sse2,
|
||||
&vpx_highbd_tm_predictor_32x32_c, 32, 12),
|
||||
IntraPredFunc(&vpx_highbd_dc_predictor_4x4_sse2,
|
||||
&vpx_highbd_dc_predictor_4x4_c, 4, 12),
|
||||
IntraPredFunc(&vpx_highbd_dc_predictor_8x8_sse2,
|
||||
&vpx_highbd_dc_predictor_8x8_c, 8, 12),
|
||||
IntraPredFunc(&vpx_highbd_dc_predictor_16x16_sse2,
|
||||
&vpx_highbd_dc_predictor_16x16_c, 16, 12),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_4x4_sse2,
|
||||
&vpx_highbd_v_predictor_4x4_c, 4, 12),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_8x8_sse2,
|
||||
&vpx_highbd_v_predictor_8x8_c, 8, 12),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_16x16_sse2,
|
||||
&vpx_highbd_v_predictor_16x16_c, 16, 12),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_32x32_sse2,
|
||||
&vpx_highbd_v_predictor_32x32_c, 32, 12),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_4x4_sse2,
|
||||
&vpx_highbd_tm_predictor_4x4_c, 4, 12),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_8x8_sse2,
|
||||
&vpx_highbd_tm_predictor_8x8_c, 8, 12)));
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2_TO_C_12, VP9IntraPredTest,
|
||||
::testing::Values(IntraPredFunc(&vpx_highbd_dc_predictor_32x32_sse2,
|
||||
&vpx_highbd_dc_predictor_32x32_c, 32, 12),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_16x16_sse2,
|
||||
&vpx_highbd_tm_predictor_16x16_c, 16, 12),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_32x32_sse2,
|
||||
&vpx_highbd_tm_predictor_32x32_c, 32, 12),
|
||||
IntraPredFunc(&vpx_highbd_dc_predictor_4x4_sse2,
|
||||
&vpx_highbd_dc_predictor_4x4_c, 4, 12),
|
||||
IntraPredFunc(&vpx_highbd_dc_predictor_8x8_sse2,
|
||||
&vpx_highbd_dc_predictor_8x8_c, 8, 12),
|
||||
IntraPredFunc(&vpx_highbd_dc_predictor_16x16_sse2,
|
||||
&vpx_highbd_dc_predictor_16x16_c, 16, 12),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_4x4_sse2,
|
||||
&vpx_highbd_v_predictor_4x4_c, 4, 12),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_8x8_sse2,
|
||||
&vpx_highbd_v_predictor_8x8_c, 8, 12),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_16x16_sse2,
|
||||
&vpx_highbd_v_predictor_16x16_c, 16, 12),
|
||||
IntraPredFunc(&vpx_highbd_v_predictor_32x32_sse2,
|
||||
&vpx_highbd_v_predictor_32x32_c, 32, 12),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_4x4_sse2,
|
||||
&vpx_highbd_tm_predictor_4x4_c, 4, 12),
|
||||
IntraPredFunc(&vpx_highbd_tm_predictor_8x8_sse2,
|
||||
&vpx_highbd_tm_predictor_8x8_c, 8, 12)));
|
||||
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
#endif // HAVE_SSE2
|
||||
|
@ -21,15 +21,13 @@ namespace {
|
||||
|
||||
const int kMaxPsnr = 100;
|
||||
|
||||
class LosslessTest : public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
class LosslessTest
|
||||
: public ::libvpx_test::EncoderTest,
|
||||
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
|
||||
protected:
|
||||
LosslessTest()
|
||||
: EncoderTest(GET_PARAM(0)),
|
||||
psnr_(kMaxPsnr),
|
||||
nframes_(0),
|
||||
encoding_mode_(GET_PARAM(1)) {
|
||||
}
|
||||
: EncoderTest(GET_PARAM(0)), psnr_(kMaxPsnr), nframes_(0),
|
||||
encoding_mode_(GET_PARAM(1)) {}
|
||||
|
||||
virtual ~LosslessTest() {}
|
||||
|
||||
@ -55,13 +53,10 @@ class LosslessTest : public ::libvpx_test::EncoderTest,
|
||||
}
|
||||
|
||||
virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
if (pkt->data.psnr.psnr[0] < psnr_)
|
||||
psnr_= pkt->data.psnr.psnr[0];
|
||||
if (pkt->data.psnr.psnr[0] < psnr_) psnr_ = pkt->data.psnr.psnr[0];
|
||||
}
|
||||
|
||||
double GetMinPsnr() const {
|
||||
return psnr_;
|
||||
}
|
||||
double GetMinPsnr() const { return psnr_; }
|
||||
|
||||
private:
|
||||
double psnr_;
|
||||
|
@ -34,9 +34,8 @@ const int number_of_iterations = 100;
|
||||
typedef void (*QuantizeFunc)(const tran_low_t *coeff, intptr_t count,
|
||||
int skip_block, const int16_t *zbin,
|
||||
const int16_t *round, const int16_t *quant,
|
||||
const int16_t *quant_shift,
|
||||
tran_low_t *qcoeff, tran_low_t *dqcoeff,
|
||||
const int16_t *dequant,
|
||||
const int16_t *quant_shift, tran_low_t *qcoeff,
|
||||
tran_low_t *dqcoeff, const int16_t *dequant,
|
||||
uint16_t *eob, const int16_t *scan,
|
||||
const int16_t *iscan);
|
||||
typedef std::tr1::tuple<QuantizeFunc, QuantizeFunc, vpx_bit_depth_t>
|
||||
@ -46,9 +45,9 @@ class VP9QuantizeTest : public ::testing::TestWithParam<QuantizeParam> {
|
||||
public:
|
||||
virtual ~VP9QuantizeTest() {}
|
||||
virtual void SetUp() {
|
||||
quantize_op_ = GET_PARAM(0);
|
||||
quantize_op_ = GET_PARAM(0);
|
||||
ref_quantize_op_ = GET_PARAM(1);
|
||||
bit_depth_ = GET_PARAM(2);
|
||||
bit_depth_ = GET_PARAM(2);
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
}
|
||||
|
||||
@ -65,9 +64,9 @@ class VP9Quantize32Test : public ::testing::TestWithParam<QuantizeParam> {
|
||||
public:
|
||||
virtual ~VP9Quantize32Test() {}
|
||||
virtual void SetUp() {
|
||||
quantize_op_ = GET_PARAM(0);
|
||||
quantize_op_ = GET_PARAM(0);
|
||||
ref_quantize_op_ = GET_PARAM(1);
|
||||
bit_depth_ = GET_PARAM(2);
|
||||
bit_depth_ = GET_PARAM(2);
|
||||
mask_ = (1 << bit_depth_) - 1;
|
||||
}
|
||||
|
||||
@ -106,10 +105,10 @@ TEST_P(VP9QuantizeTest, OperationCheck) {
|
||||
*eob_ptr = rnd.Rand16();
|
||||
*ref_eob_ptr = *eob_ptr;
|
||||
for (int j = 0; j < count; j++) {
|
||||
coeff_ptr[j] = rnd.Rand16()&mask_;
|
||||
coeff_ptr[j] = rnd.Rand16() & mask_;
|
||||
}
|
||||
for (int j = 0; j < 2; j++) {
|
||||
zbin_ptr[j] = rnd.Rand16()&mask_;
|
||||
zbin_ptr[j] = rnd.Rand16() & mask_;
|
||||
round_ptr[j] = rnd.Rand16();
|
||||
quant_ptr[j] = rnd.Rand16();
|
||||
quant_shift_ptr[j] = rnd.Rand16();
|
||||
@ -117,16 +116,15 @@ TEST_P(VP9QuantizeTest, OperationCheck) {
|
||||
}
|
||||
ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
|
||||
quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
|
||||
ref_dqcoeff_ptr, dequant_ptr,
|
||||
ref_eob_ptr, scan_order->scan, scan_order->iscan);
|
||||
ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block,
|
||||
zbin_ptr, round_ptr, quant_ptr,
|
||||
quant_shift_ptr, qcoeff_ptr,
|
||||
dqcoeff_ptr, dequant_ptr, eob_ptr,
|
||||
scan_order->scan, scan_order->iscan));
|
||||
ref_dqcoeff_ptr, dequant_ptr, ref_eob_ptr,
|
||||
scan_order->scan, scan_order->iscan);
|
||||
ASM_REGISTER_STATE_CHECK(quantize_op_(
|
||||
coeff_ptr, count, skip_block, zbin_ptr, round_ptr, quant_ptr,
|
||||
quant_shift_ptr, qcoeff_ptr, dqcoeff_ptr, dequant_ptr, eob_ptr,
|
||||
scan_order->scan, scan_order->iscan));
|
||||
for (int j = 0; j < sz; ++j) {
|
||||
err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |
|
||||
(ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
|
||||
err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |
|
||||
(ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
|
||||
}
|
||||
err_count += (*ref_eob_ptr != *eob_ptr);
|
||||
if (err_count && !err_count_total) {
|
||||
@ -165,10 +163,10 @@ TEST_P(VP9Quantize32Test, OperationCheck) {
|
||||
*eob_ptr = rnd.Rand16();
|
||||
*ref_eob_ptr = *eob_ptr;
|
||||
for (int j = 0; j < count; j++) {
|
||||
coeff_ptr[j] = rnd.Rand16()&mask_;
|
||||
coeff_ptr[j] = rnd.Rand16() & mask_;
|
||||
}
|
||||
for (int j = 0; j < 2; j++) {
|
||||
zbin_ptr[j] = rnd.Rand16()&mask_;
|
||||
zbin_ptr[j] = rnd.Rand16() & mask_;
|
||||
round_ptr[j] = rnd.Rand16();
|
||||
quant_ptr[j] = rnd.Rand16();
|
||||
quant_shift_ptr[j] = rnd.Rand16();
|
||||
@ -176,16 +174,15 @@ TEST_P(VP9Quantize32Test, OperationCheck) {
|
||||
}
|
||||
ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
|
||||
quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
|
||||
ref_dqcoeff_ptr, dequant_ptr,
|
||||
ref_eob_ptr, scan_order->scan, scan_order->iscan);
|
||||
ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block,
|
||||
zbin_ptr, round_ptr, quant_ptr,
|
||||
quant_shift_ptr, qcoeff_ptr,
|
||||
dqcoeff_ptr, dequant_ptr, eob_ptr,
|
||||
scan_order->scan, scan_order->iscan));
|
||||
ref_dqcoeff_ptr, dequant_ptr, ref_eob_ptr,
|
||||
scan_order->scan, scan_order->iscan);
|
||||
ASM_REGISTER_STATE_CHECK(quantize_op_(
|
||||
coeff_ptr, count, skip_block, zbin_ptr, round_ptr, quant_ptr,
|
||||
quant_shift_ptr, qcoeff_ptr, dqcoeff_ptr, dequant_ptr, eob_ptr,
|
||||
scan_order->scan, scan_order->iscan));
|
||||
for (int j = 0; j < sz; ++j) {
|
||||
err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |
|
||||
(ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
|
||||
err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |
|
||||
(ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
|
||||
}
|
||||
err_count += (*ref_eob_ptr != *eob_ptr);
|
||||
if (err_count && !err_count_total) {
|
||||
@ -227,10 +224,10 @@ TEST_P(VP9QuantizeTest, EOBCheck) {
|
||||
for (int j = 0; j < count; j++) {
|
||||
coeff_ptr[j] = 0;
|
||||
}
|
||||
coeff_ptr[rnd(count)] = rnd.Rand16()&mask_;
|
||||
coeff_ptr[rnd(count)] = rnd.Rand16()&mask_;
|
||||
coeff_ptr[rnd(count)] = rnd.Rand16() & mask_;
|
||||
coeff_ptr[rnd(count)] = rnd.Rand16() & mask_;
|
||||
for (int j = 0; j < 2; j++) {
|
||||
zbin_ptr[j] = rnd.Rand16()&mask_;
|
||||
zbin_ptr[j] = rnd.Rand16() & mask_;
|
||||
round_ptr[j] = rnd.Rand16();
|
||||
quant_ptr[j] = rnd.Rand16();
|
||||
quant_shift_ptr[j] = rnd.Rand16();
|
||||
@ -239,17 +236,16 @@ TEST_P(VP9QuantizeTest, EOBCheck) {
|
||||
|
||||
ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
|
||||
quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
|
||||
ref_dqcoeff_ptr, dequant_ptr,
|
||||
ref_eob_ptr, scan_order->scan, scan_order->iscan);
|
||||
ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block,
|
||||
zbin_ptr, round_ptr, quant_ptr,
|
||||
quant_shift_ptr, qcoeff_ptr,
|
||||
dqcoeff_ptr, dequant_ptr, eob_ptr,
|
||||
scan_order->scan, scan_order->iscan));
|
||||
ref_dqcoeff_ptr, dequant_ptr, ref_eob_ptr,
|
||||
scan_order->scan, scan_order->iscan);
|
||||
ASM_REGISTER_STATE_CHECK(quantize_op_(
|
||||
coeff_ptr, count, skip_block, zbin_ptr, round_ptr, quant_ptr,
|
||||
quant_shift_ptr, qcoeff_ptr, dqcoeff_ptr, dequant_ptr, eob_ptr,
|
||||
scan_order->scan, scan_order->iscan));
|
||||
|
||||
for (int j = 0; j < sz; ++j) {
|
||||
err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |
|
||||
(ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
|
||||
err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |
|
||||
(ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
|
||||
}
|
||||
err_count += (*ref_eob_ptr != *eob_ptr);
|
||||
if (err_count && !err_count_total) {
|
||||
@ -291,10 +287,10 @@ TEST_P(VP9Quantize32Test, EOBCheck) {
|
||||
coeff_ptr[j] = 0;
|
||||
}
|
||||
// Two random entries
|
||||
coeff_ptr[rnd(count)] = rnd.Rand16()&mask_;
|
||||
coeff_ptr[rnd(count)] = rnd.Rand16()&mask_;
|
||||
coeff_ptr[rnd(count)] = rnd.Rand16() & mask_;
|
||||
coeff_ptr[rnd(count)] = rnd.Rand16() & mask_;
|
||||
for (int j = 0; j < 2; j++) {
|
||||
zbin_ptr[j] = rnd.Rand16()&mask_;
|
||||
zbin_ptr[j] = rnd.Rand16() & mask_;
|
||||
round_ptr[j] = rnd.Rand16();
|
||||
quant_ptr[j] = rnd.Rand16();
|
||||
quant_shift_ptr[j] = rnd.Rand16();
|
||||
@ -303,17 +299,16 @@ TEST_P(VP9Quantize32Test, EOBCheck) {
|
||||
|
||||
ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
|
||||
quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
|
||||
ref_dqcoeff_ptr, dequant_ptr,
|
||||
ref_eob_ptr, scan_order->scan, scan_order->iscan);
|
||||
ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block,
|
||||
zbin_ptr, round_ptr, quant_ptr,
|
||||
quant_shift_ptr, qcoeff_ptr,
|
||||
dqcoeff_ptr, dequant_ptr, eob_ptr,
|
||||
scan_order->scan, scan_order->iscan));
|
||||
ref_dqcoeff_ptr, dequant_ptr, ref_eob_ptr,
|
||||
scan_order->scan, scan_order->iscan);
|
||||
ASM_REGISTER_STATE_CHECK(quantize_op_(
|
||||
coeff_ptr, count, skip_block, zbin_ptr, round_ptr, quant_ptr,
|
||||
quant_shift_ptr, qcoeff_ptr, dqcoeff_ptr, dequant_ptr, eob_ptr,
|
||||
scan_order->scan, scan_order->iscan));
|
||||
|
||||
for (int j = 0; j < sz; ++j) {
|
||||
err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |
|
||||
(ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
|
||||
err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |
|
||||
(ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
|
||||
}
|
||||
err_count += (*ref_eob_ptr != *eob_ptr);
|
||||
if (err_count && !err_count_total) {
|
||||
@ -330,22 +325,20 @@ using std::tr1::make_tuple;
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, VP9QuantizeTest,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_highbd_quantize_b_sse2,
|
||||
&vpx_highbd_quantize_b_c, VPX_BITS_8),
|
||||
make_tuple(&vpx_highbd_quantize_b_sse2,
|
||||
&vpx_highbd_quantize_b_c, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_quantize_b_sse2,
|
||||
&vpx_highbd_quantize_b_c, VPX_BITS_12)));
|
||||
::testing::Values(make_tuple(&vpx_highbd_quantize_b_sse2,
|
||||
&vpx_highbd_quantize_b_c, VPX_BITS_8),
|
||||
make_tuple(&vpx_highbd_quantize_b_sse2,
|
||||
&vpx_highbd_quantize_b_c, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_quantize_b_sse2,
|
||||
&vpx_highbd_quantize_b_c, VPX_BITS_12)));
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, VP9Quantize32Test,
|
||||
::testing::Values(
|
||||
make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
|
||||
&vpx_highbd_quantize_b_32x32_c, VPX_BITS_8),
|
||||
make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
|
||||
&vpx_highbd_quantize_b_32x32_c, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
|
||||
&vpx_highbd_quantize_b_32x32_c, VPX_BITS_12)));
|
||||
::testing::Values(make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
|
||||
&vpx_highbd_quantize_b_32x32_c, VPX_BITS_8),
|
||||
make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
|
||||
&vpx_highbd_quantize_b_32x32_c, VPX_BITS_10),
|
||||
make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
|
||||
&vpx_highbd_quantize_b_32x32_c, VPX_BITS_12)));
|
||||
#endif // HAVE_SSE2
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
} // namespace
|
||||
|
@ -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 SkipLoopFilterTest {
|
||||
public:
|
||||
SkipLoopFilterTest()
|
||||
: video_(NULL),
|
||||
decoder_(NULL),
|
||||
md5_file_(NULL) {}
|
||||
SkipLoopFilterTest() : video_(NULL), decoder_(NULL), md5_file_(NULL) {}
|
||||
|
||||
~SkipLoopFilterTest() {
|
||||
if (md5_file_ != NULL)
|
||||
fclose(md5_file_);
|
||||
if (md5_file_ != NULL) fclose(md5_file_);
|
||||
delete decoder_;
|
||||
delete video_;
|
||||
}
|
||||
@ -46,8 +42,7 @@ class SkipLoopFilterTest {
|
||||
video_->Begin();
|
||||
|
||||
vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
|
||||
if (num_threads > 0)
|
||||
cfg.threads = num_threads;
|
||||
if (num_threads > 0) cfg.threads = num_threads;
|
||||
decoder_ = new libvpx_test::VP9Decoder(cfg, 0);
|
||||
ASSERT_TRUE(decoder_ != NULL);
|
||||
|
||||
@ -73,8 +68,7 @@ class SkipLoopFilterTest {
|
||||
for (; video_->cxdata() != NULL; video_->Next()) {
|
||||
const vpx_codec_err_t res =
|
||||
decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
|
||||
if (res != VPX_CODEC_OK)
|
||||
return res;
|
||||
if (res != VPX_CODEC_OK) return res;
|
||||
ReadMd5();
|
||||
}
|
||||
return VPX_CODEC_OK;
|
||||
@ -92,7 +86,7 @@ class SkipLoopFilterTest {
|
||||
void OpenMd5File(const std::string &md5_file_name) {
|
||||
md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name);
|
||||
ASSERT_TRUE(md5_file_ != NULL) << "MD5 file open failed. Filename: "
|
||||
<< md5_file_name;
|
||||
<< md5_file_name;
|
||||
}
|
||||
|
||||
// Reads the next line of the MD5 file.
|
||||
|
@ -19,18 +19,16 @@
|
||||
#include "vp9/common/vp9_blockd.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
typedef void (*SubtractFunc)(int rows, int cols,
|
||||
int16_t *diff_ptr, ptrdiff_t diff_stride,
|
||||
const uint8_t *src_ptr, ptrdiff_t src_stride,
|
||||
const uint8_t *pred_ptr, ptrdiff_t pred_stride);
|
||||
typedef void (*SubtractFunc)(int rows, int cols, int16_t *diff_ptr,
|
||||
ptrdiff_t diff_stride, const uint8_t *src_ptr,
|
||||
ptrdiff_t src_stride, const uint8_t *pred_ptr,
|
||||
ptrdiff_t pred_stride);
|
||||
|
||||
namespace vp9 {
|
||||
|
||||
class VP9SubtractBlockTest : public ::testing::TestWithParam<SubtractFunc> {
|
||||
public:
|
||||
virtual void TearDown() {
|
||||
libvpx_test::ClearSystemState();
|
||||
}
|
||||
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
||||
};
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
@ -47,7 +45,7 @@ TEST_P(VP9SubtractBlockTest, SimpleSubtract) {
|
||||
vpx_memalign(16, sizeof(*diff) * block_width * block_height * 2));
|
||||
uint8_t *pred = reinterpret_cast<uint8_t *>(
|
||||
vpx_memalign(16, block_width * block_height * 2));
|
||||
uint8_t *src = reinterpret_cast<uint8_t *>(
|
||||
uint8_t *src = reinterpret_cast<uint8_t *>(
|
||||
vpx_memalign(16, block_width * block_height * 2));
|
||||
|
||||
for (int n = 0; n < 100; n++) {
|
||||
@ -58,29 +56,26 @@ TEST_P(VP9SubtractBlockTest, SimpleSubtract) {
|
||||
}
|
||||
}
|
||||
|
||||
GetParam()(block_height, block_width, diff, block_width,
|
||||
src, block_width, pred, block_width);
|
||||
GetParam()(block_height, block_width, diff, block_width, src, block_width,
|
||||
pred, block_width);
|
||||
|
||||
for (int r = 0; r < block_height; ++r) {
|
||||
for (int c = 0; c < block_width; ++c) {
|
||||
EXPECT_EQ(diff[r * block_width + c],
|
||||
(src[r * block_width + c] -
|
||||
pred[r * block_width + c])) << "r = " << r
|
||||
<< ", c = " << c
|
||||
<< ", bs = " << bsize;
|
||||
(src[r * block_width + c] - pred[r * block_width + c]))
|
||||
<< "r = " << r << ", c = " << c << ", bs = " << bsize;
|
||||
}
|
||||
}
|
||||
|
||||
GetParam()(block_height, block_width, diff, block_width * 2,
|
||||
src, block_width * 2, pred, block_width * 2);
|
||||
GetParam()(block_height, block_width, diff, block_width * 2, src,
|
||||
block_width * 2, pred, block_width * 2);
|
||||
|
||||
for (int r = 0; r < block_height; ++r) {
|
||||
for (int c = 0; c < block_width; ++c) {
|
||||
EXPECT_EQ(diff[r * block_width * 2 + c],
|
||||
(src[r * block_width * 2 + c] -
|
||||
pred[r * block_width * 2 + c])) << "r = " << r
|
||||
<< ", c = " << c
|
||||
<< ", bs = " << bsize;
|
||||
EXPECT_EQ(
|
||||
diff[r * block_width * 2 + c],
|
||||
(src[r * block_width * 2 + c] - pred[r * block_width * 2 + c]))
|
||||
<< "r = " << r << ", c = " << c << ", bs = " << bsize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,15 +27,11 @@ using std::string;
|
||||
class VPxWorkerThreadTest : public ::testing::TestWithParam<bool> {
|
||||
protected:
|
||||
virtual ~VPxWorkerThreadTest() {}
|
||||
virtual void SetUp() {
|
||||
vpx_get_worker_interface()->init(&worker_);
|
||||
}
|
||||
virtual void SetUp() { vpx_get_worker_interface()->init(&worker_); }
|
||||
|
||||
virtual void TearDown() {
|
||||
vpx_get_worker_interface()->end(&worker_);
|
||||
}
|
||||
virtual void TearDown() { vpx_get_worker_interface()->end(&worker_); }
|
||||
|
||||
void Run(VPxWorker* worker) {
|
||||
void Run(VPxWorker *worker) {
|
||||
const bool synchronous = GetParam();
|
||||
if (synchronous) {
|
||||
vpx_get_worker_interface()->execute(worker);
|
||||
@ -47,10 +43,10 @@ class VPxWorkerThreadTest : public ::testing::TestWithParam<bool> {
|
||||
VPxWorker worker_;
|
||||
};
|
||||
|
||||
int ThreadHook(void* data, void* return_value) {
|
||||
int* const hook_data = reinterpret_cast<int*>(data);
|
||||
int ThreadHook(void *data, void *return_value) {
|
||||
int *const hook_data = reinterpret_cast<int *>(data);
|
||||
*hook_data = 5;
|
||||
return *reinterpret_cast<int*>(return_value);
|
||||
return *reinterpret_cast<int *>(return_value);
|
||||
}
|
||||
|
||||
TEST_P(VPxWorkerThreadTest, HookSuccess) {
|
||||
@ -159,7 +155,7 @@ struct FileList {
|
||||
};
|
||||
|
||||
// Decodes |filename| with |num_threads|. Returns the md5 of the decoded frames.
|
||||
string DecodeFile(const string& filename, int num_threads) {
|
||||
string DecodeFile(const string &filename, int num_threads) {
|
||||
libvpx_test::WebMVideoSource video(filename);
|
||||
video.Init();
|
||||
|
||||
@ -191,8 +187,8 @@ void DecodeFiles(const FileList files[]) {
|
||||
for (const FileList *iter = files; iter->name != NULL; ++iter) {
|
||||
SCOPED_TRACE(iter->name);
|
||||
for (int t = 1; t <= 8; ++t) {
|
||||
EXPECT_EQ(iter->expected_md5, DecodeFile(iter->name, t))
|
||||
<< "threads = " << t;
|
||||
EXPECT_EQ(iter->expected_md5, DecodeFile(iter->name, t)) << "threads = "
|
||||
<< t;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -242,15 +238,13 @@ TEST(VP9DecodeMultiThreadedTest, NoTilesNonFrameParallel) {
|
||||
}
|
||||
|
||||
TEST(VP9DecodeMultiThreadedTest, FrameParallel) {
|
||||
static const FileList files[] = {
|
||||
{ "vp90-2-08-tile_1x2_frame_parallel.webm",
|
||||
"68ede6abd66bae0a2edf2eb9232241b6" },
|
||||
{ "vp90-2-08-tile_1x4_frame_parallel.webm",
|
||||
"368ebc6ebf3a5e478d85b2c3149b2848" },
|
||||
{ "vp90-2-08-tile_1x8_frame_parallel.webm",
|
||||
"17e439da2388aff3a0f69cb22579c6c1" },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
static const FileList files[] = { { "vp90-2-08-tile_1x2_frame_parallel.webm",
|
||||
"68ede6abd66bae0a2edf2eb9232241b6" },
|
||||
{ "vp90-2-08-tile_1x4_frame_parallel.webm",
|
||||
"368ebc6ebf3a5e478d85b2c3149b2848" },
|
||||
{ "vp90-2-08-tile_1x8_frame_parallel.webm",
|
||||
"17e439da2388aff3a0f69cb22579c6c1" },
|
||||
{ NULL, NULL } };
|
||||
|
||||
DecodeFiles(files);
|
||||
}
|
||||
|
@ -25,9 +25,7 @@ typedef void (*CopyFrameFunc)(const YV12_BUFFER_CONFIG *src_ybf,
|
||||
|
||||
class VpxScaleBase {
|
||||
public:
|
||||
virtual ~VpxScaleBase() {
|
||||
libvpx_test::ClearSystemState();
|
||||
}
|
||||
virtual ~VpxScaleBase() { libvpx_test::ClearSystemState(); }
|
||||
|
||||
void ResetImage(int width, int height) {
|
||||
width_ = width;
|
||||
@ -105,28 +103,22 @@ class VpxScaleBase {
|
||||
}
|
||||
|
||||
uint8_t *bottom = left + (crop_height * stride);
|
||||
for (int y = 0; y < bottom_extend; ++y) {
|
||||
for (int y = 0; y < bottom_extend; ++y) {
|
||||
memcpy(bottom, left + (crop_height - 1) * stride, extend_width);
|
||||
bottom += stride;
|
||||
}
|
||||
}
|
||||
|
||||
void ReferenceExtendBorder() {
|
||||
ExtendPlane(ref_img_.y_buffer,
|
||||
ref_img_.y_crop_width, ref_img_.y_crop_height,
|
||||
ref_img_.y_width, ref_img_.y_height,
|
||||
ref_img_.y_stride,
|
||||
ref_img_.border);
|
||||
ExtendPlane(ref_img_.u_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);
|
||||
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);
|
||||
ExtendPlane(ref_img_.y_buffer, ref_img_.y_crop_width,
|
||||
ref_img_.y_crop_height, ref_img_.y_width, ref_img_.y_height,
|
||||
ref_img_.y_stride, ref_img_.border);
|
||||
ExtendPlane(ref_img_.u_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);
|
||||
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() {
|
||||
@ -172,13 +164,9 @@ class ExtendBorderTest
|
||||
virtual ~ExtendBorderTest() {}
|
||||
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
extend_fn_ = GetParam();
|
||||
}
|
||||
virtual void SetUp() { extend_fn_ = GetParam(); }
|
||||
|
||||
void ExtendBorder() {
|
||||
ASM_REGISTER_STATE_CHECK(extend_fn_(&img_));
|
||||
}
|
||||
void ExtendBorder() { ASM_REGISTER_STATE_CHECK(extend_fn_(&img_)); }
|
||||
|
||||
void RunTest() {
|
||||
#if ARCH_ARM
|
||||
@ -187,7 +175,7 @@ class ExtendBorderTest
|
||||
#else
|
||||
static const int kNumSizesToTest = 7;
|
||||
#endif
|
||||
static const int kSizesToTest[] = {1, 15, 33, 145, 512, 1025, 16383};
|
||||
static const int kSizesToTest[] = { 1, 15, 33, 145, 512, 1025, 16383 };
|
||||
for (int h = 0; h < kNumSizesToTest; ++h) {
|
||||
for (int w = 0; w < kNumSizesToTest; ++w) {
|
||||
ResetImage(kSizesToTest[w], kSizesToTest[h]);
|
||||
@ -202,23 +190,18 @@ class ExtendBorderTest
|
||||
ExtendFrameBorderFunc extend_fn_;
|
||||
};
|
||||
|
||||
TEST_P(ExtendBorderTest, ExtendBorder) {
|
||||
ASSERT_NO_FATAL_FAILURE(RunTest());
|
||||
}
|
||||
TEST_P(ExtendBorderTest, ExtendBorder) { ASSERT_NO_FATAL_FAILURE(RunTest()); }
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(C, ExtendBorderTest,
|
||||
::testing::Values(vp8_yv12_extend_frame_borders_c));
|
||||
|
||||
class CopyFrameTest
|
||||
: public VpxScaleBase,
|
||||
public ::testing::TestWithParam<CopyFrameFunc> {
|
||||
class CopyFrameTest : public VpxScaleBase,
|
||||
public ::testing::TestWithParam<CopyFrameFunc> {
|
||||
public:
|
||||
virtual ~CopyFrameTest() {}
|
||||
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
copy_frame_fn_ = GetParam();
|
||||
}
|
||||
virtual void SetUp() { copy_frame_fn_ = GetParam(); }
|
||||
|
||||
void CopyFrame() {
|
||||
ASM_REGISTER_STATE_CHECK(copy_frame_fn_(&img_, &cpy_img_));
|
||||
@ -231,7 +214,7 @@ class CopyFrameTest
|
||||
#else
|
||||
static const int kNumSizesToTest = 7;
|
||||
#endif
|
||||
static const int kSizesToTest[] = {1, 15, 33, 145, 512, 1025, 16383};
|
||||
static const int kSizesToTest[] = { 1, 15, 33, 145, 512, 1025, 16383 };
|
||||
for (int h = 0; h < kNumSizesToTest; ++h) {
|
||||
for (int w = 0; w < kNumSizesToTest; ++w) {
|
||||
ResetImage(kSizesToTest[w], kSizesToTest[h]);
|
||||
@ -246,9 +229,7 @@ class CopyFrameTest
|
||||
CopyFrameFunc copy_frame_fn_;
|
||||
};
|
||||
|
||||
TEST_P(CopyFrameTest, CopyFrame) {
|
||||
ASSERT_NO_FATAL_FAILURE(RunTest());
|
||||
}
|
||||
TEST_P(CopyFrameTest, CopyFrame) { ASSERT_NO_FATAL_FAILURE(RunTest()); }
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(C, CopyFrameTest,
|
||||
::testing::Values(vp8_yv12_copy_frame_c));
|
||||
|
@ -25,30 +25,23 @@ namespace libvpx_test {
|
||||
class WebMVideoSource : public CompressedVideoSource {
|
||||
public:
|
||||
explicit WebMVideoSource(const std::string &file_name)
|
||||
: file_name_(file_name),
|
||||
vpx_ctx_(new VpxInputContext()),
|
||||
webm_ctx_(new WebmInputContext()),
|
||||
buf_(NULL),
|
||||
buf_sz_(0),
|
||||
frame_(0),
|
||||
end_of_file_(false) {
|
||||
}
|
||||
: file_name_(file_name), vpx_ctx_(new VpxInputContext()),
|
||||
webm_ctx_(new WebmInputContext()), buf_(NULL), buf_sz_(0), frame_(0),
|
||||
end_of_file_(false) {}
|
||||
|
||||
virtual ~WebMVideoSource() {
|
||||
if (vpx_ctx_->file != NULL)
|
||||
fclose(vpx_ctx_->file);
|
||||
if (vpx_ctx_->file != NULL) fclose(vpx_ctx_->file);
|
||||
webm_free(webm_ctx_);
|
||||
delete vpx_ctx_;
|
||||
delete webm_ctx_;
|
||||
}
|
||||
|
||||
virtual void Init() {
|
||||
}
|
||||
virtual void Init() {}
|
||||
|
||||
virtual void Begin() {
|
||||
vpx_ctx_->file = OpenTestDataFile(file_name_);
|
||||
ASSERT_TRUE(vpx_ctx_->file != NULL) << "Input file open failed. Filename: "
|
||||
<< file_name_;
|
||||
<< file_name_;
|
||||
|
||||
ASSERT_EQ(file_is_webm(webm_ctx_, vpx_ctx_), 1) << "file is not WebM";
|
||||
|
||||
@ -81,9 +74,7 @@ class WebMVideoSource : public CompressedVideoSource {
|
||||
} while (!webm_ctx_->is_key_frame && !end_of_file_);
|
||||
}
|
||||
|
||||
virtual const uint8_t *cxdata() const {
|
||||
return end_of_file_ ? NULL : buf_;
|
||||
}
|
||||
virtual const uint8_t *cxdata() const { return end_of_file_ ? NULL : buf_; }
|
||||
virtual size_t frame_size() const { return buf_sz_; }
|
||||
virtual unsigned int frame_number() const { return frame_; }
|
||||
|
||||
|
@ -22,7 +22,7 @@ namespace {
|
||||
|
||||
using std::string;
|
||||
|
||||
static const unsigned int kWidth = 160;
|
||||
static const unsigned int kWidth = 160;
|
||||
static const unsigned int kHeight = 90;
|
||||
static const unsigned int kFrames = 10;
|
||||
|
||||
@ -34,24 +34,24 @@ struct Y4mTestParam {
|
||||
};
|
||||
|
||||
const Y4mTestParam kY4mTestVectors[] = {
|
||||
{"park_joy_90p_8_420.y4m", 8, VPX_IMG_FMT_I420,
|
||||
"e5406275b9fc6bb3436c31d4a05c1cab"},
|
||||
{"park_joy_90p_8_422.y4m", 8, VPX_IMG_FMT_I422,
|
||||
"284a47a47133b12884ec3a14e959a0b6"},
|
||||
{"park_joy_90p_8_444.y4m", 8, VPX_IMG_FMT_I444,
|
||||
"90517ff33843d85de712fd4fe60dbed0"},
|
||||
{"park_joy_90p_10_420.y4m", 10, VPX_IMG_FMT_I42016,
|
||||
"63f21f9f717d8b8631bd2288ee87137b"},
|
||||
{"park_joy_90p_10_422.y4m", 10, VPX_IMG_FMT_I42216,
|
||||
"48ab51fb540aed07f7ff5af130c9b605"},
|
||||
{"park_joy_90p_10_444.y4m", 10, VPX_IMG_FMT_I44416,
|
||||
"067bfd75aa85ff9bae91fa3e0edd1e3e"},
|
||||
{"park_joy_90p_12_420.y4m", 12, VPX_IMG_FMT_I42016,
|
||||
"9e6d8f6508c6e55625f6b697bc461cef"},
|
||||
{"park_joy_90p_12_422.y4m", 12, VPX_IMG_FMT_I42216,
|
||||
"b239c6b301c0b835485be349ca83a7e3"},
|
||||
{"park_joy_90p_12_444.y4m", 12, VPX_IMG_FMT_I44416,
|
||||
"5a6481a550821dab6d0192f5c63845e9"},
|
||||
{ "park_joy_90p_8_420.y4m", 8, VPX_IMG_FMT_I420,
|
||||
"e5406275b9fc6bb3436c31d4a05c1cab" },
|
||||
{ "park_joy_90p_8_422.y4m", 8, VPX_IMG_FMT_I422,
|
||||
"284a47a47133b12884ec3a14e959a0b6" },
|
||||
{ "park_joy_90p_8_444.y4m", 8, VPX_IMG_FMT_I444,
|
||||
"90517ff33843d85de712fd4fe60dbed0" },
|
||||
{ "park_joy_90p_10_420.y4m", 10, VPX_IMG_FMT_I42016,
|
||||
"63f21f9f717d8b8631bd2288ee87137b" },
|
||||
{ "park_joy_90p_10_422.y4m", 10, VPX_IMG_FMT_I42216,
|
||||
"48ab51fb540aed07f7ff5af130c9b605" },
|
||||
{ "park_joy_90p_10_444.y4m", 10, VPX_IMG_FMT_I44416,
|
||||
"067bfd75aa85ff9bae91fa3e0edd1e3e" },
|
||||
{ "park_joy_90p_12_420.y4m", 12, VPX_IMG_FMT_I42016,
|
||||
"9e6d8f6508c6e55625f6b697bc461cef" },
|
||||
{ "park_joy_90p_12_422.y4m", 12, VPX_IMG_FMT_I42216,
|
||||
"b239c6b301c0b835485be349ca83a7e3" },
|
||||
{ "park_joy_90p_12_444.y4m", 12, VPX_IMG_FMT_I44416,
|
||||
"5a6481a550821dab6d0192f5c63845e9" },
|
||||
};
|
||||
|
||||
static void write_image_file(const vpx_image_t *img, FILE *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 int stride = img->stride[plane];
|
||||
const int bytes_per_sample = (img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? 2 : 1;
|
||||
const int h = (plane ? (img->d_h + img->y_chroma_shift) >>
|
||||
img->y_chroma_shift : img->d_h);
|
||||
const int w = (plane ? (img->d_w + img->x_chroma_shift) >>
|
||||
img->x_chroma_shift : img->d_w);
|
||||
const int h =
|
||||
(plane ? (img->d_h + img->y_chroma_shift) >> img->y_chroma_shift
|
||||
: img->d_h);
|
||||
const int w =
|
||||
(plane ? (img->d_w + img->x_chroma_shift) >> img->x_chroma_shift
|
||||
: img->d_w);
|
||||
for (y = 0; y < h; ++y) {
|
||||
fwrite(buf, bytes_per_sample, w, file);
|
||||
buf += stride;
|
||||
@ -71,15 +73,12 @@ static void write_image_file(const vpx_image_t *img, FILE *file) {
|
||||
}
|
||||
}
|
||||
|
||||
class Y4mVideoSourceTest
|
||||
: public ::testing::TestWithParam<Y4mTestParam>,
|
||||
public ::libvpx_test::Y4mVideoSource {
|
||||
class Y4mVideoSourceTest : public ::testing::TestWithParam<Y4mTestParam>,
|
||||
public ::libvpx_test::Y4mVideoSource {
|
||||
protected:
|
||||
Y4mVideoSourceTest() : Y4mVideoSource("", 0, 0) {}
|
||||
|
||||
virtual ~Y4mVideoSourceTest() {
|
||||
CloseSource();
|
||||
}
|
||||
virtual ~Y4mVideoSourceTest() { CloseSource(); }
|
||||
|
||||
virtual void Init(const std::string &file_name, int limit) {
|
||||
file_name_ = file_name;
|
||||
@ -137,8 +136,7 @@ TEST_P(Y4mVideoSourceTest, SourceTest) {
|
||||
INSTANTIATE_TEST_CASE_P(C, Y4mVideoSourceTest,
|
||||
::testing::ValuesIn(kY4mTestVectors));
|
||||
|
||||
class Y4mVideoWriteTest
|
||||
: public Y4mVideoSourceTest {
|
||||
class Y4mVideoWriteTest : public Y4mVideoSourceTest {
|
||||
protected:
|
||||
Y4mVideoWriteTest() {}
|
||||
|
||||
@ -158,14 +156,12 @@ class Y4mVideoWriteTest
|
||||
// Writes out a y4m file and then reads it back
|
||||
void WriteY4mAndReadBack() {
|
||||
ASSERT_TRUE(input_file_ != NULL);
|
||||
char buf[Y4M_BUFFER_SIZE] = {0};
|
||||
const struct VpxRational framerate = {y4m_.fps_n, y4m_.fps_d};
|
||||
char buf[Y4M_BUFFER_SIZE] = { 0 };
|
||||
const struct VpxRational framerate = { y4m_.fps_n, y4m_.fps_d };
|
||||
tmpfile_ = new libvpx_test::TempOutFile;
|
||||
ASSERT_TRUE(tmpfile_->file() != NULL);
|
||||
y4m_write_file_header(buf, sizeof(buf),
|
||||
kWidth, kHeight,
|
||||
&framerate, y4m_.vpx_fmt,
|
||||
y4m_.bit_depth);
|
||||
y4m_write_file_header(buf, sizeof(buf), kWidth, kHeight, &framerate,
|
||||
y4m_.vpx_fmt, y4m_.bit_depth);
|
||||
fputs(buf, tmpfile_->file());
|
||||
for (unsigned int i = start_; i < limit_; i++) {
|
||||
y4m_write_frame_header(buf, sizeof(buf));
|
||||
|
@ -21,18 +21,10 @@ namespace libvpx_test {
|
||||
// so that we can do actual file encodes.
|
||||
class Y4mVideoSource : public VideoSource {
|
||||
public:
|
||||
Y4mVideoSource(const std::string &file_name,
|
||||
unsigned int start, int limit)
|
||||
: file_name_(file_name),
|
||||
input_file_(NULL),
|
||||
img_(new vpx_image_t()),
|
||||
start_(start),
|
||||
limit_(limit),
|
||||
frame_(0),
|
||||
framerate_numerator_(0),
|
||||
framerate_denominator_(0),
|
||||
y4m_() {
|
||||
}
|
||||
Y4mVideoSource(const std::string &file_name, unsigned int start, int limit)
|
||||
: file_name_(file_name), input_file_(NULL), img_(new vpx_image_t()),
|
||||
start_(start), limit_(limit), frame_(0), framerate_numerator_(0),
|
||||
framerate_denominator_(0), y4m_() {}
|
||||
|
||||
virtual ~Y4mVideoSource() {
|
||||
vpx_img_free(img_.get());
|
||||
|
@ -25,19 +25,11 @@ namespace libvpx_test {
|
||||
class YUVVideoSource : public VideoSource {
|
||||
public:
|
||||
YUVVideoSource(const std::string &file_name, vpx_img_fmt format,
|
||||
unsigned int width, unsigned int height,
|
||||
int rate_numerator, int rate_denominator,
|
||||
unsigned int start, int limit)
|
||||
: file_name_(file_name),
|
||||
input_file_(NULL),
|
||||
img_(NULL),
|
||||
start_(start),
|
||||
limit_(limit),
|
||||
frame_(0),
|
||||
width_(0),
|
||||
height_(0),
|
||||
format_(VPX_IMG_FMT_NONE),
|
||||
framerate_numerator_(rate_numerator),
|
||||
unsigned int width, unsigned int height, int rate_numerator,
|
||||
int rate_denominator, unsigned int start, int limit)
|
||||
: file_name_(file_name), input_file_(NULL), 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) {
|
||||
// This initializes format_, raw_size_, width_, height_ and allocates img.
|
||||
SetSize(width, height, format);
|
||||
@ -45,13 +37,11 @@ class YUVVideoSource : public VideoSource {
|
||||
|
||||
virtual ~YUVVideoSource() {
|
||||
vpx_img_free(img_);
|
||||
if (input_file_)
|
||||
fclose(input_file_);
|
||||
if (input_file_) fclose(input_file_);
|
||||
}
|
||||
|
||||
virtual void Begin() {
|
||||
if (input_file_)
|
||||
fclose(input_file_);
|
||||
if (input_file_) fclose(input_file_);
|
||||
input_file_ = OpenTestDataFile(file_name_);
|
||||
ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: "
|
||||
<< file_name_;
|
||||
@ -67,7 +57,7 @@ class YUVVideoSource : public VideoSource {
|
||||
FillFrame();
|
||||
}
|
||||
|
||||
virtual vpx_image_t *img() const { return (frame_ < limit_) ? img_ : NULL; }
|
||||
virtual vpx_image_t *img() const { return (frame_ < limit_) ? img_ : NULL; }
|
||||
|
||||
// Models a stream where Timebase = 1/FPS, so pts == frame.
|
||||
virtual vpx_codec_pts_t pts() const { return frame_; }
|
||||
@ -93,32 +83,15 @@ class YUVVideoSource : public VideoSource {
|
||||
height_ = height;
|
||||
format_ = format;
|
||||
switch (format) {
|
||||
case VPX_IMG_FMT_I420:
|
||||
raw_size_ = width * height * 3 / 2;
|
||||
break;
|
||||
case VPX_IMG_FMT_I422:
|
||||
raw_size_ = width * height * 2;
|
||||
break;
|
||||
case VPX_IMG_FMT_I440:
|
||||
raw_size_ = width * height * 2;
|
||||
break;
|
||||
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);
|
||||
case VPX_IMG_FMT_I420: raw_size_ = width * height * 3 / 2; break;
|
||||
case VPX_IMG_FMT_I422: raw_size_ = width * height * 2; break;
|
||||
case VPX_IMG_FMT_I440: raw_size_ = width * height * 2; break;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user