aboutsummaryrefslogtreecommitdiff
path: root/third_party/libaom/source/libaom/test/svc_datarate_test.cc
diff options
context:
space:
mode:
authorErwin Jansen <jansene@google.com>2021-06-30 07:29:26 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2021-06-30 07:29:26 +0000
commit059cdc5996938f5f6b5343b6c969c12098275587 (patch)
tree6eacaffe4bebf8e00c290c1e1839e084b0c52e88 /third_party/libaom/source/libaom/test/svc_datarate_test.cc
parent97e54a7e73c7b24e464ef06ef3c3b3716f21bb15 (diff)
parent16be34ae72cdb525c88c2b31b21b976f35fe36d8 (diff)
downloadwebrtc-059cdc5996938f5f6b5343b6c969c12098275587.tar.gz
Merge "Merge upstream-master and enable ARM64" into emu-master-devemu-31-stable-releaseemu-31-release
Diffstat (limited to 'third_party/libaom/source/libaom/test/svc_datarate_test.cc')
-rw-r--r--third_party/libaom/source/libaom/test/svc_datarate_test.cc59
1 files changed, 57 insertions, 2 deletions
diff --git a/third_party/libaom/source/libaom/test/svc_datarate_test.cc b/third_party/libaom/source/libaom/test/svc_datarate_test.cc
index 8d7376a554..d2839ccc61 100644
--- a/third_party/libaom/source/libaom/test/svc_datarate_test.cc
+++ b/third_party/libaom/source/libaom/test/svc_datarate_test.cc
@@ -80,6 +80,7 @@ class DatarateTestSVC
mismatch_psnr_ = 0.0;
set_frame_level_er_ = 0;
multi_ref_ = 0;
+ use_fixed_mode_svc_ = 0;
}
virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video,
@@ -89,6 +90,7 @@ class DatarateTestSVC
initialize_svc(number_temporal_layers_, number_spatial_layers_,
&svc_params_);
encoder->Control(AV1E_SET_SVC_PARAMS, &svc_params_);
+ // TODO(aomedia:3032): Configure KSVC in fixed mode.
encoder->Control(AV1E_SET_ENABLE_ORDER_HINT, 0);
encoder->Control(AV1E_SET_ENABLE_TPL_MODEL, 0);
encoder->Control(AV1E_SET_DELTAQ_MODE, 0);
@@ -110,7 +112,11 @@ class DatarateTestSVC
set_layer_pattern(video->frame(), &layer_id_, &ref_frame_config_,
spatial_layer_id, multi_ref_);
encoder->Control(AV1E_SET_SVC_LAYER_ID, &layer_id_);
- encoder->Control(AV1E_SET_SVC_REF_FRAME_CONFIG, &ref_frame_config_);
+ // The SET_SVC_REF_FRAME_CONFIG api is for the flexible SVC mode
+ // (i.e., use_fixed_mode_svc == 0).
+ if (!use_fixed_mode_svc_) {
+ encoder->Control(AV1E_SET_SVC_REF_FRAME_CONFIG, &ref_frame_config_);
+ }
if (set_frame_level_er_) {
int mode =
(layer_id_.spatial_layer_id > 0 || layer_id_.temporal_layer_id > 0);
@@ -170,7 +176,7 @@ class DatarateTestSVC
int lag_index = 0;
int base_count = frame_cnt >> 2;
layer_id->spatial_layer_id = spatial_layer;
- // Set the referende map buffer idx for the 7 references:
+ // Set the reference map buffer idx for the 7 references:
// LAST_FRAME (0), LAST2_FRAME(1), LAST3_FRAME(2), GOLDEN_FRAME(3),
// BWDREF_FRAME(4), ALTREF2_FRAME(5), ALTREF_FRAME(6).
for (int i = 0; i < INTER_REFS_PER_FRAME; i++) {
@@ -689,6 +695,48 @@ class DatarateTestSVC
}
}
+ virtual void BasicRateTargetingFixedModeSVC3TL3SLHDTest() {
+ cfg_.rc_buf_initial_sz = 500;
+ cfg_.rc_buf_optimal_sz = 500;
+ cfg_.rc_buf_sz = 1000;
+ cfg_.rc_dropframe_thresh = 0;
+ cfg_.rc_min_quantizer = 0;
+ cfg_.rc_max_quantizer = 63;
+ cfg_.rc_end_usage = AOM_CBR;
+ cfg_.g_lag_in_frames = 0;
+ cfg_.g_error_resilient = 0;
+
+ ::libaom_test::Y4mVideoSource video("niklas_1280_720_30.y4m", 0, 60);
+ const int bitrate_array[2] = { 600, 1200 };
+ cfg_.rc_target_bitrate = bitrate_array[GET_PARAM(4)];
+ ResetModel();
+ number_temporal_layers_ = 3;
+ number_spatial_layers_ = 3;
+ use_fixed_mode_svc_ = 1;
+ // SL0
+ const int bitrate_sl0 = 1 * cfg_.rc_target_bitrate / 8;
+ target_layer_bitrate_[0] = 50 * bitrate_sl0 / 100;
+ target_layer_bitrate_[1] = 70 * bitrate_sl0 / 100;
+ target_layer_bitrate_[2] = bitrate_sl0;
+ // SL1
+ const int bitrate_sl1 = 3 * cfg_.rc_target_bitrate / 8;
+ target_layer_bitrate_[3] = 50 * bitrate_sl1 / 100;
+ target_layer_bitrate_[4] = 70 * bitrate_sl1 / 100;
+ target_layer_bitrate_[5] = bitrate_sl1;
+ // SL2
+ const int bitrate_sl2 = 4 * cfg_.rc_target_bitrate / 8;
+ target_layer_bitrate_[6] = 50 * bitrate_sl2 / 100;
+ target_layer_bitrate_[7] = 70 * bitrate_sl2 / 100;
+ target_layer_bitrate_[8] = bitrate_sl2;
+ ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
+ for (int i = 0; i < number_temporal_layers_ * number_spatial_layers_; i++) {
+ ASSERT_GE(effective_datarate_tl[i], target_layer_bitrate_[i] * 0.70)
+ << " The datarate for the file is lower than target by too much!";
+ ASSERT_LE(effective_datarate_tl[i], target_layer_bitrate_[i] * 1.45)
+ << " The datarate for the file is greater than target by too much!";
+ }
+ }
+
virtual void BasicRateTargetingSVC3TL3SLHDMT2Test() {
cfg_.rc_buf_initial_sz = 500;
cfg_.rc_buf_optimal_sz = 500;
@@ -1101,6 +1149,7 @@ class DatarateTestSVC
double mismatch_psnr_;
int set_frame_level_er_;
int multi_ref_;
+ int use_fixed_mode_svc_;
};
// Check basic rate targeting for CBR, for 3 temporal layers, 1 spatial.
@@ -1142,6 +1191,12 @@ TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL3SLHD) {
}
// Check basic rate targeting for CBR, for 3 spatial, 3 temporal layers,
+// for fixed mode SVC.
+TEST_P(DatarateTestSVC, BasicRateTargetingFixedModeSVC3TL3SLHD) {
+ BasicRateTargetingFixedModeSVC3TL3SLHDTest();
+}
+
+// Check basic rate targeting for CBR, for 3 spatial, 3 temporal layers,
// for 2 threads, 2 tile_columns, row-mt enabled.
TEST_P(DatarateTestSVC, BasicRateTargetingSVC3TL3SLHDMT2) {
BasicRateTargetingSVC3TL3SLHDMT2Test();