diff options
author | trav90 <travawine@palemoon.org> | 2018-10-19 21:52:15 -0500 |
---|---|---|
committer | trav90 <travawine@palemoon.org> | 2018-10-19 21:52:20 -0500 |
commit | bbcc64772580c8a979288791afa02d30bc476d2e (patch) | |
tree | 437ce94c3fdd7497508e5b55de06c6d011678597 /third_party/aom/test/coding_path_sync.cc | |
parent | 14805f6ddbfb173c327768fff9f81f40ce5e81b0 (diff) | |
download | UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar.gz UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar.lz UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar.xz UXP-bbcc64772580c8a979288791afa02d30bc476d2e.zip |
Update aom to v1.0.0
Update aom to commit id d14c5bb4f336ef1842046089849dee4a301fbbf0.
Diffstat (limited to 'third_party/aom/test/coding_path_sync.cc')
-rw-r--r-- | third_party/aom/test/coding_path_sync.cc | 75 |
1 files changed, 61 insertions, 14 deletions
diff --git a/third_party/aom/test/coding_path_sync.cc b/third_party/aom/test/coding_path_sync.cc index 5b6409d03..51a506004 100644 --- a/third_party/aom/test/coding_path_sync.cc +++ b/third_party/aom/test/coding_path_sync.cc @@ -13,7 +13,7 @@ #include "third_party/googletest/src/googletest/include/gtest/gtest.h" #include "test/acm_random.h" -#include "./aom_config.h" +#include "config/aom_config.h" #include "aom_ports/mem.h" // ROUND_POWER_OF_TWO #include "aom/aomcx.h" @@ -32,11 +32,17 @@ class CompressedSource { aom_codec_enc_cfg_t cfg; aom_codec_enc_config_default(algo, &cfg, 0); - const int max_q = cfg.rc_max_quantizer; + // force the quantizer, to reduce the sensitivity on encoding choices. + // e.g, we don't want this test to break when the rate control is modified. + { + const int max_q = cfg.rc_max_quantizer; + const int min_q = cfg.rc_min_quantizer; + const int q = rnd_.PseudoUniform(max_q - min_q + 1) + min_q; - cfg.rc_end_usage = AOM_CQ; - cfg.rc_max_quantizer = max_q; - cfg.rc_min_quantizer = max_q; + cfg.rc_end_usage = AOM_Q; + cfg.rc_max_quantizer = q; + cfg.rc_min_quantizer = q; + } // choose the picture size { @@ -44,9 +50,26 @@ class CompressedSource { height_ = rnd_.PseudoUniform(kHeight - 8) + 8; } + // choose the chroma subsampling + { + const aom_img_fmt_t fmts[] = { + AOM_IMG_FMT_I420, + AOM_IMG_FMT_I422, + AOM_IMG_FMT_I444, + }; + + format_ = fmts[rnd_.PseudoUniform(NELEMENTS(fmts))]; + } + cfg.g_w = width_; cfg.g_h = height_; cfg.g_lag_in_frames = 0; + if (format_ == AOM_IMG_FMT_I420) + cfg.g_profile = 0; + else if (format_ == AOM_IMG_FMT_I444) + cfg.g_profile = 1; + else if (format_ == AOM_IMG_FMT_I422) + cfg.g_profile = 2; aom_codec_enc_init(&enc_, algo, &cfg, 0); } @@ -54,7 +77,7 @@ class CompressedSource { ~CompressedSource() { aom_codec_destroy(&enc_); } const aom_codec_cx_pkt_t *ReadFrame() { - uint8_t buf[kWidth * kHeight * 3 / 2] = { 0 }; + uint8_t buf[kWidth * kHeight * 3] = { 0 }; // render regular pattern const int period = rnd_.Rand8() % 32 + 1; @@ -67,8 +90,8 @@ class CompressedSource { buf[i] = (i + phase) % period < period / 2 ? val_a : val_b; aom_image_t img; - aom_img_wrap(&img, AOM_IMG_FMT_I420, width_, height_, 0, buf); - aom_codec_encode(&enc_, &img, frame_count_++, 1, 0, 0); + aom_img_wrap(&img, format_, width_, height_, 0, buf); + aom_codec_encode(&enc_, &img, frame_count_++, 1, 0); aom_codec_iter_t iter = NULL; @@ -86,6 +109,7 @@ class CompressedSource { static const int kHeight = 128; ACMRandom rnd_; + aom_img_fmt_t format_; aom_codec_ctx_t enc_; int frame_count_; int width_, height_; @@ -128,7 +152,7 @@ class Decoder { std::vector<int16_t> decode(const aom_codec_cx_pkt_t *pkt) { aom_codec_decode(&dec_, static_cast<uint8_t *>(pkt->data.frame.buf), - static_cast<unsigned int>(pkt->data.frame.sz), NULL, 0); + pkt->data.frame.sz, NULL); aom_codec_iter_t iter = NULL; return Serialize(aom_codec_get_frame(&dec_, &iter)); @@ -140,18 +164,41 @@ class Decoder { // Try to reveal a mismatch between LBD and HBD coding paths. TEST(CodingPathSync, SearchForHbdLbdMismatch) { - const int count_tests = 100; + const int count_tests = 10; for (int i = 0; i < count_tests; ++i) { Decoder dec_hbd(0); Decoder dec_lbd(1); CompressedSource enc(i); - const aom_codec_cx_pkt_t *frame = enc.ReadFrame(); - std::vector<int16_t> lbd_yuv = dec_lbd.decode(frame); - std::vector<int16_t> hbd_yuv = dec_hbd.decode(frame); + for (int k = 0; k < 3; ++k) { + const aom_codec_cx_pkt_t *frame = enc.ReadFrame(); + + std::vector<int16_t> lbd_yuv = dec_lbd.decode(frame); + std::vector<int16_t> hbd_yuv = dec_hbd.decode(frame); - ASSERT_EQ(lbd_yuv, hbd_yuv); + ASSERT_EQ(lbd_yuv, hbd_yuv); + } + } +} + +TEST(CodingPathSyncLarge, SearchForHbdLbdMismatchLarge) { + const int count_tests = 100; + const int seed = 1234; + for (int i = 0; i < count_tests; ++i) { + Decoder dec_hbd(0); + Decoder dec_lbd(1); + + CompressedSource enc(seed + i); + + for (int k = 0; k < 5; ++k) { + const aom_codec_cx_pkt_t *frame = enc.ReadFrame(); + + std::vector<int16_t> lbd_yuv = dec_lbd.decode(frame); + std::vector<int16_t> hbd_yuv = dec_hbd.decode(frame); + + ASSERT_EQ(lbd_yuv, hbd_yuv); + } } } |