/* * Copyright (c) 2014 The WebM project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
void EndPassHook() override { // For first pass stats test, only run first pass encoder. if (first_pass_only_ && cfg_.g_pass == VPX_RC_FIRST_PASS)
abort_ |= first_pass_only_;
}
bool encoder_initialized_; int tiles_;
::libvpx_test::TestMode encoding_mode_; int set_cpu_used_; int row_mt_mode_; bool first_pass_only_;
vpx_fixed_buf_t firstpass_stats_;
};
#if !CONFIG_REALTIME_ONLY staticvoid compare_fp_stats(vpx_fixed_buf_t *fp_stats, double factor) { // fp_stats consists of 2 set of first pass encoding stats. These 2 set of // stats are compared to check if the stats match or at least are very close.
FIRSTPASS_STATS *stats1 = reinterpret_cast<FIRSTPASS_STATS *>(fp_stats->buf); int nframes_ = (int)(fp_stats->sz / sizeof(FIRSTPASS_STATS));
FIRSTPASS_STATS *stats2 = stats1 + nframes_ / 2; int i, j;
// The total stats are also output and included in the first pass stats. Here // ignore that in the comparison. for (i = 0; i < (nframes_ / 2 - 1); ++i) { constdouble *frame_stats1 = reinterpret_cast<double *>(stats1); constdouble *frame_stats2 = reinterpret_cast<double *>(stats2);
staticvoid compare_fp_stats_md5(vpx_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;
::libvpx_test::MD5 md5_row_mt_0, md5_row_mt_1;
// Compare to check if single-thread and multi-thread stats are close enough.
ASSERT_NO_FATAL_FAILURE(compare_fp_stats(&firstpass_stats_, 400.0));
// Bit exact test in row_mt mode. // When row_mt_mode_=1 and using >1 threads, the encoder generates bit exact // result.
row_mt_mode_ = 1;
tiles_ = 2;
bool encoder_initialized_; int tiles_; int threads_;
::libvpx_test::TestMode encoding_mode_; int set_cpu_used_; int row_mt_mode_; double psnr_; unsignedint nframes_;
std::vector<std::string> md5_;
};
// Compare to check if two vectors are equal.
ASSERT_EQ(single_thr_md5, multi_thr_md5);
// Part 2: row_mt_mode_ = 0 vs row_mt_mode_ = 1 single thread bit exact test.
row_mt_mode_ = 1;
// Encode using single thread
cfg_.g_threads = 1;
init_flags_ = VPX_CODEC_USE_PSNR;
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
std::vector<std::string> row_mt_single_thr_md5 = md5_;
md5_.clear();
ASSERT_EQ(single_thr_md5, row_mt_single_thr_md5);
// Part 3: Bit exact test with row-mt on // When row_mt_mode_=1 and using >1 threads, the encoder generates bit exact // result.
row_mt_mode_ = 1;
row_mt_single_thr_md5.clear();
// Split this into multiple instantiations so that we can distinguish // between very slow runs ( i.e., cpu_speed 0 ) vs ones that can be // run nightly by adding Large to the title.
INSTANTIATE_TEST_SUITE_P(
VP9, VPxEncoderThreadTest,
::testing::Combine(
::testing::Values( static_cast<const libvpx_test::CodecFactory *>(&libvpx_test::kVP9)),
::testing::ValuesIn(kOnePassTestModes),
::testing::Range(3, 10), // cpu_used
::testing::Range(0, 3), // tile_columns
::testing::Range(2, 5))); // threads
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.