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/tile_independence_test.cc | 147 +++++++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 third_party/aom/test/tile_independence_test.cc (limited to 'third_party/aom/test/tile_independence_test.cc') diff --git a/third_party/aom/test/tile_independence_test.cc b/third_party/aom/test/tile_independence_test.cc new file mode 100644 index 000000000..a29051f2f --- /dev/null +++ b/third_party/aom/test/tile_independence_test.cc @@ -0,0 +1,147 @@ +/* + * 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 +#include "third_party/googletest/src/googletest/include/gtest/gtest.h" +#include "test/codec_factory.h" +#include "test/encode_test_driver.h" +#include "test/i420_video_source.h" +#include "test/util.h" +#include "test/md5_helper.h" +#include "aom_mem/aom_mem.h" + +namespace { +class TileIndependenceTest + : public ::libaom_test::EncoderTest, + public ::libaom_test::CodecTestWith2Params { + protected: + TileIndependenceTest() + : EncoderTest(GET_PARAM(0)), md5_fw_order_(), md5_inv_order_(), + n_tile_cols_(GET_PARAM(1)), n_tile_rows_(GET_PARAM(2)) { + init_flags_ = AOM_CODEC_USE_PSNR; + aom_codec_dec_cfg_t cfg = aom_codec_dec_cfg_t(); + cfg.w = 704; + cfg.h = 144; + cfg.threads = 1; + fw_dec_ = codec_->CreateDecoder(cfg, 0); + inv_dec_ = codec_->CreateDecoder(cfg, 0); + inv_dec_->Control(AV1_INVERT_TILE_DECODE_ORDER, 1); + +#if CONFIG_AV1 && CONFIG_EXT_TILE + if (fw_dec_->IsAV1() && inv_dec_->IsAV1()) { + fw_dec_->Control(AV1_SET_DECODE_TILE_ROW, -1); + fw_dec_->Control(AV1_SET_DECODE_TILE_COL, -1); + inv_dec_->Control(AV1_SET_DECODE_TILE_ROW, -1); + inv_dec_->Control(AV1_SET_DECODE_TILE_COL, -1); + } +#endif + } + + virtual ~TileIndependenceTest() { + delete fw_dec_; + delete inv_dec_; + } + + virtual void SetUp() { + InitializeConfig(); + SetMode(libaom_test::kTwoPassGood); + } + + virtual void PreEncodeFrameHook(libaom_test::VideoSource *video, + libaom_test::Encoder *encoder) { + if (video->frame() == 1) { + encoder->Control(AV1E_SET_TILE_COLUMNS, n_tile_cols_); + encoder->Control(AV1E_SET_TILE_ROWS, n_tile_rows_); +#if CONFIG_EXT_TILE + encoder->Control(AV1E_SET_TILE_ENCODING_MODE, 0); // TILE_NORMAL +#endif // CONFIG_EXT_TILE +#if CONFIG_LOOPFILTERING_ACROSS_TILES + encoder->Control(AV1E_SET_TILE_LOOPFILTER, 0); +#endif // CONFIG_LOOPFILTERING_ACROSS_TILES + SetCpuUsed(encoder); + } + } + + virtual void SetCpuUsed(libaom_test::Encoder *encoder) { + static const int kCpuUsed = 3; + encoder->Control(AOME_SET_CPUUSED, kCpuUsed); + } + + void UpdateMD5(::libaom_test::Decoder *dec, const aom_codec_cx_pkt_t *pkt, + ::libaom_test::MD5 *md5) { + const aom_codec_err_t res = dec->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 = dec->GetDxData().Next(); + md5->Add(img); + } + + virtual void FramePktHook(const aom_codec_cx_pkt_t *pkt) { + UpdateMD5(fw_dec_, pkt, &md5_fw_order_); + UpdateMD5(inv_dec_, pkt, &md5_inv_order_); + } + + void DoTest() { + const aom_rational timebase = { 33333333, 1000000000 }; + cfg_.g_timebase = timebase; + cfg_.rc_target_bitrate = 500; + cfg_.g_lag_in_frames = 12; + cfg_.rc_end_usage = AOM_VBR; + + libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 704, 576, + timebase.den, timebase.num, 0, 5); + ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); + + const char *md5_fw_str = md5_fw_order_.Get(); + const char *md5_inv_str = md5_inv_order_.Get(); + ASSERT_STREQ(md5_fw_str, md5_inv_str); + } + + ::libaom_test::MD5 md5_fw_order_, md5_inv_order_; + ::libaom_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(libaom_test::Encoder *encoder) { + static const int kCpuUsed = 0; + encoder->Control(AOME_SET_CPUUSED, kCpuUsed); + } +}; + +TEST_P(TileIndependenceTestLarge, MD5Match) { DoTest(); } + +#if CONFIG_EXT_TILE +AV1_INSTANTIATE_TEST_CASE(TileIndependenceTest, ::testing::Values(1, 2, 32), + ::testing::Values(1, 2, 32)); +AV1_INSTANTIATE_TEST_CASE(TileIndependenceTestLarge, + ::testing::Values(1, 2, 32), + ::testing::Values(1, 2, 32)); +#else +AV1_INSTANTIATE_TEST_CASE(TileIndependenceTest, ::testing::Values(0, 1), + ::testing::Values(0, 1)); +AV1_INSTANTIATE_TEST_CASE(TileIndependenceTestLarge, ::testing::Values(0, 1), + ::testing::Values(0, 1)); +#endif // CONFIG_EXT_TILE +} // 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/tile_independence_test.cc | 52 ++++++++++++++++++-------- 1 file changed, 37 insertions(+), 15 deletions(-) (limited to 'third_party/aom/test/tile_independence_test.cc') diff --git a/third_party/aom/test/tile_independence_test.cc b/third_party/aom/test/tile_independence_test.cc index a29051f2f..832227fb8 100644 --- a/third_party/aom/test/tile_independence_test.cc +++ b/third_party/aom/test/tile_independence_test.cc @@ -22,8 +22,8 @@ namespace { class TileIndependenceTest - : public ::libaom_test::EncoderTest, - public ::libaom_test::CodecTestWith2Params { + : public ::libaom_test::CodecTestWith2Params, + public ::libaom_test::EncoderTest { protected: TileIndependenceTest() : EncoderTest(GET_PARAM(0)), md5_fw_order_(), md5_inv_order_(), @@ -33,11 +33,12 @@ class TileIndependenceTest cfg.w = 704; cfg.h = 144; cfg.threads = 1; + cfg.allow_lowbitdepth = 1; fw_dec_ = codec_->CreateDecoder(cfg, 0); inv_dec_ = codec_->CreateDecoder(cfg, 0); inv_dec_->Control(AV1_INVERT_TILE_DECODE_ORDER, 1); -#if CONFIG_AV1 && CONFIG_EXT_TILE +#if CONFIG_AV1 if (fw_dec_->IsAV1() && inv_dec_->IsAV1()) { fw_dec_->Control(AV1_SET_DECODE_TILE_ROW, -1); fw_dec_->Control(AV1_SET_DECODE_TILE_COL, -1); @@ -62,9 +63,6 @@ class TileIndependenceTest if (video->frame() == 1) { encoder->Control(AV1E_SET_TILE_COLUMNS, n_tile_cols_); encoder->Control(AV1E_SET_TILE_ROWS, n_tile_rows_); -#if CONFIG_EXT_TILE - encoder->Control(AV1E_SET_TILE_ENCODING_MODE, 0); // TILE_NORMAL -#endif // CONFIG_EXT_TILE #if CONFIG_LOOPFILTERING_ACROSS_TILES encoder->Control(AV1E_SET_TILE_LOOPFILTER, 0); #endif // CONFIG_LOOPFILTERING_ACROSS_TILES @@ -121,7 +119,12 @@ class TileIndependenceTest // 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(); } +TEST_P(TileIndependenceTest, MD5Match) { +#if CONFIG_EXT_TILE + cfg_.large_scale_tile = 0; +#endif // CONFIG_EXT_TILE + DoTest(); +} class TileIndependenceTestLarge : public TileIndependenceTest { virtual void SetCpuUsed(libaom_test::Encoder *encoder) { @@ -130,18 +133,37 @@ class TileIndependenceTestLarge : public TileIndependenceTest { } }; -TEST_P(TileIndependenceTestLarge, MD5Match) { DoTest(); } - +TEST_P(TileIndependenceTestLarge, MD5Match) { #if CONFIG_EXT_TILE -AV1_INSTANTIATE_TEST_CASE(TileIndependenceTest, ::testing::Values(1, 2, 32), - ::testing::Values(1, 2, 32)); -AV1_INSTANTIATE_TEST_CASE(TileIndependenceTestLarge, - ::testing::Values(1, 2, 32), - ::testing::Values(1, 2, 32)); -#else + cfg_.large_scale_tile = 0; +#endif // CONFIG_EXT_TILE + DoTest(); +} + AV1_INSTANTIATE_TEST_CASE(TileIndependenceTest, ::testing::Values(0, 1), ::testing::Values(0, 1)); AV1_INSTANTIATE_TEST_CASE(TileIndependenceTestLarge, ::testing::Values(0, 1), ::testing::Values(0, 1)); + +#if CONFIG_EXT_TILE +class TileIndependenceLSTest : public TileIndependenceTest {}; + +TEST_P(TileIndependenceLSTest, MD5Match) { + cfg_.large_scale_tile = 1; + DoTest(); +} + +class TileIndependenceLSTestLarge : public TileIndependenceTestLarge {}; + +TEST_P(TileIndependenceLSTestLarge, MD5Match) { + cfg_.large_scale_tile = 1; + DoTest(); +} + +AV1_INSTANTIATE_TEST_CASE(TileIndependenceLSTest, ::testing::Values(1, 2, 32), + ::testing::Values(1, 2, 32)); +AV1_INSTANTIATE_TEST_CASE(TileIndependenceLSTestLarge, + ::testing::Values(1, 2, 32), + ::testing::Values(1, 2, 32)); #endif // 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/tile_independence_test.cc | 43 +++++++++++++------------- 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'third_party/aom/test/tile_independence_test.cc') diff --git a/third_party/aom/test/tile_independence_test.cc b/third_party/aom/test/tile_independence_test.cc index 832227fb8..e8b2e1fe4 100644 --- a/third_party/aom/test/tile_independence_test.cc +++ b/third_party/aom/test/tile_independence_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 @@ -22,30 +22,29 @@ namespace { class TileIndependenceTest - : public ::libaom_test::CodecTestWith2Params, + : public ::libaom_test::CodecTestWith3Params, public ::libaom_test::EncoderTest { protected: TileIndependenceTest() : EncoderTest(GET_PARAM(0)), md5_fw_order_(), md5_inv_order_(), - n_tile_cols_(GET_PARAM(1)), n_tile_rows_(GET_PARAM(2)) { + n_tile_cols_(GET_PARAM(1)), n_tile_rows_(GET_PARAM(2)), + n_tile_groups_(GET_PARAM(3)) { init_flags_ = AOM_CODEC_USE_PSNR; aom_codec_dec_cfg_t cfg = aom_codec_dec_cfg_t(); cfg.w = 704; - cfg.h = 144; + cfg.h = 576; cfg.threads = 1; cfg.allow_lowbitdepth = 1; fw_dec_ = codec_->CreateDecoder(cfg, 0); inv_dec_ = codec_->CreateDecoder(cfg, 0); inv_dec_->Control(AV1_INVERT_TILE_DECODE_ORDER, 1); -#if CONFIG_AV1 if (fw_dec_->IsAV1() && inv_dec_->IsAV1()) { fw_dec_->Control(AV1_SET_DECODE_TILE_ROW, -1); fw_dec_->Control(AV1_SET_DECODE_TILE_COL, -1); inv_dec_->Control(AV1_SET_DECODE_TILE_ROW, -1); inv_dec_->Control(AV1_SET_DECODE_TILE_COL, -1); } -#endif } virtual ~TileIndependenceTest() { @@ -63,10 +62,9 @@ class TileIndependenceTest if (video->frame() == 1) { encoder->Control(AV1E_SET_TILE_COLUMNS, n_tile_cols_); encoder->Control(AV1E_SET_TILE_ROWS, n_tile_rows_); -#if CONFIG_LOOPFILTERING_ACROSS_TILES - encoder->Control(AV1E_SET_TILE_LOOPFILTER, 0); -#endif // CONFIG_LOOPFILTERING_ACROSS_TILES SetCpuUsed(encoder); + } else if (video->frame() == 3) { + encoder->Control(AV1E_SET_NUM_TG, n_tile_groups_); } } @@ -114,15 +112,16 @@ class TileIndependenceTest private: int n_tile_cols_; int n_tile_rows_; + int n_tile_groups_; }; // 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) { -#if CONFIG_EXT_TILE cfg_.large_scale_tile = 0; -#endif // CONFIG_EXT_TILE + fw_dec_->Control(AV1_SET_TILE_MODE, 0); + inv_dec_->Control(AV1_SET_TILE_MODE, 0); DoTest(); } @@ -134,36 +133,38 @@ class TileIndependenceTestLarge : public TileIndependenceTest { }; TEST_P(TileIndependenceTestLarge, MD5Match) { -#if CONFIG_EXT_TILE cfg_.large_scale_tile = 0; -#endif // CONFIG_EXT_TILE + fw_dec_->Control(AV1_SET_TILE_MODE, 0); + inv_dec_->Control(AV1_SET_TILE_MODE, 0); DoTest(); } AV1_INSTANTIATE_TEST_CASE(TileIndependenceTest, ::testing::Values(0, 1), - ::testing::Values(0, 1)); + ::testing::Values(0, 1), ::testing::Values(1, 2, 4)); AV1_INSTANTIATE_TEST_CASE(TileIndependenceTestLarge, ::testing::Values(0, 1), - ::testing::Values(0, 1)); + ::testing::Values(0, 1), ::testing::Values(1, 2, 4)); -#if CONFIG_EXT_TILE class TileIndependenceLSTest : public TileIndependenceTest {}; -TEST_P(TileIndependenceLSTest, MD5Match) { +TEST_P(TileIndependenceLSTest, DISABLED_MD5Match) { cfg_.large_scale_tile = 1; + fw_dec_->Control(AV1_SET_TILE_MODE, 1); + inv_dec_->Control(AV1_SET_TILE_MODE, 1); DoTest(); } class TileIndependenceLSTestLarge : public TileIndependenceTestLarge {}; -TEST_P(TileIndependenceLSTestLarge, MD5Match) { +TEST_P(TileIndependenceLSTestLarge, DISABLED_MD5Match) { cfg_.large_scale_tile = 1; + fw_dec_->Control(AV1_SET_TILE_MODE, 1); + inv_dec_->Control(AV1_SET_TILE_MODE, 1); DoTest(); } AV1_INSTANTIATE_TEST_CASE(TileIndependenceLSTest, ::testing::Values(1, 2, 32), - ::testing::Values(1, 2, 32)); + ::testing::Values(1, 2, 32), ::testing::Values(1)); AV1_INSTANTIATE_TEST_CASE(TileIndependenceLSTestLarge, ::testing::Values(1, 2, 32), - ::testing::Values(1, 2, 32)); -#endif // CONFIG_EXT_TILE + ::testing::Values(1, 2, 32), ::testing::Values(1)); } // 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/tile_independence_test.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'third_party/aom/test/tile_independence_test.cc') diff --git a/third_party/aom/test/tile_independence_test.cc b/third_party/aom/test/tile_independence_test.cc index e8b2e1fe4..cf534c0c5 100644 --- a/third_party/aom/test/tile_independence_test.cc +++ b/third_party/aom/test/tile_independence_test.cc @@ -146,25 +146,28 @@ AV1_INSTANTIATE_TEST_CASE(TileIndependenceTestLarge, ::testing::Values(0, 1), class TileIndependenceLSTest : public TileIndependenceTest {}; -TEST_P(TileIndependenceLSTest, DISABLED_MD5Match) { +TEST_P(TileIndependenceLSTest, MD5Match) { cfg_.large_scale_tile = 1; fw_dec_->Control(AV1_SET_TILE_MODE, 1); + fw_dec_->Control(AV1D_EXT_TILE_DEBUG, 1); inv_dec_->Control(AV1_SET_TILE_MODE, 1); + inv_dec_->Control(AV1D_EXT_TILE_DEBUG, 1); DoTest(); } class TileIndependenceLSTestLarge : public TileIndependenceTestLarge {}; -TEST_P(TileIndependenceLSTestLarge, DISABLED_MD5Match) { +TEST_P(TileIndependenceLSTestLarge, MD5Match) { cfg_.large_scale_tile = 1; fw_dec_->Control(AV1_SET_TILE_MODE, 1); + fw_dec_->Control(AV1D_EXT_TILE_DEBUG, 1); inv_dec_->Control(AV1_SET_TILE_MODE, 1); + inv_dec_->Control(AV1D_EXT_TILE_DEBUG, 1); DoTest(); } -AV1_INSTANTIATE_TEST_CASE(TileIndependenceLSTest, ::testing::Values(1, 2, 32), - ::testing::Values(1, 2, 32), ::testing::Values(1)); -AV1_INSTANTIATE_TEST_CASE(TileIndependenceLSTestLarge, - ::testing::Values(1, 2, 32), - ::testing::Values(1, 2, 32), ::testing::Values(1)); +AV1_INSTANTIATE_TEST_CASE(TileIndependenceLSTest, ::testing::Values(6), + ::testing::Values(6), ::testing::Values(1)); +AV1_INSTANTIATE_TEST_CASE(TileIndependenceLSTestLarge, ::testing::Values(6), + ::testing::Values(6), ::testing::Values(1)); } // namespace -- cgit v1.2.3