1 /*
2  * Copyright (c) 2019, Alliance for Open Media. All rights reserved
3  *
4  * This source code is subject to the terms of the BSD 2 Clause License and
5  * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6  * was not distributed with this source code in the LICENSE file, you can
7  * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8  * Media Patent License 1.0 was not distributed with this source code in the
9  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10  */
11 
12 #include <vector>
13 #include "config/aom_config.h"
14 #include "third_party/googletest/src/googletest/include/gtest/gtest.h"
15 #include "test/codec_factory.h"
16 #include "test/datarate_test.h"
17 #include "test/encode_test_driver.h"
18 #include "test/i420_video_source.h"
19 #include "test/util.h"
20 #include "test/y4m_video_source.h"
21 #include "aom/aom_codec.h"
22 #include "av1/common/enums.h"
23 #include "av1/encoder/encoder.h"
24 
25 namespace datarate_test {
26 namespace {
27 
28 struct FrameInfo {
FrameInfodatarate_test::__anon1fe62d4d0111::FrameInfo29   FrameInfo(aom_codec_pts_t _pts, unsigned int _w, unsigned int _h)
30       : pts(_pts), w(_w), h(_h) {}
31 
32   aom_codec_pts_t pts;
33   unsigned int w;
34   unsigned int h;
35 };
36 
37 class DatarateTestSVC
38     : public ::libaom_test::CodecTestWith4Params<libaom_test::TestMode, int,
39                                                  unsigned int, int>,
40       public DatarateTest {
41  public:
DatarateTestSVC()42   DatarateTestSVC() : DatarateTest(GET_PARAM(0)) {
43     set_cpu_used_ = GET_PARAM(2);
44     aq_mode_ = GET_PARAM(3);
45   }
46 
47  protected:
SetUp()48   virtual void SetUp() {
49     InitializeConfig(GET_PARAM(1));
50     ResetModel();
51   }
52 
DecompressedFrameHook(const aom_image_t & img,aom_codec_pts_t pts)53   virtual void DecompressedFrameHook(const aom_image_t &img,
54                                      aom_codec_pts_t pts) {
55     frame_info_list_.push_back(FrameInfo(pts, img.d_w, img.d_h));
56     ++decoded_nframes_;
57   }
58 
59   std::vector<FrameInfo> frame_info_list_;
60 
GetNumSpatialLayers()61   virtual int GetNumSpatialLayers() { return number_spatial_layers_; }
62 
ResetModel()63   virtual void ResetModel() {
64     DatarateTest::ResetModel();
65     layer_frame_cnt_ = 0;
66     superframe_cnt_ = 0;
67     number_temporal_layers_ = 1;
68     number_spatial_layers_ = 1;
69     for (int i = 0; i < AOM_MAX_LAYERS; i++) {
70       target_layer_bitrate_[i] = 0;
71       effective_datarate_tl[i] = 0.0;
72     }
73     memset(&layer_id_, 0, sizeof(aom_svc_layer_id_t));
74     memset(&svc_params_, 0, sizeof(aom_svc_params_t));
75     memset(&ref_frame_config_, 0, sizeof(aom_svc_ref_frame_config_t));
76     memset(&ref_frame_comp_pred_, 0, sizeof(aom_svc_ref_frame_comp_pred_t));
77     drop_frames_ = 0;
78     for (int i = 0; i < 1000; i++) drop_frames_list_[i] = 1000;
79     decoded_nframes_ = 0;
80     mismatch_nframes_ = 0;
81     mismatch_psnr_ = 0.0;
82     set_frame_level_er_ = 0;
83     multi_ref_ = 0;
84     use_fixed_mode_svc_ = 0;
85     comp_pred_ = 0;
86   }
87 
PreEncodeFrameHook(::libaom_test::VideoSource * video,::libaom_test::Encoder * encoder)88   virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video,
89                                   ::libaom_test::Encoder *encoder) {
90     int spatial_layer_id = 0;
91     if (video->frame() == 0) {
92       initialize_svc(number_temporal_layers_, number_spatial_layers_,
93                      &svc_params_);
94       encoder->Control(AV1E_SET_SVC_PARAMS, &svc_params_);
95       // TODO(aomedia:3032): Configure KSVC in fixed mode.
96       encoder->Control(AV1E_SET_ENABLE_ORDER_HINT, 0);
97       encoder->Control(AV1E_SET_ENABLE_TPL_MODEL, 0);
98       encoder->Control(AV1E_SET_DELTAQ_MODE, 0);
99       if (cfg_.g_threads > 1) {
100         encoder->Control(AV1E_SET_TILE_COLUMNS, cfg_.g_threads >> 1);
101         encoder->Control(AV1E_SET_ROW_MT, 1);
102       }
103     }
104     if (number_spatial_layers_ == 2) {
105       spatial_layer_id = (layer_frame_cnt_ % 2 == 0) ? 0 : 1;
106     } else if (number_spatial_layers_ == 3) {
107       spatial_layer_id = (layer_frame_cnt_ % 3 == 0)
108                              ? 0
109                              : ((layer_frame_cnt_ - 1) % 3 == 0) ? 1 : 2;
110     }
111     // Set the reference/update flags, layer_id, and reference_map
112     // buffer index.
113     frame_flags_ = set_layer_pattern(video->frame(), &layer_id_,
114                                      &ref_frame_config_, &ref_frame_comp_pred_,
115                                      spatial_layer_id, multi_ref_, comp_pred_);
116     encoder->Control(AV1E_SET_SVC_LAYER_ID, &layer_id_);
117     // The SET_SVC_REF_FRAME_CONFIG and AV1E_SET_SVC_REF_FRAME_COMP_PRED api is
118     // for the flexible SVC mode (i.e., use_fixed_mode_svc == 0).
119     if (!use_fixed_mode_svc_) {
120       encoder->Control(AV1E_SET_SVC_REF_FRAME_CONFIG, &ref_frame_config_);
121       encoder->Control(AV1E_SET_SVC_REF_FRAME_COMP_PRED, &ref_frame_comp_pred_);
122     }
123     if (set_frame_level_er_) {
124       int mode =
125           (layer_id_.spatial_layer_id > 0 || layer_id_.temporal_layer_id > 0);
126       encoder->Control(AV1E_SET_ERROR_RESILIENT_MODE, mode);
127     }
128     layer_frame_cnt_++;
129     DatarateTest::PreEncodeFrameHook(video, encoder);
130   }
131 
FramePktHook(const aom_codec_cx_pkt_t * pkt)132   virtual void FramePktHook(const aom_codec_cx_pkt_t *pkt) {
133     const size_t frame_size_in_bits = pkt->data.frame.sz * 8;
134     // Update the layer cumulative  bitrate.
135     for (int i = layer_id_.temporal_layer_id; i < number_temporal_layers_;
136          i++) {
137       int layer = layer_id_.spatial_layer_id * number_temporal_layers_ + i;
138       effective_datarate_tl[layer] += 1.0 * frame_size_in_bits;
139     }
140     if (layer_id_.spatial_layer_id == number_spatial_layers_ - 1) {
141       last_pts_ = pkt->data.frame.pts;
142       superframe_cnt_++;
143     }
144   }
145 
EndPassHook(void)146   virtual void EndPassHook(void) {
147     duration_ = ((last_pts_ + 1) * timebase_);
148     for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
149       effective_datarate_tl[i] = (effective_datarate_tl[i] / 1000) / duration_;
150     }
151   }
152 
DoDecode() const153   virtual bool DoDecode() const {
154     if (drop_frames_ > 0) {
155       for (unsigned int i = 0; i < drop_frames_; ++i) {
156         if (drop_frames_list_[i] == (unsigned int)superframe_cnt_) {
157           std::cout << "             Skipping decoding frame: "
158                     << drop_frames_list_[i] << "\n";
159           return 0;
160         }
161       }
162     }
163     return 1;
164   }
165 
MismatchHook(const aom_image_t * img1,const aom_image_t * img2)166   virtual void MismatchHook(const aom_image_t *img1, const aom_image_t *img2) {
167     double mismatch_psnr = compute_psnr(img1, img2);
168     mismatch_psnr_ += mismatch_psnr;
169     ++mismatch_nframes_;
170   }
171 
GetMismatchFrames()172   unsigned int GetMismatchFrames() { return mismatch_nframes_; }
GetDecodedFrames()173   unsigned int GetDecodedFrames() { return decoded_nframes_; }
174 
175   // 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)176   virtual int set_layer_pattern(
177       int frame_cnt, aom_svc_layer_id_t *layer_id,
178       aom_svc_ref_frame_config_t *ref_frame_config,
179       aom_svc_ref_frame_comp_pred_t *ref_frame_comp_pred, int spatial_layer,
180       int multi_ref, int comp_pred) {
181     int lag_index = 0;
182     int base_count = frame_cnt >> 2;
183     layer_id->spatial_layer_id = spatial_layer;
184     // Set the reference map buffer idx for the 7 references:
185     // LAST_FRAME (0), LAST2_FRAME(1), LAST3_FRAME(2), GOLDEN_FRAME(3),
186     // BWDREF_FRAME(4), ALTREF2_FRAME(5), ALTREF_FRAME(6).
187     for (int i = 0; i < INTER_REFS_PER_FRAME; i++) {
188       ref_frame_config->ref_idx[i] = i;
189       ref_frame_config->reference[i] = 0;
190     }
191     for (int i = 0; i < REF_FRAMES; i++) ref_frame_config->refresh[i] = 0;
192     if (comp_pred) {
193       ref_frame_comp_pred->use_comp_pred[0] = 1;  // GOLDEN_LAST
194       ref_frame_comp_pred->use_comp_pred[1] = 1;  // LAST2_LAST
195       ref_frame_comp_pred->use_comp_pred[2] = 1;  // ALTREF_LAST
196     }
197     // Set layer_flags to 0 when using ref_frame_config->reference.
198     int layer_flags = 0;
199     // Always reference LAST.
200     ref_frame_config->reference[0] = 1;
201     if (number_temporal_layers_ == 3 && number_spatial_layers_ == 1) {
202       // 3-layer:
203       //   1    3   5    7
204       //     2        6
205       // 0        4        8
206       if (multi_ref) {
207         // Keep golden fixed at slot 3.
208         ref_frame_config->ref_idx[3] = 3;
209         // Cyclically refresh slots 4, 5, 6, 7, for lag altref.
210         lag_index = 4 + (base_count % 4);
211         // Set the altref slot to lag_index.
212         ref_frame_config->ref_idx[6] = lag_index;
213       }
214       if (frame_cnt % 4 == 0) {
215         // Base layer.
216         layer_id->temporal_layer_id = 0;
217         // Update LAST on layer 0, reference LAST and GF.
218         ref_frame_config->refresh[0] = 1;
219         ref_frame_config->reference[3] = 1;
220         if (multi_ref) {
221           // Refresh GOLDEN every x ~10 base layer frames.
222           if (base_count % 10 == 0) ref_frame_config->refresh[3] = 1;
223           // Refresh lag_index slot, needed for lagging altref.
224           ref_frame_config->refresh[lag_index] = 1;
225         }
226       } else if ((frame_cnt - 1) % 4 == 0) {
227         layer_id->temporal_layer_id = 2;
228         // First top layer: no updates, only reference LAST (TL0).
229       } else if ((frame_cnt - 2) % 4 == 0) {
230         layer_id->temporal_layer_id = 1;
231         // Middle layer (TL1): update LAST2, only reference LAST (TL0).
232         ref_frame_config->refresh[1] = 1;
233       } else if ((frame_cnt - 3) % 4 == 0) {
234         layer_id->temporal_layer_id = 2;
235         // Second top layer: no updates, only reference LAST.
236         // Set buffer idx for LAST to slot 1, since that was the slot
237         // updated in previous frame. So LAST is TL1 frame.
238         ref_frame_config->ref_idx[0] = 1;
239         ref_frame_config->ref_idx[1] = 0;
240       }
241       if (multi_ref) {
242         // Every frame can reference GOLDEN AND ALTREF.
243         ref_frame_config->reference[3] = 1;
244         ref_frame_config->reference[6] = 1;
245       }
246     } else if (number_temporal_layers_ == 1 && number_spatial_layers_ == 2) {
247       layer_id->temporal_layer_id = 0;
248       if (layer_id->spatial_layer_id == 0) {
249         // Reference LAST, update LAST. Keep LAST and GOLDEN in slots 0 and 3.
250         ref_frame_config->ref_idx[0] = 0;
251         ref_frame_config->ref_idx[3] = 3;
252         ref_frame_config->refresh[0] = 1;
253       } else if (layer_id->spatial_layer_id == 1) {
254         // Reference LAST and GOLDEN. Set buffer_idx for LAST to slot 3
255         // and GOLDEN to slot 0. Update slot 3 (LAST).
256         ref_frame_config->ref_idx[0] = 3;
257         ref_frame_config->ref_idx[3] = 0;
258         ref_frame_config->refresh[3] = 1;
259       }
260       // Reference GOLDEN.
261       if (layer_id->spatial_layer_id > 0) ref_frame_config->reference[3] = 1;
262     } else if (number_temporal_layers_ == 1 && number_spatial_layers_ == 3) {
263       // 3 spatial layers, 1 temporal.
264       // Note for this case , we set the buffer idx for all references to be
265       // either LAST or GOLDEN, which are always valid references, since decoder
266       // will check if any of the 7 references is valid scale in
267       // valid_ref_frame_size().
268       layer_id->temporal_layer_id = 0;
269       if (layer_id->spatial_layer_id == 0) {
270         // Reference LAST, update LAST. Set all other buffer_idx to 0.
271         for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 0;
272         ref_frame_config->refresh[0] = 1;
273       } else if (layer_id->spatial_layer_id == 1) {
274         // Reference LAST and GOLDEN. Set buffer_idx for LAST to slot 1
275         // and GOLDEN (and all other refs) to slot 0.
276         // Update slot 1 (LAST).
277         for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 0;
278         ref_frame_config->ref_idx[0] = 1;
279         ref_frame_config->refresh[1] = 1;
280       } else if (layer_id->spatial_layer_id == 2) {
281         // Reference LAST and GOLDEN. Set buffer_idx for LAST to slot 2
282         // and GOLDEN (and all other refs) to slot 1.
283         // Update slot 2 (LAST).
284         for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 1;
285         ref_frame_config->ref_idx[0] = 2;
286         ref_frame_config->refresh[2] = 1;
287         if (multi_ref) {
288           ref_frame_config->ref_idx[6] = 7;
289           ref_frame_config->reference[6] = 1;
290           if (base_count % 10 == 0) ref_frame_config->refresh[7] = 1;
291         }
292       }
293       // Reference GOLDEN.
294       if (layer_id->spatial_layer_id > 0) ref_frame_config->reference[3] = 1;
295     } else if (number_temporal_layers_ == 3 && number_spatial_layers_ == 3) {
296       // 3 spatial and 3 temporal layer.
297       // Overlap in the buffer slot updates: the slots 3 and 4 updated by
298       // first TL2 are reused for update in TL1 superframe.
299       if (superframe_cnt_ % 4 == 0) {
300         // Base temporal layer.
301         layer_id->temporal_layer_id = 0;
302         if (layer_id->spatial_layer_id == 0) {
303           // Reference LAST, update LAST.
304           // Set all buffer_idx to 0.
305           for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 0;
306           ref_frame_config->refresh[0] = 1;
307         } else if (layer_id->spatial_layer_id == 1) {
308           // Reference LAST and GOLDEN. Set buffer_idx for LAST to slot 1,
309           // GOLDEN (and all other refs) to slot 0.
310           // Update slot 1 (LAST).
311           for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 0;
312           ref_frame_config->ref_idx[0] = 1;
313           ref_frame_config->refresh[1] = 1;
314         } else if (layer_id->spatial_layer_id == 2) {
315           // Reference LAST and GOLDEN. Set buffer_idx for LAST to slot 2,
316           // GOLDEN (and all other refs) to slot 1.
317           // Update slot 2 (LAST).
318           for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 1;
319           ref_frame_config->ref_idx[0] = 2;
320           ref_frame_config->refresh[2] = 1;
321         }
322       } else if ((superframe_cnt_ - 1) % 4 == 0) {
323         // First top temporal enhancement layer.
324         layer_id->temporal_layer_id = 2;
325         if (layer_id->spatial_layer_id == 0) {
326           // Reference LAST (slot 0).
327           // Set GOLDEN to slot 3 and update slot 3.
328           // Set all other buffer_idx to slot 0.
329           for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 0;
330           ref_frame_config->ref_idx[3] = 3;
331           ref_frame_config->refresh[3] = 1;
332         } else if (layer_id->spatial_layer_id == 1) {
333           // Reference LAST and GOLDEN. Set buffer_idx for LAST to slot 1,
334           // GOLDEN (and all other refs) to slot 3.
335           // Set LAST2 to slot 4 and Update slot 4.
336           for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 3;
337           ref_frame_config->ref_idx[0] = 1;
338           ref_frame_config->ref_idx[1] = 4;
339           ref_frame_config->refresh[4] = 1;
340         } else if (layer_id->spatial_layer_id == 2) {
341           // Reference LAST and GOLDEN. Set buffer_idx for LAST to slot 2,
342           // GOLDEN (and all other refs) to slot 4.
343           // No update.
344           for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 4;
345           ref_frame_config->ref_idx[0] = 2;
346         }
347       } else if ((superframe_cnt_ - 2) % 4 == 0) {
348         // Middle temporal enhancement layer.
349         layer_id->temporal_layer_id = 1;
350         if (layer_id->spatial_layer_id == 0) {
351           // Reference LAST.
352           // Set all buffer_idx to 0.
353           // Set GOLDEN to slot 3 and update slot 3.
354           for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 0;
355           ref_frame_config->ref_idx[3] = 3;
356           ref_frame_config->refresh[3] = 1;
357         } else if (layer_id->spatial_layer_id == 1) {
358           // Reference LAST and GOLDEN. Set buffer_idx for LAST to slot 1,
359           // GOLDEN (and all other refs) to slot 3.
360           // Set LAST2 to slot 4 and update slot 4.
361           for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 3;
362           ref_frame_config->ref_idx[0] = 1;
363           ref_frame_config->ref_idx[2] = 4;
364           ref_frame_config->refresh[4] = 1;
365         } else if (layer_id->spatial_layer_id == 2) {
366           // Reference LAST and GOLDEN. Set buffer_idx for LAST to slot 2,
367           // GOLDEN (and all other refs) to slot 4.
368           // Set LAST2 to slot 5 and update slot 5.
369           for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 4;
370           ref_frame_config->ref_idx[0] = 2;
371           ref_frame_config->ref_idx[2] = 5;
372           ref_frame_config->refresh[5] = 1;
373         }
374       } else if ((superframe_cnt_ - 3) % 4 == 0) {
375         // Second top temporal enhancement layer.
376         layer_id->temporal_layer_id = 2;
377         if (layer_id->spatial_layer_id == 0) {
378           // Set LAST to slot 3 and reference LAST.
379           // Set GOLDEN to slot 3 and update slot 3.
380           // Set all other buffer_idx to 0.
381           for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 0;
382           ref_frame_config->ref_idx[0] = 3;
383           ref_frame_config->ref_idx[3] = 3;
384           ref_frame_config->refresh[3] = 1;
385         } else if (layer_id->spatial_layer_id == 1) {
386           // Reference LAST and GOLDEN. Set buffer_idx for LAST to slot 4,
387           // GOLDEN to slot 3. Set LAST2 to slot 4 and update slot 4.
388           for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 0;
389           ref_frame_config->ref_idx[0] = 4;
390           ref_frame_config->ref_idx[3] = 3;
391           ref_frame_config->ref_idx[1] = 4;
392           ref_frame_config->refresh[4] = 1;
393         } else if (layer_id->spatial_layer_id == 2) {
394           // Reference LAST and GOLDEN. Set buffer_idx for LAST to slot 5,
395           // GOLDEN to slot 4. No update.
396           for (int i = 0; i < 7; i++) ref_frame_config->ref_idx[i] = 0;
397           ref_frame_config->ref_idx[0] = 5;
398           ref_frame_config->ref_idx[3] = 4;
399         }
400       }
401       // Reference GOLDEN.
402       if (layer_id->spatial_layer_id > 0) ref_frame_config->reference[3] = 1;
403       // Allow for top spatial layer to use additional temporal reference.
404       // Additional reference is only updated on base temporal layer, every
405       // 10 TL0 frames here.
406       if (multi_ref && layer_id->spatial_layer_id == 2) {
407         ref_frame_config->ref_idx[6] = 7;
408         ref_frame_config->reference[6] = 1;
409         if (base_count % 10 == 0 && layer_id->temporal_layer_id == 0)
410           ref_frame_config->refresh[7] = 1;
411       }
412     }
413     return layer_flags;
414   }
415 
initialize_svc(int number_temporal_layers,int number_spatial_layers,aom_svc_params * svc_params)416   virtual void initialize_svc(int number_temporal_layers,
417                               int number_spatial_layers,
418                               aom_svc_params *svc_params) {
419     svc_params->number_spatial_layers = number_spatial_layers;
420     svc_params->number_temporal_layers = number_temporal_layers;
421     for (int i = 0; i < number_temporal_layers * number_spatial_layers; ++i) {
422       svc_params->max_quantizers[i] = 60;
423       svc_params->min_quantizers[i] = 2;
424       svc_params->layer_target_bitrate[i] = target_layer_bitrate_[i];
425     }
426     // Do at most 3 spatial or temporal layers here.
427     svc_params->framerate_factor[0] = 1;
428     if (number_temporal_layers == 2) {
429       svc_params->framerate_factor[0] = 2;
430       svc_params->framerate_factor[1] = 1;
431     } else if (number_temporal_layers == 3) {
432       svc_params->framerate_factor[0] = 4;
433       svc_params->framerate_factor[1] = 2;
434       svc_params->framerate_factor[2] = 1;
435     }
436     svc_params->scaling_factor_num[0] = 1;
437     svc_params->scaling_factor_den[0] = 1;
438     if (number_spatial_layers == 2) {
439       svc_params->scaling_factor_num[0] = 1;
440       svc_params->scaling_factor_den[0] = 2;
441       svc_params->scaling_factor_num[1] = 1;
442       svc_params->scaling_factor_den[1] = 1;
443     } else if (number_spatial_layers == 3) {
444       svc_params->scaling_factor_num[0] = 1;
445       svc_params->scaling_factor_den[0] = 4;
446       svc_params->scaling_factor_num[1] = 1;
447       svc_params->scaling_factor_den[1] = 2;
448       svc_params->scaling_factor_num[2] = 1;
449       svc_params->scaling_factor_den[2] = 1;
450     }
451   }
452 
BasicRateTargetingSVC3TL1SLTest()453   virtual void BasicRateTargetingSVC3TL1SLTest() {
454     cfg_.rc_buf_initial_sz = 500;
455     cfg_.rc_buf_optimal_sz = 500;
456     cfg_.rc_buf_sz = 1000;
457     cfg_.rc_dropframe_thresh = 0;
458     cfg_.rc_min_quantizer = 0;
459     cfg_.rc_max_quantizer = 63;
460     cfg_.rc_end_usage = AOM_CBR;
461     cfg_.g_lag_in_frames = 0;
462     cfg_.g_error_resilient = 1;
463 
464     ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
465                                          288, 30, 1, 0, 300);
466     const int bitrate_array[2] = { 200, 550 };
467     cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
468     ResetModel();
469     number_temporal_layers_ = 3;
470     target_layer_bitrate_[0] = 50 * cfg_.rc_target_bitrate / 100;
471     target_layer_bitrate_[1] = 70 * cfg_.rc_target_bitrate / 100;
472     target_layer_bitrate_[2] = cfg_.rc_target_bitrate;
473     ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
474     for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
475       ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.80)
476           << " The datarate for the file is lower than target by too much!";
477       ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.30)
478           << " The datarate for the file is greater than target by too much!";
479     }
480     // Top temporal layers are non_reference, so exlcude them from
481     // mismatch count, since loopfilter/cdef is not applied for these on
482     // encoder side, but is always applied on decoder.
483     // This means 150 = #frames(300) - #TL2_frames(150).
484     EXPECT_EQ((int)GetMismatchFrames(), 150);
485   }
486 
BasicRateTargetingSVC3TL1SLResizeTest()487   virtual void BasicRateTargetingSVC3TL1SLResizeTest() {
488     cfg_.rc_buf_initial_sz = 500;
489     cfg_.rc_buf_optimal_sz = 500;
490     cfg_.rc_buf_sz = 1000;
491     cfg_.rc_dropframe_thresh = 0;
492     cfg_.rc_min_quantizer = 0;
493     cfg_.rc_max_quantizer = 63;
494     cfg_.rc_end_usage = AOM_CBR;
495     cfg_.g_lag_in_frames = 0;
496     cfg_.g_error_resilient = 0;
497     cfg_.rc_resize_mode = RESIZE_DYNAMIC;
498 
499     ::libaom_test::I420VideoSource video("niklas_640_480_30.yuv", 640, 480, 30,
500                                          1, 0, 400);
501     cfg_.g_w = 640;
502     cfg_.g_h = 480;
503     const int bitrate_array[2] = { 80, 90 };
504     cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
505     ResetModel();
506     number_temporal_layers_ = 3;
507     target_layer_bitrate_[0] = 50 * cfg_.rc_target_bitrate / 100;
508     target_layer_bitrate_[1] = 70 * cfg_.rc_target_bitrate / 100;
509     target_layer_bitrate_[2] = cfg_.rc_target_bitrate;
510     ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
511     for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
512       ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.80)
513           << " The datarate for the file is lower than target by too much!";
514       ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.60)
515           << " The datarate for the file is greater than target by too much!";
516     }
517     unsigned int last_w = cfg_.g_w;
518     unsigned int last_h = cfg_.g_h;
519     int resize_down_count = 0;
520     for (std::vector<FrameInfo>::const_iterator info = frame_info_list_.begin();
521          info != frame_info_list_.end(); ++info) {
522       if (info->w != last_w || info->h != last_h) {
523         // Verify that resize down occurs.
524         ASSERT_LT(info->w, last_w);
525         ASSERT_LT(info->h, last_h);
526         last_w = info->w;
527         last_h = info->h;
528         resize_down_count++;
529       }
530     }
531     // Must be at least one resize down.
532     ASSERT_GE(resize_down_count, 1);
533   }
534 
BasicRateTargetingSVC1TL2SLTest()535   virtual void BasicRateTargetingSVC1TL2SLTest() {
536     cfg_.rc_buf_initial_sz = 500;
537     cfg_.rc_buf_optimal_sz = 500;
538     cfg_.rc_buf_sz = 1000;
539     cfg_.rc_dropframe_thresh = 0;
540     cfg_.rc_min_quantizer = 0;
541     cfg_.rc_max_quantizer = 63;
542     cfg_.rc_end_usage = AOM_CBR;
543     cfg_.g_lag_in_frames = 0;
544     cfg_.g_error_resilient = 0;
545 
546     ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
547                                          288, 30, 1, 0, 300);
548     const int bitrate_array[2] = { 300, 600 };
549     cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
550     ResetModel();
551     number_temporal_layers_ = 1;
552     number_spatial_layers_ = 2;
553     target_layer_bitrate_[0] = 2 * cfg_.rc_target_bitrate / 4;
554     target_layer_bitrate_[1] = 2 * cfg_.rc_target_bitrate / 4;
555     ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
556     for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
557       ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.80)
558           << " The datarate for the file is lower than target by too much!";
559       ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.35)
560           << " The datarate for the file is greater than target by too much!";
561     }
562   }
563 
BasicRateTargetingSVC1TL3SLTest()564   virtual void BasicRateTargetingSVC1TL3SLTest() {
565     cfg_.rc_buf_initial_sz = 500;
566     cfg_.rc_buf_optimal_sz = 500;
567     cfg_.rc_buf_sz = 1000;
568     cfg_.rc_dropframe_thresh = 0;
569     cfg_.rc_min_quantizer = 0;
570     cfg_.rc_max_quantizer = 63;
571     cfg_.rc_end_usage = AOM_CBR;
572     cfg_.g_lag_in_frames = 0;
573     cfg_.g_error_resilient = 0;
574 
575     ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
576                                          288, 30, 1, 0, 300);
577     const int bitrate_array[2] = { 500, 1000 };
578     cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
579     ResetModel();
580     number_temporal_layers_ = 1;
581     number_spatial_layers_ = 3;
582     target_layer_bitrate_[0] = 1 * cfg_.rc_target_bitrate / 8;
583     target_layer_bitrate_[1] = 3 * cfg_.rc_target_bitrate / 8;
584     target_layer_bitrate_[2] = 4 * cfg_.rc_target_bitrate / 8;
585     ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
586     for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
587       ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.80)
588           << " The datarate for the file is lower than target by too much!";
589       ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.38)
590           << " The datarate for the file is greater than target by too much!";
591     }
592   }
593 
BasicRateTargetingSVC1TL3SLMultiRefTest()594   virtual void BasicRateTargetingSVC1TL3SLMultiRefTest() {
595     cfg_.rc_buf_initial_sz = 500;
596     cfg_.rc_buf_optimal_sz = 500;
597     cfg_.rc_buf_sz = 1000;
598     cfg_.rc_dropframe_thresh = 0;
599     cfg_.rc_min_quantizer = 0;
600     cfg_.rc_max_quantizer = 63;
601     cfg_.rc_end_usage = AOM_CBR;
602     cfg_.g_lag_in_frames = 0;
603     cfg_.g_error_resilient = 0;
604 
605     ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
606                                          288, 30, 1, 0, 300);
607     const int bitrate_array[2] = { 500, 1000 };
608     cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
609     ResetModel();
610     multi_ref_ = 1;
611     number_temporal_layers_ = 1;
612     number_spatial_layers_ = 3;
613     target_layer_bitrate_[0] = 1 * cfg_.rc_target_bitrate / 8;
614     target_layer_bitrate_[1] = 3 * cfg_.rc_target_bitrate / 8;
615     target_layer_bitrate_[2] = 4 * cfg_.rc_target_bitrate / 8;
616     ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
617     for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
618       ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.80)
619           << " The datarate for the file is lower than target by too much!";
620       ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.38)
621           << " The datarate for the file is greater than target by too much!";
622     }
623   }
624 
BasicRateTargetingSVC3TL3SLTest()625   virtual void BasicRateTargetingSVC3TL3SLTest() {
626     cfg_.rc_buf_initial_sz = 500;
627     cfg_.rc_buf_optimal_sz = 500;
628     cfg_.rc_buf_sz = 1000;
629     cfg_.rc_dropframe_thresh = 0;
630     cfg_.rc_min_quantizer = 0;
631     cfg_.rc_max_quantizer = 63;
632     cfg_.rc_end_usage = AOM_CBR;
633     cfg_.g_lag_in_frames = 0;
634     cfg_.g_error_resilient = 0;
635 
636     ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
637                                          288, 30, 1, 0, 300);
638     const int bitrate_array[2] = { 600, 1200 };
639     cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
640     ResetModel();
641     number_temporal_layers_ = 3;
642     number_spatial_layers_ = 3;
643     // SL0
644     const int bitrate_sl0 = 1 * cfg_.rc_target_bitrate / 8;
645     target_layer_bitrate_[0] = 50 * bitrate_sl0 / 100;
646     target_layer_bitrate_[1] = 70 * bitrate_sl0 / 100;
647     target_layer_bitrate_[2] = bitrate_sl0;
648     // SL1
649     const int bitrate_sl1 = 3 * cfg_.rc_target_bitrate / 8;
650     target_layer_bitrate_[3] = 50 * bitrate_sl1 / 100;
651     target_layer_bitrate_[4] = 70 * bitrate_sl1 / 100;
652     target_layer_bitrate_[5] = bitrate_sl1;
653     // SL2
654     const int bitrate_sl2 = 4 * cfg_.rc_target_bitrate / 8;
655     target_layer_bitrate_[6] = 50 * bitrate_sl2 / 100;
656     target_layer_bitrate_[7] = 70 * bitrate_sl2 / 100;
657     target_layer_bitrate_[8] = bitrate_sl2;
658     ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
659     for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
660       ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.80)
661           << " The datarate for the file is lower than target by too much!";
662       ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.38)
663           << " The datarate for the file is greater than target by too much!";
664     }
665   }
666 
BasicRateTargetingSVC3TL3SLHDTest()667   virtual void BasicRateTargetingSVC3TL3SLHDTest() {
668     cfg_.rc_buf_initial_sz = 500;
669     cfg_.rc_buf_optimal_sz = 500;
670     cfg_.rc_buf_sz = 1000;
671     cfg_.rc_dropframe_thresh = 0;
672     cfg_.rc_min_quantizer = 0;
673     cfg_.rc_max_quantizer = 63;
674     cfg_.rc_end_usage = AOM_CBR;
675     cfg_.g_lag_in_frames = 0;
676     cfg_.g_error_resilient = 0;
677 
678     ::libaom_test::Y4mVideoSource video("niklas_1280_720_30.y4m", 0, 60);
679     const int bitrate_array[2] = { 600, 1200 };
680     cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
681     ResetModel();
682     number_temporal_layers_ = 3;
683     number_spatial_layers_ = 3;
684     // SL0
685     const int bitrate_sl0 = 1 * cfg_.rc_target_bitrate / 8;
686     target_layer_bitrate_[0] = 50 * bitrate_sl0 / 100;
687     target_layer_bitrate_[1] = 70 * bitrate_sl0 / 100;
688     target_layer_bitrate_[2] = bitrate_sl0;
689     // SL1
690     const int bitrate_sl1 = 3 * cfg_.rc_target_bitrate / 8;
691     target_layer_bitrate_[3] = 50 * bitrate_sl1 / 100;
692     target_layer_bitrate_[4] = 70 * bitrate_sl1 / 100;
693     target_layer_bitrate_[5] = bitrate_sl1;
694     // SL2
695     const int bitrate_sl2 = 4 * cfg_.rc_target_bitrate / 8;
696     target_layer_bitrate_[6] = 50 * bitrate_sl2 / 100;
697     target_layer_bitrate_[7] = 70 * bitrate_sl2 / 100;
698     target_layer_bitrate_[8] = bitrate_sl2;
699     ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
700     for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
701       ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.70)
702           << " The datarate for the file is lower than target by too much!";
703       ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.45)
704           << " The datarate for the file is greater than target by too much!";
705     }
706   }
707 
BasicRateTargetingFixedModeSVC3TL3SLHDTest()708   virtual void BasicRateTargetingFixedModeSVC3TL3SLHDTest() {
709     cfg_.rc_buf_initial_sz = 500;
710     cfg_.rc_buf_optimal_sz = 500;
711     cfg_.rc_buf_sz = 1000;
712     cfg_.rc_dropframe_thresh = 0;
713     cfg_.rc_min_quantizer = 0;
714     cfg_.rc_max_quantizer = 63;
715     cfg_.rc_end_usage = AOM_CBR;
716     cfg_.g_lag_in_frames = 0;
717     cfg_.g_error_resilient = 0;
718 
719     ::libaom_test::Y4mVideoSource video("niklas_1280_720_30.y4m", 0, 60);
720     const int bitrate_array[2] = { 600, 1200 };
721     cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
722     ResetModel();
723     number_temporal_layers_ = 3;
724     number_spatial_layers_ = 3;
725     use_fixed_mode_svc_ = 1;
726     // SL0
727     const int bitrate_sl0 = 1 * cfg_.rc_target_bitrate / 8;
728     target_layer_bitrate_[0] = 50 * bitrate_sl0 / 100;
729     target_layer_bitrate_[1] = 70 * bitrate_sl0 / 100;
730     target_layer_bitrate_[2] = bitrate_sl0;
731     // SL1
732     const int bitrate_sl1 = 3 * cfg_.rc_target_bitrate / 8;
733     target_layer_bitrate_[3] = 50 * bitrate_sl1 / 100;
734     target_layer_bitrate_[4] = 70 * bitrate_sl1 / 100;
735     target_layer_bitrate_[5] = bitrate_sl1;
736     // SL2
737     const int bitrate_sl2 = 4 * cfg_.rc_target_bitrate / 8;
738     target_layer_bitrate_[6] = 50 * bitrate_sl2 / 100;
739     target_layer_bitrate_[7] = 70 * bitrate_sl2 / 100;
740     target_layer_bitrate_[8] = bitrate_sl2;
741     ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
742     for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
743       ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.70)
744           << " The datarate for the file is lower than target by too much!";
745       ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.45)
746           << " The datarate for the file is greater than target by too much!";
747     }
748   }
749 
BasicRateTargetingSVC3TL3SLHDMT2Test()750   virtual void BasicRateTargetingSVC3TL3SLHDMT2Test() {
751     cfg_.rc_buf_initial_sz = 500;
752     cfg_.rc_buf_optimal_sz = 500;
753     cfg_.rc_buf_sz = 1000;
754     cfg_.rc_dropframe_thresh = 0;
755     cfg_.rc_min_quantizer = 0;
756     cfg_.rc_max_quantizer = 63;
757     cfg_.rc_end_usage = AOM_CBR;
758     cfg_.g_lag_in_frames = 0;
759     cfg_.g_error_resilient = 0;
760     cfg_.g_threads = 2;
761 
762     ::libaom_test::Y4mVideoSource video("niklas_1280_720_30.y4m", 0, 60);
763     const int bitrate_array[2] = { 600, 1200 };
764     cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
765     ResetModel();
766     number_temporal_layers_ = 3;
767     number_spatial_layers_ = 3;
768     // SL0
769     const int bitrate_sl0 = 1 * cfg_.rc_target_bitrate / 8;
770     target_layer_bitrate_[0] = 50 * bitrate_sl0 / 100;
771     target_layer_bitrate_[1] = 70 * bitrate_sl0 / 100;
772     target_layer_bitrate_[2] = bitrate_sl0;
773     // SL1
774     const int bitrate_sl1 = 3 * cfg_.rc_target_bitrate / 8;
775     target_layer_bitrate_[3] = 50 * bitrate_sl1 / 100;
776     target_layer_bitrate_[4] = 70 * bitrate_sl1 / 100;
777     target_layer_bitrate_[5] = bitrate_sl1;
778     // SL2
779     const int bitrate_sl2 = 4 * cfg_.rc_target_bitrate / 8;
780     target_layer_bitrate_[6] = 50 * bitrate_sl2 / 100;
781     target_layer_bitrate_[7] = 70 * bitrate_sl2 / 100;
782     target_layer_bitrate_[8] = bitrate_sl2;
783     ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
784     for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
785       ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.70)
786           << " The datarate for the file is lower than target by too much!";
787       ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.45)
788           << " The datarate for the file is greater than target by too much!";
789     }
790   }
791 
BasicRateTargetingSVC3TL3SLHDMT4Test()792   virtual void BasicRateTargetingSVC3TL3SLHDMT4Test() {
793     cfg_.rc_buf_initial_sz = 500;
794     cfg_.rc_buf_optimal_sz = 500;
795     cfg_.rc_buf_sz = 1000;
796     cfg_.rc_dropframe_thresh = 0;
797     cfg_.rc_min_quantizer = 0;
798     cfg_.rc_max_quantizer = 63;
799     cfg_.rc_end_usage = AOM_CBR;
800     cfg_.g_lag_in_frames = 0;
801     cfg_.g_error_resilient = 0;
802     cfg_.g_threads = 4;
803 
804     ::libaom_test::Y4mVideoSource video("niklas_1280_720_30.y4m", 0, 60);
805     const int bitrate_array[2] = { 600, 1200 };
806     cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
807     ResetModel();
808     number_temporal_layers_ = 3;
809     number_spatial_layers_ = 3;
810     // SL0
811     const int bitrate_sl0 = 1 * cfg_.rc_target_bitrate / 8;
812     target_layer_bitrate_[0] = 50 * bitrate_sl0 / 100;
813     target_layer_bitrate_[1] = 70 * bitrate_sl0 / 100;
814     target_layer_bitrate_[2] = bitrate_sl0;
815     // SL1
816     const int bitrate_sl1 = 3 * cfg_.rc_target_bitrate / 8;
817     target_layer_bitrate_[3] = 50 * bitrate_sl1 / 100;
818     target_layer_bitrate_[4] = 70 * bitrate_sl1 / 100;
819     target_layer_bitrate_[5] = bitrate_sl1;
820     // SL2
821     const int bitrate_sl2 = 4 * cfg_.rc_target_bitrate / 8;
822     target_layer_bitrate_[6] = 50 * bitrate_sl2 / 100;
823     target_layer_bitrate_[7] = 70 * bitrate_sl2 / 100;
824     target_layer_bitrate_[8] = bitrate_sl2;
825     ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
826     for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
827       ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.70)
828           << " The datarate for the file is lower than target by too much!";
829       ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.45)
830           << " The datarate for the file is greater than target by too much!";
831     }
832   }
833 
BasicRateTargetingSVC3TL3SLHDMultiRefTest()834   virtual void BasicRateTargetingSVC3TL3SLHDMultiRefTest() {
835     cfg_.rc_buf_initial_sz = 500;
836     cfg_.rc_buf_optimal_sz = 500;
837     cfg_.rc_buf_sz = 1000;
838     cfg_.rc_dropframe_thresh = 0;
839     cfg_.rc_min_quantizer = 0;
840     cfg_.rc_max_quantizer = 63;
841     cfg_.rc_end_usage = AOM_CBR;
842     cfg_.g_lag_in_frames = 0;
843     cfg_.g_error_resilient = 0;
844 
845     ::libaom_test::Y4mVideoSource video("niklas_1280_720_30.y4m", 0, 60);
846     const int bitrate_array[2] = { 600, 1200 };
847     cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
848     ResetModel();
849     multi_ref_ = 1;
850     number_temporal_layers_ = 3;
851     number_spatial_layers_ = 3;
852     // SL0
853     const int bitrate_sl0 = 1 * cfg_.rc_target_bitrate / 8;
854     target_layer_bitrate_[0] = 50 * bitrate_sl0 / 100;
855     target_layer_bitrate_[1] = 70 * bitrate_sl0 / 100;
856     target_layer_bitrate_[2] = bitrate_sl0;
857     // SL1
858     const int bitrate_sl1 = 3 * cfg_.rc_target_bitrate / 8;
859     target_layer_bitrate_[3] = 50 * bitrate_sl1 / 100;
860     target_layer_bitrate_[4] = 70 * bitrate_sl1 / 100;
861     target_layer_bitrate_[5] = bitrate_sl1;
862     // SL2
863     const int bitrate_sl2 = 4 * cfg_.rc_target_bitrate / 8;
864     target_layer_bitrate_[6] = 50 * bitrate_sl2 / 100;
865     target_layer_bitrate_[7] = 70 * bitrate_sl2 / 100;
866     target_layer_bitrate_[8] = bitrate_sl2;
867     ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
868     for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
869       ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.70)
870           << " The datarate for the file is lower than target by too much!";
871       ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.45)
872           << " The datarate for the file is greater than target by too much!";
873     }
874   }
875 
BasicRateTargetingSVC3TL3SLKfTest()876   virtual void BasicRateTargetingSVC3TL3SLKfTest() {
877     cfg_.rc_buf_initial_sz = 500;
878     cfg_.rc_buf_optimal_sz = 500;
879     cfg_.rc_buf_sz = 1000;
880     cfg_.rc_dropframe_thresh = 0;
881     cfg_.rc_min_quantizer = 0;
882     cfg_.rc_max_quantizer = 63;
883     cfg_.rc_end_usage = AOM_CBR;
884     cfg_.g_lag_in_frames = 0;
885     cfg_.g_error_resilient = 0;
886     cfg_.kf_mode = AOM_KF_AUTO;
887     cfg_.kf_min_dist = cfg_.kf_max_dist = 100;
888 
889     ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
890                                          288, 30, 1, 0, 300);
891     const int bitrate_array[2] = { 600, 1200 };
892     cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
893     ResetModel();
894     number_temporal_layers_ = 3;
895     number_spatial_layers_ = 3;
896     // SL0
897     const int bitrate_sl0 = 1 * cfg_.rc_target_bitrate / 8;
898     target_layer_bitrate_[0] = 50 * bitrate_sl0 / 100;
899     target_layer_bitrate_[1] = 70 * bitrate_sl0 / 100;
900     target_layer_bitrate_[2] = bitrate_sl0;
901     // SL1
902     const int bitrate_sl1 = 3 * cfg_.rc_target_bitrate / 8;
903     target_layer_bitrate_[3] = 50 * bitrate_sl1 / 100;
904     target_layer_bitrate_[4] = 70 * bitrate_sl1 / 100;
905     target_layer_bitrate_[5] = bitrate_sl1;
906     // SL2
907     const int bitrate_sl2 = 4 * cfg_.rc_target_bitrate / 8;
908     target_layer_bitrate_[6] = 50 * bitrate_sl2 / 100;
909     target_layer_bitrate_[7] = 70 * bitrate_sl2 / 100;
910     target_layer_bitrate_[8] = bitrate_sl2;
911     ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
912     for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
913       ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.75)
914           << " The datarate for the file is lower than target by too much!";
915       ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.4)
916           << " The datarate for the file is greater than target by too much!";
917     }
918   }
919 
BasicRateTargeting444SVC3TL3SLTest()920   virtual void BasicRateTargeting444SVC3TL3SLTest() {
921     cfg_.rc_buf_initial_sz = 500;
922     cfg_.rc_buf_optimal_sz = 500;
923     cfg_.rc_buf_sz = 1000;
924     cfg_.rc_dropframe_thresh = 0;
925     cfg_.rc_min_quantizer = 0;
926     cfg_.rc_max_quantizer = 63;
927     cfg_.rc_end_usage = AOM_CBR;
928     cfg_.g_lag_in_frames = 0;
929     cfg_.g_error_resilient = 0;
930     cfg_.g_profile = 1;
931 
932     ::libaom_test::Y4mVideoSource video("rush_hour_444.y4m", 0, 140);
933 
934     const int bitrate_array[2] = { 600, 1200 };
935     cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
936     ResetModel();
937     number_temporal_layers_ = 3;
938     number_spatial_layers_ = 3;
939     // SL0
940     const int bitrate_sl0 = 1 * cfg_.rc_target_bitrate / 8;
941     target_layer_bitrate_[0] = 50 * bitrate_sl0 / 100;
942     target_layer_bitrate_[1] = 70 * bitrate_sl0 / 100;
943     target_layer_bitrate_[2] = bitrate_sl0;
944     // SL1
945     const int bitrate_sl1 = 3 * cfg_.rc_target_bitrate / 8;
946     target_layer_bitrate_[3] = 50 * bitrate_sl1 / 100;
947     target_layer_bitrate_[4] = 70 * bitrate_sl1 / 100;
948     target_layer_bitrate_[5] = bitrate_sl1;
949     // SL2
950     const int bitrate_sl2 = 4 * cfg_.rc_target_bitrate / 8;
951     target_layer_bitrate_[6] = 50 * bitrate_sl2 / 100;
952     target_layer_bitrate_[7] = 70 * bitrate_sl2 / 100;
953     target_layer_bitrate_[8] = bitrate_sl2;
954     ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
955     for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
956       ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.70)
957           << " The datarate for the file is lower than target by too much!";
958       ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.38)
959           << " The datarate for the file is greater than target by too much!";
960     }
961   }
962 
BasicRateTargetingSVC3TL1SLMultiRefDropAllEnhTest()963   virtual void BasicRateTargetingSVC3TL1SLMultiRefDropAllEnhTest() {
964     cfg_.rc_buf_initial_sz = 500;
965     cfg_.rc_buf_optimal_sz = 500;
966     cfg_.rc_buf_sz = 1000;
967     cfg_.rc_dropframe_thresh = 0;
968     cfg_.rc_min_quantizer = 0;
969     cfg_.rc_max_quantizer = 63;
970     cfg_.rc_end_usage = AOM_CBR;
971     cfg_.g_lag_in_frames = 0;
972     // error_resilient can set to off/0, since for SVC the context update
973     // is done per-layer.
974     cfg_.g_error_resilient = 0;
975 
976     ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
977                                          288, 30, 1, 0, 300);
978     const int bitrate_array[2] = { 200, 550 };
979     cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
980     ResetModel();
981     multi_ref_ = 1;
982     // Drop TL1 and TL2: #frames(300) - #TL0.
983     drop_frames_ = 300 - 300 / 4;
984     int n = 0;
985     for (int i = 0; i < 300; i++) {
986       if (i % 4 != 0) {
987         drop_frames_list_[n] = i;
988         n++;
989       }
990     }
991     number_temporal_layers_ = 3;
992     target_layer_bitrate_[0] = 50 * cfg_.rc_target_bitrate / 100;
993     target_layer_bitrate_[1] = 70 * cfg_.rc_target_bitrate / 100;
994     target_layer_bitrate_[2] = cfg_.rc_target_bitrate;
995     ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
996     for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
997       ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.80)
998           << " The datarate for the file is lower than target by too much!";
999       ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.30)
1000           << " The datarate for the file is greater than target by too much!";
1001     }
1002     // Test that no mismatches have been found.
1003     std::cout << "          Decoded frames: " << GetDecodedFrames() << "\n";
1004     std::cout << "          Mismatch frames: " << GetMismatchFrames() << "\n";
1005     EXPECT_EQ(300 - GetDecodedFrames(), drop_frames_);
1006     EXPECT_EQ((int)GetMismatchFrames(), 0);
1007   }
1008 
BasicRateTargetingSVC3TL1SLDropAllEnhTest()1009   virtual void BasicRateTargetingSVC3TL1SLDropAllEnhTest() {
1010     cfg_.rc_buf_initial_sz = 500;
1011     cfg_.rc_buf_optimal_sz = 500;
1012     cfg_.rc_buf_sz = 1000;
1013     cfg_.rc_dropframe_thresh = 0;
1014     cfg_.rc_min_quantizer = 0;
1015     cfg_.rc_max_quantizer = 63;
1016     cfg_.rc_end_usage = AOM_CBR;
1017     cfg_.g_lag_in_frames = 0;
1018     // error_resilient can set to off/0, since for SVC the context update
1019     // is done per-layer.
1020     cfg_.g_error_resilient = 0;
1021 
1022     ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
1023                                          288, 30, 1, 0, 300);
1024     const int bitrate_array[2] = { 200, 550 };
1025     cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1026     ResetModel();
1027     // Drop TL1 and TL2: #frames(300) - #TL0.
1028     drop_frames_ = 300 - 300 / 4;
1029     int n = 0;
1030     for (int i = 0; i < 300; i++) {
1031       if (i % 4 != 0) {
1032         drop_frames_list_[n] = i;
1033         n++;
1034       }
1035     }
1036     number_temporal_layers_ = 3;
1037     target_layer_bitrate_[0] = 50 * cfg_.rc_target_bitrate / 100;
1038     target_layer_bitrate_[1] = 70 * cfg_.rc_target_bitrate / 100;
1039     target_layer_bitrate_[2] = cfg_.rc_target_bitrate;
1040     ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1041     for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1042       ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.80)
1043           << " The datarate for the file is lower than target by too much!";
1044       ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.30)
1045           << " The datarate for the file is greater than target by too much!";
1046     }
1047     // Test that no mismatches have been found.
1048     std::cout << "          Decoded frames: " << GetDecodedFrames() << "\n";
1049     std::cout << "          Mismatch frames: " << GetMismatchFrames() << "\n";
1050     EXPECT_EQ(300 - GetDecodedFrames(), drop_frames_);
1051     EXPECT_EQ((int)GetMismatchFrames(), 0);
1052   }
1053 
BasicRateTargetingSVC3TL1SLDropTL2EnhTest()1054   virtual void BasicRateTargetingSVC3TL1SLDropTL2EnhTest() {
1055     cfg_.rc_buf_initial_sz = 500;
1056     cfg_.rc_buf_optimal_sz = 500;
1057     cfg_.rc_buf_sz = 1000;
1058     cfg_.rc_dropframe_thresh = 0;
1059     cfg_.rc_min_quantizer = 0;
1060     cfg_.rc_max_quantizer = 63;
1061     cfg_.rc_end_usage = AOM_CBR;
1062     cfg_.g_lag_in_frames = 0;
1063     // error_resilient for sequence can be off/0, since dropped frames (TL2)
1064     // are non-reference frames.
1065     cfg_.g_error_resilient = 0;
1066 
1067     ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
1068                                          288, 30, 1, 0, 300);
1069     const int bitrate_array[2] = { 200, 550 };
1070     cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1071     ResetModel();
1072     // Drop TL2: #frames(300) - (#TL0 + #TL1).
1073     drop_frames_ = 300 - 300 / 2;
1074     int n = 0;
1075     for (int i = 0; i < 300; i++) {
1076       if (i % 2 != 0) {
1077         drop_frames_list_[n] = i;
1078         n++;
1079       }
1080     }
1081     number_temporal_layers_ = 3;
1082     target_layer_bitrate_[0] = 50 * cfg_.rc_target_bitrate / 100;
1083     target_layer_bitrate_[1] = 70 * cfg_.rc_target_bitrate / 100;
1084     target_layer_bitrate_[2] = cfg_.rc_target_bitrate;
1085     ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1086     for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1087       ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.80)
1088           << " The datarate for the file is lower than target by too much!";
1089       ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.30)
1090           << " The datarate for the file is greater than target by too much!";
1091     }
1092     // Test that no mismatches have been found.
1093     std::cout << "          Decoded frames: " << GetDecodedFrames() << "\n";
1094     std::cout << "          Mismatch frames: " << GetMismatchFrames() << "\n";
1095     EXPECT_EQ(300 - GetDecodedFrames(), drop_frames_);
1096     EXPECT_EQ((int)GetMismatchFrames(), 0);
1097   }
1098 
BasicRateTargetingSVC3TL1SLDropAllEnhFrameERTest()1099   virtual void BasicRateTargetingSVC3TL1SLDropAllEnhFrameERTest() {
1100     cfg_.rc_buf_initial_sz = 500;
1101     cfg_.rc_buf_optimal_sz = 500;
1102     cfg_.rc_buf_sz = 1000;
1103     cfg_.rc_dropframe_thresh = 0;
1104     cfg_.rc_min_quantizer = 0;
1105     cfg_.rc_max_quantizer = 63;
1106     cfg_.rc_end_usage = AOM_CBR;
1107     cfg_.g_lag_in_frames = 0;
1108 
1109     ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352,
1110                                          288, 30, 1, 0, 300);
1111     const int bitrate_array[2] = { 200, 550 };
1112     cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1113     ResetModel();
1114     // Set error_resilience at frame level, with codec control,
1115     // on/1 for enahancement layers and off/0 for base layer frames.
1116     set_frame_level_er_ = 1;
1117 
1118     // Drop TL1 and TL2: #frames(300) - #TL0.
1119     drop_frames_ = 300 - 300 / 4;
1120     int n = 0;
1121     for (int i = 0; i < 300; i++) {
1122       if (i % 4 != 0) {
1123         drop_frames_list_[n] = i;
1124         n++;
1125       }
1126     }
1127     number_temporal_layers_ = 3;
1128     target_layer_bitrate_[0] = 50 * cfg_.rc_target_bitrate / 100;
1129     target_layer_bitrate_[1] = 70 * cfg_.rc_target_bitrate / 100;
1130     target_layer_bitrate_[2] = cfg_.rc_target_bitrate;
1131     ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1132     for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1133       ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.80)
1134           << " The datarate for the file is lower than target by too much!";
1135       ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.30)
1136           << " The datarate for the file is greater than target by too much!";
1137     }
1138     // Test that no mismatches have been found.
1139     std::cout << "          Decoded frames: " << GetDecodedFrames() << "\n";
1140     std::cout << "          Mismatch frames: " << GetMismatchFrames() << "\n";
1141     EXPECT_EQ(300 - GetDecodedFrames(), drop_frames_);
1142     EXPECT_EQ((int)GetMismatchFrames(), 0);
1143   }
1144 
BasicRateTargetingSVC3TL1SLMultiRefCompoundTest()1145   virtual void BasicRateTargetingSVC3TL1SLMultiRefCompoundTest() {
1146     cfg_.rc_buf_initial_sz = 500;
1147     cfg_.rc_buf_optimal_sz = 500;
1148     cfg_.rc_buf_sz = 1000;
1149     cfg_.rc_dropframe_thresh = 0;
1150     cfg_.rc_min_quantizer = 0;
1151     cfg_.rc_max_quantizer = 63;
1152     cfg_.rc_end_usage = AOM_CBR;
1153     cfg_.g_lag_in_frames = 0;
1154     cfg_.g_error_resilient = 0;
1155 
1156     ::libaom_test::I420VideoSource video("niklas_640_480_30.yuv", 640, 480, 30,
1157                                          1, 0, 400);
1158     cfg_.g_w = 640;
1159     cfg_.g_h = 480;
1160     const int bitrate_array[2] = { 400, 800 };
1161     cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
1162     ResetModel();
1163     multi_ref_ = 1;
1164     comp_pred_ = 1;
1165     number_temporal_layers_ = 3;
1166     number_spatial_layers_ = 1;
1167     target_layer_bitrate_[0] = 50 * cfg_.rc_target_bitrate / 100;
1168     target_layer_bitrate_[1] = 70 * cfg_.rc_target_bitrate / 100;
1169     target_layer_bitrate_[2] = cfg_.rc_target_bitrate;
1170     ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1171     for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
1172       ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.80)
1173           << " The datarate for the file is lower than target by too much!";
1174       ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.60)
1175           << " The datarate for the file is greater than target by too much!";
1176     }
1177   }
1178 
1179   int layer_frame_cnt_;
1180   int superframe_cnt_;
1181   int number_temporal_layers_;
1182   int number_spatial_layers_;
1183   // Allow for up to 3 temporal layers.
1184   int target_layer_bitrate_[AOM_MAX_LAYERS];
1185   aom_svc_params_t svc_params_;
1186   aom_svc_ref_frame_config_t ref_frame_config_;
1187   aom_svc_ref_frame_comp_pred_t ref_frame_comp_pred_;
1188   aom_svc_layer_id_t layer_id_;
1189   double effective_datarate_tl[AOM_MAX_LAYERS];
1190   unsigned int drop_frames_;
1191   unsigned int drop_frames_list_[1000];
1192   unsigned int mismatch_nframes_;
1193   unsigned int decoded_nframes_;
1194   double mismatch_psnr_;
1195   int set_frame_level_er_;
1196   int multi_ref_;
1197   int use_fixed_mode_svc_;
1198   int comp_pred_;
1199 };
1200 
1201 // Check basic rate targeting for CBR, for 3 temporal layers, 1 spatial.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL1SL)1202 TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL1SL) {
1203   BasicRateTargetingSVC3TL1SLTest();
1204 }
1205 
1206 // Check basic rate targeting for CBR, for 3 temporal layers, 1 spatial,
1207 // with dynamic resize on. Encode at very low bitrate and check that
1208 // there is at least one resize (down) event.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL1SLResize)1209 TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL1SLResize) {
1210   BasicRateTargetingSVC3TL1SLResizeTest();
1211 }
1212 
1213 // Check basic rate targeting for CBR, for 2 spatial layers, 1 temporal.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC1TL2SL)1214 TEST_P(DatarateTestSVC, BasicRateTargetingSVC1TL2SL) {
1215   BasicRateTargetingSVC1TL2SLTest();
1216 }
1217 
1218 // Check basic rate targeting for CBR, for 3 spatial layers, 1 temporal.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC1TL3SL)1219 TEST_P(DatarateTestSVC, BasicRateTargetingSVC1TL3SL) {
1220   BasicRateTargetingSVC1TL3SLTest();
1221 }
1222 
1223 // Check basic rate targeting for CBR, for 3 spatial layers, 1 temporal,
1224 // with additional temporal reference for top spatial layer.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC1TL3SLMultiRef)1225 TEST_P(DatarateTestSVC, BasicRateTargetingSVC1TL3SLMultiRef) {
1226   BasicRateTargetingSVC1TL3SLMultiRefTest();
1227 }
1228 
1229 // Check basic rate targeting for CBR, for 3 spatial, 3 temporal layers.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL3SL)1230 TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL3SL) {
1231   BasicRateTargetingSVC3TL3SLTest();
1232 }
1233 
1234 // Check basic rate targeting for CBR, for 3 spatial, 3 temporal layers.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL3SLHD)1235 TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL3SLHD) {
1236   BasicRateTargetingSVC3TL3SLHDTest();
1237 }
1238 
1239 // Check basic rate targeting for CBR, for 3 spatial, 3 temporal layers,
1240 // for fixed mode SVC.
TEST_P(DatarateTestSVC,BasicRateTargetingFixedModeSVC3TL3SLHD)1241 TEST_P(DatarateTestSVC, BasicRateTargetingFixedModeSVC3TL3SLHD) {
1242   BasicRateTargetingFixedModeSVC3TL3SLHDTest();
1243 }
1244 
1245 // Check basic rate targeting for CBR, for 3 spatial, 3 temporal layers,
1246 // for 2 threads, 2 tile_columns, row-mt enabled.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL3SLHDMT2)1247 TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL3SLHDMT2) {
1248   BasicRateTargetingSVC3TL3SLHDMT2Test();
1249 }
1250 // Check basic rate targeting for CBR, for 3 spatial, 3 temporal layers,
1251 // for 4 threads, 4 tile_columns, row-mt enabled.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL3SLHDMT4)1252 TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL3SLHDMT4) {
1253   BasicRateTargetingSVC3TL3SLHDMT4Test();
1254 }
1255 
1256 // Check basic rate targeting for CBR, for 3 spatial, 3 temporal layers,
1257 // with additional temporal reference for top spatial layer.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL3SLHDMultiRef)1258 TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL3SLHDMultiRef) {
1259   BasicRateTargetingSVC3TL3SLHDMultiRefTest();
1260 }
1261 
1262 // Check basic rate targeting for CBR, for 3 spatial, 3 temporal layers,
1263 // for auto key frame mode with short key frame period.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL3SLKf)1264 TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL3SLKf) {
1265   BasicRateTargetingSVC3TL3SLKfTest();
1266 }
1267 
1268 // Check basic rate targeting for CBR, for 3 spatial, 3 temporal layers,
1269 // for 4:4:4 input.
TEST_P(DatarateTestSVC,BasicRateTargeting444SVC3TL3SL)1270 TEST_P(DatarateTestSVC, BasicRateTargeting444SVC3TL3SL) {
1271   BasicRateTargeting444SVC3TL3SLTest();
1272 }
1273 
1274 // Check basic rate targeting for CBR, for 3 temporal layers, 1 spatial layer,
1275 // with dropping of all enhancement layers (TL 1 and TL2). Check that the base
1276 // layer (TL0) can still be decodeable (with no mismatch) with the
1277 // error_resilient flag set to 0. This test used the pattern with multiple
1278 // references (last, golden, and altref), updated on base layer.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL1SLMultiRefDropAllEnh)1279 TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL1SLMultiRefDropAllEnh) {
1280   BasicRateTargetingSVC3TL1SLMultiRefDropAllEnhTest();
1281 }
1282 
1283 // Check basic rate targeting for CBR, for 3 temporal layers, 1 spatial layer,
1284 // with dropping of all enhancement layers (TL 1 and TL2). Check that the base
1285 // layer (TL0) can still be decodeable (with no mismatch) with the
1286 // error_resilient flag set to 0.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL1SLDropAllEnh)1287 TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL1SLDropAllEnh) {
1288   BasicRateTargetingSVC3TL1SLDropAllEnhTest();
1289 }
1290 
1291 // Check basic rate targeting for CBR, for 3 temporal layers, 1 spatial layer,
1292 // with dropping of the TL2 enhancement layer, which are non-reference
1293 // (droppble) frames. For the base layer (TL0) and TL1 to still be decodeable
1294 // (with no mismatch), the error_resilient_flag may be off (set to 0),
1295 // since TL2 are non-reference frames.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL1SLDropTL2Enh)1296 TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL1SLDropTL2Enh) {
1297   BasicRateTargetingSVC3TL1SLDropTL2EnhTest();
1298 }
1299 
1300 // Check basic rate targeting for CBR, for 3 temporal layers, 1 spatial layer,
1301 // with dropping of all enhancement layers (TL 1 and TL2). Test that the
1302 // error_resilient flag can be set at frame level, with on/1 on
1303 // enhancement layers and off/0 on base layer.
1304 // This allows for successful decoding after dropping enhancement layer frames.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL1SLDropAllEnhFrameER)1305 TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL1SLDropAllEnhFrameER) {
1306   BasicRateTargetingSVC3TL1SLDropAllEnhFrameERTest();
1307 }
1308 
1309 // Check basic rate targeting for CBR, for 3 temporal layers, 1 spatial layer,
1310 // with compound prediction on, for pattern with two additional refereces
1311 // (golden and altref), both updated on base TLO frames.
TEST_P(DatarateTestSVC,BasicRateTargetingSVC3TL1SLMultiRefCompound)1312 TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL1SLMultiRefCompound) {
1313   BasicRateTargetingSVC3TL1SLMultiRefCompoundTest();
1314 }
1315 
1316 AV1_INSTANTIATE_TEST_SUITE(DatarateTestSVC,
1317                            ::testing::Values(::libaom_test::kRealTime),
1318                            ::testing::Range(7, 10),
1319                            ::testing::Range<unsigned int>(0, 4),
1320                            ::testing::Values(0, 1));
1321 
1322 }  // namespace
1323 }  // namespace datarate_test
1324