/* * Copyright (c) 2016, Alliance for Open Media. All rights reserved. * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License * was not distributed with this source code in the LICENSE file, you can * obtain it at www.aomedia.org/license/software. If the Alliance for Open * Media Patent License 1.0 was not distributed with this source code in the * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
bool encoder_initialized_;
::libaom_test::TestMode encoding_mode_; int set_cpu_used_; int tile_rows_; int tile_cols_; int row_mt_;
aom_fixed_buf_t firstpass_stats_;
};
staticvoid compare_fp_stats_md5(aom_fixed_buf_t *fp_stats) { // fp_stats consists of 2 set of first pass encoding stats. These 2 set of // stats are compared to check if the stats match.
uint8_t *stats1 = reinterpret_cast<uint8_t *>(fp_stats->buf);
uint8_t *stats2 = stats1 + fp_stats->sz / 2;
::libaom_test::MD5 md5_row_mt_0, md5_row_mt_1;
// 5 encodes will be run: // 1. row_mt_=0 and threads=1 // 2. row_mt_=1 and threads=1 // 3. row_mt_=1 and threads=2 // 4. row_mt_=1 and threads=4 // 5. row_mt_=1 and threads=8
// 4 comparisons will be made: // 1. Between run 1 and run 2. // 2. Between run 2 and run 3. // 3. Between run 3 and run 4. // 4. Between run 4 and run 5.
// Test row_mt_: 0 vs 1 at single thread case(threads = 1)
cfg_.g_threads = 1;
// Compare to check if using or not using row-mt are bit exact. // Comparison 1 (between row_mt_=0 and row_mt_=1).
ASSERT_NO_FATAL_FAILURE(compare_fp_stats_md5(&firstpass_stats));
// Test single thread vs multiple threads
row_mt_ = 1;
// offset to the 2nd and 3rd run.
firstpass_stats.buf = reinterpret_cast<void *>( reinterpret_cast<uint8_t *>(firstpass_stats_.buf) + single_run_sz);
// Compare to check if single-thread and multi-thread stats are bit exact. // Comparison 2 (between threads=1 and threads=2).
ASSERT_NO_FATAL_FAILURE(compare_fp_stats_md5(&firstpass_stats));
// offset to the 3rd and 4th run
firstpass_stats.buf = reinterpret_cast<void *>( reinterpret_cast<uint8_t *>(firstpass_stats_.buf) + single_run_sz * 2);
// Comparison 3 (between threads=2 and threads=4).
ASSERT_NO_FATAL_FAILURE(compare_fp_stats_md5(&firstpass_stats));
void PreEncodeFrameHook(::libaom_test::VideoSource * /*video*/,
::libaom_test::Encoder *encoder) override { if (!encoder_initialized_) {
SetTileSize(encoder);
encoder->Control(AOME_SET_CPUUSED, set_cpu_used_);
encoder->Control(AV1E_SET_ROW_MT, row_mt_); 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); // In row_mt_=0 case, the output of single thread (1 thread) will be // compared with multi thread (4 thread) output (as per line no:340). // Currently, Loop restoration stage is conditionally disabled for speed // 5, 6 when num_workers > 1. Due to this, the match between single // thread and multi thread output can not be achieved. Hence, testing // this case alone with LR disabled. // TODO(aomedia:3446): Remove the constraint on this test case once Loop // restoration state is same in both single and multi thread path. if (set_cpu_used_ >= 5 && row_mt_ == 0)
encoder->Control(AV1E_SET_ENABLE_RESTORATION, 0);
} elseif (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);
encoder->Control(AV1E_SET_DV_COST_UPD_FREQ, 3);
} else {
encoder->Control(AOME_SET_CQ_LEVEL, kCqLevel);
}
encoder_initialized_ = true;
}
}
// Check that the vectors are equal.
ASSERT_EQ(single_thr_size_enc, multi_thr_size_enc);
ASSERT_EQ(single_thr_md5_enc, multi_thr_md5_enc);
ASSERT_EQ(single_thr_md5_dec, multi_thr_md5_dec);
// Disable threads=3 test for now to reduce the time so that the nightly // test would not time out. // cfg_.g_threads = 3; // ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); // std::vector<size_t> multi_thr3_row_mt_size_enc; // std::vector<std::string> multi_thr3_row_mt_md5_enc; // std::vector<std::string> multi_thr3_row_mt_md5_dec; // multi_thr3_row_mt_size_enc = size_enc_; // multi_thr3_row_mt_md5_enc = md5_enc_; // multi_thr3_row_mt_md5_dec = md5_dec_; // size_enc_.clear(); // md5_enc_.clear(); // md5_dec_.clear(); // Check that the vectors are equal. // ASSERT_EQ(multi_thr3_row_mt_size_enc, multi_thr2_row_mt_size_enc); // ASSERT_EQ(multi_thr3_row_mt_md5_enc, multi_thr2_row_mt_md5_enc); // ASSERT_EQ(multi_thr3_row_mt_md5_dec, multi_thr2_row_mt_md5_dec);
// Check that the vectors are equal.
ASSERT_EQ(multi_thr4_row_mt_size_enc, multi_thr2_row_mt_size_enc);
ASSERT_EQ(multi_thr4_row_mt_md5_enc, multi_thr2_row_mt_md5_enc);
ASSERT_EQ(multi_thr4_row_mt_md5_dec, multi_thr2_row_mt_md5_dec);
// Check that the vectors are equal.
ASSERT_EQ(ref_size_enc, multi_thr_max_row_mt_size_enc);
ASSERT_EQ(ref_md5_enc, multi_thr_max_row_mt_md5_enc);
ASSERT_EQ(ref_md5_dec, multi_thr_max_row_mt_md5_dec);
}
bool encoder_initialized_;
::libaom_test::TestMode encoding_mode_; int set_cpu_used_; int tile_cols_; int tile_rows_; int row_mt_;
::libaom_test::Decoder *decoder_;
std::vector<size_t> size_enc_;
std::vector<std::string> md5_enc_;
std::vector<std::string> md5_dec_;
};
class AVxEncoderThreadRTTest : public AVxEncoderThreadTest {};
// For real time mode, test speed 5, 6, 7, 8, 9, 10.
AV1_INSTANTIATE_TEST_SUITE(AVxEncoderThreadRTTest,
::testing::Values(::libaom_test::kRealTime),
::testing::Values(5, 6, 7, 8, 9, 10),
::testing::Values(0, 2), ::testing::Values(0, 2),
::testing::Values(0, 1));
#if !CONFIG_REALTIME_ONLY
// The AVxEncoderThreadTestLarge takes up ~14% of total run-time of the // Valgrind long tests. Exclude it; the smaller tests are still run. #if !defined(AOM_VALGRIND_BUILD) class AVxEncoderThreadTestLarge : public AVxEncoderThreadTest {};
// Only test cpu_used 2 here.
AV1_INSTANTIATE_TEST_SUITE(AVxEncoderThreadTest,
::testing::Values(::libaom_test::kTwoPassGood),
::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));
// AVxEncoderThreadLSTestLarge takes up about 2% of total run-time of // the Valgrind long tests. Since we already run AVxEncoderThreadLSTest, // skip this one for Valgrind. #if !CONFIG_REALTIME_ONLY && !defined(AOM_VALGRIND_BUILD) class AVxEncoderThreadLSTestLarge : public AVxEncoderThreadLSTest {};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.