aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/acm_random.h15
-rw-r--r--test/active_map_refresh_test.cc8
-rw-r--r--test/active_map_test.cc8
-rw-r--r--test/add_noise_test.cc4
-rw-r--r--test/alt_ref_aq_segment_test.cc8
-rw-r--r--test/altref_test.cc22
-rw-r--r--test/aq_segment_test.cc8
-rw-r--r--test/avg_test.cc45
-rw-r--r--test/bench.h2
-rw-r--r--test/blockiness_test.cc4
-rw-r--r--test/borders_test.cc10
-rw-r--r--test/byte_alignment_test.cc4
-rw-r--r--test/codec_factory.h42
-rw-r--r--test/comp_avg_pred_test.cc29
-rw-r--r--test/config_test.cc10
-rw-r--r--test/consistency_test.cc4
-rw-r--r--test/convolve_test.cc36
-rw-r--r--test/cpu_speed_test.cc12
-rw-r--r--test/cq_test.cc14
-rw-r--r--test/dct16x16_test.cc179
-rw-r--r--test/dct32x32_test.cc205
-rw-r--r--test/dct_partial_test.cc2
-rw-r--r--test/dct_test.cc16
-rw-r--r--test/decode_api_test.cc6
-rw-r--r--test/decode_corrupted.cc22
-rw-r--r--test/decode_perf_test.cc18
-rw-r--r--test/decode_svc_test.cc11
-rw-r--r--test/encode_api_test.cc522
-rw-r--r--test/encode_perf_test.cc14
-rw-r--r--test/encode_test_driver.h9
-rw-r--r--test/error_resilience_test.cc30
-rw-r--r--test/external_frame_buffer_test.cc17
-rw-r--r--test/fdct8x8_test.cc69
-rw-r--r--test/frame_size_tests.cc16
-rw-r--r--test/hadamard_test.cc58
-rw-r--r--test/idct_test.cc4
-rw-r--r--test/init_vpx_test.cc96
-rw-r--r--test/init_vpx_test.h18
-rw-r--r--test/invalid_file_test.cc15
-rw-r--r--test/ivf_video_source.h14
-rw-r--r--test/keyframe_test.cc117
-rw-r--r--test/level_test.cc10
-rw-r--r--test/lpf_test.cc12
-rw-r--r--test/minmax_test.cc115
-rw-r--r--test/partial_idct_test.cc8
-rw-r--r--test/pp_filter_test.cc12
-rw-r--r--test/predict_test.cc14
-rw-r--r--test/quantize_test.cc4
-rw-r--r--test/realtime_test.cc4
-rw-r--r--test/register_state_check.h14
-rw-r--r--test/resize_test.cc62
-rw-r--r--test/sad_test.cc709
-rw-r--r--test/set_roi.cc2
-rw-r--r--test/sum_squares_test.cc217
-rw-r--r--test/superframe_test.cc14
-rw-r--r--test/svc_datarate_test.cc58
-rw-r--r--test/svc_end_to_end_test.cc54
-rw-r--r--test/svc_test.h6
-rw-r--r--test/test-data.mk1
-rw-r--r--test/test-data.sha11
-rw-r--r--test/test.mk15
-rw-r--r--test/test_intra_pred_speed.cc85
-rw-r--r--test/test_libvpx.cc61
-rw-r--r--test/test_vector_test.cc11
-rw-r--r--test/tile_independence_test.cc10
-rw-r--r--test/timestamp_test.cc10
-rwxr-xr-xtest/tools_common.sh7
-rw-r--r--test/variance_test.cc111
-rw-r--r--test/video_source.h33
-rw-r--r--test/vp8_datarate_test.cc14
-rw-r--r--test/vp8_denoiser_sse2_test.cc6
-rw-r--r--test/vp8_fdct4x4_test.cc2
-rw-r--r--test/vp8_fragments_test.cc4
-rw-r--r--test/vp8_ratectrl_rtc_test.cc104
-rw-r--r--test/vp9_arf_freq_test.cc12
-rw-r--r--test/vp9_block_error_test.cc24
-rwxr-xr-xtest/vp9_c_vs_simd_encode.sh420
-rw-r--r--test/vp9_datarate_test.cc40
-rw-r--r--test/vp9_denoiser_test.cc6
-rw-r--r--test/vp9_encoder_parms_get_to_decoder.cc14
-rw-r--r--test/vp9_end_to_end_test.cc32
-rw-r--r--test/vp9_ethread_test.cc44
-rw-r--r--test/vp9_ext_ratectrl_test.cc31
-rw-r--r--test/vp9_intrapred_test.cc155
-rw-r--r--test/vp9_lossless_test.cc12
-rw-r--r--test/vp9_motion_vector_test.cc8
-rw-r--r--test/vp9_quantize_test.cc264
-rw-r--r--test/vp9_ratectrl_rtc_test.cc270
-rw-r--r--test/vp9_roi_test.cc8
-rw-r--r--test/vp9_scale_test.cc4
-rw-r--r--test/vp9_subtract_test.cc8
-rw-r--r--test/vp9_thread_test.cc6
-rw-r--r--test/vpx_scale_test.cc8
-rw-r--r--test/webm_video_source.h14
-rw-r--r--test/y4m_test.cc6
-rw-r--r--test/y4m_video_source.h18
-rw-r--r--test/yuv_temporal_filter_test.cc20
-rw-r--r--test/yuv_video_source.h18
98 files changed, 4061 insertions, 914 deletions
diff --git a/test/acm_random.h b/test/acm_random.h
index c7122b933..e3520c47d 100644
--- a/test/acm_random.h
+++ b/test/acm_random.h
@@ -45,16 +45,11 @@ class ACMRandom {
return static_cast<int16_t>(random_.Generate(65536));
}
- int16_t Rand13Signed() {
- // Use 13 bits: values between 4095 and -4096.
- const uint32_t value = random_.Generate(8192);
- return static_cast<int16_t>(value) - 4096;
- }
-
- int16_t Rand9Signed() {
- // Use 9 bits: values between 255 (0x0FF) and -256 (0x100).
- const uint32_t value = random_.Generate(512);
- return static_cast<int16_t>(value) - 256;
+ uint16_t Rand12() {
+ const uint32_t value =
+ random_.Generate(testing::internal::Random::kMaxRange);
+ // There's a bit more entropy in the upper bits of this implementation.
+ return (value >> 19) & 0xfff;
}
uint8_t Rand8() {
diff --git a/test/active_map_refresh_test.cc b/test/active_map_refresh_test.cc
index 68d8856ea..ad067346a 100644
--- a/test/active_map_refresh_test.cc
+++ b/test/active_map_refresh_test.cc
@@ -62,16 +62,16 @@ class ActiveMapRefreshTest
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
protected:
ActiveMapRefreshTest() : EncoderTest(GET_PARAM(0)) {}
- virtual ~ActiveMapRefreshTest() {}
+ ~ActiveMapRefreshTest() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(GET_PARAM(1));
cpu_used_ = GET_PARAM(2);
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
::libvpx_test::Y4mVideoSource *y4m_video =
static_cast<libvpx_test::Y4mVideoSource *>(video);
if (video->frame() == 0) {
diff --git a/test/active_map_test.cc b/test/active_map_test.cc
index 543ec0d35..d222c00b7 100644
--- a/test/active_map_test.cc
+++ b/test/active_map_test.cc
@@ -26,16 +26,16 @@ class ActiveMapTest
static const int kHeight = 144;
ActiveMapTest() : EncoderTest(GET_PARAM(0)) {}
- virtual ~ActiveMapTest() {}
+ ~ActiveMapTest() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(GET_PARAM(1));
cpu_used_ = GET_PARAM(2);
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP8E_SET_CPUUSED, cpu_used_);
encoder->Control(VP9E_SET_AQ_MODE, GET_PARAM(3));
diff --git a/test/add_noise_test.cc b/test/add_noise_test.cc
index 7dc86e3eb..4fc4e81e6 100644
--- a/test/add_noise_test.cc
+++ b/test/add_noise_test.cc
@@ -32,8 +32,8 @@ typedef std::tuple<double, AddNoiseFunc> AddNoiseTestFPParam;
class AddNoiseTest : public ::testing::Test,
public ::testing::WithParamInterface<AddNoiseTestFPParam> {
public:
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
- virtual ~AddNoiseTest() {}
+ void TearDown() override { libvpx_test::ClearSystemState(); }
+ ~AddNoiseTest() override = default;
};
double stddev6(char a, char b, char c, char d, char e, char f) {
diff --git a/test/alt_ref_aq_segment_test.cc b/test/alt_ref_aq_segment_test.cc
index 00a00e27c..3b1a26ed1 100644
--- a/test/alt_ref_aq_segment_test.cc
+++ b/test/alt_ref_aq_segment_test.cc
@@ -20,9 +20,9 @@ class AltRefAqSegmentTest
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
protected:
AltRefAqSegmentTest() : EncoderTest(GET_PARAM(0)) {}
- virtual ~AltRefAqSegmentTest() {}
+ ~AltRefAqSegmentTest() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(GET_PARAM(1));
set_cpu_used_ = GET_PARAM(2);
@@ -30,8 +30,8 @@ class AltRefAqSegmentTest
alt_ref_aq_mode_ = 0;
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
encoder->Control(VP9E_SET_ALT_REF_AQ, alt_ref_aq_mode_);
diff --git a/test/altref_test.cc b/test/altref_test.cc
index 69bcef774..903230fde 100644
--- a/test/altref_test.cc
+++ b/test/altref_test.cc
@@ -24,24 +24,24 @@ class AltRefTest : public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWithParam<int> {
protected:
AltRefTest() : EncoderTest(GET_PARAM(0)), altref_count_(0) {}
- virtual ~AltRefTest() {}
+ ~AltRefTest() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(libvpx_test::kTwoPassGood);
}
- virtual void BeginPassHook(unsigned int /*pass*/) { altref_count_ = 0; }
+ void BeginPassHook(unsigned int /*pass*/) override { altref_count_ = 0; }
- virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
- libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(libvpx_test::VideoSource *video,
+ libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
encoder->Control(VP8E_SET_CPUUSED, 3);
}
}
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
if (pkt->data.frame.flags & VPX_FRAME_IS_INVISIBLE) ++altref_count_;
}
@@ -75,17 +75,17 @@ class AltRefForcedKeyTestLarge
AltRefForcedKeyTestLarge()
: EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)),
cpu_used_(GET_PARAM(2)), forced_kf_frame_num_(1), frame_num_(0) {}
- virtual ~AltRefForcedKeyTestLarge() {}
+ ~AltRefForcedKeyTestLarge() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(encoding_mode_);
cfg_.rc_end_usage = VPX_VBR;
cfg_.g_threads = 0;
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP8E_SET_CPUUSED, cpu_used_);
encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
@@ -100,7 +100,7 @@ class AltRefForcedKeyTestLarge
(video->frame() == forced_kf_frame_num_) ? VPX_EFLAG_FORCE_KF : 0;
}
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
if (frame_num_ == forced_kf_frame_num_) {
ASSERT_TRUE(!!(pkt->data.frame.flags & VPX_FRAME_IS_KEY))
<< "Frame #" << frame_num_ << " isn't a keyframe!";
diff --git a/test/aq_segment_test.cc b/test/aq_segment_test.cc
index 2cbc991d0..955e1dafc 100644
--- a/test/aq_segment_test.cc
+++ b/test/aq_segment_test.cc
@@ -20,17 +20,17 @@ class AqSegmentTest
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
protected:
AqSegmentTest() : EncoderTest(GET_PARAM(0)) {}
- virtual ~AqSegmentTest() {}
+ ~AqSegmentTest() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(GET_PARAM(1));
set_cpu_used_ = GET_PARAM(2);
aq_mode_ = 0;
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
encoder->Control(VP9E_SET_AQ_MODE, aq_mode_);
diff --git a/test/avg_test.cc b/test/avg_test.cc
index 196522ce5..ede9c0ba8 100644
--- a/test/avg_test.cc
+++ b/test/avg_test.cc
@@ -38,7 +38,7 @@ class AverageTestBase : public ::testing::Test {
: width_(width), height_(height), source_data_(nullptr),
source_stride_(0), bit_depth_(8) {}
- virtual void TearDown() {
+ void TearDown() override {
vpx_free(source_data_);
source_data_ = nullptr;
libvpx_test::ClearSystemState();
@@ -49,7 +49,7 @@ class AverageTestBase : public ::testing::Test {
static const int kDataAlignment = 16;
static const int kDataBlockSize = 64 * 128;
- virtual void SetUp() {
+ void SetUp() override {
source_data_ = reinterpret_cast<Pixel *>(
vpx_memalign(kDataAlignment, kDataBlockSize * sizeof(source_data_[0])));
ASSERT_NE(source_data_, nullptr);
@@ -169,7 +169,7 @@ class IntProRowTest : public AverageTestBase<uint8_t>,
}
protected:
- virtual void SetUp() {
+ void SetUp() override {
source_data_ = reinterpret_cast<uint8_t *>(
vpx_memalign(kDataAlignment, kDataBlockSize * sizeof(source_data_[0])));
ASSERT_NE(source_data_, nullptr);
@@ -180,7 +180,7 @@ class IntProRowTest : public AverageTestBase<uint8_t>,
vpx_memalign(kDataAlignment, sizeof(*hbuf_c_) * 16));
}
- virtual void TearDown() {
+ void TearDown() override {
vpx_free(source_data_);
source_data_ = nullptr;
vpx_free(hbuf_c_);
@@ -190,8 +190,9 @@ class IntProRowTest : public AverageTestBase<uint8_t>,
}
void RunComparison() {
- ASM_REGISTER_STATE_CHECK(c_func_(hbuf_c_, source_data_, 0, height_));
- ASM_REGISTER_STATE_CHECK(asm_func_(hbuf_asm_, source_data_, 0, height_));
+ ASM_REGISTER_STATE_CHECK(c_func_(hbuf_c_, source_data_, width_, height_));
+ ASM_REGISTER_STATE_CHECK(
+ asm_func_(hbuf_asm_, source_data_, width_, height_));
EXPECT_EQ(0, memcmp(hbuf_c_, hbuf_asm_, sizeof(*hbuf_c_) * 16))
<< "Output mismatch";
}
@@ -238,7 +239,7 @@ typedef std::tuple<int, SatdFunc> SatdTestParam;
class SatdTest : public ::testing::Test,
public ::testing::WithParamInterface<SatdTestParam> {
protected:
- virtual void SetUp() {
+ void SetUp() override {
satd_size_ = GET_PARAM(0);
satd_func_ = GET_PARAM(1);
rnd_.Reset(ACMRandom::DeterministicSeed());
@@ -247,7 +248,7 @@ class SatdTest : public ::testing::Test,
ASSERT_NE(src_, nullptr);
}
- virtual void TearDown() {
+ void TearDown() override {
libvpx_test::ClearSystemState();
vpx_free(src_);
}
@@ -276,7 +277,7 @@ class SatdTest : public ::testing::Test,
class SatdLowbdTest : public SatdTest {
protected:
- virtual void FillRandom() {
+ void FillRandom() override {
for (int i = 0; i < satd_size_; ++i) {
const int16_t tmp = rnd_.Rand16Signed();
src_[i] = (tran_low_t)tmp;
@@ -292,7 +293,7 @@ class BlockErrorTestFP
: public ::testing::Test,
public ::testing::WithParamInterface<BlockErrorTestFPParam> {
protected:
- virtual void SetUp() {
+ void SetUp() override {
txfm_size_ = GET_PARAM(0);
block_error_func_ = GET_PARAM(1);
rnd_.Reset(ACMRandom::DeterministicSeed());
@@ -304,7 +305,7 @@ class BlockErrorTestFP
ASSERT_NE(dqcoeff_, nullptr);
}
- virtual void TearDown() {
+ void TearDown() override {
libvpx_test::ClearSystemState();
vpx_free(coeff_);
vpx_free(dqcoeff_);
@@ -463,7 +464,7 @@ TEST_P(SatdLowbdTest, DISABLED_Speed) {
#if CONFIG_VP9_HIGHBITDEPTH
class SatdHighbdTest : public SatdTest {
protected:
- virtual void FillRandom() {
+ void FillRandom() override {
for (int i = 0; i < satd_size_; ++i) {
src_[i] = rnd_.Rand20Signed();
}
@@ -582,6 +583,13 @@ INSTANTIATE_TEST_SUITE_P(
make_tuple(16, 16, 1, 4, &vpx_highbd_avg_4x4_sse2)));
#endif // HAVE_SSE2
+#if HAVE_NEON
+INSTANTIATE_TEST_SUITE_P(
+ NEON, AverageTestHBD,
+ ::testing::Values(make_tuple(16, 16, 1, 8, &vpx_highbd_avg_8x8_neon),
+ make_tuple(16, 16, 1, 4, &vpx_highbd_avg_4x4_neon)));
+#endif // HAVE_NEON
+
INSTANTIATE_TEST_SUITE_P(C, SatdHighbdTest,
::testing::Values(make_tuple(16, &vpx_satd_c),
make_tuple(64, &vpx_satd_c),
@@ -694,16 +702,21 @@ INSTANTIATE_TEST_SUITE_P(NEON, SatdLowbdTest,
make_tuple(256, &vpx_satd_neon),
make_tuple(1024, &vpx_satd_neon)));
-// TODO(jianj): Remove the highbitdepth flag once the SIMD functions are
-// in place.
-#if !CONFIG_VP9_HIGHBITDEPTH
+#if CONFIG_VP9_HIGHBITDEPTH
+INSTANTIATE_TEST_SUITE_P(
+ NEON, SatdHighbdTest,
+ ::testing::Values(make_tuple(16, &vpx_highbd_satd_neon),
+ make_tuple(64, &vpx_highbd_satd_neon),
+ make_tuple(256, &vpx_highbd_satd_neon),
+ make_tuple(1024, &vpx_highbd_satd_neon)));
+#endif // CONFIG_VP9_HIGHBITDEPTH
+
INSTANTIATE_TEST_SUITE_P(
NEON, BlockErrorTestFP,
::testing::Values(make_tuple(16, &vp9_block_error_fp_neon),
make_tuple(64, &vp9_block_error_fp_neon),
make_tuple(256, &vp9_block_error_fp_neon),
make_tuple(1024, &vp9_block_error_fp_neon)));
-#endif // !CONFIG_VP9_HIGHBITDEPTH
#endif // HAVE_NEON
#if HAVE_MSA
diff --git a/test/bench.h b/test/bench.h
index 57ca9118b..203e4d247 100644
--- a/test/bench.h
+++ b/test/bench.h
@@ -16,6 +16,8 @@
class AbstractBench {
public:
+ virtual ~AbstractBench() = default;
+
void RunNTimes(int n);
void PrintMedian(const char *title);
diff --git a/test/blockiness_test.cc b/test/blockiness_test.cc
index 11b2a3f61..5a45bc0b7 100644
--- a/test/blockiness_test.cc
+++ b/test/blockiness_test.cc
@@ -49,14 +49,14 @@ class BlockinessTestBase : public ::testing::Test {
reference_data_ = nullptr;
}
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
+ void TearDown() override { libvpx_test::ClearSystemState(); }
protected:
// Handle frames up to 640x480
static const int kDataAlignment = 16;
static const int kDataBufferSize = 640 * 480;
- virtual void SetUp() {
+ void SetUp() override {
source_stride_ = (width_ + 31) & ~31;
reference_stride_ = width_ * 2;
rnd_.Reset(ACMRandom::DeterministicSeed());
diff --git a/test/borders_test.cc b/test/borders_test.cc
index 3c1f69a92..2726bd557 100644
--- a/test/borders_test.cc
+++ b/test/borders_test.cc
@@ -22,15 +22,15 @@ class BordersTest
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
protected:
BordersTest() : EncoderTest(GET_PARAM(0)) {}
- virtual ~BordersTest() {}
+ ~BordersTest() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(GET_PARAM(1));
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP8E_SET_CPUUSED, 1);
encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
@@ -40,7 +40,7 @@ class BordersTest
}
}
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) {
}
}
diff --git a/test/byte_alignment_test.cc b/test/byte_alignment_test.cc
index 1e0ffceb8..ba6fffc52 100644
--- a/test/byte_alignment_test.cc
+++ b/test/byte_alignment_test.cc
@@ -58,7 +58,7 @@ class ByteAlignmentTest
ByteAlignmentTest()
: video_(nullptr), decoder_(nullptr), md5_file_(nullptr) {}
- virtual void SetUp() {
+ void SetUp() override {
video_ = new libvpx_test::WebMVideoSource(kVP9TestFile);
ASSERT_NE(video_, nullptr);
video_->Init();
@@ -71,7 +71,7 @@ class ByteAlignmentTest
OpenMd5File(kVP9Md5File);
}
- virtual void TearDown() {
+ void TearDown() override {
if (md5_file_ != nullptr) fclose(md5_file_);
delete decoder_;
diff --git a/test/codec_factory.h b/test/codec_factory.h
index 96092610c..d00563df1 100644
--- a/test/codec_factory.h
+++ b/test/codec_factory.h
@@ -84,7 +84,7 @@ class VP8Decoder : public Decoder {
: Decoder(cfg, flag) {}
protected:
- virtual vpx_codec_iface_t *CodecInterface() const {
+ vpx_codec_iface_t *CodecInterface() const override {
#if CONFIG_VP8_DECODER
return &vpx_codec_vp8_dx_algo;
#else
@@ -100,7 +100,7 @@ class VP8Encoder : public Encoder {
: Encoder(cfg, deadline, init_flags, stats) {}
protected:
- virtual vpx_codec_iface_t *CodecInterface() const {
+ vpx_codec_iface_t *CodecInterface() const override {
#if CONFIG_VP8_ENCODER
return &vpx_codec_vp8_cx_algo;
#else
@@ -113,12 +113,12 @@ class VP8CodecFactory : public CodecFactory {
public:
VP8CodecFactory() : CodecFactory() {}
- virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg) const {
+ Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg) const override {
return CreateDecoder(cfg, 0);
}
- virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
- const vpx_codec_flags_t flags) const {
+ Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
+ const vpx_codec_flags_t flags) const override {
#if CONFIG_VP8_DECODER
return new VP8Decoder(cfg, flags);
#else
@@ -128,10 +128,9 @@ class VP8CodecFactory : public CodecFactory {
#endif
}
- virtual Encoder *CreateEncoder(vpx_codec_enc_cfg_t cfg,
- unsigned long deadline,
- const unsigned long init_flags,
- TwopassStatsStore *stats) const {
+ Encoder *CreateEncoder(vpx_codec_enc_cfg_t cfg, unsigned long deadline,
+ const unsigned long init_flags,
+ TwopassStatsStore *stats) const override {
#if CONFIG_VP8_ENCODER
return new VP8Encoder(cfg, deadline, init_flags, stats);
#else
@@ -143,8 +142,8 @@ class VP8CodecFactory : public CodecFactory {
#endif
}
- virtual vpx_codec_err_t DefaultEncoderConfig(vpx_codec_enc_cfg_t *cfg,
- int usage) const {
+ vpx_codec_err_t DefaultEncoderConfig(vpx_codec_enc_cfg_t *cfg,
+ int usage) const override {
#if CONFIG_VP8_ENCODER
return vpx_codec_enc_config_default(&vpx_codec_vp8_cx_algo, cfg, usage);
#else
@@ -180,7 +179,7 @@ class VP9Decoder : public Decoder {
: Decoder(cfg, flag) {}
protected:
- virtual vpx_codec_iface_t *CodecInterface() const {
+ vpx_codec_iface_t *CodecInterface() const override {
#if CONFIG_VP9_DECODER
return &vpx_codec_vp9_dx_algo;
#else
@@ -196,7 +195,7 @@ class VP9Encoder : public Encoder {
: Encoder(cfg, deadline, init_flags, stats) {}
protected:
- virtual vpx_codec_iface_t *CodecInterface() const {
+ vpx_codec_iface_t *CodecInterface() const override {
#if CONFIG_VP9_ENCODER
return &vpx_codec_vp9_cx_algo;
#else
@@ -209,12 +208,12 @@ class VP9CodecFactory : public CodecFactory {
public:
VP9CodecFactory() : CodecFactory() {}
- virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg) const {
+ Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg) const override {
return CreateDecoder(cfg, 0);
}
- virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
- const vpx_codec_flags_t flags) const {
+ Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
+ const vpx_codec_flags_t flags) const override {
#if CONFIG_VP9_DECODER
return new VP9Decoder(cfg, flags);
#else
@@ -224,10 +223,9 @@ class VP9CodecFactory : public CodecFactory {
#endif
}
- virtual Encoder *CreateEncoder(vpx_codec_enc_cfg_t cfg,
- unsigned long deadline,
- const unsigned long init_flags,
- TwopassStatsStore *stats) const {
+ Encoder *CreateEncoder(vpx_codec_enc_cfg_t cfg, unsigned long deadline,
+ const unsigned long init_flags,
+ TwopassStatsStore *stats) const override {
#if CONFIG_VP9_ENCODER
return new VP9Encoder(cfg, deadline, init_flags, stats);
#else
@@ -239,8 +237,8 @@ class VP9CodecFactory : public CodecFactory {
#endif
}
- virtual vpx_codec_err_t DefaultEncoderConfig(vpx_codec_enc_cfg_t *cfg,
- int usage) const {
+ vpx_codec_err_t DefaultEncoderConfig(vpx_codec_enc_cfg_t *cfg,
+ int usage) const override {
#if CONFIG_VP9_ENCODER
return vpx_codec_enc_config_default(&vpx_codec_vp9_cx_algo, cfg, usage);
#else
diff --git a/test/comp_avg_pred_test.cc b/test/comp_avg_pred_test.cc
index 70aeab8d7..3234cc9a2 100644
--- a/test/comp_avg_pred_test.cc
+++ b/test/comp_avg_pred_test.cc
@@ -49,7 +49,7 @@ using AvgPredFunc = void (*)(uint8_t *a, const uint8_t *b, int w, int h,
template <int bitdepth, typename Pixel>
class AvgPredTest : public ::testing::TestWithParam<AvgPredFunc> {
public:
- virtual void SetUp() {
+ void SetUp() override {
avg_pred_func_ = GetParam();
rnd_.Reset(ACMRandom::DeterministicSeed());
}
@@ -81,11 +81,11 @@ void AvgPredTest<bitdepth, Pixel>::TestSizeCombinations() {
// Only the reference buffer may have a stride not equal to width.
Buffer<Pixel> ref = Buffer<Pixel>(width, height, ref_padding ? 8 : 0);
ASSERT_TRUE(ref.Init());
- Buffer<Pixel> pred = Buffer<Pixel>(width, height, 0, 16);
+ Buffer<Pixel> pred = Buffer<Pixel>(width, height, 0, 32);
ASSERT_TRUE(pred.Init());
- Buffer<Pixel> avg_ref = Buffer<Pixel>(width, height, 0, 16);
+ Buffer<Pixel> avg_ref = Buffer<Pixel>(width, height, 0, 32);
ASSERT_TRUE(avg_ref.Init());
- Buffer<Pixel> avg_chk = Buffer<Pixel>(width, height, 0, 16);
+ Buffer<Pixel> avg_chk = Buffer<Pixel>(width, height, 0, 32);
ASSERT_TRUE(avg_chk.Init());
const int bitdepth_mask = (1 << bitdepth) - 1;
for (int h = 0; h < height; ++h) {
@@ -121,11 +121,11 @@ void AvgPredTest<bitdepth, Pixel>::TestCompareReferenceRandom() {
const int height = 32;
Buffer<Pixel> ref = Buffer<Pixel>(width, height, 8);
ASSERT_TRUE(ref.Init());
- Buffer<Pixel> pred = Buffer<Pixel>(width, height, 0, 16);
+ Buffer<Pixel> pred = Buffer<Pixel>(width, height, 0, 32);
ASSERT_TRUE(pred.Init());
- Buffer<Pixel> avg_ref = Buffer<Pixel>(width, height, 0, 16);
+ Buffer<Pixel> avg_ref = Buffer<Pixel>(width, height, 0, 32);
ASSERT_TRUE(avg_ref.Init());
- Buffer<Pixel> avg_chk = Buffer<Pixel>(width, height, 0, 16);
+ Buffer<Pixel> avg_chk = Buffer<Pixel>(width, height, 0, 32);
ASSERT_TRUE(avg_chk.Init());
for (int i = 0; i < 500; ++i) {
@@ -167,9 +167,9 @@ void AvgPredTest<bitdepth, Pixel>::TestSpeed() {
const int height = 1 << height_pow;
Buffer<Pixel> ref = Buffer<Pixel>(width, height, ref_padding ? 8 : 0);
ASSERT_TRUE(ref.Init());
- Buffer<Pixel> pred = Buffer<Pixel>(width, height, 0, 16);
+ Buffer<Pixel> pred = Buffer<Pixel>(width, height, 0, 32);
ASSERT_TRUE(pred.Init());
- Buffer<Pixel> avg = Buffer<Pixel>(width, height, 0, 16);
+ Buffer<Pixel> avg = Buffer<Pixel>(width, height, 0, 32);
ASSERT_TRUE(avg.Init());
const int bitdepth_mask = (1 << bitdepth) - 1;
for (int h = 0; h < height; ++h) {
@@ -217,6 +217,11 @@ INSTANTIATE_TEST_SUITE_P(SSE2, AvgPredTestLBD,
::testing::Values(&vpx_comp_avg_pred_sse2));
#endif // HAVE_SSE2
+#if HAVE_AVX2
+INSTANTIATE_TEST_SUITE_P(AVX2, AvgPredTestLBD,
+ ::testing::Values(&vpx_comp_avg_pred_avx2));
+#endif // HAVE_AVX2
+
#if HAVE_NEON
INSTANTIATE_TEST_SUITE_P(NEON, AvgPredTestLBD,
::testing::Values(&vpx_comp_avg_pred_neon));
@@ -260,5 +265,11 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(&highbd_wrapper<vpx_highbd_comp_avg_pred_sse2>));
#endif // HAVE_SSE2
+#if HAVE_NEON
+INSTANTIATE_TEST_SUITE_P(
+ NEON, AvgPredTestHBD,
+ ::testing::Values(&highbd_wrapper<vpx_highbd_comp_avg_pred_neon>));
+#endif // HAVE_NEON
+
#endif // CONFIG_VP9_HIGHBITDEPTH
} // namespace
diff --git a/test/config_test.cc b/test/config_test.cc
index 8f4c60e11..729b01151 100644
--- a/test/config_test.cc
+++ b/test/config_test.cc
@@ -22,24 +22,24 @@ class ConfigTest
ConfigTest()
: EncoderTest(GET_PARAM(0)), frame_count_in_(0), frame_count_out_(0),
frame_count_max_(0) {}
- virtual ~ConfigTest() {}
+ ~ConfigTest() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(GET_PARAM(1));
}
- virtual void BeginPassHook(unsigned int /*pass*/) {
+ void BeginPassHook(unsigned int /*pass*/) override {
frame_count_in_ = 0;
frame_count_out_ = 0;
}
- virtual void PreEncodeFrameHook(libvpx_test::VideoSource * /*video*/) {
+ void PreEncodeFrameHook(libvpx_test::VideoSource * /*video*/) override {
++frame_count_in_;
abort_ |= (frame_count_in_ >= frame_count_max_);
}
- virtual void FramePktHook(const vpx_codec_cx_pkt_t * /*pkt*/) {
+ void FramePktHook(const vpx_codec_cx_pkt_t * /*pkt*/) override {
++frame_count_out_;
}
diff --git a/test/consistency_test.cc b/test/consistency_test.cc
index f0e2cb297..5e872e70a 100644
--- a/test/consistency_test.cc
+++ b/test/consistency_test.cc
@@ -65,14 +65,14 @@ class ConsistencyTestBase : public ::testing::Test {
delete[] ssim_array_;
}
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
+ void TearDown() override { libvpx_test::ClearSystemState(); }
protected:
// Handle frames up to 640x480
static const int kDataAlignment = 16;
static const int kDataBufferSize = 640 * 480;
- virtual void SetUp() {
+ void SetUp() override {
source_stride_ = (width_ + 31) & ~31;
reference_stride_ = width_ * 2;
rnd_.Reset(ACMRandom::DeterministicSeed());
diff --git a/test/convolve_test.cc b/test/convolve_test.cc
index d56904869..ffd5c41c6 100644
--- a/test/convolve_test.cc
+++ b/test/convolve_test.cc
@@ -244,7 +244,7 @@ void highbd_filter_block2d_8_c(const uint16_t *src_ptr,
// Vertical pass (transposed intermediate -> dst).
{
- uint16_t *src_ptr = intermediate_buffer;
+ src_ptr = intermediate_buffer;
const int dst_next_row_stride = dst_stride - output_width;
unsigned int i, j;
for (i = 0; i < output_height; ++i) {
@@ -361,7 +361,7 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
#endif
}
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
+ void TearDown() override { libvpx_test::ClearSystemState(); }
static void TearDownTestSuite() {
vpx_free(input_ - 1);
@@ -403,7 +403,7 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
i % kOuterBlockSize >= (BorderLeft() + Width()));
}
- virtual void SetUp() {
+ void SetUp() override {
UUT_ = GET_PARAM(2);
#if CONFIG_VP9_HIGHBITDEPTH
if (UUT_->use_highbd_ != 0) {
@@ -1423,6 +1423,36 @@ INSTANTIATE_TEST_SUITE_P(NEON, ConvolveTest,
::testing::ValuesIn(kArrayConvolve_neon));
#endif // HAVE_NEON
+#if HAVE_NEON_DOTPROD
+const ConvolveFunctions convolve8_neon_dotprod(
+ vpx_convolve_copy_c, vpx_convolve_avg_c, vpx_convolve8_horiz_neon_dotprod,
+ vpx_convolve8_avg_horiz_neon_dotprod, vpx_convolve8_vert_neon_dotprod,
+ vpx_convolve8_avg_vert_neon_dotprod, vpx_convolve8_neon_dotprod,
+ vpx_convolve8_avg_neon_dotprod, 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_neon_dotprod[] = { ALL_SIZES(
+ convolve8_neon_dotprod) };
+INSTANTIATE_TEST_SUITE_P(NEON_DOTPROD, ConvolveTest,
+ ::testing::ValuesIn(kArrayConvolve_neon_dotprod));
+#endif // HAVE_NEON_DOTPROD
+
+#if HAVE_NEON_I8MM
+const ConvolveFunctions convolve8_neon_i8mm(
+ vpx_convolve_copy_c, vpx_convolve_avg_c, vpx_convolve8_horiz_neon_i8mm,
+ vpx_convolve8_avg_horiz_neon_i8mm, vpx_convolve8_vert_neon_i8mm,
+ vpx_convolve8_avg_vert_neon_i8mm, vpx_convolve8_neon_i8mm,
+ vpx_convolve8_avg_neon_i8mm, 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_neon_i8mm[] = { ALL_SIZES(
+ convolve8_neon_i8mm) };
+INSTANTIATE_TEST_SUITE_P(NEON_I8MM, ConvolveTest,
+ ::testing::ValuesIn(kArrayConvolve_neon_i8mm));
+#endif // HAVE_NEON_I8MM
+
#if HAVE_DSPR2
const ConvolveFunctions convolve8_dspr2(
vpx_convolve_copy_dspr2, vpx_convolve_avg_dspr2, vpx_convolve8_horiz_dspr2,
diff --git a/test/cpu_speed_test.cc b/test/cpu_speed_test.cc
index a7623f09a..22f455296 100644
--- a/test/cpu_speed_test.cc
+++ b/test/cpu_speed_test.cc
@@ -26,9 +26,9 @@ class CpuSpeedTest
: 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() {}
+ ~CpuSpeedTest() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(encoding_mode_);
if (encoding_mode_ != ::libvpx_test::kRealTime) {
@@ -40,10 +40,10 @@ class CpuSpeedTest
}
}
- virtual void BeginPassHook(unsigned int /*pass*/) { min_psnr_ = kMaxPSNR; }
+ void BeginPassHook(unsigned int /*pass*/) override { min_psnr_ = kMaxPSNR; }
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
encoder->Control(VP9E_SET_TUNE_CONTENT, tune_content_);
@@ -56,7 +56,7 @@ class CpuSpeedTest
}
}
- virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) override {
if (pkt->data.psnr.psnr[0] < min_psnr_) min_psnr_ = pkt->data.psnr.psnr[0];
}
diff --git a/test/cq_test.cc b/test/cq_test.cc
index 292adb0d0..b74915a33 100644
--- a/test/cq_test.cc
+++ b/test/cq_test.cc
@@ -50,21 +50,21 @@ class CQTest : public ::libvpx_test::EncoderTest,
init_flags_ = VPX_CODEC_USE_PSNR;
}
- virtual ~CQTest() {}
+ ~CQTest() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(libvpx_test::kTwoPassGood);
}
- virtual void BeginPassHook(unsigned int /*pass*/) {
+ void BeginPassHook(unsigned int /*pass*/) override {
file_size_ = 0;
psnr_ = 0.0;
n_frames_ = 0;
}
- virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
- libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(libvpx_test::VideoSource *video,
+ libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
if (cfg_.rc_end_usage == VPX_CQ) {
encoder->Control(VP8E_SET_CQ_LEVEL, cq_level_);
@@ -73,12 +73,12 @@ class CQTest : public ::libvpx_test::EncoderTest,
}
}
- virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) override {
psnr_ += pow(10.0, pkt->data.psnr.psnr[0] / 10.0);
n_frames_++;
}
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
file_size_ += pkt->data.frame.sz;
}
diff --git a/test/dct16x16_test.cc b/test/dct16x16_test.cc
index d4ef7ae13..8c4213ee1 100644
--- a/test/dct16x16_test.cc
+++ b/test/dct16x16_test.cc
@@ -27,6 +27,7 @@
#include "vpx/vpx_integer.h"
#include "vpx_ports/mem.h"
#include "vpx_ports/msvc.h" // for round()
+#include "vpx_ports/vpx_timer.h"
using libvpx_test::ACMRandom;
@@ -309,7 +310,7 @@ void idct16x16_10_add_12_sse2(const tran_low_t *in, uint8_t *out, int stride) {
class Trans16x16TestBase {
public:
- virtual ~Trans16x16TestBase() {}
+ virtual ~Trans16x16TestBase() = default;
protected:
virtual void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) = 0;
@@ -548,12 +549,50 @@ class Trans16x16TestBase {
}
}
+ void RunSpeedTest() {
+ ACMRandom rnd(ACMRandom::DeterministicSeed());
+ const int count_test_block = 10000;
+ int c_sum_time = 0;
+ int simd_sum_time = 0;
+
+ DECLARE_ALIGNED(32, int16_t, input_block[kNumCoeffs]);
+ DECLARE_ALIGNED(32, tran_low_t, output_ref_block[kNumCoeffs]);
+ DECLARE_ALIGNED(32, tran_low_t, output_block[kNumCoeffs]);
+
+ // Initialize a test block with input range [-mask_, mask_].
+ for (int j = 0; j < kNumCoeffs; ++j) {
+ input_block[j] = (rnd.Rand16() & mask_) - (rnd.Rand16() & mask_);
+ }
+
+ vpx_usec_timer timer_c;
+ vpx_usec_timer_start(&timer_c);
+ for (int i = 0; i < count_test_block; ++i) {
+ vpx_fdct16x16_c(input_block, output_ref_block, pitch_);
+ }
+ vpx_usec_timer_mark(&timer_c);
+ c_sum_time += static_cast<int>(vpx_usec_timer_elapsed(&timer_c));
+
+ vpx_usec_timer timer_mod;
+ vpx_usec_timer_start(&timer_mod);
+ for (int i = 0; i < count_test_block; ++i) {
+ RunFwdTxfm(input_block, output_block, pitch_);
+ }
+
+ vpx_usec_timer_mark(&timer_mod);
+ simd_sum_time += static_cast<int>(vpx_usec_timer_elapsed(&timer_mod));
+
+ printf(
+ "c_time = %d \t simd_time = %d \t Gain = %4.2f \n", c_sum_time,
+ simd_sum_time,
+ (static_cast<float>(c_sum_time) / static_cast<float>(simd_sum_time)));
+ }
+
void CompareInvReference(IdctFunc ref_txfm, int thresh) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
const int count_test_block = 10000;
const int eob = 10;
const int16_t *scan = vp9_default_scan_orders[TX_16X16].scan;
- DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]);
+ DECLARE_ALIGNED(32, tran_low_t, coeff[kNumCoeffs]);
DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
DECLARE_ALIGNED(16, uint8_t, ref[kNumCoeffs]);
#if CONFIG_VP9_HIGHBITDEPTH
@@ -604,6 +643,80 @@ class Trans16x16TestBase {
}
}
+ void RunInvTrans16x16SpeedTest(IdctFunc ref_txfm, int thresh) {
+ ACMRandom rnd(ACMRandom::DeterministicSeed());
+ const int count_test_block = 10000;
+ const int eob = 10;
+ const int16_t *scan = vp9_default_scan_orders[TX_16X16].scan;
+ int64_t c_sum_time = 0;
+ int64_t simd_sum_time = 0;
+ DECLARE_ALIGNED(32, tran_low_t, coeff[kNumCoeffs]);
+ DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
+ DECLARE_ALIGNED(16, uint8_t, ref[kNumCoeffs]);
+#if CONFIG_VP9_HIGHBITDEPTH
+ DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
+ DECLARE_ALIGNED(16, uint16_t, ref16[kNumCoeffs]);
+#endif // CONFIG_VP9_HIGHBITDEPTH
+
+ 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);
+ } else {
+ coeff[scan[j]] = 0;
+ }
+ if (bit_depth_ == VPX_BITS_8) {
+ dst[j] = 0;
+ ref[j] = 0;
+#if CONFIG_VP9_HIGHBITDEPTH
+ } else {
+ dst16[j] = 0;
+ ref16[j] = 0;
+#endif // CONFIG_VP9_HIGHBITDEPTH
+ }
+ }
+
+ if (bit_depth_ == VPX_BITS_8) {
+ vpx_usec_timer timer_c;
+ vpx_usec_timer_start(&timer_c);
+ for (int i = 0; i < count_test_block; ++i) {
+ ref_txfm(coeff, ref, pitch_);
+ }
+ vpx_usec_timer_mark(&timer_c);
+ c_sum_time += vpx_usec_timer_elapsed(&timer_c);
+
+ vpx_usec_timer timer_mod;
+ vpx_usec_timer_start(&timer_mod);
+ for (int i = 0; i < count_test_block; ++i) {
+ RunInvTxfm(coeff, dst, pitch_);
+ }
+ vpx_usec_timer_mark(&timer_mod);
+ simd_sum_time += vpx_usec_timer_elapsed(&timer_mod);
+ } else {
+#if CONFIG_VP9_HIGHBITDEPTH
+ vpx_usec_timer timer_c;
+ vpx_usec_timer_start(&timer_c);
+ for (int i = 0; i < count_test_block; ++i) {
+ ref_txfm(coeff, CAST_TO_BYTEPTR(ref16), pitch_);
+ }
+ vpx_usec_timer_mark(&timer_c);
+ c_sum_time += vpx_usec_timer_elapsed(&timer_c);
+
+ vpx_usec_timer timer_mod;
+ vpx_usec_timer_start(&timer_mod);
+ for (int i = 0; i < count_test_block; ++i) {
+ RunInvTxfm(coeff, CAST_TO_BYTEPTR(dst16), pitch_);
+ }
+ vpx_usec_timer_mark(&timer_mod);
+ simd_sum_time += vpx_usec_timer_elapsed(&timer_mod);
+#endif // CONFIG_VP9_HIGHBITDEPTH
+ }
+ printf(
+ "c_time = %" PRId64 " \t simd_time = %" PRId64 " \t Gain = %4.2f \n",
+ c_sum_time, simd_sum_time,
+ (static_cast<float>(c_sum_time) / static_cast<float>(simd_sum_time)));
+ }
+
int pitch_;
int tx_type_;
vpx_bit_depth_t bit_depth_;
@@ -615,9 +728,9 @@ class Trans16x16TestBase {
class Trans16x16DCT : public Trans16x16TestBase,
public ::testing::TestWithParam<Dct16x16Param> {
public:
- virtual ~Trans16x16DCT() {}
+ ~Trans16x16DCT() override = default;
- virtual void SetUp() {
+ void SetUp() override {
fwd_txfm_ = GET_PARAM(0);
inv_txfm_ = GET_PARAM(1);
tx_type_ = GET_PARAM(2);
@@ -636,13 +749,13 @@ class Trans16x16DCT : public Trans16x16TestBase,
inv_txfm_ref = idct16x16_ref;
#endif
}
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
+ void TearDown() override { libvpx_test::ClearSystemState(); }
protected:
- void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {
+ void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) override {
fwd_txfm_(in, out, stride);
}
- void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
+ void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) override {
inv_txfm_(out, dst, stride);
}
@@ -664,12 +777,14 @@ TEST_P(Trans16x16DCT, QuantCheck) {
TEST_P(Trans16x16DCT, InvAccuracyCheck) { RunInvAccuracyCheck(); }
+TEST_P(Trans16x16DCT, DISABLED_Speed) { RunSpeedTest(); }
+
class Trans16x16HT : public Trans16x16TestBase,
public ::testing::TestWithParam<Ht16x16Param> {
public:
- virtual ~Trans16x16HT() {}
+ ~Trans16x16HT() override = default;
- virtual void SetUp() {
+ void SetUp() override {
fwd_txfm_ = GET_PARAM(0);
inv_txfm_ = GET_PARAM(1);
tx_type_ = GET_PARAM(2);
@@ -688,13 +803,13 @@ class Trans16x16HT : public Trans16x16TestBase,
inv_txfm_ref = iht16x16_ref;
#endif
}
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
+ void TearDown() override { libvpx_test::ClearSystemState(); }
protected:
- void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {
+ void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) override {
fwd_txfm_(in, out, stride, tx_type_);
}
- void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
+ void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) override {
inv_txfm_(out, dst, stride, tx_type_);
}
@@ -714,13 +829,12 @@ TEST_P(Trans16x16HT, QuantCheck) {
RunQuantCheck(429, 729);
}
-#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
class InvTrans16x16DCT : public Trans16x16TestBase,
public ::testing::TestWithParam<Idct16x16Param> {
public:
- virtual ~InvTrans16x16DCT() {}
+ ~InvTrans16x16DCT() override = default;
- virtual void SetUp() {
+ void SetUp() override {
ref_txfm_ = GET_PARAM(0);
inv_txfm_ = GET_PARAM(1);
thresh_ = GET_PARAM(2);
@@ -728,11 +842,12 @@ class InvTrans16x16DCT : public Trans16x16TestBase,
pitch_ = 16;
mask_ = (1 << bit_depth_) - 1;
}
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
+ void TearDown() override { libvpx_test::ClearSystemState(); }
protected:
- void RunFwdTxfm(int16_t * /*in*/, tran_low_t * /*out*/, int /*stride*/) {}
- void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
+ void RunFwdTxfm(int16_t * /*in*/, tran_low_t * /*out*/,
+ int /*stride*/) override {}
+ void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) override {
inv_txfm_(out, dst, stride);
}
@@ -745,7 +860,10 @@ GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(InvTrans16x16DCT);
TEST_P(InvTrans16x16DCT, CompareReference) {
CompareInvReference(ref_txfm_, thresh_);
}
-#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
+
+TEST_P(InvTrans16x16DCT, DISABLED_Speed) {
+ RunInvTrans16x16SpeedTest(ref_txfm_, thresh_);
+}
using std::make_tuple;
@@ -787,6 +905,12 @@ INSTANTIATE_TEST_SUITE_P(
make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 1, VPX_BITS_8),
make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 2, VPX_BITS_8),
make_tuple(&vp9_fht16x16_c, &vp9_iht16x16_256_add_c, 3, VPX_BITS_8)));
+
+INSTANTIATE_TEST_SUITE_P(C, InvTrans16x16DCT,
+ ::testing::Values(make_tuple(&vpx_idct16x16_256_add_c,
+ &vpx_idct16x16_256_add_c,
+ 6225, VPX_BITS_8)));
+
#endif // CONFIG_VP9_HIGHBITDEPTH
#if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
@@ -821,8 +945,25 @@ INSTANTIATE_TEST_SUITE_P(
2, VPX_BITS_8),
make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2,
3, VPX_BITS_8)));
+
+INSTANTIATE_TEST_SUITE_P(SSE2, InvTrans16x16DCT,
+ ::testing::Values(make_tuple(
+ &vpx_idct16x16_256_add_c,
+ &vpx_idct16x16_256_add_sse2, 6225, VPX_BITS_8)));
#endif // HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
+#if HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
+INSTANTIATE_TEST_SUITE_P(
+ AVX2, Trans16x16DCT,
+ ::testing::Values(make_tuple(&vpx_fdct16x16_avx2,
+ &vpx_idct16x16_256_add_sse2, 0, VPX_BITS_8)));
+
+INSTANTIATE_TEST_SUITE_P(AVX2, InvTrans16x16DCT,
+ ::testing::Values(make_tuple(
+ &vpx_idct16x16_256_add_c,
+ &vpx_idct16x16_256_add_avx2, 6225, VPX_BITS_8)));
+#endif // HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
+
#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
INSTANTIATE_TEST_SUITE_P(
SSE2, Trans16x16DCT,
diff --git a/test/dct32x32_test.cc b/test/dct32x32_test.cc
index 91bb8e01e..6233b17a4 100644
--- a/test/dct32x32_test.cc
+++ b/test/dct32x32_test.cc
@@ -24,10 +24,12 @@
#include "test/register_state_check.h"
#include "test/util.h"
#include "vp9/common/vp9_entropy.h"
+#include "vp9/common/vp9_scan.h"
#include "vpx/vpx_codec.h"
#include "vpx/vpx_integer.h"
#include "vpx_ports/mem.h"
#include "vpx_ports/msvc.h" // for round()
+#include "vpx_ports/vpx_timer.h"
using libvpx_test::ACMRandom;
@@ -71,6 +73,9 @@ typedef void (*InvTxfmFunc)(const tran_low_t *in, uint8_t *out, int stride);
typedef std::tuple<FwdTxfmFunc, InvTxfmFunc, int, vpx_bit_depth_t>
Trans32x32Param;
+typedef std::tuple<InvTxfmFunc, InvTxfmFunc, int, vpx_bit_depth_t, int, int>
+ InvTrans32x32Param;
+
#if CONFIG_VP9_HIGHBITDEPTH
void idct32x32_10(const tran_low_t *in, uint8_t *out, int stride) {
vpx_highbd_idct32x32_1024_add_c(in, CAST_TO_SHORTPTR(out), stride, 10);
@@ -84,8 +89,8 @@ void idct32x32_12(const tran_low_t *in, uint8_t *out, int stride) {
class Trans32x32Test : public AbstractBench,
public ::testing::TestWithParam<Trans32x32Param> {
public:
- virtual ~Trans32x32Test() {}
- virtual void SetUp() {
+ ~Trans32x32Test() override = default;
+ void SetUp() override {
fwd_txfm_ = GET_PARAM(0);
inv_txfm_ = GET_PARAM(1);
version_ = GET_PARAM(2); // 0: high precision forward transform
@@ -94,7 +99,7 @@ class Trans32x32Test : public AbstractBench,
mask_ = (1 << bit_depth_) - 1;
}
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
+ void TearDown() override { libvpx_test::ClearSystemState(); }
protected:
int version_;
@@ -105,7 +110,7 @@ class Trans32x32Test : public AbstractBench,
int16_t *bench_in_;
tran_low_t *bench_out_;
- virtual void Run();
+ void Run() override;
};
void Trans32x32Test::Run() { fwd_txfm_(bench_in_, bench_out_, 32); }
@@ -314,6 +319,174 @@ TEST_P(Trans32x32Test, InverseAccuracy) {
}
}
+class InvTrans32x32Test : public ::testing::TestWithParam<InvTrans32x32Param> {
+ public:
+ ~InvTrans32x32Test() override = default;
+ void SetUp() override {
+ ref_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
+ bit_depth_ = GET_PARAM(3);
+ eob_ = GET_PARAM(4);
+ thresh_ = GET_PARAM(4);
+ mask_ = (1 << bit_depth_) - 1;
+ pitch_ = 32;
+ }
+
+ void TearDown() override { libvpx_test::ClearSystemState(); }
+
+ protected:
+ void RunRefTxfm(tran_low_t *out, uint8_t *dst, int stride) {
+ ref_txfm_(out, dst, stride);
+ }
+ void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
+ inv_txfm_(out, dst, stride);
+ }
+ int version_;
+ vpx_bit_depth_t bit_depth_;
+ int mask_;
+ int eob_;
+ int thresh_;
+
+ InvTxfmFunc ref_txfm_;
+ InvTxfmFunc inv_txfm_;
+ int pitch_;
+
+ void RunInvTrans32x32SpeedTest() {
+ ACMRandom rnd(ACMRandom::DeterministicSeed());
+ const int count_test_block = 10000;
+ int64_t c_sum_time = 0;
+ int64_t simd_sum_time = 0;
+ const int16_t *scan = vp9_default_scan_orders[TX_32X32].scan;
+ DECLARE_ALIGNED(32, tran_low_t, coeff[kNumCoeffs]);
+ DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
+ DECLARE_ALIGNED(16, uint8_t, ref[kNumCoeffs]);
+#if CONFIG_VP9_HIGHBITDEPTH
+ DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
+ DECLARE_ALIGNED(16, uint16_t, ref16[kNumCoeffs]);
+#endif // CONFIG_VP9_HIGHBITDEPTH
+
+ 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_);
+ } else {
+ coeff[scan[j]] = 0;
+ }
+ if (bit_depth_ == VPX_BITS_8) {
+ dst[j] = 0;
+ ref[j] = 0;
+#if CONFIG_VP9_HIGHBITDEPTH
+ } else {
+ dst16[j] = 0;
+ ref16[j] = 0;
+#endif // CONFIG_VP9_HIGHBITDEPTH
+ }
+ }
+
+ if (bit_depth_ == VPX_BITS_8) {
+ vpx_usec_timer timer_c;
+ vpx_usec_timer_start(&timer_c);
+ for (int i = 0; i < count_test_block; ++i) {
+ RunRefTxfm(coeff, ref, pitch_);
+ }
+ vpx_usec_timer_mark(&timer_c);
+ c_sum_time += vpx_usec_timer_elapsed(&timer_c);
+
+ vpx_usec_timer timer_mod;
+ vpx_usec_timer_start(&timer_mod);
+ for (int i = 0; i < count_test_block; ++i) {
+ RunInvTxfm(coeff, dst, pitch_);
+ }
+ vpx_usec_timer_mark(&timer_mod);
+ simd_sum_time += vpx_usec_timer_elapsed(&timer_mod);
+ } else {
+#if CONFIG_VP9_HIGHBITDEPTH
+ vpx_usec_timer timer_c;
+ vpx_usec_timer_start(&timer_c);
+ for (int i = 0; i < count_test_block; ++i) {
+ RunRefTxfm(coeff, CAST_TO_BYTEPTR(ref16), pitch_);
+ }
+ vpx_usec_timer_mark(&timer_c);
+ c_sum_time += vpx_usec_timer_elapsed(&timer_c);
+
+ vpx_usec_timer timer_mod;
+ vpx_usec_timer_start(&timer_mod);
+ for (int i = 0; i < count_test_block; ++i) {
+ RunInvTxfm(coeff, CAST_TO_BYTEPTR(dst16), pitch_);
+ }
+ vpx_usec_timer_mark(&timer_mod);
+ simd_sum_time += vpx_usec_timer_elapsed(&timer_mod);
+#endif // CONFIG_VP9_HIGHBITDEPTH
+ }
+ printf(
+ "c_time = %" PRId64 " \t simd_time = %" PRId64 " \t Gain = %4.2f \n",
+ c_sum_time, simd_sum_time,
+ (static_cast<float>(c_sum_time) / static_cast<float>(simd_sum_time)));
+ }
+
+ void CompareInvReference32x32() {
+ ACMRandom rnd(ACMRandom::DeterministicSeed());
+ const int count_test_block = 10000;
+ const int eob = 31;
+ const int16_t *scan = vp9_default_scan_orders[TX_32X32].scan;
+ DECLARE_ALIGNED(32, tran_low_t, coeff[kNumCoeffs]);
+ DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
+ DECLARE_ALIGNED(16, uint8_t, ref[kNumCoeffs]);
+#if CONFIG_VP9_HIGHBITDEPTH
+ DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
+ DECLARE_ALIGNED(16, uint16_t, ref16[kNumCoeffs]);
+#endif // CONFIG_VP9_HIGHBITDEPTH
+
+ for (int i = 0; i < count_test_block; ++i) {
+ for (int j = 0; j < kNumCoeffs; ++j) {
+ if (j < eob) {
+ coeff[scan[j]] = rnd.Rand8Extremes();
+ } else {
+ coeff[scan[j]] = 0;
+ }
+ if (bit_depth_ == VPX_BITS_8) {
+ dst[j] = 0;
+ ref[j] = 0;
+#if CONFIG_VP9_HIGHBITDEPTH
+ } else {
+ dst16[j] = 0;
+ ref16[j] = 0;
+#endif // CONFIG_VP9_HIGHBITDEPTH
+ }
+ }
+ if (bit_depth_ == VPX_BITS_8) {
+ RunRefTxfm(coeff, ref, pitch_);
+ RunInvTxfm(coeff, dst, pitch_);
+ } else {
+#if CONFIG_VP9_HIGHBITDEPTH
+ RunRefTxfm(coeff, CAST_TO_BYTEPTR(ref16), pitch_);
+ ASM_REGISTER_STATE_CHECK(
+ RunInvTxfm(coeff, CAST_TO_BYTEPTR(dst16), pitch_));
+#endif // CONFIG_VP9_HIGHBITDEPTH
+ }
+
+ for (int j = 0; j < kNumCoeffs; ++j) {
+#if CONFIG_VP9_HIGHBITDEPTH
+ const uint32_t diff =
+ bit_depth_ == VPX_BITS_8 ? dst[j] - ref[j] : dst16[j] - ref16[j];
+#else
+ const uint32_t diff = dst[j] - ref[j];
+#endif // CONFIG_VP9_HIGHBITDEPTH
+ const uint32_t error = diff * diff;
+ EXPECT_EQ(0u, error) << "Error: 32x32 IDCT Comparison has error "
+ << error << " at index " << j;
+ }
+ }
+ }
+};
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(InvTrans32x32Test);
+
+TEST_P(InvTrans32x32Test, DISABLED_Speed) { RunInvTrans32x32SpeedTest(); }
+TEST_P(InvTrans32x32Test, CompareReference) { CompareInvReference32x32(); }
+
using std::make_tuple;
#if CONFIG_VP9_HIGHBITDEPTH
@@ -334,6 +507,14 @@ INSTANTIATE_TEST_SUITE_P(
VPX_BITS_8),
make_tuple(&vpx_fdct32x32_rd_c, &vpx_idct32x32_1024_add_c,
1, VPX_BITS_8)));
+
+INSTANTIATE_TEST_SUITE_P(
+ C, InvTrans32x32Test,
+ ::testing::Values(
+ (make_tuple(&vpx_idct32x32_1024_add_c, &vpx_idct32x32_1024_add_c, 0,
+ VPX_BITS_8, 32, 6225)),
+ make_tuple(&vpx_idct32x32_135_add_c, &vpx_idct32x32_135_add_c, 0,
+ VPX_BITS_8, 16, 6255)));
#endif // CONFIG_VP9_HIGHBITDEPTH
#if HAVE_NEON && !CONFIG_EMULATE_HARDWARE
@@ -352,6 +533,14 @@ INSTANTIATE_TEST_SUITE_P(
&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_SUITE_P(
+ SSE2, InvTrans32x32Test,
+ ::testing::Values(
+ (make_tuple(&vpx_idct32x32_1024_add_c, &vpx_idct32x32_1024_add_sse2, 0,
+ VPX_BITS_8, 32, 6225)),
+ make_tuple(&vpx_idct32x32_135_add_c, &vpx_idct32x32_135_add_sse2, 0,
+ VPX_BITS_8, 16, 6225)));
#endif // HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
@@ -377,6 +566,14 @@ INSTANTIATE_TEST_SUITE_P(
&vpx_idct32x32_1024_add_sse2, 0, VPX_BITS_8),
make_tuple(&vpx_fdct32x32_rd_avx2,
&vpx_idct32x32_1024_add_sse2, 1, VPX_BITS_8)));
+
+INSTANTIATE_TEST_SUITE_P(
+ AVX2, InvTrans32x32Test,
+ ::testing::Values(
+ (make_tuple(&vpx_idct32x32_1024_add_c, &vpx_idct32x32_1024_add_avx2, 0,
+ VPX_BITS_8, 32, 6225)),
+ make_tuple(&vpx_idct32x32_135_add_c, &vpx_idct32x32_135_add_avx2, 0,
+ VPX_BITS_8, 16, 6225)));
#endif // HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
diff --git a/test/dct_partial_test.cc b/test/dct_partial_test.cc
index e57fa0f48..ec6f543f7 100644
--- a/test/dct_partial_test.cc
+++ b/test/dct_partial_test.cc
@@ -67,7 +67,7 @@ class PartialFdctTest : public ::testing::TestWithParam<PartialFdctParam> {
bit_depth_ = GET_PARAM(2);
}
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
+ void TearDown() override { libvpx_test::ClearSystemState(); }
protected:
void RunTest() {
diff --git a/test/dct_test.cc b/test/dct_test.cc
index 0304029bd..c3d3081c4 100644
--- a/test/dct_test.cc
+++ b/test/dct_test.cc
@@ -134,7 +134,7 @@ void fwht_ref(const Buffer<int16_t> &in, Buffer<tran_low_t> *out, int size,
class TransTestBase : public ::testing::TestWithParam<DctParam> {
public:
- virtual void SetUp() {
+ void SetUp() override {
rnd_.Reset(ACMRandom::DeterministicSeed());
const int idx = GET_PARAM(0);
const FuncInfo *func_info = &(GET_PARAM(1)[idx]);
@@ -166,7 +166,7 @@ class TransTestBase : public ::testing::TestWithParam<DctParam> {
ASSERT_NE(dst_, nullptr);
}
- virtual void TearDown() {
+ void TearDown() override {
vpx_free(src_);
src_ = nullptr;
vpx_free(dst_);
@@ -358,14 +358,6 @@ class TransTestBase : public ::testing::TestWithParam<DctParam> {
ASSERT_TRUE(in.Init());
Buffer<tran_low_t> coeff = Buffer<tran_low_t>(size_, size_, 0, 16);
ASSERT_TRUE(coeff.Init());
- Buffer<uint8_t> dst = Buffer<uint8_t>(size_, size_, 0, 16);
- ASSERT_TRUE(dst.Init());
- Buffer<uint8_t> src = Buffer<uint8_t>(size_, size_, 0);
- ASSERT_TRUE(src.Init());
- Buffer<uint16_t> dst16 = Buffer<uint16_t>(size_, size_, 0, 16);
- ASSERT_TRUE(dst16.Init());
- Buffer<uint16_t> src16 = Buffer<uint16_t>(size_, size_, 0);
- ASSERT_TRUE(src16.Init());
for (int i = 0; i < count_test_block; ++i) {
InitMem();
@@ -671,8 +663,12 @@ static const FuncInfo ht_neon_func_info[] = {
4, 2 },
{ &vp9_highbd_fht8x8_c, &highbd_iht_wrapper<vp9_highbd_iht8x8_64_add_neon>, 8,
2 },
+ { &vp9_highbd_fht8x8_neon, &highbd_iht_wrapper<vp9_highbd_iht8x8_64_add_neon>,
+ 8, 2 },
{ &vp9_highbd_fht16x16_c,
&highbd_iht_wrapper<vp9_highbd_iht16x16_256_add_neon>, 16, 2 },
+ { &vp9_highbd_fht16x16_neon,
+ &highbd_iht_wrapper<vp9_highbd_iht16x16_256_add_neon>, 16, 2 },
#endif
{ &vp9_fht4x4_c, &iht_wrapper<vp9_iht4x4_16_add_neon>, 4, 1 },
{ &vp9_fht4x4_neon, &iht_wrapper<vp9_iht4x4_16_add_neon>, 4, 1 },
diff --git a/test/decode_api_test.cc b/test/decode_api_test.cc
index 9e82ace1b..44e439772 100644
--- a/test/decode_api_test.cc
+++ b/test/decode_api_test.cc
@@ -20,7 +20,7 @@ namespace {
#define NELEMENTS(x) static_cast<int>(sizeof(x) / sizeof(x[0]))
TEST(DecodeAPI, InvalidParams) {
- static const vpx_codec_iface_t *kCodecs[] = {
+ static vpx_codec_iface_t *kCodecs[] = {
#if CONFIG_VP8_DECODER
&vpx_codec_vp8_dx_algo,
#endif
@@ -120,7 +120,7 @@ void TestVp9Controls(vpx_codec_ctx_t *dec) {
}
TEST(DecodeAPI, Vp9InvalidDecode) {
- const vpx_codec_iface_t *const codec = &vpx_codec_vp9_dx_algo;
+ vpx_codec_iface_t *const codec = &vpx_codec_vp9_dx_algo;
const char filename[] =
"invalid-vp90-2-00-quantizer-00.webm.ivf.s5861_r01-05_b6-.v2.ivf";
libvpx_test::IVFVideoSource video(filename);
@@ -147,7 +147,7 @@ TEST(DecodeAPI, Vp9InvalidDecode) {
void TestPeekInfo(const uint8_t *const data, uint32_t data_sz,
uint32_t peek_size) {
- const vpx_codec_iface_t *const codec = &vpx_codec_vp9_dx_algo;
+ vpx_codec_iface_t *const codec = &vpx_codec_vp9_dx_algo;
// Verify behavior of vpx_codec_decode. vpx_codec_decode doesn't even get
// to decoder_peek_si_internal on frames of size < 8.
if (data_sz >= 8) {
diff --git a/test/decode_corrupted.cc b/test/decode_corrupted.cc
index 31e1da69c..58773d7b8 100644
--- a/test/decode_corrupted.cc
+++ b/test/decode_corrupted.cc
@@ -28,9 +28,9 @@ class DecodeCorruptedFrameTest
DecodeCorruptedFrameTest() : EncoderTest(GET_PARAM(0)) {}
protected:
- virtual ~DecodeCorruptedFrameTest() {}
+ ~DecodeCorruptedFrameTest() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(::libvpx_test::kRealTime);
cfg_.g_lag_in_frames = 0;
@@ -44,16 +44,16 @@ class DecodeCorruptedFrameTest
dec_cfg_.threads = 1;
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) encoder->Control(VP8E_SET_CPUUSED, 7);
}
- virtual void MismatchHook(const vpx_image_t * /*img1*/,
- const vpx_image_t * /*img2*/) {}
+ void MismatchHook(const vpx_image_t * /*img1*/,
+ const vpx_image_t * /*img2*/) override {}
- virtual const vpx_codec_cx_pkt_t *MutateEncoderOutputHook(
- const vpx_codec_cx_pkt_t *pkt) {
+ const vpx_codec_cx_pkt_t *MutateEncoderOutputHook(
+ const vpx_codec_cx_pkt_t *pkt) override {
// Don't edit frame packet on key frame.
if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) return pkt;
if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) return pkt;
@@ -66,9 +66,9 @@ class DecodeCorruptedFrameTest
return &modified_pkt_;
}
- virtual bool HandleDecodeResult(const vpx_codec_err_t res_dec,
- const libvpx_test::VideoSource & /*video*/,
- libvpx_test::Decoder *decoder) {
+ bool HandleDecodeResult(const vpx_codec_err_t res_dec,
+ const libvpx_test::VideoSource & /*video*/,
+ libvpx_test::Decoder *decoder) override {
EXPECT_NE(res_dec, VPX_CODEC_MEM_ERROR) << decoder->DecodeError();
return VPX_CODEC_MEM_ERROR != res_dec;
}
diff --git a/test/decode_perf_test.cc b/test/decode_perf_test.cc
index e07a66744..383fd2d89 100644
--- a/test/decode_perf_test.cc
+++ b/test/decode_perf_test.cc
@@ -116,11 +116,11 @@ class VP9NewEncodeDecodePerfTest
protected:
VP9NewEncodeDecodePerfTest()
: EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)), speed_(0),
- outfile_(0), out_frames_(0) {}
+ outfile_(nullptr), out_frames_(0) {}
- virtual ~VP9NewEncodeDecodePerfTest() {}
+ ~VP9NewEncodeDecodePerfTest() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(encoding_mode_);
@@ -137,8 +137,8 @@ class VP9NewEncodeDecodePerfTest
cfg_.rc_end_usage = VPX_VBR;
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP8E_SET_CPUUSED, speed_);
encoder->Control(VP9E_SET_FRAME_PARALLEL_DECODING, 1);
@@ -146,14 +146,14 @@ class VP9NewEncodeDecodePerfTest
}
}
- virtual void BeginPassHook(unsigned int /*pass*/) {
+ void BeginPassHook(unsigned int /*pass*/) override {
const std::string data_path = getenv("LIBVPX_TEST_DATA_PATH");
const std::string path_to_source = data_path + "/" + kNewEncodeOutputFile;
outfile_ = fopen(path_to_source.c_str(), "wb");
ASSERT_NE(outfile_, nullptr);
}
- virtual void EndPassHook() {
+ void EndPassHook() override {
if (outfile_ != nullptr) {
if (!fseek(outfile_, 0, SEEK_SET)) {
ivf_write_file_header(outfile_, &cfg_, VP9_FOURCC, out_frames_);
@@ -163,7 +163,7 @@ class VP9NewEncodeDecodePerfTest
}
}
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
++out_frames_;
// Write initial file header if first frame.
@@ -177,7 +177,7 @@ class VP9NewEncodeDecodePerfTest
pkt->data.frame.sz);
}
- virtual bool DoDecode() const { return false; }
+ bool DoDecode() const override { return false; }
void set_speed(unsigned int speed) { speed_ = speed; }
diff --git a/test/decode_svc_test.cc b/test/decode_svc_test.cc
index ec9935da7..7098e7b27 100644
--- a/test/decode_svc_test.cc
+++ b/test/decode_svc_test.cc
@@ -25,17 +25,16 @@ class DecodeSvcTest : public ::libvpx_test::DecoderTest,
public ::libvpx_test::CodecTestWithParam<const char *> {
protected:
DecodeSvcTest() : DecoderTest(GET_PARAM(::libvpx_test::kCodecFactoryParam)) {}
- virtual ~DecodeSvcTest() {}
+ ~DecodeSvcTest() override = default;
- virtual void PreDecodeFrameHook(
- const libvpx_test::CompressedVideoSource &video,
- libvpx_test::Decoder *decoder) {
+ void PreDecodeFrameHook(const libvpx_test::CompressedVideoSource &video,
+ libvpx_test::Decoder *decoder) override {
if (video.frame_number() == 0)
decoder->Control(VP9_DECODE_SVC_SPATIAL_LAYER, spatial_layer_);
}
- virtual void DecompressedFrameHook(const vpx_image_t &img,
- const unsigned int frame_number) {
+ void DecompressedFrameHook(const vpx_image_t &img,
+ const unsigned int frame_number) override {
ASSERT_EQ(img.d_w, width_);
ASSERT_EQ(img.d_h, height_);
total_frames_ = frame_number;
diff --git a/test/encode_api_test.cc b/test/encode_api_test.cc
index e0e793b15..ee7d8d27c 100644
--- a/test/encode_api_test.cc
+++ b/test/encode_api_test.cc
@@ -11,17 +11,24 @@
#include <climits>
#include <cstring>
#include <initializer_list>
+#include <new>
#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "test/codec_factory.h"
+#include "test/encode_test_driver.h"
+#include "test/i420_video_source.h"
+#include "test/video_source.h"
#include "./vpx_config.h"
-#include "test/video_source.h"
#include "vpx/vp8cx.h"
+#include "vpx/vpx_codec.h"
#include "vpx/vpx_encoder.h"
+#include "vpx/vpx_image.h"
+#include "vpx/vpx_tpl.h"
namespace {
-const vpx_codec_iface_t *kCodecIfaces[] = {
+vpx_codec_iface_t *kCodecIfaces[] = {
#if CONFIG_VP8_ENCODER
&vpx_codec_vp8_cx_algo,
#endif
@@ -30,7 +37,7 @@ const vpx_codec_iface_t *kCodecIfaces[] = {
#endif
};
-bool IsVP9(const vpx_codec_iface_t *iface) {
+bool IsVP9(vpx_codec_iface_t *iface) {
static const char kVP9Name[] = "WebM Project VP9";
return strncmp(kVP9Name, vpx_codec_iface_name(iface), sizeof(kVP9Name) - 1) ==
0;
@@ -118,6 +125,62 @@ TEST(EncodeAPI, ImageSizeSetting) {
vpx_codec_destroy(&enc);
}
+
+// Verifies the fix for a float-cast-overflow in vp8_change_config().
+//
+// Causes cpi->framerate to become the largest possible value (10,000,000) in
+// VP8 by setting cfg.g_timebase to 1/10000000 and passing a duration of 1 to
+// vpx_codec_encode().
+TEST(EncodeAPI, HugeFramerateVp8) {
+ vpx_codec_iface_t *const iface = vpx_codec_vp8_cx();
+ vpx_codec_enc_cfg_t cfg;
+ ASSERT_EQ(vpx_codec_enc_config_default(iface, &cfg, 0), VPX_CODEC_OK);
+ cfg.g_w = 271;
+ cfg.g_h = 1080;
+ cfg.g_timebase.num = 1;
+ // Largest value (VP8's TICKS_PER_SEC) such that frame duration is nonzero (1
+ // tick).
+ cfg.g_timebase.den = 10000000;
+ cfg.g_pass = VPX_RC_ONE_PASS;
+ cfg.g_lag_in_frames = 0;
+ cfg.rc_end_usage = VPX_CBR;
+
+ vpx_codec_ctx_t enc;
+ // Before we encode the first frame, cpi->framerate is set to a guess (the
+ // reciprocal of cfg.g_timebase). If this guess doesn't seem reasonable
+ // (> 180), cpi->framerate is set to 30.
+ ASSERT_EQ(vpx_codec_enc_init(&enc, iface, &cfg, 0), VPX_CODEC_OK);
+
+ ASSERT_EQ(vpx_codec_control(&enc, VP8E_SET_CPUUSED, -12), VPX_CODEC_OK);
+
+ vpx_image_t *const image =
+ vpx_img_alloc(nullptr, VPX_IMG_FMT_I420, cfg.g_w, cfg.g_h, 1);
+ ASSERT_NE(image, nullptr);
+
+ for (unsigned int i = 0; i < image->d_h; ++i) {
+ memset(image->planes[0] + i * image->stride[0], 128, image->d_w);
+ }
+ const unsigned int uv_h = (image->d_h + 1) / 2;
+ const unsigned int uv_w = (image->d_w + 1) / 2;
+ for (unsigned int i = 0; i < uv_h; ++i) {
+ memset(image->planes[1] + i * image->stride[1], 128, uv_w);
+ memset(image->planes[2] + i * image->stride[2], 128, uv_w);
+ }
+
+ // Encode a frame.
+ // Up to this point cpi->framerate is 30. Now pass a duration of only 1. This
+ // causes cpi->framerate to become 10,000,000.
+ ASSERT_EQ(vpx_codec_encode(&enc, image, 0, 1, 0, VPX_DL_REALTIME),
+ VPX_CODEC_OK);
+
+ // Change to the same config. Since cpi->framerate is now huge, when it is
+ // used to calculate raw_target_rate (bit rate of uncompressed frames), the
+ // result is likely to overflow an unsigned int.
+ ASSERT_EQ(vpx_codec_enc_config_set(&enc, &cfg), VPX_CODEC_OK);
+
+ vpx_img_free(image);
+ ASSERT_EQ(vpx_codec_destroy(&enc), VPX_CODEC_OK);
+}
#endif
// Set up 2 spatial streams with 2 temporal layers per stream, and generate
@@ -196,7 +259,7 @@ TEST(EncodeAPI, MultiResEncode) {
TEST(EncodeAPI, SetRoi) {
static struct {
- const vpx_codec_iface_t *iface;
+ vpx_codec_iface_t *iface;
int ctrl_id;
} kCodecs[] = {
#if CONFIG_VP8_ENCODER
@@ -302,7 +365,7 @@ TEST(EncodeAPI, SetRoi) {
}
}
-void InitCodec(const vpx_codec_iface_t &iface, int width, int height,
+void InitCodec(vpx_codec_iface_t &iface, int width, int height,
vpx_codec_ctx_t *enc, vpx_codec_enc_cfg_t *cfg) {
cfg->g_w = width;
cfg->g_h = height;
@@ -392,7 +455,7 @@ TEST(EncodeAPI, ConfigResizeChangeThreadCount) {
EXPECT_EQ(vpx_codec_enc_config_set(&enc.ctx, &cfg), VPX_CODEC_OK)
<< vpx_codec_error_detail(&enc.ctx);
- cfg.g_w = 16;
+ cfg.g_w = 1000;
cfg.g_h = 720;
for (const auto threads : { 1, 4, 8, 6, 2, 1 }) {
@@ -404,4 +467,451 @@ TEST(EncodeAPI, ConfigResizeChangeThreadCount) {
}
}
+#if CONFIG_VP9_ENCODER
+// Frame size needed to trigger the overflow exceeds the max buffer allowed on
+// 32-bit systems defined by VPX_MAX_ALLOCABLE_MEMORY
+#if VPX_ARCH_X86_64 || VPX_ARCH_AARCH64
+TEST(EncodeAPI, ConfigLargeTargetBitrateVp9) {
+ constexpr int kWidth = 12383;
+ constexpr int kHeight = 8192;
+ constexpr auto *iface = &vpx_codec_vp9_cx_algo;
+ SCOPED_TRACE(vpx_codec_iface_name(iface));
+ vpx_codec_enc_cfg_t cfg = {};
+ struct Encoder {
+ ~Encoder() { EXPECT_EQ(vpx_codec_destroy(&ctx), VPX_CODEC_OK); }
+ vpx_codec_ctx_t ctx = {};
+ } enc;
+
+ ASSERT_EQ(vpx_codec_enc_config_default(iface, &cfg, 0), VPX_CODEC_OK);
+ // The following setting will cause avg_frame_bandwidth in rate control to be
+ // larger than INT_MAX
+ cfg.rc_target_bitrate = INT_MAX;
+ // Framerate 0.1 (equivalent to timebase 10) is the smallest framerate allowed
+ // by libvpx
+ cfg.g_timebase.den = 1;
+ cfg.g_timebase.num = 10;
+ EXPECT_NO_FATAL_FAILURE(InitCodec(*iface, kWidth, kHeight, &enc.ctx, &cfg))
+ << "target bitrate: " << cfg.rc_target_bitrate << " framerate: "
+ << static_cast<double>(cfg.g_timebase.den) / cfg.g_timebase.num;
+}
+#endif // VPX_ARCH_X86_64 || VPX_ARCH_AARCH64
+
+vpx_image_t *CreateImage(const unsigned int width, const unsigned int height) {
+ vpx_image_t *image =
+ vpx_img_alloc(nullptr, VPX_IMG_FMT_I420, width, height, 1);
+ if (!image) return image;
+
+ for (unsigned int i = 0; i < image->d_h; ++i) {
+ memset(image->planes[0] + i * image->stride[0], 128, image->d_w);
+ }
+ const unsigned int uv_h = (image->d_h + 1) / 2;
+ const unsigned int uv_w = (image->d_w + 1) / 2;
+ for (unsigned int i = 0; i < uv_h; ++i) {
+ memset(image->planes[1] + i * image->stride[1], 128, uv_w);
+ memset(image->planes[2] + i * image->stride[2], 128, uv_w);
+ }
+
+ return image;
+}
+
+// Emulates the WebCodecs VideoEncoder interface.
+class VP9Encoder {
+ public:
+ VP9Encoder(int speed) : speed_(speed) {}
+ ~VP9Encoder();
+
+ void Configure(unsigned int threads, unsigned int width, unsigned int height,
+ vpx_rc_mode end_usage, unsigned long deadline);
+ void Encode(bool key_frame);
+
+ private:
+ const int speed_;
+ bool initialized_ = false;
+ vpx_codec_enc_cfg_t cfg_;
+ vpx_codec_ctx_t enc_;
+ int frame_index_ = 0;
+ unsigned long deadline_ = 0;
+};
+
+VP9Encoder::~VP9Encoder() {
+ if (initialized_) {
+ EXPECT_EQ(vpx_codec_destroy(&enc_), VPX_CODEC_OK);
+ }
+}
+
+void VP9Encoder::Configure(unsigned int threads, unsigned int width,
+ unsigned int height, vpx_rc_mode end_usage,
+ unsigned long deadline) {
+ deadline_ = deadline;
+
+ if (!initialized_) {
+ vpx_codec_iface_t *const iface = vpx_codec_vp9_cx();
+ ASSERT_EQ(vpx_codec_enc_config_default(iface, &cfg_, /*usage=*/0),
+ VPX_CODEC_OK);
+ cfg_.g_threads = threads;
+ cfg_.g_w = width;
+ cfg_.g_h = height;
+ cfg_.g_timebase.num = 1;
+ cfg_.g_timebase.den = 1000 * 1000; // microseconds
+ cfg_.g_pass = VPX_RC_ONE_PASS;
+ cfg_.g_lag_in_frames = 0;
+ cfg_.rc_end_usage = end_usage;
+ cfg_.rc_min_quantizer = 2;
+ cfg_.rc_max_quantizer = 58;
+ ASSERT_EQ(vpx_codec_enc_init(&enc_, iface, &cfg_, 0), VPX_CODEC_OK);
+ ASSERT_EQ(vpx_codec_control(&enc_, VP8E_SET_CPUUSED, speed_), VPX_CODEC_OK);
+ initialized_ = true;
+ return;
+ }
+
+ cfg_.g_threads = threads;
+ cfg_.g_w = width;
+ cfg_.g_h = height;
+ cfg_.rc_end_usage = end_usage;
+ ASSERT_EQ(vpx_codec_enc_config_set(&enc_, &cfg_), VPX_CODEC_OK)
+ << vpx_codec_error_detail(&enc_);
+}
+
+void VP9Encoder::Encode(bool key_frame) {
+ const vpx_codec_cx_pkt_t *pkt;
+ vpx_image_t *image = CreateImage(cfg_.g_w, cfg_.g_h);
+ ASSERT_NE(image, nullptr);
+ const vpx_enc_frame_flags_t frame_flags = key_frame ? VPX_EFLAG_FORCE_KF : 0;
+ ASSERT_EQ(
+ vpx_codec_encode(&enc_, image, frame_index_, 1, frame_flags, deadline_),
+ VPX_CODEC_OK);
+ frame_index_++;
+ vpx_codec_iter_t iter = nullptr;
+ while ((pkt = vpx_codec_get_cx_data(&enc_, &iter)) != nullptr) {
+ ASSERT_EQ(pkt->kind, VPX_CODEC_CX_FRAME_PKT);
+ }
+ vpx_img_free(image);
+}
+
+// This is a test case from clusterfuzz.
+TEST(EncodeAPI, PrevMiCheckNullptr) {
+ VP9Encoder encoder(0);
+ encoder.Configure(0, 1554, 644, VPX_VBR, VPX_DL_REALTIME);
+
+ // First step: encode, without forcing KF.
+ encoder.Encode(false);
+ // Second step: change config
+ encoder.Configure(0, 1131, 644, VPX_CBR, VPX_DL_GOOD_QUALITY);
+ // Third step: encode, without forcing KF
+ encoder.Encode(false);
+}
+
+// This is a test case from clusterfuzz: based on b/310477034.
+// Encode a few frames with multiple change config calls
+// with different frame sizes.
+TEST(EncodeAPI, MultipleChangeConfigResize) {
+ VP9Encoder encoder(3);
+
+ // Set initial config.
+ encoder.Configure(3, 41, 1, VPX_VBR, VPX_DL_REALTIME);
+
+ // Encode first frame.
+ encoder.Encode(true);
+
+ // Change config.
+ encoder.Configure(16, 31, 1, VPX_VBR, VPX_DL_GOOD_QUALITY);
+
+ // Change config again.
+ encoder.Configure(0, 17, 1, VPX_CBR, VPX_DL_REALTIME);
+
+ // Encode 2nd frame with new config, set delta frame.
+ encoder.Encode(false);
+
+ // Encode 3rd frame with same config, set delta frame.
+ encoder.Encode(false);
+}
+
+// This is a test case from clusterfuzz: based on b/310663186.
+// Encode set of frames while varying the deadline on the fly from
+// good to realtime to best and back to realtime.
+TEST(EncodeAPI, DynamicDeadlineChange) {
+ // Use realtime speed: 5 to 9.
+ VP9Encoder encoder(5);
+
+ // Set initial config, in particular set deadline to GOOD mode.
+ encoder.Configure(0, 1, 1, VPX_VBR, VPX_DL_GOOD_QUALITY);
+
+ // Encode 1st frame.
+ encoder.Encode(true);
+
+ // Encode 2nd frame, delta frame.
+ encoder.Encode(false);
+
+ // Change config: change deadline to REALTIME.
+ encoder.Configure(0, 1, 1, VPX_VBR, VPX_DL_REALTIME);
+
+ // Encode 3rd frame with new config, set key frame.
+ encoder.Encode(true);
+
+ // Encode 4th frame with same config, delta frame.
+ encoder.Encode(false);
+
+ // Encode 5th frame with same config, key frame.
+ encoder.Encode(true);
+
+ // Change config: change deadline to BEST.
+ encoder.Configure(0, 1, 1, VPX_VBR, VPX_DL_BEST_QUALITY);
+
+ // Encode 6th frame with new config, set delta frame.
+ encoder.Encode(false);
+
+ // Change config: change deadline to REALTIME.
+ encoder.Configure(0, 1, 1, VPX_VBR, VPX_DL_REALTIME);
+
+ // Encode 7th frame with new config, set delta frame.
+ encoder.Encode(false);
+
+ // Encode 8th frame with new config, set key frame.
+ encoder.Encode(true);
+
+ // Encode 9th frame with new config, set delta frame.
+ encoder.Encode(false);
+}
+
+TEST(EncodeAPI, Buganizer310340241) {
+ VP9Encoder encoder(-6);
+
+ // Set initial config, in particular set deadline to GOOD mode.
+ encoder.Configure(0, 1, 1, VPX_VBR, VPX_DL_GOOD_QUALITY);
+
+ // Encode 1st frame.
+ encoder.Encode(true);
+
+ // Encode 2nd frame, delta frame.
+ encoder.Encode(false);
+
+ // Change config: change deadline to REALTIME.
+ encoder.Configure(0, 1, 1, VPX_VBR, VPX_DL_REALTIME);
+
+ // Encode 3rd frame with new config, set key frame.
+ encoder.Encode(true);
+}
+
+// This is a test case from clusterfuzz: based on b/312517065.
+TEST(EncodeAPI, Buganizer312517065) {
+ VP9Encoder encoder(4);
+ encoder.Configure(0, 1060, 437, VPX_CBR, VPX_DL_REALTIME);
+ encoder.Encode(true);
+ encoder.Configure(10, 33, 437, VPX_VBR, VPX_DL_GOOD_QUALITY);
+ encoder.Encode(false);
+ encoder.Configure(6, 327, 269, VPX_VBR, VPX_DL_GOOD_QUALITY);
+ encoder.Configure(15, 1060, 437, VPX_CBR, VPX_DL_REALTIME);
+ encoder.Encode(false);
+}
+
+// This is a test case from clusterfuzz: based on b/311489136.
+// Encode a few frames with multiple change config calls
+// with different frame sizes.
+TEST(EncodeAPI, Buganizer311489136) {
+ VP9Encoder encoder(1);
+
+ // Set initial config.
+ encoder.Configure(12, 1678, 620, VPX_VBR, VPX_DL_GOOD_QUALITY);
+
+ // Encode first frame.
+ encoder.Encode(true);
+
+ // Change config.
+ encoder.Configure(3, 1678, 202, VPX_CBR, VPX_DL_GOOD_QUALITY);
+
+ // Encode 2nd frame with new config, set delta frame.
+ encoder.Encode(false);
+
+ // Change config again.
+ encoder.Configure(8, 1037, 476, VPX_CBR, VPX_DL_REALTIME);
+
+ // Encode 3rd frame with new config, set delta frame.
+ encoder.Encode(false);
+
+ // Change config again.
+ encoder.Configure(0, 580, 620, VPX_CBR, VPX_DL_GOOD_QUALITY);
+
+ // Encode 4th frame with same config, set delta frame.
+ encoder.Encode(false);
+}
+
+// This is a test case from clusterfuzz: based on b/312656387.
+// Encode a few frames with multiple change config calls
+// with different frame sizes.
+TEST(EncodeAPI, Buganizer312656387) {
+ VP9Encoder encoder(1);
+
+ // Set initial config.
+ encoder.Configure(16, 1, 1024, VPX_CBR, VPX_DL_REALTIME);
+
+ // Change config.
+ encoder.Configure(15, 1, 1024, VPX_VBR, VPX_DL_REALTIME);
+
+ // Encode first frame.
+ encoder.Encode(true);
+
+ // Change config again.
+ encoder.Configure(14, 1, 595, VPX_VBR, VPX_DL_GOOD_QUALITY);
+
+ // Encode 2nd frame with new config.
+ encoder.Encode(true);
+
+ // Change config again.
+ encoder.Configure(2, 1, 1024, VPX_VBR, VPX_DL_GOOD_QUALITY);
+
+ // Encode 3rd frame with new config, set delta frame.
+ encoder.Encode(false);
+}
+
+// This is a test case from clusterfuzz: based on b/310329177.
+// Encode a few frames with multiple change config calls
+// with different frame sizes.
+TEST(EncodeAPI, Buganizer310329177) {
+ VP9Encoder encoder(6);
+
+ // Set initial config.
+ encoder.Configure(10, 41, 1, VPX_VBR, VPX_DL_REALTIME);
+
+ // Encode first frame.
+ encoder.Encode(true);
+
+ // Change config.
+ encoder.Configure(16, 1, 1, VPX_VBR, VPX_DL_REALTIME);
+
+ // Encode 2nd frame with new config, set delta frame.
+ encoder.Encode(false);
+}
+
+// This is a test case from clusterfuzz: based on b/311394513.
+// Encode a few frames with multiple change config calls
+// with different frame sizes.
+TEST(EncodeAPI, Buganizer311394513) {
+ VP9Encoder encoder(-7);
+
+ // Set initial config.
+ encoder.Configure(0, 5, 9, VPX_VBR, VPX_DL_REALTIME);
+
+ // Encode first frame.
+ encoder.Encode(false);
+
+ // Change config.
+ encoder.Configure(5, 2, 1, VPX_VBR, VPX_DL_REALTIME);
+
+ // Encode 2nd frame with new config.
+ encoder.Encode(true);
+}
+
+TEST(EncodeAPI, Buganizer311985118) {
+ VP9Encoder encoder(0);
+
+ // Set initial config, in particular set deadline to GOOD mode.
+ encoder.Configure(12, 1678, 620, VPX_VBR, VPX_DL_GOOD_QUALITY);
+
+ // Encode 1st frame.
+ encoder.Encode(false);
+
+ // Change config: change threads and width.
+ encoder.Configure(0, 1574, 620, VPX_VBR, VPX_DL_GOOD_QUALITY);
+
+ // Change config: change threads, width and height.
+ encoder.Configure(16, 837, 432, VPX_VBR, VPX_DL_GOOD_QUALITY);
+
+ // Encode 2nd frame.
+ encoder.Encode(false);
+}
+
+// This is a test case from clusterfuzz: based on b/314857577.
+// Encode a few frames with multiple change config calls
+// with different frame sizes.
+TEST(EncodeAPI, Buganizer314857577) {
+ VP9Encoder encoder(4);
+
+ // Set initial config.
+ encoder.Configure(12, 1060, 437, VPX_VBR, VPX_DL_REALTIME);
+
+ // Encode first frame.
+ encoder.Encode(false);
+
+ // Change config.
+ encoder.Configure(16, 1060, 1, VPX_CBR, VPX_DL_REALTIME);
+
+ // Encode 2nd frame with new config.
+ encoder.Encode(false);
+
+ // Encode 3rd frame with new config.
+ encoder.Encode(true);
+
+ // Change config.
+ encoder.Configure(15, 33, 437, VPX_VBR, VPX_DL_GOOD_QUALITY);
+
+ // Encode 4th frame with new config.
+ encoder.Encode(true);
+
+ // Encode 5th frame with new config.
+ encoder.Encode(false);
+
+ // Change config.
+ encoder.Configure(5, 327, 269, VPX_VBR, VPX_DL_REALTIME);
+
+ // Change config.
+ encoder.Configure(15, 1060, 437, VPX_CBR, VPX_DL_REALTIME);
+
+ // Encode 6th frame with new config.
+ encoder.Encode(false);
+
+ // Encode 7th frame with new config.
+ encoder.Encode(false);
+
+ // Change config.
+ encoder.Configure(4, 1060, 437, VPX_VBR, VPX_DL_REALTIME);
+
+ // Encode 8th frame with new config.
+ encoder.Encode(false);
+}
+
+TEST(EncodeAPI, Buganizer312875957PredBufferStride) {
+ VP9Encoder encoder(-1);
+
+ encoder.Configure(12, 1678, 620, VPX_VBR, VPX_DL_REALTIME);
+ encoder.Encode(true);
+ encoder.Encode(false);
+ encoder.Configure(0, 456, 486, VPX_VBR, VPX_DL_REALTIME);
+ encoder.Encode(true);
+ encoder.Configure(0, 1678, 620, VPX_CBR, 1000000);
+ encoder.Encode(false);
+ encoder.Encode(false);
+}
+
+// This is a test case from clusterfuzz: based on b/311294795
+// Encode a few frames with multiple change config calls
+// with different frame sizes.
+TEST(EncodeAPI, Buganizer311294795) {
+ VP9Encoder encoder(1);
+
+ // Set initial config.
+ encoder.Configure(12, 1678, 620, VPX_VBR, VPX_DL_REALTIME);
+
+ // Encode first frame.
+ encoder.Encode(false);
+
+ // Change config.
+ encoder.Configure(16, 632, 620, VPX_VBR, VPX_DL_GOOD_QUALITY);
+
+ // Encode 2nd frame with new config
+ encoder.Encode(true);
+
+ // Change config.
+ encoder.Configure(16, 1678, 342, VPX_VBR, VPX_DL_GOOD_QUALITY);
+
+ // Encode 3rd frame with new config.
+ encoder.Encode(false);
+
+ // Change config.
+ encoder.Configure(0, 1574, 618, VPX_VBR, VPX_DL_REALTIME);
+ // Encode more frames with new config.
+ encoder.Encode(false);
+ encoder.Encode(false);
+}
+#endif // CONFIG_VP9_ENCODER
+
} // namespace
diff --git a/test/encode_perf_test.cc b/test/encode_perf_test.cc
index 142a55952..171ff8eec 100644
--- a/test/encode_perf_test.cc
+++ b/test/encode_perf_test.cc
@@ -61,9 +61,9 @@ class VP9EncodePerfTest
: EncoderTest(GET_PARAM(0)), min_psnr_(kMaxPsnr), nframes_(0),
encoding_mode_(GET_PARAM(1)), speed_(0), threads_(1) {}
- virtual ~VP9EncodePerfTest() {}
+ ~VP9EncodePerfTest() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(encoding_mode_);
@@ -82,8 +82,8 @@ class VP9EncodePerfTest
cfg_.g_threads = threads_;
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
const int log2_tile_columns = 3;
encoder->Control(VP8E_SET_CPUUSED, speed_);
@@ -93,19 +93,19 @@ class VP9EncodePerfTest
}
}
- virtual void BeginPassHook(unsigned int /*pass*/) {
+ void BeginPassHook(unsigned int /*pass*/) override {
min_psnr_ = kMaxPsnr;
nframes_ = 0;
}
- virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) override {
if (pkt->data.psnr.psnr[0] < min_psnr_) {
min_psnr_ = pkt->data.psnr.psnr[0];
}
}
// for performance reasons don't decode
- virtual bool DoDecode() const { return false; }
+ bool DoDecode() const override { return false; }
double min_psnr() const { return min_psnr_; }
diff --git a/test/encode_test_driver.h b/test/encode_test_driver.h
index b57df8529..c7974894c 100644
--- a/test/encode_test_driver.h
+++ b/test/encode_test_driver.h
@@ -19,7 +19,7 @@
#if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER
#include "vpx/vp8cx.h"
#endif
-#include "vpx/vpx_encoder.h"
+#include "vpx/vpx_tpl.h"
namespace libvpx_test {
@@ -153,6 +153,11 @@ class Encoder {
const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg);
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
}
+
+ void Control(int ctrl_id, VpxTplGopStats *arg) {
+ const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg);
+ ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
+ }
#endif // CONFIG_VP9_ENCODER
#if CONFIG_VP8_ENCODER || CONFIG_VP9_ENCODER
@@ -259,7 +264,7 @@ class EncoderTest {
const CodecFactory *codec_;
// Hook to determine whether to decode frame after encoding
- virtual bool DoDecode() const { return 1; }
+ virtual bool DoDecode() const { return true; }
// Hook to handle encode/decode mismatch
virtual void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2);
diff --git a/test/error_resilience_test.cc b/test/error_resilience_test.cc
index 45138f14b..6b019b2bf 100644
--- a/test/error_resilience_test.cc
+++ b/test/error_resilience_test.cc
@@ -30,7 +30,7 @@ class ErrorResilienceTestLarge
Reset();
}
- virtual ~ErrorResilienceTestLarge() {}
+ ~ErrorResilienceTestLarge() override = default;
void Reset() {
error_nframes_ = 0;
@@ -38,19 +38,19 @@ class ErrorResilienceTestLarge
pattern_switch_ = 0;
}
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(encoding_mode_);
}
- virtual void BeginPassHook(unsigned int /*pass*/) {
+ void BeginPassHook(unsigned int /*pass*/) override {
psnr_ = 0.0;
nframes_ = 0;
mismatch_psnr_ = 0.0;
mismatch_nframes_ = 0;
}
- virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) override {
psnr_ += pkt->data.psnr.psnr[0];
nframes_++;
}
@@ -90,7 +90,7 @@ class ErrorResilienceTestLarge
return frame_flags;
}
- virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video) {
+ void PreEncodeFrameHook(libvpx_test::VideoSource *video) override {
frame_flags_ &=
~(VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF);
// For temporal layer case.
@@ -129,21 +129,21 @@ class ErrorResilienceTestLarge
return 0.0;
}
- virtual bool DoDecode() const {
+ bool DoDecode() const override {
if (error_nframes_ > 0 &&
(cfg_.g_pass == VPX_RC_LAST_PASS || cfg_.g_pass == VPX_RC_ONE_PASS)) {
for (unsigned int i = 0; i < error_nframes_; ++i) {
if (error_frames_[i] == nframes_ - 1) {
std::cout << " Skipping decoding frame: "
<< error_frames_[i] << "\n";
- return 0;
+ return false;
}
}
}
- return 1;
+ return true;
}
- virtual void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2) {
+ void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2) override {
double mismatch_psnr = compute_psnr(img1, img2);
mismatch_psnr_ += mismatch_psnr;
++mismatch_nframes_;
@@ -381,7 +381,7 @@ class ErrorResilienceTestLargeCodecControls
Reset();
}
- virtual ~ErrorResilienceTestLargeCodecControls() {}
+ ~ErrorResilienceTestLargeCodecControls() override = default;
void Reset() {
last_pts_ = 0;
@@ -393,7 +393,7 @@ class ErrorResilienceTestLargeCodecControls
duration_ = 0.0;
}
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(encoding_mode_);
}
@@ -460,8 +460,8 @@ class ErrorResilienceTestLargeCodecControls
return layer_id;
}
- virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
- libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(libvpx_test::VideoSource *video,
+ libvpx_test::Encoder *encoder) override {
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);
@@ -476,7 +476,7 @@ class ErrorResilienceTestLargeCodecControls
}
}
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
// Time since last timestamp = duration.
vpx_codec_pts_t duration = pkt->data.frame.pts - last_pts_;
if (duration > 1) {
@@ -496,7 +496,7 @@ class ErrorResilienceTestLargeCodecControls
++tot_frame_number_;
}
- virtual void EndPassHook() {
+ void EndPassHook() override {
duration_ = (last_pts_ + 1) * timebase_;
if (cfg_.ts_number_layers > 1) {
for (int layer = 0; layer < static_cast<int>(cfg_.ts_number_layers);
diff --git a/test/external_frame_buffer_test.cc b/test/external_frame_buffer_test.cc
index 3bd4a1c47..7b9a836fb 100644
--- a/test/external_frame_buffer_test.cc
+++ b/test/external_frame_buffer_test.cc
@@ -210,13 +210,12 @@ class ExternalFrameBufferMD5Test
: DecoderTest(GET_PARAM(::libvpx_test::kCodecFactoryParam)),
md5_file_(nullptr), num_buffers_(0) {}
- virtual ~ExternalFrameBufferMD5Test() {
+ ~ExternalFrameBufferMD5Test() override {
if (md5_file_ != nullptr) fclose(md5_file_);
}
- virtual void PreDecodeFrameHook(
- const libvpx_test::CompressedVideoSource &video,
- libvpx_test::Decoder *decoder) {
+ void PreDecodeFrameHook(const libvpx_test::CompressedVideoSource &video,
+ libvpx_test::Decoder *decoder) override {
if (num_buffers_ > 0 && video.frame_number() == 0) {
// Have libvpx use frame buffers we create.
ASSERT_TRUE(fb_list_.CreateBufferList(num_buffers_));
@@ -232,8 +231,8 @@ class ExternalFrameBufferMD5Test
<< "Md5 file open failed. Filename: " << md5_file_name_;
}
- virtual void DecompressedFrameHook(const vpx_image_t &img,
- const unsigned int frame_number) {
+ void DecompressedFrameHook(const vpx_image_t &img,
+ const unsigned int frame_number) override {
ASSERT_NE(md5_file_, nullptr);
char expected_md5[33];
char junk[128];
@@ -289,7 +288,7 @@ class ExternalFrameBufferTest : public ::testing::Test {
ExternalFrameBufferTest()
: video_(nullptr), decoder_(nullptr), num_buffers_(0) {}
- virtual void SetUp() {
+ void SetUp() override {
video_ = new libvpx_test::WebMVideoSource(kVP9TestFile);
ASSERT_NE(video_, nullptr);
video_->Init();
@@ -300,7 +299,7 @@ class ExternalFrameBufferTest : public ::testing::Test {
ASSERT_NE(decoder_, nullptr);
}
- virtual void TearDown() {
+ void TearDown() override {
delete decoder_;
decoder_ = nullptr;
delete video_;
@@ -355,7 +354,7 @@ class ExternalFrameBufferTest : public ::testing::Test {
class ExternalFrameBufferNonRefTest : public ExternalFrameBufferTest {
protected:
- virtual void SetUp() {
+ void SetUp() override {
video_ = new libvpx_test::WebMVideoSource(kVP9NonRefTestFile);
ASSERT_NE(video_, nullptr);
video_->Init();
diff --git a/test/fdct8x8_test.cc b/test/fdct8x8_test.cc
index 83d1ff142..3cdf909d4 100644
--- a/test/fdct8x8_test.cc
+++ b/test/fdct8x8_test.cc
@@ -132,9 +132,18 @@ void idct8x8_64_add_12_sse2(const tran_low_t *in, uint8_t *out, int stride) {
#endif // HAVE_SSE2
#endif // CONFIG_VP9_HIGHBITDEPTH
+// Visual Studio 2022 (cl.exe) targeting AArch64 with optimizations enabled
+// produces invalid code in RunExtremalCheck() and RunInvAccuracyCheck().
+// See:
+// https://developercommunity.visualstudio.com/t/1770-preview-1:-Misoptimization-for-AR/10369786
+// TODO(jzern): check the compiler version after a fix for the issue is
+// released.
+#if defined(_MSC_VER) && defined(_M_ARM64) && !defined(__clang__)
+#pragma optimize("", off)
+#endif
class FwdTrans8x8TestBase {
public:
- virtual ~FwdTrans8x8TestBase() {}
+ virtual ~FwdTrans8x8TestBase() = default;
protected:
virtual void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) = 0;
@@ -170,7 +179,7 @@ class FwdTrans8x8TestBase {
for (int j = 0; j < 64; ++j) {
const int diff = abs(count_sign_block[j][0] - count_sign_block[j][1]);
const int max_diff = kSignBiasMaxDiff255;
- EXPECT_LT(diff, max_diff << (bit_depth_ - 8))
+ ASSERT_LT(diff, max_diff << (bit_depth_ - 8))
<< "Error: 8x8 FDCT/FHT has a sign bias > "
<< 1. * max_diff / count_test_block * 100 << "%"
<< " for input range [-255, 255] at index " << j
@@ -201,7 +210,7 @@ class FwdTrans8x8TestBase {
for (int j = 0; j < 64; ++j) {
const int diff = abs(count_sign_block[j][0] - count_sign_block[j][1]);
const int max_diff = kSignBiasMaxDiff15;
- EXPECT_LT(diff, max_diff << (bit_depth_ - 8))
+ ASSERT_LT(diff, max_diff << (bit_depth_ - 8))
<< "Error: 8x8 FDCT/FHT has a sign bias > "
<< 1. * max_diff / count_test_block * 100 << "%"
<< " for input range [-15, 15] at index " << j
@@ -275,11 +284,11 @@ class FwdTrans8x8TestBase {
}
}
- EXPECT_GE(1 << 2 * (bit_depth_ - 8), max_error)
+ ASSERT_GE(1 << 2 * (bit_depth_ - 8), max_error)
<< "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)
+ ASSERT_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";
}
@@ -360,17 +369,17 @@ class FwdTrans8x8TestBase {
total_coeff_error += abs(coeff_diff);
}
- EXPECT_GE(1 << 2 * (bit_depth_ - 8), max_error)
+ ASSERT_GE(1 << 2 * (bit_depth_ - 8), max_error)
<< "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has"
- << "an individual roundtrip error > 1";
+ << " an individual roundtrip error > 1";
- EXPECT_GE((count_test_block << 2 * (bit_depth_ - 8)) / 5, total_error)
+ ASSERT_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";
- EXPECT_EQ(0, total_coeff_error)
+ ASSERT_EQ(0, total_coeff_error)
<< "Error: Extremal 8x8 FDCT/FHT has"
- << "overflow issues in the intermediate steps > 1";
+ << " overflow issues in the intermediate steps > 1";
}
}
@@ -426,7 +435,7 @@ class FwdTrans8x8TestBase {
const int diff = dst[j] - src[j];
#endif
const uint32_t error = diff * diff;
- EXPECT_GE(1u << 2 * (bit_depth_ - 8), error)
+ ASSERT_GE(1u << 2 * (bit_depth_ - 8), error)
<< "Error: 8x8 IDCT has error " << error << " at index " << j;
}
}
@@ -456,7 +465,7 @@ class FwdTrans8x8TestBase {
for (int j = 0; j < kNumCoeffs; ++j) {
const int32_t diff = coeff[j] - coeff_r[j];
const uint32_t error = diff * diff;
- EXPECT_GE(9u << 2 * (bit_depth_ - 8), error)
+ ASSERT_GE(9u << 2 * (bit_depth_ - 8), error)
<< "Error: 8x8 DCT has error " << error << " at index " << j;
}
}
@@ -512,7 +521,7 @@ class FwdTrans8x8TestBase {
const int diff = dst[j] - ref[j];
#endif
const uint32_t error = diff * diff;
- EXPECT_EQ(0u, error)
+ ASSERT_EQ(0u, error)
<< "Error: 8x8 IDCT has error " << error << " at index " << j;
}
}
@@ -523,13 +532,16 @@ class FwdTrans8x8TestBase {
vpx_bit_depth_t bit_depth_;
int mask_;
};
+#if defined(_MSC_VER) && defined(_M_ARM64) && !defined(__clang__)
+#pragma optimize("", on)
+#endif
class FwdTrans8x8DCT : public FwdTrans8x8TestBase,
public ::testing::TestWithParam<Dct8x8Param> {
public:
- virtual ~FwdTrans8x8DCT() {}
+ ~FwdTrans8x8DCT() override = default;
- virtual void SetUp() {
+ void SetUp() override {
fwd_txfm_ = GET_PARAM(0);
inv_txfm_ = GET_PARAM(1);
tx_type_ = GET_PARAM(2);
@@ -539,13 +551,13 @@ class FwdTrans8x8DCT : public FwdTrans8x8TestBase,
mask_ = (1 << bit_depth_) - 1;
}
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
+ void TearDown() override { libvpx_test::ClearSystemState(); }
protected:
- void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {
+ void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) override {
fwd_txfm_(in, out, stride);
}
- void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
+ void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) override {
inv_txfm_(out, dst, stride);
}
@@ -566,9 +578,9 @@ TEST_P(FwdTrans8x8DCT, InvAccuracyCheck) { RunInvAccuracyCheck(); }
class FwdTrans8x8HT : public FwdTrans8x8TestBase,
public ::testing::TestWithParam<Ht8x8Param> {
public:
- virtual ~FwdTrans8x8HT() {}
+ ~FwdTrans8x8HT() override = default;
- virtual void SetUp() {
+ void SetUp() override {
fwd_txfm_ = GET_PARAM(0);
inv_txfm_ = GET_PARAM(1);
tx_type_ = GET_PARAM(2);
@@ -578,13 +590,13 @@ class FwdTrans8x8HT : public FwdTrans8x8TestBase,
mask_ = (1 << bit_depth_) - 1;
}
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
+ void TearDown() override { libvpx_test::ClearSystemState(); }
protected:
- void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {
+ void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) override {
fwd_txfm_(in, out, stride, tx_type_);
}
- void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
+ void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) override {
inv_txfm_(out, dst, stride, tx_type_);
}
@@ -602,9 +614,9 @@ TEST_P(FwdTrans8x8HT, ExtremalCheck) { RunExtremalCheck(); }
class InvTrans8x8DCT : public FwdTrans8x8TestBase,
public ::testing::TestWithParam<Idct8x8Param> {
public:
- virtual ~InvTrans8x8DCT() {}
+ ~InvTrans8x8DCT() override = default;
- virtual void SetUp() {
+ void SetUp() override {
ref_txfm_ = GET_PARAM(0);
inv_txfm_ = GET_PARAM(1);
thresh_ = GET_PARAM(2);
@@ -613,13 +625,14 @@ class InvTrans8x8DCT : public FwdTrans8x8TestBase,
mask_ = (1 << bit_depth_) - 1;
}
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
+ void TearDown() override { libvpx_test::ClearSystemState(); }
protected:
- void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
+ void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) override {
inv_txfm_(out, dst, stride);
}
- void RunFwdTxfm(int16_t * /*out*/, tran_low_t * /*dst*/, int /*stride*/) {}
+ void RunFwdTxfm(int16_t * /*out*/, tran_low_t * /*dst*/,
+ int /*stride*/) override {}
IdctFunc ref_txfm_;
IdctFunc inv_txfm_;
diff --git a/test/frame_size_tests.cc b/test/frame_size_tests.cc
index 8a0eb71ba..7b6c29a88 100644
--- a/test/frame_size_tests.cc
+++ b/test/frame_size_tests.cc
@@ -65,7 +65,7 @@ class EncoderWithExpectedError : public ::libvpx_test::Encoder {
ASSERT_EQ(expected_err, res) << EncoderError();
}
- virtual vpx_codec_iface_t *CodecInterface() const {
+ vpx_codec_iface_t *CodecInterface() const override {
#if CONFIG_VP9_ENCODER
return &vpx_codec_vp9_cx_algo;
#else
@@ -79,22 +79,22 @@ class VP9FrameSizeTestsLarge : public ::libvpx_test::EncoderTest,
protected:
VP9FrameSizeTestsLarge()
: EncoderTest(&::libvpx_test::kVP9), expected_res_(VPX_CODEC_OK) {}
- virtual ~VP9FrameSizeTestsLarge() {}
+ ~VP9FrameSizeTestsLarge() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(::libvpx_test::kRealTime);
}
- virtual bool HandleDecodeResult(const vpx_codec_err_t res_dec,
- const libvpx_test::VideoSource & /*video*/,
- libvpx_test::Decoder *decoder) {
+ bool HandleDecodeResult(const vpx_codec_err_t res_dec,
+ const libvpx_test::VideoSource & /*video*/,
+ libvpx_test::Decoder *decoder) override {
EXPECT_EQ(expected_res_, res_dec) << decoder->DecodeError();
return !::testing::Test::HasFailure();
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP8E_SET_CPUUSED, 7);
encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
diff --git a/test/hadamard_test.cc b/test/hadamard_test.cc
index f904e814a..b22bae87c 100644
--- a/test/hadamard_test.cc
+++ b/test/hadamard_test.cc
@@ -130,13 +130,19 @@ std::ostream &operator<<(std::ostream &os, const HadamardFuncWithSize &hfs) {
class HadamardTestBase : public ::testing::TestWithParam<HadamardFuncWithSize> {
public:
- virtual void SetUp() {
+ void SetUp() override {
h_func_ = GetParam().func;
bwh_ = GetParam().block_size;
block_size_ = bwh_ * bwh_;
rnd_.Reset(ACMRandom::DeterministicSeed());
}
+ // The Rand() function generates values in the range [-((1 << BitDepth) - 1),
+ // (1 << BitDepth) - 1]. This is because the input to the Hadamard transform
+ // is the residual pixel, which is defined as 'source pixel - predicted
+ // pixel'. Source pixel and predicted pixel take values in the range
+ // [0, (1 << BitDepth) - 1] and thus the residual pixel ranges from
+ // -((1 << BitDepth) - 1) to ((1 << BitDepth) - 1).
virtual int16_t Rand() = 0;
void ReferenceHadamard(const int16_t *a, int a_stride, tran_low_t *b,
@@ -170,6 +176,31 @@ class HadamardTestBase : public ::testing::TestWithParam<HadamardFuncWithSize> {
EXPECT_EQ(0, memcmp(b, b_ref, sizeof(b)));
}
+ void ExtremeValuesTest() {
+ const int kMaxBlockSize = 32 * 32;
+ DECLARE_ALIGNED(16, int16_t, input_extreme_block[kMaxBlockSize]);
+ DECLARE_ALIGNED(16, tran_low_t, b[kMaxBlockSize]);
+ memset(b, 0, sizeof(b));
+
+ tran_low_t b_ref[kMaxBlockSize];
+ memset(b_ref, 0, sizeof(b_ref));
+
+ for (int i = 0; i < 2; ++i) {
+ // Initialize a test block with input range [-mask_, mask_].
+ const int sign = (i == 0) ? 1 : -1;
+ for (int j = 0; j < kMaxBlockSize; ++j)
+ input_extreme_block[j] = sign * 255;
+
+ ReferenceHadamard(input_extreme_block, bwh_, b_ref, bwh_);
+ ASM_REGISTER_STATE_CHECK(h_func_(input_extreme_block, bwh_, b));
+
+ // The order of the output is not important. Sort before checking.
+ std::sort(b, b + block_size_);
+ std::sort(b_ref, b_ref + block_size_);
+ EXPECT_EQ(0, memcmp(b, b_ref, sizeof(b)));
+ }
+ }
+
void VaryStride() {
const int kMaxBlockSize = 32 * 32;
DECLARE_ALIGNED(16, int16_t, a[kMaxBlockSize * 8]);
@@ -220,11 +251,18 @@ class HadamardTestBase : public ::testing::TestWithParam<HadamardFuncWithSize> {
class HadamardLowbdTest : public HadamardTestBase {
protected:
- virtual int16_t Rand() { return rnd_.Rand9Signed(); }
+ // Use values between -255 (0xFF01) and 255 (0x00FF)
+ int16_t Rand() override {
+ int16_t src = rnd_.Rand8();
+ int16_t pred = rnd_.Rand8();
+ return src - pred;
+ }
};
TEST_P(HadamardLowbdTest, CompareReferenceRandom) { CompareReferenceRandom(); }
+TEST_P(HadamardLowbdTest, ExtremeValuesTest) { ExtremeValuesTest(); }
+
TEST_P(HadamardLowbdTest, VaryStride) { VaryStride(); }
TEST_P(HadamardLowbdTest, DISABLED_Speed) {
@@ -296,7 +334,12 @@ INSTANTIATE_TEST_SUITE_P(
#if CONFIG_VP9_HIGHBITDEPTH
class HadamardHighbdTest : public HadamardTestBase {
protected:
- virtual int16_t Rand() { return rnd_.Rand13Signed(); }
+ // Use values between -4095 (0xF001) and 4095 (0x0FFF)
+ int16_t Rand() override {
+ int16_t src = rnd_.Rand12();
+ int16_t pred = rnd_.Rand12();
+ return src - pred;
+ }
};
TEST_P(HadamardHighbdTest, CompareReferenceRandom) { CompareReferenceRandom(); }
@@ -324,5 +367,14 @@ INSTANTIATE_TEST_SUITE_P(
32)));
#endif // HAVE_AVX2
+#if HAVE_NEON
+INSTANTIATE_TEST_SUITE_P(
+ NEON, HadamardHighbdTest,
+ ::testing::Values(HadamardFuncWithSize(&vpx_highbd_hadamard_8x8_neon, 8),
+ HadamardFuncWithSize(&vpx_highbd_hadamard_16x16_neon, 16),
+ HadamardFuncWithSize(&vpx_highbd_hadamard_32x32_neon,
+ 32)));
+#endif
+
#endif // CONFIG_VP9_HIGHBITDEPTH
} // namespace
diff --git a/test/idct_test.cc b/test/idct_test.cc
index 1b9532e1c..279e58e2a 100644
--- a/test/idct_test.cc
+++ b/test/idct_test.cc
@@ -27,7 +27,7 @@ using libvpx_test::Buffer;
class IDCTTest : public ::testing::TestWithParam<IdctFunc> {
protected:
- virtual void SetUp() {
+ void SetUp() override {
UUT = GetParam();
input = new Buffer<int16_t>(4, 4, 0);
@@ -41,7 +41,7 @@ class IDCTTest : public ::testing::TestWithParam<IdctFunc> {
ASSERT_TRUE(output->Init());
}
- virtual void TearDown() {
+ void TearDown() override {
delete input;
delete predict;
delete output;
diff --git a/test/init_vpx_test.cc b/test/init_vpx_test.cc
new file mode 100644
index 000000000..f66f00b5c
--- /dev/null
+++ b/test/init_vpx_test.cc
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2023 The WebM project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "test/init_vpx_test.h"
+
+#include "./vpx_config.h"
+
+#if !CONFIG_SHARED
+#include <string>
+#include "third_party/googletest/src/include/gtest/gtest.h"
+#if VPX_ARCH_ARM
+#include "vpx_ports/arm.h"
+#endif
+#if VPX_ARCH_X86 || VPX_ARCH_X86_64
+#include "vpx_ports/x86.h"
+#endif
+extern "C" {
+#if CONFIG_VP8
+extern void vp8_rtcd();
+#endif // CONFIG_VP8
+#if CONFIG_VP9
+extern void vp9_rtcd();
+#endif // CONFIG_VP9
+extern void vpx_dsp_rtcd();
+extern void vpx_scale_rtcd();
+}
+
+#if VPX_ARCH_ARM || VPX_ARCH_X86 || VPX_ARCH_X86_64
+static void append_negative_gtest_filter(const char *str) {
+ std::string filter = GTEST_FLAG_GET(filter);
+ // Negative patterns begin with one '-' followed by a ':' separated list.
+ if (filter.find('-') == std::string::npos) filter += '-';
+ filter += str;
+ GTEST_FLAG_SET(filter, filter);
+}
+#endif // VPX_ARCH_ARM || VPX_ARCH_X86 || VPX_ARCH_X86_64
+#endif // !CONFIG_SHARED
+
+namespace libvpx_test {
+void init_vpx_test() {
+#if !CONFIG_SHARED
+#if VPX_ARCH_AARCH64
+ const int caps = arm_cpu_caps();
+ if (!(caps & HAS_NEON_DOTPROD)) {
+ append_negative_gtest_filter(":NEON_DOTPROD.*:NEON_DOTPROD/*");
+ }
+ if (!(caps & HAS_NEON_I8MM)) {
+ append_negative_gtest_filter(":NEON_I8MM.*:NEON_I8MM/*");
+ }
+ if (!(caps & HAS_SVE)) {
+ append_negative_gtest_filter(":SVE.*:SVE/*");
+ }
+#elif VPX_ARCH_ARM
+ const int caps = arm_cpu_caps();
+ if (!(caps & HAS_NEON)) append_negative_gtest_filter(":NEON.*:NEON/*");
+#endif // VPX_ARCH_ARM
+
+#if VPX_ARCH_X86 || VPX_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_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_AVX512)) {
+ append_negative_gtest_filter(":AVX512.*:AVX512/*");
+ }
+#endif // VPX_ARCH_X86 || VPX_ARCH_X86_64
+
+ // Shared library builds don't support whitebox tests that exercise internal
+ // symbols.
+#if CONFIG_VP8
+ vp8_rtcd();
+#endif // CONFIG_VP8
+#if CONFIG_VP9
+ vp9_rtcd();
+#endif // CONFIG_VP9
+ vpx_dsp_rtcd();
+ vpx_scale_rtcd();
+#endif // !CONFIG_SHARED
+}
+} // namespace libvpx_test
diff --git a/test/init_vpx_test.h b/test/init_vpx_test.h
new file mode 100644
index 000000000..5e0dbb0e7
--- /dev/null
+++ b/test/init_vpx_test.h
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2023 The WebM project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef TEST_INIT_VPX_TEST_H_
+#define TEST_INIT_VPX_TEST_H_
+
+namespace libvpx_test {
+void init_vpx_test();
+}
+
+#endif // TEST_INIT_VPX_TEST_H_
diff --git a/test/invalid_file_test.cc b/test/invalid_file_test.cc
index 762d585f5..c37dc0d48 100644
--- a/test/invalid_file_test.cc
+++ b/test/invalid_file_test.cc
@@ -40,7 +40,7 @@ class InvalidFileTest : public ::libvpx_test::DecoderTest,
protected:
InvalidFileTest() : DecoderTest(GET_PARAM(0)), res_file_(nullptr) {}
- virtual ~InvalidFileTest() {
+ ~InvalidFileTest() override {
if (res_file_ != nullptr) fclose(res_file_);
}
@@ -50,10 +50,9 @@ class InvalidFileTest : public ::libvpx_test::DecoderTest,
<< "Result file open failed. Filename: " << res_file_name_;
}
- virtual bool HandleDecodeResult(
- const vpx_codec_err_t res_dec,
- const libvpx_test::CompressedVideoSource &video,
- libvpx_test::Decoder *decoder) {
+ bool HandleDecodeResult(const vpx_codec_err_t res_dec,
+ const libvpx_test::CompressedVideoSource &video,
+ libvpx_test::Decoder *decoder) override {
EXPECT_NE(res_file_, nullptr);
int expected_res_dec;
@@ -172,9 +171,9 @@ VP9_INSTANTIATE_TEST_SUITE(InvalidFileTest,
class InvalidFileInvalidPeekTest : public InvalidFileTest {
protected:
InvalidFileInvalidPeekTest() : InvalidFileTest() {}
- virtual void HandlePeekResult(libvpx_test::Decoder *const /*decoder*/,
- libvpx_test::CompressedVideoSource * /*video*/,
- const vpx_codec_err_t /*res_peek*/) {}
+ void HandlePeekResult(libvpx_test::Decoder *const /*decoder*/,
+ libvpx_test::CompressedVideoSource * /*video*/,
+ const vpx_codec_err_t /*res_peek*/) override {}
};
TEST_P(InvalidFileInvalidPeekTest, ReturnCode) { RunTest(); }
diff --git a/test/ivf_video_source.h b/test/ivf_video_source.h
index a8ac4f154..3ccac62b5 100644
--- a/test/ivf_video_source.h
+++ b/test/ivf_video_source.h
@@ -33,19 +33,19 @@ class IVFVideoSource : public CompressedVideoSource {
compressed_frame_buf_(nullptr), frame_sz_(0), frame_(0),
end_of_file_(false) {}
- virtual ~IVFVideoSource() {
+ ~IVFVideoSource() override {
delete[] compressed_frame_buf_;
if (input_file_) fclose(input_file_);
}
- virtual void Init() {
+ void Init() override {
// Allocate a buffer for read in the compressed video frame.
compressed_frame_buf_ = new uint8_t[libvpx_test::kCodeBufferSize];
ASSERT_NE(compressed_frame_buf_, nullptr) << "Allocate frame buffer failed";
}
- virtual void Begin() {
+ void Begin() override {
input_file_ = OpenTestDataFile(file_name_);
ASSERT_NE(input_file_, nullptr)
<< "Input file open failed. Filename: " << file_name_;
@@ -62,7 +62,7 @@ class IVFVideoSource : public CompressedVideoSource {
FillFrame();
}
- virtual void Next() {
+ void Next() override {
++frame_;
FillFrame();
}
@@ -86,11 +86,11 @@ class IVFVideoSource : public CompressedVideoSource {
}
}
- virtual const uint8_t *cxdata() const {
+ const uint8_t *cxdata() const override {
return end_of_file_ ? nullptr : compressed_frame_buf_;
}
- virtual size_t frame_size() const { return frame_sz_; }
- virtual unsigned int frame_number() const { return frame_; }
+ size_t frame_size() const override { return frame_sz_; }
+ unsigned int frame_number() const override { return frame_; }
protected:
std::string file_name_;
diff --git a/test/keyframe_test.cc b/test/keyframe_test.cc
index a13dec9ce..5292bb188 100644
--- a/test/keyframe_test.cc
+++ b/test/keyframe_test.cc
@@ -8,12 +8,18 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <climits>
+#include <cstring>
#include <vector>
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "test/codec_factory.h"
#include "test/encode_test_driver.h"
#include "test/i420_video_source.h"
#include "test/util.h"
+#include "./vpx_config.h"
+#include "vpx/vp8cx.h"
+#include "vpx/vpx_codec.h"
+#include "vpx/vpx_encoder.h"
+#include "vpx/vpx_image.h"
namespace {
@@ -22,9 +28,9 @@ class KeyframeTest
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
protected:
KeyframeTest() : EncoderTest(GET_PARAM(0)) {}
- virtual ~KeyframeTest() {}
+ ~KeyframeTest() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(GET_PARAM(1));
kf_count_ = 0;
@@ -33,8 +39,8 @@ class KeyframeTest
set_cpu_used_ = 0;
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (kf_do_force_kf_) {
frame_flags_ = (video->frame() % 3) ? 0 : VPX_EFLAG_FORCE_KF;
}
@@ -43,7 +49,7 @@ class KeyframeTest
}
}
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) {
kf_pts_list_.push_back(pkt->data.frame.pts);
kf_count_++;
@@ -146,4 +152,105 @@ TEST_P(KeyframeTest, TestAutoKeyframe) {
}
VP8_INSTANTIATE_TEST_SUITE(KeyframeTest, ALL_TEST_MODES);
+
+bool IsVP9(vpx_codec_iface_t *iface) {
+ static const char kVP9Name[] = "WebM Project VP9";
+ return strncmp(kVP9Name, vpx_codec_iface_name(iface), sizeof(kVP9Name) - 1) ==
+ 0;
+}
+
+vpx_image_t *CreateGrayImage(vpx_img_fmt_t fmt, unsigned int w,
+ unsigned int h) {
+ vpx_image_t *const image = vpx_img_alloc(nullptr, fmt, w, h, 1);
+ if (!image) return image;
+
+ for (unsigned int i = 0; i < image->d_h; ++i) {
+ memset(image->planes[0] + i * image->stride[0], 128, image->d_w);
+ }
+ const unsigned int uv_h = (image->d_h + 1) / 2;
+ const unsigned int uv_w = (image->d_w + 1) / 2;
+ for (unsigned int i = 0; i < uv_h; ++i) {
+ memset(image->planes[1] + i * image->stride[1], 128, uv_w);
+ memset(image->planes[2] + i * image->stride[2], 128, uv_w);
+ }
+ return image;
+}
+
+// Tests kf_max_dist in one-pass encoding with zero lag.
+void TestKeyframeMaximumInterval(vpx_codec_iface_t *iface,
+ unsigned long deadline,
+ unsigned int kf_max_dist) {
+ vpx_codec_enc_cfg_t cfg;
+ ASSERT_EQ(vpx_codec_enc_config_default(iface, &cfg, /*usage=*/0),
+ VPX_CODEC_OK);
+ cfg.g_w = 320;
+ cfg.g_h = 240;
+ cfg.g_pass = VPX_RC_ONE_PASS;
+ cfg.g_lag_in_frames = 0;
+ cfg.kf_mode = VPX_KF_AUTO;
+ cfg.kf_min_dist = 0;
+ cfg.kf_max_dist = kf_max_dist;
+
+ vpx_codec_ctx_t enc;
+ ASSERT_EQ(vpx_codec_enc_init(&enc, iface, &cfg, 0), VPX_CODEC_OK);
+
+ const int speed = IsVP9(iface) ? 9 : -12;
+ ASSERT_EQ(vpx_codec_control(&enc, VP8E_SET_CPUUSED, speed), VPX_CODEC_OK);
+
+ vpx_image_t *image = CreateGrayImage(VPX_IMG_FMT_I420, cfg.g_w, cfg.g_h);
+ ASSERT_NE(image, nullptr);
+
+ // Encode frames.
+ const vpx_codec_cx_pkt_t *pkt;
+ const unsigned int num_frames = kf_max_dist == 0 ? 4 : 3 * kf_max_dist + 1;
+ for (unsigned int i = 0; i < num_frames; ++i) {
+ ASSERT_EQ(vpx_codec_encode(&enc, image, i, 1, 0, deadline), VPX_CODEC_OK);
+ vpx_codec_iter_t iter = nullptr;
+ while ((pkt = vpx_codec_get_cx_data(&enc, &iter)) != nullptr) {
+ ASSERT_EQ(pkt->kind, VPX_CODEC_CX_FRAME_PKT);
+ if (kf_max_dist == 0 || i % kf_max_dist == 0) {
+ ASSERT_EQ(pkt->data.frame.flags & VPX_FRAME_IS_KEY, VPX_FRAME_IS_KEY);
+ } else {
+ ASSERT_EQ(pkt->data.frame.flags & VPX_FRAME_IS_KEY, 0u);
+ }
+ }
+ }
+
+ // Flush the encoder.
+ bool got_data;
+ do {
+ ASSERT_EQ(vpx_codec_encode(&enc, nullptr, 0, 1, 0, deadline), VPX_CODEC_OK);
+ got_data = false;
+ vpx_codec_iter_t iter = nullptr;
+ while ((pkt = vpx_codec_get_cx_data(&enc, &iter)) != nullptr) {
+ ASSERT_EQ(pkt->kind, VPX_CODEC_CX_FRAME_PKT);
+ got_data = true;
+ }
+ } while (got_data);
+
+ vpx_img_free(image);
+ ASSERT_EQ(vpx_codec_destroy(&enc), VPX_CODEC_OK);
+}
+
+TEST(KeyframeIntervalTest, KeyframeMaximumInterval) {
+ std::vector<vpx_codec_iface_t *> ifaces;
+#if CONFIG_VP8_ENCODER
+ ifaces.push_back(vpx_codec_vp8_cx());
+#endif
+#if CONFIG_VP9_ENCODER
+ ifaces.push_back(vpx_codec_vp9_cx());
+#endif
+ for (vpx_codec_iface_t *iface : ifaces) {
+ for (unsigned long deadline :
+ { VPX_DL_REALTIME, VPX_DL_GOOD_QUALITY, VPX_DL_BEST_QUALITY }) {
+ // Test 0 and 1 (both mean all intra), some powers of 2, some multiples
+ // of 10, and some prime numbers.
+ for (unsigned int kf_max_dist :
+ { 0, 1, 2, 3, 4, 7, 10, 13, 16, 20, 23, 29, 32 }) {
+ TestKeyframeMaximumInterval(iface, deadline, kf_max_dist);
+ }
+ }
+ }
+}
+
} // namespace
diff --git a/test/level_test.cc b/test/level_test.cc
index 038d75f44..36cfd645c 100644
--- a/test/level_test.cc
+++ b/test/level_test.cc
@@ -22,9 +22,9 @@ class LevelTest
: 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() {}
+ ~LevelTest() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(encoding_mode_);
if (encoding_mode_ != ::libvpx_test::kRealTime) {
@@ -41,8 +41,8 @@ class LevelTest
cfg_.rc_min_quantizer = 0;
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP8E_SET_CPUUSED, cpu_used_);
encoder->Control(VP9E_SET_TARGET_LEVEL, target_level_);
@@ -120,7 +120,7 @@ TEST_P(LevelTest, TestTargetLevel255) {
TEST_P(LevelTest, TestTargetLevelApi) {
::libvpx_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0, 1);
- static const vpx_codec_iface_t *codec = &vpx_codec_vp9_cx_algo;
+ static vpx_codec_iface_t *codec = &vpx_codec_vp9_cx_algo;
vpx_codec_ctx_t enc;
vpx_codec_enc_cfg_t cfg;
EXPECT_EQ(VPX_CODEC_OK, vpx_codec_enc_config_default(codec, &cfg, 0));
diff --git a/test/lpf_test.cc b/test/lpf_test.cc
index 4cc99a6db..ce0ddeae1 100644
--- a/test/lpf_test.cc
+++ b/test/lpf_test.cc
@@ -129,15 +129,15 @@ uint8_t GetHevThresh(ACMRandom *rnd) {
class Loop8Test6Param : public ::testing::TestWithParam<loop8_param_t> {
public:
- virtual ~Loop8Test6Param() {}
- virtual void SetUp() {
+ ~Loop8Test6Param() override = default;
+ void SetUp() override {
loopfilter_op_ = GET_PARAM(0);
ref_loopfilter_op_ = GET_PARAM(1);
bit_depth_ = GET_PARAM(2);
mask_ = (1 << bit_depth_) - 1;
}
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
+ void TearDown() override { libvpx_test::ClearSystemState(); }
protected:
int bit_depth_;
@@ -151,15 +151,15 @@ GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(Loop8Test6Param);
(HAVE_DSPR2 || HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH)
class Loop8Test9Param : public ::testing::TestWithParam<dualloop8_param_t> {
public:
- virtual ~Loop8Test9Param() {}
- virtual void SetUp() {
+ ~Loop8Test9Param() override = default;
+ void SetUp() override {
loopfilter_op_ = GET_PARAM(0);
ref_loopfilter_op_ = GET_PARAM(1);
bit_depth_ = GET_PARAM(2);
mask_ = (1 << bit_depth_) - 1;
}
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
+ void TearDown() override { libvpx_test::ClearSystemState(); }
protected:
int bit_depth_;
diff --git a/test/minmax_test.cc b/test/minmax_test.cc
index 12327bc18..b49570906 100644
--- a/test/minmax_test.cc
+++ b/test/minmax_test.cc
@@ -15,6 +15,7 @@
#include "./vpx_dsp_rtcd.h"
#include "vpx/vpx_integer.h"
+#include "vpx_mem/vpx_mem.h"
#include "test/acm_random.h"
#include "test/register_state_check.h"
@@ -28,7 +29,7 @@ typedef void (*MinMaxFunc)(const uint8_t *a, int a_stride, const uint8_t *b,
class MinMaxTest : public ::testing::TestWithParam<MinMaxFunc> {
public:
- virtual void SetUp() {
+ void SetUp() override {
mm_func_ = GetParam();
rnd_.Reset(ACMRandom::DeterministicSeed());
}
@@ -115,7 +116,115 @@ TEST_P(MinMaxTest, CompareReferenceAndVaryStride) {
}
}
+#if CONFIG_VP9_HIGHBITDEPTH
+
+using HBDMinMaxTest = MinMaxTest;
+
+void highbd_reference_minmax(const uint8_t *a, int a_stride, const uint8_t *b,
+ int b_stride, int *min_ret, int *max_ret) {
+ int min = 65535;
+ int max = 0;
+ const uint16_t *a_ptr = CONVERT_TO_SHORTPTR(a);
+ const uint16_t *b_ptr = CONVERT_TO_SHORTPTR(b);
+ for (int i = 0; i < 8; i++) {
+ for (int j = 0; j < 8; j++) {
+ const int diff = abs(a_ptr[i * a_stride + j] - b_ptr[i * b_stride + j]);
+ if (min > diff) min = diff;
+ if (max < diff) max = diff;
+ }
+ }
+
+ *min_ret = min;
+ *max_ret = max;
+}
+
+TEST_P(HBDMinMaxTest, MinValue) {
+ uint8_t *a = CONVERT_TO_BYTEPTR(
+ reinterpret_cast<uint16_t *>(vpx_malloc(64 * sizeof(uint16_t))));
+ uint8_t *b = CONVERT_TO_BYTEPTR(
+ reinterpret_cast<uint16_t *>(vpx_malloc(64 * sizeof(uint16_t))));
+ for (int i = 0; i < 64; i++) {
+ vpx_memset16(CONVERT_TO_SHORTPTR(a), 0, 64);
+ vpx_memset16(CONVERT_TO_SHORTPTR(b), 65535, 64);
+ CONVERT_TO_SHORTPTR(b)[i] = i; // Set a minimum difference of i.
+
+ int min, max;
+ ASM_REGISTER_STATE_CHECK(mm_func_(a, 8, b, 8, &min, &max));
+ EXPECT_EQ(65535, max);
+ EXPECT_EQ(i, min);
+ }
+ vpx_free(CONVERT_TO_SHORTPTR(a));
+ vpx_free(CONVERT_TO_SHORTPTR(b));
+}
+
+TEST_P(HBDMinMaxTest, MaxValue) {
+ uint8_t *a = CONVERT_TO_BYTEPTR(
+ reinterpret_cast<uint16_t *>(vpx_malloc(64 * sizeof(uint16_t))));
+ uint8_t *b = CONVERT_TO_BYTEPTR(
+ reinterpret_cast<uint16_t *>(vpx_malloc(64 * sizeof(uint16_t))));
+ for (int i = 0; i < 64; i++) {
+ vpx_memset16(CONVERT_TO_SHORTPTR(a), 0, 64);
+ vpx_memset16(CONVERT_TO_SHORTPTR(b), 0, 64);
+ CONVERT_TO_SHORTPTR(b)[i] = i; // Set a minimum difference of i.
+
+ int min, max;
+ ASM_REGISTER_STATE_CHECK(mm_func_(a, 8, b, 8, &min, &max));
+ EXPECT_EQ(i, max);
+ EXPECT_EQ(0, min);
+ }
+ vpx_free(CONVERT_TO_SHORTPTR(a));
+ vpx_free(CONVERT_TO_SHORTPTR(b));
+}
+
+TEST_P(HBDMinMaxTest, CompareReference) {
+ uint8_t *a = CONVERT_TO_BYTEPTR(
+ reinterpret_cast<uint16_t *>(vpx_malloc(64 * sizeof(uint16_t))));
+ uint8_t *b = CONVERT_TO_BYTEPTR(
+ reinterpret_cast<uint16_t *>(vpx_malloc(64 * sizeof(uint16_t))));
+ for (int j = 0; j < 64; j++) {
+ CONVERT_TO_SHORTPTR(a)[j] = rnd_.Rand16();
+ CONVERT_TO_SHORTPTR(b)[j] = rnd_.Rand16();
+ }
+
+ int min_ref, max_ref, min, max;
+ highbd_reference_minmax(a, 8, b, 8, &min_ref, &max_ref);
+ ASM_REGISTER_STATE_CHECK(mm_func_(a, 8, b, 8, &min, &max));
+ vpx_free(CONVERT_TO_SHORTPTR(a));
+ vpx_free(CONVERT_TO_SHORTPTR(b));
+ EXPECT_EQ(max_ref, max);
+ EXPECT_EQ(min_ref, min);
+}
+
+TEST_P(HBDMinMaxTest, CompareReferenceAndVaryStride) {
+ uint8_t *a = CONVERT_TO_BYTEPTR(
+ reinterpret_cast<uint16_t *>(vpx_malloc((8 * 64) * sizeof(uint16_t))));
+ uint8_t *b = CONVERT_TO_BYTEPTR(
+ reinterpret_cast<uint16_t *>(vpx_malloc((8 * 64) * sizeof(uint16_t))));
+ for (int i = 0; i < 8 * 64; i++) {
+ CONVERT_TO_SHORTPTR(a)[i] = rnd_.Rand16();
+ CONVERT_TO_SHORTPTR(b)[i] = rnd_.Rand16();
+ }
+ for (int a_stride = 8; a_stride <= 64; a_stride += 8) {
+ for (int b_stride = 8; b_stride <= 64; b_stride += 8) {
+ int min_ref, max_ref, min, max;
+ highbd_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;
+ EXPECT_EQ(min_ref, min)
+ << "when a_stride = " << a_stride << " and b_stride = " << b_stride;
+ }
+ }
+ vpx_free(CONVERT_TO_SHORTPTR(a));
+ vpx_free(CONVERT_TO_SHORTPTR(b));
+}
+#endif
+
INSTANTIATE_TEST_SUITE_P(C, MinMaxTest, ::testing::Values(&vpx_minmax_8x8_c));
+#if CONFIG_VP9_HIGHBITDEPTH
+INSTANTIATE_TEST_SUITE_P(C, HBDMinMaxTest,
+ ::testing::Values(&vpx_highbd_minmax_8x8_c));
+#endif
#if HAVE_SSE2
INSTANTIATE_TEST_SUITE_P(SSE2, MinMaxTest,
@@ -125,6 +234,10 @@ INSTANTIATE_TEST_SUITE_P(SSE2, MinMaxTest,
#if HAVE_NEON
INSTANTIATE_TEST_SUITE_P(NEON, MinMaxTest,
::testing::Values(&vpx_minmax_8x8_neon));
+#if CONFIG_VP9_HIGHBITDEPTH
+INSTANTIATE_TEST_SUITE_P(NEON, HBDMinMaxTest,
+ ::testing::Values(&vpx_highbd_minmax_8x8_neon));
+#endif
#endif
#if HAVE_MSA
diff --git a/test/partial_idct_test.cc b/test/partial_idct_test.cc
index 7eb888a58..01e63eb69 100644
--- a/test/partial_idct_test.cc
+++ b/test/partial_idct_test.cc
@@ -59,8 +59,8 @@ const int kCountTestBlock = 1000;
class PartialIDctTest : public ::testing::TestWithParam<PartialInvTxfmParam> {
public:
- virtual ~PartialIDctTest() {}
- virtual void SetUp() {
+ ~PartialIDctTest() override = default;
+ void SetUp() override {
rnd_.Reset(ACMRandom::DeterministicSeed());
fwd_txfm_ = GET_PARAM(0);
full_inv_txfm_ = GET_PARAM(1);
@@ -76,7 +76,7 @@ class PartialIDctTest : public ::testing::TestWithParam<PartialInvTxfmParam> {
case TX_8X8: size_ = 8; break;
case TX_16X16: size_ = 16; break;
case TX_32X32: size_ = 32; break;
- default: FAIL() << "Wrong Size!"; break;
+ default: FAIL() << "Wrong Size!";
}
// Randomize stride_ to a value less than or equal to 1024
@@ -100,7 +100,7 @@ class PartialIDctTest : public ::testing::TestWithParam<PartialInvTxfmParam> {
vpx_memalign(16, pixel_size_ * output_block_size_));
}
- virtual void TearDown() {
+ void TearDown() override {
vpx_free(input_block_);
input_block_ = nullptr;
vpx_free(output_block_);
diff --git a/test/pp_filter_test.cc b/test/pp_filter_test.cc
index 27d5ffa90..d2db8a7c7 100644
--- a/test/pp_filter_test.cc
+++ b/test/pp_filter_test.cc
@@ -51,10 +51,10 @@ class VpxPostProcDownAndAcrossMbRowTest
public:
VpxPostProcDownAndAcrossMbRowTest()
: mb_post_proc_down_and_across_(GetParam()) {}
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
+ void TearDown() override { libvpx_test::ClearSystemState(); }
protected:
- virtual void Run();
+ void Run() override;
const VpxPostProcDownAndAcrossMbRowFunc mb_post_proc_down_and_across_;
// Size of the underlying data block that will be filtered.
@@ -227,10 +227,10 @@ class VpxMbPostProcAcrossIpTest
VpxMbPostProcAcrossIpTest()
: rows_(16), cols_(16), mb_post_proc_across_ip_(GetParam()),
src_(Buffer<uint8_t>(rows_, cols_, 8, 8, 17, 8)) {}
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
+ void TearDown() override { libvpx_test::ClearSystemState(); }
protected:
- virtual void Run();
+ void Run() override;
void SetCols(unsigned char *s, int rows, int cols, int src_width) {
for (int r = 0; r < rows; r++) {
@@ -356,10 +356,10 @@ class VpxMbPostProcDownTest
: rows_(16), cols_(16), mb_post_proc_down_(GetParam()),
src_c_(Buffer<uint8_t>(rows_, cols_, 8, 8, 8, 17)) {}
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
+ void TearDown() override { libvpx_test::ClearSystemState(); }
protected:
- virtual void Run();
+ void Run() override;
void SetRows(unsigned char *src_c, int rows, int cols, int src_width) {
for (int r = 0; r < rows; r++) {
diff --git a/test/predict_test.cc b/test/predict_test.cc
index 747297057..474eab2cb 100644
--- a/test/predict_test.cc
+++ b/test/predict_test.cc
@@ -43,7 +43,7 @@ class PredictTestBase : public AbstractBench,
: width_(GET_PARAM(0)), height_(GET_PARAM(1)), predict_(GET_PARAM(2)),
src_(nullptr), padded_dst_(nullptr), dst_(nullptr), dst_c_(nullptr) {}
- virtual void SetUp() {
+ void SetUp() override {
src_ = new uint8_t[kSrcSize];
ASSERT_NE(src_, nullptr);
@@ -64,7 +64,7 @@ class PredictTestBase : public AbstractBench,
memset(dst_c_, 0, 16 * 16);
}
- virtual void TearDown() {
+ void TearDown() override {
delete[] src_;
src_ = nullptr;
vpx_free(padded_dst_);
@@ -209,7 +209,7 @@ class PredictTestBase : public AbstractBench,
}
}
- void Run() {
+ void Run() override {
for (int xoffset = 0; xoffset < 8; ++xoffset) {
for (int yoffset = 0; yoffset < 8; ++yoffset) {
if (xoffset == 0 && yoffset == 0) {
@@ -350,6 +350,14 @@ INSTANTIATE_TEST_SUITE_P(
make_tuple(4, 4, &vp8_sixtap_predict4x4_mmi)));
#endif
+#if HAVE_LSX
+INSTANTIATE_TEST_SUITE_P(
+ LSX, SixtapPredictTest,
+ ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_lsx),
+ make_tuple(8, 8, &vp8_sixtap_predict8x8_lsx),
+ make_tuple(4, 4, &vp8_sixtap_predict4x4_lsx)));
+#endif
+
class BilinearPredictTest : public PredictTestBase {};
TEST_P(BilinearPredictTest, TestWithRandomData) {
diff --git a/test/quantize_test.cc b/test/quantize_test.cc
index 57309e810..ab38f5c1b 100644
--- a/test/quantize_test.cc
+++ b/test/quantize_test.cc
@@ -121,13 +121,13 @@ class QuantizeTest : public QuantizeTestBase,
public ::testing::TestWithParam<VP8QuantizeParam>,
public AbstractBench {
protected:
- virtual void SetUp() {
+ void SetUp() override {
SetupCompressor();
asm_quant_ = GET_PARAM(0);
c_quant_ = GET_PARAM(1);
}
- virtual void Run() {
+ void Run() override {
asm_quant_(&vp8_comp_->mb.block[0], &macroblockd_dst_->block[0]);
}
diff --git a/test/realtime_test.cc b/test/realtime_test.cc
index c5de2dcb3..a9870b3cb 100644
--- a/test/realtime_test.cc
+++ b/test/realtime_test.cc
@@ -26,7 +26,7 @@ class RealtimeTest
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
protected:
RealtimeTest() : EncoderTest(GET_PARAM(0)), frame_packets_(0) {}
- ~RealtimeTest() override {}
+ ~RealtimeTest() override = default;
void SetUp() override {
InitializeConfig();
@@ -95,7 +95,7 @@ TEST_P(RealtimeTest, IntegerOverflow) { TestIntegerOverflow(2048, 2048); }
TEST_P(RealtimeTest, IntegerOverflowLarge) {
if (IsVP9()) {
-#if VPX_ARCH_X86_64
+#if VPX_ARCH_AARCH64 || VPX_ARCH_X86_64
TestIntegerOverflow(16384, 16384);
#else
TestIntegerOverflow(4096, 4096);
diff --git a/test/register_state_check.h b/test/register_state_check.h
index 0b837dd04..ede86ef52 100644
--- a/test/register_state_check.h
+++ b/test/register_state_check.h
@@ -184,13 +184,13 @@ 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); \
- } \
- __asm__ volatile("" ::: "memory"); \
+#define API_REGISTER_STATE_CHECK(statement) \
+ do { \
+ { \
+ libvpx_test::RegisterStateCheckMMX reg_check_mmx; \
+ ASM_REGISTER_STATE_CHECK(statement); \
+ } \
+ __asm__ volatile("" ::: "memory"); \
} while (false)
} // namespace libvpx_test
diff --git a/test/resize_test.cc b/test/resize_test.cc
index d9420a454..20ad2229b 100644
--- a/test/resize_test.cc
+++ b/test/resize_test.cc
@@ -244,10 +244,10 @@ class ResizingVideoSource : public ::libvpx_test::DummyVideoSource {
}
bool flag_codec_;
bool smaller_width_larger_size_;
- virtual ~ResizingVideoSource() {}
+ ~ResizingVideoSource() override = default;
protected:
- virtual void Next() {
+ void Next() override {
++frame_;
unsigned int width = 0;
unsigned int height = 0;
@@ -264,14 +264,14 @@ class ResizeTest
protected:
ResizeTest() : EncoderTest(GET_PARAM(0)) {}
- virtual ~ResizeTest() {}
+ ~ResizeTest() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(GET_PARAM(1));
}
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
ASSERT_NE(static_cast<int>(pkt->data.frame.width[0]), 0);
ASSERT_NE(static_cast<int>(pkt->data.frame.height[0]), 0);
encode_frame_width_.push_back(pkt->data.frame.width[0]);
@@ -286,8 +286,8 @@ class ResizeTest
return encode_frame_height_[idx];
}
- virtual void DecompressedFrameHook(const vpx_image_t &img,
- vpx_codec_pts_t pts) {
+ void DecompressedFrameHook(const vpx_image_t &img,
+ vpx_codec_pts_t pts) override {
frame_info_list_.push_back(FrameInfo(pts, img.d_w, img.d_h));
}
@@ -333,15 +333,15 @@ class ResizeInternalTest : public ResizeTest {
ResizeInternalTest() : ResizeTest(), frame0_psnr_(0.0) {}
#endif
- virtual ~ResizeInternalTest() {}
+ ~ResizeInternalTest() override = default;
- virtual void BeginPassHook(unsigned int /*pass*/) {
+ void BeginPassHook(unsigned int /*pass*/) override {
#if WRITE_COMPRESSED_STREAM
outfile_ = fopen("vp90-2-05-resize.ivf", "wb");
#endif
}
- virtual void EndPassHook() {
+ void EndPassHook() override {
#if WRITE_COMPRESSED_STREAM
if (outfile_) {
if (!fseek(outfile_, 0, SEEK_SET))
@@ -352,8 +352,8 @@ class ResizeInternalTest : public ResizeTest {
#endif
}
- virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
- libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(libvpx_test::VideoSource *video,
+ libvpx_test::Encoder *encoder) override {
if (change_config_) {
int new_q = 60;
if (video->frame() == 0) {
@@ -378,13 +378,13 @@ class ResizeInternalTest : public ResizeTest {
}
}
- virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) override {
if (frame0_psnr_ == 0.) frame0_psnr_ = pkt->data.psnr.psnr[0];
EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 2.0);
}
#if WRITE_COMPRESSED_STREAM
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
++out_frames_;
// Write initial file header if first frame.
@@ -447,10 +447,10 @@ class ResizeRealtimeTest
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
protected:
ResizeRealtimeTest() : EncoderTest(GET_PARAM(0)) {}
- virtual ~ResizeRealtimeTest() {}
+ ~ResizeRealtimeTest() override = default;
- virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
- libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(libvpx_test::VideoSource *video,
+ libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP9E_SET_AQ_MODE, 3);
encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
@@ -463,24 +463,24 @@ class ResizeRealtimeTest
}
}
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(GET_PARAM(1));
set_cpu_used_ = GET_PARAM(2);
}
- virtual void DecompressedFrameHook(const vpx_image_t &img,
- vpx_codec_pts_t pts) {
+ void DecompressedFrameHook(const vpx_image_t &img,
+ vpx_codec_pts_t pts) override {
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) {
+ void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2) override {
double mismatch_psnr = compute_psnr(img1, img2);
mismatch_psnr_ += mismatch_psnr;
++mismatch_nframes_;
}
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
ASSERT_NE(static_cast<int>(pkt->data.frame.width[0]), 0);
ASSERT_NE(static_cast<int>(pkt->data.frame.height[0]), 0);
encode_frame_width_.push_back(pkt->data.frame.width[0]);
@@ -688,15 +688,15 @@ class ResizeCspTest : public ResizeTest {
ResizeCspTest() : ResizeTest(), frame0_psnr_(0.0) {}
#endif
- virtual ~ResizeCspTest() {}
+ ~ResizeCspTest() override = default;
- virtual void BeginPassHook(unsigned int /*pass*/) {
+ void BeginPassHook(unsigned int /*pass*/) override {
#if WRITE_COMPRESSED_STREAM
outfile_ = fopen("vp91-2-05-cspchape.ivf", "wb");
#endif
}
- virtual void EndPassHook() {
+ void EndPassHook() override {
#if WRITE_COMPRESSED_STREAM
if (outfile_) {
if (!fseek(outfile_, 0, SEEK_SET))
@@ -707,8 +707,8 @@ class ResizeCspTest : public ResizeTest {
#endif
}
- virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
- libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(libvpx_test::VideoSource *video,
+ libvpx_test::Encoder *encoder) override {
if (CspForFrameNumber(video->frame()) != VPX_IMG_FMT_I420 &&
cfg_.g_profile != 1) {
cfg_.g_profile = 1;
@@ -721,13 +721,13 @@ class ResizeCspTest : public ResizeTest {
}
}
- virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) override {
if (frame0_psnr_ == 0.) frame0_psnr_ = pkt->data.psnr.psnr[0];
EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 2.0);
}
#if WRITE_COMPRESSED_STREAM
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
++out_frames_;
// Write initial file header if first frame.
@@ -753,10 +753,10 @@ class ResizingCspVideoSource : public ::libvpx_test::DummyVideoSource {
limit_ = 30;
}
- virtual ~ResizingCspVideoSource() {}
+ ~ResizingCspVideoSource() override = default;
protected:
- virtual void Next() {
+ void Next() override {
++frame_;
SetImageFormat(CspForFrameNumber(frame_));
FillFrame();
diff --git a/test/sad_test.cc b/test/sad_test.cc
index 0896c77f1..3530e6605 100644
--- a/test/sad_test.cc
+++ b/test/sad_test.cc
@@ -42,6 +42,10 @@ typedef unsigned int (*SadMxNFunc)(const uint8_t *src_ptr, int src_stride,
const uint8_t *ref_ptr, int ref_stride);
typedef TestParams<SadMxNFunc> SadMxNParam;
+typedef unsigned int (*SadSkipMxNFunc)(const uint8_t *src_ptr, int src_stride,
+ const uint8_t *ref_ptr, int ref_stride);
+typedef TestParams<SadSkipMxNFunc> SadSkipMxNParam;
+
typedef unsigned int (*SadMxNAvgFunc)(const uint8_t *src_ptr, int src_stride,
const uint8_t *ref_ptr, int ref_stride,
const uint8_t *second_pred);
@@ -52,6 +56,11 @@ typedef void (*SadMxNx4Func)(const uint8_t *src_ptr, int src_stride,
unsigned int *sad_array);
typedef TestParams<SadMxNx4Func> SadMxNx4Param;
+typedef void (*SadSkipMxNx4Func)(const uint8_t *src_ptr, int src_stride,
+ const uint8_t *const ref_ptr[], int ref_stride,
+ unsigned int *sad_array);
+typedef TestParams<SadSkipMxNx4Func> SadSkipMxNx4Param;
+
typedef void (*SadMxNx8Func)(const uint8_t *src_ptr, int src_stride,
const uint8_t *ref_ptr, int ref_stride,
unsigned int *sad_array);
@@ -64,7 +73,7 @@ class SADTestBase : public ::testing::TestWithParam<ParamType> {
public:
explicit SADTestBase(const ParamType &params) : params_(params) {}
- virtual void SetUp() {
+ void SetUp() override {
source_data8_ = reinterpret_cast<uint8_t *>(
vpx_memalign(kDataAlignment, kDataBlockSize));
reference_data8_ = reinterpret_cast<uint8_t *>(
@@ -99,7 +108,7 @@ class SADTestBase : public ::testing::TestWithParam<ParamType> {
rnd_.Reset(ACMRandom::DeterministicSeed());
}
- virtual void TearDown() {
+ void TearDown() override {
vpx_free(source_data8_);
source_data8_ = nullptr;
vpx_free(reference_data8_);
@@ -170,6 +179,34 @@ class SADTestBase : public ::testing::TestWithParam<ParamType> {
return sad;
}
+ // Sum of Absolute Differences Skip rows. Given two blocks, calculate the
+ // absolute difference between two pixels in the same relative location every
+ // other row; accumulate and double the result at the end.
+ uint32_t ReferenceSADSkip(int ref_offset) const {
+ uint32_t sad = 0;
+ const uint8_t *const reference8 = GetReferenceFromOffset(ref_offset);
+ const uint8_t *const source8 = source_data_;
+#if CONFIG_VP9_HIGHBITDEPTH
+ const uint16_t *const reference16 =
+ CONVERT_TO_SHORTPTR(GetReferenceFromOffset(ref_offset));
+ const uint16_t *const source16 = CONVERT_TO_SHORTPTR(source_data_);
+#endif // CONFIG_VP9_HIGHBITDEPTH
+ for (int h = 0; h < params_.height; h += 2) {
+ for (int w = 0; w < params_.width; ++w) {
+ if (!use_high_bit_depth_) {
+ sad += abs(source8[h * source_stride_ + w] -
+ reference8[h * reference_stride_ + w]);
+#if CONFIG_VP9_HIGHBITDEPTH
+ } else {
+ sad += abs(source16[h * source_stride_ + w] -
+ reference16[h * reference_stride_ + w]);
+#endif // CONFIG_VP9_HIGHBITDEPTH
+ }
+ }
+ }
+ return sad * 2;
+ }
+
// Sum of Absolute Differences Average. Given two blocks, and a prediction
// calculate the absolute difference between one pixel and average of the
// corresponding and predicted pixels; accumulate.
@@ -290,6 +327,32 @@ class SADx4Test : public SADTestBase<SadMxNx4Param> {
}
};
+class SADSkipx4Test : public SADTestBase<SadMxNx4Param> {
+ public:
+ SADSkipx4Test() : SADTestBase(GetParam()) {}
+
+ protected:
+ void SADs(unsigned int *results) const {
+ 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));
+ }
+
+ void CheckSADs() const {
+ uint32_t reference_sad;
+ DECLARE_ALIGNED(kDataAlignment, uint32_t, exp_sad[4]);
+
+ SADs(exp_sad);
+ for (int block = 0; block < 4; ++block) {
+ reference_sad = ReferenceSADSkip(GetBlockRefOffset(block));
+
+ EXPECT_EQ(reference_sad, exp_sad[block]) << "block " << block;
+ }
+ }
+};
+
class SADTest : public AbstractBench, public SADTestBase<SadMxNParam> {
public:
SADTest() : SADTestBase(GetParam()) {}
@@ -317,6 +380,33 @@ class SADTest : public AbstractBench, public SADTestBase<SadMxNParam> {
}
};
+class SADSkipTest : public AbstractBench, public SADTestBase<SadMxNParam> {
+ public:
+ SADSkipTest() : SADTestBase(GetParam()) {}
+
+ protected:
+ unsigned int SAD(int block_idx) const {
+ unsigned int ret;
+ const uint8_t *const reference = GetReference(block_idx);
+
+ ASM_REGISTER_STATE_CHECK(ret = params_.func(source_data_, source_stride_,
+ reference, reference_stride_));
+ return ret;
+ }
+
+ void CheckSAD() const {
+ const unsigned int reference_sad = ReferenceSADSkip(GetBlockRefOffset(0));
+ const unsigned int exp_sad = SAD(0);
+
+ ASSERT_EQ(reference_sad, exp_sad);
+ }
+
+ void Run() override {
+ params_.func(source_data_, source_stride_, reference_data_,
+ reference_stride_);
+ }
+};
+
class SADavgTest : public AbstractBench, public SADTestBase<SadMxNAvgParam> {
public:
SADavgTest() : SADTestBase(GetParam()) {}
@@ -397,6 +487,58 @@ TEST_P(SADTest, DISABLED_Speed) {
PrintMedian(title);
}
+TEST_P(SADSkipTest, MaxRef) {
+ FillConstant(source_data_, source_stride_, 0);
+ FillConstant(reference_data_, reference_stride_, mask_);
+ CheckSAD();
+}
+
+TEST_P(SADSkipTest, MaxSrc) {
+ FillConstant(source_data_, source_stride_, mask_);
+ FillConstant(reference_data_, reference_stride_, 0);
+ CheckSAD();
+}
+
+TEST_P(SADSkipTest, ShortRef) {
+ const int tmp_stride = reference_stride_;
+ reference_stride_ >>= 1;
+ FillRandom(source_data_, source_stride_);
+ FillRandom(reference_data_, reference_stride_);
+ CheckSAD();
+ reference_stride_ = tmp_stride;
+}
+
+TEST_P(SADSkipTest, UnalignedRef) {
+ // The reference frame, but not the source frame, may be unaligned for
+ // certain types of searches.
+ const int tmp_stride = reference_stride_;
+ reference_stride_ -= 1;
+ FillRandom(source_data_, source_stride_);
+ FillRandom(reference_data_, reference_stride_);
+ CheckSAD();
+ reference_stride_ = tmp_stride;
+}
+
+TEST_P(SADSkipTest, ShortSrc) {
+ const int tmp_stride = source_stride_;
+ source_stride_ >>= 1;
+ FillRandom(source_data_, source_stride_);
+ FillRandom(reference_data_, reference_stride_);
+ CheckSAD();
+ source_stride_ = tmp_stride;
+}
+
+TEST_P(SADSkipTest, DISABLED_Speed) {
+ const int kCountSpeedTestBlock = 50000000 / (params_.width * params_.height);
+ FillRandom(source_data_, source_stride_);
+
+ RunNTimes(kCountSpeedTestBlock);
+
+ char title[16];
+ snprintf(title, sizeof(title), "%dx%d", params_.width, params_.height);
+ PrintMedian(title);
+}
+
TEST_P(SADavgTest, MaxRef) {
FillConstant(source_data_, source_stride_, 0);
FillConstant(reference_data_, reference_stride_, mask_);
@@ -554,6 +696,105 @@ TEST_P(SADx4Test, DISABLED_Speed) {
reference_stride_ = tmp_stride;
}
+TEST_P(SADSkipx4Test, MaxRef) {
+ FillConstant(source_data_, source_stride_, 0);
+ FillConstant(GetReference(0), reference_stride_, mask_);
+ FillConstant(GetReference(1), reference_stride_, mask_);
+ FillConstant(GetReference(2), reference_stride_, mask_);
+ FillConstant(GetReference(3), reference_stride_, mask_);
+ CheckSADs();
+}
+
+TEST_P(SADSkipx4Test, MaxSrc) {
+ FillConstant(source_data_, source_stride_, mask_);
+ FillConstant(GetReference(0), reference_stride_, 0);
+ FillConstant(GetReference(1), reference_stride_, 0);
+ FillConstant(GetReference(2), reference_stride_, 0);
+ FillConstant(GetReference(3), reference_stride_, 0);
+ CheckSADs();
+}
+
+TEST_P(SADSkipx4Test, ShortRef) {
+ int tmp_stride = reference_stride_;
+ reference_stride_ >>= 1;
+ FillRandom(source_data_, source_stride_);
+ FillRandom(GetReference(0), reference_stride_);
+ FillRandom(GetReference(1), reference_stride_);
+ FillRandom(GetReference(2), reference_stride_);
+ FillRandom(GetReference(3), reference_stride_);
+ CheckSADs();
+ reference_stride_ = tmp_stride;
+}
+
+TEST_P(SADSkipx4Test, UnalignedRef) {
+ // The reference frame, but not the source frame, may be unaligned for
+ // certain types of searches.
+ int tmp_stride = reference_stride_;
+ reference_stride_ -= 1;
+ FillRandom(source_data_, source_stride_);
+ FillRandom(GetReference(0), reference_stride_);
+ FillRandom(GetReference(1), reference_stride_);
+ FillRandom(GetReference(2), reference_stride_);
+ FillRandom(GetReference(3), reference_stride_);
+ CheckSADs();
+ reference_stride_ = tmp_stride;
+}
+
+TEST_P(SADSkipx4Test, ShortSrc) {
+ int tmp_stride = source_stride_;
+ source_stride_ >>= 1;
+ FillRandom(source_data_, source_stride_);
+ FillRandom(GetReference(0), reference_stride_);
+ FillRandom(GetReference(1), reference_stride_);
+ FillRandom(GetReference(2), reference_stride_);
+ FillRandom(GetReference(3), reference_stride_);
+ CheckSADs();
+ source_stride_ = tmp_stride;
+}
+
+TEST_P(SADSkipx4Test, SrcAlignedByWidth) {
+ uint8_t *tmp_source_data = source_data_;
+ source_data_ += params_.width;
+ FillRandom(source_data_, source_stride_);
+ FillRandom(GetReference(0), reference_stride_);
+ FillRandom(GetReference(1), reference_stride_);
+ FillRandom(GetReference(2), reference_stride_);
+ FillRandom(GetReference(3), reference_stride_);
+ CheckSADs();
+ source_data_ = tmp_source_data;
+}
+
+TEST_P(SADSkipx4Test, DISABLED_Speed) {
+ int tmp_stride = reference_stride_;
+ reference_stride_ -= 1;
+ FillRandom(source_data_, source_stride_);
+ FillRandom(GetReference(0), reference_stride_);
+ FillRandom(GetReference(1), reference_stride_);
+ FillRandom(GetReference(2), reference_stride_);
+ FillRandom(GetReference(3), reference_stride_);
+ const int kCountSpeedTestBlock = 500000000 / (params_.width * params_.height);
+ uint32_t reference_sad[4];
+ DECLARE_ALIGNED(kDataAlignment, uint32_t, exp_sad[4]);
+ vpx_usec_timer timer;
+ for (int block = 0; block < 4; ++block) {
+ reference_sad[block] = ReferenceSADSkip(GetBlockRefOffset(block));
+ }
+ vpx_usec_timer_start(&timer);
+ for (int i = 0; i < kCountSpeedTestBlock; ++i) {
+ SADs(exp_sad);
+ }
+ vpx_usec_timer_mark(&timer);
+ for (int block = 0; block < 4; ++block) {
+ EXPECT_EQ(reference_sad[block], exp_sad[block]) << "block " << block;
+ }
+ const int elapsed_time =
+ static_cast<int>(vpx_usec_timer_elapsed(&timer) / 1000);
+ printf("sad%dx%dx4 (%2dbit) time: %5d ms\n", params_.width, params_.height,
+ bit_depth_, elapsed_time);
+
+ reference_stride_ = tmp_stride;
+}
+
//------------------------------------------------------------------------------
// C functions
const SadMxNParam c_tests[] = {
@@ -614,6 +855,56 @@ const SadMxNParam c_tests[] = {
};
INSTANTIATE_TEST_SUITE_P(C, SADTest, ::testing::ValuesIn(c_tests));
+const SadSkipMxNParam skip_c_tests[] = {
+ SadSkipMxNParam(64, 64, &vpx_sad_skip_64x64_c),
+ SadSkipMxNParam(64, 32, &vpx_sad_skip_64x32_c),
+ SadSkipMxNParam(32, 64, &vpx_sad_skip_32x64_c),
+ SadSkipMxNParam(32, 32, &vpx_sad_skip_32x32_c),
+ SadSkipMxNParam(32, 16, &vpx_sad_skip_32x16_c),
+ SadSkipMxNParam(16, 32, &vpx_sad_skip_16x32_c),
+ SadSkipMxNParam(16, 16, &vpx_sad_skip_16x16_c),
+ SadSkipMxNParam(16, 8, &vpx_sad_skip_16x8_c),
+ SadSkipMxNParam(8, 16, &vpx_sad_skip_8x16_c),
+ SadSkipMxNParam(8, 8, &vpx_sad_skip_8x8_c),
+ SadSkipMxNParam(4, 8, &vpx_sad_skip_4x8_c),
+#if CONFIG_VP9_HIGHBITDEPTH
+ SadSkipMxNParam(64, 64, &vpx_highbd_sad_skip_64x64_c, 8),
+ SadSkipMxNParam(64, 32, &vpx_highbd_sad_skip_64x32_c, 8),
+ SadSkipMxNParam(32, 64, &vpx_highbd_sad_skip_32x64_c, 8),
+ SadSkipMxNParam(32, 32, &vpx_highbd_sad_skip_32x32_c, 8),
+ SadSkipMxNParam(32, 16, &vpx_highbd_sad_skip_32x16_c, 8),
+ SadSkipMxNParam(16, 32, &vpx_highbd_sad_skip_16x32_c, 8),
+ SadSkipMxNParam(16, 16, &vpx_highbd_sad_skip_16x16_c, 8),
+ SadSkipMxNParam(16, 8, &vpx_highbd_sad_skip_16x8_c, 8),
+ SadSkipMxNParam(8, 16, &vpx_highbd_sad_skip_8x16_c, 8),
+ SadSkipMxNParam(8, 8, &vpx_highbd_sad_skip_8x8_c, 8),
+ SadSkipMxNParam(4, 8, &vpx_highbd_sad_skip_4x8_c, 8),
+ SadSkipMxNParam(64, 64, &vpx_highbd_sad_skip_64x64_c, 10),
+ SadSkipMxNParam(64, 32, &vpx_highbd_sad_skip_64x32_c, 10),
+ SadSkipMxNParam(32, 64, &vpx_highbd_sad_skip_32x64_c, 10),
+ SadSkipMxNParam(32, 32, &vpx_highbd_sad_skip_32x32_c, 10),
+ SadSkipMxNParam(32, 16, &vpx_highbd_sad_skip_32x16_c, 10),
+ SadSkipMxNParam(16, 32, &vpx_highbd_sad_skip_16x32_c, 10),
+ SadSkipMxNParam(16, 16, &vpx_highbd_sad_skip_16x16_c, 10),
+ SadSkipMxNParam(16, 8, &vpx_highbd_sad_skip_16x8_c, 10),
+ SadSkipMxNParam(8, 16, &vpx_highbd_sad_skip_8x16_c, 10),
+ SadSkipMxNParam(8, 8, &vpx_highbd_sad_skip_8x8_c, 10),
+ SadSkipMxNParam(4, 8, &vpx_highbd_sad_skip_4x8_c, 10),
+ SadSkipMxNParam(64, 64, &vpx_highbd_sad_skip_64x64_c, 12),
+ SadSkipMxNParam(64, 32, &vpx_highbd_sad_skip_64x32_c, 12),
+ SadSkipMxNParam(32, 64, &vpx_highbd_sad_skip_32x64_c, 12),
+ SadSkipMxNParam(32, 32, &vpx_highbd_sad_skip_32x32_c, 12),
+ SadSkipMxNParam(32, 16, &vpx_highbd_sad_skip_32x16_c, 12),
+ SadSkipMxNParam(16, 32, &vpx_highbd_sad_skip_16x32_c, 12),
+ SadSkipMxNParam(16, 16, &vpx_highbd_sad_skip_16x16_c, 12),
+ SadSkipMxNParam(16, 8, &vpx_highbd_sad_skip_16x8_c, 12),
+ SadSkipMxNParam(8, 16, &vpx_highbd_sad_skip_8x16_c, 12),
+ SadSkipMxNParam(8, 8, &vpx_highbd_sad_skip_8x8_c, 12),
+ SadSkipMxNParam(4, 8, &vpx_highbd_sad_skip_4x8_c, 12),
+#endif // CONFIG_VP9_HIGHBITDEPTH
+};
+INSTANTIATE_TEST_SUITE_P(C, SADSkipTest, ::testing::ValuesIn(skip_c_tests));
+
const SadMxNAvgParam avg_c_tests[] = {
SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_c),
SadMxNAvgParam(64, 32, &vpx_sad64x32_avg_c),
@@ -730,6 +1021,57 @@ const SadMxNx4Param x4d_c_tests[] = {
};
INSTANTIATE_TEST_SUITE_P(C, SADx4Test, ::testing::ValuesIn(x4d_c_tests));
+const SadSkipMxNx4Param skip_x4d_c_tests[] = {
+ SadSkipMxNx4Param(64, 64, &vpx_sad_skip_64x64x4d_c),
+ SadSkipMxNx4Param(64, 32, &vpx_sad_skip_64x32x4d_c),
+ SadSkipMxNx4Param(32, 64, &vpx_sad_skip_32x64x4d_c),
+ SadSkipMxNx4Param(32, 32, &vpx_sad_skip_32x32x4d_c),
+ SadSkipMxNx4Param(32, 16, &vpx_sad_skip_32x16x4d_c),
+ SadSkipMxNx4Param(16, 32, &vpx_sad_skip_16x32x4d_c),
+ SadSkipMxNx4Param(16, 16, &vpx_sad_skip_16x16x4d_c),
+ SadSkipMxNx4Param(16, 8, &vpx_sad_skip_16x8x4d_c),
+ SadSkipMxNx4Param(8, 16, &vpx_sad_skip_8x16x4d_c),
+ SadSkipMxNx4Param(8, 8, &vpx_sad_skip_8x8x4d_c),
+ SadSkipMxNx4Param(4, 8, &vpx_sad_skip_4x8x4d_c),
+#if CONFIG_VP9_HIGHBITDEPTH
+ SadSkipMxNx4Param(64, 64, &vpx_highbd_sad_skip_64x64x4d_c, 8),
+ SadSkipMxNx4Param(64, 32, &vpx_highbd_sad_skip_64x32x4d_c, 8),
+ SadSkipMxNx4Param(32, 64, &vpx_highbd_sad_skip_32x64x4d_c, 8),
+ SadSkipMxNx4Param(32, 32, &vpx_highbd_sad_skip_32x32x4d_c, 8),
+ SadSkipMxNx4Param(32, 16, &vpx_highbd_sad_skip_32x16x4d_c, 8),
+ SadSkipMxNx4Param(16, 32, &vpx_highbd_sad_skip_16x32x4d_c, 8),
+ SadSkipMxNx4Param(16, 16, &vpx_highbd_sad_skip_16x16x4d_c, 8),
+ SadSkipMxNx4Param(16, 8, &vpx_highbd_sad_skip_16x8x4d_c, 8),
+ SadSkipMxNx4Param(8, 16, &vpx_highbd_sad_skip_8x16x4d_c, 8),
+ SadSkipMxNx4Param(8, 8, &vpx_highbd_sad_skip_8x8x4d_c, 8),
+ SadSkipMxNx4Param(4, 8, &vpx_highbd_sad_skip_4x8x4d_c, 8),
+ SadSkipMxNx4Param(64, 64, &vpx_highbd_sad_skip_64x64x4d_c, 10),
+ SadSkipMxNx4Param(64, 32, &vpx_highbd_sad_skip_64x32x4d_c, 10),
+ SadSkipMxNx4Param(32, 64, &vpx_highbd_sad_skip_32x64x4d_c, 10),
+ SadSkipMxNx4Param(32, 32, &vpx_highbd_sad_skip_32x32x4d_c, 10),
+ SadSkipMxNx4Param(32, 16, &vpx_highbd_sad_skip_32x16x4d_c, 10),
+ SadSkipMxNx4Param(16, 32, &vpx_highbd_sad_skip_16x32x4d_c, 10),
+ SadSkipMxNx4Param(16, 16, &vpx_highbd_sad_skip_16x16x4d_c, 10),
+ SadSkipMxNx4Param(16, 8, &vpx_highbd_sad_skip_16x8x4d_c, 10),
+ SadSkipMxNx4Param(8, 16, &vpx_highbd_sad_skip_8x16x4d_c, 10),
+ SadSkipMxNx4Param(8, 8, &vpx_highbd_sad_skip_8x8x4d_c, 10),
+ SadSkipMxNx4Param(4, 8, &vpx_highbd_sad_skip_4x8x4d_c, 10),
+ SadSkipMxNx4Param(64, 64, &vpx_highbd_sad_skip_64x64x4d_c, 12),
+ SadSkipMxNx4Param(64, 32, &vpx_highbd_sad_skip_64x32x4d_c, 12),
+ SadSkipMxNx4Param(32, 64, &vpx_highbd_sad_skip_32x64x4d_c, 12),
+ SadSkipMxNx4Param(32, 32, &vpx_highbd_sad_skip_32x32x4d_c, 12),
+ SadSkipMxNx4Param(32, 16, &vpx_highbd_sad_skip_32x16x4d_c, 12),
+ SadSkipMxNx4Param(16, 32, &vpx_highbd_sad_skip_16x32x4d_c, 12),
+ SadSkipMxNx4Param(16, 16, &vpx_highbd_sad_skip_16x16x4d_c, 12),
+ SadSkipMxNx4Param(16, 8, &vpx_highbd_sad_skip_16x8x4d_c, 12),
+ SadSkipMxNx4Param(8, 16, &vpx_highbd_sad_skip_8x16x4d_c, 12),
+ SadSkipMxNx4Param(8, 8, &vpx_highbd_sad_skip_8x8x4d_c, 12),
+ SadSkipMxNx4Param(4, 8, &vpx_highbd_sad_skip_4x8x4d_c, 12),
+#endif // CONFIG_VP9_HIGHBITDEPTH
+};
+INSTANTIATE_TEST_SUITE_P(C, SADSkipx4Test,
+ ::testing::ValuesIn(skip_x4d_c_tests));
+
//------------------------------------------------------------------------------
// ARM functions
#if HAVE_NEON
@@ -787,6 +1129,95 @@ const SadMxNParam neon_tests[] = {
};
INSTANTIATE_TEST_SUITE_P(NEON, SADTest, ::testing::ValuesIn(neon_tests));
+#if HAVE_NEON_DOTPROD
+const SadMxNParam neon_dotprod_tests[] = {
+ SadMxNParam(64, 64, &vpx_sad64x64_neon_dotprod),
+ SadMxNParam(64, 32, &vpx_sad64x32_neon_dotprod),
+ SadMxNParam(32, 64, &vpx_sad32x64_neon_dotprod),
+ SadMxNParam(32, 32, &vpx_sad32x32_neon_dotprod),
+ SadMxNParam(32, 16, &vpx_sad32x16_neon_dotprod),
+ SadMxNParam(16, 32, &vpx_sad16x32_neon_dotprod),
+ SadMxNParam(16, 16, &vpx_sad16x16_neon_dotprod),
+ SadMxNParam(16, 8, &vpx_sad16x8_neon_dotprod),
+};
+INSTANTIATE_TEST_SUITE_P(NEON_DOTPROD, SADTest,
+ ::testing::ValuesIn(neon_dotprod_tests));
+#endif // HAVE_NEON_DOTPROD
+
+const SadSkipMxNParam skip_neon_tests[] = {
+ SadSkipMxNParam(64, 64, &vpx_sad_skip_64x64_neon),
+ SadSkipMxNParam(64, 32, &vpx_sad_skip_64x32_neon),
+ SadSkipMxNParam(32, 64, &vpx_sad_skip_32x64_neon),
+ SadSkipMxNParam(32, 32, &vpx_sad_skip_32x32_neon),
+ SadSkipMxNParam(32, 16, &vpx_sad_skip_32x16_neon),
+ SadSkipMxNParam(16, 32, &vpx_sad_skip_16x32_neon),
+ SadSkipMxNParam(16, 16, &vpx_sad_skip_16x16_neon),
+ SadSkipMxNParam(16, 8, &vpx_sad_skip_16x8_neon),
+ SadSkipMxNParam(8, 16, &vpx_sad_skip_8x16_neon),
+ SadSkipMxNParam(8, 8, &vpx_sad_skip_8x8_neon),
+ SadSkipMxNParam(8, 4, &vpx_sad_skip_8x4_neon),
+ SadSkipMxNParam(4, 8, &vpx_sad_skip_4x8_neon),
+ SadSkipMxNParam(4, 4, &vpx_sad_skip_4x4_neon),
+#if CONFIG_VP9_HIGHBITDEPTH
+ SadSkipMxNParam(4, 4, &vpx_highbd_sad_skip_4x4_neon, 8),
+ SadSkipMxNParam(4, 8, &vpx_highbd_sad_skip_4x8_neon, 8),
+ SadSkipMxNParam(8, 4, &vpx_highbd_sad_skip_8x4_neon, 8),
+ SadSkipMxNParam(8, 8, &vpx_highbd_sad_skip_8x8_neon, 8),
+ SadSkipMxNParam(8, 16, &vpx_highbd_sad_skip_8x16_neon, 8),
+ SadSkipMxNParam(16, 8, &vpx_highbd_sad_skip_16x8_neon, 8),
+ SadSkipMxNParam(16, 16, &vpx_highbd_sad_skip_16x16_neon, 8),
+ SadSkipMxNParam(16, 32, &vpx_highbd_sad_skip_16x32_neon, 8),
+ SadSkipMxNParam(32, 16, &vpx_highbd_sad_skip_32x16_neon, 8),
+ SadSkipMxNParam(32, 32, &vpx_highbd_sad_skip_32x32_neon, 8),
+ SadSkipMxNParam(32, 64, &vpx_highbd_sad_skip_32x64_neon, 8),
+ SadSkipMxNParam(64, 32, &vpx_highbd_sad_skip_64x32_neon, 8),
+ SadSkipMxNParam(64, 64, &vpx_highbd_sad_skip_64x64_neon, 8),
+ SadSkipMxNParam(4, 4, &vpx_highbd_sad_skip_4x4_neon, 10),
+ SadSkipMxNParam(4, 8, &vpx_highbd_sad_skip_4x8_neon, 10),
+ SadSkipMxNParam(8, 4, &vpx_highbd_sad_skip_8x4_neon, 10),
+ SadSkipMxNParam(8, 8, &vpx_highbd_sad_skip_8x8_neon, 10),
+ SadSkipMxNParam(8, 16, &vpx_highbd_sad_skip_8x16_neon, 10),
+ SadSkipMxNParam(16, 8, &vpx_highbd_sad_skip_16x8_neon, 10),
+ SadSkipMxNParam(16, 16, &vpx_highbd_sad_skip_16x16_neon, 10),
+ SadSkipMxNParam(16, 32, &vpx_highbd_sad_skip_16x32_neon, 10),
+ SadSkipMxNParam(32, 16, &vpx_highbd_sad_skip_32x16_neon, 10),
+ SadSkipMxNParam(32, 32, &vpx_highbd_sad_skip_32x32_neon, 10),
+ SadSkipMxNParam(32, 64, &vpx_highbd_sad_skip_32x64_neon, 10),
+ SadSkipMxNParam(64, 32, &vpx_highbd_sad_skip_64x32_neon, 10),
+ SadSkipMxNParam(64, 64, &vpx_highbd_sad_skip_64x64_neon, 10),
+ SadSkipMxNParam(4, 4, &vpx_highbd_sad_skip_4x4_neon, 12),
+ SadSkipMxNParam(4, 8, &vpx_highbd_sad_skip_4x8_neon, 12),
+ SadSkipMxNParam(8, 4, &vpx_highbd_sad_skip_8x4_neon, 12),
+ SadSkipMxNParam(8, 8, &vpx_highbd_sad_skip_8x8_neon, 12),
+ SadSkipMxNParam(8, 16, &vpx_highbd_sad_skip_8x16_neon, 12),
+ SadSkipMxNParam(16, 8, &vpx_highbd_sad_skip_16x8_neon, 12),
+ SadSkipMxNParam(16, 16, &vpx_highbd_sad_skip_16x16_neon, 12),
+ SadSkipMxNParam(16, 32, &vpx_highbd_sad_skip_16x32_neon, 12),
+ SadSkipMxNParam(32, 16, &vpx_highbd_sad_skip_32x16_neon, 12),
+ SadSkipMxNParam(32, 32, &vpx_highbd_sad_skip_32x32_neon, 12),
+ SadSkipMxNParam(32, 64, &vpx_highbd_sad_skip_32x64_neon, 12),
+ SadSkipMxNParam(64, 32, &vpx_highbd_sad_skip_64x32_neon, 12),
+ SadSkipMxNParam(64, 64, &vpx_highbd_sad_skip_64x64_neon, 12),
+#endif // CONFIG_VP9_HIGHBITDEPTH
+};
+INSTANTIATE_TEST_SUITE_P(NEON, SADSkipTest,
+ ::testing::ValuesIn(skip_neon_tests));
+
+#if HAVE_NEON_DOTPROD
+const SadSkipMxNParam skip_neon_dotprod_tests[] = {
+ SadSkipMxNParam(64, 64, &vpx_sad_skip_64x64_neon_dotprod),
+ SadSkipMxNParam(64, 32, &vpx_sad_skip_64x32_neon_dotprod),
+ SadSkipMxNParam(32, 64, &vpx_sad_skip_32x64_neon_dotprod),
+ SadSkipMxNParam(32, 32, &vpx_sad_skip_32x32_neon_dotprod),
+ SadSkipMxNParam(32, 16, &vpx_sad_skip_32x16_neon_dotprod),
+ SadSkipMxNParam(16, 32, &vpx_sad_skip_16x32_neon_dotprod),
+ SadSkipMxNParam(16, 16, &vpx_sad_skip_16x16_neon_dotprod),
+ SadSkipMxNParam(16, 8, &vpx_sad_skip_16x8_neon_dotprod),
+};
+INSTANTIATE_TEST_SUITE_P(NEON_DOTPROD, SADSkipTest,
+ ::testing::ValuesIn(skip_neon_dotprod_tests));
+#endif // HAVE_NEON_DOTPROD
+
const SadMxNAvgParam avg_neon_tests[] = {
SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_neon),
SadMxNAvgParam(64, 32, &vpx_sad64x32_avg_neon),
@@ -845,6 +1276,21 @@ const SadMxNAvgParam avg_neon_tests[] = {
};
INSTANTIATE_TEST_SUITE_P(NEON, SADavgTest, ::testing::ValuesIn(avg_neon_tests));
+#if HAVE_NEON_DOTPROD
+const SadMxNAvgParam avg_neon_dotprod_tests[] = {
+ SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_neon_dotprod),
+ SadMxNAvgParam(64, 32, &vpx_sad64x32_avg_neon_dotprod),
+ SadMxNAvgParam(32, 64, &vpx_sad32x64_avg_neon_dotprod),
+ SadMxNAvgParam(32, 32, &vpx_sad32x32_avg_neon_dotprod),
+ SadMxNAvgParam(32, 16, &vpx_sad32x16_avg_neon_dotprod),
+ SadMxNAvgParam(16, 32, &vpx_sad16x32_avg_neon_dotprod),
+ SadMxNAvgParam(16, 16, &vpx_sad16x16_avg_neon_dotprod),
+ SadMxNAvgParam(16, 8, &vpx_sad16x8_avg_neon_dotprod),
+};
+INSTANTIATE_TEST_SUITE_P(NEON_DOTPROD, SADavgTest,
+ ::testing::ValuesIn(avg_neon_dotprod_tests));
+#endif // HAVE_NEON_DOTPROD
+
const SadMxNx4Param x4d_neon_tests[] = {
SadMxNx4Param(64, 64, &vpx_sad64x64x4d_neon),
SadMxNx4Param(64, 32, &vpx_sad64x32x4d_neon),
@@ -899,6 +1345,92 @@ const SadMxNx4Param x4d_neon_tests[] = {
#endif // CONFIG_VP9_HIGHBITDEPTH
};
INSTANTIATE_TEST_SUITE_P(NEON, SADx4Test, ::testing::ValuesIn(x4d_neon_tests));
+
+#if HAVE_NEON_DOTPROD
+const SadMxNx4Param x4d_neon_dotprod_tests[] = {
+ SadMxNx4Param(64, 64, &vpx_sad64x64x4d_neon_dotprod),
+ SadMxNx4Param(64, 32, &vpx_sad64x32x4d_neon_dotprod),
+ SadMxNx4Param(32, 64, &vpx_sad32x64x4d_neon_dotprod),
+ SadMxNx4Param(32, 32, &vpx_sad32x32x4d_neon_dotprod),
+ SadMxNx4Param(32, 16, &vpx_sad32x16x4d_neon_dotprod),
+ SadMxNx4Param(16, 32, &vpx_sad16x32x4d_neon_dotprod),
+ SadMxNx4Param(16, 16, &vpx_sad16x16x4d_neon_dotprod),
+ SadMxNx4Param(16, 8, &vpx_sad16x8x4d_neon_dotprod),
+};
+INSTANTIATE_TEST_SUITE_P(NEON_DOTPROD, SADx4Test,
+ ::testing::ValuesIn(x4d_neon_dotprod_tests));
+#endif // HAVE_NEON_DOTPROD
+
+const SadSkipMxNx4Param skip_x4d_neon_tests[] = {
+ SadSkipMxNx4Param(64, 64, &vpx_sad_skip_64x64x4d_neon),
+ SadSkipMxNx4Param(64, 32, &vpx_sad_skip_64x32x4d_neon),
+ SadSkipMxNx4Param(32, 64, &vpx_sad_skip_32x64x4d_neon),
+ SadSkipMxNx4Param(32, 32, &vpx_sad_skip_32x32x4d_neon),
+ SadSkipMxNx4Param(32, 16, &vpx_sad_skip_32x16x4d_neon),
+ SadSkipMxNx4Param(16, 32, &vpx_sad_skip_16x32x4d_neon),
+ SadSkipMxNx4Param(16, 16, &vpx_sad_skip_16x16x4d_neon),
+ SadSkipMxNx4Param(16, 8, &vpx_sad_skip_16x8x4d_neon),
+ SadSkipMxNx4Param(8, 16, &vpx_sad_skip_8x16x4d_neon),
+ SadSkipMxNx4Param(8, 8, &vpx_sad_skip_8x8x4d_neon),
+ SadSkipMxNx4Param(8, 4, &vpx_sad_skip_8x4x4d_neon),
+ SadSkipMxNx4Param(4, 8, &vpx_sad_skip_4x8x4d_neon),
+ SadSkipMxNx4Param(4, 4, &vpx_sad_skip_4x4x4d_neon),
+#if CONFIG_VP9_HIGHBITDEPTH
+ SadSkipMxNx4Param(4, 4, &vpx_highbd_sad_skip_4x4x4d_neon, 8),
+ SadSkipMxNx4Param(4, 8, &vpx_highbd_sad_skip_4x8x4d_neon, 8),
+ SadSkipMxNx4Param(8, 4, &vpx_highbd_sad_skip_8x4x4d_neon, 8),
+ SadSkipMxNx4Param(8, 8, &vpx_highbd_sad_skip_8x8x4d_neon, 8),
+ SadSkipMxNx4Param(8, 16, &vpx_highbd_sad_skip_8x16x4d_neon, 8),
+ SadSkipMxNx4Param(16, 8, &vpx_highbd_sad_skip_16x8x4d_neon, 8),
+ SadSkipMxNx4Param(16, 16, &vpx_highbd_sad_skip_16x16x4d_neon, 8),
+ SadSkipMxNx4Param(16, 32, &vpx_highbd_sad_skip_16x32x4d_neon, 8),
+ SadSkipMxNx4Param(32, 32, &vpx_highbd_sad_skip_32x32x4d_neon, 8),
+ SadSkipMxNx4Param(32, 64, &vpx_highbd_sad_skip_32x64x4d_neon, 8),
+ SadSkipMxNx4Param(64, 32, &vpx_highbd_sad_skip_64x32x4d_neon, 8),
+ SadSkipMxNx4Param(64, 64, &vpx_highbd_sad_skip_64x64x4d_neon, 8),
+ SadSkipMxNx4Param(4, 4, &vpx_highbd_sad_skip_4x4x4d_neon, 10),
+ SadSkipMxNx4Param(4, 8, &vpx_highbd_sad_skip_4x8x4d_neon, 10),
+ SadSkipMxNx4Param(8, 4, &vpx_highbd_sad_skip_8x4x4d_neon, 10),
+ SadSkipMxNx4Param(8, 8, &vpx_highbd_sad_skip_8x8x4d_neon, 10),
+ SadSkipMxNx4Param(8, 16, &vpx_highbd_sad_skip_8x16x4d_neon, 10),
+ SadSkipMxNx4Param(16, 8, &vpx_highbd_sad_skip_16x8x4d_neon, 10),
+ SadSkipMxNx4Param(16, 16, &vpx_highbd_sad_skip_16x16x4d_neon, 10),
+ SadSkipMxNx4Param(16, 32, &vpx_highbd_sad_skip_16x32x4d_neon, 10),
+ SadSkipMxNx4Param(32, 32, &vpx_highbd_sad_skip_32x32x4d_neon, 10),
+ SadSkipMxNx4Param(32, 64, &vpx_highbd_sad_skip_32x64x4d_neon, 10),
+ SadSkipMxNx4Param(64, 32, &vpx_highbd_sad_skip_64x32x4d_neon, 10),
+ SadSkipMxNx4Param(64, 64, &vpx_highbd_sad_skip_64x64x4d_neon, 10),
+ SadSkipMxNx4Param(4, 4, &vpx_highbd_sad_skip_4x4x4d_neon, 12),
+ SadSkipMxNx4Param(4, 8, &vpx_highbd_sad_skip_4x8x4d_neon, 12),
+ SadSkipMxNx4Param(8, 4, &vpx_highbd_sad_skip_8x4x4d_neon, 12),
+ SadSkipMxNx4Param(8, 8, &vpx_highbd_sad_skip_8x8x4d_neon, 12),
+ SadSkipMxNx4Param(8, 16, &vpx_highbd_sad_skip_8x16x4d_neon, 12),
+ SadSkipMxNx4Param(16, 8, &vpx_highbd_sad_skip_16x8x4d_neon, 12),
+ SadSkipMxNx4Param(16, 16, &vpx_highbd_sad_skip_16x16x4d_neon, 12),
+ SadSkipMxNx4Param(16, 32, &vpx_highbd_sad_skip_16x32x4d_neon, 12),
+ SadSkipMxNx4Param(32, 32, &vpx_highbd_sad_skip_32x32x4d_neon, 12),
+ SadSkipMxNx4Param(32, 64, &vpx_highbd_sad_skip_32x64x4d_neon, 12),
+ SadSkipMxNx4Param(64, 32, &vpx_highbd_sad_skip_64x32x4d_neon, 12),
+ SadSkipMxNx4Param(64, 64, &vpx_highbd_sad_skip_64x64x4d_neon, 12),
+#endif // CONFIG_VP9_HIGHBITDEPTH
+};
+INSTANTIATE_TEST_SUITE_P(NEON, SADSkipx4Test,
+ ::testing::ValuesIn(skip_x4d_neon_tests));
+
+#if HAVE_NEONE_DOTPROD
+const SadSkipMxNx4Param skip_x4d_neon_dotprod_tests[] = {
+ SadSkipMxNx4Param(64, 64, &vpx_sad_skip_64x64x4d_neon_dotprod),
+ SadSkipMxNx4Param(64, 32, &vpx_sad_skip_64x32x4d_neon_dotprod),
+ SadSkipMxNx4Param(32, 64, &vpx_sad_skip_32x64x4d_neon_dotprod),
+ SadSkipMxNx4Param(32, 32, &vpx_sad_skip_32x32x4d_neon_dotprod),
+ SadSkipMxNx4Param(32, 16, &vpx_sad_skip_32x16x4d_neon_dotprod),
+ SadSkipMxNx4Param(16, 32, &vpx_sad_skip_16x32x4d_neon_dotprod),
+ SadSkipMxNx4Param(16, 16, &vpx_sad_skip_16x16x4d_neon_dotprod),
+ SadSkipMxNx4Param(16, 8, &vpx_sad_skip_16x8x4d_neon_dotprod),
+};
+INSTANTIATE_TEST_SUITE_P(NEON_DOTPROD, SADSkipx4Test,
+ ::testing::ValuesIn(skip_x4d_neon_dotprod_tests));
+#endif // HAVE_NEON_DOTPROD
#endif // HAVE_NEON
//------------------------------------------------------------------------------
@@ -956,6 +1488,54 @@ const SadMxNParam sse2_tests[] = {
};
INSTANTIATE_TEST_SUITE_P(SSE2, SADTest, ::testing::ValuesIn(sse2_tests));
+const SadSkipMxNParam skip_sse2_tests[] = {
+ SadSkipMxNParam(64, 64, &vpx_sad_skip_64x64_sse2),
+ SadSkipMxNParam(64, 32, &vpx_sad_skip_64x32_sse2),
+ SadSkipMxNParam(32, 64, &vpx_sad_skip_32x64_sse2),
+ SadSkipMxNParam(32, 32, &vpx_sad_skip_32x32_sse2),
+ SadSkipMxNParam(32, 16, &vpx_sad_skip_32x16_sse2),
+ SadSkipMxNParam(16, 32, &vpx_sad_skip_16x32_sse2),
+ SadSkipMxNParam(16, 16, &vpx_sad_skip_16x16_sse2),
+ SadSkipMxNParam(16, 8, &vpx_sad_skip_16x8_sse2),
+ SadSkipMxNParam(8, 16, &vpx_sad_skip_8x16_sse2),
+ SadSkipMxNParam(8, 8, &vpx_sad_skip_8x8_sse2),
+ SadSkipMxNParam(4, 8, &vpx_sad_skip_4x8_sse2),
+#if CONFIG_VP9_HIGHBITDEPTH
+ SadSkipMxNParam(64, 64, &vpx_highbd_sad_skip_64x64_sse2, 8),
+ SadSkipMxNParam(64, 32, &vpx_highbd_sad_skip_64x32_sse2, 8),
+ SadSkipMxNParam(32, 64, &vpx_highbd_sad_skip_32x64_sse2, 8),
+ SadSkipMxNParam(32, 32, &vpx_highbd_sad_skip_32x32_sse2, 8),
+ SadSkipMxNParam(32, 16, &vpx_highbd_sad_skip_32x16_sse2, 8),
+ SadSkipMxNParam(16, 32, &vpx_highbd_sad_skip_16x32_sse2, 8),
+ SadSkipMxNParam(16, 16, &vpx_highbd_sad_skip_16x16_sse2, 8),
+ SadSkipMxNParam(16, 8, &vpx_highbd_sad_skip_16x8_sse2, 8),
+ SadSkipMxNParam(8, 16, &vpx_highbd_sad_skip_8x16_sse2, 8),
+ SadSkipMxNParam(8, 8, &vpx_highbd_sad_skip_8x8_sse2, 8),
+ SadSkipMxNParam(64, 64, &vpx_highbd_sad_skip_64x64_sse2, 10),
+ SadSkipMxNParam(64, 32, &vpx_highbd_sad_skip_64x32_sse2, 10),
+ SadSkipMxNParam(32, 64, &vpx_highbd_sad_skip_32x64_sse2, 10),
+ SadSkipMxNParam(32, 32, &vpx_highbd_sad_skip_32x32_sse2, 10),
+ SadSkipMxNParam(32, 16, &vpx_highbd_sad_skip_32x16_sse2, 10),
+ SadSkipMxNParam(16, 32, &vpx_highbd_sad_skip_16x32_sse2, 10),
+ SadSkipMxNParam(16, 16, &vpx_highbd_sad_skip_16x16_sse2, 10),
+ SadSkipMxNParam(16, 8, &vpx_highbd_sad_skip_16x8_sse2, 10),
+ SadSkipMxNParam(8, 16, &vpx_highbd_sad_skip_8x16_sse2, 10),
+ SadSkipMxNParam(8, 8, &vpx_highbd_sad_skip_8x8_sse2, 10),
+ SadSkipMxNParam(64, 64, &vpx_highbd_sad_skip_64x64_sse2, 12),
+ SadSkipMxNParam(64, 32, &vpx_highbd_sad_skip_64x32_sse2, 12),
+ SadSkipMxNParam(32, 64, &vpx_highbd_sad_skip_32x64_sse2, 12),
+ SadSkipMxNParam(32, 32, &vpx_highbd_sad_skip_32x32_sse2, 12),
+ SadSkipMxNParam(32, 16, &vpx_highbd_sad_skip_32x16_sse2, 12),
+ SadSkipMxNParam(16, 32, &vpx_highbd_sad_skip_16x32_sse2, 12),
+ SadSkipMxNParam(16, 16, &vpx_highbd_sad_skip_16x16_sse2, 12),
+ SadSkipMxNParam(16, 8, &vpx_highbd_sad_skip_16x8_sse2, 12),
+ SadSkipMxNParam(8, 16, &vpx_highbd_sad_skip_8x16_sse2, 12),
+ SadSkipMxNParam(8, 8, &vpx_highbd_sad_skip_8x8_sse2, 12),
+#endif // CONFIG_VP9_HIGHBITDEPTH
+};
+INSTANTIATE_TEST_SUITE_P(SSE2, SADSkipTest,
+ ::testing::ValuesIn(skip_sse2_tests));
+
const SadMxNAvgParam avg_sse2_tests[] = {
SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_sse2),
SadMxNAvgParam(64, 32, &vpx_sad64x32_avg_sse2),
@@ -1065,6 +1645,57 @@ const SadMxNx4Param x4d_sse2_tests[] = {
#endif // CONFIG_VP9_HIGHBITDEPTH
};
INSTANTIATE_TEST_SUITE_P(SSE2, SADx4Test, ::testing::ValuesIn(x4d_sse2_tests));
+
+const SadSkipMxNx4Param skip_x4d_sse2_tests[] = {
+ SadSkipMxNx4Param(64, 64, &vpx_sad_skip_64x64x4d_sse2),
+ SadSkipMxNx4Param(64, 32, &vpx_sad_skip_64x32x4d_sse2),
+ SadSkipMxNx4Param(32, 64, &vpx_sad_skip_32x64x4d_sse2),
+ SadSkipMxNx4Param(32, 32, &vpx_sad_skip_32x32x4d_sse2),
+ SadSkipMxNx4Param(32, 16, &vpx_sad_skip_32x16x4d_sse2),
+ SadSkipMxNx4Param(16, 32, &vpx_sad_skip_16x32x4d_sse2),
+ SadSkipMxNx4Param(16, 16, &vpx_sad_skip_16x16x4d_sse2),
+ SadSkipMxNx4Param(16, 8, &vpx_sad_skip_16x8x4d_sse2),
+ SadSkipMxNx4Param(8, 16, &vpx_sad_skip_8x16x4d_sse2),
+ SadSkipMxNx4Param(8, 8, &vpx_sad_skip_8x8x4d_sse2),
+ SadSkipMxNx4Param(4, 8, &vpx_sad_skip_4x8x4d_sse2),
+#if CONFIG_VP9_HIGHBITDEPTH
+ SadSkipMxNx4Param(64, 64, &vpx_highbd_sad_skip_64x64x4d_sse2, 8),
+ SadSkipMxNx4Param(64, 32, &vpx_highbd_sad_skip_64x32x4d_sse2, 8),
+ SadSkipMxNx4Param(32, 64, &vpx_highbd_sad_skip_32x64x4d_sse2, 8),
+ SadSkipMxNx4Param(32, 32, &vpx_highbd_sad_skip_32x32x4d_sse2, 8),
+ SadSkipMxNx4Param(32, 16, &vpx_highbd_sad_skip_32x16x4d_sse2, 8),
+ SadSkipMxNx4Param(16, 32, &vpx_highbd_sad_skip_16x32x4d_sse2, 8),
+ SadSkipMxNx4Param(16, 16, &vpx_highbd_sad_skip_16x16x4d_sse2, 8),
+ SadSkipMxNx4Param(16, 8, &vpx_highbd_sad_skip_16x8x4d_sse2, 8),
+ SadSkipMxNx4Param(8, 16, &vpx_highbd_sad_skip_8x16x4d_sse2, 8),
+ SadSkipMxNx4Param(8, 8, &vpx_highbd_sad_skip_8x8x4d_sse2, 8),
+ SadSkipMxNx4Param(4, 8, &vpx_highbd_sad_skip_4x8x4d_sse2, 8),
+ SadSkipMxNx4Param(64, 64, &vpx_highbd_sad_skip_64x64x4d_sse2, 10),
+ SadSkipMxNx4Param(64, 32, &vpx_highbd_sad_skip_64x32x4d_sse2, 10),
+ SadSkipMxNx4Param(32, 64, &vpx_highbd_sad_skip_32x64x4d_sse2, 10),
+ SadSkipMxNx4Param(32, 32, &vpx_highbd_sad_skip_32x32x4d_sse2, 10),
+ SadSkipMxNx4Param(32, 16, &vpx_highbd_sad_skip_32x16x4d_sse2, 10),
+ SadSkipMxNx4Param(16, 32, &vpx_highbd_sad_skip_16x32x4d_sse2, 10),
+ SadSkipMxNx4Param(16, 16, &vpx_highbd_sad_skip_16x16x4d_sse2, 10),
+ SadSkipMxNx4Param(16, 8, &vpx_highbd_sad_skip_16x8x4d_sse2, 10),
+ SadSkipMxNx4Param(8, 16, &vpx_highbd_sad_skip_8x16x4d_sse2, 10),
+ SadSkipMxNx4Param(8, 8, &vpx_highbd_sad_skip_8x8x4d_sse2, 10),
+ SadSkipMxNx4Param(4, 8, &vpx_highbd_sad_skip_4x8x4d_sse2, 10),
+ SadSkipMxNx4Param(64, 64, &vpx_highbd_sad_skip_64x64x4d_sse2, 12),
+ SadSkipMxNx4Param(64, 32, &vpx_highbd_sad_skip_64x32x4d_sse2, 12),
+ SadSkipMxNx4Param(32, 64, &vpx_highbd_sad_skip_32x64x4d_sse2, 12),
+ SadSkipMxNx4Param(32, 32, &vpx_highbd_sad_skip_32x32x4d_sse2, 12),
+ SadSkipMxNx4Param(32, 16, &vpx_highbd_sad_skip_32x16x4d_sse2, 12),
+ SadSkipMxNx4Param(16, 32, &vpx_highbd_sad_skip_16x32x4d_sse2, 12),
+ SadSkipMxNx4Param(16, 16, &vpx_highbd_sad_skip_16x16x4d_sse2, 12),
+ SadSkipMxNx4Param(16, 8, &vpx_highbd_sad_skip_16x8x4d_sse2, 12),
+ SadSkipMxNx4Param(8, 16, &vpx_highbd_sad_skip_8x16x4d_sse2, 12),
+ SadSkipMxNx4Param(8, 8, &vpx_highbd_sad_skip_8x8x4d_sse2, 12),
+ SadSkipMxNx4Param(4, 8, &vpx_highbd_sad_skip_4x8x4d_sse2, 12),
+#endif // CONFIG_VP9_HIGHBITDEPTH
+};
+INSTANTIATE_TEST_SUITE_P(SSE2, SADSkipx4Test,
+ ::testing::ValuesIn(skip_x4d_sse2_tests));
#endif // HAVE_SSE2
#if HAVE_SSE3
@@ -1113,6 +1744,44 @@ const SadMxNParam avx2_tests[] = {
};
INSTANTIATE_TEST_SUITE_P(AVX2, SADTest, ::testing::ValuesIn(avx2_tests));
+const SadSkipMxNParam skip_avx2_tests[] = {
+ SadSkipMxNParam(64, 64, &vpx_sad_skip_64x64_avx2),
+ SadSkipMxNParam(64, 32, &vpx_sad_skip_64x32_avx2),
+ SadSkipMxNParam(32, 64, &vpx_sad_skip_32x64_avx2),
+ SadSkipMxNParam(32, 32, &vpx_sad_skip_32x32_avx2),
+ SadSkipMxNParam(32, 16, &vpx_sad_skip_32x16_avx2),
+#if CONFIG_VP9_HIGHBITDEPTH
+ SadSkipMxNParam(64, 64, &vpx_highbd_sad_skip_64x64_avx2, 8),
+ SadSkipMxNParam(64, 32, &vpx_highbd_sad_skip_64x32_avx2, 8),
+ SadSkipMxNParam(32, 64, &vpx_highbd_sad_skip_32x64_avx2, 8),
+ SadSkipMxNParam(32, 32, &vpx_highbd_sad_skip_32x32_avx2, 8),
+ SadSkipMxNParam(32, 16, &vpx_highbd_sad_skip_32x16_avx2, 8),
+ SadSkipMxNParam(16, 32, &vpx_highbd_sad_skip_16x32_avx2, 8),
+ SadSkipMxNParam(16, 16, &vpx_highbd_sad_skip_16x16_avx2, 8),
+ SadSkipMxNParam(16, 8, &vpx_highbd_sad_skip_16x8_avx2, 8),
+
+ SadSkipMxNParam(64, 64, &vpx_highbd_sad_skip_64x64_avx2, 10),
+ SadSkipMxNParam(64, 32, &vpx_highbd_sad_skip_64x32_avx2, 10),
+ SadSkipMxNParam(32, 64, &vpx_highbd_sad_skip_32x64_avx2, 10),
+ SadSkipMxNParam(32, 32, &vpx_highbd_sad_skip_32x32_avx2, 10),
+ SadSkipMxNParam(32, 16, &vpx_highbd_sad_skip_32x16_avx2, 10),
+ SadSkipMxNParam(16, 32, &vpx_highbd_sad_skip_16x32_avx2, 10),
+ SadSkipMxNParam(16, 16, &vpx_highbd_sad_skip_16x16_avx2, 10),
+ SadSkipMxNParam(16, 8, &vpx_highbd_sad_skip_16x8_avx2, 10),
+
+ SadSkipMxNParam(64, 64, &vpx_highbd_sad_skip_64x64_avx2, 12),
+ SadSkipMxNParam(64, 32, &vpx_highbd_sad_skip_64x32_avx2, 12),
+ SadSkipMxNParam(32, 64, &vpx_highbd_sad_skip_32x64_avx2, 12),
+ SadSkipMxNParam(32, 32, &vpx_highbd_sad_skip_32x32_avx2, 12),
+ SadSkipMxNParam(32, 16, &vpx_highbd_sad_skip_32x16_avx2, 12),
+ SadSkipMxNParam(16, 32, &vpx_highbd_sad_skip_16x32_avx2, 12),
+ SadSkipMxNParam(16, 16, &vpx_highbd_sad_skip_16x16_avx2, 12),
+ SadSkipMxNParam(16, 8, &vpx_highbd_sad_skip_16x8_avx2, 12),
+#endif // CONFIG_VP9_HIGHBITDEPTH
+};
+INSTANTIATE_TEST_SUITE_P(AVX2, SADSkipTest,
+ ::testing::ValuesIn(skip_avx2_tests));
+
const SadMxNAvgParam avg_avx2_tests[] = {
SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_avx2),
SadMxNAvgParam(64, 32, &vpx_sad64x32_avg_avx2),
@@ -1180,6 +1849,42 @@ const SadMxNx4Param x4d_avx2_tests[] = {
};
INSTANTIATE_TEST_SUITE_P(AVX2, SADx4Test, ::testing::ValuesIn(x4d_avx2_tests));
+const SadSkipMxNx4Param skip_x4d_avx2_tests[] = {
+ SadSkipMxNx4Param(64, 64, &vpx_sad_skip_64x64x4d_avx2),
+ SadSkipMxNx4Param(64, 32, &vpx_sad_skip_64x32x4d_avx2),
+ SadSkipMxNx4Param(32, 64, &vpx_sad_skip_32x64x4d_avx2),
+ SadSkipMxNx4Param(32, 32, &vpx_sad_skip_32x32x4d_avx2),
+ SadSkipMxNx4Param(32, 16, &vpx_sad_skip_32x16x4d_avx2),
+#if CONFIG_VP9_HIGHBITDEPTH
+ SadSkipMxNx4Param(64, 64, &vpx_highbd_sad_skip_64x64x4d_avx2, 8),
+ SadSkipMxNx4Param(64, 32, &vpx_highbd_sad_skip_64x32x4d_avx2, 8),
+ SadSkipMxNx4Param(32, 64, &vpx_highbd_sad_skip_32x64x4d_avx2, 8),
+ SadSkipMxNx4Param(32, 32, &vpx_highbd_sad_skip_32x32x4d_avx2, 8),
+ SadSkipMxNx4Param(32, 16, &vpx_highbd_sad_skip_32x16x4d_avx2, 8),
+ SadSkipMxNx4Param(16, 32, &vpx_highbd_sad_skip_16x32x4d_avx2, 8),
+ SadSkipMxNx4Param(16, 16, &vpx_highbd_sad_skip_16x16x4d_avx2, 8),
+ SadSkipMxNx4Param(16, 8, &vpx_highbd_sad_skip_16x8x4d_avx2, 8),
+ SadSkipMxNx4Param(64, 64, &vpx_highbd_sad_skip_64x64x4d_avx2, 10),
+ SadSkipMxNx4Param(64, 32, &vpx_highbd_sad_skip_64x32x4d_avx2, 10),
+ SadSkipMxNx4Param(32, 64, &vpx_highbd_sad_skip_32x64x4d_avx2, 10),
+ SadSkipMxNx4Param(32, 32, &vpx_highbd_sad_skip_32x32x4d_avx2, 10),
+ SadSkipMxNx4Param(32, 16, &vpx_highbd_sad_skip_32x16x4d_avx2, 10),
+ SadSkipMxNx4Param(16, 32, &vpx_highbd_sad_skip_16x32x4d_avx2, 10),
+ SadSkipMxNx4Param(16, 16, &vpx_highbd_sad_skip_16x16x4d_avx2, 10),
+ SadSkipMxNx4Param(16, 8, &vpx_highbd_sad_skip_16x8x4d_avx2, 10),
+ SadSkipMxNx4Param(64, 64, &vpx_highbd_sad_skip_64x64x4d_avx2, 12),
+ SadSkipMxNx4Param(64, 32, &vpx_highbd_sad_skip_64x32x4d_avx2, 12),
+ SadSkipMxNx4Param(32, 64, &vpx_highbd_sad_skip_32x64x4d_avx2, 12),
+ SadSkipMxNx4Param(32, 32, &vpx_highbd_sad_skip_32x32x4d_avx2, 12),
+ SadSkipMxNx4Param(32, 16, &vpx_highbd_sad_skip_32x16x4d_avx2, 12),
+ SadSkipMxNx4Param(16, 32, &vpx_highbd_sad_skip_16x32x4d_avx2, 12),
+ SadSkipMxNx4Param(16, 16, &vpx_highbd_sad_skip_16x16x4d_avx2, 12),
+ SadSkipMxNx4Param(16, 8, &vpx_highbd_sad_skip_16x8x4d_avx2, 12),
+#endif // CONFIG_VP9_HIGHBITDEPTH
+};
+INSTANTIATE_TEST_SUITE_P(AVX2, SADSkipx4Test,
+ ::testing::ValuesIn(skip_x4d_avx2_tests));
+
#endif // HAVE_AVX2
#if HAVE_AVX512
diff --git a/test/set_roi.cc b/test/set_roi.cc
index 167cf908f..693410e39 100644
--- a/test/set_roi.cc
+++ b/test/set_roi.cc
@@ -40,7 +40,7 @@ TEST(VP8RoiMapTest, ParameterCheck) {
// Initialize elements of cpi with valid defaults.
VP8_COMP cpi;
- cpi.mb.e_mbd.mb_segement_abs_delta = SEGMENT_DELTADATA;
+ cpi.mb.e_mbd.mb_segment_abs_delta = SEGMENT_DELTADATA;
cpi.cyclic_refresh_mode_enabled = 0;
cpi.mb.e_mbd.segmentation_enabled = 0;
cpi.mb.e_mbd.update_mb_segmentation_map = 0;
diff --git a/test/sum_squares_test.cc b/test/sum_squares_test.cc
index df6da8403..725d5eb85 100644
--- a/test/sum_squares_test.cc
+++ b/test/sum_squares_test.cc
@@ -21,9 +21,14 @@
#include "test/clear_system_state.h"
#include "test/register_state_check.h"
#include "test/util.h"
+#include "vpx_mem/vpx_mem.h"
#include "vpx_ports/mem.h"
+#include "vpx_ports/vpx_timer.h"
using libvpx_test::ACMRandom;
+using ::testing::Combine;
+using ::testing::Range;
+using ::testing::ValuesIn;
namespace {
const int kNumIterations = 10000;
@@ -33,13 +38,13 @@ typedef std::tuple<SSI16Func, SSI16Func> SumSquaresParam;
class SumSquaresTest : public ::testing::TestWithParam<SumSquaresParam> {
public:
- virtual ~SumSquaresTest() {}
- virtual void SetUp() {
+ ~SumSquaresTest() override = default;
+ void SetUp() override {
ref_func_ = GET_PARAM(0);
tst_func_ = GET_PARAM(1);
}
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
+ void TearDown() override { libvpx_test::ClearSystemState(); }
protected:
SSI16Func ref_func_;
@@ -126,4 +131,210 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(make_tuple(&vpx_sum_squares_2d_i16_c,
&vpx_sum_squares_2d_i16_msa)));
#endif // HAVE_MSA
+
+typedef int64_t (*SSEFunc)(const uint8_t *a, int a_stride, const uint8_t *b,
+ int b_stride, int width, int height);
+
+struct TestSSEFuncs {
+ TestSSEFuncs(SSEFunc ref = nullptr, SSEFunc tst = nullptr, int depth = 0)
+ : ref_func(ref), tst_func(tst), bit_depth(depth) {}
+ SSEFunc ref_func; // Pointer to reference function
+ SSEFunc tst_func; // Pointer to tested function
+ int bit_depth;
+};
+
+typedef std::tuple<TestSSEFuncs, int> SSETestParam;
+
+class SSETest : public ::testing::TestWithParam<SSETestParam> {
+ public:
+ ~SSETest() override = default;
+ void SetUp() override {
+ params_ = GET_PARAM(0);
+ width_ = GET_PARAM(1);
+ is_hbd_ =
+#if CONFIG_VP9_HIGHBITDEPTH
+ params_.ref_func == vpx_highbd_sse_c;
+#else
+ false;
+#endif
+ rnd_.Reset(ACMRandom::DeterministicSeed());
+ src_ = reinterpret_cast<uint8_t *>(vpx_memalign(32, 256 * 256 * 2));
+ ref_ = reinterpret_cast<uint8_t *>(vpx_memalign(32, 256 * 256 * 2));
+ ASSERT_NE(src_, nullptr);
+ ASSERT_NE(ref_, nullptr);
+ }
+
+ void TearDown() override {
+ vpx_free(src_);
+ vpx_free(ref_);
+ }
+ void RunTest(bool is_random, int width, int height, int run_times);
+
+ void GenRandomData(int width, int height, int stride) {
+ uint16_t *src16 = reinterpret_cast<uint16_t *>(src_);
+ uint16_t *ref16 = reinterpret_cast<uint16_t *>(ref_);
+ const int msb = 11; // Up to 12 bit input
+ const int limit = 1 << (msb + 1);
+ for (int ii = 0; ii < height; ii++) {
+ for (int jj = 0; jj < width; jj++) {
+ if (!is_hbd_) {
+ src_[ii * stride + jj] = rnd_.Rand8();
+ ref_[ii * stride + jj] = rnd_.Rand8();
+ } else {
+ src16[ii * stride + jj] = rnd_(limit);
+ ref16[ii * stride + jj] = rnd_(limit);
+ }
+ }
+ }
+ }
+
+ void GenExtremeData(int width, int height, int stride, uint8_t *data,
+ int16_t val) {
+ uint16_t *data16 = reinterpret_cast<uint16_t *>(data);
+ for (int ii = 0; ii < height; ii++) {
+ for (int jj = 0; jj < width; jj++) {
+ if (!is_hbd_) {
+ data[ii * stride + jj] = static_cast<uint8_t>(val);
+ } else {
+ data16[ii * stride + jj] = val;
+ }
+ }
+ }
+ }
+
+ protected:
+ bool is_hbd_;
+ int width_;
+ TestSSEFuncs params_;
+ uint8_t *src_;
+ uint8_t *ref_;
+ ACMRandom rnd_;
+};
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SSETest);
+
+void SSETest::RunTest(bool is_random, int width, int height, int run_times) {
+ int failed = 0;
+ vpx_usec_timer ref_timer, test_timer;
+ for (int k = 0; k < 3; k++) {
+ int stride = 4 << rnd_(7); // Up to 256 stride
+ while (stride < width) { // Make sure it's valid
+ stride = 4 << rnd_(7);
+ }
+ if (is_random) {
+ GenRandomData(width, height, stride);
+ } else {
+ const int msb = is_hbd_ ? 12 : 8; // Up to 12 bit input
+ const int limit = (1 << msb) - 1;
+ if (k == 0) {
+ GenExtremeData(width, height, stride, src_, 0);
+ GenExtremeData(width, height, stride, ref_, limit);
+ } else {
+ GenExtremeData(width, height, stride, src_, limit);
+ GenExtremeData(width, height, stride, ref_, 0);
+ }
+ }
+ int64_t res_ref, res_tst;
+ uint8_t *src = src_;
+ uint8_t *ref = ref_;
+#if CONFIG_VP9_HIGHBITDEPTH
+ if (is_hbd_) {
+ src = CONVERT_TO_BYTEPTR(src_);
+ ref = CONVERT_TO_BYTEPTR(ref_);
+ }
+#endif
+ res_ref = params_.ref_func(src, stride, ref, stride, width, height);
+ res_tst = params_.tst_func(src, stride, ref, stride, width, height);
+ if (run_times > 1) {
+ vpx_usec_timer_start(&ref_timer);
+ for (int j = 0; j < run_times; j++) {
+ params_.ref_func(src, stride, ref, stride, width, height);
+ }
+ vpx_usec_timer_mark(&ref_timer);
+ const int elapsed_time_c =
+ static_cast<int>(vpx_usec_timer_elapsed(&ref_timer));
+
+ vpx_usec_timer_start(&test_timer);
+ for (int j = 0; j < run_times; j++) {
+ params_.tst_func(src, stride, ref, stride, width, height);
+ }
+ vpx_usec_timer_mark(&test_timer);
+ const int elapsed_time_simd =
+ static_cast<int>(vpx_usec_timer_elapsed(&test_timer));
+
+ printf(
+ "c_time=%d \t simd_time=%d \t "
+ "gain=%d\n",
+ elapsed_time_c, elapsed_time_simd,
+ (elapsed_time_c / elapsed_time_simd));
+ } else {
+ if (!failed) {
+ failed = res_ref != res_tst;
+ EXPECT_EQ(res_ref, res_tst)
+ << "Error:" << (is_hbd_ ? "hbd " : " ") << k << " SSE Test ["
+ << width << "x" << height
+ << "] C output does not match optimized output.";
+ }
+ }
+ }
+}
+
+TEST_P(SSETest, OperationCheck) {
+ for (int height = 4; height <= 128; height += 4) {
+ RunTest(true, width_, height, 1); // GenRandomData
+ }
+}
+
+TEST_P(SSETest, ExtremeValues) {
+ for (int height = 4; height <= 128; height += 4) {
+ RunTest(false, width_, height, 1);
+ }
+}
+
+TEST_P(SSETest, DISABLED_Speed) {
+ for (int height = 4; height <= 128; height += 4) {
+ RunTest(true, width_, height, 100);
+ }
+}
+
+#if HAVE_NEON
+TestSSEFuncs sse_neon[] = {
+ TestSSEFuncs(&vpx_sse_c, &vpx_sse_neon),
+#if CONFIG_VP9_HIGHBITDEPTH
+ TestSSEFuncs(&vpx_highbd_sse_c, &vpx_highbd_sse_neon)
+#endif
+};
+INSTANTIATE_TEST_SUITE_P(NEON, SSETest,
+ Combine(ValuesIn(sse_neon), Range(4, 129, 4)));
+#endif // HAVE_NEON
+
+#if HAVE_NEON_DOTPROD
+TestSSEFuncs sse_neon_dotprod[] = {
+ TestSSEFuncs(&vpx_sse_c, &vpx_sse_neon_dotprod),
+};
+INSTANTIATE_TEST_SUITE_P(NEON_DOTPROD, SSETest,
+ Combine(ValuesIn(sse_neon_dotprod), Range(4, 129, 4)));
+#endif // HAVE_NEON_DOTPROD
+
+#if HAVE_SSE4_1
+TestSSEFuncs sse_sse4[] = {
+ TestSSEFuncs(&vpx_sse_c, &vpx_sse_sse4_1),
+#if CONFIG_VP9_HIGHBITDEPTH
+ TestSSEFuncs(&vpx_highbd_sse_c, &vpx_highbd_sse_sse4_1)
+#endif
+};
+INSTANTIATE_TEST_SUITE_P(SSE4_1, SSETest,
+ Combine(ValuesIn(sse_sse4), Range(4, 129, 4)));
+#endif // HAVE_SSE4_1
+
+#if HAVE_AVX2
+
+TestSSEFuncs sse_avx2[] = {
+ TestSSEFuncs(&vpx_sse_c, &vpx_sse_avx2),
+#if CONFIG_VP9_HIGHBITDEPTH
+ TestSSEFuncs(&vpx_highbd_sse_c, &vpx_highbd_sse_avx2)
+#endif
+};
+INSTANTIATE_TEST_SUITE_P(AVX2, SSETest,
+ Combine(ValuesIn(sse_avx2), Range(4, 129, 4)));
+#endif // HAVE_AVX2
} // namespace
diff --git a/test/superframe_test.cc b/test/superframe_test.cc
index a5c92e914..4c3aa1625 100644
--- a/test/superframe_test.cc
+++ b/test/superframe_test.cc
@@ -28,9 +28,9 @@ class SuperframeTest
protected:
SuperframeTest()
: EncoderTest(GET_PARAM(0)), modified_buf_(nullptr), last_sf_pts_(0) {}
- virtual ~SuperframeTest() {}
+ ~SuperframeTest() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
const SuperframeTestParam input = GET_PARAM(1);
const libvpx_test::TestMode mode = std::get<kTestMode>(input);
@@ -39,17 +39,17 @@ class SuperframeTest
sf_count_max_ = INT_MAX;
}
- virtual void TearDown() { delete[] modified_buf_; }
+ void TearDown() override { delete[] modified_buf_; }
- virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
- libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(libvpx_test::VideoSource *video,
+ libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
}
}
- virtual const vpx_codec_cx_pkt_t *MutateEncoderOutputHook(
- const vpx_codec_cx_pkt_t *pkt) {
+ const vpx_codec_cx_pkt_t *MutateEncoderOutputHook(
+ const vpx_codec_cx_pkt_t *pkt) override {
if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) return pkt;
const uint8_t *buffer = reinterpret_cast<uint8_t *>(pkt->data.frame.buf);
diff --git a/test/svc_datarate_test.cc b/test/svc_datarate_test.cc
index 484252ca4..aff4ace84 100644
--- a/test/svc_datarate_test.cc
+++ b/test/svc_datarate_test.cc
@@ -43,7 +43,7 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
}
protected:
- virtual ~DatarateOnePassCbrSvc() {}
+ ~DatarateOnePassCbrSvc() override = default;
virtual void ResetModel() {
last_pts_ = 0;
@@ -86,7 +86,7 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
}
ksvc_flex_noupd_tlenh_ = false;
}
- virtual void BeginPassHook(unsigned int /*pass*/) {}
+ void BeginPassHook(unsigned int /*pass*/) override {}
// Example pattern for spatial layers and 2 temporal layers used in the
// bypass/flexible mode. The pattern corresponds to the pattern
@@ -179,8 +179,8 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
}
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
PreEncodeFrameHookSetup(video, encoder);
if (video->frame() == 0) {
@@ -256,13 +256,13 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
temporal_layer_id_ = layer_id.temporal_layer_id;
for (int i = 0; i < number_spatial_layers_; i++) {
layer_id.temporal_layer_id_per_spatial[i] = temporal_layer_id_;
- ref_frame_config.duration[i] = 1;
+ ref_frame_config_.duration[i] = 1;
}
encoder->Control(VP9E_SET_SVC_LAYER_ID, &layer_id);
set_frame_flags_bypass_mode(layer_id.temporal_layer_id,
- number_spatial_layers_, 0, &ref_frame_config,
+ number_spatial_layers_, 0, &ref_frame_config_,
1);
- encoder->Control(VP9E_SET_SVC_REF_FRAME_CONFIG, &ref_frame_config);
+ encoder->Control(VP9E_SET_SVC_REF_FRAME_CONFIG, &ref_frame_config_);
}
if (update_pattern_ && video->frame() >= 100) {
@@ -277,13 +277,13 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
temporal_layer_id_ = layer_id.temporal_layer_id;
for (int i = 0; i < number_spatial_layers_; i++) {
layer_id.temporal_layer_id_per_spatial[i] = temporal_layer_id_;
- ref_frame_config.duration[i] = 1;
+ ref_frame_config_.duration[i] = 1;
}
encoder->Control(VP9E_SET_SVC_LAYER_ID, &layer_id);
set_frame_flags_bypass_mode(layer_id.temporal_layer_id,
- number_spatial_layers_, 0, &ref_frame_config,
+ number_spatial_layers_, 0, &ref_frame_config_,
0);
- encoder->Control(VP9E_SET_SVC_REF_FRAME_CONFIG, &ref_frame_config);
+ encoder->Control(VP9E_SET_SVC_REF_FRAME_CONFIG, &ref_frame_config_);
}
if (change_bitrate_ && video->frame() == 200) {
@@ -468,7 +468,7 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
return VPX_CODEC_OK;
}
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
uint32_t sizes[8] = { 0 };
uint32_t sizes_parsed[8] = { 0 };
int count = 0;
@@ -571,7 +571,7 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
}
}
- virtual void EndPassHook() {
+ void EndPassHook() override {
if (change_bitrate_) last_pts_ = last_pts_ - last_pts_ref_;
duration_ = (last_pts_ + 1) * timebase_;
for (int sl = 0; sl < number_spatial_layers_; ++sl) {
@@ -583,7 +583,7 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
}
}
- virtual void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2) {
+ void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2) override {
// TODO(marpan): Look into why an assert is triggered in compute_psnr
// for mismatch frames for the special test case: ksvc_flex_noupd_tlenh.
// Has to do with dropped frames in bypass/flexible svc mode.
@@ -611,7 +611,7 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
bool single_layer_resize_;
unsigned int top_sl_width_;
unsigned int top_sl_height_;
- vpx_svc_ref_frame_config_t ref_frame_config;
+ vpx_svc_ref_frame_config_t ref_frame_config_;
int update_pattern_;
bool change_bitrate_;
vpx_codec_pts_t last_pts_ref_;
@@ -639,7 +639,7 @@ class DatarateOnePassCbrSvc : public OnePassCbrSvc {
bool ksvc_flex_noupd_tlenh_;
private:
- virtual void SetConfig(const int num_temporal_layer) {
+ void SetConfig(const int num_temporal_layer) override {
cfg_.rc_end_usage = VPX_CBR;
cfg_.g_lag_in_frames = 0;
cfg_.g_error_resilient = 1;
@@ -670,10 +670,10 @@ class DatarateOnePassCbrSvcSingleBR
DatarateOnePassCbrSvcSingleBR() : DatarateOnePassCbrSvc(GET_PARAM(0)) {
memset(&svc_params_, 0, sizeof(svc_params_));
}
- virtual ~DatarateOnePassCbrSvcSingleBR() {}
+ ~DatarateOnePassCbrSvcSingleBR() override = default;
protected:
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(::libvpx_test::kRealTime);
speed_setting_ = GET_PARAM(1);
@@ -1160,10 +1160,10 @@ class DatarateOnePassCbrSvcMultiBR
DatarateOnePassCbrSvcMultiBR() : DatarateOnePassCbrSvc(GET_PARAM(0)) {
memset(&svc_params_, 0, sizeof(svc_params_));
}
- virtual ~DatarateOnePassCbrSvcMultiBR() {}
+ ~DatarateOnePassCbrSvcMultiBR() override = default;
protected:
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(::libvpx_test::kRealTime);
speed_setting_ = GET_PARAM(1);
@@ -1243,10 +1243,10 @@ class DatarateOnePassCbrSvcFrameDropMultiBR
: DatarateOnePassCbrSvc(GET_PARAM(0)) {
memset(&svc_params_, 0, sizeof(svc_params_));
}
- virtual ~DatarateOnePassCbrSvcFrameDropMultiBR() {}
+ ~DatarateOnePassCbrSvcFrameDropMultiBR() override = default;
protected:
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(::libvpx_test::kRealTime);
speed_setting_ = GET_PARAM(1);
@@ -1355,10 +1355,10 @@ class DatarateOnePassCbrSvcInterLayerPredSingleBR
: DatarateOnePassCbrSvc(GET_PARAM(0)) {
memset(&svc_params_, 0, sizeof(svc_params_));
}
- virtual ~DatarateOnePassCbrSvcInterLayerPredSingleBR() {}
+ ~DatarateOnePassCbrSvcInterLayerPredSingleBR() override = default;
protected:
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(::libvpx_test::kRealTime);
speed_setting_ = GET_PARAM(1);
@@ -1441,10 +1441,10 @@ class DatarateOnePassCbrSvcDenoiser
DatarateOnePassCbrSvcDenoiser() : DatarateOnePassCbrSvc(GET_PARAM(0)) {
memset(&svc_params_, 0, sizeof(svc_params_));
}
- virtual ~DatarateOnePassCbrSvcDenoiser() {}
+ ~DatarateOnePassCbrSvcDenoiser() override = default;
protected:
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(::libvpx_test::kRealTime);
speed_setting_ = GET_PARAM(1);
@@ -1499,10 +1499,10 @@ class DatarateOnePassCbrSvcSmallKF
DatarateOnePassCbrSvcSmallKF() : DatarateOnePassCbrSvc(GET_PARAM(0)) {
memset(&svc_params_, 0, sizeof(svc_params_));
}
- virtual ~DatarateOnePassCbrSvcSmallKF() {}
+ ~DatarateOnePassCbrSvcSmallKF() override = default;
protected:
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(::libvpx_test::kRealTime);
speed_setting_ = GET_PARAM(1);
@@ -1702,10 +1702,10 @@ class DatarateOnePassCbrSvcPostencodeDrop
DatarateOnePassCbrSvcPostencodeDrop() : DatarateOnePassCbrSvc(GET_PARAM(0)) {
memset(&svc_params_, 0, sizeof(svc_params_));
}
- virtual ~DatarateOnePassCbrSvcPostencodeDrop() {}
+ ~DatarateOnePassCbrSvcPostencodeDrop() override = default;
protected:
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(::libvpx_test::kRealTime);
speed_setting_ = GET_PARAM(1);
diff --git a/test/svc_end_to_end_test.cc b/test/svc_end_to_end_test.cc
index 7300ce667..b4337ae75 100644
--- a/test/svc_end_to_end_test.cc
+++ b/test/svc_end_to_end_test.cc
@@ -45,19 +45,19 @@ class ScalePartitionOnePassCbrSvc
}
protected:
- virtual ~ScalePartitionOnePassCbrSvc() {}
+ ~ScalePartitionOnePassCbrSvc() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
speed_setting_ = 7;
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
PreEncodeFrameHookSetup(video, encoder);
}
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
// Keep track of number of non-reference frames, needed for mismatch check.
// Non-reference frames are top spatial and temporal layer frames,
// for TL > 0.
@@ -67,12 +67,12 @@ class ScalePartitionOnePassCbrSvc
num_nonref_frames_++;
}
- virtual void MismatchHook(const vpx_image_t * /*img1*/,
- const vpx_image_t * /*img2*/) {
+ void MismatchHook(const vpx_image_t * /*img1*/,
+ const vpx_image_t * /*img2*/) override {
++mismatch_nframes_;
}
- virtual void SetConfig(const int /*num_temporal_layer*/) {}
+ void SetConfig(const int /*num_temporal_layer*/) override {}
unsigned int GetMismatchFrames() const { return mismatch_nframes_; }
unsigned int GetNonRefFrames() const { return num_nonref_frames_; }
@@ -129,14 +129,14 @@ class SyncFrameOnePassCbrSvc : public OnePassCbrSvc,
}
protected:
- virtual ~SyncFrameOnePassCbrSvc() {}
+ ~SyncFrameOnePassCbrSvc() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
speed_setting_ = 7;
}
- virtual bool DoDecode() const {
+ bool DoDecode() const override {
return current_video_frame_ >= frame_to_start_decode_;
}
@@ -225,8 +225,8 @@ class SyncFrameOnePassCbrSvc : public OnePassCbrSvc,
}
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
current_video_frame_ = video->frame();
PreEncodeFrameHookSetup(video, encoder);
if (video->frame() == 0) {
@@ -265,8 +265,8 @@ class SyncFrameOnePassCbrSvc : public OnePassCbrSvc,
}
#if CONFIG_VP9_DECODER
- virtual void PreDecodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Decoder *decoder) {
+ void PreDecodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Decoder *decoder) override {
if (video->frame() < frame_to_sync_) {
if (decode_to_layer_before_sync_ >= 0)
decoder->Control(VP9_DECODE_SVC_SPATIAL_LAYER,
@@ -284,7 +284,7 @@ class SyncFrameOnePassCbrSvc : public OnePassCbrSvc,
}
#endif
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
// Keep track of number of non-reference frames, needed for mismatch check.
// Non-reference frames are top spatial and temporal layer frames,
// for TL > 0.
@@ -307,8 +307,8 @@ class SyncFrameOnePassCbrSvc : public OnePassCbrSvc,
}
}
- virtual void MismatchHook(const vpx_image_t * /*img1*/,
- const vpx_image_t * /*img2*/) {
+ void MismatchHook(const vpx_image_t * /*img1*/,
+ const vpx_image_t * /*img2*/) override {
if (current_video_frame_ >= frame_to_sync_) ++mismatch_nframes_;
}
@@ -331,7 +331,7 @@ class SyncFrameOnePassCbrSvc : public OnePassCbrSvc,
vpx_svc_ref_frame_config_t ref_frame_config_;
private:
- virtual void SetConfig(const int num_temporal_layer) {
+ void SetConfig(const int num_temporal_layer) override {
cfg_.rc_buf_initial_sz = 500;
cfg_.rc_buf_optimal_sz = 500;
cfg_.rc_buf_sz = 1000;
@@ -657,15 +657,15 @@ class LoopfilterOnePassCbrSvc : public OnePassCbrSvc,
}
protected:
- virtual ~LoopfilterOnePassCbrSvc() {}
+ ~LoopfilterOnePassCbrSvc() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
speed_setting_ = 7;
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
PreEncodeFrameHookSetup(video, encoder);
if (number_temporal_layers_ > 1 || number_spatial_layers_ > 1) {
// Consider 3 cases:
@@ -694,7 +694,7 @@ class LoopfilterOnePassCbrSvc : public OnePassCbrSvc,
}
}
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
// Keep track of number of non-reference frames, needed for mismatch check.
// Non-reference frames are top spatial and temporal layer frames,
// for TL > 0.
@@ -704,12 +704,12 @@ class LoopfilterOnePassCbrSvc : public OnePassCbrSvc,
num_nonref_frames_++;
}
- virtual void MismatchHook(const vpx_image_t * /*img1*/,
- const vpx_image_t * /*img2*/) {
+ void MismatchHook(const vpx_image_t * /*img1*/,
+ const vpx_image_t * /*img2*/) override {
++mismatch_nframes_;
}
- virtual void SetConfig(const int /*num_temporal_layer*/) {}
+ void SetConfig(const int /*num_temporal_layer*/) override {}
int GetMismatchFrames() const { return mismatch_nframes_; }
int GetNonRefFrames() const { return num_nonref_frames_; }
diff --git a/test/svc_test.h b/test/svc_test.h
index f1d727fd9..0026372de 100644
--- a/test/svc_test.h
+++ b/test/svc_test.h
@@ -36,7 +36,7 @@ class OnePassCbrSvc : public ::libvpx_test::EncoderTest {
}
protected:
- virtual ~OnePassCbrSvc() {}
+ ~OnePassCbrSvc() override {}
virtual void SetConfig(const int num_temporal_layer) = 0;
@@ -46,11 +46,11 @@ class OnePassCbrSvc : public ::libvpx_test::EncoderTest {
virtual void PreEncodeFrameHookSetup(::libvpx_test::VideoSource *video,
::libvpx_test::Encoder *encoder);
- virtual void PostEncodeFrameHook(::libvpx_test::Encoder *encoder);
+ void PostEncodeFrameHook(::libvpx_test::Encoder *encoder) override;
virtual void AssignLayerBitrates();
- virtual void MismatchHook(const vpx_image_t *, const vpx_image_t *) {}
+ void MismatchHook(const vpx_image_t *, const vpx_image_t *) override {}
vpx_svc_extra_cfg_t svc_params_;
int64_t bits_in_buffer_model_[VPX_MAX_LAYERS];
diff --git a/test/test-data.mk b/test/test-data.mk
index 62a9d6ef1..9eabffae3 100644
--- a/test/test-data.mk
+++ b/test/test-data.mk
@@ -29,6 +29,7 @@ LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += rush_hour_444.y4m
LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += screendata.y4m
LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += niklas_640_480_30.yuv
LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += bus_352x288_420_f20_b8.yuv
+LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER) += crowd_run_360p_10_150f.y4m
# Test vectors
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-001.ivf
diff --git a/test/test-data.sha1 b/test/test-data.sha1
index 55f92a25d..a9decc6b6 100644
--- a/test/test-data.sha1
+++ b/test/test-data.sha1
@@ -870,3 +870,4 @@ bac455906360b45338a16dd626ac5f19bc36a307 *desktop_office1.1280_720-020.yuv
d3964f9dad9f60363c81b688324d95b4ec7c8038 *invalid-bug-148271109.ivf.res
ad18ca16f0a249fb3b7c38de0d9b327fed273f96 *hantro_collage_w352h288_nv12.yuv
8a0b2c350539859463d3546a67876c83ff6ff0ac *desktopqvga.320_240.yuv
+ad9942a073e245585c93f764ea299382a65939a7 *crowd_run_360p_10_150f.y4m
diff --git a/test/test.mk b/test/test.mk
index f60d8f823..d4521f08b 100644
--- a/test/test.mk
+++ b/test/test.mk
@@ -7,6 +7,8 @@ LIBVPX_TEST_SRCS-yes += codec_factory.h
LIBVPX_TEST_SRCS-yes += md5_helper.h
LIBVPX_TEST_SRCS-yes += register_state_check.h
LIBVPX_TEST_SRCS-yes += test.mk
+LIBVPX_TEST_SRCS-yes += init_vpx_test.cc
+LIBVPX_TEST_SRCS-yes += init_vpx_test.h
LIBVPX_TEST_SRCS-yes += test_libvpx.cc
LIBVPX_TEST_SRCS-yes += test_vectors.cc
LIBVPX_TEST_SRCS-yes += test_vectors.h
@@ -22,10 +24,6 @@ LIBVPX_TEST_SRCS-yes += ../md5_utils.h ../md5_utils.c
LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += ivf_video_source.h
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += ../y4minput.h ../y4minput.c
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += altref_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += aq_segment_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += alt_ref_aq_segment_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += vp8_datarate_test.cc
-LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += vp9_datarate_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += encode_api_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += error_resilience_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += i420_video_source.h
@@ -37,6 +35,7 @@ LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += yuv_video_source.h
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += config_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += cq_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += keyframe_test.cc
+LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += vp8_datarate_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += byte_alignment_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += decode_svc_test.cc
@@ -44,6 +43,8 @@ LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += external_frame_buffer_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += user_priv_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += active_map_refresh_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += active_map_test.cc
+LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += alt_ref_aq_segment_test.cc
+LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += aq_segment_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += borders_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += cpu_speed_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += frame_size_tests.cc
@@ -58,6 +59,7 @@ LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += svc_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += svc_test.h
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += svc_end_to_end_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += timestamp_test.cc
+LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_datarate_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_ext_ratectrl_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += ../vp9/simple_encode.h
@@ -85,6 +87,7 @@ LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += ../webmdec.cc
LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += ../webmdec.h
LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += webm_video_source.h
LIBVPX_TEST_SRCS-$(CONFIG_VP9_DECODER) += vp9_skip_loopfilter_test.cc
+$(BUILD_PFX)third_party/libwebm/%.cc.o: CXXFLAGS += $(LIBWEBM_CXXFLAGS)
endif
LIBVPX_TEST_SRCS-$(CONFIG_DECODERS) += decode_api_test.cc
@@ -179,7 +182,7 @@ ifneq ($(CONFIG_REALTIME_ONLY),yes)
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += yuv_temporal_filter_test.cc
endif
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += variance_test.cc
-ifneq (, $(filter yes, $(HAVE_SSE2) $(HAVE_AVX2)))
+ifneq (, $(filter yes, $(HAVE_SSE2) $(HAVE_AVX2) $(HAVE_NEON)))
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_block_error_test.cc
endif
LIBVPX_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_quantize_test.cc
@@ -214,6 +217,8 @@ endif
TEST_INTRA_PRED_SPEED_SRCS-yes := test_intra_pred_speed.cc
TEST_INTRA_PRED_SPEED_SRCS-yes += ../md5_utils.h ../md5_utils.c
+TEST_INTRA_PRED_SPEED_SRCS-yes += init_vpx_test.cc
+TEST_INTRA_PRED_SPEED_SRCS-yes += init_vpx_test.h
RC_INTERFACE_TEST_SRCS-yes := test_rc_interface.cc
RC_INTERFACE_TEST_SRCS-$(CONFIG_VP9_ENCODER) += vp9_ratectrl_rtc_test.cc
diff --git a/test/test_intra_pred_speed.cc b/test/test_intra_pred_speed.cc
index 28b3484a0..4c464a262 100644
--- a/test/test_intra_pred_speed.cc
+++ b/test/test_intra_pred_speed.cc
@@ -14,9 +14,11 @@
#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "./vpx_config.h"
#include "./vpx_dsp_rtcd.h"
#include "test/acm_random.h"
#include "test/clear_system_state.h"
+#include "test/init_vpx_test.h"
#include "test/md5_helper.h"
#include "vpx/vpx_integer.h"
#include "vpx_ports/mem.h"
@@ -269,28 +271,32 @@ INTRA_PRED_TEST(NEON, TestIntraPred4, vpx_dc_predictor_4x4_neon,
vpx_dc_left_predictor_4x4_neon, vpx_dc_top_predictor_4x4_neon,
vpx_dc_128_predictor_4x4_neon, vpx_v_predictor_4x4_neon,
vpx_h_predictor_4x4_neon, vpx_d45_predictor_4x4_neon,
- vpx_d135_predictor_4x4_neon, nullptr, nullptr, nullptr, nullptr,
- vpx_tm_predictor_4x4_neon)
+ vpx_d135_predictor_4x4_neon, vpx_d117_predictor_4x4_neon,
+ vpx_d153_predictor_4x4_neon, vpx_d207_predictor_4x4_neon,
+ vpx_d63_predictor_4x4_neon, vpx_tm_predictor_4x4_neon)
INTRA_PRED_TEST(NEON, TestIntraPred8, vpx_dc_predictor_8x8_neon,
vpx_dc_left_predictor_8x8_neon, vpx_dc_top_predictor_8x8_neon,
vpx_dc_128_predictor_8x8_neon, vpx_v_predictor_8x8_neon,
vpx_h_predictor_8x8_neon, vpx_d45_predictor_8x8_neon,
- vpx_d135_predictor_8x8_neon, nullptr, nullptr, nullptr, nullptr,
- vpx_tm_predictor_8x8_neon)
+ vpx_d135_predictor_8x8_neon, vpx_d117_predictor_8x8_neon,
+ vpx_d153_predictor_8x8_neon, vpx_d207_predictor_8x8_neon,
+ vpx_d63_predictor_8x8_neon, vpx_tm_predictor_8x8_neon)
INTRA_PRED_TEST(NEON, TestIntraPred16, vpx_dc_predictor_16x16_neon,
vpx_dc_left_predictor_16x16_neon,
vpx_dc_top_predictor_16x16_neon,
vpx_dc_128_predictor_16x16_neon, vpx_v_predictor_16x16_neon,
vpx_h_predictor_16x16_neon, vpx_d45_predictor_16x16_neon,
- vpx_d135_predictor_16x16_neon, nullptr, nullptr, nullptr,
- nullptr, vpx_tm_predictor_16x16_neon)
+ vpx_d135_predictor_16x16_neon, vpx_d117_predictor_16x16_neon,
+ vpx_d153_predictor_16x16_neon, vpx_d207_predictor_16x16_neon,
+ vpx_d63_predictor_16x16_neon, vpx_tm_predictor_16x16_neon)
INTRA_PRED_TEST(NEON, TestIntraPred32, vpx_dc_predictor_32x32_neon,
vpx_dc_left_predictor_32x32_neon,
vpx_dc_top_predictor_32x32_neon,
vpx_dc_128_predictor_32x32_neon, vpx_v_predictor_32x32_neon,
vpx_h_predictor_32x32_neon, vpx_d45_predictor_32x32_neon,
- vpx_d135_predictor_32x32_neon, nullptr, nullptr, nullptr,
- nullptr, vpx_tm_predictor_32x32_neon)
+ vpx_d135_predictor_32x32_neon, vpx_d117_predictor_32x32_neon,
+ vpx_d153_predictor_32x32_neon, vpx_d207_predictor_32x32_neon,
+ vpx_d63_predictor_32x32_neon, vpx_tm_predictor_32x32_neon)
#endif // HAVE_NEON
#if HAVE_MSA
@@ -344,6 +350,15 @@ INTRA_PRED_TEST(VSX, TestIntraPred32, vpx_dc_predictor_32x32_vsx,
vpx_tm_predictor_32x32_vsx)
#endif // HAVE_VSX
+#if HAVE_LSX
+INTRA_PRED_TEST(LSX, TestIntraPred8, vpx_dc_predictor_8x8_lsx, nullptr, nullptr,
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
+ nullptr, nullptr, nullptr)
+INTRA_PRED_TEST(LSX, TestIntraPred16, vpx_dc_predictor_16x16_lsx, nullptr,
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
+ nullptr, nullptr, nullptr, nullptr)
+#endif // HAVE_LSX
+
// -----------------------------------------------------------------------------
#if CONFIG_VP9_HIGHBITDEPTH
@@ -561,37 +576,41 @@ HIGHBD_INTRA_PRED_TEST(
vpx_highbd_dc_left_predictor_4x4_neon, vpx_highbd_dc_top_predictor_4x4_neon,
vpx_highbd_dc_128_predictor_4x4_neon, vpx_highbd_v_predictor_4x4_neon,
vpx_highbd_h_predictor_4x4_neon, vpx_highbd_d45_predictor_4x4_neon,
- vpx_highbd_d135_predictor_4x4_neon, nullptr, nullptr, nullptr, nullptr,
- vpx_highbd_tm_predictor_4x4_neon)
+ vpx_highbd_d135_predictor_4x4_neon, vpx_highbd_d117_predictor_4x4_neon,
+ vpx_highbd_d153_predictor_4x4_neon, vpx_highbd_d207_predictor_4x4_neon,
+ vpx_highbd_d63_predictor_4x4_neon, vpx_highbd_tm_predictor_4x4_neon)
HIGHBD_INTRA_PRED_TEST(
NEON, TestHighbdIntraPred8, vpx_highbd_dc_predictor_8x8_neon,
vpx_highbd_dc_left_predictor_8x8_neon, vpx_highbd_dc_top_predictor_8x8_neon,
vpx_highbd_dc_128_predictor_8x8_neon, vpx_highbd_v_predictor_8x8_neon,
vpx_highbd_h_predictor_8x8_neon, vpx_highbd_d45_predictor_8x8_neon,
- vpx_highbd_d135_predictor_8x8_neon, nullptr, nullptr, nullptr, nullptr,
- vpx_highbd_tm_predictor_8x8_neon)
-HIGHBD_INTRA_PRED_TEST(NEON, TestHighbdIntraPred16,
- vpx_highbd_dc_predictor_16x16_neon,
- vpx_highbd_dc_left_predictor_16x16_neon,
- vpx_highbd_dc_top_predictor_16x16_neon,
- vpx_highbd_dc_128_predictor_16x16_neon,
- vpx_highbd_v_predictor_16x16_neon,
- vpx_highbd_h_predictor_16x16_neon,
- vpx_highbd_d45_predictor_16x16_neon,
- vpx_highbd_d135_predictor_16x16_neon, nullptr, nullptr,
- nullptr, nullptr, vpx_highbd_tm_predictor_16x16_neon)
-HIGHBD_INTRA_PRED_TEST(NEON, TestHighbdIntraPred32,
- vpx_highbd_dc_predictor_32x32_neon,
- vpx_highbd_dc_left_predictor_32x32_neon,
- vpx_highbd_dc_top_predictor_32x32_neon,
- vpx_highbd_dc_128_predictor_32x32_neon,
- vpx_highbd_v_predictor_32x32_neon,
- vpx_highbd_h_predictor_32x32_neon,
- vpx_highbd_d45_predictor_32x32_neon,
- vpx_highbd_d135_predictor_32x32_neon, nullptr, nullptr,
- nullptr, nullptr, vpx_highbd_tm_predictor_32x32_neon)
+ vpx_highbd_d135_predictor_8x8_neon, vpx_highbd_d117_predictor_8x8_neon,
+ vpx_highbd_d153_predictor_8x8_neon, vpx_highbd_d207_predictor_8x8_neon,
+ vpx_highbd_d63_predictor_8x8_neon, vpx_highbd_tm_predictor_8x8_neon)
+HIGHBD_INTRA_PRED_TEST(
+ NEON, TestHighbdIntraPred16, vpx_highbd_dc_predictor_16x16_neon,
+ vpx_highbd_dc_left_predictor_16x16_neon,
+ vpx_highbd_dc_top_predictor_16x16_neon,
+ vpx_highbd_dc_128_predictor_16x16_neon, vpx_highbd_v_predictor_16x16_neon,
+ vpx_highbd_h_predictor_16x16_neon, vpx_highbd_d45_predictor_16x16_neon,
+ vpx_highbd_d135_predictor_16x16_neon, vpx_highbd_d117_predictor_16x16_neon,
+ vpx_highbd_d153_predictor_16x16_neon, vpx_highbd_d207_predictor_16x16_neon,
+ vpx_highbd_d63_predictor_16x16_neon, vpx_highbd_tm_predictor_16x16_neon)
+HIGHBD_INTRA_PRED_TEST(
+ NEON, TestHighbdIntraPred32, vpx_highbd_dc_predictor_32x32_neon,
+ vpx_highbd_dc_left_predictor_32x32_neon,
+ vpx_highbd_dc_top_predictor_32x32_neon,
+ vpx_highbd_dc_128_predictor_32x32_neon, vpx_highbd_v_predictor_32x32_neon,
+ vpx_highbd_h_predictor_32x32_neon, vpx_highbd_d45_predictor_32x32_neon,
+ vpx_highbd_d135_predictor_32x32_neon, vpx_highbd_d117_predictor_32x32_neon,
+ vpx_highbd_d153_predictor_32x32_neon, vpx_highbd_d207_predictor_32x32_neon,
+ vpx_highbd_d63_predictor_32x32_neon, vpx_highbd_tm_predictor_32x32_neon)
#endif // HAVE_NEON
#endif // CONFIG_VP9_HIGHBITDEPTH
-#include "test/test_libvpx.cc"
+int main(int argc, char **argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ ::libvpx_test::init_vpx_test();
+ return RUN_ALL_TESTS();
+}
diff --git a/test/test_libvpx.cc b/test/test_libvpx.cc
index 222a83f8c..c1798b8b8 100644
--- a/test/test_libvpx.cc
+++ b/test/test_libvpx.cc
@@ -7,69 +7,12 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
-#include <string>
+#include "test/init_vpx_test.h"
#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "./vpx_config.h"
-#if VPX_ARCH_X86 || VPX_ARCH_X86_64
-#include "vpx_ports/x86.h"
-#endif
-extern "C" {
-#if CONFIG_VP8
-extern void vp8_rtcd();
-#endif // CONFIG_VP8
-#if CONFIG_VP9
-extern void vp9_rtcd();
-#endif // CONFIG_VP9
-extern void vpx_dsp_rtcd();
-extern void vpx_scale_rtcd();
-}
-
-#if VPX_ARCH_X86 || VPX_ARCH_X86_64
-static void append_negative_gtest_filter(const char *str) {
- std::string filter = ::testing::FLAGS_gtest_filter;
- // Negative patterns begin with one '-' followed by a ':' separated list.
- if (filter.find('-') == std::string::npos) filter += '-';
- filter += str;
- ::testing::FLAGS_gtest_filter = filter;
-}
-#endif // VPX_ARCH_X86 || VPX_ARCH_X86_64
-
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
-
-#if VPX_ARCH_X86 || VPX_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_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_AVX512)) {
- append_negative_gtest_filter(":AVX512.*:AVX512/*");
- }
-#endif // VPX_ARCH_X86 || VPX_ARCH_X86_64
-
-#if !CONFIG_SHARED
-// Shared library builds don't support whitebox tests
-// that exercise internal symbols.
-#if CONFIG_VP8
- vp8_rtcd();
-#endif // CONFIG_VP8
-#if CONFIG_VP9
- vp9_rtcd();
-#endif // CONFIG_VP9
- vpx_dsp_rtcd();
- vpx_scale_rtcd();
-#endif // !CONFIG_SHARED
-
+ ::libvpx_test::init_vpx_test();
return RUN_ALL_TESTS();
}
diff --git a/test/test_vector_test.cc b/test/test_vector_test.cc
index ca990f4dd..ee552113c 100644
--- a/test/test_vector_test.cc
+++ b/test/test_vector_test.cc
@@ -48,7 +48,7 @@ class TestVectorTest : public ::libvpx_test::DecoderTest,
#endif
}
- virtual ~TestVectorTest() {
+ ~TestVectorTest() override {
if (md5_file_) fclose(md5_file_);
}
@@ -59,9 +59,8 @@ class TestVectorTest : public ::libvpx_test::DecoderTest,
}
#if CONFIG_VP9_DECODER
- virtual void PreDecodeFrameHook(
- const libvpx_test::CompressedVideoSource &video,
- libvpx_test::Decoder *decoder) {
+ void PreDecodeFrameHook(const libvpx_test::CompressedVideoSource &video,
+ libvpx_test::Decoder *decoder) override {
if (video.frame_number() == 0 && mt_mode_ >= 0) {
if (mt_mode_ == 1) {
decoder->Control(VP9D_SET_LOOP_FILTER_OPT, 1);
@@ -77,8 +76,8 @@ class TestVectorTest : public ::libvpx_test::DecoderTest,
}
#endif
- virtual void DecompressedFrameHook(const vpx_image_t &img,
- const unsigned int frame_number) {
+ void DecompressedFrameHook(const vpx_image_t &img,
+ const unsigned int frame_number) override {
ASSERT_NE(md5_file_, nullptr);
char expected_md5[33];
char junk[128];
diff --git a/test/tile_independence_test.cc b/test/tile_independence_test.cc
index d92c13f88..dab6e531b 100644
--- a/test/tile_independence_test.cc
+++ b/test/tile_independence_test.cc
@@ -36,18 +36,18 @@ class TileIndependenceTest : public ::libvpx_test::EncoderTest,
inv_dec_->Control(VP9_INVERT_TILE_DECODE_ORDER, 1);
}
- virtual ~TileIndependenceTest() {
+ ~TileIndependenceTest() override {
delete fw_dec_;
delete inv_dec_;
}
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(libvpx_test::kTwoPassGood);
}
- virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
- libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(libvpx_test::VideoSource *video,
+ libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP9E_SET_TILE_COLUMNS, n_tiles_);
}
@@ -65,7 +65,7 @@ class TileIndependenceTest : public ::libvpx_test::EncoderTest,
md5->Add(img);
}
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
UpdateMD5(fw_dec_, pkt, &md5_fw_order_);
UpdateMD5(inv_dec_, pkt, &md5_inv_order_);
}
diff --git a/test/timestamp_test.cc b/test/timestamp_test.cc
index 645a9f2ff..00abf8f31 100644
--- a/test/timestamp_test.cc
+++ b/test/timestamp_test.cc
@@ -42,16 +42,16 @@ class DummyTimebaseVideoSource : public ::libvpx_test::DummyVideoSource {
(static_cast<double>(framerate_numerator_) / framerate_denominator_);
}
- virtual vpx_codec_pts_t pts() const {
+ vpx_codec_pts_t pts() const override {
return static_cast<vpx_codec_pts_t>(frame_ * FrameDuration() +
starting_pts_ + 0.5);
}
- virtual unsigned long duration() const {
+ unsigned long duration() const override {
return static_cast<unsigned long>(FrameDuration() + 0.5);
}
- virtual vpx_rational_t timebase() const { return timebase_; }
+ vpx_rational_t timebase() const override { return timebase_; }
void set_starting_pts(int64_t starting_pts) { starting_pts_ = starting_pts; }
@@ -67,9 +67,9 @@ class TimestampTest
public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
protected:
TimestampTest() : EncoderTest(GET_PARAM(0)) {}
- virtual ~TimestampTest() {}
+ ~TimestampTest() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(GET_PARAM(1));
}
diff --git a/test/tools_common.sh b/test/tools_common.sh
index 0e4a0a5c0..d0dd24df3 100755
--- a/test/tools_common.sh
+++ b/test/tools_common.sh
@@ -280,7 +280,12 @@ run_tests() {
test_end "${test}"
done
- local tested_config="$(test_configuration_target) @ $(current_hash)"
+ # C vs SIMD tests are run for x86 32-bit, 64-bit and ARM platform
+ if [ "${test_name}" = "vp9_c_vs_simd_encode" ]; then
+ local tested_config="$(current_hash)"
+ else
+ local tested_config="$(test_configuration_target) @ $(current_hash)"
+ fi
echo "${test_name}: Done, all tests pass for ${tested_config}."
}
diff --git a/test/variance_test.cc b/test/variance_test.cc
index a6c8ef048..b8320e9ce 100644
--- a/test/variance_test.cc
+++ b/test/variance_test.cc
@@ -210,7 +210,7 @@ class SumOfSquaresTest : public ::testing::TestWithParam<SumOfSquaresFunction> {
public:
SumOfSquaresTest() : func_(GetParam()) {}
- virtual ~SumOfSquaresTest() { libvpx_test::ClearSystemState(); }
+ ~SumOfSquaresTest() override { libvpx_test::ClearSystemState(); }
protected:
void ConstTest();
@@ -289,7 +289,7 @@ template <typename FunctionType>
class MainTestClass
: public ::testing::TestWithParam<TestParams<FunctionType> > {
public:
- virtual void SetUp() {
+ void SetUp() override {
params_ = this->GetParam();
rnd_.Reset(ACMRandom::DeterministicSeed());
@@ -308,7 +308,7 @@ class MainTestClass
#endif
}
- virtual void TearDown() {
+ void TearDown() override {
#if CONFIG_VP9_HIGHBITDEPTH
if (use_high_bit_depth()) {
// TODO(skal): remove!
@@ -568,7 +568,7 @@ template <typename FunctionType>
class SubpelVarianceTest
: public ::testing::TestWithParam<TestParams<FunctionType> > {
public:
- virtual void SetUp() {
+ void SetUp() override {
params_ = this->GetParam();
rnd_.Reset(ACMRandom::DeterministicSeed());
@@ -592,7 +592,7 @@ class SubpelVarianceTest
ASSERT_NE(ref_, nullptr);
}
- virtual void TearDown() {
+ void TearDown() override {
if (!use_high_bit_depth()) {
vpx_free(src_);
vpx_free(sec_);
@@ -773,6 +773,7 @@ TEST_P(VpxSseTest, RefSse) { RefTestSse(); }
TEST_P(VpxSseTest, MaxSse) { MaxTestSse(); }
TEST_P(VpxMseTest, RefMse) { RefTestMse(); }
TEST_P(VpxMseTest, MaxMse) { MaxTestMse(); }
+TEST_P(VpxMseTest, DISABLED_Speed) { SpeedTest(); }
TEST_P(VpxVarianceTest, Zero) { ZeroTest(); }
TEST_P(VpxVarianceTest, Ref) { RefTest(); }
TEST_P(VpxVarianceTest, RefStride) { RefStrideTest(); }
@@ -1428,7 +1429,10 @@ INSTANTIATE_TEST_SUITE_P(
VarianceParams(5, 4, &vpx_variance32x16_avx2),
VarianceParams(4, 5, &vpx_variance16x32_avx2),
VarianceParams(4, 4, &vpx_variance16x16_avx2),
- VarianceParams(4, 3, &vpx_variance16x8_avx2)));
+ VarianceParams(4, 3, &vpx_variance16x8_avx2),
+ VarianceParams(3, 4, &vpx_variance8x16_avx2),
+ VarianceParams(3, 3, &vpx_variance8x8_avx2),
+ VarianceParams(3, 2, &vpx_variance8x4_avx2)));
INSTANTIATE_TEST_SUITE_P(
AVX2, VpxSubpelVarianceTest,
@@ -1450,8 +1454,10 @@ INSTANTIATE_TEST_SUITE_P(NEON, VpxSseTest,
&vpx_get4x4sse_cs_neon)));
INSTANTIATE_TEST_SUITE_P(NEON, VpxMseTest,
- ::testing::Values(MseParams(4, 4,
- &vpx_mse16x16_neon)));
+ ::testing::Values(MseParams(4, 4, &vpx_mse16x16_neon),
+ MseParams(4, 3, &vpx_mse16x8_neon),
+ MseParams(3, 4, &vpx_mse8x16_neon),
+ MseParams(3, 3, &vpx_mse8x8_neon)));
INSTANTIATE_TEST_SUITE_P(
NEON, VpxVarianceTest,
@@ -1469,6 +1475,35 @@ INSTANTIATE_TEST_SUITE_P(
VarianceParams(2, 3, &vpx_variance4x8_neon),
VarianceParams(2, 2, &vpx_variance4x4_neon)));
+#if HAVE_NEON_DOTPROD
+INSTANTIATE_TEST_SUITE_P(
+ NEON_DOTPROD, VpxSseTest,
+ ::testing::Values(SseParams(2, 2, &vpx_get4x4sse_cs_neon_dotprod)));
+
+INSTANTIATE_TEST_SUITE_P(
+ NEON_DOTPROD, VpxMseTest,
+ ::testing::Values(MseParams(4, 4, &vpx_mse16x16_neon_dotprod),
+ MseParams(4, 3, &vpx_mse16x8_neon_dotprod),
+ MseParams(3, 4, &vpx_mse8x16_neon_dotprod),
+ MseParams(3, 3, &vpx_mse8x8_neon_dotprod)));
+
+INSTANTIATE_TEST_SUITE_P(
+ NEON_DOTPROD, VpxVarianceTest,
+ ::testing::Values(VarianceParams(6, 6, &vpx_variance64x64_neon_dotprod),
+ VarianceParams(6, 5, &vpx_variance64x32_neon_dotprod),
+ VarianceParams(5, 6, &vpx_variance32x64_neon_dotprod),
+ VarianceParams(5, 5, &vpx_variance32x32_neon_dotprod),
+ VarianceParams(5, 4, &vpx_variance32x16_neon_dotprod),
+ VarianceParams(4, 5, &vpx_variance16x32_neon_dotprod),
+ VarianceParams(4, 4, &vpx_variance16x16_neon_dotprod),
+ VarianceParams(4, 3, &vpx_variance16x8_neon_dotprod),
+ VarianceParams(3, 4, &vpx_variance8x16_neon_dotprod),
+ VarianceParams(3, 3, &vpx_variance8x8_neon_dotprod),
+ VarianceParams(3, 2, &vpx_variance8x4_neon_dotprod),
+ VarianceParams(2, 3, &vpx_variance4x8_neon_dotprod),
+ VarianceParams(2, 2, &vpx_variance4x4_neon_dotprod)));
+#endif // HAVE_NEON_DOTPROD
+
INSTANTIATE_TEST_SUITE_P(
NEON, VpxSubpelVarianceTest,
::testing::Values(
@@ -1505,6 +1540,36 @@ INSTANTIATE_TEST_SUITE_P(
#if CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_SUITE_P(
+ NEON, VpxHBDMseTest,
+ ::testing::Values(
+ MseParams(4, 4, &vpx_highbd_12_mse16x16_neon, VPX_BITS_12),
+ MseParams(4, 3, &vpx_highbd_12_mse16x8_neon, VPX_BITS_12),
+ MseParams(3, 4, &vpx_highbd_12_mse8x16_neon, VPX_BITS_12),
+ MseParams(3, 3, &vpx_highbd_12_mse8x8_neon, VPX_BITS_12),
+ MseParams(4, 4, &vpx_highbd_10_mse16x16_neon, VPX_BITS_10),
+ MseParams(4, 3, &vpx_highbd_10_mse16x8_neon, VPX_BITS_10),
+ MseParams(3, 4, &vpx_highbd_10_mse8x16_neon, VPX_BITS_10),
+ MseParams(3, 3, &vpx_highbd_10_mse8x8_neon, VPX_BITS_10),
+ MseParams(4, 4, &vpx_highbd_8_mse16x16_neon, VPX_BITS_8),
+ MseParams(4, 3, &vpx_highbd_8_mse16x8_neon, VPX_BITS_8),
+ MseParams(3, 4, &vpx_highbd_8_mse8x16_neon, VPX_BITS_8),
+ MseParams(3, 3, &vpx_highbd_8_mse8x8_neon, VPX_BITS_8)));
+
+// TODO(webm:1819): Re-enable when vpx_highbd_8_mse16x16_neon_dotprod, etc. can
+// be used again.
+#if 0
+#if HAVE_NEON_DOTPROD
+INSTANTIATE_TEST_SUITE_P(
+ NEON_DOTPROD, VpxHBDMseTest,
+ ::testing::Values(
+ MseParams(4, 4, &vpx_highbd_8_mse16x16_neon_dotprod, VPX_BITS_8),
+ MseParams(4, 3, &vpx_highbd_8_mse16x8_neon_dotprod, VPX_BITS_8),
+ MseParams(3, 4, &vpx_highbd_8_mse8x16_neon_dotprod, VPX_BITS_8),
+ MseParams(3, 3, &vpx_highbd_8_mse8x8_neon_dotprod, VPX_BITS_8)));
+#endif // HAVE_NEON_DOTPROD
+#endif // 0
+
+INSTANTIATE_TEST_SUITE_P(
NEON, VpxHBDVarianceTest,
::testing::Values(
VarianceParams(6, 6, &vpx_highbd_12_variance64x64_neon, 12),
@@ -1572,6 +1637,10 @@ INSTANTIATE_TEST_SUITE_P(
12),
SubpelVarianceParams(3, 2, &vpx_highbd_12_sub_pixel_variance8x4_neon,
12),
+ SubpelVarianceParams(2, 3, &vpx_highbd_12_sub_pixel_variance4x8_neon,
+ 12),
+ SubpelVarianceParams(2, 2, &vpx_highbd_12_sub_pixel_variance4x4_neon,
+ 12),
SubpelVarianceParams(6, 6, &vpx_highbd_10_sub_pixel_variance64x64_neon,
10),
SubpelVarianceParams(6, 5, &vpx_highbd_10_sub_pixel_variance64x32_neon,
@@ -1594,6 +1663,10 @@ INSTANTIATE_TEST_SUITE_P(
10),
SubpelVarianceParams(3, 2, &vpx_highbd_10_sub_pixel_variance8x4_neon,
10),
+ SubpelVarianceParams(2, 3, &vpx_highbd_10_sub_pixel_variance4x8_neon,
+ 10),
+ SubpelVarianceParams(2, 2, &vpx_highbd_10_sub_pixel_variance4x4_neon,
+ 10),
SubpelVarianceParams(6, 6, &vpx_highbd_8_sub_pixel_variance64x64_neon,
8),
SubpelVarianceParams(6, 5, &vpx_highbd_8_sub_pixel_variance64x32_neon,
@@ -1613,7 +1686,9 @@ INSTANTIATE_TEST_SUITE_P(
SubpelVarianceParams(3, 4, &vpx_highbd_8_sub_pixel_variance8x16_neon,
8),
SubpelVarianceParams(3, 3, &vpx_highbd_8_sub_pixel_variance8x8_neon, 8),
- SubpelVarianceParams(3, 2, &vpx_highbd_8_sub_pixel_variance8x4_neon,
+ SubpelVarianceParams(3, 2, &vpx_highbd_8_sub_pixel_variance8x4_neon, 8),
+ SubpelVarianceParams(2, 3, &vpx_highbd_8_sub_pixel_variance4x8_neon, 8),
+ SubpelVarianceParams(2, 2, &vpx_highbd_8_sub_pixel_variance4x4_neon,
8)));
INSTANTIATE_TEST_SUITE_P(
@@ -1652,6 +1727,12 @@ INSTANTIATE_TEST_SUITE_P(
SubpelAvgVarianceParams(3, 2,
&vpx_highbd_12_sub_pixel_avg_variance8x4_neon,
12),
+ SubpelAvgVarianceParams(2, 3,
+ &vpx_highbd_12_sub_pixel_avg_variance4x8_neon,
+ 12),
+ SubpelAvgVarianceParams(2, 2,
+ &vpx_highbd_12_sub_pixel_avg_variance4x4_neon,
+ 12),
SubpelAvgVarianceParams(6, 6,
&vpx_highbd_10_sub_pixel_avg_variance64x64_neon,
10),
@@ -1685,6 +1766,12 @@ INSTANTIATE_TEST_SUITE_P(
SubpelAvgVarianceParams(3, 2,
&vpx_highbd_10_sub_pixel_avg_variance8x4_neon,
10),
+ SubpelAvgVarianceParams(2, 3,
+ &vpx_highbd_10_sub_pixel_avg_variance4x8_neon,
+ 10),
+ SubpelAvgVarianceParams(2, 2,
+ &vpx_highbd_10_sub_pixel_avg_variance4x4_neon,
+ 10),
SubpelAvgVarianceParams(6, 6,
&vpx_highbd_8_sub_pixel_avg_variance64x64_neon,
8),
@@ -1717,6 +1804,12 @@ INSTANTIATE_TEST_SUITE_P(
8),
SubpelAvgVarianceParams(3, 2,
&vpx_highbd_8_sub_pixel_avg_variance8x4_neon,
+ 8),
+ SubpelAvgVarianceParams(2, 3,
+ &vpx_highbd_8_sub_pixel_avg_variance4x8_neon,
+ 8),
+ SubpelAvgVarianceParams(2, 2,
+ &vpx_highbd_8_sub_pixel_avg_variance4x4_neon,
8)));
#endif // CONFIG_VP9_HIGHBITDEPTH
diff --git a/test/video_source.h b/test/video_source.h
index a10ff6fb0..2194126f1 100644
--- a/test/video_source.h
+++ b/test/video_source.h
@@ -64,7 +64,7 @@ inline FILE *OpenTestDataFile(const std::string &file_name) {
return fopen(path_to_source.c_str(), "rb");
}
-static FILE *GetTempOutFile(std::string *file_name) {
+static FILE *GetTempOutFile(std::string *file_name, const char *io_mode) {
file_name->clear();
#if defined(_WIN32)
char fname[MAX_PATH];
@@ -73,7 +73,7 @@ static FILE *GetTempOutFile(std::string *file_name) {
// Assume for now that the filename generated is unique per process
if (GetTempFileNameA(tmppath, "lvx", 0, fname)) {
file_name->assign(fname);
- return fopen(fname, "wb+");
+ return fopen(fname, io_mode);
}
}
return nullptr;
@@ -94,13 +94,16 @@ static FILE *GetTempOutFile(std::string *file_name) {
const int fd = mkstemp(temp_file_name.get());
if (fd == -1) return nullptr;
*file_name = temp_file_name.get();
- return fdopen(fd, "wb+");
+ return fdopen(fd, io_mode);
#endif
}
class TempOutFile {
public:
- TempOutFile() { file_ = GetTempOutFile(&file_name_); }
+ TempOutFile() { file_ = GetTempOutFile(&file_name_, "wb+"); }
+ TempOutFile(const char *io_mode) {
+ file_ = GetTempOutFile(&file_name_, io_mode);
+ }
~TempOutFile() {
CloseFile();
if (!file_name_.empty()) {
@@ -160,35 +163,35 @@ class DummyVideoSource : public VideoSource {
ReallocImage();
}
- virtual ~DummyVideoSource() { vpx_img_free(img_); }
+ ~DummyVideoSource() override { vpx_img_free(img_); }
- virtual void Begin() {
+ void Begin() override {
frame_ = 0;
FillFrame();
}
- virtual void Next() {
+ void Next() override {
++frame_;
FillFrame();
}
- virtual vpx_image_t *img() const {
+ vpx_image_t *img() const override {
return (frame_ < limit_) ? img_ : nullptr;
}
// Models a stream where Timebase = 1/FPS, so pts == frame.
- virtual vpx_codec_pts_t pts() const { return frame_; }
+ vpx_codec_pts_t pts() const override { return frame_; }
- virtual unsigned long duration() const { return 1; }
+ unsigned long duration() const override { return 1; }
- virtual vpx_rational_t timebase() const {
+ vpx_rational_t timebase() const override {
const vpx_rational_t t = { 1, 30 };
return t;
}
- virtual unsigned int frame() const { return frame_; }
+ unsigned int frame() const override { return frame_; }
- virtual unsigned int limit() const { return limit_; }
+ unsigned int limit() const override { return limit_; }
void set_limit(unsigned int limit) { limit_ = limit; }
@@ -235,7 +238,7 @@ class RandomVideoSource : public DummyVideoSource {
protected:
// Reset the RNG to get a matching stream for the second pass
- virtual void Begin() {
+ void Begin() override {
frame_ = 0;
rnd_.Reset(seed_);
FillFrame();
@@ -243,7 +246,7 @@ class RandomVideoSource : public DummyVideoSource {
// 15 frames of noise, followed by 15 static frames. Reset to 0 rather
// than holding previous frames to encourage keyframes to be thrown.
- virtual void FillFrame() {
+ void FillFrame() override {
if (img_) {
if (frame_ % 30 < 15) {
for (size_t i = 0; i < raw_sz_; ++i) img_->img_data[i] = rnd_.Rand8();
diff --git a/test/vp8_datarate_test.cc b/test/vp8_datarate_test.cc
index 64a861d15..aee27af66 100644
--- a/test/vp8_datarate_test.cc
+++ b/test/vp8_datarate_test.cc
@@ -24,10 +24,10 @@ class DatarateTestLarge
public:
DatarateTestLarge() : EncoderTest(GET_PARAM(0)) {}
- virtual ~DatarateTestLarge() {}
+ ~DatarateTestLarge() override = default;
protected:
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(GET_PARAM(1));
set_cpu_used_ = GET_PARAM(2);
@@ -47,8 +47,8 @@ class DatarateTestLarge
use_roi_ = false;
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP8E_SET_NOISE_SENSITIVITY, denoiser_on_);
encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
@@ -74,7 +74,7 @@ class DatarateTestLarge
duration_ = 0;
}
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
// Time since last timestamp = duration.
vpx_codec_pts_t duration = pkt->data.frame.pts - last_pts_;
@@ -121,7 +121,7 @@ class DatarateTestLarge
++frame_number_;
}
- virtual void EndPassHook() {
+ void EndPassHook() override {
if (bits_total_) {
const double file_size_in_kb = bits_total_ / 1000.; // bits per kilobit
@@ -301,7 +301,7 @@ TEST_P(DatarateTestLarge, DropFramesMultiThreads) {
class DatarateTestRealTime : public DatarateTestLarge {
public:
- virtual ~DatarateTestRealTime() {}
+ ~DatarateTestRealTime() override = default;
};
#if CONFIG_TEMPORAL_DENOISING
diff --git a/test/vp8_denoiser_sse2_test.cc b/test/vp8_denoiser_sse2_test.cc
index 8cb84ddd8..7fa867d8b 100644
--- a/test/vp8_denoiser_sse2_test.cc
+++ b/test/vp8_denoiser_sse2_test.cc
@@ -30,11 +30,11 @@ namespace {
const int kNumPixels = 16 * 16;
class VP8DenoiserTest : public ::testing::TestWithParam<int> {
public:
- virtual ~VP8DenoiserTest() {}
+ ~VP8DenoiserTest() override = default;
- virtual void SetUp() { increase_denoising_ = GetParam(); }
+ void SetUp() override { increase_denoising_ = GetParam(); }
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
+ void TearDown() override { libvpx_test::ClearSystemState(); }
protected:
int increase_denoising_;
diff --git a/test/vp8_fdct4x4_test.cc b/test/vp8_fdct4x4_test.cc
index 1b73a72a0..66d5c151c 100644
--- a/test/vp8_fdct4x4_test.cc
+++ b/test/vp8_fdct4x4_test.cc
@@ -74,7 +74,7 @@ using libvpx_test::ACMRandom;
class FdctTest : public ::testing::TestWithParam<FdctFunc> {
public:
- virtual void SetUp() {
+ void SetUp() override {
fdct_func_ = GetParam();
rnd_.Reset(ACMRandom::DeterministicSeed());
}
diff --git a/test/vp8_fragments_test.cc b/test/vp8_fragments_test.cc
index 6e5baf229..01b4c2120 100644
--- a/test/vp8_fragments_test.cc
+++ b/test/vp8_fragments_test.cc
@@ -17,9 +17,9 @@ class VP8FragmentsTest : public ::libvpx_test::EncoderTest,
public ::testing::Test {
protected:
VP8FragmentsTest() : EncoderTest(&::libvpx_test::kVP8) {}
- virtual ~VP8FragmentsTest() {}
+ ~VP8FragmentsTest() override = default;
- virtual void SetUp() {
+ void SetUp() override {
const unsigned long init_flags = // NOLINT(runtime/int)
VPX_CODEC_USE_OUTPUT_PARTITION;
InitializeConfig();
diff --git a/test/vp8_ratectrl_rtc_test.cc b/test/vp8_ratectrl_rtc_test.cc
index 7410f3c01..9fbc1d4d9 100644
--- a/test/vp8_ratectrl_rtc_test.cc
+++ b/test/vp8_ratectrl_rtc_test.cc
@@ -25,7 +25,7 @@
namespace {
struct Vp8RCTestVideo {
- Vp8RCTestVideo() {}
+ Vp8RCTestVideo() = default;
Vp8RCTestVideo(const char *name_, int width_, int height_,
unsigned int frames_)
: name(name_), width(width_), height(height_), frames(frames_) {}
@@ -52,11 +52,12 @@ class Vp8RcInterfaceTest
public ::libvpx_test::CodecTestWith2Params<int, Vp8RCTestVideo> {
public:
Vp8RcInterfaceTest()
- : EncoderTest(GET_PARAM(0)), key_interval_(3000), encoder_exit_(false) {}
- virtual ~Vp8RcInterfaceTest() {}
+ : EncoderTest(GET_PARAM(0)), key_interval_(3000), encoder_exit_(false),
+ frame_drop_thresh_(0) {}
+ ~Vp8RcInterfaceTest() override = default;
protected:
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(::libvpx_test::kRealTime);
}
@@ -111,8 +112,8 @@ class Vp8RcInterfaceTest
return layer_id;
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (rc_cfg_.ts_number_layers > 1) {
const int layer_id = SetLayerId(video->frame(), cfg_.ts_number_layers);
const int frame_flags =
@@ -127,56 +128,79 @@ class Vp8RcInterfaceTest
encoder->Control(VP8E_SET_CPUUSED, -6);
encoder->Control(VP8E_SET_RTC_EXTERNAL_RATECTRL, 1);
encoder->Control(VP8E_SET_MAX_INTRA_BITRATE_PCT, 1000);
- } else if (frame_params_.frame_type == INTER_FRAME) {
+ } else if (frame_params_.frame_type == libvpx::RcFrameType::kInterFrame) {
// Disable golden frame update.
frame_flags_ |= VP8_EFLAG_NO_UPD_GF;
frame_flags_ |= VP8_EFLAG_NO_UPD_ARF;
}
}
- frame_params_.frame_type =
- video->frame() % key_interval_ == 0 ? KEY_FRAME : INTER_FRAME;
+ frame_params_.frame_type = video->frame() % key_interval_ == 0
+ ? libvpx::RcFrameType::kKeyFrame
+ : libvpx::RcFrameType::kInterFrame;
encoder_exit_ = video->frame() == test_video_.frames;
}
- virtual void PostEncodeFrameHook(::libvpx_test::Encoder *encoder) {
+ void PostEncodeFrameHook(::libvpx_test::Encoder *encoder) override {
if (encoder_exit_) {
return;
}
int qp;
encoder->Control(VP8E_GET_LAST_QUANTIZER, &qp);
- rc_api_->ComputeQP(frame_params_);
- ASSERT_EQ(rc_api_->GetQP(), qp);
+ if (rc_api_->ComputeQP(frame_params_) == libvpx::FrameDropDecision::kOk) {
+ ASSERT_EQ(rc_api_->GetQP(), qp);
+ } else {
+ num_drops_++;
+ }
}
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
rc_api_->PostEncodeUpdate(pkt->data.frame.sz);
}
void RunOneLayer() {
test_video_ = GET_PARAM(2);
target_bitrate_ = GET_PARAM(1);
- if (test_video_.width == 1280 && target_bitrate_ == 200) return;
- if (test_video_.width == 640 && target_bitrate_ == 1000) return;
SetConfig();
rc_api_ = libvpx::VP8RateControlRTC::Create(rc_cfg_);
- rc_api_->UpdateRateControl(rc_cfg_);
+ ASSERT_TRUE(rc_api_->UpdateRateControl(rc_cfg_));
+
+ ::libvpx_test::I420VideoSource video(test_video_.name, test_video_.width,
+ test_video_.height, 30, 1, 0,
+ test_video_.frames);
+
+ ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
+ }
+
+ void RunOneLayerDropFrames() {
+ test_video_ = GET_PARAM(2);
+ target_bitrate_ = GET_PARAM(1);
+ frame_drop_thresh_ = 30;
+ num_drops_ = 0;
+ // Use lower target_bitrate and max_quantizer to trigger drops.
+ target_bitrate_ = target_bitrate_ >> 2;
+ SetConfig();
+ rc_cfg_.max_quantizer = 56;
+ cfg_.rc_max_quantizer = 56;
+ rc_api_ = libvpx::VP8RateControlRTC::Create(rc_cfg_);
+ ASSERT_TRUE(rc_api_->UpdateRateControl(rc_cfg_));
::libvpx_test::I420VideoSource video(test_video_.name, test_video_.width,
test_video_.height, 30, 1, 0,
test_video_.frames);
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
+ // Check that some frames were dropped, otherwise test has no value.
+ ASSERT_GE(num_drops_, 1);
}
void RunPeriodicKey() {
test_video_ = GET_PARAM(2);
target_bitrate_ = GET_PARAM(1);
- if (test_video_.width == 1280 && target_bitrate_ == 200) return;
- if (test_video_.width == 640 && target_bitrate_ == 1000) return;
key_interval_ = 100;
+ frame_drop_thresh_ = 30;
SetConfig();
rc_api_ = libvpx::VP8RateControlRTC::Create(rc_cfg_);
- rc_api_->UpdateRateControl(rc_cfg_);
+ ASSERT_TRUE(rc_api_->UpdateRateControl(rc_cfg_));
::libvpx_test::I420VideoSource video(test_video_.name, test_video_.width,
test_video_.height, 30, 1, 0,
@@ -188,11 +212,9 @@ class Vp8RcInterfaceTest
void RunTemporalLayers2TL() {
test_video_ = GET_PARAM(2);
target_bitrate_ = GET_PARAM(1);
- if (test_video_.width == 1280 && target_bitrate_ == 200) return;
- if (test_video_.width == 640 && target_bitrate_ == 1000) return;
SetConfigTemporalLayers(2);
rc_api_ = libvpx::VP8RateControlRTC::Create(rc_cfg_);
- rc_api_->UpdateRateControl(rc_cfg_);
+ ASSERT_TRUE(rc_api_->UpdateRateControl(rc_cfg_));
::libvpx_test::I420VideoSource video(test_video_.name, test_video_.width,
test_video_.height, 30, 1, 0,
@@ -204,11 +226,9 @@ class Vp8RcInterfaceTest
void RunTemporalLayers3TL() {
test_video_ = GET_PARAM(2);
target_bitrate_ = GET_PARAM(1);
- if (test_video_.width == 1280 && target_bitrate_ == 200) return;
- if (test_video_.width == 640 && target_bitrate_ == 1000) return;
SetConfigTemporalLayers(3);
rc_api_ = libvpx::VP8RateControlRTC::Create(rc_cfg_);
- rc_api_->UpdateRateControl(rc_cfg_);
+ ASSERT_TRUE(rc_api_->UpdateRateControl(rc_cfg_));
::libvpx_test::I420VideoSource video(test_video_.name, test_video_.width,
test_video_.height, 30, 1, 0,
@@ -217,6 +237,28 @@ class Vp8RcInterfaceTest
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
}
+ void RunTemporalLayers3TLDropFrames() {
+ test_video_ = GET_PARAM(2);
+ target_bitrate_ = GET_PARAM(1);
+ frame_drop_thresh_ = 30;
+ num_drops_ = 0;
+ // Use lower target_bitrate and max_quantizer to trigger drops.
+ target_bitrate_ = target_bitrate_ >> 2;
+ SetConfigTemporalLayers(3);
+ rc_cfg_.max_quantizer = 56;
+ cfg_.rc_max_quantizer = 56;
+ rc_api_ = libvpx::VP8RateControlRTC::Create(rc_cfg_);
+ ASSERT_TRUE(rc_api_->UpdateRateControl(rc_cfg_));
+
+ ::libvpx_test::I420VideoSource video(test_video_.name, test_video_.width,
+ test_video_.height, 30, 1, 0,
+ test_video_.frames);
+
+ ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
+ // Check that some frames were dropped, otherwise test has no value.
+ ASSERT_GE(num_drops_, 1);
+ }
+
private:
void SetConfig() {
rc_cfg_.width = test_video_.width;
@@ -232,6 +274,7 @@ class Vp8RcInterfaceTest
rc_cfg_.max_intra_bitrate_pct = 1000;
rc_cfg_.framerate = 30.0;
rc_cfg_.layer_target_bitrate[0] = target_bitrate_;
+ rc_cfg_.frame_drop_thresh = frame_drop_thresh_;
// Encoder settings for ground truth.
cfg_.g_w = test_video_.width;
@@ -250,6 +293,7 @@ class Vp8RcInterfaceTest
cfg_.rc_target_bitrate = target_bitrate_;
cfg_.kf_min_dist = key_interval_;
cfg_.kf_max_dist = key_interval_;
+ cfg_.rc_dropframe_thresh = frame_drop_thresh_;
}
void SetConfigTemporalLayers(int temporal_layers) {
@@ -265,6 +309,7 @@ class Vp8RcInterfaceTest
rc_cfg_.overshoot_pct = 50;
rc_cfg_.max_intra_bitrate_pct = 1000;
rc_cfg_.framerate = 30.0;
+ rc_cfg_.frame_drop_thresh = frame_drop_thresh_;
if (temporal_layers == 2) {
rc_cfg_.layer_target_bitrate[0] = 60 * target_bitrate_ / 100;
rc_cfg_.layer_target_bitrate[1] = target_bitrate_;
@@ -298,6 +343,7 @@ class Vp8RcInterfaceTest
cfg_.rc_target_bitrate = target_bitrate_;
cfg_.kf_min_dist = key_interval_;
cfg_.kf_max_dist = key_interval_;
+ cfg_.rc_dropframe_thresh = frame_drop_thresh_;
// 2 Temporal layers, no spatial layers, CBR mode.
cfg_.ss_number_layers = 1;
cfg_.ts_number_layers = temporal_layers;
@@ -325,16 +371,24 @@ class Vp8RcInterfaceTest
Vp8RCTestVideo test_video_;
libvpx::VP8FrameParamsQpRTC frame_params_;
bool encoder_exit_;
+ int frame_drop_thresh_;
+ int num_drops_;
};
TEST_P(Vp8RcInterfaceTest, OneLayer) { RunOneLayer(); }
+TEST_P(Vp8RcInterfaceTest, OneLayerDropFrames) { RunOneLayerDropFrames(); }
+
TEST_P(Vp8RcInterfaceTest, OneLayerPeriodicKey) { RunPeriodicKey(); }
TEST_P(Vp8RcInterfaceTest, TemporalLayers2TL) { RunTemporalLayers2TL(); }
TEST_P(Vp8RcInterfaceTest, TemporalLayers3TL) { RunTemporalLayers3TL(); }
+TEST_P(Vp8RcInterfaceTest, TemporalLayers3TLDropFrames) {
+ RunTemporalLayers3TLDropFrames();
+}
+
VP8_INSTANTIATE_TEST_SUITE(Vp8RcInterfaceTest,
::testing::Values(200, 400, 1000),
::testing::ValuesIn(kVp8RCTestVectors));
diff --git a/test/vp9_arf_freq_test.cc b/test/vp9_arf_freq_test.cc
index c7e6f1af0..3882326d2 100644
--- a/test/vp9_arf_freq_test.cc
+++ b/test/vp9_arf_freq_test.cc
@@ -86,9 +86,9 @@ class ArfFreqTest
: EncoderTest(GET_PARAM(0)), test_video_param_(GET_PARAM(1)),
test_encode_param_(GET_PARAM(2)), min_arf_requested_(GET_PARAM(3)) {}
- virtual ~ArfFreqTest() {}
+ ~ArfFreqTest() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(test_encode_param_.mode);
if (test_encode_param_.mode != ::libvpx_test::kRealTime) {
@@ -104,7 +104,7 @@ class ArfFreqTest
dec_cfg_.threads = 4;
}
- virtual void BeginPassHook(unsigned int) {
+ void BeginPassHook(unsigned int) override {
min_run_ = ARF_NOT_SEEN;
run_of_visible_frames_ = 0;
}
@@ -126,7 +126,7 @@ class ArfFreqTest
return frames;
}
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) return;
const int frames = GetNumFramesInPkt(pkt);
if (frames == 1) {
@@ -145,8 +145,8 @@ class ArfFreqTest
}
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP9E_SET_FRAME_PARALLEL_DECODING, 1);
encoder->Control(VP9E_SET_TILE_COLUMNS, 4);
diff --git a/test/vp9_block_error_test.cc b/test/vp9_block_error_test.cc
index b93b014e6..0645341ac 100644
--- a/test/vp9_block_error_test.cc
+++ b/test/vp9_block_error_test.cc
@@ -53,14 +53,14 @@ int64_t BlockError8BitWrapper(const tran_low_t *coeff,
class BlockErrorTest : public ::testing::TestWithParam<BlockErrorParam> {
public:
- virtual ~BlockErrorTest() {}
- virtual void SetUp() {
+ ~BlockErrorTest() override = default;
+ void SetUp() override {
error_block_op_ = GET_PARAM(0);
ref_error_block_op_ = GET_PARAM(1);
bit_depth_ = GET_PARAM(2);
}
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
+ void TearDown() override { libvpx_test::ClearSystemState(); }
protected:
vpx_bit_depth_t bit_depth_;
@@ -197,4 +197,22 @@ INSTANTIATE_TEST_SUITE_P(
&BlockError8BitWrapper<vp9_block_error_c>,
VPX_BITS_8)));
#endif // HAVE_AVX2
+
+#if HAVE_NEON
+const BlockErrorParam neon_block_error_tests[] = {
+#if CONFIG_VP9_HIGHBITDEPTH
+ make_tuple(&vp9_highbd_block_error_neon, &vp9_highbd_block_error_c,
+ VPX_BITS_10),
+ make_tuple(&vp9_highbd_block_error_neon, &vp9_highbd_block_error_c,
+ VPX_BITS_12),
+ make_tuple(&vp9_highbd_block_error_neon, &vp9_highbd_block_error_c,
+ VPX_BITS_8),
+#endif // CONFIG_VP9_HIGHBITDEPTH
+ make_tuple(&BlockError8BitWrapper<vp9_block_error_neon>,
+ &BlockError8BitWrapper<vp9_block_error_c>, VPX_BITS_8)
+};
+
+INSTANTIATE_TEST_SUITE_P(NEON, BlockErrorTest,
+ ::testing::ValuesIn(neon_block_error_tests));
+#endif // HAVE_NEON
} // namespace
diff --git a/test/vp9_c_vs_simd_encode.sh b/test/vp9_c_vs_simd_encode.sh
new file mode 100755
index 000000000..03843610d
--- /dev/null
+++ b/test/vp9_c_vs_simd_encode.sh
@@ -0,0 +1,420 @@
+#!/bin/sh
+##
+## Copyright (c) 2023 The WebM project authors. All Rights Reserved.
+##
+## Use of this source code is governed by a BSD-style license
+## that can be found in the LICENSE file in the root of the source
+## tree. An additional intellectual property rights grant can be found
+## in the file PATENTS. All contributing project authors may
+## be found in the AUTHORS file in the root of the source tree.
+##
+## This script checks the bit exactness between C and SIMD
+## implementations of VP9 encoder.
+##
+. $(dirname $0)/tools_common.sh
+
+TEST_BITRATES="1600 6400"
+PRESETS="good rt"
+TEST_CLIPS="yuv_raw_input y4m_360p_10bit_input yuv_480p_raw_input y4m_720p_input"
+OUT_FILE_SUFFIX=".ivf"
+SCRIPT_DIR=$(dirname "$0")
+LIBVPX_SOURCE_DIR=$(cd "${SCRIPT_DIR}/.."; pwd)
+
+# Clips used in test.
+YUV_RAW_INPUT="${LIBVPX_TEST_DATA_PATH}/hantro_collage_w352h288.yuv"
+YUV_480P_RAW_INPUT="${LIBVPX_TEST_DATA_PATH}/niklas_640_480_30.yuv"
+Y4M_360P_10BIT_INPUT="${LIBVPX_TEST_DATA_PATH}/crowd_run_360p_10_150f.y4m"
+Y4M_720P_INPUT="${LIBVPX_TEST_DATA_PATH}/niklas_1280_720_30.y4m"
+
+# Number of frames to test.
+VP9_ENCODE_C_VS_SIMD_TEST_FRAME_LIMIT=20
+
+# Create a temporary directory for output files.
+if [ -n "${TMPDIR}" ]; then
+ VPX_TEST_TEMP_ROOT="${TMPDIR}"
+elif [ -n "${TEMPDIR}" ]; then
+ VPX_TEST_TEMP_ROOT="${TEMPDIR}"
+else
+ VPX_TEST_TEMP_ROOT=/tmp
+fi
+
+VPX_TEST_OUTPUT_DIR="${VPX_TEST_TEMP_ROOT}/vpx_test_$$"
+
+if ! mkdir -p "${VPX_TEST_OUTPUT_DIR}" || \
+ [ ! -d "${VPX_TEST_OUTPUT_DIR}" ]; then
+ echo "${0##*/}: Cannot create output directory, giving up."
+ echo "${0##*/}: VPX_TEST_OUTPUT_DIR=${VPX_TEST_OUTPUT_DIR}"
+ exit 1
+fi
+
+elog() {
+ echo "$@" 1>&2
+}
+
+# Echoes path to $1 when it's executable and exists in ${VPX_TEST_OUTPUT_DIR},
+# or an empty string. Caller is responsible for testing the string once the
+# function returns.
+vp9_enc_tool_path() {
+ local target="$1"
+ local tool_path="${VPX_TEST_OUTPUT_DIR}/build_target_${target}/vpxenc"
+
+ if [ ! -x "${tool_path}" ]; then
+ tool_path=""
+ fi
+ echo "${tool_path}"
+}
+
+# Environment check: Make sure input and source directories are available.
+vp9_c_vs_simd_enc_verify_environment() {
+ if [ ! -e "${YUV_RAW_INPUT}" ]; then
+ elog "libvpx test data must exist in LIBVPX_TEST_DATA_PATH."
+ return 1
+ fi
+ if [ ! -e "${YUV_480P_RAW_INPUT}" ]; then
+ elog "libvpx test data must exist in LIBVPX_TEST_DATA_PATH."
+ return 1
+ fi
+ if [ ! -e "${Y4M_720P_INPUT}" ]; then
+ elog "libvpx test data must exist in LIBVPX_TEST_DATA_PATH."
+ return 1
+ fi
+ if [ ! -e "${Y4M_360P_10BIT_INPUT}" ]; then
+ elog "libvpx test data must exist in LIBVPX_TEST_DATA_PATH."
+ return 1
+ fi
+ if [ ! -d "$LIBVPX_SOURCE_DIR" ]; then
+ elog "LIBVPX_SOURCE_DIR does not exist."
+ return 1
+ fi
+}
+
+# This is not needed since tools_common.sh does the same cleanup.
+# Keep the code here for our reference.
+# cleanup() {
+# rm -rf ${VPX_TEST_OUTPUT_DIR}
+# }
+
+# Echo VPX_SIMD_CAPS_MASK for different instruction set architecture.
+avx512f() {
+ echo "0x1FF"
+}
+
+avx2() {
+ echo "0x0FF"
+}
+
+sse4_1() {
+ echo "0x03F"
+}
+
+ssse3() {
+ echo "0x01F"
+}
+
+sse2() {
+ echo "0x007"
+}
+
+# Echo clip details to be used as input to vpxenc.
+yuv_raw_input() {
+ echo ""${YUV_RAW_INPUT}"
+ --width=352
+ --height=288
+ --bit-depth=8
+ --profile=0"
+}
+
+yuv_480p_raw_input() {
+ echo ""${YUV_480P_RAW_INPUT}"
+ --width=640
+ --height=480
+ --bit-depth=8
+ --profile=0"
+}
+
+y4m_720p_input() {
+ echo ""${Y4M_720P_INPUT}"
+ --bit-depth=8
+ --profile=0"
+}
+
+y4m_360p_10bit_input() {
+ echo ""${Y4M_360P_10BIT_INPUT}"
+ --bit-depth=10
+ --profile=2"
+}
+
+has_x86_isa_extn() {
+ instruction_set=$1
+ if ! grep -q "$instruction_set" /proc/cpuinfo; then
+ # This instruction_set is not supported.
+ return 1
+ fi
+ # This instruction_set is supported.
+ return 0
+}
+
+# Echo good encode params for use with VP9 encoder.
+vp9_encode_good_params() {
+ echo "--codec=vp9 \
+ --good \
+ --test-decode=fatal \
+ --ivf \
+ --threads=1 \
+ --static-thresh=0 \
+ --tile-columns=0 \
+ --end-usage=vbr \
+ --kf-max-dist=160 \
+ --kf-min-dist=0 \
+ --lag-in-frames=19 \
+ --max-q=63 \
+ --min-q=0 \
+ --passes=2 \
+ --undershoot-pct=100 \
+ --overshoot-pct=100 \
+ --verbose \
+ --auto-alt-ref=1 \
+ --drop-frame=0 \
+ --bias-pct=50 \
+ --minsection-pct=0 \
+ --maxsection-pct=2000 \
+ --arnr-maxframes=7 \
+ --arnr-strength=5 \
+ --sharpness=0 \
+ --frame-parallel=0"
+}
+
+# Echo realtime encode params for use with VP9 encoder.
+vp9_encode_rt_params() {
+ echo "--codec=vp9 \
+ --rt \
+ --test-decode=fatal \
+ --ivf \
+ --threads=1 \
+ --static-thresh=0 \
+ --tile-columns=0 \
+ --tile-rows=0 \
+ --end-usage=cbr \
+ --kf-max-dist=90000 \
+ --lag-in-frames=0 \
+ --max-q=58 \
+ --min-q=2 \
+ --passes=1 \
+ --undershoot-pct=50 \
+ --overshoot-pct=50 \
+ --verbose \
+ --row-mt=0 \
+ --buf-sz=1000 \
+ --buf-initial-sz=500 \
+ --buf-optimal-sz=600 \
+ --max-intra-rate=300 \
+ --resize-allowed=0 \
+ --noise-sensitivity=0 \
+ --aq-mode=3 \
+ --error-resilient=0"
+}
+
+# Configures for the given target in the
+# ${VPX_TEST_OUTPUT_DIR}/build_target_${target} directory.
+vp9_enc_build() {
+ local target=$1
+ local configure="$2"
+ local tmp_build_dir=${VPX_TEST_OUTPUT_DIR}/build_target_${target}
+ mkdir -p "$tmp_build_dir"
+ local save_dir="$PWD"
+ cd "$tmp_build_dir"
+
+ echo "Building target: ${target}"
+ local config_args="--disable-install-docs \
+ --enable-unit-tests \
+ --enable-debug \
+ --enable-postproc \
+ --enable-vp9-postproc \
+ --enable-vp9-temporal-denoising \
+ --enable-vp9-highbitdepth"
+
+ eval "$configure" --target="${target}" "${config_args}" ${devnull}
+ eval make -j$(nproc) ${devnull}
+ echo "Done building target: ${target}"
+ cd "${save_dir}"
+}
+
+compare_enc_output() {
+ local target=$1
+ local cpu=$2
+ local clip=$3
+ local bitrate=$4
+ local preset=$5
+ if ! diff -q ${VPX_TEST_OUTPUT_DIR}/Out-generic-gnu-"${clip}"-${preset}-${bitrate}kbps-cpu${cpu}${OUT_FILE_SUFFIX} \
+ ${VPX_TEST_OUTPUT_DIR}/Out-${target}-"${clip}"-${preset}-${bitrate}kbps-cpu${cpu}${OUT_FILE_SUFFIX}; then
+ elog "C vs ${target} encode mismatches for ${clip}, at ${bitrate} kbps, speed ${cpu}, ${preset} preset"
+ return 1
+ fi
+}
+
+vp9_enc_test() {
+ local encoder="$1"
+ local target=$2
+ if [ -z "$(vp9_enc_tool_path "${target}")" ]; then
+ elog "vpxenc not found. It must exist in ${VPX_TEST_OUTPUT_DIR}/build_target_${target} path"
+ return 1
+ fi
+
+ local tmp_build_dir=${VPX_TEST_OUTPUT_DIR}/build_target_${target}
+ local save_dir="$PWD"
+ cd "$tmp_build_dir"
+ for preset in ${PRESETS}; do
+ if [ "${preset}" = "good" ]; then
+ local max_cpu_used=5
+ local test_params=vp9_encode_good_params
+ elif [ "${preset}" = "rt" ]; then
+ local max_cpu_used=9
+ local test_params=vp9_encode_rt_params
+ else
+ elog "Invalid preset"
+ cd "${save_dir}"
+ return 1
+ fi
+
+ # Enable armv8 test for real-time only
+ if [ "${preset}" = "good" ] && [ "${target}" = "armv8-linux-gcc" ]; then
+ continue
+ fi
+
+ for cpu in $(seq 0 $max_cpu_used); do
+ for clip in ${TEST_CLIPS}; do
+ for bitrate in ${TEST_BITRATES}; do
+ eval "${encoder}" $($clip) $($test_params) \
+ "--limit=${VP9_ENCODE_C_VS_SIMD_TEST_FRAME_LIMIT}" \
+ "--cpu-used=${cpu}" "--target-bitrate=${bitrate}" "-o" \
+ ${VPX_TEST_OUTPUT_DIR}/Out-${target}-"${clip}"-${preset}-${bitrate}kbps-cpu${cpu}${OUT_FILE_SUFFIX} \
+ ${devnull}
+
+ if [ "${target}" != "generic-gnu" ]; then
+ if ! compare_enc_output ${target} $cpu ${clip} $bitrate ${preset}; then
+ # Find the mismatch
+ cd "${save_dir}"
+ return 1
+ fi
+ fi
+ done
+ done
+ done
+ done
+ cd "${save_dir}"
+}
+
+vp9_test_generic() {
+ local configure="$LIBVPX_SOURCE_DIR/configure"
+ local target="generic-gnu"
+
+ echo "Build for: ${target}"
+ vp9_enc_build ${target} ${configure}
+ local encoder="$(vp9_enc_tool_path "${target}")"
+ vp9_enc_test $encoder "${target}"
+}
+
+# This function encodes VP9 bitstream by enabling SSE2, SSSE3, SSE4_1, AVX2, AVX512f as there are
+# no functions with MMX, SSE, SSE3 and AVX specialization.
+# The value of environment variable 'VPX_SIMD_CAPS' controls enabling of different instruction
+# set extension optimizations. The value of the flag 'VPX_SIMD_CAPS' and the corresponding
+# instruction set extension optimization enabled are as follows:
+# AVX512 AVX2 AVX SSE4_1 SSSE3 SSE3 SSE2 SSE MMX
+# 1 1 1 1 1 1 1 1 1 -> 0x1FF -> Enable AVX512 and lower variants
+# 0 1 1 1 1 1 1 1 1 -> 0x0FF -> Enable AVX2 and lower variants
+# 0 0 1 1 1 1 1 1 1 -> 0x07F -> Enable AVX and lower variants
+# 0 0 0 1 1 1 1 1 1 -> 0x03F -> Enable SSE4_1 and lower variants
+# 0 0 0 0 1 1 1 1 1 -> 0x01F -> Enable SSSE3 and lower variants
+# 0 0 0 0 0 1 1 1 1 -> 0x00F -> Enable SSE3 and lower variants
+# 0 0 0 0 0 0 1 1 1 -> 0x007 -> Enable SSE2 and lower variants
+# 0 0 0 0 0 0 0 1 1 -> 0x003 -> Enable SSE and lower variants
+# 0 0 0 0 0 0 0 0 1 -> 0x001 -> Enable MMX
+## NOTE: In x86_64 platform, it is not possible to enable sse/mmx/c using "VPX_SIMD_CAPS_MASK" as
+# all x86_64 platforms implement sse2.
+vp9_test_x86() {
+ local arch=$1
+
+ if ! uname -m | grep -q "x86"; then
+ elog "Machine architecture is not x86 or x86_64"
+ return 0
+ fi
+
+ if [ $arch = "x86" ]; then
+ local target="x86-linux-gcc"
+ elif [ $arch = "x86_64" ]; then
+ local target="x86_64-linux-gcc"
+ fi
+
+ local x86_isa_variants="avx512f avx2 sse4_1 ssse3 sse2"
+ local configure="$LIBVPX_SOURCE_DIR/configure"
+
+ echo "Build for x86: ${target}"
+ vp9_enc_build ${target} ${configure}
+ local encoder="$(vp9_enc_tool_path "${target}")"
+ for isa in $x86_isa_variants; do
+ # Note that if has_x86_isa_extn returns 1, it is false, and vice versa.
+ if ! has_x86_isa_extn $isa; then
+ echo "${isa} is not supported in this machine"
+ continue
+ fi
+ export VPX_SIMD_CAPS_MASK=$($isa)
+ if ! vp9_enc_test $encoder ${target}; then
+ # Find the mismatch
+ return 1
+ fi
+ unset VPX_SIMD_CAPS_MASK
+ done
+}
+
+vp9_test_arm() {
+ local target="armv8-linux-gcc"
+ local configure="CROSS=aarch64-linux-gnu- $LIBVPX_SOURCE_DIR/configure --extra-cflags=-march=armv8.4-a \
+ --extra-cxxflags=-march=armv8.4-a"
+ echo "Build for arm64: ${target}"
+ vp9_enc_build ${target} "${configure}"
+
+ local encoder="$(vp9_enc_tool_path "${target}")"
+ if ! vp9_enc_test "qemu-aarch64 -L /usr/aarch64-linux-gnu ${encoder}" ${target}; then
+ # Find the mismatch
+ return 1
+ fi
+}
+
+vp9_c_vs_simd_enc_test() {
+ # Test Generic
+ vp9_test_generic
+
+ # Test x86 (32 bit)
+ echo "vp9 test for x86 (32 bit): Started."
+ if ! vp9_test_x86 "x86"; then
+ echo "vp9 test for x86 (32 bit): Done, test failed."
+ return 1
+ else
+ echo "vp9 test for x86 (32 bit): Done, all tests passed."
+ fi
+
+ # Test x86_64 (64 bit)
+ if [ "$(eval uname -m)" = "x86_64" ]; then
+ echo "vp9 test for x86_64 (64 bit): Started."
+ if ! vp9_test_x86 "x86_64"; then
+ echo "vp9 test for x86_64 (64 bit): Done, test failed."
+ return 1
+ else
+ echo "vp9 test for x86_64 (64 bit): Done, all tests passed."
+ fi
+ fi
+
+ # Test ARM
+ echo "vp9_test_arm: Started."
+ if ! vp9_test_arm; then
+ echo "vp9 test for arm: Done, test failed."
+ return 1
+ else
+ echo "vp9 test for arm: Done, all tests passed."
+ fi
+}
+
+# Setup a trap function to clean up build, and output files after tests complete.
+# trap cleanup EXIT
+
+run_tests vp9_c_vs_simd_enc_verify_environment vp9_c_vs_simd_enc_test
diff --git a/test/vp9_datarate_test.cc b/test/vp9_datarate_test.cc
index 7e9180749..4bc909920 100644
--- a/test/vp9_datarate_test.cc
+++ b/test/vp9_datarate_test.cc
@@ -28,7 +28,7 @@ class DatarateTestVP9 : public ::libvpx_test::EncoderTest {
}
protected:
- virtual ~DatarateTestVP9() {}
+ ~DatarateTestVP9() override = default;
virtual void ResetModel() {
last_pts_ = 0;
@@ -113,8 +113,8 @@ class DatarateTestVP9 : public ::libvpx_test::EncoderTest {
return layer_id;
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
encoder->Control(VP9E_SET_AQ_MODE, aq_mode_);
@@ -164,7 +164,7 @@ class DatarateTestVP9 : public ::libvpx_test::EncoderTest {
duration_ = 0;
}
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
// Time since last timestamp = duration.
vpx_codec_pts_t duration = pkt->data.frame.pts - last_pts_;
@@ -202,7 +202,7 @@ class DatarateTestVP9 : public ::libvpx_test::EncoderTest {
++tot_frame_number_;
}
- virtual void EndPassHook() {
+ void EndPassHook() override {
for (int layer = 0; layer < static_cast<int>(cfg_.ts_number_layers);
++layer) {
duration_ = (last_pts_ + 1) * timebase_;
@@ -243,7 +243,7 @@ class DatarateTestVP9RealTimeMultiBR
DatarateTestVP9RealTimeMultiBR() : DatarateTestVP9(GET_PARAM(0)) {}
protected:
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(::libvpx_test::kRealTime);
set_cpu_used_ = GET_PARAM(1);
@@ -259,7 +259,7 @@ class DatarateTestVP9LargeVBR
DatarateTestVP9LargeVBR() : DatarateTestVP9(GET_PARAM(0)) {}
protected:
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(::libvpx_test::kRealTime);
set_cpu_used_ = GET_PARAM(1);
@@ -579,10 +579,10 @@ class DatarateTestVP9RealTime : public DatarateTestVP9,
public ::libvpx_test::CodecTestWithParam<int> {
public:
DatarateTestVP9RealTime() : DatarateTestVP9(GET_PARAM(0)) {}
- virtual ~DatarateTestVP9RealTime() {}
+ ~DatarateTestVP9RealTime() override = default;
protected:
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(::libvpx_test::kRealTime);
set_cpu_used_ = GET_PARAM(1);
@@ -731,10 +731,10 @@ class DatarateTestVP9RealTimeDeltaQUV
public ::libvpx_test::CodecTestWith2Params<int, int> {
public:
DatarateTestVP9RealTimeDeltaQUV() : DatarateTestVP9(GET_PARAM(0)) {}
- virtual ~DatarateTestVP9RealTimeDeltaQUV() {}
+ ~DatarateTestVP9RealTimeDeltaQUV() override = default;
protected:
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(::libvpx_test::kRealTime);
set_cpu_used_ = GET_PARAM(1);
@@ -779,7 +779,7 @@ class DatarateTestVP9PostEncodeDrop
DatarateTestVP9PostEncodeDrop() : DatarateTestVP9(GET_PARAM(0)) {}
protected:
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(::libvpx_test::kRealTime);
set_cpu_used_ = GET_PARAM(1);
@@ -819,17 +819,17 @@ class DatarateTestVP9FrameQp
public ::testing::TestWithParam<const libvpx_test::CodecFactory *> {
public:
DatarateTestVP9FrameQp() : DatarateTestVP9(GetParam()), frame_(0) {}
- virtual ~DatarateTestVP9FrameQp() {}
+ ~DatarateTestVP9FrameQp() override = default;
protected:
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(::libvpx_test::kRealTime);
ResetModel();
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
set_cpu_used_ = 7;
DatarateTestVP9::PreEncodeFrameHook(video, encoder);
frame_qp_ = static_cast<int>(rnd_.RandRange(64));
@@ -837,7 +837,7 @@ class DatarateTestVP9FrameQp
frame_++;
}
- virtual void PostEncodeFrameHook(::libvpx_test::Encoder *encoder) {
+ void PostEncodeFrameHook(::libvpx_test::Encoder *encoder) override {
int qp = 0;
vpx_svc_layer_id_t layer_id;
if (frame_ >= total_frame_) return;
@@ -847,8 +847,8 @@ class DatarateTestVP9FrameQp
temporal_layer_id_ = layer_id.temporal_layer_id;
}
- virtual void MismatchHook(const vpx_image_t * /*img1*/,
- const vpx_image_t * /*img2*/) {
+ void MismatchHook(const vpx_image_t * /*img1*/,
+ const vpx_image_t * /*img2*/) override {
if (frame_ >= total_frame_) return;
ASSERT_TRUE(cfg_.temporal_layering_mode ==
VP9E_TEMPORAL_LAYERING_MODE_0212 &&
@@ -945,7 +945,7 @@ TEST_P(DatarateTestVP9FrameQp, VP9SetFrameQp3TemporalLayersFixedMode) {
// Params: speed setting.
class DatarateTestVP9RealTimeDenoiser : public DatarateTestVP9RealTime {
public:
- virtual ~DatarateTestVP9RealTimeDenoiser() {}
+ ~DatarateTestVP9RealTimeDenoiser() override = default;
};
// Check basic datarate targeting, for a single bitrate, when denoiser is on.
diff --git a/test/vp9_denoiser_test.cc b/test/vp9_denoiser_test.cc
index d884b7eb9..831f83305 100644
--- a/test/vp9_denoiser_test.cc
+++ b/test/vp9_denoiser_test.cc
@@ -42,11 +42,11 @@ class VP9DenoiserTest
: public ::testing::Test,
public ::testing::WithParamInterface<VP9DenoiserTestParam> {
public:
- virtual ~VP9DenoiserTest() {}
+ ~VP9DenoiserTest() override = default;
- virtual void SetUp() { bs_ = GET_PARAM(1); }
+ void SetUp() override { bs_ = GET_PARAM(1); }
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
+ void TearDown() override { libvpx_test::ClearSystemState(); }
protected:
BLOCK_SIZE bs_;
diff --git a/test/vp9_encoder_parms_get_to_decoder.cc b/test/vp9_encoder_parms_get_to_decoder.cc
index ce2198c59..0e182c76d 100644
--- a/test/vp9_encoder_parms_get_to_decoder.cc
+++ b/test/vp9_encoder_parms_get_to_decoder.cc
@@ -62,9 +62,9 @@ class VpxEncoderParmsGetToDecoder
VpxEncoderParmsGetToDecoder()
: EncoderTest(GET_PARAM(0)), encode_parms(GET_PARAM(1)) {}
- virtual ~VpxEncoderParmsGetToDecoder() {}
+ ~VpxEncoderParmsGetToDecoder() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(::libvpx_test::kTwoPassGood);
cfg_.g_lag_in_frames = 25;
@@ -74,8 +74,8 @@ class VpxEncoderParmsGetToDecoder
cfg_.rc_target_bitrate = test_video_.bitrate;
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP9E_SET_COLOR_SPACE, encode_parms.cs);
encoder->Control(VP9E_SET_COLOR_RANGE, encode_parms.color_range);
@@ -95,9 +95,9 @@ class VpxEncoderParmsGetToDecoder
}
}
- virtual bool HandleDecodeResult(const vpx_codec_err_t res_dec,
- const libvpx_test::VideoSource & /*video*/,
- libvpx_test::Decoder *decoder) {
+ bool HandleDecodeResult(const vpx_codec_err_t res_dec,
+ const libvpx_test::VideoSource & /*video*/,
+ libvpx_test::Decoder *decoder) override {
vpx_codec_ctx_t *const vp9_decoder = decoder->GetDecoder();
vpx_codec_alg_priv_t *const priv =
reinterpret_cast<vpx_codec_alg_priv_t *>(vp9_decoder->priv);
diff --git a/test/vp9_end_to_end_test.cc b/test/vp9_end_to_end_test.cc
index 7a85db26a..79be4ee14 100644
--- a/test/vp9_end_to_end_test.cc
+++ b/test/vp9_end_to_end_test.cc
@@ -89,9 +89,9 @@ class EndToEndTestAdaptiveRDThresh
: EncoderTest(GET_PARAM(0)), cpu_used_start_(GET_PARAM(1)),
cpu_used_end_(GET_PARAM(2)) {}
- virtual ~EndToEndTestAdaptiveRDThresh() {}
+ ~EndToEndTestAdaptiveRDThresh() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(::libvpx_test::kRealTime);
cfg_.g_lag_in_frames = 0;
@@ -102,8 +102,8 @@ class EndToEndTestAdaptiveRDThresh
dec_cfg_.threads = 4;
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP8E_SET_CPUUSED, cpu_used_start_);
encoder->Control(VP9E_SET_ROW_MT, 1);
@@ -131,9 +131,9 @@ class EndToEndTestLarge
denoiser_on_ = 0;
}
- virtual ~EndToEndTestLarge() {}
+ ~EndToEndTestLarge() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(encoding_mode_);
if (encoding_mode_ != ::libvpx_test::kRealTime) {
@@ -149,18 +149,18 @@ class EndToEndTestLarge
dec_cfg_.threads = 4;
}
- virtual void BeginPassHook(unsigned int) {
+ void BeginPassHook(unsigned int) override {
psnr_ = 0.0;
nframes_ = 0;
}
- virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) override {
psnr_ += pkt->data.psnr.psnr[0];
nframes_++;
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP9E_SET_FRAME_PARALLEL_DECODING, 1);
encoder->Control(VP9E_SET_TILE_COLUMNS, 4);
@@ -207,9 +207,9 @@ class EndToEndTestLoopFilterThreading
EndToEndTestLoopFilterThreading()
: EncoderTest(GET_PARAM(0)), use_loop_filter_opt_(GET_PARAM(1)) {}
- virtual ~EndToEndTestLoopFilterThreading() {}
+ ~EndToEndTestLoopFilterThreading() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(::libvpx_test::kRealTime);
cfg_.g_threads = 2;
@@ -221,16 +221,16 @@ class EndToEndTestLoopFilterThreading
dec_cfg_.threads = GET_PARAM(2);
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP8E_SET_CPUUSED, 8);
}
encoder->Control(VP9E_SET_TILE_COLUMNS, 4 - video->frame() % 5);
}
- virtual void PreDecodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Decoder *decoder) {
+ void PreDecodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Decoder *decoder) override {
if (video->frame() == 0) {
decoder->Control(VP9D_SET_LOOP_FILTER_OPT, use_loop_filter_opt_ ? 1 : 0);
}
diff --git a/test/vp9_ethread_test.cc b/test/vp9_ethread_test.cc
index 238366cb6..c8d3cba7f 100644
--- a/test/vp9_ethread_test.cc
+++ b/test/vp9_ethread_test.cc
@@ -21,12 +21,12 @@
namespace {
// FIRSTPASS_STATS struct:
// {
-// 25 double members;
+// 26 double members;
// 1 int64_t member;
// }
// Whenever FIRSTPASS_STATS struct is modified, the following constants need to
// be revisited.
-const int kDbl = 25;
+const int kDbl = 26;
const int kInt = 1;
const size_t kFirstPassStatsSz = kDbl * sizeof(double) + kInt * sizeof(int64_t);
@@ -44,9 +44,9 @@ class VPxFirstPassEncoderThreadTest
firstpass_stats_.buf = nullptr;
firstpass_stats_.sz = 0;
}
- virtual ~VPxFirstPassEncoderThreadTest() { free(firstpass_stats_.buf); }
+ ~VPxFirstPassEncoderThreadTest() override { free(firstpass_stats_.buf); }
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(encoding_mode_);
@@ -57,19 +57,19 @@ class VPxFirstPassEncoderThreadTest
cfg_.rc_min_quantizer = 0;
}
- virtual void BeginPassHook(unsigned int /*pass*/) {
+ void BeginPassHook(unsigned int /*pass*/) override {
encoder_initialized_ = false;
abort_ = false;
}
- virtual void EndPassHook() {
+ void EndPassHook() override {
// For first pass stats test, only run first pass encoder.
if (first_pass_only_ && cfg_.g_pass == VPX_RC_FIRST_PASS)
abort_ |= first_pass_only_;
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource * /*video*/,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource * /*video*/,
+ ::libvpx_test::Encoder *encoder) override {
if (!encoder_initialized_) {
// Encode in 2-pass mode.
encoder->Control(VP9E_SET_TILE_COLUMNS, tiles_);
@@ -87,7 +87,7 @@ class VPxFirstPassEncoderThreadTest
}
}
- virtual void StatsPktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void StatsPktHook(const vpx_codec_cx_pkt_t *pkt) override {
const uint8_t *const pkt_buf =
reinterpret_cast<uint8_t *>(pkt->data.twopass_stats.buf);
const size_t pkt_size = pkt->data.twopass_stats.sz;
@@ -185,7 +185,7 @@ TEST_P(VPxFirstPassEncoderThreadTest, FirstPassStatsTest) {
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
// Compare to check if using or not using row-mt generates close stats.
- ASSERT_NO_FATAL_FAILURE(compare_fp_stats(&firstpass_stats_, 1000.0));
+ ASSERT_NO_FATAL_FAILURE(compare_fp_stats(&firstpass_stats_, 400.0));
// Test single thread vs multiple threads
row_mt_mode_ = 1;
@@ -199,7 +199,7 @@ TEST_P(VPxFirstPassEncoderThreadTest, FirstPassStatsTest) {
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
// Compare to check if single-thread and multi-thread stats are close enough.
- ASSERT_NO_FATAL_FAILURE(compare_fp_stats(&firstpass_stats_, 1000.0));
+ ASSERT_NO_FATAL_FAILURE(compare_fp_stats(&firstpass_stats_, 400.0));
// Bit exact test in row_mt mode.
// When row_mt_mode_=1 and using >1 threads, the encoder generates bit exact
@@ -233,9 +233,9 @@ class VPxEncoderThreadTest
psnr_ = 0.0;
nframes_ = 0;
}
- virtual ~VPxEncoderThreadTest() {}
+ ~VPxEncoderThreadTest() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(encoding_mode_);
@@ -252,14 +252,14 @@ class VPxEncoderThreadTest
cfg_.rc_min_quantizer = 0;
}
- virtual void BeginPassHook(unsigned int /*pass*/) {
+ void BeginPassHook(unsigned int /*pass*/) override {
encoder_initialized_ = false;
psnr_ = 0.0;
nframes_ = 0;
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource * /*video*/,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource * /*video*/,
+ ::libvpx_test::Encoder *encoder) override {
if (!encoder_initialized_) {
// Encode 4 column tiles.
encoder->Control(VP9E_SET_TILE_COLUMNS, tiles_);
@@ -280,21 +280,21 @@ class VPxEncoderThreadTest
}
}
- virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) override {
psnr_ += pkt->data.psnr.psnr[0];
nframes_++;
}
- virtual void DecompressedFrameHook(const vpx_image_t &img,
- vpx_codec_pts_t /*pts*/) {
+ void DecompressedFrameHook(const vpx_image_t &img,
+ vpx_codec_pts_t /*pts*/) override {
::libvpx_test::MD5 md5_res;
md5_res.Add(&img);
md5_.push_back(md5_res.Get());
}
- virtual bool HandleDecodeResult(const vpx_codec_err_t res,
- const libvpx_test::VideoSource & /*video*/,
- libvpx_test::Decoder * /*decoder*/) {
+ bool HandleDecodeResult(const vpx_codec_err_t res,
+ const libvpx_test::VideoSource & /*video*/,
+ libvpx_test::Decoder * /*decoder*/) override {
if (res != VPX_CODEC_OK) {
EXPECT_EQ(VPX_CODEC_OK, res);
return false;
diff --git a/test/vp9_ext_ratectrl_test.cc b/test/vp9_ext_ratectrl_test.cc
index 2bfa6281d..33fa05c65 100644
--- a/test/vp9_ext_ratectrl_test.cc
+++ b/test/vp9_ext_ratectrl_test.cc
@@ -18,6 +18,7 @@
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "vp9/simple_encode.h"
#include "vpx/vpx_ext_ratectrl.h"
+#include "vpx/vpx_tpl.h"
#include "vpx_dsp/vpx_dsp_common.h"
namespace {
@@ -41,7 +42,7 @@ constexpr int kDefaultMaxGfInterval = 16;
constexpr int kReadMinGfInterval = 5;
constexpr int kReadMaxGfInterval = 13;
const char kTestFileName[] = "bus_352x288_420_f20_b8.yuv";
-const double kPsnrThreshold = 30.50;
+const double kPsnrThreshold = 30.4;
struct ToyRateCtrl {
int magic_number;
@@ -151,6 +152,19 @@ vpx_rc_status_t rc_send_firstpass_stats_gop_short(
return VPX_RC_OK;
}
+vpx_rc_status_t rc_send_tpl_gop_stats(vpx_rc_model_t rate_ctrl_model,
+ const VpxTplGopStats *tpl_gop_stats) {
+ const ToyRateCtrl *toy_rate_ctrl =
+ static_cast<ToyRateCtrl *>(rate_ctrl_model);
+ EXPECT_EQ(toy_rate_ctrl->magic_number, kModelMagicNumber);
+ EXPECT_GT(tpl_gop_stats->size, 0);
+
+ for (int i = 0; i < tpl_gop_stats->size; ++i) {
+ EXPECT_GT(tpl_gop_stats->frame_stats_list[i].num_blocks, 0);
+ }
+ return VPX_RC_OK;
+}
+
vpx_rc_status_t rc_get_encodeframe_decision(
vpx_rc_model_t rate_ctrl_model,
const vpx_rc_encodeframe_info_t *encode_frame_info,
@@ -384,7 +398,7 @@ vpx_rc_status_t rc_get_encodeframe_decision_gop_short_overlay(
EXPECT_EQ(encode_frame_info->show_index, 3);
EXPECT_EQ(encode_frame_info->gop_index, 0);
EXPECT_EQ(encode_frame_info->frame_type, vp9::kFrameTypeOverlay);
- EXPECT_EQ(toy_rate_ctrl->gop_global_index, 2);
+ EXPECT_EQ(toy_rate_ctrl->gop_global_index, 1);
}
// When the model recommends an invalid q, valid range [0, 255],
@@ -678,7 +692,7 @@ class ExtRateCtrlTest : public ::libvpx_test::EncoderTest,
void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
- vpx_rc_funcs_t rc_funcs;
+ vpx_rc_funcs_t rc_funcs = {};
rc_funcs.rc_type = VPX_RC_QP;
rc_funcs.create_model = rc_create_model;
rc_funcs.send_firstpass_stats = rc_send_firstpass_stats;
@@ -721,10 +735,11 @@ class ExtRateCtrlTestGOP : public ::libvpx_test::EncoderTest,
encoder->Control(VP9E_SET_MIN_GF_INTERVAL, kDefaultMinGfInterval);
encoder->Control(VP9E_SET_MAX_GF_INTERVAL, kDefaultMaxGfInterval);
- vpx_rc_funcs_t rc_funcs;
+ vpx_rc_funcs_t rc_funcs = {};
rc_funcs.rc_type = VPX_RC_GOP_QP;
rc_funcs.create_model = rc_create_model_gop;
rc_funcs.send_firstpass_stats = rc_send_firstpass_stats_gop;
+ rc_funcs.send_tpl_gop_stats = rc_send_tpl_gop_stats;
rc_funcs.get_encodeframe_decision = rc_get_encodeframe_decision_gop;
rc_funcs.get_gop_decision = rc_get_gop_decision;
rc_funcs.update_encodeframe_result = rc_update_encodeframe_result_gop;
@@ -768,7 +783,7 @@ class ExtRateCtrlTestGOPShort : public ::libvpx_test::EncoderTest,
encoder->Control(VP9E_SET_MAX_GF_INTERVAL, kDefaultMaxGfInterval);
encoder->Control(VP9E_SET_TARGET_LEVEL, vp9::LEVEL_AUTO);
- vpx_rc_funcs_t rc_funcs;
+ vpx_rc_funcs_t rc_funcs = {};
rc_funcs.rc_type = VPX_RC_GOP_QP;
rc_funcs.create_model = rc_create_model_gop_short;
rc_funcs.send_firstpass_stats = rc_send_firstpass_stats_gop_short;
@@ -816,7 +831,7 @@ class ExtRateCtrlTestGOPShortOverlay
encoder->Control(VP9E_SET_MAX_GF_INTERVAL, kDefaultMaxGfInterval);
encoder->Control(VP9E_SET_TARGET_LEVEL, vp9::LEVEL_AUTO);
- vpx_rc_funcs_t rc_funcs;
+ vpx_rc_funcs_t rc_funcs = {};
rc_funcs.rc_type = VPX_RC_GOP_QP;
rc_funcs.create_model = rc_create_model_gop_short;
rc_funcs.send_firstpass_stats = rc_send_firstpass_stats_gop_short;
@@ -865,7 +880,7 @@ class ExtRateCtrlTestGOPShortNoARF
encoder->Control(VP9E_SET_MAX_GF_INTERVAL, kDefaultMaxGfInterval);
encoder->Control(VP9E_SET_TARGET_LEVEL, vp9::LEVEL_AUTO);
- vpx_rc_funcs_t rc_funcs;
+ vpx_rc_funcs_t rc_funcs = {};
rc_funcs.rc_type = VPX_RC_GOP_QP;
rc_funcs.create_model = rc_create_model_gop_short;
rc_funcs.send_firstpass_stats = rc_send_firstpass_stats_gop_short;
@@ -919,7 +934,7 @@ class ExtRateCtrlTestRdmult : public ::libvpx_test::EncoderTest,
void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
- vpx_rc_funcs_t rc_funcs;
+ vpx_rc_funcs_t rc_funcs = {};
rc_funcs.rc_type = VPX_RC_GOP_QP_RDMULT;
rc_funcs.create_model = rc_create_model_gop_short;
rc_funcs.send_firstpass_stats = rc_send_firstpass_stats_gop_short;
diff --git a/test/vp9_intrapred_test.cc b/test/vp9_intrapred_test.cc
index ccace719e..c69d43efb 100644
--- a/test/vp9_intrapred_test.cc
+++ b/test/vp9_intrapred_test.cc
@@ -55,6 +55,21 @@ class IntraPredTest : public ::testing::TestWithParam<PredParam> {
ref_dst_ = ref_dst;
int error_count = 0;
for (int i = 0; i < count_test_block; ++i) {
+ // TODO(webm:1797): Some of the optimised predictor implementations rely
+ // on the trailing half of the above_row_ being a copy of the final
+ // element, however relying on this in some cases can cause the MD5 tests
+ // to fail. We have fixed all of these cases for Neon, so fill the whole
+ // of above_row_ randomly.
+#if HAVE_NEON
+ // Fill edges with random data, try first with saturated values.
+ for (int x = -1; x < 2 * block_size; x++) {
+ if (i == 0) {
+ above_row_[x] = mask_;
+ } else {
+ above_row_[x] = rnd.Rand16() & mask_;
+ }
+ }
+#else
// Fill edges with random data, try first with saturated values.
for (int x = -1; x < block_size; x++) {
if (i == 0) {
@@ -66,6 +81,7 @@ class IntraPredTest : public ::testing::TestWithParam<PredParam> {
for (int x = block_size; x < 2 * block_size; x++) {
above_row_[x] = above_row_[block_size - 1];
}
+#endif
for (int y = 0; y < block_size; y++) {
if (i == 0) {
left_col_[y] = mask_;
@@ -80,7 +96,7 @@ class IntraPredTest : public ::testing::TestWithParam<PredParam> {
}
protected:
- virtual void SetUp() {
+ void SetUp() override {
params_ = this->GetParam();
stride_ = params_.block_size * 3;
mask_ = (1 << params_.bit_depth) - 1;
@@ -243,6 +259,22 @@ INSTANTIATE_TEST_SUITE_P(
&vpx_d45_predictor_16x16_c, 16, 8),
IntraPredParam(&vpx_d45_predictor_32x32_neon,
&vpx_d45_predictor_32x32_c, 32, 8),
+ IntraPredParam(&vpx_d63_predictor_4x4_neon, &vpx_d63_predictor_4x4_c, 4,
+ 8),
+ IntraPredParam(&vpx_d63_predictor_8x8_neon, &vpx_d63_predictor_8x8_c, 8,
+ 8),
+ IntraPredParam(&vpx_d63_predictor_16x16_neon,
+ &vpx_d63_predictor_16x16_c, 16, 8),
+ IntraPredParam(&vpx_d63_predictor_32x32_neon,
+ &vpx_d63_predictor_32x32_c, 32, 8),
+ IntraPredParam(&vpx_d117_predictor_4x4_neon, &vpx_d117_predictor_4x4_c,
+ 4, 8),
+ IntraPredParam(&vpx_d117_predictor_8x8_neon, &vpx_d117_predictor_8x8_c,
+ 8, 8),
+ IntraPredParam(&vpx_d117_predictor_16x16_neon,
+ &vpx_d117_predictor_16x16_c, 16, 8),
+ IntraPredParam(&vpx_d117_predictor_32x32_neon,
+ &vpx_d117_predictor_32x32_c, 32, 8),
IntraPredParam(&vpx_d135_predictor_4x4_neon, &vpx_d135_predictor_4x4_c,
4, 8),
IntraPredParam(&vpx_d135_predictor_8x8_neon, &vpx_d135_predictor_8x8_c,
@@ -251,6 +283,22 @@ INSTANTIATE_TEST_SUITE_P(
&vpx_d135_predictor_16x16_c, 16, 8),
IntraPredParam(&vpx_d135_predictor_32x32_neon,
&vpx_d135_predictor_32x32_c, 32, 8),
+ IntraPredParam(&vpx_d153_predictor_4x4_neon, &vpx_d153_predictor_4x4_c,
+ 4, 8),
+ IntraPredParam(&vpx_d153_predictor_8x8_neon, &vpx_d153_predictor_8x8_c,
+ 8, 8),
+ IntraPredParam(&vpx_d153_predictor_16x16_neon,
+ &vpx_d153_predictor_16x16_c, 16, 8),
+ IntraPredParam(&vpx_d153_predictor_32x32_neon,
+ &vpx_d153_predictor_32x32_c, 32, 8),
+ IntraPredParam(&vpx_d207_predictor_4x4_neon, &vpx_d207_predictor_4x4_c,
+ 4, 8),
+ IntraPredParam(&vpx_d207_predictor_8x8_neon, &vpx_d207_predictor_8x8_c,
+ 8, 8),
+ IntraPredParam(&vpx_d207_predictor_16x16_neon,
+ &vpx_d207_predictor_16x16_c, 16, 8),
+ IntraPredParam(&vpx_d207_predictor_32x32_neon,
+ &vpx_d207_predictor_32x32_c, 32, 8),
IntraPredParam(&vpx_dc_128_predictor_4x4_neon,
&vpx_dc_128_predictor_4x4_c, 4, 8),
IntraPredParam(&vpx_dc_128_predictor_8x8_neon,
@@ -441,6 +489,15 @@ INSTANTIATE_TEST_SUITE_P(
&vpx_v_predictor_32x32_c, 32, 8)));
#endif // HAVE_VSX
+#if HAVE_LSX
+INSTANTIATE_TEST_SUITE_P(
+ LSX, VP9IntraPredTest,
+ ::testing::Values(IntraPredParam(&vpx_dc_predictor_8x8_lsx,
+ &vpx_dc_predictor_8x8_c, 8, 8),
+ IntraPredParam(&vpx_dc_predictor_16x16_lsx,
+ &vpx_dc_predictor_16x16_c, 16, 8)));
+#endif // HAVE_LSX
+
#if CONFIG_VP9_HIGHBITDEPTH
typedef void (*HighbdIntraPred)(uint16_t *dst, ptrdiff_t stride,
const uint16_t *above, const uint16_t *left,
@@ -832,6 +889,22 @@ INSTANTIATE_TEST_SUITE_P(
&vpx_highbd_d45_predictor_16x16_c, 16, 8),
HighbdIntraPredParam(&vpx_highbd_d45_predictor_32x32_neon,
&vpx_highbd_d45_predictor_32x32_c, 32, 8),
+ HighbdIntraPredParam(&vpx_highbd_d63_predictor_4x4_neon,
+ &vpx_highbd_d63_predictor_4x4_c, 4, 8),
+ HighbdIntraPredParam(&vpx_highbd_d63_predictor_8x8_neon,
+ &vpx_highbd_d63_predictor_8x8_c, 8, 8),
+ HighbdIntraPredParam(&vpx_highbd_d63_predictor_16x16_neon,
+ &vpx_highbd_d63_predictor_16x16_c, 16, 8),
+ HighbdIntraPredParam(&vpx_highbd_d63_predictor_32x32_neon,
+ &vpx_highbd_d63_predictor_32x32_c, 32, 8),
+ HighbdIntraPredParam(&vpx_highbd_d117_predictor_4x4_neon,
+ &vpx_highbd_d117_predictor_4x4_c, 4, 8),
+ HighbdIntraPredParam(&vpx_highbd_d117_predictor_8x8_neon,
+ &vpx_highbd_d117_predictor_8x8_c, 8, 8),
+ HighbdIntraPredParam(&vpx_highbd_d117_predictor_16x16_neon,
+ &vpx_highbd_d117_predictor_16x16_c, 16, 8),
+ HighbdIntraPredParam(&vpx_highbd_d117_predictor_32x32_neon,
+ &vpx_highbd_d117_predictor_32x32_c, 32, 8),
HighbdIntraPredParam(&vpx_highbd_d135_predictor_4x4_neon,
&vpx_highbd_d135_predictor_4x4_c, 4, 8),
HighbdIntraPredParam(&vpx_highbd_d135_predictor_8x8_neon,
@@ -840,6 +913,22 @@ INSTANTIATE_TEST_SUITE_P(
&vpx_highbd_d135_predictor_16x16_c, 16, 8),
HighbdIntraPredParam(&vpx_highbd_d135_predictor_32x32_neon,
&vpx_highbd_d135_predictor_32x32_c, 32, 8),
+ HighbdIntraPredParam(&vpx_highbd_d153_predictor_4x4_neon,
+ &vpx_highbd_d153_predictor_4x4_c, 4, 8),
+ HighbdIntraPredParam(&vpx_highbd_d153_predictor_8x8_neon,
+ &vpx_highbd_d153_predictor_8x8_c, 8, 8),
+ HighbdIntraPredParam(&vpx_highbd_d153_predictor_16x16_neon,
+ &vpx_highbd_d153_predictor_16x16_c, 16, 8),
+ HighbdIntraPredParam(&vpx_highbd_d153_predictor_32x32_neon,
+ &vpx_highbd_d153_predictor_32x32_c, 32, 8),
+ HighbdIntraPredParam(&vpx_highbd_d207_predictor_4x4_neon,
+ &vpx_highbd_d207_predictor_4x4_c, 4, 8),
+ HighbdIntraPredParam(&vpx_highbd_d207_predictor_8x8_neon,
+ &vpx_highbd_d207_predictor_8x8_c, 8, 8),
+ HighbdIntraPredParam(&vpx_highbd_d207_predictor_16x16_neon,
+ &vpx_highbd_d207_predictor_16x16_c, 16, 8),
+ HighbdIntraPredParam(&vpx_highbd_d207_predictor_32x32_neon,
+ &vpx_highbd_d207_predictor_32x32_c, 32, 8),
HighbdIntraPredParam(&vpx_highbd_dc_128_predictor_4x4_neon,
&vpx_highbd_dc_128_predictor_4x4_c, 4, 8),
HighbdIntraPredParam(&vpx_highbd_dc_128_predictor_8x8_neon,
@@ -908,6 +997,22 @@ INSTANTIATE_TEST_SUITE_P(
&vpx_highbd_d45_predictor_16x16_c, 16, 10),
HighbdIntraPredParam(&vpx_highbd_d45_predictor_32x32_neon,
&vpx_highbd_d45_predictor_32x32_c, 32, 10),
+ HighbdIntraPredParam(&vpx_highbd_d63_predictor_4x4_neon,
+ &vpx_highbd_d63_predictor_4x4_c, 4, 10),
+ HighbdIntraPredParam(&vpx_highbd_d63_predictor_8x8_neon,
+ &vpx_highbd_d63_predictor_8x8_c, 8, 10),
+ HighbdIntraPredParam(&vpx_highbd_d63_predictor_16x16_neon,
+ &vpx_highbd_d63_predictor_16x16_c, 16, 10),
+ HighbdIntraPredParam(&vpx_highbd_d63_predictor_32x32_neon,
+ &vpx_highbd_d63_predictor_32x32_c, 32, 10),
+ HighbdIntraPredParam(&vpx_highbd_d117_predictor_4x4_neon,
+ &vpx_highbd_d117_predictor_4x4_c, 4, 10),
+ HighbdIntraPredParam(&vpx_highbd_d117_predictor_8x8_neon,
+ &vpx_highbd_d117_predictor_8x8_c, 8, 10),
+ HighbdIntraPredParam(&vpx_highbd_d117_predictor_16x16_neon,
+ &vpx_highbd_d117_predictor_16x16_c, 16, 10),
+ HighbdIntraPredParam(&vpx_highbd_d117_predictor_32x32_neon,
+ &vpx_highbd_d117_predictor_32x32_c, 32, 10),
HighbdIntraPredParam(&vpx_highbd_d135_predictor_4x4_neon,
&vpx_highbd_d135_predictor_4x4_c, 4, 10),
HighbdIntraPredParam(&vpx_highbd_d135_predictor_8x8_neon,
@@ -916,6 +1021,22 @@ INSTANTIATE_TEST_SUITE_P(
&vpx_highbd_d135_predictor_16x16_c, 16, 10),
HighbdIntraPredParam(&vpx_highbd_d135_predictor_32x32_neon,
&vpx_highbd_d135_predictor_32x32_c, 32, 10),
+ HighbdIntraPredParam(&vpx_highbd_d153_predictor_4x4_neon,
+ &vpx_highbd_d153_predictor_4x4_c, 4, 10),
+ HighbdIntraPredParam(&vpx_highbd_d153_predictor_8x8_neon,
+ &vpx_highbd_d153_predictor_8x8_c, 8, 10),
+ HighbdIntraPredParam(&vpx_highbd_d153_predictor_16x16_neon,
+ &vpx_highbd_d153_predictor_16x16_c, 16, 10),
+ HighbdIntraPredParam(&vpx_highbd_d153_predictor_32x32_neon,
+ &vpx_highbd_d153_predictor_32x32_c, 32, 10),
+ HighbdIntraPredParam(&vpx_highbd_d207_predictor_4x4_neon,
+ &vpx_highbd_d207_predictor_4x4_c, 4, 10),
+ HighbdIntraPredParam(&vpx_highbd_d207_predictor_8x8_neon,
+ &vpx_highbd_d207_predictor_8x8_c, 8, 10),
+ HighbdIntraPredParam(&vpx_highbd_d207_predictor_16x16_neon,
+ &vpx_highbd_d207_predictor_16x16_c, 16, 10),
+ HighbdIntraPredParam(&vpx_highbd_d207_predictor_32x32_neon,
+ &vpx_highbd_d207_predictor_32x32_c, 32, 10),
HighbdIntraPredParam(&vpx_highbd_dc_128_predictor_4x4_neon,
&vpx_highbd_dc_128_predictor_4x4_c, 4, 10),
HighbdIntraPredParam(&vpx_highbd_dc_128_predictor_8x8_neon,
@@ -984,6 +1105,22 @@ INSTANTIATE_TEST_SUITE_P(
&vpx_highbd_d45_predictor_16x16_c, 16, 12),
HighbdIntraPredParam(&vpx_highbd_d45_predictor_32x32_neon,
&vpx_highbd_d45_predictor_32x32_c, 32, 12),
+ HighbdIntraPredParam(&vpx_highbd_d63_predictor_4x4_neon,
+ &vpx_highbd_d63_predictor_4x4_c, 4, 12),
+ HighbdIntraPredParam(&vpx_highbd_d63_predictor_8x8_neon,
+ &vpx_highbd_d63_predictor_8x8_c, 8, 12),
+ HighbdIntraPredParam(&vpx_highbd_d63_predictor_16x16_neon,
+ &vpx_highbd_d63_predictor_16x16_c, 16, 12),
+ HighbdIntraPredParam(&vpx_highbd_d63_predictor_32x32_neon,
+ &vpx_highbd_d63_predictor_32x32_c, 32, 12),
+ HighbdIntraPredParam(&vpx_highbd_d117_predictor_4x4_neon,
+ &vpx_highbd_d117_predictor_4x4_c, 4, 10),
+ HighbdIntraPredParam(&vpx_highbd_d117_predictor_8x8_neon,
+ &vpx_highbd_d117_predictor_8x8_c, 8, 10),
+ HighbdIntraPredParam(&vpx_highbd_d117_predictor_16x16_neon,
+ &vpx_highbd_d117_predictor_16x16_c, 16, 10),
+ HighbdIntraPredParam(&vpx_highbd_d117_predictor_32x32_neon,
+ &vpx_highbd_d117_predictor_32x32_c, 32, 10),
HighbdIntraPredParam(&vpx_highbd_d135_predictor_4x4_neon,
&vpx_highbd_d135_predictor_4x4_c, 4, 12),
HighbdIntraPredParam(&vpx_highbd_d135_predictor_8x8_neon,
@@ -992,6 +1129,22 @@ INSTANTIATE_TEST_SUITE_P(
&vpx_highbd_d135_predictor_16x16_c, 16, 12),
HighbdIntraPredParam(&vpx_highbd_d135_predictor_32x32_neon,
&vpx_highbd_d135_predictor_32x32_c, 32, 12),
+ HighbdIntraPredParam(&vpx_highbd_d153_predictor_4x4_neon,
+ &vpx_highbd_d153_predictor_4x4_c, 4, 12),
+ HighbdIntraPredParam(&vpx_highbd_d153_predictor_8x8_neon,
+ &vpx_highbd_d153_predictor_8x8_c, 8, 12),
+ HighbdIntraPredParam(&vpx_highbd_d153_predictor_16x16_neon,
+ &vpx_highbd_d153_predictor_16x16_c, 16, 12),
+ HighbdIntraPredParam(&vpx_highbd_d153_predictor_32x32_neon,
+ &vpx_highbd_d153_predictor_32x32_c, 32, 12),
+ HighbdIntraPredParam(&vpx_highbd_d207_predictor_4x4_neon,
+ &vpx_highbd_d207_predictor_4x4_c, 4, 12),
+ HighbdIntraPredParam(&vpx_highbd_d207_predictor_8x8_neon,
+ &vpx_highbd_d207_predictor_8x8_c, 8, 12),
+ HighbdIntraPredParam(&vpx_highbd_d207_predictor_16x16_neon,
+ &vpx_highbd_d207_predictor_16x16_c, 16, 12),
+ HighbdIntraPredParam(&vpx_highbd_d207_predictor_32x32_neon,
+ &vpx_highbd_d207_predictor_32x32_c, 32, 12),
HighbdIntraPredParam(&vpx_highbd_dc_128_predictor_4x4_neon,
&vpx_highbd_dc_128_predictor_4x4_c, 4, 12),
HighbdIntraPredParam(&vpx_highbd_dc_128_predictor_8x8_neon,
diff --git a/test/vp9_lossless_test.cc b/test/vp9_lossless_test.cc
index 931ac30a3..fe3cd1aba 100644
--- a/test/vp9_lossless_test.cc
+++ b/test/vp9_lossless_test.cc
@@ -29,15 +29,15 @@ class LosslessTest
: EncoderTest(GET_PARAM(0)), psnr_(kMaxPsnr), nframes_(0),
encoding_mode_(GET_PARAM(1)) {}
- virtual ~LosslessTest() {}
+ ~LosslessTest() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(encoding_mode_);
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
// Only call Control if quantizer > 0 to verify that using quantizer
// alone will activate lossless
@@ -47,12 +47,12 @@ class LosslessTest
}
}
- virtual void BeginPassHook(unsigned int /*pass*/) {
+ void BeginPassHook(unsigned int /*pass*/) override {
psnr_ = kMaxPsnr;
nframes_ = 0;
}
- virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
+ void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) override {
if (pkt->data.psnr.psnr[0] < psnr_) psnr_ = pkt->data.psnr.psnr[0];
}
diff --git a/test/vp9_motion_vector_test.cc b/test/vp9_motion_vector_test.cc
index 6b1082a10..495ea11fc 100644
--- a/test/vp9_motion_vector_test.cc
+++ b/test/vp9_motion_vector_test.cc
@@ -42,9 +42,9 @@ class MotionVectorTestLarge
: EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)),
cpu_used_(GET_PARAM(2)), mv_test_mode_(GET_PARAM(3)) {}
- virtual ~MotionVectorTestLarge() {}
+ ~MotionVectorTestLarge() override = default;
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(encoding_mode_);
if (encoding_mode_ != ::libvpx_test::kRealTime) {
@@ -59,8 +59,8 @@ class MotionVectorTestLarge
}
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP8E_SET_CPUUSED, cpu_used_);
encoder->Control(VP9E_ENABLE_MOTION_VECTOR_UNIT_TEST, mv_test_mode_);
diff --git a/test/vp9_quantize_test.cc b/test/vp9_quantize_test.cc
index 587cec692..e00ab4022 100644
--- a/test/vp9_quantize_test.cc
+++ b/test/vp9_quantize_test.cc
@@ -26,6 +26,7 @@
#include "test/util.h"
#include "vp9/common/vp9_entropy.h"
#include "vp9/common/vp9_scan.h"
+#include "vp9/encoder/vp9_block.h"
#include "vpx/vpx_codec.h"
#include "vpx/vpx_integer.h"
#include "vpx_ports/msvc.h"
@@ -38,33 +39,44 @@ namespace {
const int number_of_iterations = 100;
typedef void (*QuantizeFunc)(const tran_low_t *coeff, intptr_t count,
- const int16_t *zbin, const int16_t *round,
- const int16_t *quant, const int16_t *quant_shift,
+ const macroblock_plane *mb_plane,
tran_low_t *qcoeff, tran_low_t *dqcoeff,
const int16_t *dequant, uint16_t *eob,
- const int16_t *scan, const int16_t *iscan);
+ const struct ScanOrder *const scan_order);
typedef std::tuple<QuantizeFunc, QuantizeFunc, vpx_bit_depth_t,
int /*max_size*/, bool /*is_fp*/>
QuantizeParam;
+// Wrapper for 32x32 version which does not use count
+typedef void (*Quantize32x32Func)(const tran_low_t *coeff,
+ const macroblock_plane *const mb_plane,
+ tran_low_t *qcoeff, tran_low_t *dqcoeff,
+ const int16_t *dequant, uint16_t *eob,
+ const struct ScanOrder *const scan_order);
+
+template <Quantize32x32Func fn>
+void Quant32x32Wrapper(const tran_low_t *coeff, intptr_t count,
+ const macroblock_plane *const mb_plane,
+ tran_low_t *qcoeff, tran_low_t *dqcoeff,
+ const int16_t *dequant, uint16_t *eob,
+ const struct ScanOrder *const scan_order) {
+ (void)count;
+ fn(coeff, mb_plane, qcoeff, dqcoeff, dequant, eob, scan_order);
+}
+
// Wrapper for FP version which does not use zbin or quant_shift.
typedef void (*QuantizeFPFunc)(const tran_low_t *coeff, intptr_t count,
- const int16_t *round, const int16_t *quant,
+ const macroblock_plane *const mb_plane,
tran_low_t *qcoeff, tran_low_t *dqcoeff,
const int16_t *dequant, uint16_t *eob,
- const int16_t *scan, const int16_t *iscan);
+ const struct ScanOrder *const scan_order);
template <QuantizeFPFunc fn>
void QuantFPWrapper(const tran_low_t *coeff, intptr_t count,
- 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, uint16_t *eob, const int16_t *scan,
- const int16_t *iscan) {
- (void)zbin;
- (void)quant_shift;
-
- fn(coeff, count, round, quant, qcoeff, dqcoeff, dequant, eob, scan, iscan);
+ const macroblock_plane *const mb_plane, tran_low_t *qcoeff,
+ tran_low_t *dqcoeff, const int16_t *dequant, uint16_t *eob,
+ const struct ScanOrder *const scan_order) {
+ fn(coeff, count, mb_plane, qcoeff, dqcoeff, dequant, eob, scan_order);
}
void GenerateHelperArrays(ACMRandom *rnd, int16_t *zbin, int16_t *round,
@@ -119,17 +131,21 @@ class VP9QuantizeBase : public AbstractBench {
#else
max_value_ = (1 << bit_depth_) - 1;
#endif
- zbin_ptr_ =
+
+ mb_plane_ = reinterpret_cast<macroblock_plane *>(
+ vpx_memalign(16, sizeof(macroblock_plane)));
+
+ zbin_ptr_ = mb_plane_->zbin =
reinterpret_cast<int16_t *>(vpx_memalign(16, 8 * sizeof(*zbin_ptr_)));
- round_fp_ptr_ = reinterpret_cast<int16_t *>(
+ round_fp_ptr_ = mb_plane_->round_fp = reinterpret_cast<int16_t *>(
vpx_memalign(16, 8 * sizeof(*round_fp_ptr_)));
- quant_fp_ptr_ = reinterpret_cast<int16_t *>(
+ quant_fp_ptr_ = mb_plane_->quant_fp = reinterpret_cast<int16_t *>(
vpx_memalign(16, 8 * sizeof(*quant_fp_ptr_)));
- round_ptr_ =
+ round_ptr_ = mb_plane_->round =
reinterpret_cast<int16_t *>(vpx_memalign(16, 8 * sizeof(*round_ptr_)));
- quant_ptr_ =
+ quant_ptr_ = mb_plane_->quant =
reinterpret_cast<int16_t *>(vpx_memalign(16, 8 * sizeof(*quant_ptr_)));
- quant_shift_ptr_ = reinterpret_cast<int16_t *>(
+ quant_shift_ptr_ = mb_plane_->quant_shift = reinterpret_cast<int16_t *>(
vpx_memalign(16, 8 * sizeof(*quant_shift_ptr_)));
dequant_ptr_ = reinterpret_cast<int16_t *>(
vpx_memalign(16, 8 * sizeof(*dequant_ptr_)));
@@ -138,7 +154,8 @@ class VP9QuantizeBase : public AbstractBench {
q_ptr_ = (is_fp_) ? quant_fp_ptr_ : quant_ptr_;
}
- ~VP9QuantizeBase() {
+ ~VP9QuantizeBase() override {
+ vpx_free(mb_plane_);
vpx_free(zbin_ptr_);
vpx_free(round_fp_ptr_);
vpx_free(quant_fp_ptr_);
@@ -146,6 +163,7 @@ class VP9QuantizeBase : public AbstractBench {
vpx_free(quant_ptr_);
vpx_free(quant_shift_ptr_);
vpx_free(dequant_ptr_);
+ mb_plane_ = nullptr;
zbin_ptr_ = nullptr;
round_fp_ptr_ = nullptr;
quant_fp_ptr_ = nullptr;
@@ -157,9 +175,10 @@ class VP9QuantizeBase : public AbstractBench {
}
protected:
+ macroblock_plane *mb_plane_;
int16_t *zbin_ptr_;
- int16_t *round_fp_ptr_;
int16_t *quant_fp_ptr_;
+ int16_t *round_fp_ptr_;
int16_t *round_ptr_;
int16_t *quant_ptr_;
int16_t *quant_shift_ptr_;
@@ -174,7 +193,7 @@ class VP9QuantizeBase : public AbstractBench {
int16_t *r_ptr_;
int16_t *q_ptr_;
int count_;
- const scan_order *scan_;
+ const ScanOrder *scan_;
uint16_t eob_;
};
@@ -186,17 +205,15 @@ class VP9QuantizeTest : public VP9QuantizeBase,
quantize_op_(GET_PARAM(0)), ref_quantize_op_(GET_PARAM(1)) {}
protected:
- virtual void Run();
+ void Run() override;
void Speed(bool is_median);
const QuantizeFunc quantize_op_;
const QuantizeFunc ref_quantize_op_;
};
void VP9QuantizeTest::Run() {
- quantize_op_(coeff_.TopLeftPixel(), count_, zbin_ptr_, r_ptr_, q_ptr_,
- quant_shift_ptr_, qcoeff_.TopLeftPixel(),
- dqcoeff_.TopLeftPixel(), dequant_ptr_, &eob_, scan_->scan,
- scan_->iscan);
+ quantize_op_(coeff_.TopLeftPixel(), count_, mb_plane_, qcoeff_.TopLeftPixel(),
+ dqcoeff_.TopLeftPixel(), dequant_ptr_, &eob_, scan_);
}
void VP9QuantizeTest::Speed(bool is_median) {
@@ -266,19 +283,18 @@ void VP9QuantizeTest::Speed(bool is_median) {
vpx_usec_timer_start(&timer);
for (int n = 0; n < kNumTests; ++n) {
- ref_quantize_op_(coeff_.TopLeftPixel(), count_, zbin_ptr_, r_ptr_,
- q_ptr_, quant_shift_ptr_, ref_qcoeff.TopLeftPixel(),
+ ref_quantize_op_(coeff_.TopLeftPixel(), count_, mb_plane_,
+ ref_qcoeff.TopLeftPixel(),
ref_dqcoeff.TopLeftPixel(), dequant_ptr_, &ref_eob,
- scan_->scan, scan_->iscan);
+ scan_);
}
vpx_usec_timer_mark(&timer);
vpx_usec_timer_start(&simd_timer);
for (int n = 0; n < kNumTests; ++n) {
- quantize_op_(coeff_.TopLeftPixel(), count_, zbin_ptr_, r_ptr_, q_ptr_,
- quant_shift_ptr_, qcoeff_.TopLeftPixel(),
- dqcoeff_.TopLeftPixel(), dequant_ptr_, &eob_,
- scan_->scan, scan_->iscan);
+ quantize_op_(coeff_.TopLeftPixel(), count_, mb_plane_,
+ qcoeff_.TopLeftPixel(), dqcoeff_.TopLeftPixel(),
+ dequant_ptr_, &eob_, scan_);
}
vpx_usec_timer_mark(&simd_timer);
@@ -298,14 +314,16 @@ void VP9QuantizeTest::Speed(bool is_median) {
// determine if further multiplication operations are needed.
// Based on vp9_quantize_fp_sse2().
inline void quant_fp_nz(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- const int16_t *round_ptr, const int16_t *quant_ptr,
+ const struct macroblock_plane *const mb_plane,
tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
const int16_t *dequant_ptr, uint16_t *eob_ptr,
- const int16_t *scan, const int16_t *iscan,
+ const struct ScanOrder *const scan_order,
int is_32x32) {
int i, eob = -1;
const int thr = dequant_ptr[1] >> (1 + is_32x32);
- (void)iscan;
+ const int16_t *round_ptr = mb_plane->round_fp;
+ const int16_t *quant_ptr = mb_plane->quant_fp;
+ const int16_t *scan = scan_order->scan;
// Quantization pass: All coefficients with index >= zero_flag are
// skippable. Note: zero_flag can be zero.
@@ -372,21 +390,21 @@ inline void quant_fp_nz(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
}
void quantize_fp_nz_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- const int16_t *round_ptr, const int16_t *quant_ptr,
+ const struct macroblock_plane *mb_plane,
tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
const int16_t *dequant_ptr, uint16_t *eob_ptr,
- const int16_t *scan, const int16_t *iscan) {
- quant_fp_nz(coeff_ptr, n_coeffs, round_ptr, quant_ptr, qcoeff_ptr,
- dqcoeff_ptr, dequant_ptr, eob_ptr, scan, iscan, 0);
+ const struct ScanOrder *const scan_order) {
+ quant_fp_nz(coeff_ptr, n_coeffs, mb_plane, qcoeff_ptr, dqcoeff_ptr,
+ dequant_ptr, eob_ptr, scan_order, 0);
}
void quantize_fp_32x32_nz_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- const int16_t *round_ptr, const int16_t *quant_ptr,
+ const struct macroblock_plane *mb_plane,
tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
const int16_t *dequant_ptr, uint16_t *eob_ptr,
- const int16_t *scan, const int16_t *iscan) {
- quant_fp_nz(coeff_ptr, n_coeffs, round_ptr, quant_ptr, qcoeff_ptr,
- dqcoeff_ptr, dequant_ptr, eob_ptr, scan, iscan, 1);
+ const struct ScanOrder *const scan_order) {
+ quant_fp_nz(coeff_ptr, n_coeffs, mb_plane, qcoeff_ptr, dqcoeff_ptr,
+ dequant_ptr, eob_ptr, scan_order, 1);
}
TEST_P(VP9QuantizeTest, OperationCheck) {
@@ -417,15 +435,13 @@ TEST_P(VP9QuantizeTest, OperationCheck) {
GenerateHelperArrays(&rnd, zbin_ptr_, round_ptr_, quant_ptr_,
quant_shift_ptr_, dequant_ptr_, round_fp_ptr_,
quant_fp_ptr_);
- ref_quantize_op_(coeff_.TopLeftPixel(), count_, zbin_ptr_, r_ptr_, q_ptr_,
- quant_shift_ptr_, ref_qcoeff.TopLeftPixel(),
- ref_dqcoeff.TopLeftPixel(), dequant_ptr_, &ref_eob,
- scan_->scan, scan_->iscan);
+ ref_quantize_op_(coeff_.TopLeftPixel(), count_, mb_plane_,
+ ref_qcoeff.TopLeftPixel(), ref_dqcoeff.TopLeftPixel(),
+ dequant_ptr_, &ref_eob, scan_);
ASM_REGISTER_STATE_CHECK(quantize_op_(
- coeff_.TopLeftPixel(), count_, zbin_ptr_, r_ptr_, q_ptr_,
- quant_shift_ptr_, qcoeff_.TopLeftPixel(), dqcoeff_.TopLeftPixel(),
- dequant_ptr_, &eob_, scan_->scan, scan_->iscan));
+ coeff_.TopLeftPixel(), count_, mb_plane_, qcoeff_.TopLeftPixel(),
+ dqcoeff_.TopLeftPixel(), dequant_ptr_, &eob_, scan_));
EXPECT_TRUE(qcoeff_.CheckValues(ref_qcoeff));
EXPECT_TRUE(dqcoeff_.CheckValues(ref_dqcoeff));
@@ -475,15 +491,13 @@ TEST_P(VP9QuantizeTest, EOBCheck) {
GenerateHelperArrays(&rnd, zbin_ptr_, round_ptr_, quant_ptr_,
quant_shift_ptr_, dequant_ptr_, round_fp_ptr_,
quant_fp_ptr_);
- ref_quantize_op_(coeff_.TopLeftPixel(), count_, zbin_ptr_, r_ptr_, q_ptr_,
- quant_shift_ptr_, ref_qcoeff.TopLeftPixel(),
- ref_dqcoeff.TopLeftPixel(), dequant_ptr_, &ref_eob,
- scan_->scan, scan_->iscan);
+ ref_quantize_op_(coeff_.TopLeftPixel(), count_, mb_plane_,
+ ref_qcoeff.TopLeftPixel(), ref_dqcoeff.TopLeftPixel(),
+ dequant_ptr_, &ref_eob, scan_);
ASM_REGISTER_STATE_CHECK(quantize_op_(
- coeff_.TopLeftPixel(), count_, zbin_ptr_, r_ptr_, q_ptr_,
- quant_shift_ptr_, qcoeff_.TopLeftPixel(), dqcoeff_.TopLeftPixel(),
- dequant_ptr_, &eob_, scan_->scan, scan_->iscan));
+ coeff_.TopLeftPixel(), count_, mb_plane_, qcoeff_.TopLeftPixel(),
+ dqcoeff_.TopLeftPixel(), dequant_ptr_, &eob_, scan_));
EXPECT_TRUE(qcoeff_.CheckValues(ref_qcoeff));
EXPECT_TRUE(dqcoeff_.CheckValues(ref_dqcoeff));
@@ -510,27 +524,30 @@ using std::make_tuple;
INSTANTIATE_TEST_SUITE_P(
SSE2, VP9QuantizeTest,
::testing::Values(
- make_tuple(&vpx_quantize_b_sse2, &vpx_quantize_b_c, VPX_BITS_8, 16,
+ make_tuple(vpx_quantize_b_sse2, vpx_quantize_b_c, VPX_BITS_8, 16,
false),
make_tuple(&QuantFPWrapper<vp9_quantize_fp_sse2>,
&QuantFPWrapper<quantize_fp_nz_c>, VPX_BITS_8, 16, true),
- make_tuple(&vpx_highbd_quantize_b_sse2, &vpx_highbd_quantize_b_c,
+ make_tuple(vpx_highbd_quantize_b_sse2, vpx_highbd_quantize_b_c,
VPX_BITS_8, 16, false),
- make_tuple(&vpx_highbd_quantize_b_sse2, &vpx_highbd_quantize_b_c,
+ make_tuple(vpx_highbd_quantize_b_sse2, vpx_highbd_quantize_b_c,
VPX_BITS_10, 16, false),
- make_tuple(&vpx_highbd_quantize_b_sse2, &vpx_highbd_quantize_b_c,
+ make_tuple(vpx_highbd_quantize_b_sse2, vpx_highbd_quantize_b_c,
VPX_BITS_12, 16, false),
- make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
- &vpx_highbd_quantize_b_32x32_c, VPX_BITS_8, 32, false),
- make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
- &vpx_highbd_quantize_b_32x32_c, VPX_BITS_10, 32, false),
- make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
- &vpx_highbd_quantize_b_32x32_c, VPX_BITS_12, 32, false)));
+ make_tuple(&Quant32x32Wrapper<vpx_highbd_quantize_b_32x32_sse2>,
+ &Quant32x32Wrapper<vpx_highbd_quantize_b_32x32_c>,
+ VPX_BITS_8, 32, false),
+ make_tuple(&Quant32x32Wrapper<vpx_highbd_quantize_b_32x32_sse2>,
+ &Quant32x32Wrapper<vpx_highbd_quantize_b_32x32_c>,
+ VPX_BITS_10, 32, false),
+ make_tuple(&Quant32x32Wrapper<vpx_highbd_quantize_b_32x32_sse2>,
+ &Quant32x32Wrapper<vpx_highbd_quantize_b_32x32_c>,
+ VPX_BITS_12, 32, false)));
#else
INSTANTIATE_TEST_SUITE_P(
SSE2, VP9QuantizeTest,
- ::testing::Values(make_tuple(&vpx_quantize_b_sse2, &vpx_quantize_b_c,
+ ::testing::Values(make_tuple(vpx_quantize_b_sse2, vpx_quantize_b_c,
VPX_BITS_8, 16, false),
make_tuple(&QuantFPWrapper<vp9_quantize_fp_sse2>,
&QuantFPWrapper<quantize_fp_nz_c>, VPX_BITS_8,
@@ -541,11 +558,11 @@ INSTANTIATE_TEST_SUITE_P(
#if HAVE_SSSE3
INSTANTIATE_TEST_SUITE_P(
SSSE3, VP9QuantizeTest,
- ::testing::Values(make_tuple(&vpx_quantize_b_ssse3, &vpx_quantize_b_c,
+ ::testing::Values(make_tuple(vpx_quantize_b_ssse3, vpx_quantize_b_c,
VPX_BITS_8, 16, false),
- make_tuple(&vpx_quantize_b_32x32_ssse3,
- &vpx_quantize_b_32x32_c, VPX_BITS_8, 32,
- false),
+ make_tuple(&Quant32x32Wrapper<vpx_quantize_b_32x32_ssse3>,
+ &Quant32x32Wrapper<vpx_quantize_b_32x32_c>,
+ VPX_BITS_8, 32, false),
make_tuple(&QuantFPWrapper<vp9_quantize_fp_ssse3>,
&QuantFPWrapper<quantize_fp_nz_c>, VPX_BITS_8,
16, true),
@@ -555,13 +572,13 @@ INSTANTIATE_TEST_SUITE_P(
#endif // HAVE_SSSE3
#if HAVE_AVX
-INSTANTIATE_TEST_SUITE_P(AVX, VP9QuantizeTest,
- ::testing::Values(make_tuple(&vpx_quantize_b_avx,
- &vpx_quantize_b_c,
- VPX_BITS_8, 16, false),
- make_tuple(&vpx_quantize_b_32x32_avx,
- &vpx_quantize_b_32x32_c,
- VPX_BITS_8, 32, false)));
+INSTANTIATE_TEST_SUITE_P(
+ AVX, VP9QuantizeTest,
+ ::testing::Values(make_tuple(vpx_quantize_b_avx, vpx_quantize_b_c,
+ VPX_BITS_8, 16, false),
+ make_tuple(&Quant32x32Wrapper<vpx_quantize_b_32x32_avx>,
+ &Quant32x32Wrapper<vpx_quantize_b_32x32_c>,
+ VPX_BITS_8, 32, false)));
#endif // HAVE_AVX
#if VPX_ARCH_X86_64 && HAVE_AVX2
@@ -577,22 +594,26 @@ INSTANTIATE_TEST_SUITE_P(
make_tuple(&QuantFPWrapper<vp9_highbd_quantize_fp_32x32_avx2>,
&QuantFPWrapper<vp9_highbd_quantize_fp_32x32_c>, VPX_BITS_12,
32, true),
- make_tuple(&vpx_quantize_b_avx2, &vpx_quantize_b_c, VPX_BITS_8, 16,
+ make_tuple(vpx_quantize_b_avx2, vpx_quantize_b_c, VPX_BITS_8, 16,
false),
- make_tuple(&vpx_highbd_quantize_b_avx2, &vpx_highbd_quantize_b_c,
+ make_tuple(vpx_highbd_quantize_b_avx2, vpx_highbd_quantize_b_c,
VPX_BITS_8, 16, false),
- make_tuple(&vpx_highbd_quantize_b_avx2, &vpx_highbd_quantize_b_c,
+ make_tuple(vpx_highbd_quantize_b_avx2, vpx_highbd_quantize_b_c,
VPX_BITS_10, 16, false),
- make_tuple(&vpx_highbd_quantize_b_avx2, &vpx_highbd_quantize_b_c,
+ make_tuple(vpx_highbd_quantize_b_avx2, vpx_highbd_quantize_b_c,
VPX_BITS_12, 16, false),
- make_tuple(&vpx_quantize_b_32x32_avx2, &vpx_quantize_b_32x32_c,
+ make_tuple(&Quant32x32Wrapper<vpx_quantize_b_32x32_avx2>,
+ &Quant32x32Wrapper<vpx_quantize_b_32x32_c>, VPX_BITS_8, 32,
+ false),
+ make_tuple(&Quant32x32Wrapper<vpx_highbd_quantize_b_32x32_avx2>,
+ &Quant32x32Wrapper<vpx_highbd_quantize_b_32x32_c>,
VPX_BITS_8, 32, false),
- make_tuple(&vpx_highbd_quantize_b_32x32_avx2,
- &vpx_highbd_quantize_b_32x32_c, VPX_BITS_8, 32, false),
- make_tuple(&vpx_highbd_quantize_b_32x32_avx2,
- &vpx_highbd_quantize_b_32x32_c, VPX_BITS_10, 32, false),
- make_tuple(&vpx_highbd_quantize_b_32x32_avx2,
- &vpx_highbd_quantize_b_32x32_c, VPX_BITS_12, 32, false)));
+ make_tuple(&Quant32x32Wrapper<vpx_highbd_quantize_b_32x32_avx2>,
+ &Quant32x32Wrapper<vpx_highbd_quantize_b_32x32_c>,
+ VPX_BITS_10, 32, false),
+ make_tuple(&Quant32x32Wrapper<vpx_highbd_quantize_b_32x32_avx2>,
+ &Quant32x32Wrapper<vpx_highbd_quantize_b_32x32_c>,
+ VPX_BITS_12, 32, false)));
#else
INSTANTIATE_TEST_SUITE_P(
AVX2, VP9QuantizeTest,
@@ -602,11 +623,11 @@ INSTANTIATE_TEST_SUITE_P(
make_tuple(&QuantFPWrapper<vp9_quantize_fp_32x32_avx2>,
&QuantFPWrapper<quantize_fp_32x32_nz_c>,
VPX_BITS_8, 32, true),
- make_tuple(&vpx_quantize_b_avx2, &vpx_quantize_b_c,
+ make_tuple(vpx_quantize_b_avx2, vpx_quantize_b_c,
VPX_BITS_8, 16, false),
- make_tuple(&vpx_quantize_b_32x32_avx2,
- &vpx_quantize_b_32x32_c, VPX_BITS_8, 32,
- false)));
+ make_tuple(&Quant32x32Wrapper<vpx_quantize_b_32x32_avx2>,
+ &Quant32x32Wrapper<vpx_quantize_b_32x32_c>,
+ VPX_BITS_8, 32, false)));
#endif // CONFIG_VP9_HIGHBITDEPTH
#endif // HAVE_AVX2
@@ -617,20 +638,24 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
make_tuple(&vpx_quantize_b_neon, &vpx_quantize_b_c, VPX_BITS_8, 16,
false),
- make_tuple(&vpx_highbd_quantize_b_neon, &vpx_highbd_quantize_b_c,
+ make_tuple(vpx_highbd_quantize_b_neon, vpx_highbd_quantize_b_c,
VPX_BITS_8, 16, false),
- make_tuple(&vpx_highbd_quantize_b_neon, &vpx_highbd_quantize_b_c,
+ make_tuple(vpx_highbd_quantize_b_neon, vpx_highbd_quantize_b_c,
VPX_BITS_10, 16, false),
- make_tuple(&vpx_highbd_quantize_b_neon, &vpx_highbd_quantize_b_c,
+ make_tuple(vpx_highbd_quantize_b_neon, vpx_highbd_quantize_b_c,
VPX_BITS_12, 16, false),
- make_tuple(&vpx_quantize_b_32x32_neon, &vpx_quantize_b_32x32_c,
+ make_tuple(&Quant32x32Wrapper<vpx_quantize_b_32x32_neon>,
+ &Quant32x32Wrapper<vpx_quantize_b_32x32_c>, VPX_BITS_8, 32,
+ false),
+ make_tuple(&Quant32x32Wrapper<vpx_highbd_quantize_b_32x32_neon>,
+ &Quant32x32Wrapper<vpx_highbd_quantize_b_32x32_c>,
VPX_BITS_8, 32, false),
- make_tuple(&vpx_highbd_quantize_b_32x32_neon,
- &vpx_highbd_quantize_b_32x32_c, VPX_BITS_8, 32, false),
- make_tuple(&vpx_highbd_quantize_b_32x32_neon,
- &vpx_highbd_quantize_b_32x32_c, VPX_BITS_10, 32, false),
- make_tuple(&vpx_highbd_quantize_b_32x32_neon,
- &vpx_highbd_quantize_b_32x32_c, VPX_BITS_12, 32, false),
+ make_tuple(&Quant32x32Wrapper<vpx_highbd_quantize_b_32x32_neon>,
+ &Quant32x32Wrapper<vpx_highbd_quantize_b_32x32_c>,
+ VPX_BITS_10, 32, false),
+ make_tuple(&Quant32x32Wrapper<vpx_highbd_quantize_b_32x32_neon>,
+ &Quant32x32Wrapper<vpx_highbd_quantize_b_32x32_c>,
+ VPX_BITS_12, 32, false),
make_tuple(&QuantFPWrapper<vp9_quantize_fp_neon>,
&QuantFPWrapper<vp9_quantize_fp_c>, VPX_BITS_8, 16, true),
make_tuple(&QuantFPWrapper<vp9_quantize_fp_32x32_neon>,
@@ -641,9 +666,9 @@ INSTANTIATE_TEST_SUITE_P(
NEON, VP9QuantizeTest,
::testing::Values(make_tuple(&vpx_quantize_b_neon, &vpx_quantize_b_c,
VPX_BITS_8, 16, false),
- make_tuple(&vpx_quantize_b_32x32_neon,
- &vpx_quantize_b_32x32_c, VPX_BITS_8, 32,
- false),
+ make_tuple(&Quant32x32Wrapper<vpx_quantize_b_32x32_neon>,
+ &Quant32x32Wrapper<vpx_quantize_b_32x32_c>,
+ VPX_BITS_8, 32, false),
make_tuple(&QuantFPWrapper<vp9_quantize_fp_neon>,
&QuantFPWrapper<vp9_quantize_fp_c>, VPX_BITS_8,
16, true),
@@ -670,13 +695,13 @@ INSTANTIATE_TEST_SUITE_P(
#endif // HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH
#if HAVE_LSX && !CONFIG_VP9_HIGHBITDEPTH
-INSTANTIATE_TEST_SUITE_P(LSX, VP9QuantizeTest,
- ::testing::Values(make_tuple(&vpx_quantize_b_lsx,
- &vpx_quantize_b_c,
- VPX_BITS_8, 16, false),
- make_tuple(&vpx_quantize_b_32x32_lsx,
- &vpx_quantize_b_32x32_c,
- VPX_BITS_8, 32, false)));
+INSTANTIATE_TEST_SUITE_P(
+ LSX, VP9QuantizeTest,
+ ::testing::Values(make_tuple(&vpx_quantize_b_lsx, &vpx_quantize_b_c,
+ VPX_BITS_8, 16, false),
+ make_tuple(&Quant32x32Wrapper<vpx_quantize_b_32x32_lsx>,
+ &Quant32x32Wrapper<vpx_quantize_b_32x32_c>,
+ VPX_BITS_8, 32, false)));
#endif // HAVE_LSX && !CONFIG_VP9_HIGHBITDEPTH
// Only useful to compare "Speed" test results.
@@ -684,8 +709,9 @@ INSTANTIATE_TEST_SUITE_P(
DISABLED_C, VP9QuantizeTest,
::testing::Values(
make_tuple(&vpx_quantize_b_c, &vpx_quantize_b_c, VPX_BITS_8, 16, false),
- make_tuple(&vpx_quantize_b_32x32_c, &vpx_quantize_b_32x32_c, VPX_BITS_8,
- 32, false),
+ make_tuple(&Quant32x32Wrapper<vpx_quantize_b_32x32_c>,
+ &Quant32x32Wrapper<vpx_quantize_b_32x32_c>, VPX_BITS_8, 32,
+ false),
make_tuple(&QuantFPWrapper<vp9_quantize_fp_c>,
&QuantFPWrapper<vp9_quantize_fp_c>, VPX_BITS_8, 16, true),
make_tuple(&QuantFPWrapper<quantize_fp_nz_c>,
diff --git a/test/vp9_ratectrl_rtc_test.cc b/test/vp9_ratectrl_rtc_test.cc
index 1d1a78f43..f7be47542 100644
--- a/test/vp9_ratectrl_rtc_test.cc
+++ b/test/vp9_ratectrl_rtc_test.cc
@@ -31,6 +31,7 @@ const int kTemporalId2Layer[2] = { 0, 1 };
const int kTemporalRateAllocation3Layer[3] = { 50, 70, 100 };
const int kTemporalRateAllocation2Layer[2] = { 60, 100 };
const int kSpatialLayerBitrate[3] = { 200, 400, 1000 };
+const int kSpatialLayerBitrateLow[3] = { 50, 100, 400 };
class RcInterfaceTest
: public ::libvpx_test::EncoderTest,
@@ -38,28 +39,34 @@ class RcInterfaceTest
public:
RcInterfaceTest()
: EncoderTest(GET_PARAM(0)), aq_mode_(GET_PARAM(1)), key_interval_(3000),
- encoder_exit_(false) {}
+ encoder_exit_(false), frame_drop_thresh_(0), num_drops_(0) {}
- virtual ~RcInterfaceTest() {}
+ ~RcInterfaceTest() override = default;
protected:
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(::libvpx_test::kRealTime);
}
- virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
- libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(libvpx_test::VideoSource *video,
+ libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP8E_SET_CPUUSED, 7);
encoder->Control(VP9E_SET_AQ_MODE, aq_mode_);
- encoder->Control(VP9E_SET_TUNE_CONTENT, 0);
+ if (rc_cfg_.is_screen) {
+ encoder->Control(VP9E_SET_TUNE_CONTENT, VP9E_CONTENT_SCREEN);
+ } else {
+ encoder->Control(VP9E_SET_TUNE_CONTENT, VP9E_CONTENT_DEFAULT);
+ }
encoder->Control(VP8E_SET_MAX_INTRA_BITRATE_PCT, 1000);
encoder->Control(VP9E_SET_RTC_EXTERNAL_RATECTRL, 1);
}
- frame_params_.frame_type =
- video->frame() % key_interval_ == 0 ? KEY_FRAME : INTER_FRAME;
- if (rc_cfg_.rc_mode == VPX_CBR && frame_params_.frame_type == INTER_FRAME) {
+ frame_params_.frame_type = video->frame() % key_interval_ == 0
+ ? libvpx::RcFrameType::kKeyFrame
+ : libvpx::RcFrameType::kInterFrame;
+ if (rc_cfg_.rc_mode == VPX_CBR &&
+ frame_params_.frame_type == libvpx::RcFrameType::kInterFrame) {
// Disable golden frame update.
frame_flags_ |= VP8_EFLAG_NO_UPD_GF;
frame_flags_ |= VP8_EFLAG_NO_UPD_ARF;
@@ -67,20 +74,23 @@ class RcInterfaceTest
encoder_exit_ = video->frame() == kNumFrames;
}
- virtual void PostEncodeFrameHook(::libvpx_test::Encoder *encoder) {
+ void PostEncodeFrameHook(::libvpx_test::Encoder *encoder) override {
if (encoder_exit_) {
return;
}
int loopfilter_level, qp;
encoder->Control(VP9E_GET_LOOPFILTER_LEVEL, &loopfilter_level);
encoder->Control(VP8E_GET_LAST_QUANTIZER, &qp);
- rc_api_->ComputeQP(frame_params_);
- ASSERT_EQ(rc_api_->GetQP(), qp);
- ASSERT_EQ(rc_api_->GetLoopfilterLevel(), loopfilter_level);
+ if (rc_api_->ComputeQP(frame_params_) == libvpx::FrameDropDecision::kOk) {
+ ASSERT_EQ(rc_api_->GetQP(), qp);
+ ASSERT_EQ(rc_api_->GetLoopfilterLevel(), loopfilter_level);
+ } else {
+ num_drops_++;
+ }
}
- virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
- rc_api_->PostEncodeUpdate(pkt->data.frame.sz);
+ void FramePktHook(const vpx_codec_cx_pkt_t *pkt) override {
+ rc_api_->PostEncodeUpdate(pkt->data.frame.sz, frame_params_);
}
void RunOneLayer() {
@@ -95,6 +105,42 @@ class RcInterfaceTest
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
}
+ void RunOneLayerScreen() {
+ SetConfig(GET_PARAM(2));
+ rc_cfg_.is_screen = true;
+ rc_api_ = libvpx::VP9RateControlRTC::Create(rc_cfg_);
+ frame_params_.spatial_layer_id = 0;
+ frame_params_.temporal_layer_id = 0;
+
+ ::libvpx_test::I420VideoSource video("desktop_office1.1280_720-020.yuv",
+ 1280, 720, 30, 1, 0, kNumFrames);
+
+ ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
+ }
+
+ void RunOneLayerDropFramesCBR() {
+ if (GET_PARAM(2) != VPX_CBR) {
+ GTEST_SKIP() << "Frame dropping is only for CBR mode.";
+ }
+ frame_drop_thresh_ = 30;
+ SetConfig(GET_PARAM(2));
+ // Use lower bitrate, lower max-q, and enable frame dropper.
+ rc_cfg_.target_bandwidth = 200;
+ cfg_.rc_target_bitrate = 200;
+ rc_cfg_.max_quantizer = 50;
+ cfg_.rc_max_quantizer = 50;
+ rc_api_ = libvpx::VP9RateControlRTC::Create(rc_cfg_);
+ frame_params_.spatial_layer_id = 0;
+ frame_params_.temporal_layer_id = 0;
+
+ ::libvpx_test::I420VideoSource video("desktop_office1.1280_720-020.yuv",
+ 1280, 720, 30, 1, 0, kNumFrames);
+
+ ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
+ // Check that some frames were dropped, otherwise test has no value.
+ ASSERT_GE(num_drops_, 1);
+ }
+
void RunOneLayerVBRPeriodicKey() {
if (GET_PARAM(2) != VPX_VBR) return;
key_interval_ = 100;
@@ -132,6 +178,7 @@ class RcInterfaceTest
rc_cfg_.min_quantizers[0] = 2;
rc_cfg_.rc_mode = rc_mode;
rc_cfg_.aq_mode = aq_mode_;
+ rc_cfg_.frame_drop_thresh = frame_drop_thresh_;
// Encoder settings for ground truth.
cfg_.g_w = 1280;
@@ -150,6 +197,7 @@ class RcInterfaceTest
cfg_.rc_target_bitrate = 1000;
cfg_.kf_min_dist = key_interval_;
cfg_.kf_max_dist = key_interval_;
+ cfg_.rc_dropframe_thresh = frame_drop_thresh_;
}
std::unique_ptr<libvpx::VP9RateControlRTC> rc_api_;
@@ -158,23 +206,31 @@ class RcInterfaceTest
int key_interval_;
libvpx::VP9FrameParamsQpRTC frame_params_;
bool encoder_exit_;
+ int frame_drop_thresh_;
+ int num_drops_;
};
-class RcInterfaceSvcTest : public ::libvpx_test::EncoderTest,
- public ::libvpx_test::CodecTestWithParam<int> {
+class RcInterfaceSvcTest
+ : public ::libvpx_test::EncoderTest,
+ public ::libvpx_test::CodecTestWith2Params<int, bool> {
public:
- RcInterfaceSvcTest() : EncoderTest(GET_PARAM(0)), aq_mode_(GET_PARAM(1)) {}
- virtual ~RcInterfaceSvcTest() {}
+ RcInterfaceSvcTest()
+ : EncoderTest(GET_PARAM(0)), aq_mode_(GET_PARAM(1)), key_interval_(3000),
+ dynamic_spatial_layers_(0), inter_layer_pred_off_(GET_PARAM(2)),
+ parallel_spatial_layers_(false), frame_drop_thresh_(0),
+ max_consec_drop_(INT_MAX), num_drops_(0) {}
+ ~RcInterfaceSvcTest() override = default;
protected:
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(::libvpx_test::kRealTime);
}
- virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
+ current_superframe_ = 0;
encoder->Control(VP8E_SET_CPUUSED, 7);
encoder->Control(VP9E_SET_AQ_MODE, aq_mode_);
encoder->Control(VP9E_SET_TUNE_CONTENT, 0);
@@ -182,11 +238,23 @@ class RcInterfaceSvcTest : public ::libvpx_test::EncoderTest,
encoder->Control(VP9E_SET_RTC_EXTERNAL_RATECTRL, 1);
encoder->Control(VP9E_SET_SVC, 1);
encoder->Control(VP9E_SET_SVC_PARAMETERS, &svc_params_);
+ if (inter_layer_pred_off_) {
+ encoder->Control(VP9E_SET_SVC_INTER_LAYER_PRED,
+ INTER_LAYER_PRED_OFF_NONKEY);
+ }
+ if (frame_drop_thresh_ > 0) {
+ vpx_svc_frame_drop_t svc_drop_frame;
+ svc_drop_frame.framedrop_mode = FULL_SUPERFRAME_DROP;
+ for (int sl = 0; sl < rc_cfg_.ss_number_layers; ++sl)
+ svc_drop_frame.framedrop_thresh[sl] = frame_drop_thresh_;
+ svc_drop_frame.max_consec_drop = max_consec_drop_;
+ encoder->Control(VP9E_SET_SVC_FRAME_DROP_LAYER, &svc_drop_frame);
+ }
}
- frame_params_.frame_type =
- video->frame() % key_interval_ == 0 ? KEY_FRAME : INTER_FRAME;
+ frame_params_.frame_type = video->frame() % key_interval_ == 0
+ ? libvpx::RcFrameType::kKeyFrame
+ : libvpx::RcFrameType::kInterFrame;
encoder_exit_ = video->frame() == kNumFrames;
- current_superframe_ = video->frame();
if (dynamic_spatial_layers_ == 1) {
if (video->frame() == 100) {
// Go down to 2 spatial layers: set top SL to 0 bitrate.
@@ -201,7 +269,7 @@ class RcInterfaceSvcTest : public ::libvpx_test::EncoderTest,
rc_cfg_.layer_target_bitrate[6] = 0;
rc_cfg_.layer_target_bitrate[7] = 0;
rc_cfg_.layer_target_bitrate[8] = 0;
- rc_api_->UpdateRateControl(rc_cfg_);
+ ASSERT_TRUE(rc_api_->UpdateRateControl(rc_cfg_));
} else if (video->frame() == 200) {
// Go down to 1 spatial layer.
// Update the encoder config.
@@ -215,8 +283,8 @@ class RcInterfaceSvcTest : public ::libvpx_test::EncoderTest,
rc_cfg_.layer_target_bitrate[3] = 0;
rc_cfg_.layer_target_bitrate[4] = 0;
rc_cfg_.layer_target_bitrate[5] = 0;
- rc_api_->UpdateRateControl(rc_cfg_);
- } else if (0 && video->frame() == 280) {
+ ASSERT_TRUE(rc_api_->UpdateRateControl(rc_cfg_));
+ } else if (/*DISABLES CODE*/ (false) && video->frame() == 280) {
// TODO(marpan): Re-enable this going back up when issue is fixed.
// Go back up to 3 spatial layers.
// Update the encoder config: use the original bitrates.
@@ -224,52 +292,92 @@ class RcInterfaceSvcTest : public ::libvpx_test::EncoderTest,
encoder->Config(&cfg_);
// Update the RC config.
SetRCConfigSvc(3, 3);
- rc_api_->UpdateRateControl(rc_cfg_);
+ ASSERT_TRUE(rc_api_->UpdateRateControl(rc_cfg_));
}
}
}
- virtual void PostEncodeFrameHook(::libvpx_test::Encoder *encoder) {
+ virtual void SetFrameParamsSvc(int sl) {
+ frame_params_.spatial_layer_id = sl;
+ if (rc_cfg_.ts_number_layers == 3)
+ frame_params_.temporal_layer_id =
+ kTemporalId3Layer[current_superframe_ % 4];
+ else if (rc_cfg_.ts_number_layers == 2)
+ frame_params_.temporal_layer_id =
+ kTemporalId2Layer[current_superframe_ % 2];
+ else
+ frame_params_.temporal_layer_id = 0;
+ frame_params_.frame_type =
+ current_superframe_ % key_interval_ == 0 && sl == 0
+ ? libvpx::RcFrameType::kKeyFrame
+ : libvpx::RcFrameType::kInterFrame;
+ }
+
+ void PostEncodeFrameHook(::libvpx_test::Encoder *encoder) override {
+ if (encoder_exit_) {
+ return;
+ }
+ int superframe_is_dropped = false;
::libvpx_test::CxDataIterator iter = encoder->GetCxData();
for (int sl = 0; sl < rc_cfg_.ss_number_layers; sl++) sizes_[sl] = 0;
+ std::vector<int> rc_qp;
+ // For FULL_SUPERFRAME_DROP: the full superframe drop decision is
+ // determined on the base spatial layer.
+ SetFrameParamsSvc(0);
+ if (rc_api_->ComputeQP(frame_params_) == libvpx::FrameDropDecision::kDrop) {
+ superframe_is_dropped = true;
+ num_drops_++;
+ }
while (const vpx_codec_cx_pkt_t *pkt = iter.Next()) {
+ ASSERT_EQ(superframe_is_dropped, false);
ParseSuperframeSizes(static_cast<const uint8_t *>(pkt->data.frame.buf),
pkt->data.frame.sz);
- for (int sl = 0; sl < rc_cfg_.ss_number_layers; sl++) {
- if (sizes_[sl] > 0) {
- frame_params_.spatial_layer_id = sl;
- if (rc_cfg_.ts_number_layers == 3)
- frame_params_.temporal_layer_id =
- kTemporalId3Layer[current_superframe_ % 4];
- else if (rc_cfg_.ts_number_layers == 2)
- frame_params_.temporal_layer_id =
- kTemporalId2Layer[current_superframe_ % 2];
- else
- frame_params_.temporal_layer_id = 0;
- rc_api_->ComputeQP(frame_params_);
- frame_params_.frame_type = INTER_FRAME;
- rc_api_->PostEncodeUpdate(sizes_[sl]);
+ if (!parallel_spatial_layers_ || current_superframe_ == 0) {
+ for (int sl = 0; sl < rc_cfg_.ss_number_layers; sl++) {
+ if (sizes_[sl] > 0) {
+ SetFrameParamsSvc(sl);
+ // For sl=0 ComputeQP() is already called above (line 310).
+ if (sl > 0) rc_api_->ComputeQP(frame_params_);
+ rc_api_->PostEncodeUpdate(sizes_[sl], frame_params_);
+ rc_qp.push_back(rc_api_->GetQP());
+ }
+ }
+ } else {
+ for (int sl = 0; sl < rc_cfg_.ss_number_layers; sl++) {
+ // For sl=0 ComputeQP() is already called above (line 310).
+ if (sizes_[sl] > 0 && sl > 0) {
+ SetFrameParamsSvc(sl);
+ rc_api_->ComputeQP(frame_params_);
+ }
+ }
+ for (int sl = 0; sl < rc_cfg_.ss_number_layers; sl++) {
+ if (sizes_[sl] > 0) {
+ SetFrameParamsSvc(sl);
+ rc_api_->PostEncodeUpdate(sizes_[sl], frame_params_);
+ rc_qp.push_back(rc_api_->GetQP());
+ }
}
}
}
- if (!encoder_exit_) {
- int loopfilter_level, qp;
+ if (!superframe_is_dropped) {
+ int loopfilter_level;
+ std::vector<int> encoder_qp(VPX_SS_MAX_LAYERS, 0);
encoder->Control(VP9E_GET_LOOPFILTER_LEVEL, &loopfilter_level);
- encoder->Control(VP8E_GET_LAST_QUANTIZER, &qp);
- ASSERT_EQ(rc_api_->GetQP(), qp);
+ encoder->Control(VP9E_GET_LAST_QUANTIZER_SVC_LAYERS, encoder_qp.data());
+ encoder_qp.resize(rc_qp.size());
+ ASSERT_EQ(rc_qp, encoder_qp);
ASSERT_EQ(rc_api_->GetLoopfilterLevel(), loopfilter_level);
+ current_superframe_++;
}
}
// This method needs to be overridden because non-reference frames are
// expected to be mismatched frames as the encoder will avoid loopfilter on
// these frames.
- virtual void MismatchHook(const vpx_image_t * /*img1*/,
- const vpx_image_t * /*img2*/) {}
+ void MismatchHook(const vpx_image_t * /*img1*/,
+ const vpx_image_t * /*img2*/) override {}
void RunSvc() {
- dynamic_spatial_layers_ = 0;
SetRCConfigSvc(3, 3);
- key_interval_ = 10000;
rc_api_ = libvpx::VP9RateControlRTC::Create(rc_cfg_);
SetEncoderConfigSvc(3, 3);
@@ -279,8 +387,22 @@ class RcInterfaceSvcTest : public ::libvpx_test::EncoderTest,
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
}
+ void RunSvcDropFramesCBR() {
+ max_consec_drop_ = 10;
+ frame_drop_thresh_ = 30;
+ SetRCConfigSvc(3, 3);
+ rc_api_ = libvpx::VP9RateControlRTC::Create(rc_cfg_);
+ SetEncoderConfigSvc(3, 3);
+
+ ::libvpx_test::I420VideoSource video("desktop_office1.1280_720-020.yuv",
+ 1280, 720, 30, 1, 0, kNumFrames);
+
+ ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
+ // Check that some frames were dropped, otherwise test has no value.
+ ASSERT_GE(num_drops_, 1);
+ }
+
void RunSvcPeriodicKey() {
- dynamic_spatial_layers_ = 0;
SetRCConfigSvc(3, 3);
key_interval_ = 100;
rc_api_ = libvpx::VP9RateControlRTC::Create(rc_cfg_);
@@ -295,7 +417,19 @@ class RcInterfaceSvcTest : public ::libvpx_test::EncoderTest,
void RunSvcDynamicSpatial() {
dynamic_spatial_layers_ = 1;
SetRCConfigSvc(3, 3);
- key_interval_ = 10000;
+ rc_api_ = libvpx::VP9RateControlRTC::Create(rc_cfg_);
+ SetEncoderConfigSvc(3, 3);
+
+ ::libvpx_test::I420VideoSource video("desktop_office1.1280_720-020.yuv",
+ 1280, 720, 30, 1, 0, kNumFrames);
+
+ ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
+ }
+
+ void RunSvcParallelSpatialLayers() {
+ if (!inter_layer_pred_off_) return;
+ parallel_spatial_layers_ = true;
+ SetRCConfigSvc(3, 3);
rc_api_ = libvpx::VP9RateControlRTC::Create(rc_cfg_);
SetEncoderConfigSvc(3, 3);
@@ -391,12 +525,14 @@ class RcInterfaceSvcTest : public ::libvpx_test::EncoderTest,
cfg_.kf_max_dist = 9999;
cfg_.rc_overshoot_pct = 50;
cfg_.rc_undershoot_pct = 50;
+ cfg_.rc_dropframe_thresh = frame_drop_thresh_;
cfg_.rc_target_bitrate = 0;
for (int sl = 0; sl < number_spatial_layers; sl++) {
int spatial_bitrate = 0;
if (number_spatial_layers <= 3)
- spatial_bitrate = kSpatialLayerBitrate[sl];
+ spatial_bitrate = frame_drop_thresh_ > 0 ? kSpatialLayerBitrateLow[sl]
+ : kSpatialLayerBitrate[sl];
for (int tl = 0; tl < number_temporal_layers; tl++) {
int layer = sl * number_temporal_layers + tl;
if (number_temporal_layers == 3)
@@ -431,6 +567,8 @@ class RcInterfaceSvcTest : public ::libvpx_test::EncoderTest,
rc_cfg_.framerate = 30.0;
rc_cfg_.rc_mode = VPX_CBR;
rc_cfg_.aq_mode = aq_mode_;
+ rc_cfg_.frame_drop_thresh = frame_drop_thresh_;
+ rc_cfg_.max_consec_drop = max_consec_drop_;
if (number_spatial_layers == 3) {
rc_cfg_.scaling_factor_num[0] = 1;
@@ -464,7 +602,8 @@ class RcInterfaceSvcTest : public ::libvpx_test::EncoderTest,
for (int sl = 0; sl < number_spatial_layers; sl++) {
int spatial_bitrate = 0;
if (number_spatial_layers <= 3)
- spatial_bitrate = kSpatialLayerBitrate[sl];
+ spatial_bitrate = frame_drop_thresh_ > 0 ? kSpatialLayerBitrateLow[sl]
+ : kSpatialLayerBitrate[sl];
for (int tl = 0; tl < number_temporal_layers; tl++) {
int layer = sl * number_temporal_layers + tl;
if (number_temporal_layers == 3)
@@ -498,19 +637,36 @@ class RcInterfaceSvcTest : public ::libvpx_test::EncoderTest,
uint32_t sizes_[8];
int key_interval_;
int dynamic_spatial_layers_;
+ bool inter_layer_pred_off_;
+ // ComputeQP() and PostEncodeUpdate() don't need to be sequential for KSVC.
+ bool parallel_spatial_layers_;
+ int frame_drop_thresh_;
+ int max_consec_drop_;
+ int num_drops_;
};
TEST_P(RcInterfaceTest, OneLayer) { RunOneLayer(); }
+TEST_P(RcInterfaceTest, OneLayerDropFramesCBR) { RunOneLayerDropFramesCBR(); }
+
+TEST_P(RcInterfaceTest, OneLayerScreen) { RunOneLayerScreen(); }
+
TEST_P(RcInterfaceTest, OneLayerVBRPeriodicKey) { RunOneLayerVBRPeriodicKey(); }
TEST_P(RcInterfaceSvcTest, Svc) { RunSvc(); }
+TEST_P(RcInterfaceSvcTest, SvcDropFramesCBR) { RunSvcDropFramesCBR(); }
+
+TEST_P(RcInterfaceSvcTest, SvcParallelSpatialLayers) {
+ RunSvcParallelSpatialLayers();
+}
+
TEST_P(RcInterfaceSvcTest, SvcPeriodicKey) { RunSvcPeriodicKey(); }
TEST_P(RcInterfaceSvcTest, SvcDynamicSpatial) { RunSvcDynamicSpatial(); }
VP9_INSTANTIATE_TEST_SUITE(RcInterfaceTest, ::testing::Values(0, 3),
::testing::Values(VPX_CBR, VPX_VBR));
-VP9_INSTANTIATE_TEST_SUITE(RcInterfaceSvcTest, ::testing::Values(0, 3));
+VP9_INSTANTIATE_TEST_SUITE(RcInterfaceSvcTest, ::testing::Values(0, 3),
+ ::testing::Values(true, false));
} // namespace
diff --git a/test/vp9_roi_test.cc b/test/vp9_roi_test.cc
index e8373c4c0..a9347fb36 100644
--- a/test/vp9_roi_test.cc
+++ b/test/vp9_roi_test.cc
@@ -84,9 +84,9 @@ class RoiMaskBackgroundSkip : public ::libvpx_test::EncoderTest,
public ::testing::Test {
protected:
RoiMaskBackgroundSkip() : EncoderTest(&::libvpx_test::kVP9) {}
- virtual ~RoiMaskBackgroundSkip() { free(roi_.roi_map); }
+ ~RoiMaskBackgroundSkip() override { free(roi_.roi_map); }
- virtual void SetUp() {
+ void SetUp() override {
InitializeConfig();
SetMode(::libvpx_test::kRealTime);
SetRoi();
@@ -114,8 +114,8 @@ class RoiMaskBackgroundSkip : public ::libvpx_test::EncoderTest,
}
}
- virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) {
+ void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
+ ::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
encoder->Control(VP8E_SET_CPUUSED, 7);
encoder->Control(VP9E_SET_AQ_MODE, 3);
diff --git a/test/vp9_scale_test.cc b/test/vp9_scale_test.cc
index 2d1203fb8..049a10a61 100644
--- a/test/vp9_scale_test.cc
+++ b/test/vp9_scale_test.cc
@@ -33,10 +33,10 @@ typedef void (*ScaleFrameFunc)(const YV12_BUFFER_CONFIG *src,
class ScaleTest : public VpxScaleBase,
public ::testing::TestWithParam<ScaleFrameFunc> {
public:
- virtual ~ScaleTest() {}
+ ~ScaleTest() override = default;
protected:
- virtual void SetUp() { scale_fn_ = GetParam(); }
+ void SetUp() override { scale_fn_ = GetParam(); }
void ReferenceScaleFrame(INTERP_FILTER filter_type, int phase_scaler) {
vp9_scale_and_extend_frame_c(&img_, &ref_img_, filter_type, phase_scaler);
diff --git a/test/vp9_subtract_test.cc b/test/vp9_subtract_test.cc
index a57082f1e..78deb5190 100644
--- a/test/vp9_subtract_test.cc
+++ b/test/vp9_subtract_test.cc
@@ -34,10 +34,10 @@ namespace vp9 {
class VP9SubtractBlockTest : public AbstractBench,
public ::testing::TestWithParam<SubtractFunc> {
public:
- virtual void TearDown() { libvpx_test::ClearSystemState(); }
+ void TearDown() override { libvpx_test::ClearSystemState(); }
protected:
- virtual void Run() {
+ void Run() override {
GetParam()(block_height_, block_width_, diff_, block_width_, src_,
block_width_, pred_, block_width_);
}
@@ -176,7 +176,7 @@ using Params = std::tuple<BLOCK_SIZE, int, HBDSubtractFunc, HBDSubtractFunc>;
class VPXHBDSubtractBlockTest : public ::testing::TestWithParam<Params> {
public:
- virtual void SetUp() {
+ void SetUp() override {
block_width_ = 4 * num_4x4_blocks_wide_lookup[GET_PARAM(0)];
block_height_ = 4 * num_4x4_blocks_high_lookup[GET_PARAM(0)];
bit_depth_ = static_cast<vpx_bit_depth_t>(GET_PARAM(1));
@@ -198,7 +198,7 @@ class VPXHBDSubtractBlockTest : public ::testing::TestWithParam<Params> {
ASSERT_NE(diff_, nullptr);
}
- virtual void TearDown() {
+ void TearDown() override {
vpx_free(CONVERT_TO_SHORTPTR(src_));
vpx_free(CONVERT_TO_SHORTPTR(pred_));
vpx_free(diff_);
diff --git a/test/vp9_thread_test.cc b/test/vp9_thread_test.cc
index 1ceef8185..c0cea681d 100644
--- a/test/vp9_thread_test.cc
+++ b/test/vp9_thread_test.cc
@@ -26,10 +26,10 @@ using std::string;
class VPxWorkerThreadTest : public ::testing::TestWithParam<bool> {
protected:
- virtual ~VPxWorkerThreadTest() {}
- virtual void SetUp() { vpx_get_worker_interface()->init(&worker_); }
+ ~VPxWorkerThreadTest() override = default;
+ void SetUp() override { vpx_get_worker_interface()->init(&worker_); }
- virtual void TearDown() { vpx_get_worker_interface()->end(&worker_); }
+ void TearDown() override { vpx_get_worker_interface()->end(&worker_); }
void Run(VPxWorker *worker) {
const bool synchronous = GetParam();
diff --git a/test/vpx_scale_test.cc b/test/vpx_scale_test.cc
index 7eea437fc..3897a6088 100644
--- a/test/vpx_scale_test.cc
+++ b/test/vpx_scale_test.cc
@@ -38,10 +38,10 @@ class ExtendBorderTest
: public VpxScaleBase,
public ::testing::TestWithParam<ExtendFrameBorderFunc> {
public:
- virtual ~ExtendBorderTest() {}
+ ~ExtendBorderTest() override = default;
protected:
- virtual void SetUp() { extend_fn_ = GetParam(); }
+ void SetUp() override { extend_fn_ = GetParam(); }
void ExtendBorder() { ASM_REGISTER_STATE_CHECK(extend_fn_(&img_)); }
@@ -68,10 +68,10 @@ INSTANTIATE_TEST_SUITE_P(C, ExtendBorderTest,
class CopyFrameTest : public VpxScaleBase,
public ::testing::TestWithParam<CopyFrameFunc> {
public:
- virtual ~CopyFrameTest() {}
+ ~CopyFrameTest() override = default;
protected:
- virtual void SetUp() { copy_frame_fn_ = GetParam(); }
+ void SetUp() override { copy_frame_fn_ = GetParam(); }
void CopyFrame() {
ASM_REGISTER_STATE_CHECK(copy_frame_fn_(&img_, &dst_img_));
diff --git a/test/webm_video_source.h b/test/webm_video_source.h
index d24592629..6ab50c849 100644
--- a/test/webm_video_source.h
+++ b/test/webm_video_source.h
@@ -29,16 +29,16 @@ class WebMVideoSource : public CompressedVideoSource {
webm_ctx_(new WebmInputContext()), buf_(nullptr), buf_sz_(0), frame_(0),
end_of_file_(false) {}
- virtual ~WebMVideoSource() {
+ ~WebMVideoSource() override {
if (vpx_ctx_->file != nullptr) fclose(vpx_ctx_->file);
webm_free(webm_ctx_);
delete vpx_ctx_;
delete webm_ctx_;
}
- virtual void Init() {}
+ void Init() override {}
- virtual void Begin() {
+ void Begin() override {
vpx_ctx_->file = OpenTestDataFile(file_name_);
ASSERT_NE(vpx_ctx_->file, nullptr)
<< "Input file open failed. Filename: " << file_name_;
@@ -48,7 +48,7 @@ class WebMVideoSource : public CompressedVideoSource {
FillFrame();
}
- virtual void Next() {
+ void Next() override {
++frame_;
FillFrame();
}
@@ -74,11 +74,11 @@ class WebMVideoSource : public CompressedVideoSource {
} while (!webm_ctx_->is_key_frame && !end_of_file_);
}
- virtual const uint8_t *cxdata() const {
+ const uint8_t *cxdata() const override {
return end_of_file_ ? nullptr : buf_;
}
- virtual size_t frame_size() const { return buf_sz_; }
- virtual unsigned int frame_number() const { return frame_; }
+ size_t frame_size() const override { return buf_sz_; }
+ unsigned int frame_number() const override { return frame_; }
protected:
std::string file_name_;
diff --git a/test/y4m_test.cc b/test/y4m_test.cc
index 32f2cd51d..78a944fd0 100644
--- a/test/y4m_test.cc
+++ b/test/y4m_test.cc
@@ -78,7 +78,7 @@ class Y4mVideoSourceTest : public ::testing::TestWithParam<Y4mTestParam>,
protected:
Y4mVideoSourceTest() : Y4mVideoSource("", 0, 0) {}
- virtual ~Y4mVideoSourceTest() { CloseSource(); }
+ ~Y4mVideoSourceTest() override { CloseSource(); }
virtual void Init(const std::string &file_name, int limit) {
file_name_ = file_name;
@@ -140,7 +140,7 @@ class Y4mVideoWriteTest : public Y4mVideoSourceTest {
protected:
Y4mVideoWriteTest() : tmpfile_(nullptr) {}
- virtual ~Y4mVideoWriteTest() {
+ ~Y4mVideoWriteTest() override {
delete tmpfile_;
input_file_ = nullptr;
}
@@ -172,7 +172,7 @@ class Y4mVideoWriteTest : public Y4mVideoSourceTest {
ReplaceInputFile(tmpfile_->file());
}
- virtual void Init(const std::string &file_name, int limit) {
+ void Init(const std::string &file_name, int limit) override {
Y4mVideoSourceTest::Init(file_name, limit);
WriteY4mAndReadBack();
}
diff --git a/test/y4m_video_source.h b/test/y4m_video_source.h
index 71fbf3193..e43e37d9e 100644
--- a/test/y4m_video_source.h
+++ b/test/y4m_video_source.h
@@ -27,7 +27,7 @@ class Y4mVideoSource : public VideoSource {
start_(start), limit_(limit), frame_(0), framerate_numerator_(0),
framerate_denominator_(0), y4m_() {}
- virtual ~Y4mVideoSource() {
+ ~Y4mVideoSource() override {
vpx_img_free(img_.get());
CloseSource();
}
@@ -51,33 +51,33 @@ class Y4mVideoSource : public VideoSource {
FillFrame();
}
- virtual void Begin() {
+ void Begin() override {
OpenSource();
ReadSourceToStart();
}
- virtual void Next() {
+ void Next() override {
++frame_;
FillFrame();
}
- virtual vpx_image_t *img() const {
+ vpx_image_t *img() const override {
return (frame_ < limit_) ? img_.get() : nullptr;
}
// Models a stream where Timebase = 1/FPS, so pts == frame.
- virtual vpx_codec_pts_t pts() const { return frame_; }
+ vpx_codec_pts_t pts() const override { return frame_; }
- virtual unsigned long duration() const { return 1; }
+ unsigned long duration() const override { return 1; }
- virtual vpx_rational_t timebase() const {
+ vpx_rational_t timebase() const override {
const vpx_rational_t t = { framerate_denominator_, framerate_numerator_ };
return t;
}
- virtual unsigned int frame() const { return frame_; }
+ unsigned int frame() const override { return frame_; }
- virtual unsigned int limit() const { return limit_; }
+ unsigned int limit() const override { return limit_; }
virtual void FillFrame() {
ASSERT_NE(input_file_, nullptr);
diff --git a/test/yuv_temporal_filter_test.cc b/test/yuv_temporal_filter_test.cc
index 2bdcf4d86..0677d5568 100644
--- a/test/yuv_temporal_filter_test.cc
+++ b/test/yuv_temporal_filter_test.cc
@@ -290,7 +290,7 @@ void ApplyReferenceFilter(
class YUVTemporalFilterTest
: public ::testing::TestWithParam<TemporalFilterWithBd> {
public:
- virtual void SetUp() {
+ void SetUp() override {
filter_func_ = GetParam().temporal_filter;
bd_ = GetParam().bd;
use_highbd_ = (bd_ != 8);
@@ -694,6 +694,18 @@ INSTANTIATE_TEST_SUITE_P(
TemporalFilterWithBd(&wrap_vp9_highbd_apply_temporal_filter_sse4_1_12,
12)));
#endif // HAVE_SSE4_1
+#if HAVE_NEON
+WRAP_HIGHBD_FUNC(vp9_highbd_apply_temporal_filter_neon, 10)
+WRAP_HIGHBD_FUNC(vp9_highbd_apply_temporal_filter_neon, 12)
+
+INSTANTIATE_TEST_SUITE_P(
+ NEON, YUVTemporalFilterTest,
+ ::testing::Values(
+ TemporalFilterWithBd(&wrap_vp9_highbd_apply_temporal_filter_neon_10,
+ 10),
+ TemporalFilterWithBd(&wrap_vp9_highbd_apply_temporal_filter_neon_12,
+ 12)));
+#endif // HAVE_NEON
#else
INSTANTIATE_TEST_SUITE_P(
C, YUVTemporalFilterTest,
@@ -704,5 +716,11 @@ INSTANTIATE_TEST_SUITE_P(SSE4_1, YUVTemporalFilterTest,
::testing::Values(TemporalFilterWithBd(
&vp9_apply_temporal_filter_sse4_1, 8)));
#endif // HAVE_SSE4_1
+#if HAVE_NEON
+INSTANTIATE_TEST_SUITE_P(NEON, YUVTemporalFilterTest,
+ ::testing::Values(TemporalFilterWithBd(
+ &vp9_apply_temporal_filter_neon, 8)));
+#endif // HAVE_NEON
#endif // CONFIG_VP9_HIGHBITDEPTH
+
} // namespace
diff --git a/test/yuv_video_source.h b/test/yuv_video_source.h
index 51948c0ef..bb5eec5bb 100644
--- a/test/yuv_video_source.h
+++ b/test/yuv_video_source.h
@@ -35,12 +35,12 @@ class YUVVideoSource : public VideoSource {
SetSize(width, height, format);
}
- virtual ~YUVVideoSource() {
+ ~YUVVideoSource() override {
vpx_img_free(img_);
if (input_file_) fclose(input_file_);
}
- virtual void Begin() {
+ void Begin() override {
if (input_file_) fclose(input_file_);
input_file_ = OpenTestDataFile(file_name_);
ASSERT_NE(input_file_, nullptr)
@@ -53,28 +53,28 @@ class YUVVideoSource : public VideoSource {
FillFrame();
}
- virtual void Next() {
+ void Next() override {
++frame_;
FillFrame();
}
- virtual vpx_image_t *img() const {
+ vpx_image_t *img() const override {
return (frame_ < limit_) ? img_ : nullptr;
}
// Models a stream where Timebase = 1/FPS, so pts == frame.
- virtual vpx_codec_pts_t pts() const { return frame_; }
+ vpx_codec_pts_t pts() const override { return frame_; }
- virtual unsigned long duration() const { return 1; }
+ unsigned long duration() const override { return 1; }
- virtual vpx_rational_t timebase() const {
+ vpx_rational_t timebase() const override {
const vpx_rational_t t = { framerate_denominator_, framerate_numerator_ };
return t;
}
- virtual unsigned int frame() const { return frame_; }
+ unsigned int frame() const override { return frame_; }
- virtual unsigned int limit() const { return limit_; }
+ unsigned int limit() const override { return limit_; }
virtual void SetSize(unsigned int width, unsigned int height,
vpx_img_fmt format) {