Merge "Split some slower tests based on cpu-used" into nextgenv2

This commit is contained in:
Debargha Mukherjee 2016-06-16 11:46:35 +00:00 коммит произвёл Gerrit Code Review
Родитель 94e84bbc07 6abddf37f8
Коммит f9fc898d56
3 изменённых файлов: 110 добавлений и 60 удалений

Просмотреть файл

@ -65,10 +65,7 @@ class ActiveMapTest
}
}
int cpu_used_;
};
TEST_P(ActiveMapTest, Test) {
void DoTest() {
// Validate that this non multiple of 64 wide clip encodes
cfg_.g_lag_in_frames = 0;
cfg_.rc_target_bitrate = 400;
@ -76,21 +73,33 @@ TEST_P(ActiveMapTest, Test) {
cfg_.g_pass = VPX_RC_ONE_PASS;
cfg_.rc_end_usage = VPX_CBR;
cfg_.kf_max_dist = 90000;
::libvpx_test::I420VideoSource video("hantro_odd.yuv", kWidth, kHeight, 30,
1, 0, 20);
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
}
int cpu_used_;
};
TEST_P(ActiveMapTest, Test) {
DoTest();
}
class ActiveMapTestLarge : public ActiveMapTest {};
TEST_P(ActiveMapTestLarge, Test) {
DoTest();
}
VP9_INSTANTIATE_TEST_CASE(ActiveMapTest,
::testing::Values(::libvpx_test::kRealTime),
::testing::Range(0, 9));
#if CONFIG_VP10
#if CONFIG_SUPERTX
VP10_INSTANTIATE_TEST_CASE(ActiveMapTest,
VP10_INSTANTIATE_TEST_CASE(ActiveMapTestLarge,
::testing::Values(::libvpx_test::kRealTime),
::testing::Range(0, 5));
#if CONFIG_SUPERTX
// SuperTx and ActiveMap don't get along at speed 5.
// https://bugs.chromium.org/p/webm/issues/detail?id=1234
INSTANTIATE_TEST_CASE_P(
@ -102,7 +111,7 @@ INSTANTIATE_TEST_CASE_P(
#else
VP10_INSTANTIATE_TEST_CASE(ActiveMapTest,
::testing::Values(::libvpx_test::kRealTime),
::testing::Range(0, 9));
::testing::Range(5, 9));
#endif // CONFIG_SUPERTX
#endif // CONFIG_VP10
} // namespace

Просмотреть файл

@ -64,9 +64,15 @@ class TileIndependenceTest : public ::libvpx_test::EncoderTest,
if (video->frame() == 1) {
encoder->Control(VP9E_SET_TILE_COLUMNS, n_tile_cols_);
encoder->Control(VP9E_SET_TILE_ROWS, n_tile_rows_);
SetCpuUsed(encoder);
}
}
virtual void SetCpuUsed(libvpx_test::Encoder *encoder) {
static const int kCpuUsed = 3;
encoder->Control(VP8E_SET_CPUUSED, kCpuUsed);
}
void UpdateMD5(::libvpx_test::Decoder *dec, const vpx_codec_cx_pkt_t *pkt,
::libvpx_test::MD5 *md5) {
const vpx_codec_err_t res = dec->DecodeFrame(
@ -84,18 +90,7 @@ class TileIndependenceTest : public ::libvpx_test::EncoderTest,
UpdateMD5(inv_dec_, pkt, &md5_inv_order_);
}
::libvpx_test::MD5 md5_fw_order_, md5_inv_order_;
::libvpx_test::Decoder *fw_dec_, *inv_dec_;
private:
int n_tile_cols_;
int n_tile_rows_;
};
// run an encode with 2 or 4 tiles, and do the decode both in normal and
// inverted tile ordering. Ensure that the MD5 of the output in both cases
// is identical. If so, tiles are considered independent and the test passes.
TEST_P(TileIndependenceTest, MD5Match) {
void DoTest() {
const vpx_rational timebase = { 33333333, 1000000000 };
cfg_.g_timebase = timebase;
cfg_.rc_target_bitrate = 500;
@ -108,21 +103,51 @@ TEST_P(TileIndependenceTest, MD5Match) {
const char *md5_fw_str = md5_fw_order_.Get();
const char *md5_inv_str = md5_inv_order_.Get();
// could use ASSERT_EQ(!memcmp(.., .., 16) here, but this gives nicer
// output if it fails. Not sure if it's helpful since it's really just
// a MD5...
ASSERT_STREQ(md5_fw_str, md5_inv_str);
}
::libvpx_test::MD5 md5_fw_order_, md5_inv_order_;
::libvpx_test::Decoder *fw_dec_, *inv_dec_;
private:
int n_tile_cols_;
int n_tile_rows_;
};
// run an encode with 2 or 4 tiles, and do the decode both in normal and
// inverted tile ordering. Ensure that the MD5 of the output in both cases
// is identical. If so, tiles are considered independent and the test passes.
TEST_P(TileIndependenceTest, MD5Match) {
DoTest();
}
class TileIndependenceTestLarge : public TileIndependenceTest {
virtual void SetCpuUsed(libvpx_test::Encoder *encoder) {
static const int kCpuUsed = 0;
encoder->Control(VP8E_SET_CPUUSED, kCpuUsed);
}
};
TEST_P(TileIndependenceTestLarge, MD5Match) {
DoTest();
}
VP9_INSTANTIATE_TEST_CASE(TileIndependenceTest, ::testing::Values(0, 1),
::testing::Values(0));
VP9_INSTANTIATE_TEST_CASE(TileIndependenceTestLarge, ::testing::Values(0, 1),
::testing::Values(0));
#if CONFIG_EXT_TILE
VP10_INSTANTIATE_TEST_CASE(TileIndependenceTest, ::testing::Values(1, 2, 32),
::testing::Values(1, 2, 32));
VP10_INSTANTIATE_TEST_CASE(TileIndependenceTestLarge,
::testing::Values(1, 2, 32),
::testing::Values(1, 2, 32));
#else
VP10_INSTANTIATE_TEST_CASE(TileIndependenceTest, ::testing::Values(0, 1),
::testing::Values(0, 1));
VP10_INSTANTIATE_TEST_CASE(TileIndependenceTestLarge,
::testing::Values(0, 1),
::testing::Values(0, 1));
#endif // CONFIG_EXT_TILE
} // namespace

Просмотреть файл

@ -125,30 +125,17 @@ class VPxEncoderThreadTest
}
}
bool encoder_initialized_;
::libvpx_test::TestMode encoding_mode_;
int set_cpu_used_;
::libvpx_test::Decoder *decoder_;
std::vector<size_t> size_enc_;
std::vector<std::string> md5_enc_;
std::vector<std::string> md5_dec_;
bool vp10_;
};
TEST_P(VPxEncoderThreadTest, EncoderResultTest) {
std::vector<size_t> single_thr_size_enc, multi_thr_size_enc;
std::vector<std::string> single_thr_md5_enc, multi_thr_md5_enc;
std::vector<std::string> single_thr_md5_dec, multi_thr_md5_dec;
void DoTest() {
::libvpx_test::Y4mVideoSource video("niklas_1280_720_30.y4m", 15, 18);
cfg_.rc_target_bitrate = 1000;
// Encode using single thread.
cfg_.g_threads = 1;
init_flags_ = VPX_CODEC_USE_PSNR;
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
std::vector<size_t> single_thr_size_enc;
std::vector<std::string> single_thr_md5_enc;
std::vector<std::string> single_thr_md5_dec;
single_thr_size_enc = size_enc_;
single_thr_md5_enc = md5_enc_;
single_thr_md5_dec = md5_dec_;
@ -159,6 +146,9 @@ TEST_P(VPxEncoderThreadTest, EncoderResultTest) {
// Encode using multiple threads.
cfg_.g_threads = 4;
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
std::vector<size_t> multi_thr_size_enc;
std::vector<std::string> multi_thr_md5_enc;
std::vector<std::string> multi_thr_md5_dec;
multi_thr_size_enc = size_enc_;
multi_thr_md5_enc = md5_enc_;
multi_thr_md5_dec = md5_dec_;
@ -172,6 +162,27 @@ TEST_P(VPxEncoderThreadTest, EncoderResultTest) {
ASSERT_EQ(single_thr_md5_dec, multi_thr_md5_dec);
}
bool encoder_initialized_;
::libvpx_test::TestMode encoding_mode_;
int set_cpu_used_;
::libvpx_test::Decoder *decoder_;
std::vector<size_t> size_enc_;
std::vector<std::string> md5_enc_;
std::vector<std::string> md5_dec_;
bool vp10_;
};
TEST_P(VPxEncoderThreadTest, EncoderResultTest) {
DoTest();
}
class VPxEncoderThreadTestLarge : public VPxEncoderThreadTest {};
TEST_P(VPxEncoderThreadTestLarge, EncoderResultTest) {
DoTest();
}
VP9_INSTANTIATE_TEST_CASE(
VPxEncoderThreadTest,
::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood,
@ -181,5 +192,10 @@ VP9_INSTANTIATE_TEST_CASE(
VP10_INSTANTIATE_TEST_CASE(
VPxEncoderThreadTest,
::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood),
::testing::Range(1, 9), ::testing::Values(1));
::testing::Range(3, 9), ::testing::Values(1));
VP10_INSTANTIATE_TEST_CASE(
VPxEncoderThreadTestLarge,
::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood),
::testing::Range(1, 3), ::testing::Values(1));
} // namespace