Enhance the end to end psnr tests

Includes more speed settings and also real-time mode now.

Change-Id: I71c77c4a2471d715c61cc30db092aa053cf012e1
This commit is contained in:
Deb Mukherjee 2014-12-15 11:58:43 -08:00
parent 4ebdb4a1b9
commit b62064f338

View File

@ -22,8 +22,17 @@ const unsigned int kHeight = 90;
const unsigned int kFramerate = 50; const unsigned int kFramerate = 50;
const unsigned int kFrames = 10; const unsigned int kFrames = 10;
const int kBitrate = 500; const int kBitrate = 500;
const int kCpuUsed = 2; // List of psnr thresholds for speed settings 0-7 and 5 encoding modes
const double psnr_threshold = 35.0; const double kPsnrThreshold[][5] = {
{ 36.0, 37.0, 37.0, 37.0, 37.0 },
{ 35.0, 36.0, 36.0, 36.0, 36.0 },
{ 34.0, 35.0, 35.0, 35.0, 35.0 },
{ 33.0, 34.0, 34.0, 34.0, 34.0 },
{ 32.0, 33.0, 33.0, 33.0, 33.0 },
{ 31.0, 32.0, 32.0, 32.0, 32.0 },
{ 30.0, 31.0, 31.0, 31.0, 31.0 },
{ 29.0, 30.0, 30.0, 30.0, 30.0 },
};
typedef struct { typedef struct {
const char *filename; const char *filename;
@ -33,7 +42,7 @@ typedef struct {
unsigned int profile; unsigned int profile;
} TestVideoParam; } TestVideoParam;
const TestVideoParam TestVectors[] = { const TestVideoParam kTestVectors[] = {
{"park_joy_90p_8_420.y4m", 8, VPX_IMG_FMT_I420, VPX_BITS_8, 0}, {"park_joy_90p_8_420.y4m", 8, VPX_IMG_FMT_I420, VPX_BITS_8, 0},
{"park_joy_90p_8_422.y4m", 8, VPX_IMG_FMT_I422, VPX_BITS_8, 1}, {"park_joy_90p_8_422.y4m", 8, VPX_IMG_FMT_I422, VPX_BITS_8, 1},
{"park_joy_90p_8_444.y4m", 8, VPX_IMG_FMT_I444, VPX_BITS_8, 1}, {"park_joy_90p_8_444.y4m", 8, VPX_IMG_FMT_I444, VPX_BITS_8, 1},
@ -50,6 +59,16 @@ const TestVideoParam TestVectors[] = {
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
}; };
// Encoding modes tested
const libvpx_test::TestMode kEncodingModeVectors[] = {
::libvpx_test::kTwoPassGood,
::libvpx_test::kOnePassGood,
::libvpx_test::kRealTime,
};
// Speed settings tested
const int kCpuUsedVectors[] = {1, 2, 3, 5, 6};
int is_extension_y4m(const char *filename) { int is_extension_y4m(const char *filename) {
const char *dot = strrchr(filename, '.'); const char *dot = strrchr(filename, '.');
if (!dot || dot == filename) if (!dot || dot == filename)
@ -60,11 +79,13 @@ int is_extension_y4m(const char *filename) {
class EndToEndTestLarge class EndToEndTestLarge
: public ::libvpx_test::EncoderTest, : public ::libvpx_test::EncoderTest,
public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, \ public ::libvpx_test::CodecTestWith3Params<libvpx_test::TestMode, \
TestVideoParam> { TestVideoParam, int> {
protected: protected:
EndToEndTestLarge() EndToEndTestLarge()
: EncoderTest(GET_PARAM(0)), : EncoderTest(GET_PARAM(0)),
test_video_param_(GET_PARAM(2)),
cpu_used_(GET_PARAM(3)),
psnr_(0.0), psnr_(0.0),
nframes_(0), nframes_(0),
encoding_mode_(GET_PARAM(1)) { encoding_mode_(GET_PARAM(1)) {
@ -81,9 +102,11 @@ class EndToEndTestLarge
} else { } else {
cfg_.g_lag_in_frames = 0; cfg_.g_lag_in_frames = 0;
cfg_.rc_end_usage = VPX_CBR; cfg_.rc_end_usage = VPX_CBR;
cfg_.rc_buf_sz = 1000;
cfg_.rc_buf_initial_sz = 500;
cfg_.rc_buf_optimal_sz = 600;
} }
dec_cfg_.threads = 4; dec_cfg_.threads = 4;
test_video_param_ = GET_PARAM(2);
} }
virtual void BeginPassHook(unsigned int) { virtual void BeginPassHook(unsigned int) {
@ -101,7 +124,7 @@ class EndToEndTestLarge
if (video->frame() == 1) { if (video->frame() == 1) {
encoder->Control(VP9E_SET_FRAME_PARALLEL_DECODING, 1); encoder->Control(VP9E_SET_FRAME_PARALLEL_DECODING, 1);
encoder->Control(VP9E_SET_TILE_COLUMNS, 4); encoder->Control(VP9E_SET_TILE_COLUMNS, 4);
encoder->Control(VP8E_SET_CPUUSED, kCpuUsed); encoder->Control(VP8E_SET_CPUUSED, cpu_used_);
if (encoding_mode_ != ::libvpx_test::kRealTime) { if (encoding_mode_ != ::libvpx_test::kRealTime) {
encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1); encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
encoder->Control(VP8E_SET_ARNR_MAXFRAMES, 7); encoder->Control(VP8E_SET_ARNR_MAXFRAMES, 7);
@ -117,7 +140,12 @@ class EndToEndTestLarge
return 0.0; return 0.0;
} }
double GetPsnrThreshold() {
return kPsnrThreshold[cpu_used_][encoding_mode_];
}
TestVideoParam test_video_param_; TestVideoParam test_video_param_;
int cpu_used_;
private: private:
double psnr_; double psnr_;
@ -132,6 +160,8 @@ TEST_P(EndToEndTestLarge, EndtoEndPSNRTest) {
cfg_.g_input_bit_depth = test_video_param_.input_bit_depth; cfg_.g_input_bit_depth = test_video_param_.input_bit_depth;
cfg_.g_bit_depth = test_video_param_.bit_depth; cfg_.g_bit_depth = test_video_param_.bit_depth;
init_flags_ = VPX_CODEC_USE_PSNR; init_flags_ = VPX_CODEC_USE_PSNR;
if (cfg_.g_bit_depth > 8)
init_flags_ |= VPX_CODEC_USE_HIGHBITDEPTH;
libvpx_test::VideoSource *video; libvpx_test::VideoSource *video;
if (is_extension_y4m(test_video_param_.filename)) { if (is_extension_y4m(test_video_param_.filename)) {
@ -146,13 +176,14 @@ TEST_P(EndToEndTestLarge, EndtoEndPSNRTest) {
ASSERT_NO_FATAL_FAILURE(RunLoop(video)); ASSERT_NO_FATAL_FAILURE(RunLoop(video));
const double psnr = GetAveragePsnr(); const double psnr = GetAveragePsnr();
EXPECT_GT(psnr, psnr_threshold); EXPECT_GT(psnr, GetPsnrThreshold());
delete(video); delete(video);
} }
VP9_INSTANTIATE_TEST_CASE( VP9_INSTANTIATE_TEST_CASE(
EndToEndTestLarge, EndToEndTestLarge,
::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood), ::testing::ValuesIn(kEncodingModeVectors),
::testing::ValuesIn(TestVectors)); ::testing::ValuesIn(kTestVectors),
::testing::ValuesIn(kCpuUsedVectors));
} // namespace } // namespace