From 68569dee1416593955c1570d638b3d9250b33012 Mon Sep 17 00:00:00 2001 From: trav90 Date: Mon, 15 Oct 2018 21:45:30 -0500 Subject: Import aom library This is the reference implementation for the Alliance for Open Media's av1 video code. The commit used was 4d668d7feb1f8abd809d1bca0418570a7f142a36. --- third_party/aom/test/ethread_test.cc | 188 +++++++++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 third_party/aom/test/ethread_test.cc (limited to 'third_party/aom/test/ethread_test.cc') diff --git a/third_party/aom/test/ethread_test.cc b/third_party/aom/test/ethread_test.cc new file mode 100644 index 000000000..5b519f8fe --- /dev/null +++ b/third_party/aom/test/ethread_test.cc @@ -0,0 +1,188 @@ +/* + * 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. +*/ + +#include +#include +#include "third_party/googletest/src/googletest/include/gtest/gtest.h" +#include "test/codec_factory.h" +#include "test/encode_test_driver.h" +#include "test/md5_helper.h" +#include "test/util.h" +#include "test/y4m_video_source.h" + +namespace { +class AVxEncoderThreadTest + : public ::libaom_test::EncoderTest, + public ::libaom_test::CodecTestWith2Params { + protected: + AVxEncoderThreadTest() + : EncoderTest(GET_PARAM(0)), encoder_initialized_(false), + encoding_mode_(GET_PARAM(1)), set_cpu_used_(GET_PARAM(2)) { + init_flags_ = AOM_CODEC_USE_PSNR; + aom_codec_dec_cfg_t cfg = aom_codec_dec_cfg_t(); + cfg.w = 1280; + cfg.h = 720; + decoder_ = codec_->CreateDecoder(cfg, 0); +#if CONFIG_AV1 && CONFIG_EXT_TILE + if (decoder_->IsAV1()) { + decoder_->Control(AV1_SET_DECODE_TILE_ROW, -1); + decoder_->Control(AV1_SET_DECODE_TILE_COL, -1); + } +#endif + + size_enc_.clear(); + md5_dec_.clear(); + md5_enc_.clear(); + } + virtual ~AVxEncoderThreadTest() { delete decoder_; } + + virtual void SetUp() { + InitializeConfig(); + SetMode(encoding_mode_); + + if (encoding_mode_ != ::libaom_test::kRealTime) { + cfg_.g_lag_in_frames = 3; + cfg_.rc_end_usage = AOM_VBR; + cfg_.rc_2pass_vbr_minsection_pct = 5; + cfg_.rc_2pass_vbr_maxsection_pct = 2000; + } else { + cfg_.g_lag_in_frames = 0; + cfg_.rc_end_usage = AOM_CBR; + cfg_.g_error_resilient = 1; + } + cfg_.rc_max_quantizer = 56; + cfg_.rc_min_quantizer = 0; + } + + virtual void BeginPassHook(unsigned int /*pass*/) { + encoder_initialized_ = false; + } + + virtual void PreEncodeFrameHook(::libaom_test::VideoSource * /*video*/, + ::libaom_test::Encoder *encoder) { + if (!encoder_initialized_) { +#if CONFIG_AV1 && CONFIG_EXT_TILE + encoder->Control(AV1E_SET_TILE_COLUMNS, 1); + if (codec_ == &libaom_test::kAV1) { + // TODO(geza): Start using multiple tile rows when the multi-threaded + // encoder can handle them + encoder->Control(AV1E_SET_TILE_ROWS, 32); + } else { + encoder->Control(AV1E_SET_TILE_ROWS, 0); + } +#else + // Encode 4 tile columns. + encoder->Control(AV1E_SET_TILE_COLUMNS, 2); + encoder->Control(AV1E_SET_TILE_ROWS, 0); +#endif // CONFIG_AV1 && CONFIG_EXT_TILE +#if CONFIG_LOOPFILTERING_ACROSS_TILES + encoder->Control(AV1E_SET_TILE_LOOPFILTER, 0); +#endif // CONFIG_LOOPFILTERING_ACROSS_TILES + encoder->Control(AOME_SET_CPUUSED, set_cpu_used_); + if (encoding_mode_ != ::libaom_test::kRealTime) { + encoder->Control(AOME_SET_ENABLEAUTOALTREF, 1); + encoder->Control(AOME_SET_ARNR_MAXFRAMES, 7); + encoder->Control(AOME_SET_ARNR_STRENGTH, 5); + encoder->Control(AV1E_SET_FRAME_PARALLEL_DECODING, 0); + } else { + encoder->Control(AOME_SET_ENABLEAUTOALTREF, 0); + encoder->Control(AV1E_SET_AQ_MODE, 3); + } + encoder_initialized_ = true; + } + } + + virtual void FramePktHook(const aom_codec_cx_pkt_t *pkt) { + size_enc_.push_back(pkt->data.frame.sz); + + ::libaom_test::MD5 md5_enc; + md5_enc.Add(reinterpret_cast(pkt->data.frame.buf), + pkt->data.frame.sz); + md5_enc_.push_back(md5_enc.Get()); + + const aom_codec_err_t res = decoder_->DecodeFrame( + reinterpret_cast(pkt->data.frame.buf), pkt->data.frame.sz); + if (res != AOM_CODEC_OK) { + abort_ = true; + ASSERT_EQ(AOM_CODEC_OK, res); + } + const aom_image_t *img = decoder_->GetDxData().Next(); + + if (img) { + ::libaom_test::MD5 md5_res; + md5_res.Add(img); + md5_dec_.push_back(md5_res.Get()); + } + } + + void DoTest() { + ::libaom_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_ = AOM_CODEC_USE_PSNR; + ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); + std::vector single_thr_size_enc; + std::vector single_thr_md5_enc; + std::vector single_thr_md5_dec; + single_thr_size_enc = size_enc_; + single_thr_md5_enc = md5_enc_; + single_thr_md5_dec = md5_dec_; + size_enc_.clear(); + md5_enc_.clear(); + md5_dec_.clear(); + + // Encode using multiple threads. + cfg_.g_threads = 4; + ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); + std::vector multi_thr_size_enc; + std::vector multi_thr_md5_enc; + std::vector multi_thr_md5_dec; + multi_thr_size_enc = size_enc_; + multi_thr_md5_enc = md5_enc_; + multi_thr_md5_dec = md5_dec_; + size_enc_.clear(); + md5_enc_.clear(); + md5_dec_.clear(); + + // 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); + } + + bool encoder_initialized_; + ::libaom_test::TestMode encoding_mode_; + int set_cpu_used_; + ::libaom_test::Decoder *decoder_; + std::vector size_enc_; + std::vector md5_enc_; + std::vector md5_dec_; +}; + +TEST_P(AVxEncoderThreadTest, EncoderResultTest) { DoTest(); } + +class AVxEncoderThreadTestLarge : public AVxEncoderThreadTest {}; + +TEST_P(AVxEncoderThreadTestLarge, EncoderResultTest) { DoTest(); } + +// For AV1, only test speed 0 to 3. +AV1_INSTANTIATE_TEST_CASE(AVxEncoderThreadTest, + ::testing::Values(::libaom_test::kTwoPassGood, + ::libaom_test::kOnePassGood), + ::testing::Range(2, 4)); + +AV1_INSTANTIATE_TEST_CASE(AVxEncoderThreadTestLarge, + ::testing::Values(::libaom_test::kTwoPassGood, + ::libaom_test::kOnePassGood), + ::testing::Range(0, 2)); +} // namespace -- cgit v1.2.3 From 7369c7d7a5eed32963d8af37658286617919f91c Mon Sep 17 00:00:00 2001 From: trav90 Date: Thu, 18 Oct 2018 06:04:57 -0500 Subject: Update aom to commit id f5bdeac22930ff4c6b219be49c843db35970b918 --- third_party/aom/test/ethread_test.cc | 74 +++++++++++++++++++++++++++--------- 1 file changed, 55 insertions(+), 19 deletions(-) (limited to 'third_party/aom/test/ethread_test.cc') diff --git a/third_party/aom/test/ethread_test.cc b/third_party/aom/test/ethread_test.cc index 5b519f8fe..86eb3228e 100644 --- a/third_party/aom/test/ethread_test.cc +++ b/third_party/aom/test/ethread_test.cc @@ -20,8 +20,8 @@ namespace { class AVxEncoderThreadTest - : public ::libaom_test::EncoderTest, - public ::libaom_test::CodecTestWith2Params { + : public ::libaom_test::CodecTestWith2Params, + public ::libaom_test::EncoderTest { protected: AVxEncoderThreadTest() : EncoderTest(GET_PARAM(0)), encoder_initialized_(false), @@ -30,8 +30,9 @@ class AVxEncoderThreadTest aom_codec_dec_cfg_t cfg = aom_codec_dec_cfg_t(); cfg.w = 1280; cfg.h = 720; + cfg.allow_lowbitdepth = 1; decoder_ = codec_->CreateDecoder(cfg, 0); -#if CONFIG_AV1 && CONFIG_EXT_TILE +#if CONFIG_AV1 if (decoder_->IsAV1()) { decoder_->Control(AV1_SET_DECODE_TILE_ROW, -1); decoder_->Control(AV1_SET_DECODE_TILE_COL, -1); @@ -69,20 +70,7 @@ class AVxEncoderThreadTest virtual void PreEncodeFrameHook(::libaom_test::VideoSource * /*video*/, ::libaom_test::Encoder *encoder) { if (!encoder_initialized_) { -#if CONFIG_AV1 && CONFIG_EXT_TILE - encoder->Control(AV1E_SET_TILE_COLUMNS, 1); - if (codec_ == &libaom_test::kAV1) { - // TODO(geza): Start using multiple tile rows when the multi-threaded - // encoder can handle them - encoder->Control(AV1E_SET_TILE_ROWS, 32); - } else { - encoder->Control(AV1E_SET_TILE_ROWS, 0); - } -#else - // Encode 4 tile columns. - encoder->Control(AV1E_SET_TILE_COLUMNS, 2); - encoder->Control(AV1E_SET_TILE_ROWS, 0); -#endif // CONFIG_AV1 && CONFIG_EXT_TILE + SetTileSize(encoder); #if CONFIG_LOOPFILTERING_ACROSS_TILES encoder->Control(AV1E_SET_TILE_LOOPFILTER, 0); #endif // CONFIG_LOOPFILTERING_ACROSS_TILES @@ -100,6 +88,12 @@ class AVxEncoderThreadTest } } + virtual void SetTileSize(libaom_test::Encoder *encoder) { + // Encode 4 tile columns. + encoder->Control(AV1E_SET_TILE_COLUMNS, 2); + encoder->Control(AV1E_SET_TILE_ROWS, 0); + } + virtual void FramePktHook(const aom_codec_cx_pkt_t *pkt) { size_enc_.push_back(pkt->data.frame.sz); @@ -169,11 +163,21 @@ class AVxEncoderThreadTest std::vector md5_dec_; }; -TEST_P(AVxEncoderThreadTest, EncoderResultTest) { DoTest(); } +TEST_P(AVxEncoderThreadTest, EncoderResultTest) { +#if CONFIG_AV1 && CONFIG_EXT_TILE + cfg_.large_scale_tile = 0; +#endif // CONFIG_AV1 && CONFIG_EXT_TILE + DoTest(); +} class AVxEncoderThreadTestLarge : public AVxEncoderThreadTest {}; -TEST_P(AVxEncoderThreadTestLarge, EncoderResultTest) { DoTest(); } +TEST_P(AVxEncoderThreadTestLarge, EncoderResultTest) { +#if CONFIG_AV1 && CONFIG_EXT_TILE + cfg_.large_scale_tile = 0; +#endif // CONFIG_AV1 && CONFIG_EXT_TILE + DoTest(); +} // For AV1, only test speed 0 to 3. AV1_INSTANTIATE_TEST_CASE(AVxEncoderThreadTest, @@ -185,4 +189,36 @@ AV1_INSTANTIATE_TEST_CASE(AVxEncoderThreadTestLarge, ::testing::Values(::libaom_test::kTwoPassGood, ::libaom_test::kOnePassGood), ::testing::Range(0, 2)); + +#if CONFIG_AV1 && CONFIG_EXT_TILE +class AVxEncoderThreadLSTest : public AVxEncoderThreadTest { + virtual void SetTileSize(libaom_test::Encoder *encoder) { + encoder->Control(AV1E_SET_TILE_COLUMNS, 1); + // TODO(geza): Start using multiple tile rows when the multi-threaded + // encoder can handle them + encoder->Control(AV1E_SET_TILE_ROWS, 32); + } +}; + +TEST_P(AVxEncoderThreadLSTest, EncoderResultTest) { + cfg_.large_scale_tile = 1; + DoTest(); +} + +class AVxEncoderThreadLSTestLarge : public AVxEncoderThreadLSTest {}; + +TEST_P(AVxEncoderThreadLSTestLarge, EncoderResultTest) { + cfg_.large_scale_tile = 1; + DoTest(); +} + +AV1_INSTANTIATE_TEST_CASE(AVxEncoderThreadLSTest, + ::testing::Values(::libaom_test::kTwoPassGood, + ::libaom_test::kOnePassGood), + ::testing::Range(2, 4)); +AV1_INSTANTIATE_TEST_CASE(AVxEncoderThreadLSTestLarge, + ::testing::Values(::libaom_test::kTwoPassGood, + ::libaom_test::kOnePassGood), + ::testing::Range(0, 2)); +#endif // CONFIG_AV1 && CONFIG_EXT_TILE } // namespace -- cgit v1.2.3 From bbcc64772580c8a979288791afa02d30bc476d2e Mon Sep 17 00:00:00 2001 From: trav90 Date: Fri, 19 Oct 2018 21:52:15 -0500 Subject: Update aom to v1.0.0 Update aom to commit id d14c5bb4f336ef1842046089849dee4a301fbbf0. --- third_party/aom/test/ethread_test.cc | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'third_party/aom/test/ethread_test.cc') diff --git a/third_party/aom/test/ethread_test.cc b/third_party/aom/test/ethread_test.cc index 86eb3228e..3dcc2a707 100644 --- a/third_party/aom/test/ethread_test.cc +++ b/third_party/aom/test/ethread_test.cc @@ -7,7 +7,7 @@ * 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. -*/ + */ #include #include @@ -16,7 +16,7 @@ #include "test/encode_test_driver.h" #include "test/md5_helper.h" #include "test/util.h" -#include "test/y4m_video_source.h" +#include "test/yuv_video_source.h" namespace { class AVxEncoderThreadTest @@ -32,12 +32,10 @@ class AVxEncoderThreadTest cfg.h = 720; cfg.allow_lowbitdepth = 1; decoder_ = codec_->CreateDecoder(cfg, 0); -#if CONFIG_AV1 if (decoder_->IsAV1()) { decoder_->Control(AV1_SET_DECODE_TILE_ROW, -1); decoder_->Control(AV1_SET_DECODE_TILE_COL, -1); } -#endif size_enc_.clear(); md5_dec_.clear(); @@ -71,9 +69,6 @@ class AVxEncoderThreadTest ::libaom_test::Encoder *encoder) { if (!encoder_initialized_) { SetTileSize(encoder); -#if CONFIG_LOOPFILTERING_ACROSS_TILES - encoder->Control(AV1E_SET_TILE_LOOPFILTER, 0); -#endif // CONFIG_LOOPFILTERING_ACROSS_TILES encoder->Control(AOME_SET_CPUUSED, set_cpu_used_); if (encoding_mode_ != ::libaom_test::kRealTime) { encoder->Control(AOME_SET_ENABLEAUTOALTREF, 1); @@ -118,7 +113,8 @@ class AVxEncoderThreadTest } void DoTest() { - ::libaom_test::Y4mVideoSource video("niklas_1280_720_30.y4m", 15, 18); + ::libaom_test::YUVVideoSource video( + "niklas_640_480_30.yuv", AOM_IMG_FMT_I420, 640, 480, 30, 1, 15, 18); cfg_.rc_target_bitrate = 1000; // Encode using single thread. @@ -164,18 +160,16 @@ class AVxEncoderThreadTest }; TEST_P(AVxEncoderThreadTest, EncoderResultTest) { -#if CONFIG_AV1 && CONFIG_EXT_TILE cfg_.large_scale_tile = 0; -#endif // CONFIG_AV1 && CONFIG_EXT_TILE + decoder_->Control(AV1_SET_TILE_MODE, 0); DoTest(); } class AVxEncoderThreadTestLarge : public AVxEncoderThreadTest {}; TEST_P(AVxEncoderThreadTestLarge, EncoderResultTest) { -#if CONFIG_AV1 && CONFIG_EXT_TILE cfg_.large_scale_tile = 0; -#endif // CONFIG_AV1 && CONFIG_EXT_TILE + decoder_->Control(AV1_SET_TILE_MODE, 0); DoTest(); } @@ -190,7 +184,6 @@ AV1_INSTANTIATE_TEST_CASE(AVxEncoderThreadTestLarge, ::libaom_test::kOnePassGood), ::testing::Range(0, 2)); -#if CONFIG_AV1 && CONFIG_EXT_TILE class AVxEncoderThreadLSTest : public AVxEncoderThreadTest { virtual void SetTileSize(libaom_test::Encoder *encoder) { encoder->Control(AV1E_SET_TILE_COLUMNS, 1); @@ -200,15 +193,17 @@ class AVxEncoderThreadLSTest : public AVxEncoderThreadTest { } }; -TEST_P(AVxEncoderThreadLSTest, EncoderResultTest) { +TEST_P(AVxEncoderThreadLSTest, DISABLED_EncoderResultTest) { cfg_.large_scale_tile = 1; + decoder_->Control(AV1_SET_TILE_MODE, 1); DoTest(); } class AVxEncoderThreadLSTestLarge : public AVxEncoderThreadLSTest {}; -TEST_P(AVxEncoderThreadLSTestLarge, EncoderResultTest) { +TEST_P(AVxEncoderThreadLSTestLarge, DISABLED_EncoderResultTest) { cfg_.large_scale_tile = 1; + decoder_->Control(AV1_SET_TILE_MODE, 1); DoTest(); } @@ -220,5 +215,4 @@ AV1_INSTANTIATE_TEST_CASE(AVxEncoderThreadLSTestLarge, ::testing::Values(::libaom_test::kTwoPassGood, ::libaom_test::kOnePassGood), ::testing::Range(0, 2)); -#endif // CONFIG_AV1 && CONFIG_EXT_TILE } // namespace -- cgit v1.2.3 From b8df135c97a854c2ff9b4394b016649c601177fa Mon Sep 17 00:00:00 2001 From: trav90 Date: Fri, 19 Oct 2018 23:00:02 -0500 Subject: Update libaom to rev b25610052a1398032320008d69b51d2da94f5928 --- third_party/aom/test/ethread_test.cc | 37 +++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'third_party/aom/test/ethread_test.cc') diff --git a/third_party/aom/test/ethread_test.cc b/third_party/aom/test/ethread_test.cc index 3dcc2a707..dd9fc2f8d 100644 --- a/third_party/aom/test/ethread_test.cc +++ b/third_party/aom/test/ethread_test.cc @@ -20,12 +20,14 @@ namespace { class AVxEncoderThreadTest - : public ::libaom_test::CodecTestWith2Params, + : public ::libaom_test::CodecTestWith4Params, public ::libaom_test::EncoderTest { protected: AVxEncoderThreadTest() : EncoderTest(GET_PARAM(0)), encoder_initialized_(false), - encoding_mode_(GET_PARAM(1)), set_cpu_used_(GET_PARAM(2)) { + encoding_mode_(GET_PARAM(1)), set_cpu_used_(GET_PARAM(2)), + tile_cols_(GET_PARAM(3)), tile_rows_(GET_PARAM(4)) { init_flags_ = AOM_CODEC_USE_PSNR; aom_codec_dec_cfg_t cfg = aom_codec_dec_cfg_t(); cfg.w = 1280; @@ -84,9 +86,8 @@ class AVxEncoderThreadTest } virtual void SetTileSize(libaom_test::Encoder *encoder) { - // Encode 4 tile columns. - encoder->Control(AV1E_SET_TILE_COLUMNS, 2); - encoder->Control(AV1E_SET_TILE_ROWS, 0); + encoder->Control(AV1E_SET_TILE_COLUMNS, tile_cols_); + encoder->Control(AV1E_SET_TILE_ROWS, tile_rows_); } virtual void FramePktHook(const aom_codec_cx_pkt_t *pkt) { @@ -153,6 +154,8 @@ class AVxEncoderThreadTest bool encoder_initialized_; ::libaom_test::TestMode encoding_mode_; int set_cpu_used_; + int tile_cols_; + int tile_rows_; ::libaom_test::Decoder *decoder_; std::vector size_enc_; std::vector md5_enc_; @@ -177,42 +180,46 @@ TEST_P(AVxEncoderThreadTestLarge, EncoderResultTest) { AV1_INSTANTIATE_TEST_CASE(AVxEncoderThreadTest, ::testing::Values(::libaom_test::kTwoPassGood, ::libaom_test::kOnePassGood), - ::testing::Range(2, 4)); + ::testing::Range(2, 4), ::testing::Values(1, 2), + ::testing::Values(0, 1)); AV1_INSTANTIATE_TEST_CASE(AVxEncoderThreadTestLarge, ::testing::Values(::libaom_test::kTwoPassGood, ::libaom_test::kOnePassGood), - ::testing::Range(0, 2)); + ::testing::Range(0, 2), ::testing::Values(0, 1, 2, 6), + ::testing::Values(0, 1, 2, 6)); class AVxEncoderThreadLSTest : public AVxEncoderThreadTest { virtual void SetTileSize(libaom_test::Encoder *encoder) { - encoder->Control(AV1E_SET_TILE_COLUMNS, 1); - // TODO(geza): Start using multiple tile rows when the multi-threaded - // encoder can handle them - encoder->Control(AV1E_SET_TILE_ROWS, 32); + encoder->Control(AV1E_SET_TILE_COLUMNS, tile_cols_); + encoder->Control(AV1E_SET_TILE_ROWS, tile_rows_); } }; -TEST_P(AVxEncoderThreadLSTest, DISABLED_EncoderResultTest) { +TEST_P(AVxEncoderThreadLSTest, EncoderResultTest) { cfg_.large_scale_tile = 1; decoder_->Control(AV1_SET_TILE_MODE, 1); + decoder_->Control(AV1D_EXT_TILE_DEBUG, 1); DoTest(); } class AVxEncoderThreadLSTestLarge : public AVxEncoderThreadLSTest {}; -TEST_P(AVxEncoderThreadLSTestLarge, DISABLED_EncoderResultTest) { +TEST_P(AVxEncoderThreadLSTestLarge, EncoderResultTest) { cfg_.large_scale_tile = 1; decoder_->Control(AV1_SET_TILE_MODE, 1); + decoder_->Control(AV1D_EXT_TILE_DEBUG, 1); DoTest(); } AV1_INSTANTIATE_TEST_CASE(AVxEncoderThreadLSTest, ::testing::Values(::libaom_test::kTwoPassGood, ::libaom_test::kOnePassGood), - ::testing::Range(2, 4)); + ::testing::Range(2, 4), ::testing::Values(6), + ::testing::Values(0, 6)); AV1_INSTANTIATE_TEST_CASE(AVxEncoderThreadLSTestLarge, ::testing::Values(::libaom_test::kTwoPassGood, ::libaom_test::kOnePassGood), - ::testing::Range(0, 2)); + ::testing::Range(0, 2), ::testing::Values(6), + ::testing::Values(0, 6)); } // namespace -- cgit v1.2.3 From d2499ead93dc4298c0882fe98902acb1b5209f99 Mon Sep 17 00:00:00 2001 From: trav90 Date: Fri, 19 Oct 2018 23:05:00 -0500 Subject: Update libaom to commit ID 1e227d41f0616de9548a673a83a21ef990b62591 --- third_party/aom/test/ethread_test.cc | 70 ++++++++++++++++++++++++++++++------ 1 file changed, 59 insertions(+), 11 deletions(-) (limited to 'third_party/aom/test/ethread_test.cc') diff --git a/third_party/aom/test/ethread_test.cc b/third_party/aom/test/ethread_test.cc index dd9fc2f8d..d9ac78282 100644 --- a/third_party/aom/test/ethread_test.cc +++ b/third_party/aom/test/ethread_test.cc @@ -50,7 +50,7 @@ class AVxEncoderThreadTest SetMode(encoding_mode_); if (encoding_mode_ != ::libaom_test::kRealTime) { - cfg_.g_lag_in_frames = 3; + cfg_.g_lag_in_frames = 5; cfg_.rc_end_usage = AOM_VBR; cfg_.rc_2pass_vbr_minsection_pct = 5; cfg_.rc_2pass_vbr_maxsection_pct = 2000; @@ -72,6 +72,7 @@ class AVxEncoderThreadTest 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::kRealTime) { encoder->Control(AOME_SET_ENABLEAUTOALTREF, 1); encoder->Control(AOME_SET_ARNR_MAXFRAMES, 7); @@ -115,10 +116,11 @@ class AVxEncoderThreadTest void DoTest() { ::libaom_test::YUVVideoSource video( - "niklas_640_480_30.yuv", AOM_IMG_FMT_I420, 640, 480, 30, 1, 15, 18); + "niklas_640_480_30.yuv", AOM_IMG_FMT_I420, 640, 480, 30, 1, 15, 21); cfg_.rc_target_bitrate = 1000; // Encode using single thread. + row_mt_ = 0; cfg_.g_threads = 1; init_flags_ = AOM_CODEC_USE_PSNR; ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); @@ -149,6 +151,55 @@ class AVxEncoderThreadTest 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); + + // Encode using multiple threads row-mt enabled. + row_mt_ = 1; + cfg_.g_threads = 2; + ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); + std::vector multi_thr2_row_mt_size_enc; + std::vector multi_thr2_row_mt_md5_enc; + std::vector multi_thr2_row_mt_md5_dec; + multi_thr2_row_mt_size_enc = size_enc_; + multi_thr2_row_mt_md5_enc = md5_enc_; + multi_thr2_row_mt_md5_dec = md5_dec_; + size_enc_.clear(); + md5_enc_.clear(); + md5_dec_.clear(); + + // 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 multi_thr3_row_mt_size_enc; + // std::vector multi_thr3_row_mt_md5_enc; + // std::vector 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); + + cfg_.g_threads = 4; + ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); + std::vector multi_thr4_row_mt_size_enc; + std::vector multi_thr4_row_mt_md5_enc; + std::vector multi_thr4_row_mt_md5_dec; + multi_thr4_row_mt_size_enc = size_enc_; + multi_thr4_row_mt_md5_enc = md5_enc_; + multi_thr4_row_mt_md5_dec = md5_dec_; + size_enc_.clear(); + md5_enc_.clear(); + md5_dec_.clear(); + + // 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); } bool encoder_initialized_; @@ -156,6 +207,7 @@ class AVxEncoderThreadTest int set_cpu_used_; int tile_cols_; int tile_rows_; + int row_mt_; ::libaom_test::Decoder *decoder_; std::vector size_enc_; std::vector md5_enc_; @@ -177,12 +229,13 @@ TEST_P(AVxEncoderThreadTestLarge, EncoderResultTest) { } // For AV1, only test speed 0 to 3. +// Here test cpu_used 2 and 3 AV1_INSTANTIATE_TEST_CASE(AVxEncoderThreadTest, - ::testing::Values(::libaom_test::kTwoPassGood, - ::libaom_test::kOnePassGood), - ::testing::Range(2, 4), ::testing::Values(1, 2), + ::testing::Values(::libaom_test::kTwoPassGood), + ::testing::Range(2, 4), ::testing::Values(0, 2), ::testing::Values(0, 1)); +// Test cpu_used 0 and 1. AV1_INSTANTIATE_TEST_CASE(AVxEncoderThreadTestLarge, ::testing::Values(::libaom_test::kTwoPassGood, ::libaom_test::kOnePassGood), @@ -212,14 +265,9 @@ TEST_P(AVxEncoderThreadLSTestLarge, EncoderResultTest) { DoTest(); } -AV1_INSTANTIATE_TEST_CASE(AVxEncoderThreadLSTest, - ::testing::Values(::libaom_test::kTwoPassGood, - ::libaom_test::kOnePassGood), - ::testing::Range(2, 4), ::testing::Values(6), - ::testing::Values(0, 6)); AV1_INSTANTIATE_TEST_CASE(AVxEncoderThreadLSTestLarge, ::testing::Values(::libaom_test::kTwoPassGood, ::libaom_test::kOnePassGood), - ::testing::Range(0, 2), ::testing::Values(6), + ::testing::Range(0, 4), ::testing::Values(0, 6), ::testing::Values(0, 6)); } // namespace -- cgit v1.2.3