#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 "test/md5_helper.h"
+#include "test/util.h"
+#include "test/y4m_video_source.h"
namespace {
-class VP9EncoderThreadTest
+class VPxEncoderThreadTest
: public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
protected:
- VP9EncoderThreadTest()
+ VPxEncoderThreadTest()
: EncoderTest(GET_PARAM(0)),
+ encoder_initialized_(false),
tiles_(2),
encoding_mode_(GET_PARAM(1)),
set_cpu_used_(GET_PARAM(2)) {
md5_.clear();
}
- virtual ~VP9EncoderThreadTest() {
+ virtual ~VPxEncoderThreadTest() {
delete decoder_;
}
cfg_.rc_min_quantizer = 0;
}
+ virtual void BeginPassHook(unsigned int /*pass*/) {
+ encoder_initialized_ = false;
+ }
+
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
::libvpx_test::Encoder *encoder) {
- if (video->frame() == 0) {
+ if (!encoder_initialized_) {
// Encode 4 column tiles.
encoder->Control(VP9E_SET_TILE_COLUMNS, tiles_);
encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
encoder->Control(VP8E_SET_ARNR_TYPE, 3);
} else {
encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 0);
+ encoder->Control(VP9E_SET_AQ_MODE, 3);
}
+ encoder_initialized_ = true;
}
}
}
}
+ bool encoder_initialized_;
int tiles_;
::libvpx_test::TestMode encoding_mode_;
int set_cpu_used_;
std::vector<std::string> md5_;
};
-TEST_P(VP9EncoderThreadTest, EncoderResultTest) {
+TEST_P(VPxEncoderThreadTest, EncoderResultTest) {
std::vector<std::string> single_thr_md5, multi_thr_md5;
- ::libvpx_test::I420VideoSource video("niklas_1280_720_30.yuv", 1280, 720,
- 50, 1, 15, 20);
+ ::libvpx_test::Y4mVideoSource video("niklas_1280_720_30.y4m", 15, 20);
cfg_.rc_target_bitrate = 1000;
}
VP9_INSTANTIATE_TEST_CASE(
- VP9EncoderThreadTest,
+ VPxEncoderThreadTest,
::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood,
::libvpx_test::kRealTime),
::testing::Range(1, 9));
+
+VP10_INSTANTIATE_TEST_CASE(
+ VPxEncoderThreadTest,
+ ::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood),
+ ::testing::Range(1, 3));
} // namespace