Add unit tests to validate multi-threading in allintra mode
Added unit tests AVxEncoderThreadAllIntraTest and
AVxEncoderThreadAllIntraTestLarge to validate the
correctness of multi-thread encoding mode for different
speed presets.
BUG=aomedia:2959
Change-Id: I01950db74cceb389a08c7930847572c55a908f75
diff --git a/test/ethread_test.cc b/test/ethread_test.cc
index dc9cb5c..96e2dfe 100644
--- a/test/ethread_test.cc
+++ b/test/ethread_test.cc
@@ -21,6 +21,8 @@
#include "av1/encoder/firstpass.h"
namespace {
+const unsigned int kCqLevel = 18;
+
#if !CONFIG_REALTIME_ONLY
const size_t kFirstPassStatsSz = sizeof(FIRSTPASS_STATS);
class AVxFirstPassEncoderThreadTest
@@ -229,11 +231,12 @@
virtual void SetUp() {
InitializeConfig(encoding_mode_);
- if (encoding_mode_ != ::libaom_test::kRealTime) {
+ if (encoding_mode_ == ::libaom_test::kOnePassGood ||
+ encoding_mode_ == ::libaom_test::kTwoPassGood) {
cfg_.g_lag_in_frames = 6;
cfg_.rc_2pass_vbr_minsection_pct = 5;
cfg_.rc_2pass_vbr_maxsection_pct = 2000;
- } else {
+ } else if (encoding_mode_ == ::libaom_test::kRealTime) {
cfg_.g_error_resilient = 1;
}
cfg_.rc_max_quantizer = 56;
@@ -250,18 +253,21 @@
SetTileSize(encoder);
encoder->Control(AOME_SET_CPUUSED, set_cpu_used_);
encoder->Control(AV1E_SET_ROW_MT, row_mt_);
- if (encoding_mode_ != ::libaom_test::kRealTime) {
+ if (encoding_mode_ == ::libaom_test::kOnePassGood ||
+ encoding_mode_ == ::libaom_test::kTwoPassGood) {
encoder->Control(AOME_SET_ENABLEAUTOALTREF, 1);
encoder->Control(AOME_SET_ARNR_MAXFRAMES, 5);
encoder->Control(AOME_SET_ARNR_STRENGTH, 5);
encoder->Control(AV1E_SET_FRAME_PARALLEL_DECODING, 0);
encoder->Control(AV1E_SET_MAX_GF_INTERVAL, 4);
- } else {
+ } else if (encoding_mode_ == ::libaom_test::kRealTime) {
encoder->Control(AOME_SET_ENABLEAUTOALTREF, 0);
encoder->Control(AV1E_SET_AQ_MODE, 3);
encoder->Control(AV1E_SET_COEFF_COST_UPD_FREQ, 2);
encoder->Control(AV1E_SET_MODE_COST_UPD_FREQ, 2);
encoder->Control(AV1E_SET_MV_COST_UPD_FREQ, 3);
+ } else {
+ encoder->Control(AOME_SET_CQ_LEVEL, kCqLevel);
}
encoder_initialized_ = true;
}
@@ -462,6 +468,22 @@
DoTest();
}
+class AVxEncoderThreadAllIntraTest : public AVxEncoderThreadTest {};
+
+TEST_P(AVxEncoderThreadAllIntraTest, EncoderResultTest) {
+ cfg_.large_scale_tile = 0;
+ decoder_->Control(AV1_SET_TILE_MODE, 0);
+ DoTest();
+}
+
+class AVxEncoderThreadAllIntraTestLarge : public AVxEncoderThreadTest {};
+
+TEST_P(AVxEncoderThreadAllIntraTestLarge, EncoderResultTest) {
+ cfg_.large_scale_tile = 0;
+ decoder_->Control(AV1_SET_TILE_MODE, 0);
+ DoTest();
+}
+
// first pass stats test
AV1_INSTANTIATE_TEST_SUITE(AVxFirstPassEncoderThreadTest,
::testing::Values(::libaom_test::kTwoPassGood),
@@ -475,6 +497,13 @@
::testing::Values(2), ::testing::Values(0, 2),
::testing::Values(0, 2), ::testing::Values(0, 1));
+// For all intra mode, test speed 0, 2, 4, 6, 8.
+// Only test cpu_used 6 here.
+AV1_INSTANTIATE_TEST_SUITE(AVxEncoderThreadAllIntraTest,
+ ::testing::Values(::libaom_test::kAllIntra),
+ ::testing::Values(6), ::testing::Values(0, 2),
+ ::testing::Values(0, 2), ::testing::Values(0, 1));
+
// Test cpu_used 0, 1, 3 and 5.
AV1_INSTANTIATE_TEST_SUITE(AVxEncoderThreadTestLarge,
::testing::Values(::libaom_test::kTwoPassGood,
@@ -489,6 +518,13 @@
::testing::Values(0, 2, 4, 6),
::testing::Values(1, 6), ::testing::Values(1, 6),
::testing::Values(0, 1));
+
+// Test cpu_used 0, 2, 4 and 8.
+AV1_INSTANTIATE_TEST_SUITE(AVxEncoderThreadAllIntraTestLarge,
+ ::testing::Values(::libaom_test::kAllIntra),
+ ::testing::Values(0, 2, 4, 8),
+ ::testing::Values(1, 6), ::testing::Values(1, 6),
+ ::testing::Values(0, 1));
#endif
class AVxEncoderThreadLSTest : public AVxEncoderThreadTest {