1*77c1e3ccSAndroid Build Coastguard Worker /*
2*77c1e3ccSAndroid Build Coastguard Worker * Copyright (c) 2019, Alliance for Open Media. All rights reserved.
3*77c1e3ccSAndroid Build Coastguard Worker *
4*77c1e3ccSAndroid Build Coastguard Worker * This source code is subject to the terms of the BSD 2 Clause License and
5*77c1e3ccSAndroid Build Coastguard Worker * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6*77c1e3ccSAndroid Build Coastguard Worker * was not distributed with this source code in the LICENSE file, you can
7*77c1e3ccSAndroid Build Coastguard Worker * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8*77c1e3ccSAndroid Build Coastguard Worker * Media Patent License 1.0 was not distributed with this source code in the
9*77c1e3ccSAndroid Build Coastguard Worker * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10*77c1e3ccSAndroid Build Coastguard Worker */
11*77c1e3ccSAndroid Build Coastguard Worker
12*77c1e3ccSAndroid Build Coastguard Worker #include <climits>
13*77c1e3ccSAndroid Build Coastguard Worker #include <vector>
14*77c1e3ccSAndroid Build Coastguard Worker #include "config/aom_config.h"
15*77c1e3ccSAndroid Build Coastguard Worker #include "gtest/gtest.h"
16*77c1e3ccSAndroid Build Coastguard Worker #include "test/codec_factory.h"
17*77c1e3ccSAndroid Build Coastguard Worker #include "test/datarate_test.h"
18*77c1e3ccSAndroid Build Coastguard Worker #include "test/encode_test_driver.h"
19*77c1e3ccSAndroid Build Coastguard Worker #include "test/i420_video_source.h"
20*77c1e3ccSAndroid Build Coastguard Worker #include "test/util.h"
21*77c1e3ccSAndroid Build Coastguard Worker #include "test/y4m_video_source.h"
22*77c1e3ccSAndroid Build Coastguard Worker #include "aom/aom_codec.h"
23*77c1e3ccSAndroid Build Coastguard Worker #include "av1/common/enums.h"
24*77c1e3ccSAndroid Build Coastguard Worker #include "av1/encoder/encoder.h"
25*77c1e3ccSAndroid Build Coastguard Worker
26*77c1e3ccSAndroid Build Coastguard Worker namespace datarate_test {
27*77c1e3ccSAndroid Build Coastguard Worker namespace {
28*77c1e3ccSAndroid Build Coastguard Worker
29*77c1e3ccSAndroid Build Coastguard Worker struct FrameInfo {
FrameInfodatarate_test::__anon1e68b69d0111::FrameInfo30*77c1e3ccSAndroid Build Coastguard Worker FrameInfo(aom_codec_pts_t _pts, unsigned int _w, unsigned int _h)
31*77c1e3ccSAndroid Build Coastguard Worker : pts(_pts), w(_w), h(_h) {}
32*77c1e3ccSAndroid Build Coastguard Worker
33*77c1e3ccSAndroid Build Coastguard Worker aom_codec_pts_t pts;
34*77c1e3ccSAndroid Build Coastguard Worker unsigned int w;
35*77c1e3ccSAndroid Build Coastguard Worker unsigned int h;
36*77c1e3ccSAndroid Build Coastguard Worker };
37*77c1e3ccSAndroid Build Coastguard Worker
38*77c1e3ccSAndroid Build Coastguard Worker class DatarateTestSVC
39*77c1e3ccSAndroid Build Coastguard Worker : public ::libaom_test::CodecTestWith4Params<libaom_test::TestMode, int,
40*77c1e3ccSAndroid Build Coastguard Worker unsigned int, int>,
41*77c1e3ccSAndroid Build Coastguard Worker public DatarateTest {
42*77c1e3ccSAndroid Build Coastguard Worker public:
DatarateTestSVC()43*77c1e3ccSAndroid Build Coastguard Worker DatarateTestSVC() : DatarateTest(GET_PARAM(0)) {
44*77c1e3ccSAndroid Build Coastguard Worker set_cpu_used_ = GET_PARAM(2);
45*77c1e3ccSAndroid Build Coastguard Worker aq_mode_ = GET_PARAM(3);
46*77c1e3ccSAndroid Build Coastguard Worker }
47*77c1e3ccSAndroid Build Coastguard Worker
48*77c1e3ccSAndroid Build Coastguard Worker protected:
SetUp()49*77c1e3ccSAndroid Build Coastguard Worker void SetUp() override {
50*77c1e3ccSAndroid Build Coastguard Worker InitializeConfig(GET_PARAM(1));
51*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
52*77c1e3ccSAndroid Build Coastguard Worker }
53*77c1e3ccSAndroid Build Coastguard Worker
DecompressedFrameHook(const aom_image_t & img,aom_codec_pts_t pts)54*77c1e3ccSAndroid Build Coastguard Worker void DecompressedFrameHook(const aom_image_t &img,
55*77c1e3ccSAndroid Build Coastguard Worker aom_codec_pts_t pts) override {
56*77c1e3ccSAndroid Build Coastguard Worker frame_info_list_.push_back(FrameInfo(pts, img.d_w, img.d_h));
57*77c1e3ccSAndroid Build Coastguard Worker ++decoded_nframes_;
58*77c1e3ccSAndroid Build Coastguard Worker }
59*77c1e3ccSAndroid Build Coastguard Worker
60*77c1e3ccSAndroid Build Coastguard Worker std::vector<FrameInfo> frame_info_list_;
61*77c1e3ccSAndroid Build Coastguard Worker
GetNumSpatialLayers()62*77c1e3ccSAndroid Build Coastguard Worker int GetNumSpatialLayers() override { return number_spatial_layers_; }
63*77c1e3ccSAndroid Build Coastguard Worker
ResetModel()64*77c1e3ccSAndroid Build Coastguard Worker void ResetModel() override {
65*77c1e3ccSAndroid Build Coastguard Worker DatarateTest::ResetModel();
66*77c1e3ccSAndroid Build Coastguard Worker layer_frame_cnt_ = 0;
67*77c1e3ccSAndroid Build Coastguard Worker superframe_cnt_ = 0;
68*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 1;
69*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 1;
70*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < AOM_MAX_LAYERS; i++) {
71*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[i] = 0;
72*77c1e3ccSAndroid Build Coastguard Worker effective_datarate_tl[i] = 0.0;
73*77c1e3ccSAndroid Build Coastguard Worker }
74*77c1e3ccSAndroid Build Coastguard Worker memset(&layer_id_, 0, sizeof(aom_svc_layer_id_t));
75*77c1e3ccSAndroid Build Coastguard Worker memset(&svc_params_, 0, sizeof(aom_svc_params_t));
76*77c1e3ccSAndroid Build Coastguard Worker memset(&ref_frame_config_, 0, sizeof(aom_svc_ref_frame_config_t));
77*77c1e3ccSAndroid Build Coastguard Worker memset(&ref_frame_comp_pred_, 0, sizeof(aom_svc_ref_frame_comp_pred_t));
78*77c1e3ccSAndroid Build Coastguard Worker drop_frames_ = 0;
79*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < 1000; i++) drop_frames_list_[i] = 1000;
80*77c1e3ccSAndroid Build Coastguard Worker decoded_nframes_ = 0;
81*77c1e3ccSAndroid Build Coastguard Worker mismatch_nframes_ = 0;
82*77c1e3ccSAndroid Build Coastguard Worker mismatch_psnr_ = 0.0;
83*77c1e3ccSAndroid Build Coastguard Worker set_frame_level_er_ = 0;
84*77c1e3ccSAndroid Build Coastguard Worker multi_ref_ = 0;
85*77c1e3ccSAndroid Build Coastguard Worker use_fixed_mode_svc_ = 0;
86*77c1e3ccSAndroid Build Coastguard Worker comp_pred_ = 0;
87*77c1e3ccSAndroid Build Coastguard Worker dynamic_enable_disable_mode_ = 0;
88*77c1e3ccSAndroid Build Coastguard Worker intra_only_ = 0;
89*77c1e3ccSAndroid Build Coastguard Worker intra_only_single_layer_ = false;
90*77c1e3ccSAndroid Build Coastguard Worker frame_to_start_decoding_ = 0;
91*77c1e3ccSAndroid Build Coastguard Worker layer_to_decode_ = 0;
92*77c1e3ccSAndroid Build Coastguard Worker frame_sync_ = 0;
93*77c1e3ccSAndroid Build Coastguard Worker current_video_frame_ = 0;
94*77c1e3ccSAndroid Build Coastguard Worker screen_mode_ = 0;
95*77c1e3ccSAndroid Build Coastguard Worker rps_mode_ = 0;
96*77c1e3ccSAndroid Build Coastguard Worker rps_recovery_frame_ = 0;
97*77c1e3ccSAndroid Build Coastguard Worker user_define_frame_qp_ = 0;
98*77c1e3ccSAndroid Build Coastguard Worker set_speed_per_layer_ = false;
99*77c1e3ccSAndroid Build Coastguard Worker simulcast_mode_ = false;
100*77c1e3ccSAndroid Build Coastguard Worker use_last_as_scaled_ = false;
101*77c1e3ccSAndroid Build Coastguard Worker use_last_as_scaled_single_ref_ = false;
102*77c1e3ccSAndroid Build Coastguard Worker }
103*77c1e3ccSAndroid Build Coastguard Worker
PreEncodeFrameHook(::libaom_test::VideoSource * video,::libaom_test::Encoder * encoder)104*77c1e3ccSAndroid Build Coastguard Worker void PreEncodeFrameHook(::libaom_test::VideoSource *video,
105*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::Encoder *encoder) override {
106*77c1e3ccSAndroid Build Coastguard Worker int spatial_layer_id = 0;
107*77c1e3ccSAndroid Build Coastguard Worker current_video_frame_ = video->frame();
108*77c1e3ccSAndroid Build Coastguard Worker // video->frame() is called every superframe, so we should condition
109*77c1e3ccSAndroid Build Coastguard Worker // this on layer_frame_cnt_ = 0, so we only do this once on the very
110*77c1e3ccSAndroid Build Coastguard Worker // first frame.
111*77c1e3ccSAndroid Build Coastguard Worker if (video->frame() == 0 && layer_frame_cnt_ == 0) {
112*77c1e3ccSAndroid Build Coastguard Worker initialize_svc(number_temporal_layers_, number_spatial_layers_,
113*77c1e3ccSAndroid Build Coastguard Worker &svc_params_);
114*77c1e3ccSAndroid Build Coastguard Worker if (dynamic_enable_disable_mode_ == 1) {
115*77c1e3ccSAndroid Build Coastguard Worker svc_params_.layer_target_bitrate[2] = 0;
116*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate -= target_layer_bitrate_[2];
117*77c1e3ccSAndroid Build Coastguard Worker }
118*77c1e3ccSAndroid Build Coastguard Worker encoder->Control(AV1E_SET_SVC_PARAMS, &svc_params_);
119*77c1e3ccSAndroid Build Coastguard Worker // TODO(aomedia:3032): Configure KSVC in fixed mode.
120*77c1e3ccSAndroid Build Coastguard Worker encoder->Control(AV1E_SET_ENABLE_ORDER_HINT, 0);
121*77c1e3ccSAndroid Build Coastguard Worker encoder->Control(AV1E_SET_ENABLE_TPL_MODEL, 0);
122*77c1e3ccSAndroid Build Coastguard Worker encoder->Control(AV1E_SET_DELTAQ_MODE, 0);
123*77c1e3ccSAndroid Build Coastguard Worker if (cfg_.g_threads > 1) {
124*77c1e3ccSAndroid Build Coastguard Worker if (auto_tiles_) {
125*77c1e3ccSAndroid Build Coastguard Worker encoder->Control(AV1E_SET_AUTO_TILES, 1);
126*77c1e3ccSAndroid Build Coastguard Worker } else {
127*77c1e3ccSAndroid Build Coastguard Worker encoder->Control(AV1E_SET_TILE_COLUMNS, tile_columns_);
128*77c1e3ccSAndroid Build Coastguard Worker encoder->Control(AV1E_SET_TILE_ROWS, tile_rows_);
129*77c1e3ccSAndroid Build Coastguard Worker }
130*77c1e3ccSAndroid Build Coastguard Worker encoder->Control(AV1E_SET_ROW_MT, 1);
131*77c1e3ccSAndroid Build Coastguard Worker }
132*77c1e3ccSAndroid Build Coastguard Worker if (screen_mode_) {
133*77c1e3ccSAndroid Build Coastguard Worker encoder->Control(AV1E_SET_TUNE_CONTENT, AOM_CONTENT_SCREEN);
134*77c1e3ccSAndroid Build Coastguard Worker }
135*77c1e3ccSAndroid Build Coastguard Worker encoder->Control(AV1E_SET_POSTENCODE_DROP_RTC, 1);
136*77c1e3ccSAndroid Build Coastguard Worker }
137*77c1e3ccSAndroid Build Coastguard Worker if (number_spatial_layers_ == 2) {
138*77c1e3ccSAndroid Build Coastguard Worker spatial_layer_id = (layer_frame_cnt_ % 2 == 0) ? 0 : 1;
139*77c1e3ccSAndroid Build Coastguard Worker } else if (number_spatial_layers_ == 3) {
140*77c1e3ccSAndroid Build Coastguard Worker spatial_layer_id = (layer_frame_cnt_ % 3 == 0) ? 0
141*77c1e3ccSAndroid Build Coastguard Worker : ((layer_frame_cnt_ - 1) % 3 == 0) ? 1
142*77c1e3ccSAndroid Build Coastguard Worker : 2;
143*77c1e3ccSAndroid Build Coastguard Worker }
144*77c1e3ccSAndroid Build Coastguard Worker // Set the reference/update flags, layer_id, and reference_map
145*77c1e3ccSAndroid Build Coastguard Worker // buffer index.
146*77c1e3ccSAndroid Build Coastguard Worker frame_flags_ = set_layer_pattern(
147*77c1e3ccSAndroid Build Coastguard Worker video->frame(), &layer_id_, &ref_frame_config_, &ref_frame_comp_pred_,
148*77c1e3ccSAndroid Build Coastguard Worker spatial_layer_id, multi_ref_, comp_pred_,
149*77c1e3ccSAndroid Build Coastguard Worker (video->frame() % cfg_.kf_max_dist) == 0, dynamic_enable_disable_mode_,
150*77c1e3ccSAndroid Build Coastguard Worker rps_mode_, rps_recovery_frame_, simulcast_mode_, use_last_as_scaled_,
151*77c1e3ccSAndroid Build Coastguard Worker use_last_as_scaled_single_ref_);
152*77c1e3ccSAndroid Build Coastguard Worker if (intra_only_ == 1 && frame_sync_ > 0) {
153*77c1e3ccSAndroid Build Coastguard Worker // Set an Intra-only frame on SL0 at frame_sync_.
154*77c1e3ccSAndroid Build Coastguard Worker // In order to allow decoding to start on SL0 in mid-sequence we need to
155*77c1e3ccSAndroid Build Coastguard Worker // set and refresh all the slots used on SL0 stream, which is 0 and 3
156*77c1e3ccSAndroid Build Coastguard Worker // for this test pattern. The other slots (1, 2, 4, 5) are used for the
157*77c1e3ccSAndroid Build Coastguard Worker // SL > 0 layers and these slotes are not refreshed on frame_sync_, so
158*77c1e3ccSAndroid Build Coastguard Worker // temporal prediction for the top layers can continue.
159*77c1e3ccSAndroid Build Coastguard Worker if (spatial_layer_id == 0 && video->frame() == frame_sync_) {
160*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config_.ref_idx[0] = 0;
161*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config_.ref_idx[3] = 3;
162*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config_.refresh[0] = 1;
163*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config_.refresh[3] = 1;
164*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < INTER_REFS_PER_FRAME; i++)
165*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config_.reference[i] = 0;
166*77c1e3ccSAndroid Build Coastguard Worker }
167*77c1e3ccSAndroid Build Coastguard Worker }
168*77c1e3ccSAndroid Build Coastguard Worker if (intra_only_ && video->frame() == 50 && spatial_layer_id == 1) {
169*77c1e3ccSAndroid Build Coastguard Worker // Force an intra_only frame here, for SL1.
170*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < INTER_REFS_PER_FRAME; i++)
171*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config_.reference[i] = 0;
172*77c1e3ccSAndroid Build Coastguard Worker }
173*77c1e3ccSAndroid Build Coastguard Worker encoder->Control(AV1E_SET_SVC_LAYER_ID, &layer_id_);
174*77c1e3ccSAndroid Build Coastguard Worker // The SET_SVC_REF_FRAME_CONFIG and AV1E_SET_SVC_REF_FRAME_COMP_PRED api is
175*77c1e3ccSAndroid Build Coastguard Worker // for the flexible SVC mode (i.e., use_fixed_mode_svc == 0).
176*77c1e3ccSAndroid Build Coastguard Worker if (!use_fixed_mode_svc_) {
177*77c1e3ccSAndroid Build Coastguard Worker encoder->Control(AV1E_SET_SVC_REF_FRAME_CONFIG, &ref_frame_config_);
178*77c1e3ccSAndroid Build Coastguard Worker encoder->Control(AV1E_SET_SVC_REF_FRAME_COMP_PRED, &ref_frame_comp_pred_);
179*77c1e3ccSAndroid Build Coastguard Worker }
180*77c1e3ccSAndroid Build Coastguard Worker if (set_speed_per_layer_) {
181*77c1e3ccSAndroid Build Coastguard Worker int speed_per_layer = 10;
182*77c1e3ccSAndroid Build Coastguard Worker if (layer_id_.spatial_layer_id == 0) {
183*77c1e3ccSAndroid Build Coastguard Worker // For for base SL0,TL0: use the speed the test loops over.
184*77c1e3ccSAndroid Build Coastguard Worker if (layer_id_.temporal_layer_id == 1) speed_per_layer = 7;
185*77c1e3ccSAndroid Build Coastguard Worker if (layer_id_.temporal_layer_id == 2) speed_per_layer = 8;
186*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id_.spatial_layer_id == 1) {
187*77c1e3ccSAndroid Build Coastguard Worker if (layer_id_.temporal_layer_id == 0) speed_per_layer = 7;
188*77c1e3ccSAndroid Build Coastguard Worker if (layer_id_.temporal_layer_id == 1) speed_per_layer = 8;
189*77c1e3ccSAndroid Build Coastguard Worker if (layer_id_.temporal_layer_id == 2) speed_per_layer = 9;
190*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id_.spatial_layer_id == 2) {
191*77c1e3ccSAndroid Build Coastguard Worker if (layer_id_.temporal_layer_id == 0) speed_per_layer = 8;
192*77c1e3ccSAndroid Build Coastguard Worker if (layer_id_.temporal_layer_id == 1) speed_per_layer = 9;
193*77c1e3ccSAndroid Build Coastguard Worker if (layer_id_.temporal_layer_id == 2) speed_per_layer = 10;
194*77c1e3ccSAndroid Build Coastguard Worker }
195*77c1e3ccSAndroid Build Coastguard Worker encoder->Control(AOME_SET_CPUUSED, speed_per_layer);
196*77c1e3ccSAndroid Build Coastguard Worker }
197*77c1e3ccSAndroid Build Coastguard Worker if (set_frame_level_er_) {
198*77c1e3ccSAndroid Build Coastguard Worker int mode =
199*77c1e3ccSAndroid Build Coastguard Worker (layer_id_.spatial_layer_id > 0 || layer_id_.temporal_layer_id > 0);
200*77c1e3ccSAndroid Build Coastguard Worker encoder->Control(AV1E_SET_ERROR_RESILIENT_MODE, mode);
201*77c1e3ccSAndroid Build Coastguard Worker }
202*77c1e3ccSAndroid Build Coastguard Worker if (dynamic_enable_disable_mode_ == 1) {
203*77c1e3ccSAndroid Build Coastguard Worker if (layer_frame_cnt_ == 300 && spatial_layer_id == 0) {
204*77c1e3ccSAndroid Build Coastguard Worker // Enable: set top spatial layer bitrate back to non-zero.
205*77c1e3ccSAndroid Build Coastguard Worker svc_params_.layer_target_bitrate[2] = target_layer_bitrate_[2];
206*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate += target_layer_bitrate_[2];
207*77c1e3ccSAndroid Build Coastguard Worker encoder->Config(&cfg_);
208*77c1e3ccSAndroid Build Coastguard Worker encoder->Control(AV1E_SET_SVC_PARAMS, &svc_params_);
209*77c1e3ccSAndroid Build Coastguard Worker }
210*77c1e3ccSAndroid Build Coastguard Worker } else if (dynamic_enable_disable_mode_ == 2) {
211*77c1e3ccSAndroid Build Coastguard Worker if (layer_frame_cnt_ == 300 && spatial_layer_id == 0) {
212*77c1e3ccSAndroid Build Coastguard Worker // Disable top spatial layer mid-stream.
213*77c1e3ccSAndroid Build Coastguard Worker svc_params_.layer_target_bitrate[2] = 0;
214*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate -= target_layer_bitrate_[2];
215*77c1e3ccSAndroid Build Coastguard Worker encoder->Config(&cfg_);
216*77c1e3ccSAndroid Build Coastguard Worker encoder->Control(AV1E_SET_SVC_PARAMS, &svc_params_);
217*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_frame_cnt_ == 600 && spatial_layer_id == 0) {
218*77c1e3ccSAndroid Build Coastguard Worker // Enable top spatial layer mid-stream.
219*77c1e3ccSAndroid Build Coastguard Worker svc_params_.layer_target_bitrate[2] = target_layer_bitrate_[2];
220*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate += target_layer_bitrate_[2];
221*77c1e3ccSAndroid Build Coastguard Worker encoder->Config(&cfg_);
222*77c1e3ccSAndroid Build Coastguard Worker encoder->Control(AV1E_SET_SVC_PARAMS, &svc_params_);
223*77c1e3ccSAndroid Build Coastguard Worker }
224*77c1e3ccSAndroid Build Coastguard Worker }
225*77c1e3ccSAndroid Build Coastguard Worker layer_frame_cnt_++;
226*77c1e3ccSAndroid Build Coastguard Worker DatarateTest::PreEncodeFrameHook(video, encoder);
227*77c1e3ccSAndroid Build Coastguard Worker
228*77c1e3ccSAndroid Build Coastguard Worker if (user_define_frame_qp_) {
229*77c1e3ccSAndroid Build Coastguard Worker frame_qp_ = rnd_.PseudoUniform(63);
230*77c1e3ccSAndroid Build Coastguard Worker encoder->Control(AV1E_SET_QUANTIZER_ONE_PASS, frame_qp_);
231*77c1e3ccSAndroid Build Coastguard Worker }
232*77c1e3ccSAndroid Build Coastguard Worker }
233*77c1e3ccSAndroid Build Coastguard Worker
PostEncodeFrameHook(::libaom_test::Encoder * encoder)234*77c1e3ccSAndroid Build Coastguard Worker void PostEncodeFrameHook(::libaom_test::Encoder *encoder) override {
235*77c1e3ccSAndroid Build Coastguard Worker int num_operating_points;
236*77c1e3ccSAndroid Build Coastguard Worker encoder->Control(AV1E_GET_NUM_OPERATING_POINTS, &num_operating_points);
237*77c1e3ccSAndroid Build Coastguard Worker ASSERT_EQ(num_operating_points,
238*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ * number_spatial_layers_);
239*77c1e3ccSAndroid Build Coastguard Worker
240*77c1e3ccSAndroid Build Coastguard Worker if (user_define_frame_qp_) {
241*77c1e3ccSAndroid Build Coastguard Worker if (current_video_frame_ >= static_cast<unsigned int>(total_frame_))
242*77c1e3ccSAndroid Build Coastguard Worker return;
243*77c1e3ccSAndroid Build Coastguard Worker int qp;
244*77c1e3ccSAndroid Build Coastguard Worker encoder->Control(AOME_GET_LAST_QUANTIZER_64, &qp);
245*77c1e3ccSAndroid Build Coastguard Worker ASSERT_EQ(qp, frame_qp_);
246*77c1e3ccSAndroid Build Coastguard Worker }
247*77c1e3ccSAndroid Build Coastguard Worker }
248*77c1e3ccSAndroid Build Coastguard Worker
FramePktHook(const aom_codec_cx_pkt_t * pkt)249*77c1e3ccSAndroid Build Coastguard Worker void FramePktHook(const aom_codec_cx_pkt_t *pkt) override {
250*77c1e3ccSAndroid Build Coastguard Worker const size_t frame_size_in_bits = pkt->data.frame.sz * 8;
251*77c1e3ccSAndroid Build Coastguard Worker // Update the layer cumulative bitrate.
252*77c1e3ccSAndroid Build Coastguard Worker for (int i = layer_id_.temporal_layer_id; i < number_temporal_layers_;
253*77c1e3ccSAndroid Build Coastguard Worker i++) {
254*77c1e3ccSAndroid Build Coastguard Worker int layer = layer_id_.spatial_layer_id * number_temporal_layers_ + i;
255*77c1e3ccSAndroid Build Coastguard Worker effective_datarate_tl[layer] += 1.0 * frame_size_in_bits;
256*77c1e3ccSAndroid Build Coastguard Worker }
257*77c1e3ccSAndroid Build Coastguard Worker if (layer_id_.spatial_layer_id == number_spatial_layers_ - 1) {
258*77c1e3ccSAndroid Build Coastguard Worker last_pts_ = pkt->data.frame.pts;
259*77c1e3ccSAndroid Build Coastguard Worker superframe_cnt_++;
260*77c1e3ccSAndroid Build Coastguard Worker }
261*77c1e3ccSAndroid Build Coastguard Worker // For simulcast mode: verify that for first frame to start decoding,
262*77c1e3ccSAndroid Build Coastguard Worker // for SL > 0, are Intra-only frames (not Key), whereas SL0 is Key.
263*77c1e3ccSAndroid Build Coastguard Worker if (simulcast_mode_ && superframe_cnt_ == (int)frame_to_start_decoding_) {
264*77c1e3ccSAndroid Build Coastguard Worker if (layer_id_.spatial_layer_id > 0) {
265*77c1e3ccSAndroid Build Coastguard Worker EXPECT_NE(pkt->data.frame.flags & AOM_FRAME_IS_KEY, AOM_FRAME_IS_KEY);
266*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id_.spatial_layer_id == 0) {
267*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ(pkt->data.frame.flags & AOM_FRAME_IS_KEY, AOM_FRAME_IS_KEY);
268*77c1e3ccSAndroid Build Coastguard Worker }
269*77c1e3ccSAndroid Build Coastguard Worker }
270*77c1e3ccSAndroid Build Coastguard Worker }
271*77c1e3ccSAndroid Build Coastguard Worker
EndPassHook()272*77c1e3ccSAndroid Build Coastguard Worker void EndPassHook() override {
273*77c1e3ccSAndroid Build Coastguard Worker duration_ = ((last_pts_ + 1) * timebase_);
274*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
275*77c1e3ccSAndroid Build Coastguard Worker effective_datarate_tl[i] = (effective_datarate_tl[i] / 1000) / duration_;
276*77c1e3ccSAndroid Build Coastguard Worker }
277*77c1e3ccSAndroid Build Coastguard Worker }
278*77c1e3ccSAndroid Build Coastguard Worker
DoDecode() const279*77c1e3ccSAndroid Build Coastguard Worker bool DoDecode() const override {
280*77c1e3ccSAndroid Build Coastguard Worker if (drop_frames_ > 0) {
281*77c1e3ccSAndroid Build Coastguard Worker for (unsigned int i = 0; i < drop_frames_; ++i) {
282*77c1e3ccSAndroid Build Coastguard Worker if (drop_frames_list_[i] == (unsigned int)superframe_cnt_) {
283*77c1e3ccSAndroid Build Coastguard Worker std::cout << " Skipping decoding frame: "
284*77c1e3ccSAndroid Build Coastguard Worker << drop_frames_list_[i] << "\n";
285*77c1e3ccSAndroid Build Coastguard Worker return false;
286*77c1e3ccSAndroid Build Coastguard Worker }
287*77c1e3ccSAndroid Build Coastguard Worker }
288*77c1e3ccSAndroid Build Coastguard Worker } else if (intra_only_ == 1) {
289*77c1e3ccSAndroid Build Coastguard Worker // Only start decoding at frames_to_start_decoding_.
290*77c1e3ccSAndroid Build Coastguard Worker if (current_video_frame_ < frame_to_start_decoding_) return false;
291*77c1e3ccSAndroid Build Coastguard Worker // Only decode base layer for 3SL, for layer_to_decode_ = 0.
292*77c1e3ccSAndroid Build Coastguard Worker if (layer_to_decode_ == 0 && frame_sync_ > 0 &&
293*77c1e3ccSAndroid Build Coastguard Worker (layer_frame_cnt_ - 1) % 3 != 0)
294*77c1e3ccSAndroid Build Coastguard Worker return false;
295*77c1e3ccSAndroid Build Coastguard Worker } else if (simulcast_mode_) {
296*77c1e3ccSAndroid Build Coastguard Worker // Only start decoding at frames_to_start_decoding_ and only
297*77c1e3ccSAndroid Build Coastguard Worker // for top spatial layer SL2 (layer_to_decode_).
298*77c1e3ccSAndroid Build Coastguard Worker if (current_video_frame_ < frame_to_start_decoding_) return false;
299*77c1e3ccSAndroid Build Coastguard Worker if (layer_id_.spatial_layer_id < (int)layer_to_decode_) return false;
300*77c1e3ccSAndroid Build Coastguard Worker }
301*77c1e3ccSAndroid Build Coastguard Worker return true;
302*77c1e3ccSAndroid Build Coastguard Worker }
303*77c1e3ccSAndroid Build Coastguard Worker
MismatchHook(const aom_image_t * img1,const aom_image_t * img2)304*77c1e3ccSAndroid Build Coastguard Worker void MismatchHook(const aom_image_t *img1, const aom_image_t *img2) override {
305*77c1e3ccSAndroid Build Coastguard Worker double mismatch_psnr = compute_psnr(img1, img2);
306*77c1e3ccSAndroid Build Coastguard Worker mismatch_psnr_ += mismatch_psnr;
307*77c1e3ccSAndroid Build Coastguard Worker ++mismatch_nframes_;
308*77c1e3ccSAndroid Build Coastguard Worker }
309*77c1e3ccSAndroid Build Coastguard Worker
GetMismatchFrames()310*77c1e3ccSAndroid Build Coastguard Worker unsigned int GetMismatchFrames() { return mismatch_nframes_; }
GetDecodedFrames()311*77c1e3ccSAndroid Build Coastguard Worker unsigned int GetDecodedFrames() { return decoded_nframes_; }
312*77c1e3ccSAndroid Build Coastguard Worker
ref_config_rps(aom_svc_ref_frame_config_t * ref_frame_config,int frame_cnt,int rps_recovery_frame)313*77c1e3ccSAndroid Build Coastguard Worker static void ref_config_rps(aom_svc_ref_frame_config_t *ref_frame_config,
314*77c1e3ccSAndroid Build Coastguard Worker int frame_cnt, int rps_recovery_frame) {
315*77c1e3ccSAndroid Build Coastguard Worker // Pattern of 3 references with (ALTREF and GOLDEN) trailing
316*77c1e3ccSAndroid Build Coastguard Worker // LAST by 4 and 8 frame, with some switching logic to
317*77c1e3ccSAndroid Build Coastguard Worker // only predict from longer-term reference.
318*77c1e3ccSAndroid Build Coastguard Worker int last_idx = 0;
319*77c1e3ccSAndroid Build Coastguard Worker int last_idx_refresh = 0;
320*77c1e3ccSAndroid Build Coastguard Worker int gld_idx = 0;
321*77c1e3ccSAndroid Build Coastguard Worker int alt_ref_idx = 0;
322*77c1e3ccSAndroid Build Coastguard Worker const int lag_alt = 4;
323*77c1e3ccSAndroid Build Coastguard Worker const int lag_gld = 8;
324*77c1e3ccSAndroid Build Coastguard Worker const int sh = 8; // slots 0 - 7.
325*77c1e3ccSAndroid Build Coastguard Worker // Moving index slot for last: 0 - (sh - 1)
326*77c1e3ccSAndroid Build Coastguard Worker if (frame_cnt > 1) last_idx = (frame_cnt - 1) % sh;
327*77c1e3ccSAndroid Build Coastguard Worker // Moving index for refresh of last: one ahead for next frame.
328*77c1e3ccSAndroid Build Coastguard Worker last_idx_refresh = frame_cnt % sh;
329*77c1e3ccSAndroid Build Coastguard Worker // Moving index for gld_ref, lag behind current by lag_gld
330*77c1e3ccSAndroid Build Coastguard Worker if (frame_cnt > lag_gld) gld_idx = (frame_cnt - lag_gld) % sh;
331*77c1e3ccSAndroid Build Coastguard Worker // Moving index for alt_ref, lag behind LAST by lag_alt frames.
332*77c1e3ccSAndroid Build Coastguard Worker if (frame_cnt > lag_alt) alt_ref_idx = (frame_cnt - lag_alt) % sh;
333*77c1e3ccSAndroid Build Coastguard Worker // Set the ref_idx.
334*77c1e3ccSAndroid Build Coastguard Worker // Default all references (7) to slot for last.
335*77c1e3ccSAndroid Build Coastguard Worker // LAST_FRAME (0), LAST2_FRAME(1), LAST3_FRAME(2), GOLDEN_FRAME(3),
336*77c1e3ccSAndroid Build Coastguard Worker // BWDREF_FRAME(4), ALTREF2_FRAME(5), ALTREF_FRAME(6).
337*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < INTER_REFS_PER_FRAME; i++)
338*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[i] = last_idx;
339*77c1e3ccSAndroid Build Coastguard Worker // Set the ref_idx for the relevant references.
340*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = last_idx;
341*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[1] = last_idx_refresh;
342*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[3] = gld_idx;
343*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[6] = alt_ref_idx;
344*77c1e3ccSAndroid Build Coastguard Worker // Refresh this slot, which will become LAST on next frame.
345*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[last_idx_refresh] = 1;
346*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST, ALTREF, and GOLDEN
347*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[0] = 1;
348*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[6] = 1;
349*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[3] = 1;
350*77c1e3ccSAndroid Build Coastguard Worker if (frame_cnt == rps_recovery_frame) {
351*77c1e3ccSAndroid Build Coastguard Worker // Switch to only reference GOLDEN at recovery_frame.
352*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[0] = 0;
353*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[6] = 0;
354*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[3] = 1;
355*77c1e3ccSAndroid Build Coastguard Worker } else if (frame_cnt > rps_recovery_frame &&
356*77c1e3ccSAndroid Build Coastguard Worker frame_cnt < rps_recovery_frame + 8) {
357*77c1e3ccSAndroid Build Coastguard Worker // Go back to predicting from LAST, and after
358*77c1e3ccSAndroid Build Coastguard Worker // 8 frames (GOLDEN is 8 frames aways) go back
359*77c1e3ccSAndroid Build Coastguard Worker // to predicting off GOLDEN and ALTREF.
360*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[0] = 1;
361*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[6] = 0;
362*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[3] = 0;
363*77c1e3ccSAndroid Build Coastguard Worker }
364*77c1e3ccSAndroid Build Coastguard Worker }
365*77c1e3ccSAndroid Build Coastguard Worker
366*77c1e3ccSAndroid Build Coastguard Worker // Simulcast mode for 3 spatial and 3 temporal layers.
367*77c1e3ccSAndroid Build Coastguard Worker // No inter-layer predicton, only prediction is temporal and single
368*77c1e3ccSAndroid Build Coastguard Worker // reference (LAST).
369*77c1e3ccSAndroid Build Coastguard Worker // No overlap in buffer slots between spatial layers. So for example,
370*77c1e3ccSAndroid Build Coastguard Worker // SL0 only uses slots 0 and 1.
371*77c1e3ccSAndroid Build Coastguard Worker // SL1 only uses slots 2 and 3.
372*77c1e3ccSAndroid Build Coastguard Worker // SL2 only uses slots 4 and 5.
373*77c1e3ccSAndroid Build Coastguard Worker // All 7 references for each inter-frame must only access buffer slots
374*77c1e3ccSAndroid Build Coastguard Worker // for that spatial layer.
375*77c1e3ccSAndroid Build Coastguard Worker // On key (super)frames: SL1 and SL2 must have no references set
376*77c1e3ccSAndroid Build Coastguard Worker // and must refresh all the slots for that layer only (so 2 and 3
377*77c1e3ccSAndroid Build Coastguard Worker // for SL1, 4 and 5 for SL2). The base SL0 will be labelled internally
378*77c1e3ccSAndroid Build Coastguard Worker // as a Key frame (refresh all slots). SL1/SL2 will be labelled
379*77c1e3ccSAndroid Build Coastguard Worker // internally as Intra-only frames that allow that stream to be decoded.
380*77c1e3ccSAndroid Build Coastguard Worker // These conditions will allow for each spatial stream to be
381*77c1e3ccSAndroid Build Coastguard Worker // independently decodeable.
ref_config_simulcast3SL3TL(aom_svc_ref_frame_config_t * ref_frame_config,aom_svc_layer_id_t * layer_id,int is_key_frame,int superframe_cnt)382*77c1e3ccSAndroid Build Coastguard Worker static void ref_config_simulcast3SL3TL(
383*77c1e3ccSAndroid Build Coastguard Worker aom_svc_ref_frame_config_t *ref_frame_config,
384*77c1e3ccSAndroid Build Coastguard Worker aom_svc_layer_id_t *layer_id, int is_key_frame, int superframe_cnt) {
385*77c1e3ccSAndroid Build Coastguard Worker int i;
386*77c1e3ccSAndroid Build Coastguard Worker // Initialize all references to 0 (don't use reference).
387*77c1e3ccSAndroid Build Coastguard Worker for (i = 0; i < INTER_REFS_PER_FRAME; i++)
388*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[i] = 0;
389*77c1e3ccSAndroid Build Coastguard Worker // Initialize as no refresh/update for all slots.
390*77c1e3ccSAndroid Build Coastguard Worker for (i = 0; i < REF_FRAMES; i++) ref_frame_config->refresh[i] = 0;
391*77c1e3ccSAndroid Build Coastguard Worker for (i = 0; i < INTER_REFS_PER_FRAME; i++) ref_frame_config->ref_idx[i] = 0;
392*77c1e3ccSAndroid Build Coastguard Worker
393*77c1e3ccSAndroid Build Coastguard Worker if (is_key_frame) {
394*77c1e3ccSAndroid Build Coastguard Worker if (layer_id->spatial_layer_id == 0) {
395*77c1e3ccSAndroid Build Coastguard Worker // Assign LAST/GOLDEN to slot 0/1.
396*77c1e3ccSAndroid Build Coastguard Worker // Refesh slots 0 and 1 for SL0.
397*77c1e3ccSAndroid Build Coastguard Worker // SL0: this will get set to KEY frame internally.
398*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 0;
399*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[3] = 1;
400*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[0] = 1;
401*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[1] = 1;
402*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id->spatial_layer_id == 1) {
403*77c1e3ccSAndroid Build Coastguard Worker // Assign LAST/GOLDEN to slot 2/3.
404*77c1e3ccSAndroid Build Coastguard Worker // Refesh slots 2 and 3 for SL1.
405*77c1e3ccSAndroid Build Coastguard Worker // This will get set to Intra-only frame internally.
406*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 2;
407*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[3] = 3;
408*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[2] = 1;
409*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[3] = 1;
410*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id->spatial_layer_id == 2) {
411*77c1e3ccSAndroid Build Coastguard Worker // Assign LAST/GOLDEN to slot 4/5.
412*77c1e3ccSAndroid Build Coastguard Worker // Refresh slots 4 and 5 for SL2.
413*77c1e3ccSAndroid Build Coastguard Worker // This will get set to Intra-only frame internally.
414*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 4;
415*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[3] = 5;
416*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[4] = 1;
417*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[5] = 1;
418*77c1e3ccSAndroid Build Coastguard Worker }
419*77c1e3ccSAndroid Build Coastguard Worker } else if (superframe_cnt % 4 == 0) {
420*77c1e3ccSAndroid Build Coastguard Worker // Base temporal layer: TL0
421*77c1e3ccSAndroid Build Coastguard Worker layer_id->temporal_layer_id = 0;
422*77c1e3ccSAndroid Build Coastguard Worker if (layer_id->spatial_layer_id == 0) { // SL0
423*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST. Assign all references to either slot
424*77c1e3ccSAndroid Build Coastguard Worker // 0 or 1. Here we assign LAST to slot 0, all others to 1.
425*77c1e3ccSAndroid Build Coastguard Worker // Update slot 0 (LAST).
426*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[0] = 1;
427*77c1e3ccSAndroid Build Coastguard Worker for (i = 0; i < INTER_REFS_PER_FRAME; i++)
428*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[i] = 1;
429*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 0;
430*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[0] = 1;
431*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id->spatial_layer_id == 1) { // SL1
432*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST. Assign all references to either slot
433*77c1e3ccSAndroid Build Coastguard Worker // 2 or 3. Here we assign LAST to slot 2, all others to 3.
434*77c1e3ccSAndroid Build Coastguard Worker // Update slot 2 (LAST).
435*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[0] = 1;
436*77c1e3ccSAndroid Build Coastguard Worker for (i = 0; i < INTER_REFS_PER_FRAME; i++)
437*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[i] = 3;
438*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 2;
439*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[2] = 1;
440*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id->spatial_layer_id == 2) { // SL2
441*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST. Assign all references to either slot
442*77c1e3ccSAndroid Build Coastguard Worker // 4 or 5. Here we assign LAST to slot 4, all others to 5.
443*77c1e3ccSAndroid Build Coastguard Worker // Update slot 4 (LAST).
444*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[0] = 1;
445*77c1e3ccSAndroid Build Coastguard Worker for (i = 0; i < INTER_REFS_PER_FRAME; i++)
446*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[i] = 5;
447*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 4;
448*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[4] = 1;
449*77c1e3ccSAndroid Build Coastguard Worker }
450*77c1e3ccSAndroid Build Coastguard Worker } else if ((superframe_cnt - 1) % 4 == 0) {
451*77c1e3ccSAndroid Build Coastguard Worker // First top temporal enhancement layer: TL2
452*77c1e3ccSAndroid Build Coastguard Worker layer_id->temporal_layer_id = 2;
453*77c1e3ccSAndroid Build Coastguard Worker if (layer_id->spatial_layer_id == 0) { // SL0
454*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST (slot 0). Assign other references to slot 1.
455*77c1e3ccSAndroid Build Coastguard Worker // No update/refresh on any slots.
456*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[0] = 1;
457*77c1e3ccSAndroid Build Coastguard Worker for (i = 0; i < INTER_REFS_PER_FRAME; i++)
458*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[i] = 1;
459*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 0;
460*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id->spatial_layer_id == 1) { // SL1
461*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST (slot 2). Assign other references to slot 3.
462*77c1e3ccSAndroid Build Coastguard Worker // No update/refresh on any slots.
463*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[0] = 1;
464*77c1e3ccSAndroid Build Coastguard Worker for (i = 0; i < INTER_REFS_PER_FRAME; i++)
465*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[i] = 3;
466*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 2;
467*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id->spatial_layer_id == 2) { // SL2
468*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST (slot 4). Assign other references to slot 4.
469*77c1e3ccSAndroid Build Coastguard Worker // No update/refresh on any slots.
470*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[0] = 1;
471*77c1e3ccSAndroid Build Coastguard Worker for (i = 0; i < INTER_REFS_PER_FRAME; i++)
472*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[i] = 5;
473*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 4;
474*77c1e3ccSAndroid Build Coastguard Worker }
475*77c1e3ccSAndroid Build Coastguard Worker } else if ((superframe_cnt - 2) % 4 == 0) {
476*77c1e3ccSAndroid Build Coastguard Worker // Middle temporal enhancement layer: TL1
477*77c1e3ccSAndroid Build Coastguard Worker layer_id->temporal_layer_id = 1;
478*77c1e3ccSAndroid Build Coastguard Worker if (layer_id->spatial_layer_id == 0) { // SL0
479*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST (slot 0).
480*77c1e3ccSAndroid Build Coastguard Worker // Set GOLDEN to slot 1 and update slot 1.
481*77c1e3ccSAndroid Build Coastguard Worker // This will be used as reference for next TL2.
482*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[0] = 1;
483*77c1e3ccSAndroid Build Coastguard Worker for (i = 0; i < INTER_REFS_PER_FRAME; i++)
484*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[i] = 1;
485*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 0;
486*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[1] = 1;
487*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id->spatial_layer_id == 1) { // SL1
488*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST (slot 2).
489*77c1e3ccSAndroid Build Coastguard Worker // Set GOLDEN to slot 3 and update slot 3.
490*77c1e3ccSAndroid Build Coastguard Worker // This will be used as reference for next TL2.
491*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[0] = 1;
492*77c1e3ccSAndroid Build Coastguard Worker for (i = 0; i < INTER_REFS_PER_FRAME; i++)
493*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[i] = 3;
494*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 2;
495*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[3] = 1;
496*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id->spatial_layer_id == 2) { // SL2
497*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST (slot 4).
498*77c1e3ccSAndroid Build Coastguard Worker // Set GOLDEN to slot 5 and update slot 5.
499*77c1e3ccSAndroid Build Coastguard Worker // This will be used as reference for next TL2.
500*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[0] = 1;
501*77c1e3ccSAndroid Build Coastguard Worker for (i = 0; i < INTER_REFS_PER_FRAME; i++)
502*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[i] = 5;
503*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 4;
504*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[5] = 1;
505*77c1e3ccSAndroid Build Coastguard Worker }
506*77c1e3ccSAndroid Build Coastguard Worker } else if ((superframe_cnt - 3) % 4 == 0) {
507*77c1e3ccSAndroid Build Coastguard Worker // Second top temporal enhancement layer: TL2
508*77c1e3ccSAndroid Build Coastguard Worker layer_id->temporal_layer_id = 2;
509*77c1e3ccSAndroid Build Coastguard Worker if (layer_id->spatial_layer_id == 0) { // SL0
510*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST (slot 1). Assign other references to slot 0.
511*77c1e3ccSAndroid Build Coastguard Worker // No update/refresh on any slots.
512*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[0] = 1;
513*77c1e3ccSAndroid Build Coastguard Worker for (i = 0; i < INTER_REFS_PER_FRAME; i++)
514*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[i] = 0;
515*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 1;
516*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id->spatial_layer_id == 1) { // SL1
517*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST (slot 3). Assign other references to slot 2.
518*77c1e3ccSAndroid Build Coastguard Worker // No update/refresh on any slots.
519*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[0] = 1;
520*77c1e3ccSAndroid Build Coastguard Worker for (i = 0; i < INTER_REFS_PER_FRAME; i++)
521*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[i] = 2;
522*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 3;
523*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id->spatial_layer_id == 2) { // SL2
524*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST (slot 5). Assign other references to slot 4.
525*77c1e3ccSAndroid Build Coastguard Worker // No update/refresh on any slots.
526*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[0] = 1;
527*77c1e3ccSAndroid Build Coastguard Worker for (i = 0; i < INTER_REFS_PER_FRAME; i++)
528*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[i] = 4;
529*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 5;
530*77c1e3ccSAndroid Build Coastguard Worker }
531*77c1e3ccSAndroid Build Coastguard Worker }
532*77c1e3ccSAndroid Build Coastguard Worker }
533*77c1e3ccSAndroid Build Coastguard Worker
534*77c1e3ccSAndroid Build Coastguard Worker // 3 spatial and 3 temporal layer.
535*77c1e3ccSAndroid Build Coastguard Worker // Overlap in the buffer slot updates: the slots 3 and 4 updated by
536*77c1e3ccSAndroid Build Coastguard Worker // first TL2 are reused for update in TL1 superframe.
ref_config_3SL3TL(aom_svc_ref_frame_config_t * ref_frame_config,aom_svc_layer_id_t * layer_id,int is_key_frame,int superframe_cnt)537*77c1e3ccSAndroid Build Coastguard Worker static void ref_config_3SL3TL(aom_svc_ref_frame_config_t *ref_frame_config,
538*77c1e3ccSAndroid Build Coastguard Worker aom_svc_layer_id_t *layer_id, int is_key_frame,
539*77c1e3ccSAndroid Build Coastguard Worker int superframe_cnt) {
540*77c1e3ccSAndroid Build Coastguard Worker if (superframe_cnt % 4 == 0) {
541*77c1e3ccSAndroid Build Coastguard Worker // Base temporal layer.
542*77c1e3ccSAndroid Build Coastguard Worker layer_id->temporal_layer_id = 0;
543*77c1e3ccSAndroid Build Coastguard Worker if (layer_id->spatial_layer_id == 0) {
544*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST, update LAST.
545*77c1e3ccSAndroid Build Coastguard Worker // Set all buffer_idx to 0.
546*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 0;
547*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[0] = 1;
548*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id->spatial_layer_id == 1) {
549*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST and GOLDEN. Set buffer_idx for LAST to slot 1,
550*77c1e3ccSAndroid Build Coastguard Worker // GOLDEN (and all other refs) to slot 0.
551*77c1e3ccSAndroid Build Coastguard Worker // Update slot 1 (LAST).
552*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 0;
553*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 1;
554*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[1] = 1;
555*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id->spatial_layer_id == 2) {
556*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST and GOLDEN. Set buffer_idx for LAST to slot 2,
557*77c1e3ccSAndroid Build Coastguard Worker // GOLDEN (and all other refs) to slot 1.
558*77c1e3ccSAndroid Build Coastguard Worker // Update slot 2 (LAST).
559*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 1;
560*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 2;
561*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[2] = 1;
562*77c1e3ccSAndroid Build Coastguard Worker }
563*77c1e3ccSAndroid Build Coastguard Worker } else if ((superframe_cnt - 1) % 4 == 0) {
564*77c1e3ccSAndroid Build Coastguard Worker // First top temporal enhancement layer.
565*77c1e3ccSAndroid Build Coastguard Worker layer_id->temporal_layer_id = 2;
566*77c1e3ccSAndroid Build Coastguard Worker if (layer_id->spatial_layer_id == 0) {
567*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST (slot 0).
568*77c1e3ccSAndroid Build Coastguard Worker // Set GOLDEN to slot 3 and update slot 3.
569*77c1e3ccSAndroid Build Coastguard Worker // Set all other buffer_idx to slot 0.
570*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 0;
571*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[3] = 3;
572*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[3] = 1;
573*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id->spatial_layer_id == 1) {
574*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST and GOLDEN. Set buffer_idx for LAST to slot 1,
575*77c1e3ccSAndroid Build Coastguard Worker // GOLDEN (and all other refs) to slot 3.
576*77c1e3ccSAndroid Build Coastguard Worker // Set LAST2 to slot 4 and Update slot 4.
577*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 3;
578*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 1;
579*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[1] = 4;
580*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[4] = 1;
581*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id->spatial_layer_id == 2) {
582*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST and GOLDEN. Set buffer_idx for LAST to slot 2,
583*77c1e3ccSAndroid Build Coastguard Worker // GOLDEN (and all other refs) to slot 4.
584*77c1e3ccSAndroid Build Coastguard Worker // No update.
585*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 4;
586*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 2;
587*77c1e3ccSAndroid Build Coastguard Worker }
588*77c1e3ccSAndroid Build Coastguard Worker } else if ((superframe_cnt - 2) % 4 == 0) {
589*77c1e3ccSAndroid Build Coastguard Worker // Middle temporal enhancement layer.
590*77c1e3ccSAndroid Build Coastguard Worker layer_id->temporal_layer_id = 1;
591*77c1e3ccSAndroid Build Coastguard Worker if (layer_id->spatial_layer_id == 0) {
592*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST.
593*77c1e3ccSAndroid Build Coastguard Worker // Set all buffer_idx to 0.
594*77c1e3ccSAndroid Build Coastguard Worker // Set GOLDEN to slot 3 and update slot 3.
595*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 0;
596*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[3] = 3;
597*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[3] = 1;
598*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id->spatial_layer_id == 1) {
599*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST and GOLDEN. Set buffer_idx for LAST to slot 1,
600*77c1e3ccSAndroid Build Coastguard Worker // GOLDEN (and all other refs) to slot 3.
601*77c1e3ccSAndroid Build Coastguard Worker // Set LAST2 to slot 4 and update slot 4.
602*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 3;
603*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 1;
604*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[2] = 4;
605*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[4] = 1;
606*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id->spatial_layer_id == 2) {
607*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST and GOLDEN. Set buffer_idx for LAST to slot 2,
608*77c1e3ccSAndroid Build Coastguard Worker // GOLDEN (and all other refs) to slot 4.
609*77c1e3ccSAndroid Build Coastguard Worker // Set LAST2 to slot 5 and update slot 5.
610*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 4;
611*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 2;
612*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[2] = 5;
613*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[5] = 1;
614*77c1e3ccSAndroid Build Coastguard Worker }
615*77c1e3ccSAndroid Build Coastguard Worker } else if ((superframe_cnt - 3) % 4 == 0) {
616*77c1e3ccSAndroid Build Coastguard Worker // Second top temporal enhancement layer.
617*77c1e3ccSAndroid Build Coastguard Worker layer_id->temporal_layer_id = 2;
618*77c1e3ccSAndroid Build Coastguard Worker if (layer_id->spatial_layer_id == 0) {
619*77c1e3ccSAndroid Build Coastguard Worker // Set LAST to slot 3 and reference LAST.
620*77c1e3ccSAndroid Build Coastguard Worker // Set GOLDEN to slot 3 and update slot 3.
621*77c1e3ccSAndroid Build Coastguard Worker // Set all other buffer_idx to 0.
622*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 0;
623*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 3;
624*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[3] = 3;
625*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[3] = 1;
626*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id->spatial_layer_id == 1) {
627*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST and GOLDEN. Set buffer_idx for LAST to slot 4,
628*77c1e3ccSAndroid Build Coastguard Worker // GOLDEN to slot 3. Set LAST2 to slot 4 and update slot 4.
629*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 0;
630*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 4;
631*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[3] = 3;
632*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[1] = 4;
633*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[4] = 1;
634*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id->spatial_layer_id == 2) {
635*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST and GOLDEN. Set buffer_idx for LAST to slot 5,
636*77c1e3ccSAndroid Build Coastguard Worker // GOLDEN to slot 4. No update.
637*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 0;
638*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 5;
639*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[3] = 4;
640*77c1e3ccSAndroid Build Coastguard Worker }
641*77c1e3ccSAndroid Build Coastguard Worker }
642*77c1e3ccSAndroid Build Coastguard Worker if (layer_id->spatial_layer_id > 0) {
643*77c1e3ccSAndroid Build Coastguard Worker // Always reference GOLDEN (inter-layer prediction).
644*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[3] = 1;
645*77c1e3ccSAndroid Build Coastguard Worker if (is_key_frame && layer_id->spatial_layer_id > 0) {
646*77c1e3ccSAndroid Build Coastguard Worker // On superframes whose base is key: remove LAST since GOLDEN
647*77c1e3ccSAndroid Build Coastguard Worker // is used as reference.
648*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[0] = 0;
649*77c1e3ccSAndroid Build Coastguard Worker }
650*77c1e3ccSAndroid Build Coastguard Worker }
651*77c1e3ccSAndroid Build Coastguard Worker }
652*77c1e3ccSAndroid Build Coastguard Worker
653*77c1e3ccSAndroid Build Coastguard Worker // Layer pattern configuration.
set_layer_pattern(int frame_cnt,aom_svc_layer_id_t * layer_id,aom_svc_ref_frame_config_t * ref_frame_config,aom_svc_ref_frame_comp_pred_t * ref_frame_comp_pred,int spatial_layer,int multi_ref,int comp_pred,int is_key_frame,int dynamic_enable_disable_mode,int rps_mode,int rps_recovery_frame,int simulcast_mode,bool use_last_as_scaled,bool use_last_as_scaled_single_ref)654*77c1e3ccSAndroid Build Coastguard Worker virtual int set_layer_pattern(
655*77c1e3ccSAndroid Build Coastguard Worker int frame_cnt, aom_svc_layer_id_t *layer_id,
656*77c1e3ccSAndroid Build Coastguard Worker aom_svc_ref_frame_config_t *ref_frame_config,
657*77c1e3ccSAndroid Build Coastguard Worker aom_svc_ref_frame_comp_pred_t *ref_frame_comp_pred, int spatial_layer,
658*77c1e3ccSAndroid Build Coastguard Worker int multi_ref, int comp_pred, int is_key_frame,
659*77c1e3ccSAndroid Build Coastguard Worker int dynamic_enable_disable_mode, int rps_mode, int rps_recovery_frame,
660*77c1e3ccSAndroid Build Coastguard Worker int simulcast_mode, bool use_last_as_scaled,
661*77c1e3ccSAndroid Build Coastguard Worker bool use_last_as_scaled_single_ref) {
662*77c1e3ccSAndroid Build Coastguard Worker int lag_index = 0;
663*77c1e3ccSAndroid Build Coastguard Worker int base_count = frame_cnt >> 2;
664*77c1e3ccSAndroid Build Coastguard Worker layer_id->spatial_layer_id = spatial_layer;
665*77c1e3ccSAndroid Build Coastguard Worker // Set the reference map buffer idx for the 7 references:
666*77c1e3ccSAndroid Build Coastguard Worker // LAST_FRAME (0), LAST2_FRAME(1), LAST3_FRAME(2), GOLDEN_FRAME(3),
667*77c1e3ccSAndroid Build Coastguard Worker // BWDREF_FRAME(4), ALTREF2_FRAME(5), ALTREF_FRAME(6).
668*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < INTER_REFS_PER_FRAME; i++) {
669*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[i] = i;
670*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[i] = 0;
671*77c1e3ccSAndroid Build Coastguard Worker }
672*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < REF_FRAMES; i++) ref_frame_config->refresh[i] = 0;
673*77c1e3ccSAndroid Build Coastguard Worker if (comp_pred) {
674*77c1e3ccSAndroid Build Coastguard Worker ref_frame_comp_pred->use_comp_pred[0] = 1; // GOLDEN_LAST
675*77c1e3ccSAndroid Build Coastguard Worker ref_frame_comp_pred->use_comp_pred[1] = 1; // LAST2_LAST
676*77c1e3ccSAndroid Build Coastguard Worker ref_frame_comp_pred->use_comp_pred[2] = 1; // ALTREF_LAST
677*77c1e3ccSAndroid Build Coastguard Worker }
678*77c1e3ccSAndroid Build Coastguard Worker // Set layer_flags to 0 when using ref_frame_config->reference.
679*77c1e3ccSAndroid Build Coastguard Worker int layer_flags = 0;
680*77c1e3ccSAndroid Build Coastguard Worker // Always reference LAST.
681*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[0] = 1;
682*77c1e3ccSAndroid Build Coastguard Worker if (number_temporal_layers_ == 1 && number_spatial_layers_ == 1) {
683*77c1e3ccSAndroid Build Coastguard Worker layer_id->temporal_layer_id = 0;
684*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[0] = 1;
685*77c1e3ccSAndroid Build Coastguard Worker if (rps_mode)
686*77c1e3ccSAndroid Build Coastguard Worker ref_config_rps(ref_frame_config, frame_cnt, rps_recovery_frame);
687*77c1e3ccSAndroid Build Coastguard Worker if (intra_only_single_layer_) {
688*77c1e3ccSAndroid Build Coastguard Worker // This repros the crash in Bug: 363016123.
689*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 0;
690*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[3] = 1;
691*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[6] = 2;
692*77c1e3ccSAndroid Build Coastguard Worker if (frame_cnt == 1) {
693*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < INTER_REFS_PER_FRAME; i++)
694*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[i] = 0;
695*77c1e3ccSAndroid Build Coastguard Worker }
696*77c1e3ccSAndroid Build Coastguard Worker }
697*77c1e3ccSAndroid Build Coastguard Worker }
698*77c1e3ccSAndroid Build Coastguard Worker if (number_temporal_layers_ == 2 && number_spatial_layers_ == 1) {
699*77c1e3ccSAndroid Build Coastguard Worker // 2-temporal layer.
700*77c1e3ccSAndroid Build Coastguard Worker // 1 3 5
701*77c1e3ccSAndroid Build Coastguard Worker // 0 2 4
702*77c1e3ccSAndroid Build Coastguard Worker // Keep golden fixed at slot 3.
703*77c1e3ccSAndroid Build Coastguard Worker base_count = frame_cnt >> 1;
704*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[3] = 3;
705*77c1e3ccSAndroid Build Coastguard Worker // Cyclically refresh slots 5, 6, 7, for lag alt ref.
706*77c1e3ccSAndroid Build Coastguard Worker lag_index = 5;
707*77c1e3ccSAndroid Build Coastguard Worker if (base_count > 0) {
708*77c1e3ccSAndroid Build Coastguard Worker lag_index = 5 + (base_count % 3);
709*77c1e3ccSAndroid Build Coastguard Worker if (frame_cnt % 2 != 0) lag_index = 5 + ((base_count + 1) % 3);
710*77c1e3ccSAndroid Build Coastguard Worker }
711*77c1e3ccSAndroid Build Coastguard Worker // Set the altref slot to lag_index.
712*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[6] = lag_index;
713*77c1e3ccSAndroid Build Coastguard Worker if (frame_cnt % 2 == 0) {
714*77c1e3ccSAndroid Build Coastguard Worker layer_id->temporal_layer_id = 0;
715*77c1e3ccSAndroid Build Coastguard Worker // Update LAST on layer 0, reference LAST.
716*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[0] = 1;
717*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[0] = 1;
718*77c1e3ccSAndroid Build Coastguard Worker // Refresh lag_index slot, needed for lagging golen.
719*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[lag_index] = 1;
720*77c1e3ccSAndroid Build Coastguard Worker // Refresh GOLDEN every x base layer frames.
721*77c1e3ccSAndroid Build Coastguard Worker if (base_count % 32 == 0) ref_frame_config->refresh[3] = 1;
722*77c1e3ccSAndroid Build Coastguard Worker } else {
723*77c1e3ccSAndroid Build Coastguard Worker layer_id->temporal_layer_id = 1;
724*77c1e3ccSAndroid Build Coastguard Worker // No updates on layer 1, reference LAST (TL0).
725*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[0] = 1;
726*77c1e3ccSAndroid Build Coastguard Worker }
727*77c1e3ccSAndroid Build Coastguard Worker // Always reference golden and altref on TL0.
728*77c1e3ccSAndroid Build Coastguard Worker if (layer_id->temporal_layer_id == 0) {
729*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[3] = 1;
730*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[6] = 1;
731*77c1e3ccSAndroid Build Coastguard Worker }
732*77c1e3ccSAndroid Build Coastguard Worker } else if (number_temporal_layers_ == 3 && number_spatial_layers_ == 1) {
733*77c1e3ccSAndroid Build Coastguard Worker // 3-layer:
734*77c1e3ccSAndroid Build Coastguard Worker // 1 3 5 7
735*77c1e3ccSAndroid Build Coastguard Worker // 2 6
736*77c1e3ccSAndroid Build Coastguard Worker // 0 4 8
737*77c1e3ccSAndroid Build Coastguard Worker if (multi_ref) {
738*77c1e3ccSAndroid Build Coastguard Worker // Keep golden fixed at slot 3.
739*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[3] = 3;
740*77c1e3ccSAndroid Build Coastguard Worker // Cyclically refresh slots 4, 5, 6, 7, for lag altref.
741*77c1e3ccSAndroid Build Coastguard Worker lag_index = 4 + (base_count % 4);
742*77c1e3ccSAndroid Build Coastguard Worker // Set the altref slot to lag_index.
743*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[6] = lag_index;
744*77c1e3ccSAndroid Build Coastguard Worker }
745*77c1e3ccSAndroid Build Coastguard Worker if (frame_cnt % 4 == 0) {
746*77c1e3ccSAndroid Build Coastguard Worker // Base layer.
747*77c1e3ccSAndroid Build Coastguard Worker layer_id->temporal_layer_id = 0;
748*77c1e3ccSAndroid Build Coastguard Worker // Update LAST on layer 0, reference LAST and GF.
749*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[0] = 1;
750*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[3] = 1;
751*77c1e3ccSAndroid Build Coastguard Worker if (multi_ref) {
752*77c1e3ccSAndroid Build Coastguard Worker // Refresh GOLDEN every x ~10 base layer frames.
753*77c1e3ccSAndroid Build Coastguard Worker if (base_count % 10 == 0) ref_frame_config->refresh[3] = 1;
754*77c1e3ccSAndroid Build Coastguard Worker // Refresh lag_index slot, needed for lagging altref.
755*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[lag_index] = 1;
756*77c1e3ccSAndroid Build Coastguard Worker }
757*77c1e3ccSAndroid Build Coastguard Worker } else if ((frame_cnt - 1) % 4 == 0) {
758*77c1e3ccSAndroid Build Coastguard Worker layer_id->temporal_layer_id = 2;
759*77c1e3ccSAndroid Build Coastguard Worker // First top layer: no updates, only reference LAST (TL0).
760*77c1e3ccSAndroid Build Coastguard Worker } else if ((frame_cnt - 2) % 4 == 0) {
761*77c1e3ccSAndroid Build Coastguard Worker layer_id->temporal_layer_id = 1;
762*77c1e3ccSAndroid Build Coastguard Worker // Middle layer (TL1): update LAST2, only reference LAST (TL0).
763*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[1] = 1;
764*77c1e3ccSAndroid Build Coastguard Worker } else if ((frame_cnt - 3) % 4 == 0) {
765*77c1e3ccSAndroid Build Coastguard Worker layer_id->temporal_layer_id = 2;
766*77c1e3ccSAndroid Build Coastguard Worker // Second top layer: no updates, only reference LAST.
767*77c1e3ccSAndroid Build Coastguard Worker // Set buffer idx for LAST to slot 1, since that was the slot
768*77c1e3ccSAndroid Build Coastguard Worker // updated in previous frame. So LAST is TL1 frame.
769*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 1;
770*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[1] = 0;
771*77c1e3ccSAndroid Build Coastguard Worker }
772*77c1e3ccSAndroid Build Coastguard Worker if (multi_ref) {
773*77c1e3ccSAndroid Build Coastguard Worker // Every frame can reference GOLDEN AND ALTREF.
774*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[3] = 1;
775*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[6] = 1;
776*77c1e3ccSAndroid Build Coastguard Worker }
777*77c1e3ccSAndroid Build Coastguard Worker } else if (number_temporal_layers_ == 1 && number_spatial_layers_ == 2) {
778*77c1e3ccSAndroid Build Coastguard Worker layer_id->temporal_layer_id = 0;
779*77c1e3ccSAndroid Build Coastguard Worker if (layer_id->spatial_layer_id == 0) {
780*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST, update LAST. Keep LAST and GOLDEN in slots 0 and 3.
781*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 0;
782*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[3] = 3;
783*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[0] = 1;
784*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id->spatial_layer_id == 1) {
785*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST and GOLDEN. Set buffer_idx for LAST to slot 3
786*77c1e3ccSAndroid Build Coastguard Worker // and GOLDEN to slot 0. Update slot 3 (LAST).
787*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 3;
788*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[3] = 0;
789*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[3] = 1;
790*77c1e3ccSAndroid Build Coastguard Worker }
791*77c1e3ccSAndroid Build Coastguard Worker // Reference GOLDEN.
792*77c1e3ccSAndroid Build Coastguard Worker if (layer_id->spatial_layer_id > 0) ref_frame_config->reference[3] = 1;
793*77c1e3ccSAndroid Build Coastguard Worker } else if (number_temporal_layers_ == 1 && number_spatial_layers_ == 3) {
794*77c1e3ccSAndroid Build Coastguard Worker // 3 spatial layers, 1 temporal.
795*77c1e3ccSAndroid Build Coastguard Worker // Note for this case , we set the buffer idx for all references to be
796*77c1e3ccSAndroid Build Coastguard Worker // either LAST or GOLDEN, which are always valid references, since decoder
797*77c1e3ccSAndroid Build Coastguard Worker // will check if any of the 7 references is valid scale in
798*77c1e3ccSAndroid Build Coastguard Worker // valid_ref_frame_size().
799*77c1e3ccSAndroid Build Coastguard Worker layer_id->temporal_layer_id = 0;
800*77c1e3ccSAndroid Build Coastguard Worker if (layer_id->spatial_layer_id == 0) {
801*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST, update LAST. Set all other buffer_idx to 0.
802*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 0;
803*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[0] = 1;
804*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id->spatial_layer_id == 1) {
805*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST and GOLDEN. Set buffer_idx for LAST to slot 1
806*77c1e3ccSAndroid Build Coastguard Worker // and GOLDEN (and all other refs) to slot 0.
807*77c1e3ccSAndroid Build Coastguard Worker // Update slot 1 (LAST).
808*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 0;
809*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 1;
810*77c1e3ccSAndroid Build Coastguard Worker if (use_last_as_scaled) {
811*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 1;
812*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 0;
813*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[3] = 1;
814*77c1e3ccSAndroid Build Coastguard Worker }
815*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[1] = 1;
816*77c1e3ccSAndroid Build Coastguard Worker } else if (layer_id->spatial_layer_id == 2) {
817*77c1e3ccSAndroid Build Coastguard Worker // Reference LAST and GOLDEN. Set buffer_idx for LAST to slot 2
818*77c1e3ccSAndroid Build Coastguard Worker // and GOLDEN (and all other refs) to slot 1.
819*77c1e3ccSAndroid Build Coastguard Worker // Update slot 2 (LAST).
820*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 1;
821*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[0] = 2;
822*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[2] = 1;
823*77c1e3ccSAndroid Build Coastguard Worker if (multi_ref) {
824*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[6] = 7;
825*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[6] = 1;
826*77c1e3ccSAndroid Build Coastguard Worker if (base_count % 10 == 0) ref_frame_config->refresh[7] = 1;
827*77c1e3ccSAndroid Build Coastguard Worker }
828*77c1e3ccSAndroid Build Coastguard Worker }
829*77c1e3ccSAndroid Build Coastguard Worker // Reference GOLDEN.
830*77c1e3ccSAndroid Build Coastguard Worker if (layer_id->spatial_layer_id > 0) {
831*77c1e3ccSAndroid Build Coastguard Worker if (use_last_as_scaled_single_ref)
832*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[3] = 0;
833*77c1e3ccSAndroid Build Coastguard Worker else
834*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[3] = 1;
835*77c1e3ccSAndroid Build Coastguard Worker }
836*77c1e3ccSAndroid Build Coastguard Worker } else if (number_temporal_layers_ == 3 && number_spatial_layers_ == 3) {
837*77c1e3ccSAndroid Build Coastguard Worker if (simulcast_mode) {
838*77c1e3ccSAndroid Build Coastguard Worker ref_config_simulcast3SL3TL(ref_frame_config, layer_id, is_key_frame,
839*77c1e3ccSAndroid Build Coastguard Worker superframe_cnt_);
840*77c1e3ccSAndroid Build Coastguard Worker } else {
841*77c1e3ccSAndroid Build Coastguard Worker ref_config_3SL3TL(ref_frame_config, layer_id, is_key_frame,
842*77c1e3ccSAndroid Build Coastguard Worker superframe_cnt_);
843*77c1e3ccSAndroid Build Coastguard Worker // Allow for top spatial layer to use additional temporal reference.
844*77c1e3ccSAndroid Build Coastguard Worker // Additional reference is only updated on base temporal layer, every
845*77c1e3ccSAndroid Build Coastguard Worker // 10 TL0 frames here.
846*77c1e3ccSAndroid Build Coastguard Worker if (multi_ref && layer_id->spatial_layer_id == 2) {
847*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->ref_idx[6] = 7;
848*77c1e3ccSAndroid Build Coastguard Worker if (!is_key_frame) ref_frame_config->reference[6] = 1;
849*77c1e3ccSAndroid Build Coastguard Worker if (base_count % 10 == 0 && layer_id->temporal_layer_id == 0)
850*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->refresh[7] = 1;
851*77c1e3ccSAndroid Build Coastguard Worker }
852*77c1e3ccSAndroid Build Coastguard Worker }
853*77c1e3ccSAndroid Build Coastguard Worker }
854*77c1e3ccSAndroid Build Coastguard Worker // If the top spatial layer is first-time encoded in mid-sequence
855*77c1e3ccSAndroid Build Coastguard Worker // (i.e., dynamic_enable_disable_mode = 1), then don't predict from LAST,
856*77c1e3ccSAndroid Build Coastguard Worker // since it will have been last updated on first key frame (SL0) and so
857*77c1e3ccSAndroid Build Coastguard Worker // be different resolution from SL2.
858*77c1e3ccSAndroid Build Coastguard Worker if (dynamic_enable_disable_mode == 1 &&
859*77c1e3ccSAndroid Build Coastguard Worker layer_id->spatial_layer_id == number_spatial_layers_ - 1)
860*77c1e3ccSAndroid Build Coastguard Worker ref_frame_config->reference[0] = 0;
861*77c1e3ccSAndroid Build Coastguard Worker return layer_flags;
862*77c1e3ccSAndroid Build Coastguard Worker }
863*77c1e3ccSAndroid Build Coastguard Worker
initialize_svc(int number_temporal_layers,int number_spatial_layers,aom_svc_params * svc_params)864*77c1e3ccSAndroid Build Coastguard Worker virtual void initialize_svc(int number_temporal_layers,
865*77c1e3ccSAndroid Build Coastguard Worker int number_spatial_layers,
866*77c1e3ccSAndroid Build Coastguard Worker aom_svc_params *svc_params) {
867*77c1e3ccSAndroid Build Coastguard Worker svc_params->number_spatial_layers = number_spatial_layers;
868*77c1e3ccSAndroid Build Coastguard Worker svc_params->number_temporal_layers = number_temporal_layers;
869*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers * number_spatial_layers; ++i) {
870*77c1e3ccSAndroid Build Coastguard Worker svc_params->max_quantizers[i] = 60;
871*77c1e3ccSAndroid Build Coastguard Worker svc_params->min_quantizers[i] = 2;
872*77c1e3ccSAndroid Build Coastguard Worker svc_params->layer_target_bitrate[i] = target_layer_bitrate_[i];
873*77c1e3ccSAndroid Build Coastguard Worker }
874*77c1e3ccSAndroid Build Coastguard Worker // Do at most 3 spatial or temporal layers here.
875*77c1e3ccSAndroid Build Coastguard Worker svc_params->framerate_factor[0] = 1;
876*77c1e3ccSAndroid Build Coastguard Worker if (number_temporal_layers == 2) {
877*77c1e3ccSAndroid Build Coastguard Worker svc_params->framerate_factor[0] = 2;
878*77c1e3ccSAndroid Build Coastguard Worker svc_params->framerate_factor[1] = 1;
879*77c1e3ccSAndroid Build Coastguard Worker } else if (number_temporal_layers == 3) {
880*77c1e3ccSAndroid Build Coastguard Worker svc_params->framerate_factor[0] = 4;
881*77c1e3ccSAndroid Build Coastguard Worker svc_params->framerate_factor[1] = 2;
882*77c1e3ccSAndroid Build Coastguard Worker svc_params->framerate_factor[2] = 1;
883*77c1e3ccSAndroid Build Coastguard Worker }
884*77c1e3ccSAndroid Build Coastguard Worker svc_params->scaling_factor_num[0] = 1;
885*77c1e3ccSAndroid Build Coastguard Worker svc_params->scaling_factor_den[0] = 1;
886*77c1e3ccSAndroid Build Coastguard Worker if (number_spatial_layers == 2) {
887*77c1e3ccSAndroid Build Coastguard Worker svc_params->scaling_factor_num[0] = 1;
888*77c1e3ccSAndroid Build Coastguard Worker svc_params->scaling_factor_den[0] = 2;
889*77c1e3ccSAndroid Build Coastguard Worker svc_params->scaling_factor_num[1] = 1;
890*77c1e3ccSAndroid Build Coastguard Worker svc_params->scaling_factor_den[1] = 1;
891*77c1e3ccSAndroid Build Coastguard Worker } else if (number_spatial_layers == 3) {
892*77c1e3ccSAndroid Build Coastguard Worker svc_params->scaling_factor_num[0] = 1;
893*77c1e3ccSAndroid Build Coastguard Worker svc_params->scaling_factor_den[0] = 4;
894*77c1e3ccSAndroid Build Coastguard Worker svc_params->scaling_factor_num[1] = 1;
895*77c1e3ccSAndroid Build Coastguard Worker svc_params->scaling_factor_den[1] = 2;
896*77c1e3ccSAndroid Build Coastguard Worker svc_params->scaling_factor_num[2] = 1;
897*77c1e3ccSAndroid Build Coastguard Worker svc_params->scaling_factor_den[2] = 1;
898*77c1e3ccSAndroid Build Coastguard Worker }
899*77c1e3ccSAndroid Build Coastguard Worker }
900*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC3TL1SLTest()901*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC3TL1SLTest() {
902*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
903*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
904*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
905*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
906*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
907*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
908*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
909*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
910*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 1;
911*77c1e3ccSAndroid Build Coastguard Worker
912*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
913*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
914*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 200, 550 };
915*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
916*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
917*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
918*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * cfg_.rc_target_bitrate / 100;
919*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * cfg_.rc_target_bitrate / 100;
920*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = cfg_.rc_target_bitrate;
921*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
922*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
923*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.60)
924*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
925*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.60)
926*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
927*77c1e3ccSAndroid Build Coastguard Worker }
928*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
929*77c1e3ccSAndroid Build Coastguard Worker // Top temporal layers are non_reference, so exlcude them from
930*77c1e3ccSAndroid Build Coastguard Worker // mismatch count, since loopfilter/cdef is not applied for these on
931*77c1e3ccSAndroid Build Coastguard Worker // encoder side, but is always applied on decoder.
932*77c1e3ccSAndroid Build Coastguard Worker // This means 150 = #frames(300) - #TL2_frames(150).
933*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ((int)GetMismatchFrames(), 150);
934*77c1e3ccSAndroid Build Coastguard Worker #endif
935*77c1e3ccSAndroid Build Coastguard Worker }
936*77c1e3ccSAndroid Build Coastguard Worker
SetFrameQpSVC3TL1SLTest()937*77c1e3ccSAndroid Build Coastguard Worker virtual void SetFrameQpSVC3TL1SLTest() {
938*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
939*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
940*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
941*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
942*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
943*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
944*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
945*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
946*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 1;
947*77c1e3ccSAndroid Build Coastguard Worker
948*77c1e3ccSAndroid Build Coastguard Worker user_define_frame_qp_ = 1;
949*77c1e3ccSAndroid Build Coastguard Worker total_frame_ = 300;
950*77c1e3ccSAndroid Build Coastguard Worker
951*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
952*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
953*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 200, 550 };
954*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
955*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
956*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
957*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * cfg_.rc_target_bitrate / 100;
958*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * cfg_.rc_target_bitrate / 100;
959*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = cfg_.rc_target_bitrate;
960*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
961*77c1e3ccSAndroid Build Coastguard Worker }
962*77c1e3ccSAndroid Build Coastguard Worker
SetFrameQpSVC3TL3SLTest()963*77c1e3ccSAndroid Build Coastguard Worker virtual void SetFrameQpSVC3TL3SLTest() {
964*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
965*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
966*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
967*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
968*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
969*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
970*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
971*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
972*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
973*77c1e3ccSAndroid Build Coastguard Worker
974*77c1e3ccSAndroid Build Coastguard Worker user_define_frame_qp_ = 1;
975*77c1e3ccSAndroid Build Coastguard Worker total_frame_ = 300;
976*77c1e3ccSAndroid Build Coastguard Worker
977*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
978*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
979*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 600, 1200 };
980*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
981*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
982*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
983*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 3;
984*77c1e3ccSAndroid Build Coastguard Worker // SL0
985*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl0 = 1 * cfg_.rc_target_bitrate / 8;
986*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * bitrate_sl0 / 100;
987*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * bitrate_sl0 / 100;
988*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = bitrate_sl0;
989*77c1e3ccSAndroid Build Coastguard Worker // SL1
990*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl1 = 3 * cfg_.rc_target_bitrate / 8;
991*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[3] = 50 * bitrate_sl1 / 100;
992*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[4] = 70 * bitrate_sl1 / 100;
993*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[5] = bitrate_sl1;
994*77c1e3ccSAndroid Build Coastguard Worker // SL2
995*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl2 = 4 * cfg_.rc_target_bitrate / 8;
996*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[6] = 50 * bitrate_sl2 / 100;
997*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[7] = 70 * bitrate_sl2 / 100;
998*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[8] = bitrate_sl2;
999*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1000*77c1e3ccSAndroid Build Coastguard Worker }
1001*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC3TL1SLScreenTest()1002*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC3TL1SLScreenTest() {
1003*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1004*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1005*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1006*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1007*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1008*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
1009*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1010*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1011*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1012*77c1e3ccSAndroid Build Coastguard Worker
1013*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::Y4mVideoSource video("screendata.y4m", 0, 60);
1014*77c1e3ccSAndroid Build Coastguard Worker
1015*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 1000, 1500 };
1016*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1017*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1018*77c1e3ccSAndroid Build Coastguard Worker screen_mode_ = 1;
1019*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
1020*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 1;
1021*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * cfg_.rc_target_bitrate / 100;
1022*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * cfg_.rc_target_bitrate / 100;
1023*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = cfg_.rc_target_bitrate;
1024*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1025*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1026*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.40)
1027*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1028*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 2.0)
1029*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1030*77c1e3ccSAndroid Build Coastguard Worker }
1031*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
1032*77c1e3ccSAndroid Build Coastguard Worker // Top temporal layers are non_reference, so exlcude them from
1033*77c1e3ccSAndroid Build Coastguard Worker // mismatch count, since loopfilter/cdef is not applied for these on
1034*77c1e3ccSAndroid Build Coastguard Worker // encoder side, but is always applied on decoder.
1035*77c1e3ccSAndroid Build Coastguard Worker // This means 30 = #frames(60) - #TL2_frames(30).
1036*77c1e3ccSAndroid Build Coastguard Worker // We use LE for screen since loopfilter level can become very small
1037*77c1e3ccSAndroid Build Coastguard Worker // or zero and then the frame is not a mismatch.
1038*77c1e3ccSAndroid Build Coastguard Worker EXPECT_LE((int)GetMismatchFrames(), 30);
1039*77c1e3ccSAndroid Build Coastguard Worker #endif
1040*77c1e3ccSAndroid Build Coastguard Worker }
1041*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC2TL1SLScreenDropFrameTest()1042*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC2TL1SLScreenDropFrameTest() {
1043*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 50;
1044*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 50;
1045*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 100;
1046*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 30;
1047*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1048*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 52;
1049*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1050*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1051*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1052*77c1e3ccSAndroid Build Coastguard Worker
1053*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
1054*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
1055*77c1e3ccSAndroid Build Coastguard Worker
1056*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 60, 100 };
1057*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1058*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1059*77c1e3ccSAndroid Build Coastguard Worker screen_mode_ = 1;
1060*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 2;
1061*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 1;
1062*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 60 * cfg_.rc_target_bitrate / 100;
1063*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = cfg_.rc_target_bitrate;
1064*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1065*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1066*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.75)
1067*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1068*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.8)
1069*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1070*77c1e3ccSAndroid Build Coastguard Worker }
1071*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
1072*77c1e3ccSAndroid Build Coastguard Worker // Top temporal layers are non_reference, so exlcude them from
1073*77c1e3ccSAndroid Build Coastguard Worker // mismatch count, since loopfilter/cdef is not applied for these on
1074*77c1e3ccSAndroid Build Coastguard Worker // encoder side, but is always applied on decoder.
1075*77c1e3ccSAndroid Build Coastguard Worker // This means 300 = #frames(300) - #TL2_frames(150).
1076*77c1e3ccSAndroid Build Coastguard Worker // We use LE for screen since loopfilter level can become very small
1077*77c1e3ccSAndroid Build Coastguard Worker // or zero and then the frame is not a mismatch.
1078*77c1e3ccSAndroid Build Coastguard Worker EXPECT_LE((int)GetMismatchFrames(), 150);
1079*77c1e3ccSAndroid Build Coastguard Worker #endif
1080*77c1e3ccSAndroid Build Coastguard Worker }
1081*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC1TL3SLScreenTest()1082*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC1TL3SLScreenTest() {
1083*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1084*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1085*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1086*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1087*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1088*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
1089*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1090*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1091*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1092*77c1e3ccSAndroid Build Coastguard Worker
1093*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::Y4mVideoSource video("niklas_1280_720_30.y4m", 0, 60);
1094*77c1e3ccSAndroid Build Coastguard Worker
1095*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 800, 1200 };
1096*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1097*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1098*77c1e3ccSAndroid Build Coastguard Worker screen_mode_ = 1;
1099*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 1;
1100*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 3;
1101*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 30 * cfg_.rc_target_bitrate / 100;
1102*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 60 * cfg_.rc_target_bitrate / 100;
1103*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = cfg_.rc_target_bitrate;
1104*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1105*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1106*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.50)
1107*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1108*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.5)
1109*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1110*77c1e3ccSAndroid Build Coastguard Worker }
1111*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
1112*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ((int)GetMismatchFrames(), 0);
1113*77c1e3ccSAndroid Build Coastguard Worker #endif
1114*77c1e3ccSAndroid Build Coastguard Worker }
1115*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC1TL1SLScreenScCutsMotionTest()1116*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC1TL1SLScreenScCutsMotionTest() {
1117*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1118*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1119*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1120*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1121*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1122*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
1123*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1124*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1125*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1126*77c1e3ccSAndroid Build Coastguard Worker
1127*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
1128*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
1129*77c1e3ccSAndroid Build Coastguard Worker
1130*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 200, 500 };
1131*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1132*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1133*77c1e3ccSAndroid Build Coastguard Worker screen_mode_ = 1;
1134*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 1;
1135*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 1;
1136*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = cfg_.rc_target_bitrate;
1137*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1138*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1139*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.40)
1140*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1141*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.7)
1142*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1143*77c1e3ccSAndroid Build Coastguard Worker }
1144*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
1145*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ((int)GetMismatchFrames(), 0);
1146*77c1e3ccSAndroid Build Coastguard Worker #endif
1147*77c1e3ccSAndroid Build Coastguard Worker }
1148*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC3TL1SLResizeTest()1149*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC3TL1SLResizeTest() {
1150*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1151*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1152*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1153*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1154*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1155*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
1156*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1157*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1158*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1159*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_resize_mode = RESIZE_DYNAMIC;
1160*77c1e3ccSAndroid Build Coastguard Worker
1161*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("niklas_640_480_30.yuv", 640, 480, 30,
1162*77c1e3ccSAndroid Build Coastguard Worker 1, 0, 400);
1163*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_w = 640;
1164*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_h = 480;
1165*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 80, 90 };
1166*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1167*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1168*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
1169*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * cfg_.rc_target_bitrate / 100;
1170*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * cfg_.rc_target_bitrate / 100;
1171*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = cfg_.rc_target_bitrate;
1172*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1173*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1174*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.80)
1175*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1176*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.60)
1177*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1178*77c1e3ccSAndroid Build Coastguard Worker }
1179*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
1180*77c1e3ccSAndroid Build Coastguard Worker unsigned int last_w = cfg_.g_w;
1181*77c1e3ccSAndroid Build Coastguard Worker unsigned int last_h = cfg_.g_h;
1182*77c1e3ccSAndroid Build Coastguard Worker int resize_down_count = 0;
1183*77c1e3ccSAndroid Build Coastguard Worker for (std::vector<FrameInfo>::const_iterator info = frame_info_list_.begin();
1184*77c1e3ccSAndroid Build Coastguard Worker info != frame_info_list_.end(); ++info) {
1185*77c1e3ccSAndroid Build Coastguard Worker if (info->w != last_w || info->h != last_h) {
1186*77c1e3ccSAndroid Build Coastguard Worker // Verify that resize down occurs.
1187*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LT(info->w, last_w);
1188*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LT(info->h, last_h);
1189*77c1e3ccSAndroid Build Coastguard Worker last_w = info->w;
1190*77c1e3ccSAndroid Build Coastguard Worker last_h = info->h;
1191*77c1e3ccSAndroid Build Coastguard Worker resize_down_count++;
1192*77c1e3ccSAndroid Build Coastguard Worker }
1193*77c1e3ccSAndroid Build Coastguard Worker }
1194*77c1e3ccSAndroid Build Coastguard Worker // Must be at least one resize down.
1195*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(resize_down_count, 1);
1196*77c1e3ccSAndroid Build Coastguard Worker #else
1197*77c1e3ccSAndroid Build Coastguard Worker printf("Warning: AV1 decoder unavailable, unable to check resize count!\n");
1198*77c1e3ccSAndroid Build Coastguard Worker #endif
1199*77c1e3ccSAndroid Build Coastguard Worker }
1200*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC1TL2SLTest()1201*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC1TL2SLTest() {
1202*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1203*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1204*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1205*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1206*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1207*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
1208*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1209*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1210*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1211*77c1e3ccSAndroid Build Coastguard Worker
1212*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
1213*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
1214*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 300, 600 };
1215*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1216*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1217*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 1;
1218*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 2;
1219*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 2 * cfg_.rc_target_bitrate / 4;
1220*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 2 * cfg_.rc_target_bitrate / 4;
1221*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1222*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1223*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.80)
1224*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1225*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.60)
1226*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1227*77c1e3ccSAndroid Build Coastguard Worker }
1228*77c1e3ccSAndroid Build Coastguard Worker }
1229*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC3TL3SLIntraStartDecodeBaseMidSeq()1230*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC3TL3SLIntraStartDecodeBaseMidSeq() {
1231*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1232*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1233*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1234*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1235*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1236*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 56;
1237*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1238*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1239*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1240*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
1241*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
1242*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 500, 1000 };
1243*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1244*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1245*77c1e3ccSAndroid Build Coastguard Worker intra_only_ = 1;
1246*77c1e3ccSAndroid Build Coastguard Worker frame_sync_ = 20;
1247*77c1e3ccSAndroid Build Coastguard Worker frame_to_start_decoding_ = frame_sync_;
1248*77c1e3ccSAndroid Build Coastguard Worker layer_to_decode_ = 0;
1249*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
1250*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 3;
1251*77c1e3ccSAndroid Build Coastguard Worker // SL0
1252*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl0 = 1 * cfg_.rc_target_bitrate / 8;
1253*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * bitrate_sl0 / 100;
1254*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * bitrate_sl0 / 100;
1255*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = bitrate_sl0;
1256*77c1e3ccSAndroid Build Coastguard Worker // SL1
1257*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl1 = 3 * cfg_.rc_target_bitrate / 8;
1258*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[3] = 50 * bitrate_sl1 / 100;
1259*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[4] = 70 * bitrate_sl1 / 100;
1260*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[5] = bitrate_sl1;
1261*77c1e3ccSAndroid Build Coastguard Worker // SL2
1262*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl2 = 4 * cfg_.rc_target_bitrate / 8;
1263*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[6] = 50 * bitrate_sl2 / 100;
1264*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[7] = 70 * bitrate_sl2 / 100;
1265*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[8] = bitrate_sl2;
1266*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1267*77c1e3ccSAndroid Build Coastguard Worker // Only check datarate on SL0 - this is layer that is decoded starting at
1268*77c1e3ccSAndroid Build Coastguard Worker // frame_to_start_decoding_.
1269*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_; i++) {
1270*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.50)
1271*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1272*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.60)
1273*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1274*77c1e3ccSAndroid Build Coastguard Worker }
1275*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
1276*77c1e3ccSAndroid Build Coastguard Worker // Only base spatial layer is decoded and there are no non-referenece
1277*77c1e3ccSAndroid Build Coastguard Worker // frames on S0, so #mismatch must be 0.
1278*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ((int)GetMismatchFrames(), 0);
1279*77c1e3ccSAndroid Build Coastguard Worker #endif
1280*77c1e3ccSAndroid Build Coastguard Worker }
1281*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC3TL3SLIntraMidSeqDecodeAll()1282*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC3TL3SLIntraMidSeqDecodeAll() {
1283*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1284*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1285*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1286*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1287*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1288*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 56;
1289*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1290*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1291*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1292*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
1293*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
1294*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 500, 1000 };
1295*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1296*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1297*77c1e3ccSAndroid Build Coastguard Worker intra_only_ = 1;
1298*77c1e3ccSAndroid Build Coastguard Worker frame_sync_ = 20;
1299*77c1e3ccSAndroid Build Coastguard Worker frame_to_start_decoding_ = 0;
1300*77c1e3ccSAndroid Build Coastguard Worker layer_to_decode_ = 3;
1301*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
1302*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 3;
1303*77c1e3ccSAndroid Build Coastguard Worker // SL0
1304*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl0 = 1 * cfg_.rc_target_bitrate / 8;
1305*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * bitrate_sl0 / 100;
1306*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * bitrate_sl0 / 100;
1307*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = bitrate_sl0;
1308*77c1e3ccSAndroid Build Coastguard Worker // SL1
1309*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl1 = 3 * cfg_.rc_target_bitrate / 8;
1310*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[3] = 50 * bitrate_sl1 / 100;
1311*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[4] = 70 * bitrate_sl1 / 100;
1312*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[5] = bitrate_sl1;
1313*77c1e3ccSAndroid Build Coastguard Worker // SL2
1314*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl2 = 4 * cfg_.rc_target_bitrate / 8;
1315*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[6] = 50 * bitrate_sl2 / 100;
1316*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[7] = 70 * bitrate_sl2 / 100;
1317*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[8] = bitrate_sl2;
1318*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1319*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1320*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.585)
1321*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1322*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.60)
1323*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1324*77c1e3ccSAndroid Build Coastguard Worker }
1325*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
1326*77c1e3ccSAndroid Build Coastguard Worker // All 3 spatial layers are decoded, starting at frame 0, so there are
1327*77c1e3ccSAndroid Build Coastguard Worker // and there 300/2 = 150 non-reference frames, so mismatch is 150.
1328*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ((int)GetMismatchFrames(), 150);
1329*77c1e3ccSAndroid Build Coastguard Worker #endif
1330*77c1e3ccSAndroid Build Coastguard Worker }
1331*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC3TL3SLSimulcast()1332*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC3TL3SLSimulcast() {
1333*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1334*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1335*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1336*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1337*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1338*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 56;
1339*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1340*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1341*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1342*77c1e3ccSAndroid Build Coastguard Worker cfg_.kf_max_dist = 150;
1343*77c1e3ccSAndroid Build Coastguard Worker cfg_.kf_min_dist = 150;
1344*77c1e3ccSAndroid Build Coastguard Worker int num_frames = 300;
1345*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
1346*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, num_frames);
1347*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 500, 1000 };
1348*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1349*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1350*77c1e3ccSAndroid Build Coastguard Worker simulcast_mode_ = 1;
1351*77c1e3ccSAndroid Build Coastguard Worker frame_to_start_decoding_ = cfg_.kf_max_dist;
1352*77c1e3ccSAndroid Build Coastguard Worker layer_to_decode_ = 2; // SL2
1353*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
1354*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 3;
1355*77c1e3ccSAndroid Build Coastguard Worker // SL0
1356*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl0 = 1 * cfg_.rc_target_bitrate / 8;
1357*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * bitrate_sl0 / 100;
1358*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * bitrate_sl0 / 100;
1359*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = bitrate_sl0;
1360*77c1e3ccSAndroid Build Coastguard Worker // SL1
1361*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl1 = 3 * cfg_.rc_target_bitrate / 8;
1362*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[3] = 50 * bitrate_sl1 / 100;
1363*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[4] = 70 * bitrate_sl1 / 100;
1364*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[5] = bitrate_sl1;
1365*77c1e3ccSAndroid Build Coastguard Worker // SL2
1366*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl2 = 4 * cfg_.rc_target_bitrate / 8;
1367*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[6] = 50 * bitrate_sl2 / 100;
1368*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[7] = 70 * bitrate_sl2 / 100;
1369*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[8] = bitrate_sl2;
1370*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1371*77c1e3ccSAndroid Build Coastguard Worker // Only SL2 layer is decoded.
1372*77c1e3ccSAndroid Build Coastguard Worker for (int tl = 0; tl < number_temporal_layers_; tl++) {
1373*77c1e3ccSAndroid Build Coastguard Worker int i = layer_to_decode_ * number_temporal_layers_ + tl;
1374*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.6)
1375*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1376*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.7)
1377*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1378*77c1e3ccSAndroid Build Coastguard Worker }
1379*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
1380*77c1e3ccSAndroid Build Coastguard Worker // Only top spatial layer (SL2) is decoded, starting at frame 150
1381*77c1e3ccSAndroid Build Coastguard Worker // (frame_to_start_decoding_), so there (300 - 150) / 2 = 75
1382*77c1e3ccSAndroid Build Coastguard Worker // non-reference frames, so mismatch is 75.
1383*77c1e3ccSAndroid Build Coastguard Worker int num_mismatch = (num_frames - frame_to_start_decoding_) / 2;
1384*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ((int)GetMismatchFrames(), num_mismatch);
1385*77c1e3ccSAndroid Build Coastguard Worker #endif
1386*77c1e3ccSAndroid Build Coastguard Worker }
1387*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC1TL2SLIntraOnlyTest()1388*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC1TL2SLIntraOnlyTest() {
1389*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1390*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1391*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1392*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1393*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1394*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
1395*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1396*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1397*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1398*77c1e3ccSAndroid Build Coastguard Worker
1399*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
1400*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
1401*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 300, 600 };
1402*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1403*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1404*77c1e3ccSAndroid Build Coastguard Worker intra_only_ = 1;
1405*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 1;
1406*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 2;
1407*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 2 * cfg_.rc_target_bitrate / 4;
1408*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 2 * cfg_.rc_target_bitrate / 4;
1409*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1410*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1411*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.80)
1412*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1413*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.60)
1414*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1415*77c1e3ccSAndroid Build Coastguard Worker }
1416*77c1e3ccSAndroid Build Coastguard Worker }
1417*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC1TL1SLIntraOnlyTest()1418*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC1TL1SLIntraOnlyTest() {
1419*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1420*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1421*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1422*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1423*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1424*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
1425*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1426*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1427*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1428*77c1e3ccSAndroid Build Coastguard Worker
1429*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
1430*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
1431*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 300, 600 };
1432*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1433*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1434*77c1e3ccSAndroid Build Coastguard Worker intra_only_single_layer_ = true;
1435*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 1;
1436*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 1;
1437*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1438*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[0], cfg_.rc_target_bitrate * 0.80)
1439*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1440*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[0], cfg_.rc_target_bitrate * 1.60)
1441*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1442*77c1e3ccSAndroid Build Coastguard Worker }
1443*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC1TL3SLTest()1444*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC1TL3SLTest() {
1445*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1446*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1447*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1448*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1449*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1450*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
1451*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1452*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1453*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1454*77c1e3ccSAndroid Build Coastguard Worker
1455*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
1456*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
1457*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 500, 1000 };
1458*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1459*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1460*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 1;
1461*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 3;
1462*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 1 * cfg_.rc_target_bitrate / 8;
1463*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 3 * cfg_.rc_target_bitrate / 8;
1464*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = 4 * cfg_.rc_target_bitrate / 8;
1465*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1466*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1467*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.80)
1468*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1469*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.38)
1470*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1471*77c1e3ccSAndroid Build Coastguard Worker }
1472*77c1e3ccSAndroid Build Coastguard Worker }
1473*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC1TL3SLLastIsScaledTest()1474*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC1TL3SLLastIsScaledTest() {
1475*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1476*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1477*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1478*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1479*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1480*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
1481*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1482*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1483*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1484*77c1e3ccSAndroid Build Coastguard Worker
1485*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
1486*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
1487*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 500, 1000 };
1488*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1489*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1490*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 1;
1491*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 3;
1492*77c1e3ccSAndroid Build Coastguard Worker use_last_as_scaled_ = true;
1493*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 1 * cfg_.rc_target_bitrate / 8;
1494*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 3 * cfg_.rc_target_bitrate / 8;
1495*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = 4 * cfg_.rc_target_bitrate / 8;
1496*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1497*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1498*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.80)
1499*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1500*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.38)
1501*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1502*77c1e3ccSAndroid Build Coastguard Worker }
1503*77c1e3ccSAndroid Build Coastguard Worker }
1504*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC1TL3SLLastIsScaledSingleRefTest()1505*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC1TL3SLLastIsScaledSingleRefTest() {
1506*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1507*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1508*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1509*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1510*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1511*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
1512*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1513*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1514*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1515*77c1e3ccSAndroid Build Coastguard Worker
1516*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
1517*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
1518*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 500, 1000 };
1519*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1520*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1521*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 1;
1522*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 3;
1523*77c1e3ccSAndroid Build Coastguard Worker use_last_as_scaled_ = true;
1524*77c1e3ccSAndroid Build Coastguard Worker use_last_as_scaled_single_ref_ = true;
1525*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 1 * cfg_.rc_target_bitrate / 8;
1526*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 3 * cfg_.rc_target_bitrate / 8;
1527*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = 4 * cfg_.rc_target_bitrate / 8;
1528*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1529*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1530*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.80)
1531*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1532*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.38)
1533*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1534*77c1e3ccSAndroid Build Coastguard Worker }
1535*77c1e3ccSAndroid Build Coastguard Worker }
1536*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC1TL3SLMultiRefTest()1537*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC1TL3SLMultiRefTest() {
1538*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1539*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1540*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1541*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1542*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1543*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
1544*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1545*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1546*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1547*77c1e3ccSAndroid Build Coastguard Worker
1548*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
1549*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
1550*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 500, 1000 };
1551*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1552*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1553*77c1e3ccSAndroid Build Coastguard Worker multi_ref_ = 1;
1554*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 1;
1555*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 3;
1556*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 1 * cfg_.rc_target_bitrate / 8;
1557*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 3 * cfg_.rc_target_bitrate / 8;
1558*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = 4 * cfg_.rc_target_bitrate / 8;
1559*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1560*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1561*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.80)
1562*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1563*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.38)
1564*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1565*77c1e3ccSAndroid Build Coastguard Worker }
1566*77c1e3ccSAndroid Build Coastguard Worker }
1567*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC3TL3SLTest()1568*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC3TL3SLTest() {
1569*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1570*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1571*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1572*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1573*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1574*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
1575*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1576*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1577*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1578*77c1e3ccSAndroid Build Coastguard Worker
1579*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
1580*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
1581*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 600, 1200 };
1582*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1583*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1584*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
1585*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 3;
1586*77c1e3ccSAndroid Build Coastguard Worker // SL0
1587*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl0 = 1 * cfg_.rc_target_bitrate / 8;
1588*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * bitrate_sl0 / 100;
1589*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * bitrate_sl0 / 100;
1590*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = bitrate_sl0;
1591*77c1e3ccSAndroid Build Coastguard Worker // SL1
1592*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl1 = 3 * cfg_.rc_target_bitrate / 8;
1593*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[3] = 50 * bitrate_sl1 / 100;
1594*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[4] = 70 * bitrate_sl1 / 100;
1595*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[5] = bitrate_sl1;
1596*77c1e3ccSAndroid Build Coastguard Worker // SL2
1597*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl2 = 4 * cfg_.rc_target_bitrate / 8;
1598*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[6] = 50 * bitrate_sl2 / 100;
1599*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[7] = 70 * bitrate_sl2 / 100;
1600*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[8] = bitrate_sl2;
1601*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1602*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1603*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.50)
1604*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1605*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.38)
1606*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1607*77c1e3ccSAndroid Build Coastguard Worker }
1608*77c1e3ccSAndroid Build Coastguard Worker }
1609*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC3TL3SLHDTest()1610*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC3TL3SLHDTest() {
1611*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1612*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1613*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1614*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1615*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1616*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
1617*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1618*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1619*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1620*77c1e3ccSAndroid Build Coastguard Worker
1621*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::Y4mVideoSource video("niklas_1280_720_30.y4m", 0, 60);
1622*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 600, 1200 };
1623*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1624*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1625*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
1626*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 3;
1627*77c1e3ccSAndroid Build Coastguard Worker // SL0
1628*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl0 = 1 * cfg_.rc_target_bitrate / 8;
1629*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * bitrate_sl0 / 100;
1630*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * bitrate_sl0 / 100;
1631*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = bitrate_sl0;
1632*77c1e3ccSAndroid Build Coastguard Worker // SL1
1633*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl1 = 3 * cfg_.rc_target_bitrate / 8;
1634*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[3] = 50 * bitrate_sl1 / 100;
1635*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[4] = 70 * bitrate_sl1 / 100;
1636*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[5] = bitrate_sl1;
1637*77c1e3ccSAndroid Build Coastguard Worker // SL2
1638*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl2 = 4 * cfg_.rc_target_bitrate / 8;
1639*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[6] = 50 * bitrate_sl2 / 100;
1640*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[7] = 70 * bitrate_sl2 / 100;
1641*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[8] = bitrate_sl2;
1642*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1643*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1644*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.70)
1645*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1646*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.45)
1647*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1648*77c1e3ccSAndroid Build Coastguard Worker }
1649*77c1e3ccSAndroid Build Coastguard Worker }
1650*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingFixedModeSVC3TL3SLHDTest()1651*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingFixedModeSVC3TL3SLHDTest() {
1652*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1653*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1654*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1655*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1656*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1657*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
1658*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1659*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1660*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1661*77c1e3ccSAndroid Build Coastguard Worker
1662*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::Y4mVideoSource video("niklas_1280_720_30.y4m", 0, 60);
1663*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 600, 1200 };
1664*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1665*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1666*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
1667*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 3;
1668*77c1e3ccSAndroid Build Coastguard Worker use_fixed_mode_svc_ = 1;
1669*77c1e3ccSAndroid Build Coastguard Worker // SL0
1670*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl0 = 1 * cfg_.rc_target_bitrate / 8;
1671*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * bitrate_sl0 / 100;
1672*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * bitrate_sl0 / 100;
1673*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = bitrate_sl0;
1674*77c1e3ccSAndroid Build Coastguard Worker // SL1
1675*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl1 = 3 * cfg_.rc_target_bitrate / 8;
1676*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[3] = 50 * bitrate_sl1 / 100;
1677*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[4] = 70 * bitrate_sl1 / 100;
1678*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[5] = bitrate_sl1;
1679*77c1e3ccSAndroid Build Coastguard Worker // SL2
1680*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl2 = 4 * cfg_.rc_target_bitrate / 8;
1681*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[6] = 50 * bitrate_sl2 / 100;
1682*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[7] = 70 * bitrate_sl2 / 100;
1683*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[8] = bitrate_sl2;
1684*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1685*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1686*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.70)
1687*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1688*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.45)
1689*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1690*77c1e3ccSAndroid Build Coastguard Worker }
1691*77c1e3ccSAndroid Build Coastguard Worker }
1692*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC3TL3SLMultiThreadSpeedPerLayerTest()1693*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC3TL3SLMultiThreadSpeedPerLayerTest() {
1694*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1695*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1696*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1697*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1698*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1699*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
1700*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1701*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1702*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1703*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_threads = 2;
1704*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("niklas_640_480_30.yuv", 640, 480, 30,
1705*77c1e3ccSAndroid Build Coastguard Worker 1, 0, 400);
1706*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_w = 640;
1707*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_h = 480;
1708*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 600, 1200 };
1709*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1710*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1711*77c1e3ccSAndroid Build Coastguard Worker tile_columns_ = 1;
1712*77c1e3ccSAndroid Build Coastguard Worker tile_rows_ = 0;
1713*77c1e3ccSAndroid Build Coastguard Worker set_speed_per_layer_ = true;
1714*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
1715*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 3;
1716*77c1e3ccSAndroid Build Coastguard Worker // SL0
1717*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl0 = 1 * cfg_.rc_target_bitrate / 8;
1718*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * bitrate_sl0 / 100;
1719*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * bitrate_sl0 / 100;
1720*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = bitrate_sl0;
1721*77c1e3ccSAndroid Build Coastguard Worker // SL1
1722*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl1 = 3 * cfg_.rc_target_bitrate / 8;
1723*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[3] = 50 * bitrate_sl1 / 100;
1724*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[4] = 70 * bitrate_sl1 / 100;
1725*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[5] = bitrate_sl1;
1726*77c1e3ccSAndroid Build Coastguard Worker // SL2
1727*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl2 = 4 * cfg_.rc_target_bitrate / 8;
1728*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[6] = 50 * bitrate_sl2 / 100;
1729*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[7] = 70 * bitrate_sl2 / 100;
1730*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[8] = bitrate_sl2;
1731*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1732*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1733*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.70)
1734*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1735*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.45)
1736*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1737*77c1e3ccSAndroid Build Coastguard Worker }
1738*77c1e3ccSAndroid Build Coastguard Worker }
1739*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC3TL3SLHDMultiThread2Test()1740*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC3TL3SLHDMultiThread2Test() {
1741*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1742*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1743*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1744*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1745*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1746*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
1747*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1748*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1749*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1750*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_threads = 2;
1751*77c1e3ccSAndroid Build Coastguard Worker
1752*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::Y4mVideoSource video("niklas_1280_720_30.y4m", 0, 60);
1753*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 600, 1200 };
1754*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1755*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1756*77c1e3ccSAndroid Build Coastguard Worker tile_columns_ = 1;
1757*77c1e3ccSAndroid Build Coastguard Worker tile_rows_ = 0;
1758*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
1759*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 3;
1760*77c1e3ccSAndroid Build Coastguard Worker // SL0
1761*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl0 = 1 * cfg_.rc_target_bitrate / 8;
1762*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * bitrate_sl0 / 100;
1763*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * bitrate_sl0 / 100;
1764*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = bitrate_sl0;
1765*77c1e3ccSAndroid Build Coastguard Worker // SL1
1766*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl1 = 3 * cfg_.rc_target_bitrate / 8;
1767*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[3] = 50 * bitrate_sl1 / 100;
1768*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[4] = 70 * bitrate_sl1 / 100;
1769*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[5] = bitrate_sl1;
1770*77c1e3ccSAndroid Build Coastguard Worker // SL2
1771*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl2 = 4 * cfg_.rc_target_bitrate / 8;
1772*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[6] = 50 * bitrate_sl2 / 100;
1773*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[7] = 70 * bitrate_sl2 / 100;
1774*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[8] = bitrate_sl2;
1775*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1776*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1777*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.70)
1778*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1779*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.45)
1780*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1781*77c1e3ccSAndroid Build Coastguard Worker }
1782*77c1e3ccSAndroid Build Coastguard Worker }
1783*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC2TL1SLHDMultiThread4Test()1784*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC2TL1SLHDMultiThread4Test() {
1785*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1786*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1787*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1788*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1789*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1790*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
1791*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1792*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1793*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1794*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_threads = 4;
1795*77c1e3ccSAndroid Build Coastguard Worker
1796*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::Y4mVideoSource video("niklas_1280_720_30.y4m", 0, 60);
1797*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 600, 1200 };
1798*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1799*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1800*77c1e3ccSAndroid Build Coastguard Worker tile_columns_ = 1;
1801*77c1e3ccSAndroid Build Coastguard Worker tile_rows_ = 1;
1802*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 2;
1803*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 1;
1804*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 60 * cfg_.rc_target_bitrate / 100;
1805*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = cfg_.rc_target_bitrate;
1806*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1807*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1808*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.70)
1809*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1810*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.45)
1811*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1812*77c1e3ccSAndroid Build Coastguard Worker }
1813*77c1e3ccSAndroid Build Coastguard Worker }
1814*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC2TL1SLHDMultiThread4AutoTilesTest()1815*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC2TL1SLHDMultiThread4AutoTilesTest() {
1816*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1817*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1818*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1819*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1820*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1821*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
1822*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1823*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1824*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1825*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_threads = 4;
1826*77c1e3ccSAndroid Build Coastguard Worker
1827*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::Y4mVideoSource video("niklas_1280_720_30.y4m", 0, 60);
1828*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 600, 1200 };
1829*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1830*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1831*77c1e3ccSAndroid Build Coastguard Worker auto_tiles_ = 1;
1832*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 2;
1833*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 1;
1834*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 60 * cfg_.rc_target_bitrate / 100;
1835*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = cfg_.rc_target_bitrate;
1836*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1837*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1838*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.70)
1839*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1840*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.45)
1841*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1842*77c1e3ccSAndroid Build Coastguard Worker }
1843*77c1e3ccSAndroid Build Coastguard Worker }
1844*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC3TL3SLHDMultiThread4Test()1845*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC3TL3SLHDMultiThread4Test() {
1846*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1847*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1848*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1849*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1850*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1851*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
1852*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1853*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1854*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1855*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_threads = 4;
1856*77c1e3ccSAndroid Build Coastguard Worker
1857*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::Y4mVideoSource video("niklas_1280_720_30.y4m", 0, 60);
1858*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 600, 1200 };
1859*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1860*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1861*77c1e3ccSAndroid Build Coastguard Worker tile_columns_ = 1;
1862*77c1e3ccSAndroid Build Coastguard Worker tile_rows_ = 1;
1863*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
1864*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 3;
1865*77c1e3ccSAndroid Build Coastguard Worker // SL0
1866*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl0 = 1 * cfg_.rc_target_bitrate / 8;
1867*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * bitrate_sl0 / 100;
1868*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * bitrate_sl0 / 100;
1869*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = bitrate_sl0;
1870*77c1e3ccSAndroid Build Coastguard Worker // SL1
1871*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl1 = 3 * cfg_.rc_target_bitrate / 8;
1872*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[3] = 50 * bitrate_sl1 / 100;
1873*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[4] = 70 * bitrate_sl1 / 100;
1874*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[5] = bitrate_sl1;
1875*77c1e3ccSAndroid Build Coastguard Worker // SL2
1876*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl2 = 4 * cfg_.rc_target_bitrate / 8;
1877*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[6] = 50 * bitrate_sl2 / 100;
1878*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[7] = 70 * bitrate_sl2 / 100;
1879*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[8] = bitrate_sl2;
1880*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1881*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1882*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.70)
1883*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1884*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.45)
1885*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1886*77c1e3ccSAndroid Build Coastguard Worker }
1887*77c1e3ccSAndroid Build Coastguard Worker }
1888*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC3TL3SLHDMultiRefTest()1889*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC3TL3SLHDMultiRefTest() {
1890*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1891*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1892*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1893*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1894*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1895*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
1896*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1897*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1898*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1899*77c1e3ccSAndroid Build Coastguard Worker
1900*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::Y4mVideoSource video("niklas_1280_720_30.y4m", 0, 60);
1901*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 600, 1200 };
1902*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1903*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1904*77c1e3ccSAndroid Build Coastguard Worker multi_ref_ = 1;
1905*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
1906*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 3;
1907*77c1e3ccSAndroid Build Coastguard Worker // SL0
1908*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl0 = 1 * cfg_.rc_target_bitrate / 8;
1909*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * bitrate_sl0 / 100;
1910*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * bitrate_sl0 / 100;
1911*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = bitrate_sl0;
1912*77c1e3ccSAndroid Build Coastguard Worker // SL1
1913*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl1 = 3 * cfg_.rc_target_bitrate / 8;
1914*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[3] = 50 * bitrate_sl1 / 100;
1915*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[4] = 70 * bitrate_sl1 / 100;
1916*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[5] = bitrate_sl1;
1917*77c1e3ccSAndroid Build Coastguard Worker // SL2
1918*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl2 = 4 * cfg_.rc_target_bitrate / 8;
1919*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[6] = 50 * bitrate_sl2 / 100;
1920*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[7] = 70 * bitrate_sl2 / 100;
1921*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[8] = bitrate_sl2;
1922*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1923*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1924*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.70)
1925*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1926*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.45)
1927*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1928*77c1e3ccSAndroid Build Coastguard Worker }
1929*77c1e3ccSAndroid Build Coastguard Worker }
1930*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC3TL3SLKfTest()1931*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC3TL3SLKfTest() {
1932*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1933*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1934*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1935*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1936*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1937*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
1938*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1939*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1940*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1941*77c1e3ccSAndroid Build Coastguard Worker cfg_.kf_mode = AOM_KF_AUTO;
1942*77c1e3ccSAndroid Build Coastguard Worker cfg_.kf_min_dist = cfg_.kf_max_dist = 100;
1943*77c1e3ccSAndroid Build Coastguard Worker
1944*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
1945*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
1946*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 600, 1200 };
1947*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1948*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1949*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
1950*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 3;
1951*77c1e3ccSAndroid Build Coastguard Worker // SL0
1952*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl0 = 1 * cfg_.rc_target_bitrate / 8;
1953*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * bitrate_sl0 / 100;
1954*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * bitrate_sl0 / 100;
1955*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = bitrate_sl0;
1956*77c1e3ccSAndroid Build Coastguard Worker // SL1
1957*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl1 = 3 * cfg_.rc_target_bitrate / 8;
1958*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[3] = 50 * bitrate_sl1 / 100;
1959*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[4] = 70 * bitrate_sl1 / 100;
1960*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[5] = bitrate_sl1;
1961*77c1e3ccSAndroid Build Coastguard Worker // SL2
1962*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl2 = 4 * cfg_.rc_target_bitrate / 8;
1963*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[6] = 50 * bitrate_sl2 / 100;
1964*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[7] = 70 * bitrate_sl2 / 100;
1965*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[8] = bitrate_sl2;
1966*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1967*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1968*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.55)
1969*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
1970*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.4)
1971*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
1972*77c1e3ccSAndroid Build Coastguard Worker }
1973*77c1e3ccSAndroid Build Coastguard Worker }
1974*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargeting444SVC3TL3SLTest()1975*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargeting444SVC3TL3SLTest() {
1976*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
1977*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
1978*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
1979*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
1980*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
1981*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
1982*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
1983*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
1984*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
1985*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_profile = 1;
1986*77c1e3ccSAndroid Build Coastguard Worker
1987*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::Y4mVideoSource video("rush_hour_444.y4m", 0, 140);
1988*77c1e3ccSAndroid Build Coastguard Worker
1989*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 600, 1200 };
1990*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1991*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
1992*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
1993*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 3;
1994*77c1e3ccSAndroid Build Coastguard Worker // SL0
1995*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl0 = 1 * cfg_.rc_target_bitrate / 8;
1996*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * bitrate_sl0 / 100;
1997*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * bitrate_sl0 / 100;
1998*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = bitrate_sl0;
1999*77c1e3ccSAndroid Build Coastguard Worker // SL1
2000*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl1 = 3 * cfg_.rc_target_bitrate / 8;
2001*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[3] = 50 * bitrate_sl1 / 100;
2002*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[4] = 70 * bitrate_sl1 / 100;
2003*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[5] = bitrate_sl1;
2004*77c1e3ccSAndroid Build Coastguard Worker // SL2
2005*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl2 = 4 * cfg_.rc_target_bitrate / 8;
2006*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[6] = 50 * bitrate_sl2 / 100;
2007*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[7] = 70 * bitrate_sl2 / 100;
2008*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[8] = bitrate_sl2;
2009*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
2010*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
2011*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.70)
2012*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
2013*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.38)
2014*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
2015*77c1e3ccSAndroid Build Coastguard Worker }
2016*77c1e3ccSAndroid Build Coastguard Worker }
2017*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC3TL1SLMultiRefDropAllEnhTest()2018*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC3TL1SLMultiRefDropAllEnhTest() {
2019*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
2020*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
2021*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
2022*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
2023*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
2024*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
2025*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
2026*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
2027*77c1e3ccSAndroid Build Coastguard Worker // error_resilient can set to off/0, since for SVC the context update
2028*77c1e3ccSAndroid Build Coastguard Worker // is done per-layer.
2029*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
2030*77c1e3ccSAndroid Build Coastguard Worker
2031*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
2032*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
2033*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 200, 550 };
2034*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
2035*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
2036*77c1e3ccSAndroid Build Coastguard Worker multi_ref_ = 1;
2037*77c1e3ccSAndroid Build Coastguard Worker // Drop TL1 and TL2: #frames(300) - #TL0.
2038*77c1e3ccSAndroid Build Coastguard Worker drop_frames_ = 300 - 300 / 4;
2039*77c1e3ccSAndroid Build Coastguard Worker int n = 0;
2040*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < 300; i++) {
2041*77c1e3ccSAndroid Build Coastguard Worker if (i % 4 != 0) {
2042*77c1e3ccSAndroid Build Coastguard Worker drop_frames_list_[n] = i;
2043*77c1e3ccSAndroid Build Coastguard Worker n++;
2044*77c1e3ccSAndroid Build Coastguard Worker }
2045*77c1e3ccSAndroid Build Coastguard Worker }
2046*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
2047*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * cfg_.rc_target_bitrate / 100;
2048*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * cfg_.rc_target_bitrate / 100;
2049*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = cfg_.rc_target_bitrate;
2050*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
2051*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
2052*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.60)
2053*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
2054*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.60)
2055*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
2056*77c1e3ccSAndroid Build Coastguard Worker }
2057*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
2058*77c1e3ccSAndroid Build Coastguard Worker // Test that no mismatches have been found.
2059*77c1e3ccSAndroid Build Coastguard Worker std::cout << " Decoded frames: " << GetDecodedFrames() << "\n";
2060*77c1e3ccSAndroid Build Coastguard Worker std::cout << " Mismatch frames: " << GetMismatchFrames() << "\n";
2061*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ(300 - GetDecodedFrames(), drop_frames_);
2062*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ((int)GetMismatchFrames(), 0);
2063*77c1e3ccSAndroid Build Coastguard Worker #endif
2064*77c1e3ccSAndroid Build Coastguard Worker }
2065*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC3TL1SLDropAllEnhTest()2066*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC3TL1SLDropAllEnhTest() {
2067*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
2068*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
2069*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
2070*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
2071*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
2072*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
2073*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
2074*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
2075*77c1e3ccSAndroid Build Coastguard Worker // error_resilient can set to off/0, since for SVC the context update
2076*77c1e3ccSAndroid Build Coastguard Worker // is done per-layer.
2077*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
2078*77c1e3ccSAndroid Build Coastguard Worker
2079*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
2080*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
2081*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 200, 550 };
2082*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
2083*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
2084*77c1e3ccSAndroid Build Coastguard Worker // Drop TL1 and TL2: #frames(300) - #TL0.
2085*77c1e3ccSAndroid Build Coastguard Worker drop_frames_ = 300 - 300 / 4;
2086*77c1e3ccSAndroid Build Coastguard Worker int n = 0;
2087*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < 300; i++) {
2088*77c1e3ccSAndroid Build Coastguard Worker if (i % 4 != 0) {
2089*77c1e3ccSAndroid Build Coastguard Worker drop_frames_list_[n] = i;
2090*77c1e3ccSAndroid Build Coastguard Worker n++;
2091*77c1e3ccSAndroid Build Coastguard Worker }
2092*77c1e3ccSAndroid Build Coastguard Worker }
2093*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
2094*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * cfg_.rc_target_bitrate / 100;
2095*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * cfg_.rc_target_bitrate / 100;
2096*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = cfg_.rc_target_bitrate;
2097*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
2098*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
2099*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.60)
2100*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
2101*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.60)
2102*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
2103*77c1e3ccSAndroid Build Coastguard Worker }
2104*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
2105*77c1e3ccSAndroid Build Coastguard Worker // Test that no mismatches have been found.
2106*77c1e3ccSAndroid Build Coastguard Worker std::cout << " Decoded frames: " << GetDecodedFrames() << "\n";
2107*77c1e3ccSAndroid Build Coastguard Worker std::cout << " Mismatch frames: " << GetMismatchFrames() << "\n";
2108*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ(300 - GetDecodedFrames(), drop_frames_);
2109*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ((int)GetMismatchFrames(), 0);
2110*77c1e3ccSAndroid Build Coastguard Worker #endif
2111*77c1e3ccSAndroid Build Coastguard Worker }
2112*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC3TL1SLDropTL2EnhTest()2113*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC3TL1SLDropTL2EnhTest() {
2114*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
2115*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
2116*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
2117*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
2118*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
2119*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
2120*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
2121*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
2122*77c1e3ccSAndroid Build Coastguard Worker // error_resilient for sequence can be off/0, since dropped frames (TL2)
2123*77c1e3ccSAndroid Build Coastguard Worker // are non-reference frames.
2124*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
2125*77c1e3ccSAndroid Build Coastguard Worker
2126*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
2127*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
2128*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 200, 550 };
2129*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
2130*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
2131*77c1e3ccSAndroid Build Coastguard Worker // Drop TL2: #frames(300) - (#TL0 + #TL1).
2132*77c1e3ccSAndroid Build Coastguard Worker drop_frames_ = 300 - 300 / 2;
2133*77c1e3ccSAndroid Build Coastguard Worker int n = 0;
2134*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < 300; i++) {
2135*77c1e3ccSAndroid Build Coastguard Worker if (i % 2 != 0) {
2136*77c1e3ccSAndroid Build Coastguard Worker drop_frames_list_[n] = i;
2137*77c1e3ccSAndroid Build Coastguard Worker n++;
2138*77c1e3ccSAndroid Build Coastguard Worker }
2139*77c1e3ccSAndroid Build Coastguard Worker }
2140*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
2141*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * cfg_.rc_target_bitrate / 100;
2142*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * cfg_.rc_target_bitrate / 100;
2143*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = cfg_.rc_target_bitrate;
2144*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
2145*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
2146*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.60)
2147*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
2148*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.60)
2149*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
2150*77c1e3ccSAndroid Build Coastguard Worker }
2151*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
2152*77c1e3ccSAndroid Build Coastguard Worker // Test that no mismatches have been found.
2153*77c1e3ccSAndroid Build Coastguard Worker std::cout << " Decoded frames: " << GetDecodedFrames() << "\n";
2154*77c1e3ccSAndroid Build Coastguard Worker std::cout << " Mismatch frames: " << GetMismatchFrames() << "\n";
2155*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ(300 - GetDecodedFrames(), drop_frames_);
2156*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ((int)GetMismatchFrames(), 0);
2157*77c1e3ccSAndroid Build Coastguard Worker #endif
2158*77c1e3ccSAndroid Build Coastguard Worker }
2159*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC3TL1SLDropAllEnhFrameERTest()2160*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC3TL1SLDropAllEnhFrameERTest() {
2161*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
2162*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
2163*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
2164*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
2165*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
2166*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
2167*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
2168*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
2169*77c1e3ccSAndroid Build Coastguard Worker
2170*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
2171*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
2172*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 200, 550 };
2173*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
2174*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
2175*77c1e3ccSAndroid Build Coastguard Worker // Set error_resilience at frame level, with codec control,
2176*77c1e3ccSAndroid Build Coastguard Worker // on/1 for enahancement layers and off/0 for base layer frames.
2177*77c1e3ccSAndroid Build Coastguard Worker set_frame_level_er_ = 1;
2178*77c1e3ccSAndroid Build Coastguard Worker
2179*77c1e3ccSAndroid Build Coastguard Worker // Drop TL1 and TL2: #frames(300) - #TL0.
2180*77c1e3ccSAndroid Build Coastguard Worker drop_frames_ = 300 - 300 / 4;
2181*77c1e3ccSAndroid Build Coastguard Worker int n = 0;
2182*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < 300; i++) {
2183*77c1e3ccSAndroid Build Coastguard Worker if (i % 4 != 0) {
2184*77c1e3ccSAndroid Build Coastguard Worker drop_frames_list_[n] = i;
2185*77c1e3ccSAndroid Build Coastguard Worker n++;
2186*77c1e3ccSAndroid Build Coastguard Worker }
2187*77c1e3ccSAndroid Build Coastguard Worker }
2188*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
2189*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * cfg_.rc_target_bitrate / 100;
2190*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * cfg_.rc_target_bitrate / 100;
2191*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = cfg_.rc_target_bitrate;
2192*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
2193*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
2194*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.60)
2195*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
2196*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.60)
2197*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
2198*77c1e3ccSAndroid Build Coastguard Worker }
2199*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
2200*77c1e3ccSAndroid Build Coastguard Worker // Test that no mismatches have been found.
2201*77c1e3ccSAndroid Build Coastguard Worker std::cout << " Decoded frames: " << GetDecodedFrames() << "\n";
2202*77c1e3ccSAndroid Build Coastguard Worker std::cout << " Mismatch frames: " << GetMismatchFrames() << "\n";
2203*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ(300 - GetDecodedFrames(), drop_frames_);
2204*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ((int)GetMismatchFrames(), 0);
2205*77c1e3ccSAndroid Build Coastguard Worker #endif
2206*77c1e3ccSAndroid Build Coastguard Worker }
2207*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC3TL1SLDropSetEnhFrameERTest()2208*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC3TL1SLDropSetEnhFrameERTest() {
2209*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
2210*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
2211*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
2212*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
2213*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
2214*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
2215*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
2216*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
2217*77c1e3ccSAndroid Build Coastguard Worker
2218*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
2219*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
2220*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 200, 550 };
2221*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
2222*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
2223*77c1e3ccSAndroid Build Coastguard Worker // Set error_resilience at frame level, with codec control,
2224*77c1e3ccSAndroid Build Coastguard Worker // on/1 for enahancement layers and off/0 for base layer frames.
2225*77c1e3ccSAndroid Build Coastguard Worker set_frame_level_er_ = 1;
2226*77c1e3ccSAndroid Build Coastguard Worker
2227*77c1e3ccSAndroid Build Coastguard Worker // Drop TL1 and TL2: for part of sequence. Start at first TL2 at
2228*77c1e3ccSAndroid Build Coastguard Worker // frame 101, and end at second T2 at frame 199. Frame 200 is TL0,
2229*77c1e3ccSAndroid Build Coastguard Worker // so we can continue decoding without mismatch (since LAST is the
2230*77c1e3ccSAndroid Build Coastguard Worker // only reference and error_resilient = 1 on TL1/TL2 frames).
2231*77c1e3ccSAndroid Build Coastguard Worker int n = 0;
2232*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
2233*77c1e3ccSAndroid Build Coastguard Worker int num_nonref = 300 / 2;
2234*77c1e3ccSAndroid Build Coastguard Worker #endif
2235*77c1e3ccSAndroid Build Coastguard Worker for (int i = 101; i < 200; i++) {
2236*77c1e3ccSAndroid Build Coastguard Worker if (i % 4 != 0) {
2237*77c1e3ccSAndroid Build Coastguard Worker drop_frames_list_[n] = i;
2238*77c1e3ccSAndroid Build Coastguard Worker n++;
2239*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
2240*77c1e3ccSAndroid Build Coastguard Worker if (i % 2 != 0) num_nonref -= 1;
2241*77c1e3ccSAndroid Build Coastguard Worker #endif
2242*77c1e3ccSAndroid Build Coastguard Worker }
2243*77c1e3ccSAndroid Build Coastguard Worker }
2244*77c1e3ccSAndroid Build Coastguard Worker drop_frames_ = n;
2245*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
2246*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * cfg_.rc_target_bitrate / 100;
2247*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * cfg_.rc_target_bitrate / 100;
2248*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = cfg_.rc_target_bitrate;
2249*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
2250*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
2251*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.60)
2252*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
2253*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.60)
2254*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
2255*77c1e3ccSAndroid Build Coastguard Worker }
2256*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
2257*77c1e3ccSAndroid Build Coastguard Worker // Test that no mismatches have been found.
2258*77c1e3ccSAndroid Build Coastguard Worker std::cout << " Decoded frames: " << GetDecodedFrames() << "\n";
2259*77c1e3ccSAndroid Build Coastguard Worker std::cout << " Mismatch frames: " << GetMismatchFrames() << "\n";
2260*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ(300 - GetDecodedFrames(), drop_frames_);
2261*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ((int)GetMismatchFrames(), num_nonref);
2262*77c1e3ccSAndroid Build Coastguard Worker #endif
2263*77c1e3ccSAndroid Build Coastguard Worker }
2264*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC2TL1SLDropSetEnhER0Test()2265*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC2TL1SLDropSetEnhER0Test() {
2266*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
2267*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
2268*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
2269*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
2270*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
2271*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
2272*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
2273*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
2274*77c1e3ccSAndroid Build Coastguard Worker
2275*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
2276*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
2277*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 200, 550 };
2278*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
2279*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
2280*77c1e3ccSAndroid Build Coastguard Worker
2281*77c1e3ccSAndroid Build Coastguard Worker // Set error_resilience off.
2282*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
2283*77c1e3ccSAndroid Build Coastguard Worker
2284*77c1e3ccSAndroid Build Coastguard Worker // Drop TL1: for part of sequence. Start at first TL1 at
2285*77c1e3ccSAndroid Build Coastguard Worker // frame 101, and end at frame 199. Frame 200 is TL0,
2286*77c1e3ccSAndroid Build Coastguard Worker // so we can continue decoding without mismatch (since LAST is the
2287*77c1e3ccSAndroid Build Coastguard Worker // only reference).
2288*77c1e3ccSAndroid Build Coastguard Worker int n = 0;
2289*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
2290*77c1e3ccSAndroid Build Coastguard Worker int num_nonref = 300 / 2;
2291*77c1e3ccSAndroid Build Coastguard Worker #endif
2292*77c1e3ccSAndroid Build Coastguard Worker for (int i = 101; i < 200; i++) {
2293*77c1e3ccSAndroid Build Coastguard Worker if (i % 2 != 0) {
2294*77c1e3ccSAndroid Build Coastguard Worker drop_frames_list_[n] = i;
2295*77c1e3ccSAndroid Build Coastguard Worker n++;
2296*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
2297*77c1e3ccSAndroid Build Coastguard Worker if (i % 2 != 0) num_nonref -= 1;
2298*77c1e3ccSAndroid Build Coastguard Worker #endif
2299*77c1e3ccSAndroid Build Coastguard Worker }
2300*77c1e3ccSAndroid Build Coastguard Worker }
2301*77c1e3ccSAndroid Build Coastguard Worker drop_frames_ = n;
2302*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 2;
2303*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 70 * cfg_.rc_target_bitrate / 100;
2304*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = cfg_.rc_target_bitrate;
2305*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
2306*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
2307*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.60)
2308*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
2309*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.60)
2310*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
2311*77c1e3ccSAndroid Build Coastguard Worker }
2312*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
2313*77c1e3ccSAndroid Build Coastguard Worker // Test that no mismatches have been found.
2314*77c1e3ccSAndroid Build Coastguard Worker std::cout << " Decoded frames: " << GetDecodedFrames() << "\n";
2315*77c1e3ccSAndroid Build Coastguard Worker std::cout << " Mismatch frames: " << GetMismatchFrames() << "\n";
2316*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ(300 - GetDecodedFrames(), drop_frames_);
2317*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ((int)GetMismatchFrames(), num_nonref);
2318*77c1e3ccSAndroid Build Coastguard Worker #endif
2319*77c1e3ccSAndroid Build Coastguard Worker }
2320*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC3TL1SLDropSetEnhER0Test()2321*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC3TL1SLDropSetEnhER0Test() {
2322*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
2323*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
2324*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
2325*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
2326*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
2327*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
2328*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
2329*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
2330*77c1e3ccSAndroid Build Coastguard Worker
2331*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
2332*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
2333*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 200, 550 };
2334*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
2335*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
2336*77c1e3ccSAndroid Build Coastguard Worker
2337*77c1e3ccSAndroid Build Coastguard Worker // Set error_resilience off.
2338*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
2339*77c1e3ccSAndroid Build Coastguard Worker
2340*77c1e3ccSAndroid Build Coastguard Worker // Drop TL1 and TL2: for part of sequence. Start at first TL2 at
2341*77c1e3ccSAndroid Build Coastguard Worker // frame 101, and end at second T2 at frame 199. Frame 200 is TL0,
2342*77c1e3ccSAndroid Build Coastguard Worker // so we can continue decoding without mismatch (since LAST is the
2343*77c1e3ccSAndroid Build Coastguard Worker // only reference).
2344*77c1e3ccSAndroid Build Coastguard Worker int n = 0;
2345*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
2346*77c1e3ccSAndroid Build Coastguard Worker int num_nonref = 300 / 2;
2347*77c1e3ccSAndroid Build Coastguard Worker #endif
2348*77c1e3ccSAndroid Build Coastguard Worker for (int i = 101; i < 200; i++) {
2349*77c1e3ccSAndroid Build Coastguard Worker if (i % 4 != 0) {
2350*77c1e3ccSAndroid Build Coastguard Worker drop_frames_list_[n] = i;
2351*77c1e3ccSAndroid Build Coastguard Worker n++;
2352*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
2353*77c1e3ccSAndroid Build Coastguard Worker if (i % 2 != 0) num_nonref -= 1;
2354*77c1e3ccSAndroid Build Coastguard Worker #endif
2355*77c1e3ccSAndroid Build Coastguard Worker }
2356*77c1e3ccSAndroid Build Coastguard Worker }
2357*77c1e3ccSAndroid Build Coastguard Worker drop_frames_ = n;
2358*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
2359*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * cfg_.rc_target_bitrate / 100;
2360*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * cfg_.rc_target_bitrate / 100;
2361*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = cfg_.rc_target_bitrate;
2362*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
2363*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
2364*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.60)
2365*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
2366*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.60)
2367*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
2368*77c1e3ccSAndroid Build Coastguard Worker }
2369*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
2370*77c1e3ccSAndroid Build Coastguard Worker // Test that no mismatches have been found.
2371*77c1e3ccSAndroid Build Coastguard Worker std::cout << " Decoded frames: " << GetDecodedFrames() << "\n";
2372*77c1e3ccSAndroid Build Coastguard Worker std::cout << " Mismatch frames: " << GetMismatchFrames() << "\n";
2373*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ(300 - GetDecodedFrames(), drop_frames_);
2374*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ((int)GetMismatchFrames(), num_nonref);
2375*77c1e3ccSAndroid Build Coastguard Worker #endif
2376*77c1e3ccSAndroid Build Coastguard Worker }
2377*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC3TL3SLDropSetEnhER0Test()2378*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC3TL3SLDropSetEnhER0Test() {
2379*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
2380*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
2381*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
2382*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
2383*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
2384*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
2385*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
2386*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
2387*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
2388*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
2389*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 200, 550 };
2390*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
2391*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
2392*77c1e3ccSAndroid Build Coastguard Worker // Set error_resilience off.
2393*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
2394*77c1e3ccSAndroid Build Coastguard Worker // Drop TL1 and TL2: for part of sequence. Start at first TL2 at
2395*77c1e3ccSAndroid Build Coastguard Worker // frame 101, and end at second T2 at frame 199. Frame 200 is TL0,
2396*77c1e3ccSAndroid Build Coastguard Worker // so we can continue decoding without mismatch (since LAST is the
2397*77c1e3ccSAndroid Build Coastguard Worker // only reference).
2398*77c1e3ccSAndroid Build Coastguard Worker // Drop here means drop whole superframe.
2399*77c1e3ccSAndroid Build Coastguard Worker int n = 0;
2400*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
2401*77c1e3ccSAndroid Build Coastguard Worker int num_nonref = 300 / 2;
2402*77c1e3ccSAndroid Build Coastguard Worker #endif
2403*77c1e3ccSAndroid Build Coastguard Worker for (int i = 101; i < 200; i++) {
2404*77c1e3ccSAndroid Build Coastguard Worker if (i % 4 != 0) {
2405*77c1e3ccSAndroid Build Coastguard Worker drop_frames_list_[n] = i;
2406*77c1e3ccSAndroid Build Coastguard Worker n++;
2407*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
2408*77c1e3ccSAndroid Build Coastguard Worker if (i % 2 != 0) num_nonref -= 1;
2409*77c1e3ccSAndroid Build Coastguard Worker #endif
2410*77c1e3ccSAndroid Build Coastguard Worker }
2411*77c1e3ccSAndroid Build Coastguard Worker }
2412*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
2413*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 3;
2414*77c1e3ccSAndroid Build Coastguard Worker multi_ref_ = 1;
2415*77c1e3ccSAndroid Build Coastguard Worker drop_frames_ = n * number_spatial_layers_;
2416*77c1e3ccSAndroid Build Coastguard Worker // SL0
2417*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl0 = 1 * cfg_.rc_target_bitrate / 8;
2418*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * bitrate_sl0 / 100;
2419*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * bitrate_sl0 / 100;
2420*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = bitrate_sl0;
2421*77c1e3ccSAndroid Build Coastguard Worker // SL1
2422*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl1 = 3 * cfg_.rc_target_bitrate / 8;
2423*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[3] = 50 * bitrate_sl1 / 100;
2424*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[4] = 70 * bitrate_sl1 / 100;
2425*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[5] = bitrate_sl1;
2426*77c1e3ccSAndroid Build Coastguard Worker // SL2
2427*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_sl2 = 4 * cfg_.rc_target_bitrate / 8;
2428*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[6] = 50 * bitrate_sl2 / 100;
2429*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[7] = 70 * bitrate_sl2 / 100;
2430*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[8] = bitrate_sl2;
2431*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
2432*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
2433*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.60)
2434*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
2435*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.60)
2436*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
2437*77c1e3ccSAndroid Build Coastguard Worker }
2438*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
2439*77c1e3ccSAndroid Build Coastguard Worker // Test that no mismatches have been found.
2440*77c1e3ccSAndroid Build Coastguard Worker std::cout << " Decoded frames: " << GetDecodedFrames() << "\n";
2441*77c1e3ccSAndroid Build Coastguard Worker std::cout << " Mismatch frames: " << GetMismatchFrames() << "\n";
2442*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ(300 * number_spatial_layers_ - GetDecodedFrames(), drop_frames_);
2443*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ((int)GetMismatchFrames(), num_nonref);
2444*77c1e3ccSAndroid Build Coastguard Worker #endif
2445*77c1e3ccSAndroid Build Coastguard Worker }
2446*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC3TL1SLMultiRefCompoundTest()2447*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC3TL1SLMultiRefCompoundTest() {
2448*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
2449*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
2450*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
2451*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
2452*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
2453*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
2454*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
2455*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
2456*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
2457*77c1e3ccSAndroid Build Coastguard Worker
2458*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("niklas_640_480_30.yuv", 640, 480, 30,
2459*77c1e3ccSAndroid Build Coastguard Worker 1, 0, 400);
2460*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_w = 640;
2461*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_h = 480;
2462*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 400, 800 };
2463*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
2464*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
2465*77c1e3ccSAndroid Build Coastguard Worker multi_ref_ = 1;
2466*77c1e3ccSAndroid Build Coastguard Worker comp_pred_ = 1;
2467*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 3;
2468*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 1;
2469*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 50 * cfg_.rc_target_bitrate / 100;
2470*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 70 * cfg_.rc_target_bitrate / 100;
2471*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = cfg_.rc_target_bitrate;
2472*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
2473*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
2474*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.80)
2475*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
2476*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.60)
2477*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
2478*77c1e3ccSAndroid Build Coastguard Worker }
2479*77c1e3ccSAndroid Build Coastguard Worker }
2480*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC1TL3SLDynEnablTest()2481*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC1TL3SLDynEnablTest() {
2482*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
2483*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
2484*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
2485*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
2486*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
2487*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
2488*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
2489*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
2490*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
2491*77c1e3ccSAndroid Build Coastguard Worker
2492*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("niklas_640_480_30.yuv", 640, 480, 30,
2493*77c1e3ccSAndroid Build Coastguard Worker 1, 0, 400);
2494*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 500, 1000 };
2495*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
2496*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
2497*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 1;
2498*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 3;
2499*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 1 * cfg_.rc_target_bitrate / 8;
2500*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 3 * cfg_.rc_target_bitrate / 8;
2501*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = 4 * cfg_.rc_target_bitrate / 8;
2502*77c1e3ccSAndroid Build Coastguard Worker dynamic_enable_disable_mode_ = 1;
2503*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
2504*77c1e3ccSAndroid Build Coastguard Worker // No need to check RC on top layer which is disabled part of the time.
2505*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_spatial_layers_ - 1; i++) {
2506*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.80)
2507*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
2508*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.38)
2509*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
2510*77c1e3ccSAndroid Build Coastguard Worker }
2511*77c1e3ccSAndroid Build Coastguard Worker }
2512*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingSVC1TL3SLDynDisEnablTest()2513*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingSVC1TL3SLDynDisEnablTest() {
2514*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
2515*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
2516*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
2517*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
2518*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
2519*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
2520*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
2521*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
2522*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
2523*77c1e3ccSAndroid Build Coastguard Worker
2524*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
2525*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
2526*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 500, 1000 };
2527*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
2528*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
2529*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 1;
2530*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 3;
2531*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = 1 * cfg_.rc_target_bitrate / 8;
2532*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[1] = 3 * cfg_.rc_target_bitrate / 8;
2533*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[2] = 4 * cfg_.rc_target_bitrate / 8;
2534*77c1e3ccSAndroid Build Coastguard Worker dynamic_enable_disable_mode_ = 2;
2535*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
2536*77c1e3ccSAndroid Build Coastguard Worker // No need to check RC on top layer which is disabled part of the time.
2537*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_spatial_layers_ - 1; i++) {
2538*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.80)
2539*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
2540*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.38)
2541*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
2542*77c1e3ccSAndroid Build Coastguard Worker }
2543*77c1e3ccSAndroid Build Coastguard Worker }
2544*77c1e3ccSAndroid Build Coastguard Worker
BasicRateTargetingRPS1TL1SLDropFramesTest()2545*77c1e3ccSAndroid Build Coastguard Worker virtual void BasicRateTargetingRPS1TL1SLDropFramesTest() {
2546*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_initial_sz = 500;
2547*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_optimal_sz = 500;
2548*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_buf_sz = 1000;
2549*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_dropframe_thresh = 0;
2550*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_min_quantizer = 0;
2551*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_max_quantizer = 63;
2552*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_end_usage = AOM_CBR;
2553*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_lag_in_frames = 0;
2554*77c1e3ccSAndroid Build Coastguard Worker
2555*77c1e3ccSAndroid Build Coastguard Worker ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
2556*77c1e3ccSAndroid Build Coastguard Worker 288, 30, 1, 0, 300);
2557*77c1e3ccSAndroid Build Coastguard Worker const int bitrate_array[2] = { 100, 300 };
2558*77c1e3ccSAndroid Build Coastguard Worker cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
2559*77c1e3ccSAndroid Build Coastguard Worker ResetModel();
2560*77c1e3ccSAndroid Build Coastguard Worker rps_mode_ = 1;
2561*77c1e3ccSAndroid Build Coastguard Worker rps_recovery_frame_ = 100;
2562*77c1e3ccSAndroid Build Coastguard Worker cfg_.g_error_resilient = 0;
2563*77c1e3ccSAndroid Build Coastguard Worker // Drop x frames before the recovery frames (where the reference
2564*77c1e3ccSAndroid Build Coastguard Worker // is switched to an older reference (golden or altref).
2565*77c1e3ccSAndroid Build Coastguard Worker // GOLDEN is 8 frames behind (for the rps pattern example) so we can't
2566*77c1e3ccSAndroid Build Coastguard Worker // drop more than 8 frames recovery frame, so choose x = 7.
2567*77c1e3ccSAndroid Build Coastguard Worker int n = 0;
2568*77c1e3ccSAndroid Build Coastguard Worker for (int i = rps_recovery_frame_ - 7; i < rps_recovery_frame_; i++) {
2569*77c1e3ccSAndroid Build Coastguard Worker drop_frames_list_[n] = i;
2570*77c1e3ccSAndroid Build Coastguard Worker n++;
2571*77c1e3ccSAndroid Build Coastguard Worker }
2572*77c1e3ccSAndroid Build Coastguard Worker drop_frames_ = n;
2573*77c1e3ccSAndroid Build Coastguard Worker number_spatial_layers_ = 1;
2574*77c1e3ccSAndroid Build Coastguard Worker number_temporal_layers_ = 1;
2575*77c1e3ccSAndroid Build Coastguard Worker target_layer_bitrate_[0] = cfg_.rc_target_bitrate;
2576*77c1e3ccSAndroid Build Coastguard Worker ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
2577*77c1e3ccSAndroid Build Coastguard Worker for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
2578*77c1e3ccSAndroid Build Coastguard Worker ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.60)
2579*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is lower than target by too much!";
2580*77c1e3ccSAndroid Build Coastguard Worker ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.60)
2581*77c1e3ccSAndroid Build Coastguard Worker << " The datarate for the file is greater than target by too much!";
2582*77c1e3ccSAndroid Build Coastguard Worker }
2583*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_DECODER
2584*77c1e3ccSAndroid Build Coastguard Worker // Test that no mismatches have been found.
2585*77c1e3ccSAndroid Build Coastguard Worker std::cout << " Decoded frames: " << GetDecodedFrames() << "\n";
2586*77c1e3ccSAndroid Build Coastguard Worker std::cout << " Mismatch frames: " << GetMismatchFrames() << "\n";
2587*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ(300 - GetDecodedFrames(), drop_frames_);
2588*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ((int)GetMismatchFrames(), 0);
2589*77c1e3ccSAndroid Build Coastguard Worker #endif
2590*77c1e3ccSAndroid Build Coastguard Worker }
2591*77c1e3ccSAndroid Build Coastguard Worker
2592*77c1e3ccSAndroid Build Coastguard Worker int layer_frame_cnt_;
2593*77c1e3ccSAndroid Build Coastguard Worker int superframe_cnt_;
2594*77c1e3ccSAndroid Build Coastguard Worker int number_temporal_layers_;
2595*77c1e3ccSAndroid Build Coastguard Worker int number_spatial_layers_;
2596*77c1e3ccSAndroid Build Coastguard Worker // Allow for up to 3 temporal layers.
2597*77c1e3ccSAndroid Build Coastguard Worker int target_layer_bitrate_[AOM_MAX_LAYERS];
2598*77c1e3ccSAndroid Build Coastguard Worker aom_svc_params_t svc_params_;
2599*77c1e3ccSAndroid Build Coastguard Worker aom_svc_ref_frame_config_t ref_frame_config_;
2600*77c1e3ccSAndroid Build Coastguard Worker aom_svc_ref_frame_comp_pred_t ref_frame_comp_pred_;
2601*77c1e3ccSAndroid Build Coastguard Worker aom_svc_layer_id_t layer_id_;
2602*77c1e3ccSAndroid Build Coastguard Worker double effective_datarate_tl[AOM_MAX_LAYERS];
2603*77c1e3ccSAndroid Build Coastguard Worker unsigned int drop_frames_;
2604*77c1e3ccSAndroid Build Coastguard Worker unsigned int drop_frames_list_[1000];
2605*77c1e3ccSAndroid Build Coastguard Worker unsigned int mismatch_nframes_;
2606*77c1e3ccSAndroid Build Coastguard Worker unsigned int decoded_nframes_;
2607*77c1e3ccSAndroid Build Coastguard Worker double mismatch_psnr_;
2608*77c1e3ccSAndroid Build Coastguard Worker int set_frame_level_er_;
2609*77c1e3ccSAndroid Build Coastguard Worker int multi_ref_;
2610*77c1e3ccSAndroid Build Coastguard Worker int use_fixed_mode_svc_;
2611*77c1e3ccSAndroid Build Coastguard Worker int comp_pred_;
2612*77c1e3ccSAndroid Build Coastguard Worker int dynamic_enable_disable_mode_;
2613*77c1e3ccSAndroid Build Coastguard Worker int intra_only_;
2614*77c1e3ccSAndroid Build Coastguard Worker int intra_only_single_layer_;
2615*77c1e3ccSAndroid Build Coastguard Worker unsigned int frame_to_start_decoding_;
2616*77c1e3ccSAndroid Build Coastguard Worker unsigned int layer_to_decode_;
2617*77c1e3ccSAndroid Build Coastguard Worker unsigned int frame_sync_;
2618*77c1e3ccSAndroid Build Coastguard Worker unsigned int current_video_frame_;
2619*77c1e3ccSAndroid Build Coastguard Worker int screen_mode_;
2620*77c1e3ccSAndroid Build Coastguard Worker int rps_mode_;
2621*77c1e3ccSAndroid Build Coastguard Worker int rps_recovery_frame_;
2622*77c1e3ccSAndroid Build Coastguard Worker int simulcast_mode_;
2623*77c1e3ccSAndroid Build Coastguard Worker bool use_last_as_scaled_;
2624*77c1e3ccSAndroid Build Coastguard Worker bool use_last_as_scaled_single_ref_;
2625*77c1e3ccSAndroid Build Coastguard Worker
2626*77c1e3ccSAndroid Build Coastguard Worker int user_define_frame_qp_;
2627*77c1e3ccSAndroid Build Coastguard Worker int frame_qp_;
2628*77c1e3ccSAndroid Build Coastguard Worker int total_frame_;
2629*77c1e3ccSAndroid Build Coastguard Worker bool set_speed_per_layer_;
2630*77c1e3ccSAndroid Build Coastguard Worker libaom_test::ACMRandom rnd_;
2631*77c1e3ccSAndroid Build Coastguard Worker };
2632*77c1e3ccSAndroid Build Coastguard Worker
2633*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 temporal layers, 1 spatial.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL1SL)2634*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL1SL) {
2635*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC3TL1SLTest();
2636*77c1e3ccSAndroid Build Coastguard Worker }
2637*77c1e3ccSAndroid Build Coastguard Worker
TEST_P(DatarateTestSVC,SetFrameQpSVC3TL1SL)2638*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, SetFrameQpSVC3TL1SL) { SetFrameQpSVC3TL1SLTest(); }
2639*77c1e3ccSAndroid Build Coastguard Worker
TEST_P(DatarateTestSVC,SetFrameQpSVC3TL3SL)2640*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, SetFrameQpSVC3TL3SL) { SetFrameQpSVC3TL3SLTest(); }
2641*77c1e3ccSAndroid Build Coastguard Worker
2642*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 temporal layers, 1 spatial
2643*77c1e3ccSAndroid Build Coastguard Worker // for screen mode.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL1SLScreen)2644*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL1SLScreen) {
2645*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC3TL1SLScreenTest();
2646*77c1e3ccSAndroid Build Coastguard Worker }
2647*77c1e3ccSAndroid Build Coastguard Worker
2648*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 2 temporal layers, 1 spatial
2649*77c1e3ccSAndroid Build Coastguard Worker // for screen mode, with frame dropper on at low bitrates. Use small
2650*77c1e3ccSAndroid Build Coastguard Worker // values of rc_buf_initial/optimal/sz to trigger postencode frame drop.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC2TL1SLScreenDropFrame)2651*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC2TL1SLScreenDropFrame) {
2652*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC2TL1SLScreenDropFrameTest();
2653*77c1e3ccSAndroid Build Coastguard Worker }
2654*77c1e3ccSAndroid Build Coastguard Worker
2655*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 spatial layers, 1 temporal
2656*77c1e3ccSAndroid Build Coastguard Worker // for screen mode.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC1TL3SLScreen)2657*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC1TL3SLScreen) {
2658*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC1TL3SLScreenTest();
2659*77c1e3ccSAndroid Build Coastguard Worker }
2660*77c1e3ccSAndroid Build Coastguard Worker
2661*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 1 temporal layer, 1 spatial
2662*77c1e3ccSAndroid Build Coastguard Worker // for screen mode, with source with many scene cuts and motion.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC1TL1SLScreenScCutsMotion)2663*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC1TL1SLScreenScCutsMotion) {
2664*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC1TL1SLScreenScCutsMotionTest();
2665*77c1e3ccSAndroid Build Coastguard Worker }
2666*77c1e3ccSAndroid Build Coastguard Worker
2667*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 temporal layers, 1 spatial,
2668*77c1e3ccSAndroid Build Coastguard Worker // with dynamic resize on. Encode at very low bitrate and check that
2669*77c1e3ccSAndroid Build Coastguard Worker // there is at least one resize (down) event.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL1SLResize)2670*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL1SLResize) {
2671*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC3TL1SLResizeTest();
2672*77c1e3ccSAndroid Build Coastguard Worker }
2673*77c1e3ccSAndroid Build Coastguard Worker
2674*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 2 spatial layers, 1 temporal.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC1TL2SL)2675*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC1TL2SL) {
2676*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC1TL2SLTest();
2677*77c1e3ccSAndroid Build Coastguard Worker }
2678*77c1e3ccSAndroid Build Coastguard Worker
2679*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 spatial layers, 3 temporal,
2680*77c1e3ccSAndroid Build Coastguard Worker // with Intra-only frame inserted in the stream. Verify that we can start
2681*77c1e3ccSAndroid Build Coastguard Worker // decoding the SL0 stream at the intra_only frame in mid-sequence.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL3SLIntraStartDecodeBaseMidSeq)2682*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL3SLIntraStartDecodeBaseMidSeq) {
2683*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC3TL3SLIntraStartDecodeBaseMidSeq();
2684*77c1e3ccSAndroid Build Coastguard Worker }
2685*77c1e3ccSAndroid Build Coastguard Worker
2686*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3spatial layers, 3 temporal,
2687*77c1e3ccSAndroid Build Coastguard Worker // with Intra-only frame inserted in the stream. Verify that we can
2688*77c1e3ccSAndroid Build Coastguard Worker // decode all frames and layers with no mismatch.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL3SLIntraMidSeqDecodeAll)2689*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL3SLIntraMidSeqDecodeAll) {
2690*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC3TL3SLIntraMidSeqDecodeAll();
2691*77c1e3ccSAndroid Build Coastguard Worker }
2692*77c1e3ccSAndroid Build Coastguard Worker
2693*77c1e3ccSAndroid Build Coastguard Worker // Check simulcast mode for 3 spatial layers, 3 temporal,
2694*77c1e3ccSAndroid Build Coastguard Worker // Key frame is inserted on base SLO in mid-stream, and verify that the
2695*77c1e3ccSAndroid Build Coastguard Worker // top spatial layer (SL2) case be decoded, starting with an Intra-only frame.
2696*77c1e3ccSAndroid Build Coastguard Worker // Verify that we can decode all frames for SL2 with no mismatch.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL3SLSimulcast)2697*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL3SLSimulcast) {
2698*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC3TL3SLSimulcast();
2699*77c1e3ccSAndroid Build Coastguard Worker }
2700*77c1e3ccSAndroid Build Coastguard Worker
2701*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 2 spatial layers, 1 temporal,
2702*77c1e3ccSAndroid Build Coastguard Worker // with Intra-only frame inserted in the stream.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC1TL2SLIntraOnly)2703*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC1TL2SLIntraOnly) {
2704*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC1TL2SLIntraOnlyTest();
2705*77c1e3ccSAndroid Build Coastguard Worker }
2706*77c1e3ccSAndroid Build Coastguard Worker
2707*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 1 spatial layers, 1 temporal,
2708*77c1e3ccSAndroid Build Coastguard Worker // with Intra-only frame (frame with no references) inserted in the stream.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC1TL1SLIntraOnly)2709*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC1TL1SLIntraOnly) {
2710*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC1TL1SLIntraOnlyTest();
2711*77c1e3ccSAndroid Build Coastguard Worker }
2712*77c1e3ccSAndroid Build Coastguard Worker
2713*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 spatial layers, 1 temporal.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC1TL3SL)2714*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC1TL3SL) {
2715*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC1TL3SLTest();
2716*77c1e3ccSAndroid Build Coastguard Worker }
2717*77c1e3ccSAndroid Build Coastguard Worker
2718*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 spatial layers, 1 temporal.
2719*77c1e3ccSAndroid Build Coastguard Worker // Force the spatial reference to be LAST, with a second temporal
2720*77c1e3ccSAndroid Build Coastguard Worker // reference (GOLDEN).
TEST_P(DatarateTestSVC,BasicRateTargetingSVC1TL3SLLastIsScaled)2721*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC1TL3SLLastIsScaled) {
2722*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC1TL3SLLastIsScaledTest();
2723*77c1e3ccSAndroid Build Coastguard Worker }
2724*77c1e3ccSAndroid Build Coastguard Worker
2725*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 spatial layers, 1 temporal.
2726*77c1e3ccSAndroid Build Coastguard Worker // Force the spatial reference to be LAST, and force only 1 reference.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC1TL3SLastIsScaledSingleRef)2727*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC1TL3SLastIsScaledSingleRef) {
2728*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC1TL3SLLastIsScaledSingleRefTest();
2729*77c1e3ccSAndroid Build Coastguard Worker }
2730*77c1e3ccSAndroid Build Coastguard Worker
2731*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 spatial layers, 1 temporal,
2732*77c1e3ccSAndroid Build Coastguard Worker // with additional temporal reference for top spatial layer.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC1TL3SLMultiRef)2733*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC1TL3SLMultiRef) {
2734*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC1TL3SLMultiRefTest();
2735*77c1e3ccSAndroid Build Coastguard Worker }
2736*77c1e3ccSAndroid Build Coastguard Worker
2737*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 spatial, 3 temporal layers.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL3SL)2738*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL3SL) {
2739*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC3TL3SLTest();
2740*77c1e3ccSAndroid Build Coastguard Worker }
2741*77c1e3ccSAndroid Build Coastguard Worker
2742*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 spatial, 3 temporal layers.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL3SLHD)2743*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL3SLHD) {
2744*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC3TL3SLHDTest();
2745*77c1e3ccSAndroid Build Coastguard Worker }
2746*77c1e3ccSAndroid Build Coastguard Worker
2747*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 spatial, 3 temporal layers,
2748*77c1e3ccSAndroid Build Coastguard Worker // for fixed mode SVC.
TEST_P(DatarateTestSVC,BasicRateTargetingFixedModeSVC3TL3SLHD)2749*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingFixedModeSVC3TL3SLHD) {
2750*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingFixedModeSVC3TL3SLHDTest();
2751*77c1e3ccSAndroid Build Coastguard Worker }
2752*77c1e3ccSAndroid Build Coastguard Worker
2753*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 spatial, 3 temporal layers,
2754*77c1e3ccSAndroid Build Coastguard Worker // for 2 threads, 2 tile_columns, row-mt enabled, and different speed
2755*77c1e3ccSAndroid Build Coastguard Worker // per layer.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL3SLMultiThreadSpeedPerLayer)2756*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL3SLMultiThreadSpeedPerLayer) {
2757*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC3TL3SLMultiThreadSpeedPerLayerTest();
2758*77c1e3ccSAndroid Build Coastguard Worker }
2759*77c1e3ccSAndroid Build Coastguard Worker
2760*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 spatial, 3 temporal layers,
2761*77c1e3ccSAndroid Build Coastguard Worker // for 2 threads, 2 tile_columns, row-mt enabled.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL3SLHDMultiThread2)2762*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL3SLHDMultiThread2) {
2763*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC3TL3SLHDMultiThread2Test();
2764*77c1e3ccSAndroid Build Coastguard Worker }
2765*77c1e3ccSAndroid Build Coastguard Worker
2766*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 1 spatial, 2 temporal layers,
2767*77c1e3ccSAndroid Build Coastguard Worker // for 4 threads, 2 tile_columns, 2 tiles_rows, row-mt enabled.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC2TL1SLHDMultiThread4)2768*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC2TL1SLHDMultiThread4) {
2769*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC2TL1SLHDMultiThread4Test();
2770*77c1e3ccSAndroid Build Coastguard Worker }
2771*77c1e3ccSAndroid Build Coastguard Worker
2772*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 1 spatial, 2 temporal layers,
2773*77c1e3ccSAndroid Build Coastguard Worker // for 4 threads, row-mt enabled, and auto_tiling enabled.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC2TL1SLHDMultiThread4AutoTiles)2774*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC2TL1SLHDMultiThread4AutoTiles) {
2775*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC2TL1SLHDMultiThread4AutoTilesTest();
2776*77c1e3ccSAndroid Build Coastguard Worker }
2777*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 spatial, 3 temporal layers,
2778*77c1e3ccSAndroid Build Coastguard Worker // for 4 threads, 2 tile_columns, 2 tiles_rows, row-mt enabled.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL3SLHDMultiThread4)2779*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL3SLHDMultiThread4) {
2780*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC3TL3SLHDMultiThread4Test();
2781*77c1e3ccSAndroid Build Coastguard Worker }
2782*77c1e3ccSAndroid Build Coastguard Worker
2783*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 spatial, 3 temporal layers,
2784*77c1e3ccSAndroid Build Coastguard Worker // with additional temporal reference for top spatial layer.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL3SLHDMultiRef)2785*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL3SLHDMultiRef) {
2786*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC3TL3SLHDMultiRefTest();
2787*77c1e3ccSAndroid Build Coastguard Worker }
2788*77c1e3ccSAndroid Build Coastguard Worker
2789*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 spatial, 3 temporal layers,
2790*77c1e3ccSAndroid Build Coastguard Worker // for auto key frame mode with short key frame period.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL3SLKf)2791*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL3SLKf) {
2792*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC3TL3SLKfTest();
2793*77c1e3ccSAndroid Build Coastguard Worker }
2794*77c1e3ccSAndroid Build Coastguard Worker
2795*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 spatial, 3 temporal layers,
2796*77c1e3ccSAndroid Build Coastguard Worker // for 4:4:4 input.
2797*77c1e3ccSAndroid Build Coastguard Worker #if defined(CONFIG_MAX_DECODE_PROFILE) && CONFIG_MAX_DECODE_PROFILE < 1
TEST_P(DatarateTestSVC,DISABLED_BasicRateTargeting444SVC3TL3SL)2798*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, DISABLED_BasicRateTargeting444SVC3TL3SL) {
2799*77c1e3ccSAndroid Build Coastguard Worker #else
2800*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargeting444SVC3TL3SL) {
2801*77c1e3ccSAndroid Build Coastguard Worker #endif
2802*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargeting444SVC3TL3SLTest();
2803*77c1e3ccSAndroid Build Coastguard Worker }
2804*77c1e3ccSAndroid Build Coastguard Worker
2805*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 temporal layers, 1 spatial layer,
2806*77c1e3ccSAndroid Build Coastguard Worker // with dropping of all enhancement layers (TL 1 and TL2). Check that the base
2807*77c1e3ccSAndroid Build Coastguard Worker // layer (TL0) can still be decodeable (with no mismatch) with the
2808*77c1e3ccSAndroid Build Coastguard Worker // error_resilient flag set to 0. This test used the pattern with multiple
2809*77c1e3ccSAndroid Build Coastguard Worker // references (last, golden, and altref), updated on base layer.
2810*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL1SLMultiRefDropAllEnh) {
2811*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC3TL1SLMultiRefDropAllEnhTest();
2812*77c1e3ccSAndroid Build Coastguard Worker }
2813*77c1e3ccSAndroid Build Coastguard Worker
2814*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 temporal layers, 1 spatial layer,
2815*77c1e3ccSAndroid Build Coastguard Worker // with dropping of all enhancement layers (TL 1 and TL2). Check that the base
2816*77c1e3ccSAndroid Build Coastguard Worker // layer (TL0) can still be decodeable (with no mismatch) with the
2817*77c1e3ccSAndroid Build Coastguard Worker // error_resilient flag set to 0.
2818*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL1SLDropAllEnh) {
2819*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC3TL1SLDropAllEnhTest();
2820*77c1e3ccSAndroid Build Coastguard Worker }
2821*77c1e3ccSAndroid Build Coastguard Worker
2822*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 temporal layers, 1 spatial layer,
2823*77c1e3ccSAndroid Build Coastguard Worker // with dropping of the TL2 enhancement layer, which are non-reference
2824*77c1e3ccSAndroid Build Coastguard Worker // (droppble) frames. For the base layer (TL0) and TL1 to still be decodeable
2825*77c1e3ccSAndroid Build Coastguard Worker // (with no mismatch), the error_resilient_flag may be off (set to 0),
2826*77c1e3ccSAndroid Build Coastguard Worker // since TL2 are non-reference frames.
2827*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL1SLDropTL2Enh) {
2828*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC3TL1SLDropTL2EnhTest();
2829*77c1e3ccSAndroid Build Coastguard Worker }
2830*77c1e3ccSAndroid Build Coastguard Worker
2831*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 temporal layers, 1 spatial layer,
2832*77c1e3ccSAndroid Build Coastguard Worker // with dropping of all enhancement layers (TL 1 and TL2). Test that the
2833*77c1e3ccSAndroid Build Coastguard Worker // error_resilient flag can be set at frame level, with on/1 on
2834*77c1e3ccSAndroid Build Coastguard Worker // enhancement layers and off/0 on base layer.
2835*77c1e3ccSAndroid Build Coastguard Worker // This allows for successful decoding after dropping enhancement layer frames.
2836*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL1SLDropAllEnhFrameER) {
2837*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC3TL1SLDropAllEnhFrameERTest();
2838*77c1e3ccSAndroid Build Coastguard Worker }
2839*77c1e3ccSAndroid Build Coastguard Worker
2840*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 temporal layers, 1 spatial layer,
2841*77c1e3ccSAndroid Build Coastguard Worker // with dropping set of enhancement layers (TL 1 and TL2) in middle of sequence.
2842*77c1e3ccSAndroid Build Coastguard Worker // Test that the error_resilient flag can be set at frame level, with on/1 on
2843*77c1e3ccSAndroid Build Coastguard Worker // enhancement layers and off/0 on base layer.
2844*77c1e3ccSAndroid Build Coastguard Worker // This allows for successful decoding after dropping a set enhancement layer
2845*77c1e3ccSAndroid Build Coastguard Worker // frames in the sequence.
2846*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL1SLDropSetEnhFrameER) {
2847*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC3TL1SLDropSetEnhFrameERTest();
2848*77c1e3ccSAndroid Build Coastguard Worker }
2849*77c1e3ccSAndroid Build Coastguard Worker
2850*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 2 temporal layers, 1 spatial layer,
2851*77c1e3ccSAndroid Build Coastguard Worker // with dropping set of enhancement layers (TL 1) in middle of sequence.
2852*77c1e3ccSAndroid Build Coastguard Worker // Test that the error_resilient flag can be 0/off for all frames.
2853*77c1e3ccSAndroid Build Coastguard Worker // This allows for successful decoding after dropping a set enhancement layer
2854*77c1e3ccSAndroid Build Coastguard Worker // frames in the sequence.
2855*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC2TL1SLDropSetEnhER0) {
2856*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC2TL1SLDropSetEnhER0Test();
2857*77c1e3ccSAndroid Build Coastguard Worker }
2858*77c1e3ccSAndroid Build Coastguard Worker
2859*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 temporal layers, 1 spatial layer,
2860*77c1e3ccSAndroid Build Coastguard Worker // with dropping set of enhancement layers (TL 1 and TL2) in middle of sequence.
2861*77c1e3ccSAndroid Build Coastguard Worker // Test that the error_resilient flag can be 0/off for all frames.
2862*77c1e3ccSAndroid Build Coastguard Worker // This allows for successful decoding after dropping a set enhancement layer
2863*77c1e3ccSAndroid Build Coastguard Worker // frames in the sequence.
2864*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL1SLDropSetEnhER0) {
2865*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC3TL1SLDropSetEnhER0Test();
2866*77c1e3ccSAndroid Build Coastguard Worker }
2867*77c1e3ccSAndroid Build Coastguard Worker
2868*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 temporal layers, 3 spatial layers,
2869*77c1e3ccSAndroid Build Coastguard Worker // with dropping set of enhancement layers (superframe TL 1 and TL2) in middle
2870*77c1e3ccSAndroid Build Coastguard Worker // of sequence. Test that the error_resilient flag can be 0/off for all frames.
2871*77c1e3ccSAndroid Build Coastguard Worker // This allows for successful decoding after dropping a set enhancement layer
2872*77c1e3ccSAndroid Build Coastguard Worker // frames in the sequence.
2873*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL3SLDropSetEnhER0) {
2874*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC3TL3SLDropSetEnhER0Test();
2875*77c1e3ccSAndroid Build Coastguard Worker }
2876*77c1e3ccSAndroid Build Coastguard Worker
2877*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 temporal layers, 1 spatial layer,
2878*77c1e3ccSAndroid Build Coastguard Worker // with compound prediction on, for pattern with two additional refereces
2879*77c1e3ccSAndroid Build Coastguard Worker // (golden and altref), both updated on base TLO frames.
2880*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL1SLMultiRefCompound) {
2881*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC3TL1SLMultiRefCompoundTest();
2882*77c1e3ccSAndroid Build Coastguard Worker }
2883*77c1e3ccSAndroid Build Coastguard Worker
2884*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 spatial layers, 1 temporal,
2885*77c1e3ccSAndroid Build Coastguard Worker // with the top spatial layer starting disabled (0 bitrate) and then
2886*77c1e3ccSAndroid Build Coastguard Worker // dynamically enabled after x frames with nonzero bitrate.
2887*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC1TL3SLDynEnabl) {
2888*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC1TL3SLDynEnablTest();
2889*77c1e3ccSAndroid Build Coastguard Worker }
2890*77c1e3ccSAndroid Build Coastguard Worker
2891*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting for CBR, for 3 spatial layers, 1 temporal,
2892*77c1e3ccSAndroid Build Coastguard Worker // with the top spatial layer dynamically disabled snd enabled during the
2893*77c1e3ccSAndroid Build Coastguard Worker // middle of the sequence.
2894*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingSVC1TL3SLDynDisEnabl) {
2895*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingSVC1TL3SLDynDisEnablTest();
2896*77c1e3ccSAndroid Build Coastguard Worker }
2897*77c1e3ccSAndroid Build Coastguard Worker
2898*77c1e3ccSAndroid Build Coastguard Worker // Check basic rate targeting and encoder/decodermismatch, for RPS
2899*77c1e3ccSAndroid Build Coastguard Worker // with 1 layer. A number of consecutive frames are lost midway in
2900*77c1e3ccSAndroid Build Coastguard Worker // sequence, and encoder resorts to a longer term reference to recovery
2901*77c1e3ccSAndroid Build Coastguard Worker // and continue decoding successfully.
2902*77c1e3ccSAndroid Build Coastguard Worker TEST_P(DatarateTestSVC, BasicRateTargetingRPS1TL1SLDropFrames) {
2903*77c1e3ccSAndroid Build Coastguard Worker BasicRateTargetingRPS1TL1SLDropFramesTest();
2904*77c1e3ccSAndroid Build Coastguard Worker }
2905*77c1e3ccSAndroid Build Coastguard Worker
2906*77c1e3ccSAndroid Build Coastguard Worker TEST(SvcParams, BitrateOverflow) {
2907*77c1e3ccSAndroid Build Coastguard Worker uint8_t buf[6] = { 0 };
2908*77c1e3ccSAndroid Build Coastguard Worker aom_image_t img;
2909*77c1e3ccSAndroid Build Coastguard Worker aom_codec_ctx_t enc;
2910*77c1e3ccSAndroid Build Coastguard Worker aom_codec_enc_cfg_t cfg;
2911*77c1e3ccSAndroid Build Coastguard Worker
2912*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ(&img, aom_img_wrap(&img, AOM_IMG_FMT_I420, 1, 1, 1, buf));
2913*77c1e3ccSAndroid Build Coastguard Worker
2914*77c1e3ccSAndroid Build Coastguard Worker aom_codec_iface_t *const iface = aom_codec_av1_cx();
2915*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ(aom_codec_enc_config_default(iface, &cfg, AOM_USAGE_REALTIME),
2916*77c1e3ccSAndroid Build Coastguard Worker AOM_CODEC_OK);
2917*77c1e3ccSAndroid Build Coastguard Worker cfg.g_w = 1;
2918*77c1e3ccSAndroid Build Coastguard Worker cfg.g_h = 1;
2919*77c1e3ccSAndroid Build Coastguard Worker ASSERT_EQ(aom_codec_enc_init(&enc, iface, &cfg, 0), AOM_CODEC_OK);
2920*77c1e3ccSAndroid Build Coastguard Worker
2921*77c1e3ccSAndroid Build Coastguard Worker aom_svc_params_t svc_params = {};
2922*77c1e3ccSAndroid Build Coastguard Worker svc_params.framerate_factor[0] = 1;
2923*77c1e3ccSAndroid Build Coastguard Worker svc_params.framerate_factor[1] = 2;
2924*77c1e3ccSAndroid Build Coastguard Worker svc_params.number_spatial_layers = 1;
2925*77c1e3ccSAndroid Build Coastguard Worker svc_params.number_temporal_layers = 2;
2926*77c1e3ccSAndroid Build Coastguard Worker svc_params.layer_target_bitrate[0] = INT_MAX;
2927*77c1e3ccSAndroid Build Coastguard Worker svc_params.layer_target_bitrate[1] = INT_MAX;
2928*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ(aom_codec_control(&enc, AV1E_SET_SVC_PARAMS, &svc_params),
2929*77c1e3ccSAndroid Build Coastguard Worker AOM_CODEC_OK);
2930*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ(
2931*77c1e3ccSAndroid Build Coastguard Worker aom_codec_encode(&enc, &img, /*pts=*/0, /*duration=*/1, /*flags=*/0),
2932*77c1e3ccSAndroid Build Coastguard Worker AOM_CODEC_OK);
2933*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ(aom_codec_encode(&enc, /*img=*/nullptr, /*pts=*/0, /*duration=*/0,
2934*77c1e3ccSAndroid Build Coastguard Worker /*flags=*/0),
2935*77c1e3ccSAndroid Build Coastguard Worker AOM_CODEC_OK);
2936*77c1e3ccSAndroid Build Coastguard Worker EXPECT_EQ(aom_codec_destroy(&enc), AOM_CODEC_OK);
2937*77c1e3ccSAndroid Build Coastguard Worker }
2938*77c1e3ccSAndroid Build Coastguard Worker
2939*77c1e3ccSAndroid Build Coastguard Worker AV1_INSTANTIATE_TEST_SUITE(DatarateTestSVC,
2940*77c1e3ccSAndroid Build Coastguard Worker ::testing::Values(::libaom_test::kRealTime),
2941*77c1e3ccSAndroid Build Coastguard Worker ::testing::Range(7, 12), ::testing::Values(0, 3),
2942*77c1e3ccSAndroid Build Coastguard Worker ::testing::Values(0, 1));
2943*77c1e3ccSAndroid Build Coastguard Worker
2944*77c1e3ccSAndroid Build Coastguard Worker } // namespace
2945*77c1e3ccSAndroid Build Coastguard Worker } // namespace datarate_test
2946