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"
18 class AV1FrameSizeTests
: public ::testing::Test
,
19 public ::libaom_test::EncoderTest
{
22 : EncoderTest(&::libaom_test::kAV1
), expected_res_(AOM_CODEC_OK
) {}
23 virtual ~AV1FrameSizeTests() {}
25 virtual void SetUp() {
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);
50 TEST_F(AV1FrameSizeTests
, TestInvalidSizes
) {
51 ::libaom_test::RandomVideoSource video
;
53 video
.SetSize(DECODE_WIDTH_LIMIT
+ 16, DECODE_HEIGHT_LIMIT
+ 16);
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
);
64 expected_res_
= AOM_CODEC_OK
;
65 ASSERT_NO_FATAL_FAILURE(RunLoop(&video
));
69 TEST_F(AV1FrameSizeTests
, OneByOneVideo
) {
70 ::libaom_test::RandomVideoSource video
;
74 expected_res_
= AOM_CODEC_OK
;
75 ASSERT_NO_FATAL_FAILURE(RunLoop(&video
));
77 #undef ONE_BY_ONE_VIDEO_NAME