/* * 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.
*/
#if CONFIG_SIZE_LIMIT // TODO(Casey.Smalley@arm.com) fails due to newer bounds checks that get caught // before the assert below added in ebc2714d71a834fc32a19eef0a81f51fbc47db01
TEST_F(AV1FrameSizeTests, DISABLED_TestInvalidSizes) {
::libaom_test::RandomVideoSource video;
// TODO(Casey.Smalley@arm.com) similar to the above test, needs to be // updated for the new rejection case
TEST_F(AV1FrameSizeTests, DISABLED_LargeValidSizes) {
::libaom_test::RandomVideoSource video;
// Resolution changes are only permitted with one pass encoding with no lag.
cfg.g_pass = AOM_RC_ONE_PASS;
cfg.g_lag_in_frames = 0;
cfg.rc_end_usage = rc_mode_;
for (int i = 0; i < kNumFramesPerResolution; ++i) {
video.Next(); // SetSize() does not call FillFrame().
EXPECT_EQ(aom_codec_encode(enc.get(), video.img(), video.pts(),
video.duration(), /*flags=*/0),
AOM_CODEC_OK);
iter = nullptr; while ((pkt = aom_codec_get_cx_data(enc.get(), &iter)) != nullptr) {
ASSERT_EQ(pkt->kind, AOM_CODEC_CX_FRAME_PKT); // The frame following a resolution change should be a keyframe as the // change is too extreme to allow previous references to be used. if (i == 0 || usage_ == AOM_USAGE_ALL_INTRA) {
EXPECT_NE(pkt->data.frame.flags & AOM_FRAME_IS_KEY, 0u)
<< "frame " << frame_count;
}
frame_count++;
}
}
}
// Resolution changes are only permitted with one pass encoding with no lag.
cfg.g_pass = AOM_RC_ONE_PASS;
cfg.g_lag_in_frames = 0;
cfg.rc_end_usage = rc_mode_; // For random input source, if max frame sizes are not set, the first encoded // frame size will be locked as the max frame size, and the encoder will // identify it as unsupported bitstream. unsignedint max_width = cfg.g_w; // default frame width unsignedint max_height = cfg.g_h; // default frame height for (constauto &frame_size : kFrameSizes) {
max_width = frame_size.width > max_width ? frame_size.width : max_width;
max_height =
frame_size.height > max_height ? frame_size.height : max_height;
}
cfg.g_forced_max_frame_width = max_width;
cfg.g_forced_max_frame_height = max_height;
for (int i = 0; i < kNumFramesPerResolution; ++i) {
video.Next(); // SetSize() does not call FillFrame().
EXPECT_EQ(aom_codec_encode(enc.get(), video.img(), video.pts(),
video.duration(), /*flags=*/0),
AOM_CODEC_OK);
iter = nullptr; while ((pkt = aom_codec_get_cx_data(enc.get(), &iter)) != nullptr) {
ASSERT_EQ(pkt->kind, AOM_CODEC_CX_FRAME_PKT); // The frame following a resolution change should be a keyframe as the // change is too extreme to allow previous references to be used. if (i == 0 || usage_ == AOM_USAGE_ALL_INTRA) {
EXPECT_NE(pkt->data.frame.flags & AOM_FRAME_IS_KEY, 0u)
<< "frame " << frame_count;
}
frame_count++;
}
}
}
// Resolution changes are only permitted with one pass encoding with no lag.
cfg.g_pass = AOM_RC_ONE_PASS;
cfg.g_lag_in_frames = 0;
cfg.rc_end_usage = rc_mode_;
for (int i = 0; i < kNumFramesPerResolution; ++i) {
video.Next(); // SetSize() does not call FillFrame().
EXPECT_EQ(aom_codec_encode(enc.get(), video.img(), video.pts(),
video.duration(), /*flags=*/0),
AOM_CODEC_OK);
iter = nullptr; while ((pkt = aom_codec_get_cx_data(enc.get(), &iter)) != nullptr) {
ASSERT_EQ(pkt->kind, AOM_CODEC_CX_FRAME_PKT); // The frame following a resolution change should be a keyframe as the // change is too extreme to allow previous references to be used. if (i == 0 || usage_ == AOM_USAGE_ALL_INTRA) {
EXPECT_NE(pkt->data.frame.flags & AOM_FRAME_IS_KEY, 0u)
<< "frame " << frame_count;
}
frame_count++;
}
}
}
// This unit test is used to validate the allocated size of compressed data // (ctx->cx_data) buffer, by feeding pseudo random input to the encoder in // lossless encoding mode. // // If compressed data buffer is not large enough, the av1_get_compressed_data() // call in av1/av1_cx_iface.c will overflow the buffer. class AV1LosslessFrameSizeTests
: public ::libaom_test::CodecTestWith2Params<FrameSizeParam,
::libaom_test::TestMode>, public ::libaom_test::EncoderTest { protected:
AV1LosslessFrameSizeTests()
: EncoderTest(GET_PARAM(0)), frame_size_param_(GET_PARAM(1)),
encoding_mode_(GET_PARAM(2)) {}
~AV1LosslessFrameSizeTests() override = default;
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.