Bug 1797755 - Part 5: Use a single initial mark stack size regardless of whether...
[gecko.git] / third_party / aom / test / frame_size_tests.cc
blobeaf0b8370a4d6bd61a6a3d33c7f22d7fed65a6bd
1 /*
2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
4 * This source code is subject to the terms of the BSD 2 Clause License and
5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 * was not distributed with this source code in the LICENSE file, you can
7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 * Media Patent License 1.0 was not distributed with this source code in the
9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
12 #include "third_party/googletest/src/googletest/include/gtest/gtest.h"
13 #include "test/codec_factory.h"
14 #include "test/video_source.h"
16 namespace {
18 class AV1FrameSizeTests : public ::testing::Test,
19 public ::libaom_test::EncoderTest {
20 protected:
21 AV1FrameSizeTests()
22 : EncoderTest(&::libaom_test::kAV1), expected_res_(AOM_CODEC_OK) {}
23 virtual ~AV1FrameSizeTests() {}
25 virtual void SetUp() {
26 InitializeConfig();
27 SetMode(::libaom_test::kRealTime);
30 virtual bool HandleDecodeResult(const aom_codec_err_t res_dec,
31 libaom_test::Decoder *decoder) {
32 EXPECT_EQ(expected_res_, res_dec) << decoder->DecodeError();
33 return !::testing::Test::HasFailure();
36 virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video,
37 ::libaom_test::Encoder *encoder) {
38 if (video->frame() == 1) {
39 encoder->Control(AOME_SET_CPUUSED, 7);
40 encoder->Control(AOME_SET_ENABLEAUTOALTREF, 1);
41 encoder->Control(AOME_SET_ARNR_MAXFRAMES, 7);
42 encoder->Control(AOME_SET_ARNR_STRENGTH, 5);
46 int expected_res_;
49 #if CONFIG_SIZE_LIMIT
50 TEST_F(AV1FrameSizeTests, TestInvalidSizes) {
51 ::libaom_test::RandomVideoSource video;
53 video.SetSize(DECODE_WIDTH_LIMIT + 16, DECODE_HEIGHT_LIMIT + 16);
54 video.set_limit(2);
55 expected_res_ = AOM_CODEC_CORRUPT_FRAME;
56 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
59 TEST_F(AV1FrameSizeTests, LargeValidSizes) {
60 ::libaom_test::RandomVideoSource video;
62 video.SetSize(DECODE_WIDTH_LIMIT, DECODE_HEIGHT_LIMIT);
63 video.set_limit(2);
64 expected_res_ = AOM_CODEC_OK;
65 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
67 #endif
69 TEST_F(AV1FrameSizeTests, OneByOneVideo) {
70 ::libaom_test::RandomVideoSource video;
72 video.SetSize(1, 1);
73 video.set_limit(2);
74 expected_res_ = AOM_CODEC_OK;
75 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
77 #undef ONE_BY_ONE_VIDEO_NAME
78 } // namespace