/src/libavif/ext/aom/av1/encoder/speed_features.c
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2016, 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 <limits.h> |
13 | | |
14 | | #include "av1/common/reconintra.h" |
15 | | |
16 | | #include "av1/encoder/encoder.h" |
17 | | #include "av1/encoder/speed_features.h" |
18 | | #include "av1/encoder/rdopt.h" |
19 | | |
20 | | #include "aom_dsp/aom_dsp_common.h" |
21 | | |
22 | | #define MAX_MESH_SPEED 5 // Max speed setting for mesh motion method |
23 | | // Max speed setting for tx domain evaluation |
24 | | #define MAX_TX_DOMAIN_EVAL_SPEED 5 |
25 | | static const MESH_PATTERN |
26 | | good_quality_mesh_patterns[MAX_MESH_SPEED + 1][MAX_MESH_STEP] = { |
27 | | { { 64, 8 }, { 28, 4 }, { 15, 1 }, { 7, 1 } }, |
28 | | { { 64, 8 }, { 28, 4 }, { 15, 1 }, { 7, 1 } }, |
29 | | { { 64, 8 }, { 14, 2 }, { 7, 1 }, { 7, 1 } }, |
30 | | { { 64, 16 }, { 24, 8 }, { 12, 4 }, { 7, 1 } }, |
31 | | { { 64, 16 }, { 24, 8 }, { 12, 4 }, { 7, 1 } }, |
32 | | { { 64, 16 }, { 24, 8 }, { 12, 4 }, { 7, 1 } }, |
33 | | }; |
34 | | |
35 | | // TODO(huisu@google.com): These settings are pretty relaxed, tune them for |
36 | | // each speed setting |
37 | | static const MESH_PATTERN |
38 | | intrabc_mesh_patterns[MAX_MESH_SPEED + 1][MAX_MESH_STEP] = { |
39 | | { { 256, 1 }, { 256, 1 }, { 0, 0 }, { 0, 0 } }, |
40 | | { { 256, 1 }, { 256, 1 }, { 0, 0 }, { 0, 0 } }, |
41 | | { { 64, 1 }, { 64, 1 }, { 0, 0 }, { 0, 0 } }, |
42 | | { { 64, 1 }, { 64, 1 }, { 0, 0 }, { 0, 0 } }, |
43 | | { { 64, 4 }, { 16, 1 }, { 0, 0 }, { 0, 0 } }, |
44 | | { { 64, 4 }, { 16, 1 }, { 0, 0 }, { 0, 0 } }, |
45 | | }; |
46 | | |
47 | | // Threshold values to be used for pruning the txfm_domain_distortion |
48 | | // based on block MSE |
49 | | // Index 0: Default mode evaluation, Winner mode processing is not |
50 | | // applicable (Eg : IntraBc). Index 1: Mode evaluation. |
51 | | // Index 2: Winner mode evaluation. Index 1 and 2 are applicable when |
52 | | // enable_winner_mode_for_use_tx_domain_dist speed feature is ON |
53 | | // TODO(any): Experiment the threshold logic based on variance metric |
54 | | static const unsigned int tx_domain_dist_thresholds[4][MODE_EVAL_TYPES] = { |
55 | | { UINT_MAX, UINT_MAX, UINT_MAX }, |
56 | | { 22026, 22026, 22026 }, |
57 | | { 1377, 1377, 1377 }, |
58 | | { 0, 0, 0 } |
59 | | }; |
60 | | |
61 | | // Number of different levels of aggressiveness in using transform domain |
62 | | // distortion during the R-D evaluation based on the speed feature |
63 | | // tx_domain_dist_level. |
64 | | #define TX_DOMAIN_DIST_LEVELS 4 |
65 | | |
66 | | // Transform domain distortion type to be used for default, mode and winner mode |
67 | | // evaluation Index 0: Default mode evaluation, Winner mode processing is not |
68 | | // applicable (Eg : IntraBc). Index 1: Mode evaluation. Index 2: Winner mode |
69 | | // evaluation. Index 1 and 2 are applicable when |
70 | | // enable_winner_mode_for_use_tx_domain_dist speed feature is ON |
71 | | static const unsigned int |
72 | | tx_domain_dist_types[TX_DOMAIN_DIST_LEVELS][MODE_EVAL_TYPES] = { |
73 | | { 0, 2, 0 }, { 1, 2, 0 }, { 2, 2, 0 }, { 2, 2, 2 } |
74 | | }; |
75 | | |
76 | | // Threshold values to be used for disabling coeff RD-optimization |
77 | | // based on block MSE / qstep^2. |
78 | | // TODO(any): Experiment the threshold logic based on variance metric. |
79 | | // Table has satd and dist threshold value index 0 : dist,index 1: satd |
80 | | // For each row, the indices are as follows. |
81 | | // Index 0: Default mode evaluation, Winner mode processing is not applicable |
82 | | // (Eg : IntraBc) |
83 | | // Index 1: Mode evaluation. |
84 | | // Index 2: Winner mode evaluation. |
85 | | // Index 1 and 2 are applicable when enable_winner_mode_for_coeff_opt speed |
86 | | // feature is ON |
87 | | // There are 7 levels with increasing speed, mapping to vertical indices. |
88 | | static const unsigned int coeff_opt_thresholds[9][MODE_EVAL_TYPES][2] = { |
89 | | { { UINT_MAX, UINT_MAX }, { UINT_MAX, UINT_MAX }, { UINT_MAX, UINT_MAX } }, |
90 | | { { 3200, UINT_MAX }, { 250, UINT_MAX }, { UINT_MAX, UINT_MAX } }, |
91 | | { { 1728, UINT_MAX }, { 142, UINT_MAX }, { UINT_MAX, UINT_MAX } }, |
92 | | { { 864, UINT_MAX }, { 142, UINT_MAX }, { UINT_MAX, UINT_MAX } }, |
93 | | { { 432, UINT_MAX }, { 86, UINT_MAX }, { UINT_MAX, UINT_MAX } }, |
94 | | { { 864, 97 }, { 142, 16 }, { UINT_MAX, UINT_MAX } }, |
95 | | { { 432, 97 }, { 86, 16 }, { UINT_MAX, UINT_MAX } }, |
96 | | { { 216, 25 }, { 86, 10 }, { UINT_MAX, UINT_MAX } }, |
97 | | { { 216, 25 }, { 0, 10 }, { UINT_MAX, UINT_MAX } } |
98 | | }; |
99 | | |
100 | | // Transform size to be used for default, mode and winner mode evaluation |
101 | | // Index 0: Default mode evaluation, Winner mode processing is not applicable |
102 | | // (Eg : IntraBc) Index 1: Mode evaluation. Index 2: Winner mode evaluation. |
103 | | // Index 1 and 2 are applicable when enable_winner_mode_for_tx_size_srch speed |
104 | | // feature is ON |
105 | | static const TX_SIZE_SEARCH_METHOD |
106 | | tx_size_search_methods[4][MODE_EVAL_TYPES] = { |
107 | | { USE_FULL_RD, USE_LARGESTALL, USE_FULL_RD }, |
108 | | { USE_FAST_RD, USE_LARGESTALL, USE_FULL_RD }, |
109 | | { USE_LARGESTALL, USE_LARGESTALL, USE_FULL_RD }, |
110 | | { USE_LARGESTALL, USE_LARGESTALL, USE_LARGESTALL } |
111 | | }; |
112 | | |
113 | | // Predict transform skip levels to be used for default, mode and winner mode |
114 | | // evaluation. Index 0: Default mode evaluation, Winner mode processing is not |
115 | | // applicable. Index 1: Mode evaluation, Index 2: Winner mode evaluation |
116 | | // Values indicate the aggressiveness of skip flag prediction. |
117 | | // 0 : no early skip prediction |
118 | | // 1 : conservative early skip prediction using DCT_DCT |
119 | | // 2 : early skip prediction based on SSE |
120 | | static const unsigned int predict_skip_levels[3][MODE_EVAL_TYPES] = { |
121 | | { 0, 0, 0 }, { 1, 1, 1 }, { 1, 2, 1 } |
122 | | }; |
123 | | |
124 | | // Predict skip or DC block level used during transform type search. It is |
125 | | // indexed using the following: |
126 | | // First index : Speed feature 'dc_blk_pred_level' (0 to 3) |
127 | | // Second index : Mode evaluation type (DEFAULT_EVAL, MODE_EVAL and |
128 | | // WINNER_MODE_EVAL). |
129 | | // |
130 | | // The values of predict_dc_levels[][] indicate the aggressiveness of predicting |
131 | | // a block as transform skip or DC only. |
132 | | // Type 0 : No skip block or DC only block prediction |
133 | | // Type 1 : Prediction of skip block based on residual mean and variance |
134 | | // Type 2 : Prediction of skip block or DC only block based on residual mean and |
135 | | // variance |
136 | | static const unsigned int predict_dc_levels[4][MODE_EVAL_TYPES] = { |
137 | | { 0, 0, 0 }, { 1, 1, 0 }, { 2, 2, 0 }, { 2, 2, 2 } |
138 | | }; |
139 | | |
140 | | #if !CONFIG_FPMT_TEST |
141 | | // This table holds the maximum number of reference frames for global motion. |
142 | | // The table is indexed as per the speed feature 'gm_search_type'. |
143 | | // 0 : All reference frames are allowed. |
144 | | // 1 : All reference frames except L2 and L3 are allowed. |
145 | | // 2 : All reference frames except L2, L3 and ARF2 are allowed. |
146 | | // 3 : No reference frame is allowed. |
147 | | static const int gm_available_reference_frames[GM_DISABLE_SEARCH + 1] = { |
148 | | INTER_REFS_PER_FRAME, INTER_REFS_PER_FRAME - 2, INTER_REFS_PER_FRAME - 3, 0 |
149 | | }; |
150 | | #endif |
151 | | |
152 | | // Intra only frames, golden frames (except alt ref overlays) and |
153 | | // alt ref frames tend to be coded at a higher than ambient quality |
154 | 364k | static int frame_is_boosted(const AV1_COMP *cpi) { |
155 | 364k | return frame_is_kf_gf_arf(cpi); |
156 | 364k | } |
157 | | |
158 | | // Set transform rd gate level for all transform search cases. |
159 | | static inline void set_txfm_rd_gate_level( |
160 | 520k | int txfm_rd_gate_level[TX_SEARCH_CASES], int level) { |
161 | 520k | assert(level <= MAX_TX_RD_GATE_LEVEL); |
162 | 2.08M | for (int idx = 0; idx < TX_SEARCH_CASES; idx++) |
163 | 1.56M | txfm_rd_gate_level[idx] = level; |
164 | 520k | } |
165 | | |
166 | | static void set_allintra_speed_feature_framesize_dependent( |
167 | 213k | const AV1_COMP *const cpi, SPEED_FEATURES *const sf, int speed) { |
168 | 213k | const AV1_COMMON *const cm = &cpi->common; |
169 | 213k | const int is_480p_or_larger = AOMMIN(cm->width, cm->height) >= 480; |
170 | 213k | const int is_720p_or_larger = AOMMIN(cm->width, cm->height) >= 720; |
171 | 213k | const int is_1080p_or_larger = AOMMIN(cm->width, cm->height) >= 1080; |
172 | 213k | const int is_4k_or_larger = AOMMIN(cm->width, cm->height) >= 2160; |
173 | 213k | const bool use_hbd = cpi->oxcf.use_highbitdepth; |
174 | | |
175 | 213k | if (is_480p_or_larger) { |
176 | 1.91k | sf->part_sf.use_square_partition_only_threshold = BLOCK_128X128; |
177 | 1.91k | if (is_720p_or_larger) |
178 | 0 | sf->part_sf.auto_max_partition_based_on_simple_motion = ADAPT_PRED; |
179 | 1.91k | else |
180 | 1.91k | sf->part_sf.auto_max_partition_based_on_simple_motion = RELAXED_PRED; |
181 | 211k | } else { |
182 | 211k | sf->part_sf.use_square_partition_only_threshold = BLOCK_64X64; |
183 | 211k | sf->part_sf.auto_max_partition_based_on_simple_motion = DIRECT_PRED; |
184 | 211k | if (use_hbd) sf->tx_sf.prune_tx_size_level = 1; |
185 | 211k | } |
186 | | |
187 | 213k | if (is_4k_or_larger) { |
188 | 0 | sf->part_sf.default_min_partition_size = BLOCK_8X8; |
189 | 0 | } |
190 | | |
191 | | // TODO(huisu@google.com): train models for 720P and above. |
192 | 213k | if (!is_720p_or_larger) { |
193 | 213k | sf->part_sf.ml_partition_search_breakout_thresh[0] = -1.0f; |
194 | 213k | sf->part_sf.ml_partition_search_breakout_thresh[1] = 0.993307f; |
195 | 213k | sf->part_sf.ml_partition_search_breakout_thresh[2] = 0.952574f; |
196 | 213k | sf->part_sf.ml_partition_search_breakout_thresh[3] = 0.924142f; |
197 | 213k | sf->part_sf.ml_partition_search_breakout_thresh[4] = 0.880797f; |
198 | 213k | sf->part_sf.ml_early_term_after_part_split_level = 1; |
199 | 213k | } |
200 | | |
201 | 213k | sf->part_sf.ml_partition_search_breakout_model_index = 0; |
202 | | |
203 | 213k | if (is_720p_or_larger) { |
204 | | // TODO(chiyotsai@google.com): make this speed feature adaptive based on |
205 | | // current block's vertical texture instead of hardcoded with resolution |
206 | 0 | sf->mv_sf.use_downsampled_sad = 2; |
207 | 0 | } |
208 | | |
209 | 213k | if (speed >= 1) { |
210 | 142k | sf->part_sf.ml_4_partition_search_level_index = 1; |
211 | 142k | if (is_720p_or_larger) { |
212 | 0 | sf->part_sf.use_square_partition_only_threshold = BLOCK_128X128; |
213 | 142k | } else if (is_480p_or_larger) { |
214 | 1.27k | sf->part_sf.use_square_partition_only_threshold = BLOCK_64X64; |
215 | 141k | } else { |
216 | 141k | sf->part_sf.use_square_partition_only_threshold = BLOCK_32X32; |
217 | 141k | } |
218 | | |
219 | 142k | if (is_720p_or_larger) { |
220 | 0 | sf->part_sf.ml_partition_search_breakout_thresh[0] = 0.5f; |
221 | 0 | sf->part_sf.ml_partition_search_breakout_thresh[1] = 0.5042595622791082f; |
222 | 0 | sf->part_sf.ml_partition_search_breakout_thresh[2] = 0.5f; |
223 | 0 | sf->part_sf.ml_partition_search_breakout_thresh[3] = 0.8378425823517456f; |
224 | 0 | sf->part_sf.ml_partition_search_breakout_thresh[4] = 0.8047585616503903f; |
225 | 0 | sf->part_sf.ml_partition_search_breakout_model_index = 1; |
226 | 142k | } else { |
227 | 142k | sf->part_sf.ml_partition_search_breakout_thresh[0] = -1.0f; |
228 | 142k | sf->part_sf.ml_partition_search_breakout_thresh[1] = 0.952574f; |
229 | 142k | sf->part_sf.ml_partition_search_breakout_thresh[2] = 0.952574f; |
230 | 142k | sf->part_sf.ml_partition_search_breakout_thresh[3] = 0.924142f; |
231 | 142k | sf->part_sf.ml_partition_search_breakout_thresh[4] = 0.880797f; |
232 | 142k | } |
233 | 142k | sf->part_sf.ml_early_term_after_part_split_level = 2; |
234 | 142k | } |
235 | | |
236 | 213k | if (speed >= 2) { |
237 | 142k | sf->part_sf.ml_4_partition_search_level_index = 2; |
238 | 142k | if (is_720p_or_larger) { |
239 | 0 | sf->part_sf.use_square_partition_only_threshold = BLOCK_64X64; |
240 | 142k | } else { |
241 | 142k | sf->part_sf.use_square_partition_only_threshold = BLOCK_32X32; |
242 | 142k | } |
243 | | |
244 | 142k | if (is_720p_or_larger) { |
245 | 0 | sf->part_sf.ml_partition_search_breakout_thresh[0] = 0.5f; |
246 | 0 | sf->part_sf.ml_partition_search_breakout_thresh[1] = 0.5042595622791082f; |
247 | 0 | sf->part_sf.ml_partition_search_breakout_thresh[2] = 0.5f; |
248 | 0 | sf->part_sf.ml_partition_search_breakout_thresh[3] = 0.8378425823517456f; |
249 | 0 | sf->part_sf.ml_partition_search_breakout_thresh[4] = 0.8047585616503903f; |
250 | 0 | sf->part_sf.ml_partition_search_breakout_model_index = 1; |
251 | 0 | } |
252 | | |
253 | 142k | if (is_720p_or_larger) { |
254 | 0 | sf->part_sf.partition_search_breakout_dist_thr = (1 << 24); |
255 | 0 | sf->part_sf.partition_search_breakout_rate_thr = 120; |
256 | 142k | } else { |
257 | 142k | sf->part_sf.partition_search_breakout_dist_thr = (1 << 22); |
258 | 142k | sf->part_sf.partition_search_breakout_rate_thr = 100; |
259 | 142k | } |
260 | | |
261 | 142k | if (is_480p_or_larger) { |
262 | 1.27k | sf->tx_sf.tx_type_search.prune_tx_type_using_stats = 1; |
263 | 1.27k | if (use_hbd) sf->tx_sf.prune_tx_size_level = 2; |
264 | 141k | } else { |
265 | 141k | if (use_hbd) sf->tx_sf.prune_tx_size_level = 3; |
266 | 141k | } |
267 | 142k | } |
268 | | |
269 | 213k | if (speed >= 3) { |
270 | 142k | sf->part_sf.ml_early_term_after_part_split_level = 0; |
271 | 142k | sf->part_sf.ml_4_partition_search_level_index = 3; |
272 | | |
273 | 142k | if (is_720p_or_larger) { |
274 | 0 | for (int i = 0; i < PARTITION_BLOCK_SIZES; ++i) { |
275 | 0 | sf->part_sf.ml_partition_search_breakout_thresh[i] = |
276 | 0 | -1; // -1 means not enabled. |
277 | 0 | } |
278 | 0 | sf->part_sf.ml_partition_search_breakout_model_index = 0; |
279 | 0 | } |
280 | | |
281 | 142k | if (is_720p_or_larger) { |
282 | 0 | sf->part_sf.partition_search_breakout_dist_thr = (1 << 25); |
283 | 0 | sf->part_sf.partition_search_breakout_rate_thr = 200; |
284 | 142k | } else { |
285 | 142k | sf->part_sf.max_intra_bsize = BLOCK_32X32; |
286 | 142k | sf->part_sf.partition_search_breakout_dist_thr = (1 << 23); |
287 | 142k | sf->part_sf.partition_search_breakout_rate_thr = 120; |
288 | 142k | } |
289 | 142k | if (use_hbd) sf->tx_sf.prune_tx_size_level = 3; |
290 | 142k | } |
291 | | |
292 | 213k | if (speed >= 4) { |
293 | 142k | if (is_720p_or_larger) { |
294 | 0 | sf->part_sf.partition_search_breakout_dist_thr = (1 << 26); |
295 | 142k | } else { |
296 | 142k | sf->part_sf.partition_search_breakout_dist_thr = (1 << 24); |
297 | 142k | } |
298 | | |
299 | 142k | if (is_480p_or_larger) { |
300 | 1.27k | sf->tx_sf.tx_type_search.prune_tx_type_using_stats = 2; |
301 | 1.27k | } |
302 | 142k | } |
303 | | |
304 | 213k | if (speed >= 6) { |
305 | 142k | if (is_720p_or_larger) { |
306 | 0 | sf->part_sf.auto_max_partition_based_on_simple_motion = NOT_IN_USE; |
307 | 142k | } else if (is_480p_or_larger) { |
308 | 1.27k | sf->part_sf.auto_max_partition_based_on_simple_motion = DIRECT_PRED; |
309 | 1.27k | } |
310 | | |
311 | 142k | if (is_1080p_or_larger) { |
312 | 0 | sf->part_sf.default_min_partition_size = BLOCK_8X8; |
313 | 0 | } |
314 | | |
315 | 142k | sf->part_sf.use_square_partition_only_threshold = BLOCK_16X16; |
316 | 142k | } |
317 | | |
318 | 213k | if (speed >= 7) { |
319 | | // TODO(kyslov): add more speed features to control speed/quality |
320 | 61.4k | } |
321 | | |
322 | 213k | if (speed >= 8) { |
323 | 42.0k | if (!is_480p_or_larger) { |
324 | 41.5k | sf->rt_sf.nonrd_check_partition_merge_mode = 2; |
325 | 41.5k | } |
326 | 42.0k | if (is_720p_or_larger) { |
327 | 0 | sf->rt_sf.force_large_partition_blocks_intra = 1; |
328 | 0 | } |
329 | 42.0k | } |
330 | | |
331 | 213k | if (speed >= 9) { |
332 | | // TODO(kyslov): add more speed features to control speed/quality |
333 | 22.6k | if (!is_4k_or_larger) { |
334 | | // In av1_select_sb_size(), superblock size is set to 64x64 only for |
335 | | // resolutions less than 4k in speed>=9, to improve the multithread |
336 | | // performance. If cost update levels are set to INTERNAL_COST_UPD_OFF |
337 | | // for resolutions >= 4k, the SB size setting can be modified for these |
338 | | // resolutions as well. |
339 | 22.6k | sf->inter_sf.coeff_cost_upd_level = INTERNAL_COST_UPD_OFF; |
340 | 22.6k | sf->inter_sf.mode_cost_upd_level = INTERNAL_COST_UPD_OFF; |
341 | 22.6k | } |
342 | 22.6k | } |
343 | 213k | } |
344 | | |
345 | | static void set_allintra_speed_features_framesize_independent( |
346 | 213k | const AV1_COMP *const cpi, SPEED_FEATURES *const sf, int speed) { |
347 | 213k | const AV1_COMMON *const cm = &cpi->common; |
348 | 213k | const int allow_screen_content_tools = |
349 | 213k | cm->features.allow_screen_content_tools; |
350 | 213k | const int use_hbd = cpi->oxcf.use_highbitdepth; |
351 | | |
352 | 213k | sf->part_sf.less_rectangular_check_level = 1; |
353 | 213k | sf->part_sf.ml_prune_partition = 1; |
354 | 213k | sf->part_sf.prune_ext_partition_types_search_level = 1; |
355 | 213k | sf->part_sf.prune_part4_search = 2; |
356 | 213k | sf->part_sf.simple_motion_search_prune_rect = 1; |
357 | 213k | sf->part_sf.ml_predict_breakout_level = use_hbd ? 1 : 3; |
358 | 213k | sf->part_sf.reuse_prev_rd_results_for_part_ab = 1; |
359 | 213k | sf->part_sf.use_best_rd_for_pruning = 1; |
360 | | |
361 | 213k | sf->intra_sf.intra_pruning_with_hog = 1; |
362 | 213k | sf->intra_sf.prune_luma_palette_size_search_level = 1; |
363 | 213k | sf->intra_sf.dv_cost_upd_level = INTERNAL_COST_UPD_OFF; |
364 | 213k | sf->intra_sf.early_term_chroma_palette_size_search = 1; |
365 | | |
366 | 213k | sf->tx_sf.adaptive_txb_search_level = 1; |
367 | 213k | sf->tx_sf.intra_tx_size_search_init_depth_sqr = 1; |
368 | 213k | sf->tx_sf.model_based_prune_tx_search_level = 1; |
369 | 213k | sf->tx_sf.tx_type_search.use_reduced_intra_txset = 1; |
370 | 213k | sf->tx_sf.use_chroma_trellis_rd_mult = 1; |
371 | | |
372 | 213k | sf->rt_sf.use_nonrd_pick_mode = 0; |
373 | 213k | sf->rt_sf.discount_color_cost = 0; |
374 | 213k | sf->rt_sf.use_real_time_ref_set = 0; |
375 | | |
376 | 213k | if (cpi->twopass_frame.fr_content_type == FC_GRAPHICS_ANIMATION || |
377 | 213k | cpi->use_screen_content_tools) { |
378 | 7.21k | sf->mv_sf.exhaustive_searches_thresh = (1 << 20); |
379 | 206k | } else { |
380 | 206k | sf->mv_sf.exhaustive_searches_thresh = (1 << 25); |
381 | 206k | } |
382 | | |
383 | 213k | sf->rd_sf.perform_coeff_opt = 1; |
384 | 213k | sf->hl_sf.superres_auto_search_type = SUPERRES_AUTO_DUAL; |
385 | | |
386 | 213k | if (speed >= 1) { |
387 | 142k | sf->part_sf.intra_cnn_based_part_prune_level = |
388 | 142k | allow_screen_content_tools ? 0 : 2; |
389 | 142k | sf->part_sf.simple_motion_search_prune_agg = |
390 | 142k | allow_screen_content_tools ? NO_PRUNING : SIMPLE_AGG_LVL1; |
391 | 142k | sf->part_sf.simple_motion_search_early_term_none = 1; |
392 | | // TODO(Venkat): Clean-up frame type dependency for |
393 | | // simple_motion_search_split in partition search function and set the |
394 | | // speed feature accordingly |
395 | 142k | sf->part_sf.simple_motion_search_split = allow_screen_content_tools ? 1 : 2; |
396 | 142k | sf->part_sf.ml_predict_breakout_level = use_hbd ? 2 : 3; |
397 | 142k | sf->part_sf.reuse_best_prediction_for_part_ab = 1; |
398 | | |
399 | 142k | sf->mv_sf.exhaustive_searches_thresh <<= 1; |
400 | 142k | sf->mv_sf.prune_intrabc_candidate_block_hash_search = 1; |
401 | | |
402 | 142k | sf->intra_sf.prune_palette_search_level = 1; |
403 | 142k | sf->intra_sf.prune_luma_palette_size_search_level = 2; |
404 | 142k | sf->intra_sf.top_intra_model_count_allowed = 3; |
405 | | |
406 | 142k | sf->tx_sf.adaptive_txb_search_level = 2; |
407 | 142k | sf->tx_sf.inter_tx_size_search_init_depth_rect = 1; |
408 | 142k | sf->tx_sf.inter_tx_size_search_init_depth_sqr = 1; |
409 | 142k | sf->tx_sf.intra_tx_size_search_init_depth_rect = 1; |
410 | 142k | sf->tx_sf.model_based_prune_tx_search_level = 0; |
411 | 142k | sf->tx_sf.tx_type_search.ml_tx_split_thresh = 4000; |
412 | 142k | sf->tx_sf.tx_type_search.prune_2d_txfm_mode = TX_TYPE_PRUNE_2; |
413 | 142k | sf->tx_sf.tx_type_search.skip_tx_search = 1; |
414 | | |
415 | 142k | sf->rd_sf.perform_coeff_opt = 2; |
416 | 142k | sf->rd_sf.tx_domain_dist_level = 1; |
417 | 142k | sf->rd_sf.tx_domain_dist_thres_level = 1; |
418 | | |
419 | 142k | sf->lpf_sf.cdef_pick_method = CDEF_FAST_SEARCH_LVL1; |
420 | 142k | sf->lpf_sf.dual_sgr_penalty_level = 1; |
421 | 142k | sf->lpf_sf.enable_sgr_ep_pruning = 1; |
422 | 142k | } |
423 | | |
424 | 213k | if (speed >= 2) { |
425 | 142k | sf->mv_sf.auto_mv_step_size = 1; |
426 | | |
427 | 142k | sf->part_sf.simple_motion_search_prune_agg = |
428 | 142k | allow_screen_content_tools ? NO_PRUNING : SIMPLE_AGG_LVL2; |
429 | 142k | sf->intra_sf.disable_smooth_intra = 1; |
430 | 142k | sf->intra_sf.intra_pruning_with_hog = 2; |
431 | 142k | sf->intra_sf.prune_filter_intra_level = 1; |
432 | | |
433 | 142k | sf->rd_sf.perform_coeff_opt = 3; |
434 | | |
435 | 142k | sf->lpf_sf.prune_wiener_based_on_src_var = 1; |
436 | 142k | sf->lpf_sf.prune_sgr_based_on_wiener = 1; |
437 | 142k | } |
438 | | |
439 | 213k | if (speed >= 3) { |
440 | 142k | sf->hl_sf.high_precision_mv_usage = CURRENT_Q; |
441 | 142k | sf->hl_sf.recode_loop = ALLOW_RECODE_KFARFGF; |
442 | 142k | sf->hl_sf.screen_detection_mode2_fast_detection = 1; |
443 | | |
444 | 142k | sf->part_sf.less_rectangular_check_level = 2; |
445 | 142k | sf->part_sf.simple_motion_search_prune_agg = SIMPLE_AGG_LVL3; |
446 | 142k | sf->part_sf.prune_ext_part_using_split_info = 1; |
447 | | |
448 | 142k | sf->mv_sf.full_pixel_search_level = 1; |
449 | 142k | sf->mv_sf.search_method = DIAMOND; |
450 | | |
451 | | // TODO(chiyotsai@google.com): the thresholds chosen for intra hog are |
452 | | // inherited directly from luma hog with some minor tweaking. Eventually we |
453 | | // should run this with a bayesian optimizer to find the Pareto frontier. |
454 | 142k | sf->intra_sf.chroma_intra_pruning_with_hog = 2; |
455 | 142k | sf->intra_sf.intra_pruning_with_hog = 3; |
456 | 142k | sf->intra_sf.prune_palette_search_level = 2; |
457 | | |
458 | 142k | sf->tx_sf.adaptive_txb_search_level = 2; |
459 | 142k | sf->tx_sf.tx_type_search.use_skip_flag_prediction = 2; |
460 | 142k | sf->tx_sf.use_rd_based_breakout_for_intra_tx_search = true; |
461 | | |
462 | | // TODO(any): evaluate if these lpf features can be moved to speed 2. |
463 | | // For screen content, "prune_sgr_based_on_wiener = 2" cause large quality |
464 | | // loss. |
465 | 142k | sf->lpf_sf.prune_sgr_based_on_wiener = allow_screen_content_tools ? 1 : 2; |
466 | 142k | sf->lpf_sf.disable_loop_restoration_chroma = 0; |
467 | 142k | sf->lpf_sf.reduce_wiener_window_size = 1; |
468 | 142k | sf->lpf_sf.prune_wiener_based_on_src_var = 2; |
469 | 142k | } |
470 | | |
471 | 213k | if (speed >= 4) { |
472 | 142k | sf->mv_sf.subpel_search_method = SUBPEL_TREE_PRUNED_MORE; |
473 | | |
474 | 142k | sf->part_sf.simple_motion_search_prune_agg = SIMPLE_AGG_LVL4; |
475 | 142k | sf->part_sf.simple_motion_search_reduce_search_steps = 4; |
476 | 142k | sf->part_sf.prune_ext_part_using_split_info = 2; |
477 | 142k | sf->part_sf.early_term_after_none_split = 1; |
478 | 142k | sf->part_sf.ml_predict_breakout_level = 3; |
479 | | |
480 | 142k | sf->intra_sf.prune_chroma_modes_using_luma_winner = 1; |
481 | | |
482 | 142k | sf->mv_sf.simple_motion_subpel_force_stop = HALF_PEL; |
483 | | |
484 | 142k | sf->tpl_sf.prune_starting_mv = 2; |
485 | 142k | sf->tpl_sf.subpel_force_stop = HALF_PEL; |
486 | 142k | sf->tpl_sf.search_method = FAST_BIGDIA; |
487 | | |
488 | 142k | sf->tx_sf.tx_type_search.winner_mode_tx_type_pruning = 2; |
489 | 142k | sf->tx_sf.tx_type_search.fast_intra_tx_type_search = 2; |
490 | 142k | sf->tx_sf.tx_type_search.prune_2d_txfm_mode = TX_TYPE_PRUNE_3; |
491 | 142k | sf->tx_sf.tx_type_search.prune_tx_type_est_rd = 1; |
492 | | |
493 | 142k | sf->rd_sf.perform_coeff_opt = 5; |
494 | 142k | sf->rd_sf.tx_domain_dist_thres_level = 3; |
495 | | |
496 | 142k | sf->lpf_sf.lpf_pick = LPF_PICK_FROM_FULL_IMAGE_NON_DUAL; |
497 | 142k | sf->lpf_sf.cdef_pick_method = CDEF_FAST_SEARCH_LVL3; |
498 | | |
499 | 142k | sf->mv_sf.reduce_search_range = 1; |
500 | 142k | sf->mv_sf.hash_max_8x8_intrabc_blocks = 1; |
501 | | |
502 | 142k | sf->winner_mode_sf.enable_winner_mode_for_coeff_opt = 1; |
503 | 142k | sf->winner_mode_sf.enable_winner_mode_for_use_tx_domain_dist = 1; |
504 | 142k | sf->winner_mode_sf.multi_winner_mode_type = MULTI_WINNER_MODE_DEFAULT; |
505 | 142k | sf->winner_mode_sf.enable_winner_mode_for_tx_size_srch = 1; |
506 | 142k | } |
507 | | |
508 | 213k | if (speed >= 5) { |
509 | 142k | sf->part_sf.simple_motion_search_prune_agg = SIMPLE_AGG_LVL5; |
510 | 142k | sf->part_sf.ext_partition_eval_thresh = |
511 | 142k | allow_screen_content_tools ? BLOCK_8X8 : BLOCK_16X16; |
512 | 142k | sf->part_sf.intra_cnn_based_part_prune_level = |
513 | 142k | allow_screen_content_tools ? 1 : 2; |
514 | | |
515 | 142k | sf->intra_sf.chroma_intra_pruning_with_hog = 3; |
516 | | |
517 | 142k | sf->lpf_sf.use_coarse_filter_level_search = 0; |
518 | | // Disable Wiener and Self-guided Loop restoration filters. |
519 | 142k | sf->lpf_sf.disable_wiener_filter = true; |
520 | 142k | sf->lpf_sf.disable_sgr_filter = true; |
521 | | |
522 | 142k | sf->mv_sf.prune_mesh_search = PRUNE_MESH_SEARCH_LVL_2; |
523 | | |
524 | 142k | sf->winner_mode_sf.multi_winner_mode_type = MULTI_WINNER_MODE_FAST; |
525 | 142k | } |
526 | | |
527 | 213k | if (speed >= 6) { |
528 | 142k | sf->intra_sf.prune_smooth_intra_mode_for_chroma = 1; |
529 | 142k | sf->intra_sf.prune_filter_intra_level = 2; |
530 | 142k | sf->intra_sf.chroma_intra_pruning_with_hog = 4; |
531 | 142k | sf->intra_sf.intra_pruning_with_hog = 4; |
532 | 142k | sf->intra_sf.cfl_search_range = 1; |
533 | 142k | sf->intra_sf.top_intra_model_count_allowed = 2; |
534 | 142k | sf->intra_sf.adapt_top_model_rd_count_using_neighbors = 1; |
535 | 142k | sf->intra_sf.prune_luma_odd_delta_angles_in_intra = 1; |
536 | | |
537 | 142k | sf->part_sf.prune_rectangular_split_based_on_qidx = |
538 | 142k | allow_screen_content_tools ? 0 : 2; |
539 | 142k | sf->part_sf.prune_rect_part_using_4x4_var_deviation = true; |
540 | 142k | sf->part_sf.prune_rect_part_using_none_pred_mode = true; |
541 | 142k | sf->part_sf.prune_sub_8x8_partition_level = |
542 | 142k | allow_screen_content_tools ? 0 : 1; |
543 | 142k | sf->part_sf.prune_part4_search = 3; |
544 | | // TODO(jingning): This might not be a good trade off if the |
545 | | // target image quality is very low. |
546 | 142k | sf->part_sf.default_max_partition_size = BLOCK_32X32; |
547 | | |
548 | 142k | sf->mv_sf.use_bsize_dependent_search_method = 3; |
549 | 142k | sf->mv_sf.intrabc_search_level = 1; |
550 | | |
551 | 142k | sf->tx_sf.tx_type_search.winner_mode_tx_type_pruning = 3; |
552 | 142k | sf->tx_sf.tx_type_search.prune_tx_type_est_rd = 0; |
553 | 142k | sf->tx_sf.prune_intra_tx_depths_using_nn = true; |
554 | | |
555 | 142k | sf->rd_sf.perform_coeff_opt = 6; |
556 | 142k | sf->rd_sf.tx_domain_dist_level = 3; |
557 | | |
558 | 142k | sf->lpf_sf.cdef_pick_method = CDEF_FAST_SEARCH_LVL4; |
559 | 142k | sf->lpf_sf.lpf_pick = LPF_PICK_FROM_Q; |
560 | | |
561 | 142k | sf->winner_mode_sf.multi_winner_mode_type = MULTI_WINNER_MODE_OFF; |
562 | 142k | sf->winner_mode_sf.prune_winner_mode_eval_level = 1; |
563 | 142k | sf->winner_mode_sf.dc_blk_pred_level = 1; |
564 | 142k | } |
565 | | // The following should make all-intra mode speed 7 approximately equal |
566 | | // to real-time speed 6, |
567 | | // all-intra speed 8 close to real-time speed 7, and all-intra speed 9 |
568 | | // close to real-time speed 8 |
569 | 213k | if (speed >= 7) { |
570 | 61.4k | sf->part_sf.default_min_partition_size = BLOCK_8X8; |
571 | 61.4k | sf->part_sf.partition_search_type = VAR_BASED_PARTITION; |
572 | 61.4k | sf->lpf_sf.cdef_pick_method = CDEF_PICK_FROM_Q; |
573 | 61.4k | sf->rt_sf.mode_search_skip_flags |= FLAG_SKIP_INTRA_DIRMISMATCH; |
574 | 61.4k | sf->rt_sf.var_part_split_threshold_shift = 7; |
575 | 61.4k | } |
576 | | |
577 | 213k | if (speed >= 8) { |
578 | 42.0k | sf->rt_sf.hybrid_intra_pickmode = 2; |
579 | 42.0k | sf->rt_sf.use_nonrd_pick_mode = 1; |
580 | 42.0k | sf->rt_sf.nonrd_check_partition_merge_mode = 1; |
581 | 42.0k | sf->rt_sf.var_part_split_threshold_shift = 8; |
582 | 42.0k | sf->rt_sf.prune_palette_search_nonrd = 1; |
583 | | // Set mask for intra modes. |
584 | 714k | for (int i = 0; i < BLOCK_SIZES; ++i) |
585 | 672k | if (i >= BLOCK_32X32) |
586 | 294k | sf->rt_sf.intra_y_mode_bsize_mask_nrd[i] = INTRA_DC; |
587 | 378k | else |
588 | | // Use DC, H, V intra mode for block sizes < 32X32. |
589 | 378k | sf->rt_sf.intra_y_mode_bsize_mask_nrd[i] = INTRA_DC_H_V; |
590 | 42.0k | } |
591 | | |
592 | 213k | if (speed >= 9) { |
593 | 22.6k | sf->inter_sf.coeff_cost_upd_level = INTERNAL_COST_UPD_SBROW; |
594 | 22.6k | sf->inter_sf.mode_cost_upd_level = INTERNAL_COST_UPD_SBROW; |
595 | | |
596 | 22.6k | sf->rt_sf.nonrd_check_partition_merge_mode = 0; |
597 | 22.6k | sf->rt_sf.hybrid_intra_pickmode = 0; |
598 | | // Note that the threshold value below is intentionally lower than speed |
599 | | // 8's. This is due to the lack of hybrid intra pick mode, which causes |
600 | | // partitions to be bigger on average, causing noticeable ringing artifacts. |
601 | 22.6k | sf->rt_sf.var_part_split_threshold_shift = 7; |
602 | 22.6k | sf->rt_sf.vbp_prune_16x16_split_using_min_max_sub_blk_var = true; |
603 | 22.6k | sf->rt_sf.prune_h_pred_using_best_mode_so_far = true; |
604 | 22.6k | sf->rt_sf.enable_intra_mode_pruning_using_neighbors = true; |
605 | 22.6k | sf->rt_sf.prune_intra_mode_using_best_sad_so_far = true; |
606 | 22.6k | } |
607 | | |
608 | | // As the speed feature prune_chroma_modes_using_luma_winner already |
609 | | // constrains the number of chroma directional mode evaluations to a maximum |
610 | | // of 1, the HOG computation and the associated pruning logic does not seem to |
611 | | // help speed-up the chroma mode evaluations. Hence disable the speed feature |
612 | | // chroma_intra_pruning_with_hog when prune_chroma_modes_using_luma_winner is |
613 | | // enabled. |
614 | 213k | if (sf->intra_sf.prune_chroma_modes_using_luma_winner) |
615 | 142k | sf->intra_sf.chroma_intra_pruning_with_hog = 0; |
616 | 213k | } |
617 | | |
618 | | // Configures framesize dependent speed features for low complexity decoding. |
619 | | static void set_good_speed_features_lc_dec_framesize_dependent( |
620 | 0 | const AV1_COMP *const cpi, SPEED_FEATURES *const sf, int speed) { |
621 | 0 | if (speed < 1 || speed > 3) return; |
622 | | |
623 | 0 | const AV1_COMMON *const cm = &cpi->common; |
624 | 0 | const bool is_between_608p_and_1080p = AOMMIN(cm->width, cm->height) >= 608 && |
625 | 0 | AOMMIN(cm->width, cm->height) <= 1080; |
626 | 0 | const bool is_between_720p_and_1080p = AOMMIN(cm->width, cm->height) >= 720 && |
627 | 0 | AOMMIN(cm->width, cm->height) <= 1080; |
628 | 0 | const bool is_vertical_video = cm->width < cm->height; |
629 | |
|
630 | 0 | const FRAME_UPDATE_TYPE update_type = |
631 | 0 | get_frame_update_type(&cpi->ppi->gf_group, cpi->gf_frame_index); |
632 | 0 | const int boosted = frame_is_boosted(cpi); |
633 | 0 | const int is_key_frame = frame_is_intra_only(cm); |
634 | | |
635 | | // Need to study the decoder time impact. |
636 | 0 | sf->interp_sf.use_more_sharp_interp = 0; |
637 | | |
638 | | // Speed features for vertical videos |
639 | 0 | if (is_vertical_video && is_between_608p_and_1080p) { |
640 | 0 | const int leaf_and_overlay_frames = |
641 | 0 | (update_type == LF_UPDATE || update_type == OVERLAY_UPDATE || |
642 | 0 | update_type == INTNL_OVERLAY_UPDATE); |
643 | 0 | if (leaf_and_overlay_frames) sf->gm_sf.gm_search_type = GM_DISABLE_SEARCH; |
644 | |
|
645 | 0 | sf->hl_sf.ref_frame_mvs_lvl = 2; |
646 | |
|
647 | 0 | sf->lpf_sf.adaptive_cdef_mode = 1; |
648 | 0 | sf->lpf_sf.dual_sgr_penalty_level = boosted ? 1 : 3; |
649 | 0 | sf->lpf_sf.switchable_lr_with_bias_level = 1; |
650 | 0 | sf->lpf_sf.skip_loop_filter_using_filt_error = |
651 | 0 | (update_type != OVERLAY_UPDATE && update_type != INTNL_OVERLAY_UPDATE && |
652 | 0 | cm->current_frame.pyramid_level > 1) |
653 | 0 | ? 1 |
654 | 0 | : 0; |
655 | |
|
656 | 0 | sf->inter_sf.bias_warp_mode_rd_scale_pct = 4; |
657 | 0 | sf->inter_sf.bias_obmc_mode_rd_scale_pct = 1.5f; |
658 | |
|
659 | 0 | sf->part_sf.split_partition_penalty_level = is_key_frame ? 0 : 2; |
660 | |
|
661 | 0 | if (speed >= 2) { |
662 | 0 | sf->part_sf.split_partition_penalty_level = is_key_frame ? 0 : 1; |
663 | 0 | } |
664 | 0 | } |
665 | | |
666 | | // Speed features for regular videos |
667 | 0 | if (!is_vertical_video && is_between_720p_and_1080p) { |
668 | 0 | sf->gm_sf.gm_erroradv_tr_level = 1; |
669 | |
|
670 | 0 | sf->hl_sf.ref_frame_mvs_lvl = 1; |
671 | |
|
672 | 0 | sf->lpf_sf.adaptive_cdef_mode = 1; |
673 | 0 | sf->lpf_sf.skip_loop_filter_using_filt_error = |
674 | 0 | (update_type != OVERLAY_UPDATE && update_type != INTNL_OVERLAY_UPDATE && |
675 | 0 | cm->current_frame.pyramid_level > 1) |
676 | 0 | ? 1 |
677 | 0 | : 0; |
678 | |
|
679 | 0 | sf->inter_sf.bias_warp_mode_rd_scale_pct = 4; |
680 | 0 | sf->inter_sf.bias_obmc_mode_rd_scale_pct = 1.5f; |
681 | |
|
682 | 0 | sf->part_sf.split_partition_penalty_level = is_key_frame ? 0 : 2; |
683 | |
|
684 | 0 | if (speed >= 2) { |
685 | 0 | sf->part_sf.split_partition_penalty_level = is_key_frame ? 0 : 1; |
686 | 0 | } |
687 | 0 | } |
688 | 0 | } |
689 | | |
690 | | // Configures framesize independent speed features for low complexity decoding. |
691 | | static void set_good_speed_features_lc_dec_framesize_independent( |
692 | 0 | const AV1_COMP *const cpi, SPEED_FEATURES *const sf, int speed) { |
693 | 0 | if (speed < 1 || speed > 3) return; |
694 | | |
695 | | // Need to study the decoder time impact. |
696 | 0 | sf->interp_sf.use_more_sharp_interp = 0; |
697 | |
|
698 | 0 | const FRAME_UPDATE_TYPE update_type = |
699 | 0 | get_frame_update_type(&cpi->ppi->gf_group, cpi->gf_frame_index); |
700 | |
|
701 | 0 | sf->lpf_sf.adaptive_luma_loop_filter_skip = |
702 | 0 | (update_type != OVERLAY_UPDATE && update_type != INTNL_OVERLAY_UPDATE) |
703 | 0 | ? 1 |
704 | 0 | : 0; |
705 | 0 | } |
706 | | |
707 | | static void set_good_speed_feature_framesize_dependent( |
708 | 74.4k | const AV1_COMP *const cpi, SPEED_FEATURES *const sf, int speed) { |
709 | 74.4k | const AV1_COMMON *const cm = &cpi->common; |
710 | 74.4k | const int is_480p_or_lesser = AOMMIN(cm->width, cm->height) <= 480; |
711 | 74.4k | const int is_480p_or_larger = AOMMIN(cm->width, cm->height) >= 480; |
712 | 74.4k | const int is_720p_or_larger = AOMMIN(cm->width, cm->height) >= 720; |
713 | 74.4k | const int is_1080p_or_larger = AOMMIN(cm->width, cm->height) >= 1080; |
714 | 74.4k | const int is_4k_or_larger = AOMMIN(cm->width, cm->height) >= 2160; |
715 | 74.4k | const bool use_hbd = cpi->oxcf.use_highbitdepth; |
716 | | // Speed features applicable for temporal filtering and tpl modules may be |
717 | | // changed based on frame type at places where the sf is applied (Example : |
718 | | // use_downsampled_sad). This is because temporal filtering and tpl modules |
719 | | // are called before this function (except for the first key frame). |
720 | | // TODO(deepa.kg@ittiam.com): For the speed features applicable to temporal |
721 | | // filtering and tpl modules, modify the sf initialization appropriately |
722 | | // before calling the modules. |
723 | 74.4k | const int boosted = frame_is_boosted(cpi); |
724 | 74.4k | const int is_boosted_arf2_bwd_type = |
725 | 74.4k | boosted || |
726 | 14.7k | cpi->ppi->gf_group.update_type[cpi->gf_frame_index] == INTNL_ARF_UPDATE; |
727 | 74.4k | const int is_lf_frame = |
728 | 74.4k | cpi->ppi->gf_group.update_type[cpi->gf_frame_index] == LF_UPDATE; |
729 | 74.4k | const int allow_screen_content_tools = |
730 | 74.4k | cm->features.allow_screen_content_tools; |
731 | | |
732 | 74.4k | if (is_480p_or_larger) { |
733 | 0 | sf->part_sf.use_square_partition_only_threshold = BLOCK_128X128; |
734 | 0 | if (is_720p_or_larger) |
735 | 0 | sf->part_sf.auto_max_partition_based_on_simple_motion = ADAPT_PRED; |
736 | 0 | else |
737 | 0 | sf->part_sf.auto_max_partition_based_on_simple_motion = RELAXED_PRED; |
738 | 74.4k | } else { |
739 | 74.4k | sf->part_sf.use_square_partition_only_threshold = BLOCK_64X64; |
740 | 74.4k | sf->part_sf.auto_max_partition_based_on_simple_motion = DIRECT_PRED; |
741 | 74.4k | if (use_hbd) sf->tx_sf.prune_tx_size_level = 1; |
742 | 74.4k | } |
743 | | |
744 | 74.4k | if (is_4k_or_larger) { |
745 | 0 | sf->part_sf.default_min_partition_size = BLOCK_8X8; |
746 | 0 | } |
747 | | |
748 | | // TODO(huisu@google.com): train models for 720P and above. |
749 | 74.4k | if (!is_720p_or_larger) { |
750 | 74.4k | sf->part_sf.ml_partition_search_breakout_thresh[0] = -1.0f; |
751 | 74.4k | sf->part_sf.ml_partition_search_breakout_thresh[1] = 0.993307f; |
752 | 74.4k | sf->part_sf.ml_partition_search_breakout_thresh[2] = 0.952574f; |
753 | 74.4k | sf->part_sf.ml_partition_search_breakout_thresh[3] = 0.924142f; |
754 | 74.4k | sf->part_sf.ml_partition_search_breakout_thresh[4] = 0.880797f; |
755 | 74.4k | sf->part_sf.ml_early_term_after_part_split_level = 1; |
756 | 74.4k | } |
757 | | |
758 | 74.4k | sf->part_sf.ml_partition_search_breakout_model_index = 0; |
759 | | |
760 | 74.4k | if (is_720p_or_larger) { |
761 | | // TODO(chiyotsai@google.com): make this speed feature adaptive based on |
762 | | // current block's vertical texture instead of hardcoded with resolution |
763 | 0 | sf->mv_sf.use_downsampled_sad = 2; |
764 | 0 | } |
765 | | |
766 | 74.4k | if (!is_720p_or_larger) { |
767 | 74.4k | const RateControlCfg *const rc_cfg = &cpi->oxcf.rc_cfg; |
768 | 74.4k | const int rate_tolerance = |
769 | 74.4k | AOMMIN(rc_cfg->under_shoot_pct, rc_cfg->over_shoot_pct); |
770 | 74.4k | sf->hl_sf.recode_tolerance = 25 + (rate_tolerance >> 2); |
771 | 74.4k | } |
772 | | |
773 | 74.4k | if (speed >= 1) { |
774 | 55.6k | sf->part_sf.ml_4_partition_search_level_index = 1; |
775 | 55.6k | sf->inter_sf.skip_newmv_in_drl = 1; |
776 | | |
777 | 55.6k | if (is_480p_or_lesser) { |
778 | 55.6k | sf->inter_sf.skip_cmp_using_top_cmp_avg_est_rd_lvl = 1; |
779 | 55.6k | } else { |
780 | 0 | sf->inter_sf.skip_cmp_using_top_cmp_avg_est_rd_lvl = 2; |
781 | 0 | } |
782 | | |
783 | 55.6k | if (is_720p_or_larger) { |
784 | 0 | sf->part_sf.use_square_partition_only_threshold = BLOCK_128X128; |
785 | 55.6k | } else if (is_480p_or_larger) { |
786 | 0 | sf->part_sf.use_square_partition_only_threshold = BLOCK_64X64; |
787 | 55.6k | } else { |
788 | 55.6k | sf->part_sf.use_square_partition_only_threshold = BLOCK_32X32; |
789 | 55.6k | } |
790 | | |
791 | 55.6k | if (is_720p_or_larger) { |
792 | 0 | sf->part_sf.ml_partition_search_breakout_thresh[0] = 0.5f; |
793 | 0 | sf->part_sf.ml_partition_search_breakout_thresh[1] = 0.5042595622791082f; |
794 | 0 | sf->part_sf.ml_partition_search_breakout_thresh[2] = 0.5f; |
795 | 0 | sf->part_sf.ml_partition_search_breakout_thresh[3] = 0.8378425823517456f; |
796 | 0 | sf->part_sf.ml_partition_search_breakout_thresh[4] = 0.8047585616503903f; |
797 | 0 | sf->part_sf.ml_partition_search_breakout_model_index = 1; |
798 | 55.6k | } else { |
799 | 55.6k | sf->part_sf.ml_partition_search_breakout_thresh[0] = -1.0f; |
800 | 55.6k | sf->part_sf.ml_partition_search_breakout_thresh[1] = 0.952574f; |
801 | 55.6k | sf->part_sf.ml_partition_search_breakout_thresh[2] = 0.952574f; |
802 | 55.6k | sf->part_sf.ml_partition_search_breakout_thresh[3] = 0.924142f; |
803 | 55.6k | sf->part_sf.ml_partition_search_breakout_thresh[4] = 0.880797f; |
804 | 55.6k | } |
805 | 55.6k | sf->part_sf.ml_early_term_after_part_split_level = 2; |
806 | | |
807 | 55.6k | sf->lpf_sf.cdef_pick_method = CDEF_FAST_SEARCH_LVL1; |
808 | 55.6k | } |
809 | | |
810 | 74.4k | if (speed >= 2) { |
811 | 55.6k | sf->part_sf.ml_4_partition_search_level_index = 2; |
812 | 55.6k | if (is_720p_or_larger) { |
813 | 0 | sf->part_sf.use_square_partition_only_threshold = BLOCK_64X64; |
814 | 55.6k | } else { |
815 | 55.6k | sf->part_sf.use_square_partition_only_threshold = BLOCK_32X32; |
816 | 55.6k | } |
817 | | |
818 | 55.6k | if (is_720p_or_larger) { |
819 | 0 | sf->part_sf.ml_partition_search_breakout_thresh[0] = 0.5f; |
820 | 0 | sf->part_sf.ml_partition_search_breakout_thresh[1] = 0.5042595622791082f; |
821 | 0 | sf->part_sf.ml_partition_search_breakout_thresh[2] = 0.5f; |
822 | 0 | sf->part_sf.ml_partition_search_breakout_thresh[3] = 0.8378425823517456f; |
823 | 0 | sf->part_sf.ml_partition_search_breakout_thresh[4] = 0.8047585616503903f; |
824 | 0 | sf->part_sf.ml_partition_search_breakout_model_index = 1; |
825 | 0 | } |
826 | | |
827 | 55.6k | if (is_720p_or_larger) { |
828 | 0 | sf->part_sf.partition_search_breakout_dist_thr = (1 << 24); |
829 | 0 | sf->part_sf.partition_search_breakout_rate_thr = 120; |
830 | 55.6k | } else { |
831 | 55.6k | sf->part_sf.partition_search_breakout_dist_thr = (1 << 22); |
832 | 55.6k | sf->part_sf.partition_search_breakout_rate_thr = 100; |
833 | 55.6k | } |
834 | | |
835 | 55.6k | if (is_720p_or_larger) { |
836 | 0 | sf->inter_sf.prune_obmc_prob_thresh = 16; |
837 | 55.6k | } else { |
838 | 55.6k | sf->inter_sf.prune_obmc_prob_thresh = 8; |
839 | 55.6k | } |
840 | | |
841 | 55.6k | if (is_480p_or_larger) { |
842 | 0 | sf->inter_sf.disable_interintra_wedge_var_thresh = 100; |
843 | 55.6k | } else { |
844 | 55.6k | sf->inter_sf.disable_interintra_wedge_var_thresh = UINT_MAX; |
845 | 55.6k | } |
846 | | |
847 | 55.6k | if (is_480p_or_lesser) sf->inter_sf.skip_ext_comp_nearmv_mode = 1; |
848 | | |
849 | 55.6k | if (is_720p_or_larger) { |
850 | 0 | sf->inter_sf.limit_inter_mode_cands = is_lf_frame ? 1 : 0; |
851 | 55.6k | } else { |
852 | 55.6k | sf->inter_sf.limit_inter_mode_cands = is_lf_frame ? 2 : 0; |
853 | 55.6k | } |
854 | | |
855 | 55.6k | sf->inter_sf.skip_cmp_using_top_cmp_avg_est_rd_lvl = 3; |
856 | | |
857 | 55.6k | if (is_480p_or_larger) { |
858 | 0 | sf->tx_sf.tx_type_search.prune_tx_type_using_stats = 1; |
859 | 0 | if (use_hbd) sf->tx_sf.prune_tx_size_level = 2; |
860 | 55.6k | } else { |
861 | 55.6k | if (use_hbd) sf->tx_sf.prune_tx_size_level = 3; |
862 | 55.6k | sf->tx_sf.tx_type_search.winner_mode_tx_type_pruning = boosted ? 0 : 1; |
863 | 55.6k | sf->winner_mode_sf.enable_winner_mode_for_tx_size_srch = boosted ? 0 : 1; |
864 | 55.6k | } |
865 | | |
866 | 55.6k | if (!is_720p_or_larger) { |
867 | 55.6k | sf->mv_sf.disable_second_mv = 1; |
868 | 55.6k | sf->mv_sf.auto_mv_step_size = 2; |
869 | 55.6k | } else { |
870 | 0 | sf->mv_sf.disable_second_mv = boosted ? 0 : 2; |
871 | 0 | sf->mv_sf.auto_mv_step_size = 1; |
872 | 0 | } |
873 | | |
874 | 55.6k | if (!is_720p_or_larger) { |
875 | 55.6k | sf->hl_sf.recode_tolerance = 50; |
876 | 55.6k | sf->inter_sf.disable_interinter_wedge_newmv_search = |
877 | 55.6k | is_boosted_arf2_bwd_type ? 0 : 1; |
878 | 55.6k | sf->inter_sf.enable_fast_wedge_mask_search = 1; |
879 | 55.6k | } |
880 | 55.6k | } |
881 | | |
882 | 74.4k | if (speed >= 3) { |
883 | 55.6k | sf->inter_sf.enable_fast_wedge_mask_search = 1; |
884 | 55.6k | sf->inter_sf.skip_newmv_in_drl = 2; |
885 | 55.6k | sf->inter_sf.skip_ext_comp_nearmv_mode = 1; |
886 | 55.6k | sf->inter_sf.limit_inter_mode_cands = is_lf_frame ? 3 : 0; |
887 | 55.6k | sf->inter_sf.disable_interinter_wedge_newmv_search = boosted ? 0 : 1; |
888 | 55.6k | sf->tx_sf.tx_type_search.winner_mode_tx_type_pruning = 1; |
889 | 55.6k | sf->winner_mode_sf.enable_winner_mode_for_tx_size_srch = |
890 | 55.6k | frame_is_intra_only(&cpi->common) ? 0 : 1; |
891 | | |
892 | 55.6k | sf->part_sf.ml_early_term_after_part_split_level = 0; |
893 | | |
894 | 55.6k | if (is_720p_or_larger) { |
895 | 0 | for (int i = 0; i < PARTITION_BLOCK_SIZES; ++i) { |
896 | 0 | sf->part_sf.ml_partition_search_breakout_thresh[i] = |
897 | 0 | -1; // -1 means not enabled. |
898 | 0 | } |
899 | 0 | sf->part_sf.ml_partition_search_breakout_model_index = 0; |
900 | 0 | } |
901 | | |
902 | 55.6k | sf->part_sf.ml_4_partition_search_level_index = 3; |
903 | | |
904 | 55.6k | if (is_720p_or_larger) { |
905 | 0 | sf->part_sf.partition_search_breakout_dist_thr = (1 << 25); |
906 | 0 | sf->part_sf.partition_search_breakout_rate_thr = 200; |
907 | 0 | sf->part_sf.skip_non_sq_part_based_on_none = is_lf_frame ? 2 : 0; |
908 | 55.6k | } else { |
909 | 55.6k | sf->part_sf.max_intra_bsize = BLOCK_32X32; |
910 | 55.6k | sf->part_sf.partition_search_breakout_dist_thr = (1 << 23); |
911 | 55.6k | sf->part_sf.partition_search_breakout_rate_thr = 120; |
912 | 55.6k | sf->part_sf.skip_non_sq_part_based_on_none = is_lf_frame ? 1 : 0; |
913 | 55.6k | } |
914 | 55.6k | if (use_hbd) sf->tx_sf.prune_tx_size_level = 3; |
915 | | |
916 | 55.6k | if (is_480p_or_larger) { |
917 | 0 | sf->part_sf.early_term_after_none_split = 1; |
918 | 55.6k | } else { |
919 | 55.6k | sf->part_sf.early_term_after_none_split = 0; |
920 | 55.6k | } |
921 | 55.6k | if (is_720p_or_larger) { |
922 | 0 | sf->intra_sf.skip_intra_in_interframe = boosted ? 1 : 2; |
923 | 55.6k | } else { |
924 | 55.6k | sf->intra_sf.skip_intra_in_interframe = boosted ? 1 : 3; |
925 | 55.6k | } |
926 | | |
927 | 55.6k | if (is_720p_or_larger) { |
928 | 0 | sf->inter_sf.disable_interinter_wedge_var_thresh = 100; |
929 | 0 | sf->inter_sf.skip_interinter_wedge_search_based_on_mse = 1; |
930 | 0 | sf->inter_sf.limit_txfm_eval_per_mode = boosted ? 0 : 1; |
931 | 55.6k | } else { |
932 | 55.6k | sf->inter_sf.disable_interinter_wedge_var_thresh = UINT_MAX; |
933 | 55.6k | sf->inter_sf.limit_txfm_eval_per_mode = boosted ? 0 : 2; |
934 | 55.6k | sf->lpf_sf.cdef_pick_method = CDEF_FAST_SEARCH_LVL2; |
935 | 55.6k | } |
936 | | |
937 | 55.6k | if (is_480p_or_lesser) { |
938 | 55.6k | sf->inter_sf.prune_comp_ref_frames = 0; |
939 | 55.6k | } else { |
940 | 0 | sf->inter_sf.prune_comp_ref_frames = 1; |
941 | 0 | } |
942 | | |
943 | 55.6k | sf->inter_sf.disable_interintra_wedge_var_thresh = UINT_MAX; |
944 | 55.6k | } |
945 | | |
946 | 74.4k | if (speed >= 4) { |
947 | 55.6k | sf->tx_sf.tx_type_search.winner_mode_tx_type_pruning = 2; |
948 | 55.6k | sf->winner_mode_sf.enable_winner_mode_for_tx_size_srch = 1; |
949 | 55.6k | if (is_720p_or_larger) { |
950 | 0 | sf->part_sf.partition_search_breakout_dist_thr = (1 << 26); |
951 | 55.6k | } else { |
952 | 55.6k | sf->part_sf.partition_search_breakout_dist_thr = (1 << 24); |
953 | 55.6k | } |
954 | 55.6k | sf->part_sf.early_term_after_none_split = 1; |
955 | | |
956 | 55.6k | if (is_480p_or_larger) { |
957 | 0 | sf->tx_sf.tx_type_search.prune_tx_type_using_stats = 2; |
958 | 55.6k | } else { |
959 | 55.6k | sf->mv_sf.skip_fullpel_search_using_startmv_refmv = boosted ? 0 : 1; |
960 | 55.6k | } |
961 | | |
962 | 55.6k | sf->inter_sf.disable_interinter_wedge_var_thresh = UINT_MAX; |
963 | 55.6k | sf->inter_sf.prune_obmc_prob_thresh = INT_MAX; |
964 | 55.6k | sf->inter_sf.limit_txfm_eval_per_mode = boosted ? 0 : 2; |
965 | 55.6k | if (is_480p_or_lesser) sf->inter_sf.skip_newmv_in_drl = 3; |
966 | | |
967 | 55.6k | if (is_720p_or_larger) { |
968 | 0 | sf->inter_sf.prune_comp_ref_frames = 2; |
969 | 55.6k | } else if (is_480p_or_larger) { |
970 | 0 | sf->inter_sf.prune_comp_ref_frames = is_boosted_arf2_bwd_type ? 0 : 2; |
971 | 0 | } |
972 | | |
973 | 55.6k | if (is_720p_or_larger) |
974 | 0 | sf->hl_sf.recode_tolerance = 32; |
975 | 55.6k | else |
976 | 55.6k | sf->hl_sf.recode_tolerance = 55; |
977 | | |
978 | 55.6k | sf->intra_sf.skip_intra_in_interframe = 4; |
979 | | |
980 | 55.6k | sf->lpf_sf.cdef_pick_method = CDEF_FAST_SEARCH_LVL3; |
981 | 55.6k | } |
982 | | |
983 | 74.4k | if (speed >= 5) { |
984 | 55.6k | if (is_720p_or_larger) { |
985 | 0 | sf->inter_sf.prune_warped_prob_thresh = 16; |
986 | 55.6k | } else if (is_480p_or_larger) { |
987 | 0 | sf->inter_sf.prune_warped_prob_thresh = 8; |
988 | 0 | } |
989 | 55.6k | if (is_720p_or_larger) sf->hl_sf.recode_tolerance = 40; |
990 | | |
991 | 55.6k | sf->inter_sf.skip_newmv_in_drl = 4; |
992 | 55.6k | sf->inter_sf.prune_comp_ref_frames = 2; |
993 | 55.6k | sf->mv_sf.skip_fullpel_search_using_startmv_refmv = boosted ? 0 : 1; |
994 | | |
995 | 55.6k | if (!is_720p_or_larger) { |
996 | 55.6k | sf->inter_sf.mv_cost_upd_level = INTERNAL_COST_UPD_SBROW_SET; |
997 | 55.6k | sf->inter_sf.prune_nearest_near_mv_using_refmv_weight = |
998 | 55.6k | (boosted || allow_screen_content_tools) ? 0 : 1; |
999 | 55.6k | sf->mv_sf.use_downsampled_sad = 1; |
1000 | 55.6k | } |
1001 | | |
1002 | 55.6k | if (!is_480p_or_larger) { |
1003 | 55.6k | sf->part_sf.partition_search_breakout_dist_thr = (1 << 26); |
1004 | 55.6k | } |
1005 | | |
1006 | 55.6k | if (is_480p_or_lesser) { |
1007 | 55.6k | sf->inter_sf.prune_nearmv_using_neighbors = PRUNE_NEARMV_LEVEL1; |
1008 | 55.6k | } else { |
1009 | 0 | sf->inter_sf.prune_nearmv_using_neighbors = PRUNE_NEARMV_LEVEL2; |
1010 | 0 | } |
1011 | | |
1012 | 55.6k | if (is_720p_or_larger) { |
1013 | 0 | sf->part_sf.ext_part_eval_based_on_cur_best = |
1014 | 0 | (allow_screen_content_tools || frame_is_intra_only(cm)) ? 0 : 1; |
1015 | 0 | sf->part_sf.auto_max_partition_based_on_simple_motion = NOT_IN_USE; |
1016 | 0 | } |
1017 | | |
1018 | 55.6k | if (is_480p_or_larger) { |
1019 | 0 | sf->tpl_sf.reduce_num_frames = 1; |
1020 | 0 | } |
1021 | 55.6k | } |
1022 | | |
1023 | 74.4k | if (speed >= 6) { |
1024 | 55.6k | sf->tx_sf.tx_type_search.winner_mode_tx_type_pruning = 4; |
1025 | 55.6k | sf->inter_sf.prune_nearmv_using_neighbors = PRUNE_NEARMV_LEVEL3; |
1026 | 55.6k | sf->inter_sf.prune_comp_ref_frames = 3; |
1027 | 55.6k | sf->inter_sf.prune_nearest_near_mv_using_refmv_weight = |
1028 | 55.6k | (boosted || allow_screen_content_tools) ? 0 : 1; |
1029 | 55.6k | sf->mv_sf.skip_fullpel_search_using_startmv_refmv = boosted ? 0 : 2; |
1030 | | |
1031 | 55.6k | if (is_480p_or_larger && !is_720p_or_larger) { |
1032 | 0 | sf->part_sf.auto_max_partition_based_on_simple_motion = DIRECT_PRED; |
1033 | 0 | } |
1034 | | |
1035 | 55.6k | if (is_480p_or_larger) { |
1036 | 0 | sf->hl_sf.allow_sub_blk_me_in_tf = 1; |
1037 | 0 | } |
1038 | | |
1039 | 55.6k | if (is_1080p_or_larger) { |
1040 | 0 | sf->part_sf.default_min_partition_size = BLOCK_8X8; |
1041 | 0 | } |
1042 | | |
1043 | 55.6k | if (is_720p_or_larger) { |
1044 | 0 | sf->inter_sf.disable_masked_comp = 1; |
1045 | 0 | } |
1046 | | |
1047 | 55.6k | if (!is_720p_or_larger) { |
1048 | 55.6k | sf->inter_sf.coeff_cost_upd_level = INTERNAL_COST_UPD_SBROW; |
1049 | 55.6k | sf->inter_sf.mode_cost_upd_level = INTERNAL_COST_UPD_SBROW; |
1050 | 55.6k | } |
1051 | | |
1052 | 55.6k | if (is_720p_or_larger) { |
1053 | 0 | sf->part_sf.use_square_partition_only_threshold = BLOCK_32X32; |
1054 | 0 | sf->part_sf.partition_search_breakout_dist_thr = (1 << 28); |
1055 | 55.6k | } else { |
1056 | 55.6k | sf->part_sf.use_square_partition_only_threshold = BLOCK_16X16; |
1057 | 55.6k | sf->part_sf.partition_search_breakout_dist_thr = (1 << 26); |
1058 | 55.6k | } |
1059 | | |
1060 | 55.6k | if (is_720p_or_larger) { |
1061 | 0 | sf->inter_sf.prune_ref_mv_idx_search = 2; |
1062 | 55.6k | } else { |
1063 | 55.6k | sf->inter_sf.prune_ref_mv_idx_search = 1; |
1064 | 55.6k | } |
1065 | | |
1066 | 55.6k | if (is_720p_or_larger) { |
1067 | 0 | sf->mv_sf.use_bsize_dependent_search_method = 1; |
1068 | 55.6k | } else { |
1069 | 55.6k | sf->mv_sf.use_bsize_dependent_search_method = 2; |
1070 | 55.6k | } |
1071 | | |
1072 | 55.6k | if (!is_720p_or_larger) { |
1073 | 55.6k | sf->tx_sf.tx_type_search.fast_inter_tx_type_prob_thresh = |
1074 | 55.6k | is_boosted_arf2_bwd_type ? 450 : 150; |
1075 | 55.6k | } |
1076 | | |
1077 | 55.6k | sf->lpf_sf.cdef_pick_method = CDEF_FAST_SEARCH_LVL4; |
1078 | | |
1079 | 55.6k | sf->hl_sf.recode_tolerance = 55; |
1080 | 55.6k | } |
1081 | | |
1082 | 74.4k | if (cpi->oxcf.enable_low_complexity_decode) |
1083 | 0 | set_good_speed_features_lc_dec_framesize_dependent(cpi, sf, speed); |
1084 | | |
1085 | 74.4k | if (cpi->oxcf.tune_cfg.tuning == AOM_TUNE_IQ || |
1086 | 74.4k | cpi->oxcf.tune_cfg.tuning == AOM_TUNE_SSIMULACRA2) { |
1087 | 0 | sf->intra_sf.skip_intra_in_interframe = 0; |
1088 | 0 | } |
1089 | 74.4k | } |
1090 | | |
1091 | | static void set_good_speed_features_framesize_independent( |
1092 | 91.8k | const AV1_COMP *const cpi, SPEED_FEATURES *const sf, int speed) { |
1093 | 91.8k | const AV1_COMMON *const cm = &cpi->common; |
1094 | 91.8k | const GF_GROUP *const gf_group = &cpi->ppi->gf_group; |
1095 | 91.8k | const int boosted = frame_is_boosted(cpi); |
1096 | 91.8k | const int is_boosted_arf2_bwd_type = |
1097 | 91.8k | boosted || gf_group->update_type[cpi->gf_frame_index] == INTNL_ARF_UPDATE; |
1098 | 91.8k | const int is_inter_frame = |
1099 | 91.8k | gf_group->frame_type[cpi->gf_frame_index] == INTER_FRAME; |
1100 | 91.8k | const int allow_screen_content_tools = |
1101 | 91.8k | cm->features.allow_screen_content_tools; |
1102 | 91.8k | const int use_hbd = cpi->oxcf.use_highbitdepth; |
1103 | 91.8k | if (!cpi->oxcf.tile_cfg.enable_large_scale_tile) { |
1104 | 91.8k | sf->hl_sf.high_precision_mv_usage = LAST_MV_DATA; |
1105 | 91.8k | } |
1106 | | |
1107 | | // Speed 0 for all speed features that give neutral coding performance change. |
1108 | 91.8k | sf->gm_sf.gm_search_type = boosted ? GM_REDUCED_REF_SEARCH_SKIP_L2_L3_ARF2 |
1109 | 91.8k | : GM_SEARCH_CLOSEST_REFS_ONLY; |
1110 | 91.8k | sf->gm_sf.prune_ref_frame_for_gm_search = boosted ? 0 : 1; |
1111 | 91.8k | sf->gm_sf.disable_gm_search_based_on_stats = 1; |
1112 | | |
1113 | 91.8k | sf->part_sf.ml_prune_partition = 1; |
1114 | 91.8k | sf->part_sf.prune_ext_partition_types_search_level = 1; |
1115 | 91.8k | sf->part_sf.prune_part4_search = 2; |
1116 | 91.8k | sf->part_sf.simple_motion_search_prune_rect = 1; |
1117 | 91.8k | sf->part_sf.ml_predict_breakout_level = use_hbd ? 1 : 3; |
1118 | 91.8k | sf->part_sf.reuse_prev_rd_results_for_part_ab = 1; |
1119 | 91.8k | sf->part_sf.use_best_rd_for_pruning = 1; |
1120 | 91.8k | sf->part_sf.simple_motion_search_prune_agg = |
1121 | 91.8k | allow_screen_content_tools ? NO_PRUNING : SIMPLE_AGG_LVL0; |
1122 | | |
1123 | 91.8k | sf->inter_sf.inter_mode_rd_model_estimation = |
1124 | 91.8k | cpi->oxcf.algo_cfg.sharpness ? 0 : 1; |
1125 | 91.8k | sf->inter_sf.model_based_post_interp_filter_breakout = 1; |
1126 | 91.8k | sf->inter_sf.prune_compound_using_single_ref = 1; |
1127 | 91.8k | sf->inter_sf.prune_mode_search_simple_translation = 1; |
1128 | 91.8k | sf->inter_sf.prune_ref_frame_for_rect_partitions = |
1129 | 91.8k | (boosted || (allow_screen_content_tools)) |
1130 | 91.8k | ? 0 |
1131 | 91.8k | : (is_boosted_arf2_bwd_type ? 1 : 2); |
1132 | 91.8k | sf->inter_sf.reduce_inter_modes = boosted ? 1 : 2; |
1133 | 91.8k | sf->inter_sf.selective_ref_frame = 1; |
1134 | 91.8k | sf->inter_sf.use_dist_wtd_comp_flag = DIST_WTD_COMP_SKIP_MV_SEARCH; |
1135 | 91.8k | sf->inter_sf.enable_fast_compound_mode_search = 1; |
1136 | | |
1137 | 91.8k | sf->interp_sf.use_fast_interpolation_filter_search = 1; |
1138 | 91.8k | sf->interp_sf.disable_dual_filter = 1; |
1139 | 91.8k | sf->interp_sf.use_more_sharp_interp = boosted ? 0 : 1; |
1140 | | |
1141 | 91.8k | sf->intra_sf.intra_pruning_with_hog = 1; |
1142 | | |
1143 | 91.8k | sf->tx_sf.adaptive_txb_search_level = 1; |
1144 | 91.8k | sf->tx_sf.intra_tx_size_search_init_depth_sqr = 1; |
1145 | 91.8k | sf->tx_sf.model_based_prune_tx_search_level = 1; |
1146 | 91.8k | sf->tx_sf.tx_type_search.use_reduced_intra_txset = 1; |
1147 | | |
1148 | 91.8k | sf->tpl_sf.search_method = NSTEP_8PT; |
1149 | | |
1150 | 91.8k | sf->rt_sf.use_nonrd_pick_mode = 0; |
1151 | 91.8k | sf->rt_sf.discount_color_cost = 0; |
1152 | 91.8k | sf->rt_sf.use_real_time_ref_set = 0; |
1153 | | |
1154 | 91.8k | if (cpi->twopass_frame.fr_content_type == FC_GRAPHICS_ANIMATION || |
1155 | 91.8k | cpi->use_screen_content_tools) { |
1156 | 25 | sf->mv_sf.exhaustive_searches_thresh = (1 << 20); |
1157 | 91.8k | } else { |
1158 | 91.8k | sf->mv_sf.exhaustive_searches_thresh = (1 << 25); |
1159 | 91.8k | } |
1160 | | |
1161 | 91.8k | sf->rd_sf.perform_coeff_opt = 1; |
1162 | 91.8k | sf->hl_sf.superres_auto_search_type = SUPERRES_AUTO_DUAL; |
1163 | | |
1164 | 91.8k | sf->lpf_sf.reduce_wiener_window_size = 1; |
1165 | | |
1166 | 91.8k | if (speed >= 1) { |
1167 | 72.9k | sf->hl_sf.adjust_num_frames_for_arf_filtering = |
1168 | 72.9k | allow_screen_content_tools ? 0 : 1; |
1169 | | |
1170 | 72.9k | sf->part_sf.intra_cnn_based_part_prune_level = |
1171 | 72.9k | allow_screen_content_tools ? 0 : 2; |
1172 | | |
1173 | 72.9k | sf->part_sf.simple_motion_search_prune_agg = |
1174 | 72.9k | allow_screen_content_tools ? NO_PRUNING : SIMPLE_AGG_LVL1; |
1175 | 72.9k | sf->part_sf.simple_motion_search_early_term_none = 1; |
1176 | | // TODO(Venkat): Clean-up frame type dependency for |
1177 | | // simple_motion_search_split in partition search function and set the |
1178 | | // speed feature accordingly |
1179 | 72.9k | sf->part_sf.simple_motion_search_split = allow_screen_content_tools ? 1 : 2; |
1180 | 72.9k | sf->part_sf.ml_predict_breakout_level = use_hbd ? 2 : 3; |
1181 | | |
1182 | 72.9k | sf->mv_sf.exhaustive_searches_thresh <<= 1; |
1183 | 72.9k | sf->mv_sf.obmc_full_pixel_search_level = 1; |
1184 | 72.9k | sf->mv_sf.use_accurate_subpel_search = USE_4_TAPS; |
1185 | 72.9k | sf->mv_sf.disable_extensive_joint_motion_search = 1; |
1186 | | |
1187 | 72.9k | sf->inter_sf.prune_comp_search_by_single_result = boosted ? 2 : 1; |
1188 | 72.9k | sf->inter_sf.prune_comp_type_by_comp_avg = 1; |
1189 | 72.9k | sf->inter_sf.prune_comp_type_by_model_rd = boosted ? 0 : 1; |
1190 | 72.9k | sf->inter_sf.prune_ref_frame_for_rect_partitions = |
1191 | 72.9k | (frame_is_intra_only(&cpi->common) || (allow_screen_content_tools)) |
1192 | 72.9k | ? 0 |
1193 | 72.9k | : (boosted ? 1 : 2); |
1194 | 72.9k | sf->inter_sf.reduce_inter_modes = boosted ? 1 : 3; |
1195 | 72.9k | sf->inter_sf.reuse_inter_intra_mode = 1; |
1196 | 72.9k | sf->inter_sf.selective_ref_frame = 2; |
1197 | 72.9k | sf->inter_sf.skip_arf_compound = 1; |
1198 | 72.9k | sf->inter_sf.prune_comp_using_best_single_mode_ref = 2; |
1199 | 72.9k | sf->inter_sf.use_dist_wtd_comp_flag = DIST_WTD_COMP_DISABLED; |
1200 | 72.9k | sf->inter_sf.prune_inter_modes_based_on_tpl = 1; |
1201 | | |
1202 | 72.9k | sf->interp_sf.use_interp_filter = 1; |
1203 | | |
1204 | 72.9k | sf->intra_sf.prune_palette_search_level = 1; |
1205 | | |
1206 | 72.9k | sf->tx_sf.adaptive_txb_search_level = 2; |
1207 | 72.9k | sf->tx_sf.inter_tx_size_search_init_depth_rect = 1; |
1208 | 72.9k | sf->tx_sf.inter_tx_size_search_init_depth_sqr = 1; |
1209 | 72.9k | sf->tx_sf.intra_tx_size_search_init_depth_rect = 1; |
1210 | 72.9k | sf->tx_sf.model_based_prune_tx_search_level = 0; |
1211 | 72.9k | sf->tx_sf.tx_type_search.ml_tx_split_thresh = 4000; |
1212 | 72.9k | sf->tx_sf.tx_type_search.prune_2d_txfm_mode = TX_TYPE_PRUNE_2; |
1213 | 72.9k | sf->tx_sf.tx_type_search.skip_tx_search = 1; |
1214 | 72.9k | sf->tx_sf.prune_inter_tx_split_rd_eval_lvl = 1; |
1215 | | |
1216 | 72.9k | sf->rd_sf.perform_coeff_opt = boosted ? 2 : 3; |
1217 | 72.9k | sf->rd_sf.tx_domain_dist_level = boosted ? 1 : 2; |
1218 | 72.9k | sf->rd_sf.tx_domain_dist_thres_level = 1; |
1219 | | |
1220 | 72.9k | sf->lpf_sf.dual_sgr_penalty_level = 1; |
1221 | 72.9k | sf->lpf_sf.enable_sgr_ep_pruning = 1; |
1222 | | |
1223 | | // TODO(any, yunqing): move this feature to speed 0. |
1224 | 72.9k | sf->tpl_sf.skip_alike_starting_mv = 1; |
1225 | 72.9k | } |
1226 | | |
1227 | 91.8k | if (speed >= 2) { |
1228 | 72.9k | sf->hl_sf.recode_loop = ALLOW_RECODE_KFARFGF; |
1229 | | |
1230 | 72.9k | sf->part_sf.simple_motion_search_prune_agg = |
1231 | 72.9k | allow_screen_content_tools ? NO_PRUNING : SIMPLE_AGG_LVL2; |
1232 | 72.9k | sf->fp_sf.skip_motion_search_threshold = 25; |
1233 | | |
1234 | 72.9k | sf->gm_sf.num_refinement_steps = 2; |
1235 | | |
1236 | 72.9k | sf->part_sf.reuse_best_prediction_for_part_ab = |
1237 | 72.9k | !frame_is_intra_only(&cpi->common); |
1238 | | |
1239 | 72.9k | sf->mv_sf.simple_motion_subpel_force_stop = QUARTER_PEL; |
1240 | 72.9k | sf->mv_sf.subpel_iters_per_step = 1; |
1241 | 72.9k | sf->mv_sf.reduce_search_range = 1; |
1242 | | |
1243 | | // TODO(chiyotsai@google.com): We can get 10% speed up if we move |
1244 | | // adaptive_rd_thresh to speed 1. But currently it performs poorly on some |
1245 | | // clips (e.g. 5% loss on dinner_1080p). We need to examine the sequence a |
1246 | | // bit more closely to figure out why. |
1247 | 72.9k | sf->inter_sf.adaptive_rd_thresh = 1; |
1248 | 72.9k | sf->inter_sf.disable_interinter_wedge_var_thresh = 100; |
1249 | 72.9k | sf->inter_sf.fast_interintra_wedge_search = 1; |
1250 | 72.9k | sf->inter_sf.prune_comp_search_by_single_result = boosted ? 4 : 1; |
1251 | 72.9k | sf->inter_sf.prune_ext_comp_using_neighbors = 1; |
1252 | 72.9k | sf->inter_sf.prune_comp_type_by_comp_avg = 2; |
1253 | 72.9k | sf->inter_sf.selective_ref_frame = 3; |
1254 | 72.9k | sf->inter_sf.reuse_mask_search_results = 1; |
1255 | 72.9k | set_txfm_rd_gate_level(sf->inter_sf.txfm_rd_gate_level, boosted ? 0 : 1); |
1256 | 72.9k | sf->inter_sf.inter_mode_txfm_breakout = boosted ? 0 : 1; |
1257 | 72.9k | sf->inter_sf.alt_ref_search_fp = 1; |
1258 | 72.9k | sf->inter_sf.prune_single_ref = boosted ? 1 : 2; |
1259 | | |
1260 | 72.9k | sf->interp_sf.adaptive_interp_filter_search = 1; |
1261 | | |
1262 | 72.9k | sf->intra_sf.intra_pruning_with_hog = 2; |
1263 | 72.9k | sf->intra_sf.skip_intra_in_interframe = is_inter_frame ? 2 : 1; |
1264 | 72.9k | sf->intra_sf.skip_filter_intra_in_inter_frames = 1; |
1265 | | |
1266 | 72.9k | sf->tpl_sf.prune_starting_mv = 1; |
1267 | 72.9k | sf->tpl_sf.search_method = DIAMOND; |
1268 | | |
1269 | 72.9k | sf->rd_sf.perform_coeff_opt = is_boosted_arf2_bwd_type ? 3 : 4; |
1270 | 72.9k | sf->rd_sf.use_mb_rd_hash = 1; |
1271 | | |
1272 | 72.9k | sf->lpf_sf.prune_wiener_based_on_src_var = 1; |
1273 | 72.9k | sf->lpf_sf.prune_sgr_based_on_wiener = 1; |
1274 | 72.9k | sf->lpf_sf.disable_loop_restoration_chroma = boosted ? 0 : 1; |
1275 | | |
1276 | | // TODO(any): Re-evaluate this feature set to 1 in speed 2. |
1277 | 72.9k | sf->tpl_sf.allow_compound_pred = 0; |
1278 | 72.9k | sf->tpl_sf.prune_ref_frames_in_tpl = 1; |
1279 | | |
1280 | 72.9k | sf->tx_sf.prune_inter_tx_split_rd_eval_lvl = 2; |
1281 | 72.9k | } |
1282 | | |
1283 | 91.8k | if (speed >= 3) { |
1284 | 72.9k | sf->hl_sf.high_precision_mv_usage = CURRENT_Q; |
1285 | 72.9k | sf->hl_sf.weight_calc_level_in_tf = 1; |
1286 | | |
1287 | 72.9k | sf->gm_sf.prune_ref_frame_for_gm_search = 1; |
1288 | 72.9k | sf->gm_sf.prune_zero_mv_with_sse = 1; |
1289 | 72.9k | sf->gm_sf.num_refinement_steps = 0; |
1290 | | |
1291 | 72.9k | sf->part_sf.simple_motion_search_prune_agg = |
1292 | 72.9k | allow_screen_content_tools |
1293 | 72.9k | ? SIMPLE_AGG_LVL0 |
1294 | 72.9k | : (boosted ? SIMPLE_AGG_LVL3 : QIDX_BASED_AGG_LVL1); |
1295 | 72.9k | sf->part_sf.prune_ext_part_using_split_info = 1; |
1296 | 72.9k | sf->part_sf.simple_motion_search_rect_split = 1; |
1297 | 72.9k | sf->part_sf.prune_h_or_v_4part_using_sms_info = true; |
1298 | | |
1299 | 72.9k | sf->mv_sf.subpel_search_method = SUBPEL_TREE_PRUNED; |
1300 | 72.9k | sf->mv_sf.search_method = DIAMOND; |
1301 | 72.9k | sf->mv_sf.disable_second_mv = 2; |
1302 | 72.9k | sf->mv_sf.prune_mesh_search = PRUNE_MESH_SEARCH_LVL_1; |
1303 | 72.9k | sf->mv_sf.use_intrabc = 0; |
1304 | | |
1305 | 72.9k | sf->inter_sf.disable_interinter_wedge_newmv_search = boosted ? 0 : 1; |
1306 | 72.9k | sf->inter_sf.mv_cost_upd_level = INTERNAL_COST_UPD_SBROW; |
1307 | 72.9k | sf->inter_sf.disable_onesided_comp = 1; |
1308 | 72.9k | sf->inter_sf.disable_interintra_wedge_var_thresh = UINT_MAX; |
1309 | | // TODO(any): Experiment with the early exit mechanism for speeds 0, 1 and 2 |
1310 | | // and clean-up the speed feature |
1311 | 72.9k | sf->inter_sf.perform_best_rd_based_gating_for_chroma = 1; |
1312 | 72.9k | sf->inter_sf.prune_inter_modes_based_on_tpl = boosted ? 1 : 2; |
1313 | 72.9k | sf->inter_sf.prune_comp_search_by_single_result = boosted ? 4 : 2; |
1314 | 72.9k | sf->inter_sf.selective_ref_frame = 5; |
1315 | 72.9k | sf->inter_sf.reuse_compound_type_decision = 1; |
1316 | 72.9k | set_txfm_rd_gate_level(sf->inter_sf.txfm_rd_gate_level, |
1317 | 72.9k | boosted ? 0 : (is_boosted_arf2_bwd_type ? 1 : 2)); |
1318 | 72.9k | sf->inter_sf.inter_mode_txfm_breakout = boosted ? 0 : 2; |
1319 | 72.9k | sf->inter_sf.prune_single_ref = 2; |
1320 | | |
1321 | 72.9k | sf->interp_sf.adaptive_interp_filter_search = 2; |
1322 | 72.9k | sf->interp_sf.skip_model_rd_uv = 1; |
1323 | | |
1324 | | // TODO(chiyotsai@google.com): the thresholds chosen for intra hog are |
1325 | | // inherited directly from luma hog with some minor tweaking. Eventually we |
1326 | | // should run this with a bayesian optimizer to find the Pareto frontier. |
1327 | 72.9k | sf->intra_sf.chroma_intra_pruning_with_hog = 2; |
1328 | 72.9k | sf->intra_sf.intra_pruning_with_hog = 3; |
1329 | 72.9k | sf->intra_sf.prune_palette_search_level = 2; |
1330 | 72.9k | sf->intra_sf.top_intra_model_count_allowed = 2; |
1331 | | |
1332 | 72.9k | sf->tpl_sf.prune_starting_mv = 2; |
1333 | 72.9k | sf->tpl_sf.skip_alike_starting_mv = 2; |
1334 | 72.9k | sf->tpl_sf.prune_intra_modes = 1; |
1335 | 72.9k | sf->tpl_sf.reduce_first_step_size = 6; |
1336 | 72.9k | sf->tpl_sf.subpel_force_stop = QUARTER_PEL; |
1337 | | |
1338 | 72.9k | sf->tx_sf.adaptive_txb_search_level = boosted ? 2 : 3; |
1339 | 72.9k | sf->tx_sf.tx_type_search.use_skip_flag_prediction = 2; |
1340 | 72.9k | sf->tx_sf.tx_type_search.prune_2d_txfm_mode = TX_TYPE_PRUNE_3; |
1341 | | |
1342 | | // TODO(any): Refactor the code related to following winner mode speed |
1343 | | // features |
1344 | 72.9k | sf->winner_mode_sf.enable_winner_mode_for_coeff_opt = 1; |
1345 | 72.9k | sf->winner_mode_sf.enable_winner_mode_for_use_tx_domain_dist = 1; |
1346 | 72.9k | sf->winner_mode_sf.motion_mode_for_winner_cand = |
1347 | 72.9k | boosted ? 0 |
1348 | 72.9k | : gf_group->update_type[cpi->gf_frame_index] == INTNL_ARF_UPDATE ? 1 |
1349 | 23.7k | : 2; |
1350 | 72.9k | sf->winner_mode_sf.prune_winner_mode_eval_level = boosted ? 0 : 4; |
1351 | | |
1352 | | // For screen content, "prune_sgr_based_on_wiener = 2" cause large quality |
1353 | | // loss. |
1354 | 72.9k | sf->lpf_sf.prune_sgr_based_on_wiener = allow_screen_content_tools ? 1 : 2; |
1355 | 72.9k | sf->lpf_sf.prune_wiener_based_on_src_var = 2; |
1356 | 72.9k | sf->lpf_sf.use_coarse_filter_level_search = |
1357 | 72.9k | frame_is_intra_only(&cpi->common) ? 0 : 1; |
1358 | 72.9k | sf->lpf_sf.use_downsampled_wiener_stats = 1; |
1359 | 72.9k | } |
1360 | | |
1361 | 91.8k | if (speed >= 4) { |
1362 | 72.9k | sf->mv_sf.subpel_search_method = SUBPEL_TREE_PRUNED_MORE; |
1363 | | |
1364 | 72.9k | sf->gm_sf.prune_zero_mv_with_sse = 2; |
1365 | 72.9k | sf->gm_sf.downsample_level = 1; |
1366 | | |
1367 | 72.9k | sf->part_sf.simple_motion_search_prune_agg = |
1368 | 72.9k | allow_screen_content_tools ? SIMPLE_AGG_LVL0 : SIMPLE_AGG_LVL4; |
1369 | 72.9k | sf->part_sf.simple_motion_search_reduce_search_steps = 4; |
1370 | 72.9k | sf->part_sf.prune_ext_part_using_split_info = 2; |
1371 | 72.9k | sf->part_sf.ml_predict_breakout_level = 3; |
1372 | 72.9k | sf->part_sf.prune_rectangular_split_based_on_qidx = |
1373 | 72.9k | (allow_screen_content_tools || frame_is_intra_only(&cpi->common)) ? 0 |
1374 | 72.9k | : 1; |
1375 | | |
1376 | 72.9k | sf->inter_sf.alt_ref_search_fp = 2; |
1377 | 72.9k | sf->inter_sf.txfm_rd_gate_level[TX_SEARCH_DEFAULT] = boosted ? 0 : 3; |
1378 | 72.9k | sf->inter_sf.txfm_rd_gate_level[TX_SEARCH_MOTION_MODE] = boosted ? 0 : 5; |
1379 | 72.9k | sf->inter_sf.txfm_rd_gate_level[TX_SEARCH_COMP_TYPE_MODE] = boosted ? 0 : 3; |
1380 | | |
1381 | 72.9k | sf->inter_sf.prune_inter_modes_based_on_tpl = boosted ? 1 : 3; |
1382 | 72.9k | sf->inter_sf.prune_ext_comp_using_neighbors = 2; |
1383 | 72.9k | sf->inter_sf.prune_obmc_prob_thresh = INT_MAX; |
1384 | 72.9k | sf->inter_sf.disable_interinter_wedge_var_thresh = UINT_MAX; |
1385 | | |
1386 | 72.9k | sf->interp_sf.cb_pred_filter_search = 1; |
1387 | 72.9k | sf->interp_sf.skip_sharp_interp_filter_search = 1; |
1388 | 72.9k | sf->interp_sf.use_interp_filter = 2; |
1389 | 72.9k | sf->interp_sf.use_more_sharp_interp = 0; |
1390 | | |
1391 | 72.9k | sf->intra_sf.intra_uv_mode_mask[TX_16X16] = UV_INTRA_DC_H_V_CFL; |
1392 | 72.9k | sf->intra_sf.intra_uv_mode_mask[TX_32X32] = UV_INTRA_DC_H_V_CFL; |
1393 | 72.9k | sf->intra_sf.intra_uv_mode_mask[TX_64X64] = UV_INTRA_DC_H_V_CFL; |
1394 | | // TODO(any): "intra_y_mode_mask" doesn't help much at speed 4. |
1395 | | // sf->intra_sf.intra_y_mode_mask[TX_16X16] = INTRA_DC_H_V; |
1396 | | // sf->intra_sf.intra_y_mode_mask[TX_32X32] = INTRA_DC_H_V; |
1397 | | // sf->intra_sf.intra_y_mode_mask[TX_64X64] = INTRA_DC_H_V; |
1398 | 72.9k | sf->intra_sf.skip_intra_in_interframe = 4; |
1399 | | |
1400 | 72.9k | sf->mv_sf.simple_motion_subpel_force_stop = HALF_PEL; |
1401 | 72.9k | sf->mv_sf.prune_mesh_search = PRUNE_MESH_SEARCH_LVL_2; |
1402 | | |
1403 | 72.9k | sf->tpl_sf.subpel_force_stop = HALF_PEL; |
1404 | 72.9k | sf->tpl_sf.search_method = FAST_BIGDIA; |
1405 | 72.9k | sf->tpl_sf.use_sad_for_mode_decision = 1; |
1406 | | |
1407 | 72.9k | sf->tx_sf.tx_type_search.fast_intra_tx_type_search = 1; |
1408 | | |
1409 | 72.9k | sf->rd_sf.perform_coeff_opt = is_boosted_arf2_bwd_type ? 5 : 7; |
1410 | | |
1411 | | // TODO(any): Extend multi-winner mode processing support for inter frames |
1412 | 72.9k | sf->winner_mode_sf.multi_winner_mode_type = |
1413 | 72.9k | frame_is_intra_only(&cpi->common) ? MULTI_WINNER_MODE_DEFAULT |
1414 | 72.9k | : MULTI_WINNER_MODE_OFF; |
1415 | 72.9k | sf->winner_mode_sf.dc_blk_pred_level = boosted ? 0 : 2; |
1416 | | |
1417 | 72.9k | sf->lpf_sf.lpf_pick = LPF_PICK_FROM_FULL_IMAGE_NON_DUAL; |
1418 | 72.9k | } |
1419 | | |
1420 | 91.8k | if (speed >= 5) { |
1421 | 72.9k | sf->hl_sf.adjust_num_frames_for_arf_filtering = |
1422 | 72.9k | allow_screen_content_tools ? 0 : 2; |
1423 | | |
1424 | 72.9k | sf->fp_sf.reduce_mv_step_param = 4; |
1425 | | |
1426 | 72.9k | sf->part_sf.simple_motion_search_prune_agg = |
1427 | 72.9k | allow_screen_content_tools ? SIMPLE_AGG_LVL0 : SIMPLE_AGG_LVL5; |
1428 | 72.9k | sf->part_sf.ext_partition_eval_thresh = |
1429 | 72.9k | allow_screen_content_tools ? BLOCK_8X8 : BLOCK_16X16; |
1430 | 72.9k | sf->part_sf.prune_sub_8x8_partition_level = |
1431 | 72.9k | allow_screen_content_tools ? 1 : 2; |
1432 | | |
1433 | 72.9k | sf->mv_sf.warp_search_method = WARP_SEARCH_DIAMOND; |
1434 | | |
1435 | 72.9k | sf->inter_sf.prune_inter_modes_if_skippable = 1; |
1436 | 72.9k | sf->inter_sf.prune_single_ref = is_boosted_arf2_bwd_type ? 0 : 3; |
1437 | 72.9k | sf->inter_sf.txfm_rd_gate_level[TX_SEARCH_DEFAULT] = boosted ? 0 : 4; |
1438 | 72.9k | sf->inter_sf.txfm_rd_gate_level[TX_SEARCH_COMP_TYPE_MODE] = boosted ? 0 : 5; |
1439 | 72.9k | sf->inter_sf.enable_fast_compound_mode_search = 2; |
1440 | | |
1441 | 72.9k | sf->interp_sf.skip_interp_filter_search = boosted ? 0 : 1; |
1442 | | |
1443 | 72.9k | sf->intra_sf.chroma_intra_pruning_with_hog = 3; |
1444 | 72.9k | sf->intra_sf.disable_smooth_intra = 1; |
1445 | | |
1446 | | // TODO(any): Extend multi-winner mode processing support for inter frames |
1447 | 72.9k | sf->winner_mode_sf.multi_winner_mode_type = |
1448 | 72.9k | frame_is_intra_only(&cpi->common) ? MULTI_WINNER_MODE_FAST |
1449 | 72.9k | : MULTI_WINNER_MODE_OFF; |
1450 | | |
1451 | | // Disable Self-guided Loop restoration filter. |
1452 | 72.9k | sf->lpf_sf.enable_sgr_ep_pruning = 2; |
1453 | 72.9k | sf->lpf_sf.disable_wiener_coeff_refine_search = true; |
1454 | | |
1455 | 72.9k | sf->tpl_sf.prune_starting_mv = 3; |
1456 | 72.9k | sf->tpl_sf.use_y_only_rate_distortion = 1; |
1457 | 72.9k | sf->tpl_sf.subpel_force_stop = FULL_PEL; |
1458 | 72.9k | sf->tpl_sf.gop_length_decision_method = 2; |
1459 | 72.9k | sf->tpl_sf.use_sad_for_mode_decision = 2; |
1460 | | |
1461 | 72.9k | sf->winner_mode_sf.dc_blk_pred_level = 2; |
1462 | | |
1463 | 72.9k | sf->fp_sf.disable_recon = 1; |
1464 | 72.9k | } |
1465 | | |
1466 | 91.8k | if (speed >= 6) { |
1467 | 72.9k | sf->hl_sf.disable_extra_sc_testing = 1; |
1468 | 72.9k | sf->hl_sf.second_alt_ref_filtering = 0; |
1469 | | |
1470 | 72.9k | sf->gm_sf.downsample_level = 2; |
1471 | | |
1472 | 72.9k | sf->inter_sf.prune_inter_modes_based_on_tpl = boosted ? 1 : 4; |
1473 | 72.9k | sf->inter_sf.selective_ref_frame = 6; |
1474 | 72.9k | sf->inter_sf.prune_single_ref = is_boosted_arf2_bwd_type ? 0 : 4; |
1475 | 72.9k | sf->inter_sf.prune_ext_comp_using_neighbors = 3; |
1476 | | |
1477 | 72.9k | sf->intra_sf.chroma_intra_pruning_with_hog = 4; |
1478 | 72.9k | sf->intra_sf.intra_pruning_with_hog = 4; |
1479 | 72.9k | sf->intra_sf.intra_uv_mode_mask[TX_32X32] = UV_INTRA_DC; |
1480 | 72.9k | sf->intra_sf.intra_uv_mode_mask[TX_64X64] = UV_INTRA_DC; |
1481 | 72.9k | sf->intra_sf.intra_y_mode_mask[TX_32X32] = INTRA_DC; |
1482 | 72.9k | sf->intra_sf.intra_y_mode_mask[TX_64X64] = INTRA_DC; |
1483 | 72.9k | sf->intra_sf.early_term_chroma_palette_size_search = 1; |
1484 | | |
1485 | 72.9k | sf->part_sf.prune_rectangular_split_based_on_qidx = |
1486 | 72.9k | boosted || allow_screen_content_tools ? 0 : 2; |
1487 | | |
1488 | 72.9k | sf->part_sf.prune_part4_search = 3; |
1489 | | |
1490 | 72.9k | sf->mv_sf.simple_motion_subpel_force_stop = FULL_PEL; |
1491 | | |
1492 | 72.9k | sf->tpl_sf.gop_length_decision_method = 3; |
1493 | | |
1494 | 72.9k | sf->rd_sf.perform_coeff_opt = is_boosted_arf2_bwd_type ? 6 : 8; |
1495 | | |
1496 | 72.9k | sf->winner_mode_sf.dc_blk_pred_level = 3; |
1497 | 72.9k | sf->winner_mode_sf.multi_winner_mode_type = MULTI_WINNER_MODE_OFF; |
1498 | | |
1499 | 72.9k | sf->fp_sf.skip_zeromv_motion_search = 1; |
1500 | 72.9k | } |
1501 | | |
1502 | 91.8k | if (cpi->oxcf.enable_low_complexity_decode) |
1503 | 0 | set_good_speed_features_lc_dec_framesize_independent(cpi, sf, speed); |
1504 | | |
1505 | 91.8k | if (cpi->oxcf.algo_cfg.sharpness == 3) { |
1506 | 0 | sf->tx_sf.adaptive_txb_search_level = 0; |
1507 | 0 | sf->tx_sf.tx_type_search.use_skip_flag_prediction = 0; |
1508 | 0 | } |
1509 | | |
1510 | | // Set speed features for the IQ and SSIMULACRA2 tuning modes |
1511 | | // Layered image encoding has different requirements than regular video |
1512 | | // coding. |
1513 | | // Mainly, most of these speed features undo an implicit assumption that |
1514 | | // keyframes are encoded at a better quality than inter-coded frames. |
1515 | | // This means the encoder needs to be more thorough at considering and |
1516 | | // performing RDO on intra block candidates vs. inter block candidates for |
1517 | | // the best compression efficiency. |
1518 | | // Finally, enabling certain coding tools are beneficial for layered image |
1519 | | // encoding in general. |
1520 | 91.8k | if (cpi->oxcf.tune_cfg.tuning == AOM_TUNE_IQ || |
1521 | 91.8k | cpi->oxcf.tune_cfg.tuning == AOM_TUNE_SSIMULACRA2) { |
1522 | 0 | sf->intra_sf.skip_intra_in_interframe = 0; |
1523 | 0 | sf->inter_sf.inter_mode_rd_model_estimation = 0; |
1524 | 0 | sf->mv_sf.use_intrabc = 1; |
1525 | | |
1526 | | // Don't prune intra candidates too aggressively, as it can cause more |
1527 | | // expensive inter candidates to be chosen instead |
1528 | 0 | if (sf->intra_sf.intra_pruning_with_hog > 3) { |
1529 | 0 | sf->intra_sf.intra_pruning_with_hog = 3; |
1530 | 0 | } |
1531 | 0 | if (sf->intra_sf.chroma_intra_pruning_with_hog > 3) { |
1532 | 0 | sf->intra_sf.chroma_intra_pruning_with_hog = 3; |
1533 | 0 | } |
1534 | 0 | } |
1535 | 91.8k | } |
1536 | | |
1537 | | static void set_rt_speed_feature_framesize_dependent(const AV1_COMP *const cpi, |
1538 | | SPEED_FEATURES *const sf, |
1539 | 34.7k | int speed) { |
1540 | 34.7k | const AV1_COMMON *const cm = &cpi->common; |
1541 | 34.7k | const int boosted = frame_is_boosted(cpi); |
1542 | 34.7k | const int is_1080p_or_larger = AOMMIN(cm->width, cm->height) >= 1080; |
1543 | 34.7k | const int is_720p_or_larger = AOMMIN(cm->width, cm->height) >= 720; |
1544 | 34.7k | const int is_480p_or_larger = AOMMIN(cm->width, cm->height) >= 480; |
1545 | 34.7k | const int is_360p_or_larger = AOMMIN(cm->width, cm->height) >= 360; |
1546 | | |
1547 | 34.7k | if (!is_360p_or_larger) { |
1548 | 34.7k | sf->rt_sf.prune_intra_mode_based_on_mv_range = 1; |
1549 | 34.7k | sf->rt_sf.prune_inter_modes_wrt_gf_arf_based_on_sad = 1; |
1550 | 34.7k | if (speed >= 6) |
1551 | 27.7k | sf->winner_mode_sf.prune_winner_mode_eval_level = boosted ? 0 : 2; |
1552 | 34.7k | if (speed == 7) sf->rt_sf.prefer_large_partition_blocks = 2; |
1553 | 34.7k | if (speed >= 7) { |
1554 | 27.7k | sf->lpf_sf.cdef_pick_method = CDEF_PICK_FROM_Q; |
1555 | 27.7k | sf->rt_sf.check_only_zero_zeromv_on_large_blocks = true; |
1556 | 27.7k | sf->rt_sf.use_rtc_tf = 2; |
1557 | 27.7k | } |
1558 | 34.7k | if (speed == 8) sf->rt_sf.prefer_large_partition_blocks = 1; |
1559 | 34.7k | if (speed >= 8) { |
1560 | 18.5k | sf->rt_sf.use_nonrd_filter_search = 1; |
1561 | 18.5k | sf->rt_sf.tx_size_level_based_on_qstep = 1; |
1562 | 18.5k | } |
1563 | 34.7k | if (speed >= 9) { |
1564 | 11.5k | sf->rt_sf.use_comp_ref_nonrd = 0; |
1565 | 11.5k | sf->rt_sf.nonrd_aggressive_skip = 1; |
1566 | 11.5k | sf->rt_sf.skip_intra_pred = 1; |
1567 | | // Only turn on enable_ref_short_signaling for low resolution when only |
1568 | | // LAST and GOLDEN ref frames are used. |
1569 | 11.5k | sf->rt_sf.enable_ref_short_signaling = |
1570 | 11.5k | (!sf->rt_sf.use_nonrd_altref_frame && |
1571 | 11.5k | (!sf->rt_sf.use_comp_ref_nonrd || |
1572 | 0 | (!sf->rt_sf.ref_frame_comp_nonrd[1] && |
1573 | 0 | !sf->rt_sf.ref_frame_comp_nonrd[2]))); |
1574 | | |
1575 | | // TODO(kyslov) Re-enable when AV1 models are trained |
1576 | | #if 0 |
1577 | | #if CONFIG_RT_ML_PARTITIONING |
1578 | | if (!frame_is_intra_only(cm)) { |
1579 | | sf->part_sf.partition_search_type = ML_BASED_PARTITION; |
1580 | | sf->rt_sf.reuse_inter_pred_nonrd = 0; |
1581 | | } |
1582 | | #endif |
1583 | | #endif |
1584 | 11.5k | sf->rt_sf.use_adaptive_subpel_search = false; |
1585 | 11.5k | } |
1586 | 34.7k | if (speed >= 10) { |
1587 | | // TODO(yunqingwang@google.com): To be conservative, disable |
1588 | | // sf->rt_sf.estimate_motion_for_var_based_partition = 3 for speed 10/qvga |
1589 | | // for now. May enable it in the future. |
1590 | 0 | sf->rt_sf.estimate_motion_for_var_based_partition = 0; |
1591 | 0 | sf->rt_sf.skip_intra_pred = 2; |
1592 | 0 | sf->rt_sf.hybrid_intra_pickmode = 3; |
1593 | 0 | sf->rt_sf.reduce_mv_pel_precision_lowcomplex = 1; |
1594 | 0 | sf->rt_sf.reduce_mv_pel_precision_highmotion = 2; |
1595 | 0 | sf->rt_sf.use_nonrd_filter_search = 0; |
1596 | 0 | } |
1597 | 34.7k | } else { |
1598 | 0 | sf->rt_sf.prune_intra_mode_based_on_mv_range = 2; |
1599 | 0 | sf->intra_sf.skip_filter_intra_in_inter_frames = 1; |
1600 | 0 | if (speed <= 5) { |
1601 | 0 | sf->tx_sf.tx_type_search.fast_inter_tx_type_prob_thresh = |
1602 | 0 | boosted ? INT_MAX : 350; |
1603 | 0 | sf->winner_mode_sf.prune_winner_mode_eval_level = boosted ? 0 : 2; |
1604 | 0 | } |
1605 | 0 | if (speed == 6) sf->part_sf.disable_8x8_part_based_on_qidx = 1; |
1606 | 0 | if (speed >= 6) sf->rt_sf.skip_newmv_mode_based_on_sse = 2; |
1607 | 0 | if (speed == 7) { |
1608 | 0 | sf->rt_sf.prefer_large_partition_blocks = 1; |
1609 | | // Enable this feature for [360p, 720p] resolution range initially. |
1610 | | // Only enable for low bitdepth to mitigate issue: b/303023614. |
1611 | 0 | if (!cpi->rc.rtc_external_ratectrl && |
1612 | 0 | AOMMIN(cm->width, cm->height) <= 720 && !cpi->oxcf.use_highbitdepth) |
1613 | 0 | sf->hl_sf.accurate_bit_estimate = cpi->oxcf.q_cfg.aq_mode == NO_AQ; |
1614 | 0 | } |
1615 | 0 | if (speed >= 7) { |
1616 | 0 | sf->rt_sf.use_rtc_tf = 1; |
1617 | 0 | } |
1618 | 0 | if (speed == 8 && !cpi->ppi->use_svc) { |
1619 | 0 | sf->rt_sf.short_circuit_low_temp_var = 0; |
1620 | 0 | sf->rt_sf.use_nonrd_altref_frame = 1; |
1621 | 0 | } |
1622 | 0 | if (speed >= 8) sf->rt_sf.tx_size_level_based_on_qstep = 2; |
1623 | 0 | if (speed >= 9) { |
1624 | 0 | sf->rt_sf.gf_length_lvl = 1; |
1625 | 0 | sf->rt_sf.skip_cdef_sb = 1; |
1626 | 0 | sf->rt_sf.sad_based_adp_altref_lag = 2; |
1627 | 0 | sf->rt_sf.reduce_mv_pel_precision_highmotion = 2; |
1628 | 0 | sf->rt_sf.use_adaptive_subpel_search = true; |
1629 | 0 | sf->interp_sf.cb_pred_filter_search = 1; |
1630 | 0 | } |
1631 | 0 | if (speed >= 10) { |
1632 | 0 | sf->rt_sf.hybrid_intra_pickmode = 2; |
1633 | 0 | sf->rt_sf.sad_based_adp_altref_lag = 4; |
1634 | 0 | sf->rt_sf.tx_size_level_based_on_qstep = 0; |
1635 | 0 | sf->rt_sf.reduce_mv_pel_precision_highmotion = 3; |
1636 | 0 | sf->rt_sf.use_adaptive_subpel_search = false; |
1637 | 0 | sf->interp_sf.cb_pred_filter_search = 2; |
1638 | 0 | } |
1639 | 0 | } |
1640 | 34.7k | if (!is_480p_or_larger) { |
1641 | 34.7k | if (speed == 7) { |
1642 | 9.19k | sf->rt_sf.nonrd_check_partition_merge_mode = 2; |
1643 | 9.19k | } |
1644 | 34.7k | } |
1645 | 34.7k | if (!is_720p_or_larger) { |
1646 | 34.7k | if (speed >= 9) { |
1647 | 11.5k | sf->rt_sf.force_large_partition_blocks_intra = 1; |
1648 | 11.5k | } |
1649 | 34.7k | } else { |
1650 | 0 | if (speed >= 6) sf->rt_sf.skip_newmv_mode_based_on_sse = 3; |
1651 | 0 | if (speed == 7) sf->rt_sf.prefer_large_partition_blocks = 0; |
1652 | 0 | if (speed >= 7) { |
1653 | 0 | sf->rt_sf.reduce_mv_pel_precision_lowcomplex = 2; |
1654 | 0 | sf->rt_sf.reduce_mv_pel_precision_highmotion = 1; |
1655 | 0 | } |
1656 | 0 | if (speed >= 9) { |
1657 | 0 | sf->rt_sf.sad_based_adp_altref_lag = 1; |
1658 | 0 | sf->rt_sf.reduce_mv_pel_precision_lowcomplex = 0; |
1659 | 0 | sf->rt_sf.reduce_mv_pel_precision_highmotion = 2; |
1660 | 0 | } |
1661 | 0 | if (speed >= 10) { |
1662 | 0 | sf->rt_sf.sad_based_adp_altref_lag = 3; |
1663 | 0 | sf->rt_sf.reduce_mv_pel_precision_highmotion = 3; |
1664 | 0 | } |
1665 | 0 | } |
1666 | | // TODO(Any): Check/Tune settings of other sfs for 1080p. |
1667 | 34.7k | if (is_1080p_or_larger) { |
1668 | 0 | if (speed >= 7) { |
1669 | 0 | sf->rt_sf.reduce_mv_pel_precision_highmotion = 0; |
1670 | 0 | sf->rt_sf.use_adaptive_subpel_search = 0; |
1671 | 0 | } |
1672 | 0 | if (speed >= 9) sf->interp_sf.cb_pred_filter_search = 0; |
1673 | 34.7k | } else { |
1674 | 34.7k | if (speed >= 9) sf->lpf_sf.cdef_pick_method = CDEF_PICK_FROM_Q; |
1675 | 34.7k | if (speed >= 10) sf->rt_sf.nonrd_aggressive_skip = 1; |
1676 | 34.7k | } |
1677 | | // TODO(marpan): Tune settings for speed 11 video mode, |
1678 | 34.7k | if (speed >= 11 && cpi->oxcf.tune_cfg.content != AOM_CONTENT_SCREEN) { |
1679 | 0 | sf->rt_sf.skip_cdef_sb = 1; |
1680 | 0 | sf->rt_sf.force_only_last_ref = 1; |
1681 | 0 | sf->rt_sf.selective_cdf_update = 1; |
1682 | 0 | sf->rt_sf.use_nonrd_filter_search = 0; |
1683 | 0 | if (is_360p_or_larger) { |
1684 | 0 | sf->part_sf.fixed_partition_size = BLOCK_32X32; |
1685 | 0 | sf->rt_sf.use_fast_fixed_part = 1; |
1686 | 0 | sf->rt_sf.reduce_mv_pel_precision_lowcomplex = 2; |
1687 | 0 | } |
1688 | 0 | sf->rt_sf.increase_source_sad_thresh = 1; |
1689 | 0 | sf->rt_sf.part_early_exit_zeromv = 2; |
1690 | 0 | sf->rt_sf.set_zeromv_skip_based_on_source_sad = 2; |
1691 | 0 | for (int i = 0; i < BLOCK_SIZES; ++i) { |
1692 | 0 | sf->rt_sf.intra_y_mode_bsize_mask_nrd[i] = INTRA_DC; |
1693 | 0 | } |
1694 | 0 | sf->rt_sf.hybrid_intra_pickmode = 0; |
1695 | 0 | } |
1696 | | // Setting for SVC, or when the ref_frame_config control is |
1697 | | // used to set the reference structure. |
1698 | 34.7k | if (cpi->ppi->use_svc || cpi->ppi->rtc_ref.set_ref_frame_config) { |
1699 | 0 | const RTC_REF *const rtc_ref = &cpi->ppi->rtc_ref; |
1700 | | // For SVC: for greater than 2 temporal layers, use better mv search on |
1701 | | // base temporal layers, and only on base spatial layer if highest |
1702 | | // resolution is above 640x360. |
1703 | 0 | if (cpi->svc.number_temporal_layers >= 2 && |
1704 | 0 | cpi->svc.temporal_layer_id == 0 && |
1705 | 0 | (cpi->svc.spatial_layer_id == 0 || |
1706 | 0 | cpi->oxcf.frm_dim_cfg.width * cpi->oxcf.frm_dim_cfg.height <= |
1707 | 0 | 640 * 360)) { |
1708 | 0 | sf->mv_sf.search_method = NSTEP; |
1709 | 0 | sf->mv_sf.subpel_search_method = SUBPEL_TREE_PRUNED; |
1710 | 0 | sf->rt_sf.fullpel_search_step_param = 10; |
1711 | 0 | sf->rt_sf.reduce_mv_pel_precision_highmotion = 0; |
1712 | 0 | if (cm->width * cm->height <= 352 * 288) |
1713 | 0 | sf->rt_sf.nonrd_prune_ref_frame_search = 2; |
1714 | 0 | sf->rt_sf.force_large_partition_blocks_intra = 0; |
1715 | 0 | } |
1716 | 0 | if (speed >= 8) { |
1717 | 0 | if (cpi->svc.number_temporal_layers > 2) |
1718 | 0 | sf->rt_sf.disable_cdf_update_non_reference_frame = true; |
1719 | 0 | sf->rt_sf.reduce_mv_pel_precision_highmotion = 3; |
1720 | 0 | if (rtc_ref->non_reference_frame) { |
1721 | 0 | sf->rt_sf.nonrd_aggressive_skip = 1; |
1722 | 0 | sf->mv_sf.subpel_search_method = SUBPEL_TREE_PRUNED_MORE; |
1723 | 0 | } |
1724 | 0 | } |
1725 | 0 | if (speed <= 9 && cpi->svc.number_temporal_layers > 2 && |
1726 | 0 | cpi->svc.temporal_layer_id == 0) |
1727 | 0 | sf->rt_sf.check_only_zero_zeromv_on_large_blocks = false; |
1728 | 0 | else |
1729 | 0 | sf->rt_sf.check_only_zero_zeromv_on_large_blocks = true; |
1730 | 0 | sf->rt_sf.frame_level_mode_cost_update = false; |
1731 | | |
1732 | | // Compound mode enabling. |
1733 | 0 | if (rtc_ref->ref_frame_comp[0] || rtc_ref->ref_frame_comp[1] || |
1734 | 0 | rtc_ref->ref_frame_comp[2]) { |
1735 | 0 | sf->rt_sf.use_comp_ref_nonrd = 1; |
1736 | 0 | sf->rt_sf.ref_frame_comp_nonrd[0] = |
1737 | 0 | rtc_ref->ref_frame_comp[0] && rtc_ref->reference[GOLDEN_FRAME - 1]; |
1738 | 0 | sf->rt_sf.ref_frame_comp_nonrd[1] = |
1739 | 0 | rtc_ref->ref_frame_comp[1] && rtc_ref->reference[LAST2_FRAME - 1]; |
1740 | 0 | sf->rt_sf.ref_frame_comp_nonrd[2] = |
1741 | 0 | rtc_ref->ref_frame_comp[2] && rtc_ref->reference[ALTREF_FRAME - 1]; |
1742 | 0 | } else { |
1743 | 0 | sf->rt_sf.use_comp_ref_nonrd = 0; |
1744 | 0 | } |
1745 | |
|
1746 | 0 | if (cpi->svc.number_spatial_layers > 1 || |
1747 | 0 | cpi->svc.number_temporal_layers > 1) |
1748 | 0 | sf->hl_sf.accurate_bit_estimate = 0; |
1749 | |
|
1750 | 0 | sf->rt_sf.estimate_motion_for_var_based_partition = 1; |
1751 | | |
1752 | | // For single layers RPS: bias/adjustment for recovery frame. |
1753 | 0 | if (cpi->ppi->rtc_ref.bias_recovery_frame) { |
1754 | 0 | sf->mv_sf.search_method = NSTEP; |
1755 | 0 | sf->mv_sf.subpel_search_method = SUBPEL_TREE; |
1756 | 0 | sf->rt_sf.fullpel_search_step_param = 8; |
1757 | 0 | sf->rt_sf.nonrd_aggressive_skip = 0; |
1758 | 0 | } |
1759 | 0 | } |
1760 | | // Screen settings. |
1761 | 34.7k | if (cpi->oxcf.tune_cfg.content == AOM_CONTENT_SCREEN) { |
1762 | | // TODO(marpan): Check settings for speed 7 and 8. |
1763 | 0 | if (speed >= 7) { |
1764 | 0 | sf->rt_sf.reduce_mv_pel_precision_highmotion = 0; |
1765 | 0 | sf->mv_sf.use_bsize_dependent_search_method = 0; |
1766 | 0 | sf->rt_sf.skip_cdef_sb = 1; |
1767 | 0 | sf->rt_sf.increase_color_thresh_palette = 1; |
1768 | 0 | if (!frame_is_intra_only(cm)) sf->rt_sf.dct_only_palette_nonrd = 1; |
1769 | 0 | } |
1770 | 0 | if (speed >= 8) { |
1771 | 0 | sf->rt_sf.nonrd_check_partition_merge_mode = 3; |
1772 | 0 | sf->rt_sf.nonrd_prune_ref_frame_search = 1; |
1773 | 0 | sf->rt_sf.use_nonrd_filter_search = 0; |
1774 | 0 | sf->rt_sf.prune_hv_pred_modes_using_src_sad = false; |
1775 | 0 | } |
1776 | 0 | if (speed >= 9) { |
1777 | 0 | sf->rt_sf.prune_idtx_nonrd = 1; |
1778 | 0 | sf->rt_sf.part_early_exit_zeromv = 2; |
1779 | 0 | sf->rt_sf.skip_lf_screen = 1; |
1780 | 0 | sf->rt_sf.nonrd_prune_ref_frame_search = 3; |
1781 | 0 | sf->rt_sf.var_part_split_threshold_shift = 10; |
1782 | 0 | sf->mv_sf.subpel_search_method = SUBPEL_TREE_PRUNED_MORE; |
1783 | 0 | sf->rt_sf.reduce_mv_pel_precision_lowcomplex = 1; |
1784 | 0 | sf->lpf_sf.cdef_pick_method = CDEF_PICK_FROM_Q; |
1785 | 0 | sf->rt_sf.nonrd_check_partition_merge_mode = 0; |
1786 | 0 | sf->interp_sf.cb_pred_filter_search = 0; |
1787 | 0 | } |
1788 | 0 | if (speed >= 10) { |
1789 | 0 | if (cm->width * cm->height > 1920 * 1080) |
1790 | 0 | sf->part_sf.disable_8x8_part_based_on_qidx = 1; |
1791 | 0 | sf->rt_sf.screen_content_cdef_filter_qindex_thresh = 80; |
1792 | 0 | sf->rt_sf.part_early_exit_zeromv = 1; |
1793 | 0 | sf->rt_sf.nonrd_aggressive_skip = 1; |
1794 | 0 | sf->rt_sf.thresh_active_maps_skip_lf_cdef = 90; |
1795 | 0 | sf->rt_sf.hybrid_intra_pickmode = 0; |
1796 | 0 | sf->rt_sf.dct_only_palette_nonrd = 1; |
1797 | 0 | sf->rt_sf.prune_palette_search_nonrd = 1; |
1798 | 0 | sf->rt_sf.prune_intra_mode_using_best_sad_so_far = true; |
1799 | 0 | sf->rt_sf.rc_faster_convergence_static = 1; |
1800 | 0 | sf->rt_sf.rc_compute_spatial_var_sc_kf = 1; |
1801 | 0 | } |
1802 | 0 | if (speed >= 11) { |
1803 | 0 | sf->rt_sf.skip_lf_screen = 2; |
1804 | 0 | sf->rt_sf.skip_cdef_sb = 2; |
1805 | 0 | sf->rt_sf.prune_palette_search_nonrd = 2; |
1806 | 0 | sf->rt_sf.increase_color_thresh_palette = 0; |
1807 | 0 | sf->rt_sf.prune_h_pred_using_best_mode_so_far = true; |
1808 | 0 | sf->rt_sf.enable_intra_mode_pruning_using_neighbors = true; |
1809 | 0 | } |
1810 | 0 | if (speed >= 12) { |
1811 | 0 | if (cpi->rc.high_source_sad && cpi->rc.frame_source_sad > 40000 && |
1812 | 0 | cpi->rc.prev_avg_source_sad < 1000 && |
1813 | 0 | cpi->oxcf.frm_dim_cfg.width * cpi->oxcf.frm_dim_cfg.height >= |
1814 | 0 | 1280 * 720) { |
1815 | 0 | sf->rt_sf.prune_palette_search_nonrd = 3; |
1816 | 0 | sf->rt_sf.skip_newmv_mode_sad_screen = 1; |
1817 | 0 | } |
1818 | 0 | } |
1819 | 0 | sf->rt_sf.skip_encoding_non_reference_slide_change = |
1820 | 0 | cpi->oxcf.rc_cfg.drop_frames_water_mark > 0 ? 1 : 0; |
1821 | 0 | sf->rt_sf.skip_newmv_flat_blocks_screen = 1; |
1822 | 0 | sf->rt_sf.use_idtx_nonrd = 1; |
1823 | 0 | sf->rt_sf.higher_thresh_scene_detection = 0; |
1824 | 0 | sf->rt_sf.use_nonrd_altref_frame = 0; |
1825 | 0 | sf->rt_sf.use_rtc_tf = 0; |
1826 | 0 | sf->rt_sf.use_comp_ref_nonrd = 0; |
1827 | 0 | sf->rt_sf.source_metrics_sb_nonrd = 1; |
1828 | 0 | if (cpi->rc.high_source_sad == 1) { |
1829 | 0 | sf->rt_sf.prefer_large_partition_blocks = 0; |
1830 | 0 | sf->part_sf.max_intra_bsize = BLOCK_128X128; |
1831 | 0 | for (int i = 0; i < BLOCK_SIZES; ++i) { |
1832 | 0 | if (i > BLOCK_32X32) |
1833 | 0 | sf->rt_sf.intra_y_mode_bsize_mask_nrd[i] = INTRA_DC; |
1834 | 0 | else |
1835 | 0 | sf->rt_sf.intra_y_mode_bsize_mask_nrd[i] = INTRA_DC_H_V; |
1836 | 0 | } |
1837 | 0 | } |
1838 | 0 | if (speed >= 11 && cpi->rc.high_motion_content_screen_rtc) { |
1839 | 0 | sf->rt_sf.higher_thresh_scene_detection = 1; |
1840 | 0 | sf->rt_sf.force_only_last_ref = 1; |
1841 | 0 | sf->rt_sf.use_nonrd_filter_search = 0; |
1842 | 0 | sf->part_sf.fixed_partition_size = BLOCK_32X32; |
1843 | 0 | sf->rt_sf.use_fast_fixed_part = 1; |
1844 | 0 | sf->rt_sf.increase_source_sad_thresh = 1; |
1845 | 0 | sf->rt_sf.selective_cdf_update = 1; |
1846 | 0 | sf->mv_sf.search_method = FAST_DIAMOND; |
1847 | 0 | } else if (cpi->rc.max_block_source_sad > 20000 && |
1848 | 0 | cpi->rc.frame_source_sad > 100 && speed >= 6 && |
1849 | 0 | (cpi->rc.percent_blocks_with_motion > 1 || |
1850 | 0 | cpi->svc.last_layer_dropped[0])) { |
1851 | 0 | sf->mv_sf.search_method = NSTEP; |
1852 | 0 | sf->rt_sf.fullpel_search_step_param = 2; |
1853 | 0 | } |
1854 | 0 | if (cpi->rc.high_source_sad && cpi->ppi->rtc_ref.non_reference_frame) { |
1855 | 0 | sf->rt_sf.use_idtx_nonrd = 0; |
1856 | 0 | sf->rt_sf.prefer_large_partition_blocks = 1; |
1857 | 0 | sf->mv_sf.subpel_search_method = SUBPEL_TREE_PRUNED_MORE; |
1858 | 0 | sf->rt_sf.fullpel_search_step_param = 10; |
1859 | 0 | } |
1860 | 0 | sf->rt_sf.partition_direct_merging = 0; |
1861 | 0 | sf->hl_sf.accurate_bit_estimate = 0; |
1862 | | // This feature is for nonrd_pickmode. |
1863 | 0 | if (sf->rt_sf.use_nonrd_pick_mode) |
1864 | 0 | sf->rt_sf.estimate_motion_for_var_based_partition = 1; |
1865 | 0 | else |
1866 | 0 | sf->rt_sf.estimate_motion_for_var_based_partition = 0; |
1867 | 0 | } |
1868 | 34.7k | if (is_lossless_requested(&cpi->oxcf.rc_cfg)) { |
1869 | 1.09k | sf->rt_sf.use_rtc_tf = 0; |
1870 | | // TODO(aomedia:3412): The setting accurate_bit_estimate = 0 |
1871 | | // can be removed once it's fixed for lossless mode. |
1872 | 1.09k | sf->hl_sf.accurate_bit_estimate = 0; |
1873 | 1.09k | } |
1874 | 34.7k | if (cpi->oxcf.use_highbitdepth) { |
1875 | | // Disable for use_highbitdepth = 1 to mitigate issue: b/303023614. |
1876 | 8.67k | sf->rt_sf.estimate_motion_for_var_based_partition = 0; |
1877 | 8.67k | } |
1878 | 34.7k | if (cpi->oxcf.superres_cfg.enable_superres) { |
1879 | 0 | sf->rt_sf.use_rtc_tf = 0; |
1880 | 0 | sf->rt_sf.nonrd_prune_ref_frame_search = 1; |
1881 | 0 | } |
1882 | | // rtc_tf feature allocates new source because of possible |
1883 | | // temporal filtering which may change the input source during encoding: |
1884 | | // this causes an issue on resized frames when psnr is calculated, |
1885 | | // so disable it here for frames that are resized (encoding width/height |
1886 | | // different from configured width/height). Also disable for spatial layers. |
1887 | | // Bug: 491358681 |
1888 | 34.7k | if ((is_psnr_calc_enabled(cpi) && |
1889 | 0 | (cpi->oxcf.frm_dim_cfg.width != cm->width || |
1890 | 0 | cpi->oxcf.frm_dim_cfg.height != cm->height)) || |
1891 | 34.7k | cpi->svc.number_spatial_layers > 1) |
1892 | 0 | sf->rt_sf.use_rtc_tf = 0; |
1893 | | |
1894 | | // This speed feature is causing artifacts with active_maps enabled, so |
1895 | | // disable for now. |
1896 | 34.7k | if (cpi->active_map.enabled) |
1897 | 0 | sf->rt_sf.set_zeromv_skip_based_on_source_sad = 0; |
1898 | | |
1899 | 34.7k | if (is_one_pass_rt_lag_params(cpi)) { |
1900 | 0 | const RefreshFrameInfo *const refresh_frame = &cpi->refresh_frame; |
1901 | 0 | if (refresh_frame->alt_ref_frame) { |
1902 | 0 | sf->rt_sf.source_metrics_sb_nonrd = 0; |
1903 | 0 | sf->rt_sf.var_part_based_on_qidx = 0; |
1904 | 0 | } |
1905 | 0 | sf->rt_sf.use_nonrd_altref_frame = 1; |
1906 | | // For non-zero lag: disable the 3 speed features below for now, |
1907 | | // until further testing. |
1908 | 0 | sf->rt_sf.use_rtc_tf = 0; |
1909 | 0 | sf->rt_sf.nonrd_check_partition_merge_mode = 0; |
1910 | 0 | sf->rt_sf.nonrd_check_partition_split = 0; |
1911 | | // These (nonrd) speed features that force zeromv-LAST early in partition |
1912 | | // are disabled since for src_frame_alt_ref frame the zeromv-ALTREF_FRAME |
1913 | | // mode is forced in the nonrd_pickmode. |
1914 | 0 | if (cpi->rc.is_src_frame_alt_ref) { |
1915 | 0 | sf->rt_sf.increase_source_sad_thresh = 0; |
1916 | 0 | sf->rt_sf.part_early_exit_zeromv = 0; |
1917 | 0 | } |
1918 | | // This feature is for CBR mode, turning if off means the gop interval |
1919 | | // will not be changed after encoding. |
1920 | 0 | sf->rt_sf.gf_refresh_based_on_qp = 0; |
1921 | 0 | } |
1922 | 34.7k | } |
1923 | | |
1924 | | static void set_rt_speed_features_framesize_independent(AV1_COMP *cpi, |
1925 | | SPEED_FEATURES *sf, |
1926 | 34.7k | int speed) { |
1927 | 34.7k | AV1_COMMON *const cm = &cpi->common; |
1928 | 34.7k | const int boosted = frame_is_boosted(cpi); |
1929 | | |
1930 | | // Currently, rt speed 0, 1, 2, 3, 4, 5 are the same. |
1931 | | // Following set of speed features are not impacting encoder's decisions as |
1932 | | // the relevant tools are disabled by default. |
1933 | 34.7k | sf->gm_sf.gm_search_type = GM_DISABLE_SEARCH; |
1934 | 34.7k | sf->hl_sf.recode_loop = ALLOW_RECODE_KFARFGF; |
1935 | 34.7k | sf->inter_sf.reuse_inter_intra_mode = 1; |
1936 | 34.7k | sf->inter_sf.prune_compound_using_single_ref = 0; |
1937 | 34.7k | sf->inter_sf.prune_comp_search_by_single_result = 2; |
1938 | 34.7k | sf->inter_sf.prune_comp_type_by_comp_avg = 2; |
1939 | 34.7k | sf->inter_sf.fast_wedge_sign_estimate = 1; |
1940 | 34.7k | sf->inter_sf.use_dist_wtd_comp_flag = DIST_WTD_COMP_DISABLED; |
1941 | 34.7k | sf->inter_sf.mv_cost_upd_level = INTERNAL_COST_UPD_SBROW; |
1942 | 34.7k | sf->inter_sf.disable_interinter_wedge_var_thresh = 100; |
1943 | 34.7k | sf->interp_sf.cb_pred_filter_search = 0; |
1944 | 34.7k | sf->interp_sf.skip_interp_filter_search = 1; |
1945 | 34.7k | sf->part_sf.ml_prune_partition = 1; |
1946 | 34.7k | sf->part_sf.reuse_prev_rd_results_for_part_ab = 1; |
1947 | 34.7k | sf->part_sf.prune_ext_partition_types_search_level = 2; |
1948 | 34.7k | sf->part_sf.less_rectangular_check_level = 2; |
1949 | 34.7k | sf->mv_sf.obmc_full_pixel_search_level = 1; |
1950 | 34.7k | sf->intra_sf.dv_cost_upd_level = INTERNAL_COST_UPD_OFF; |
1951 | 34.7k | sf->tx_sf.model_based_prune_tx_search_level = 0; |
1952 | 34.7k | sf->lpf_sf.dual_sgr_penalty_level = 1; |
1953 | | // Disable Wiener and Self-guided Loop restoration filters. |
1954 | 34.7k | sf->lpf_sf.disable_wiener_filter = true; |
1955 | 34.7k | sf->lpf_sf.disable_sgr_filter = true; |
1956 | 34.7k | sf->intra_sf.prune_palette_search_level = 2; |
1957 | 34.7k | sf->intra_sf.prune_luma_palette_size_search_level = 2; |
1958 | 34.7k | sf->intra_sf.early_term_chroma_palette_size_search = 1; |
1959 | | |
1960 | | // End of set |
1961 | | |
1962 | | // TODO(any, yunqing): tune these features for real-time use cases. |
1963 | 34.7k | sf->hl_sf.superres_auto_search_type = SUPERRES_AUTO_SOLO; |
1964 | 34.7k | sf->hl_sf.frame_parameter_update = 0; |
1965 | | |
1966 | 34.7k | sf->inter_sf.model_based_post_interp_filter_breakout = 1; |
1967 | | // TODO(any): As per the experiments, this speed feature is doing redundant |
1968 | | // computation since the model rd based pruning logic is similar to model rd |
1969 | | // based gating when inter_mode_rd_model_estimation = 2. Enable this SF if |
1970 | | // either of the condition becomes true. |
1971 | | // (1) inter_mode_rd_model_estimation != 2 |
1972 | | // (2) skip_interp_filter_search == 0 |
1973 | | // (3) Motion mode or compound mode is enabled */ |
1974 | 34.7k | sf->inter_sf.prune_mode_search_simple_translation = 0; |
1975 | 34.7k | sf->inter_sf.prune_ref_frame_for_rect_partitions = !boosted; |
1976 | 34.7k | sf->inter_sf.disable_interintra_wedge_var_thresh = UINT_MAX; |
1977 | 34.7k | sf->inter_sf.selective_ref_frame = 4; |
1978 | 34.7k | sf->inter_sf.alt_ref_search_fp = 2; |
1979 | 34.7k | set_txfm_rd_gate_level(sf->inter_sf.txfm_rd_gate_level, boosted ? 0 : 4); |
1980 | 34.7k | sf->inter_sf.limit_txfm_eval_per_mode = 3; |
1981 | | |
1982 | 34.7k | sf->inter_sf.adaptive_rd_thresh = 4; |
1983 | 34.7k | sf->inter_sf.inter_mode_rd_model_estimation = 2; |
1984 | 34.7k | sf->inter_sf.prune_inter_modes_if_skippable = 1; |
1985 | 34.7k | sf->inter_sf.prune_nearmv_using_neighbors = PRUNE_NEARMV_LEVEL3; |
1986 | 34.7k | sf->inter_sf.reduce_inter_modes = boosted ? 1 : 3; |
1987 | 34.7k | sf->inter_sf.skip_newmv_in_drl = 4; |
1988 | | |
1989 | 34.7k | sf->interp_sf.use_fast_interpolation_filter_search = 1; |
1990 | 34.7k | sf->interp_sf.use_interp_filter = 1; |
1991 | 34.7k | sf->interp_sf.adaptive_interp_filter_search = 1; |
1992 | 34.7k | sf->interp_sf.disable_dual_filter = 1; |
1993 | | |
1994 | 34.7k | sf->part_sf.default_max_partition_size = BLOCK_128X128; |
1995 | 34.7k | sf->part_sf.default_min_partition_size = BLOCK_8X8; |
1996 | 34.7k | sf->part_sf.use_best_rd_for_pruning = 1; |
1997 | 34.7k | sf->part_sf.early_term_after_none_split = 1; |
1998 | 34.7k | sf->part_sf.partition_search_breakout_dist_thr = (1 << 25); |
1999 | 34.7k | sf->part_sf.max_intra_bsize = BLOCK_16X16; |
2000 | 34.7k | sf->part_sf.partition_search_breakout_rate_thr = 500; |
2001 | 34.7k | sf->part_sf.partition_search_type = VAR_BASED_PARTITION; |
2002 | 34.7k | sf->part_sf.adjust_var_based_rd_partitioning = 2; |
2003 | | |
2004 | 34.7k | sf->mv_sf.full_pixel_search_level = 1; |
2005 | 34.7k | sf->mv_sf.exhaustive_searches_thresh = INT_MAX; |
2006 | 34.7k | sf->mv_sf.auto_mv_step_size = 1; |
2007 | 34.7k | sf->mv_sf.subpel_iters_per_step = 1; |
2008 | 34.7k | sf->mv_sf.use_accurate_subpel_search = USE_2_TAPS; |
2009 | 34.7k | sf->mv_sf.search_method = FAST_DIAMOND; |
2010 | 34.7k | sf->mv_sf.subpel_force_stop = EIGHTH_PEL; |
2011 | 34.7k | sf->mv_sf.subpel_search_method = SUBPEL_TREE_PRUNED; |
2012 | | |
2013 | 208k | for (int i = 0; i < TX_SIZES; ++i) { |
2014 | 173k | sf->intra_sf.intra_y_mode_mask[i] = INTRA_DC; |
2015 | 173k | sf->intra_sf.intra_uv_mode_mask[i] = UV_INTRA_DC_CFL; |
2016 | 173k | } |
2017 | 34.7k | sf->intra_sf.skip_intra_in_interframe = 5; |
2018 | 34.7k | sf->intra_sf.disable_smooth_intra = 1; |
2019 | 34.7k | sf->intra_sf.skip_filter_intra_in_inter_frames = 1; |
2020 | | |
2021 | 34.7k | sf->tx_sf.intra_tx_size_search_init_depth_sqr = 1; |
2022 | 34.7k | sf->tx_sf.tx_type_search.use_reduced_intra_txset = 1; |
2023 | 34.7k | sf->tx_sf.adaptive_txb_search_level = 2; |
2024 | 34.7k | sf->tx_sf.intra_tx_size_search_init_depth_rect = 1; |
2025 | 34.7k | sf->tx_sf.tx_size_search_lgr_block = 1; |
2026 | 34.7k | sf->tx_sf.tx_type_search.ml_tx_split_thresh = 4000; |
2027 | 34.7k | sf->tx_sf.tx_type_search.skip_tx_search = 1; |
2028 | 34.7k | sf->tx_sf.inter_tx_size_search_init_depth_rect = 1; |
2029 | 34.7k | sf->tx_sf.inter_tx_size_search_init_depth_sqr = 1; |
2030 | 34.7k | sf->tx_sf.tx_type_search.prune_2d_txfm_mode = TX_TYPE_PRUNE_3; |
2031 | 34.7k | sf->tx_sf.refine_fast_tx_search_results = 0; |
2032 | 34.7k | sf->tx_sf.tx_type_search.fast_intra_tx_type_search = 2; |
2033 | 34.7k | sf->tx_sf.tx_type_search.use_skip_flag_prediction = 2; |
2034 | 34.7k | sf->tx_sf.tx_type_search.winner_mode_tx_type_pruning = 4; |
2035 | 34.7k | sf->tx_sf.use_chroma_trellis_rd_mult = 1; |
2036 | | |
2037 | 34.7k | sf->rd_sf.optimize_coefficients = NO_TRELLIS_OPT; |
2038 | 34.7k | sf->rd_sf.simple_model_rd_from_var = 1; |
2039 | 34.7k | sf->rd_sf.tx_domain_dist_level = 2; |
2040 | 34.7k | sf->rd_sf.tx_domain_dist_thres_level = 2; |
2041 | | |
2042 | 34.7k | sf->lpf_sf.cdef_pick_method = CDEF_FAST_SEARCH_LVL4; |
2043 | 34.7k | sf->lpf_sf.lpf_pick = LPF_PICK_FROM_Q; |
2044 | | |
2045 | 34.7k | sf->winner_mode_sf.dc_blk_pred_level = frame_is_intra_only(cm) ? 0 : 3; |
2046 | 34.7k | sf->winner_mode_sf.enable_winner_mode_for_tx_size_srch = 1; |
2047 | 34.7k | sf->winner_mode_sf.tx_size_search_level = 1; |
2048 | 34.7k | sf->winner_mode_sf.winner_mode_ifs = 1; |
2049 | | |
2050 | 34.7k | sf->rt_sf.check_intra_pred_nonrd = 1; |
2051 | 34.7k | sf->rt_sf.estimate_motion_for_var_based_partition = 2; |
2052 | 34.7k | sf->rt_sf.hybrid_intra_pickmode = 1; |
2053 | 34.7k | sf->rt_sf.use_comp_ref_nonrd = 0; |
2054 | 34.7k | sf->rt_sf.ref_frame_comp_nonrd[0] = 0; |
2055 | 34.7k | sf->rt_sf.ref_frame_comp_nonrd[1] = 0; |
2056 | 34.7k | sf->rt_sf.ref_frame_comp_nonrd[2] = 0; |
2057 | 34.7k | sf->rt_sf.use_nonrd_filter_search = 1; |
2058 | 34.7k | sf->rt_sf.mode_search_skip_flags |= FLAG_SKIP_INTRA_DIRMISMATCH; |
2059 | 34.7k | sf->rt_sf.num_inter_modes_for_tx_search = 5; |
2060 | 34.7k | sf->rt_sf.prune_inter_modes_using_temp_var = 1; |
2061 | 34.7k | sf->rt_sf.use_real_time_ref_set = is_one_pass_rt_lag_params(cpi) ? 0 : 1; |
2062 | 34.7k | sf->rt_sf.use_simple_rd_model = 1; |
2063 | 34.7k | sf->rt_sf.prune_inter_modes_with_golden_ref = boosted ? 0 : 1; |
2064 | | // TODO(any): This sf could be removed. |
2065 | 34.7k | sf->rt_sf.short_circuit_low_temp_var = 1; |
2066 | 34.7k | sf->rt_sf.check_scene_detection = 1; |
2067 | 34.7k | if (cpi->rc.rtc_external_ratectrl) sf->rt_sf.check_scene_detection = 0; |
2068 | 34.7k | if (cm->current_frame.frame_type != KEY_FRAME && |
2069 | 9.82k | cpi->oxcf.rc_cfg.mode == AOM_CBR) |
2070 | 9.82k | sf->rt_sf.overshoot_detection_cbr = FAST_DETECTION_MAXQ; |
2071 | | // Enable noise estimation only for high resolutions for now. |
2072 | | // |
2073 | | // Since use_temporal_noise_estimate has no effect for all-intra frame |
2074 | | // encoding, it is disabled for this case. |
2075 | 34.7k | if (cpi->oxcf.kf_cfg.key_freq_max != 0 && cm->width * cm->height > 640 * 480) |
2076 | 0 | sf->rt_sf.use_temporal_noise_estimate = 1; |
2077 | 34.7k | sf->rt_sf.skip_tx_no_split_var_based_partition = 1; |
2078 | 34.7k | sf->rt_sf.skip_newmv_mode_based_on_sse = 1; |
2079 | 34.7k | sf->rt_sf.mode_search_skip_flags = |
2080 | 34.7k | (cm->current_frame.frame_type == KEY_FRAME) |
2081 | 34.7k | ? 0 |
2082 | 34.7k | : FLAG_SKIP_INTRA_DIRMISMATCH | FLAG_SKIP_INTRA_BESTINTER | |
2083 | 9.82k | FLAG_SKIP_COMP_BESTINTRA | FLAG_SKIP_INTRA_LOWVAR | |
2084 | 9.82k | FLAG_EARLY_TERMINATE; |
2085 | 34.7k | sf->rt_sf.var_part_split_threshold_shift = 5; |
2086 | 34.7k | if (!frame_is_intra_only(&cpi->common)) sf->rt_sf.var_part_based_on_qidx = 1; |
2087 | 34.7k | sf->rt_sf.use_fast_fixed_part = 0; |
2088 | 34.7k | sf->rt_sf.increase_source_sad_thresh = 0; |
2089 | | |
2090 | 34.7k | if (is_one_pass_rt_lag_params(cpi) && speed <= 6) { |
2091 | 0 | sf->hl_sf.frame_parameter_update = 1; |
2092 | 0 | sf->inter_sf.use_dist_wtd_comp_flag = 0; |
2093 | 0 | sf->inter_sf.disable_masked_comp = 1; |
2094 | 0 | sf->inter_sf.disable_onesided_comp = 1; |
2095 | 0 | } |
2096 | | |
2097 | 34.7k | if (speed >= 6) { |
2098 | 27.7k | sf->mv_sf.use_fullpel_costlist = 1; |
2099 | | |
2100 | 27.7k | sf->rd_sf.tx_domain_dist_thres_level = 3; |
2101 | | |
2102 | 27.7k | sf->tx_sf.tx_type_search.fast_inter_tx_type_prob_thresh = 0; |
2103 | 27.7k | sf->inter_sf.limit_inter_mode_cands = 4; |
2104 | 27.7k | sf->inter_sf.prune_warped_prob_thresh = 8; |
2105 | 27.7k | sf->inter_sf.extra_prune_warped = 1; |
2106 | | |
2107 | 27.7k | sf->rt_sf.gf_refresh_based_on_qp = 1; |
2108 | 27.7k | sf->rt_sf.prune_inter_modes_wrt_gf_arf_based_on_sad = 1; |
2109 | 27.7k | sf->rt_sf.var_part_split_threshold_shift = 7; |
2110 | 27.7k | if (!frame_is_intra_only(&cpi->common)) |
2111 | 9.82k | sf->rt_sf.var_part_based_on_qidx = 2; |
2112 | | |
2113 | 27.7k | sf->winner_mode_sf.prune_winner_mode_eval_level = boosted ? 0 : 3; |
2114 | 27.7k | } |
2115 | | |
2116 | 34.7k | if (speed >= 7) { |
2117 | 27.7k | sf->rt_sf.sse_early_term_inter_search = EARLY_TERM_IDX_1; |
2118 | 27.7k | sf->rt_sf.use_comp_ref_nonrd = 1; |
2119 | 27.7k | sf->rt_sf.ref_frame_comp_nonrd[2] = 1; // LAST_ALTREF |
2120 | 27.7k | sf->tx_sf.intra_tx_size_search_init_depth_sqr = 2; |
2121 | 27.7k | sf->part_sf.partition_search_type = VAR_BASED_PARTITION; |
2122 | 27.7k | sf->part_sf.max_intra_bsize = BLOCK_32X32; |
2123 | | |
2124 | 27.7k | sf->mv_sf.search_method = FAST_DIAMOND; |
2125 | 27.7k | sf->mv_sf.subpel_force_stop = QUARTER_PEL; |
2126 | | |
2127 | 27.7k | sf->inter_sf.inter_mode_rd_model_estimation = 2; |
2128 | | // This sf is not applicable in non-rd path. |
2129 | 27.7k | sf->inter_sf.skip_newmv_in_drl = 0; |
2130 | | |
2131 | 27.7k | sf->interp_sf.skip_interp_filter_search = 0; |
2132 | | |
2133 | | // Disable intra_y_mode_mask pruning since the performance at speed 7 isn't |
2134 | | // good. May need more study. |
2135 | 166k | for (int i = 0; i < TX_SIZES; ++i) { |
2136 | 138k | sf->intra_sf.intra_y_mode_mask[i] = INTRA_ALL; |
2137 | 138k | } |
2138 | | |
2139 | 27.7k | sf->lpf_sf.lpf_pick = LPF_PICK_FROM_Q; |
2140 | 27.7k | sf->lpf_sf.cdef_pick_method = CDEF_FAST_SEARCH_LVL5; |
2141 | | |
2142 | 27.7k | sf->rt_sf.mode_search_skip_flags |= FLAG_SKIP_INTRA_DIRMISMATCH; |
2143 | 27.7k | sf->rt_sf.nonrd_prune_ref_frame_search = 1; |
2144 | | // This is for rd path only. |
2145 | 27.7k | sf->rt_sf.prune_inter_modes_using_temp_var = 0; |
2146 | 27.7k | sf->rt_sf.prune_inter_modes_wrt_gf_arf_based_on_sad = 0; |
2147 | 27.7k | sf->rt_sf.prune_intra_mode_based_on_mv_range = 0; |
2148 | 27.7k | #if !CONFIG_REALTIME_ONLY |
2149 | 27.7k | sf->rt_sf.reuse_inter_pred_nonrd = |
2150 | 27.7k | (cpi->oxcf.motion_mode_cfg.enable_warped_motion == 0); |
2151 | | #else |
2152 | | sf->rt_sf.reuse_inter_pred_nonrd = 1; |
2153 | | #endif |
2154 | | #if CONFIG_AV1_TEMPORAL_DENOISING |
2155 | | sf->rt_sf.reuse_inter_pred_nonrd = (cpi->oxcf.noise_sensitivity == 0); |
2156 | | #endif |
2157 | 27.7k | sf->rt_sf.short_circuit_low_temp_var = 0; |
2158 | | // For spatial layers, only LAST and GOLDEN are currently used in the SVC |
2159 | | // for nonrd. The flag use_nonrd_altref_frame can disable GOLDEN in the |
2160 | | // get_ref_frame_flags() for some patterns, so disable it here for |
2161 | | // spatial layers. |
2162 | 27.7k | sf->rt_sf.use_nonrd_altref_frame = |
2163 | 27.7k | (cpi->svc.number_spatial_layers > 1) ? 0 : 1; |
2164 | 27.7k | sf->rt_sf.use_nonrd_pick_mode = 1; |
2165 | 27.7k | sf->rt_sf.discount_color_cost = 1; |
2166 | 27.7k | sf->rt_sf.nonrd_check_partition_merge_mode = 3; |
2167 | 27.7k | sf->rt_sf.skip_intra_pred = 1; |
2168 | 27.7k | sf->rt_sf.source_metrics_sb_nonrd = 1; |
2169 | | // Set mask for intra modes. |
2170 | 471k | for (int i = 0; i < BLOCK_SIZES; ++i) |
2171 | 443k | if (i >= BLOCK_32X32) |
2172 | 194k | sf->rt_sf.intra_y_mode_bsize_mask_nrd[i] = INTRA_DC; |
2173 | 249k | else |
2174 | | // Use DC, H, V intra mode for block sizes < 32X32. |
2175 | 249k | sf->rt_sf.intra_y_mode_bsize_mask_nrd[i] = INTRA_DC_H_V; |
2176 | | |
2177 | 27.7k | sf->winner_mode_sf.dc_blk_pred_level = 0; |
2178 | 27.7k | sf->rt_sf.var_part_based_on_qidx = 3; |
2179 | 27.7k | sf->rt_sf.prune_compoundmode_with_singlecompound_var = true; |
2180 | 27.7k | sf->rt_sf.prune_compoundmode_with_singlemode_var = true; |
2181 | 27.7k | sf->rt_sf.skip_compound_based_on_var = true; |
2182 | 27.7k | sf->rt_sf.use_adaptive_subpel_search = true; |
2183 | 27.7k | } |
2184 | | |
2185 | 34.7k | if (speed >= 8) { |
2186 | 18.5k | sf->rt_sf.sse_early_term_inter_search = EARLY_TERM_IDX_2; |
2187 | 18.5k | sf->intra_sf.intra_pruning_with_hog = 1; |
2188 | 18.5k | sf->rt_sf.short_circuit_low_temp_var = 1; |
2189 | 18.5k | sf->rt_sf.use_nonrd_altref_frame = 0; |
2190 | 18.5k | sf->rt_sf.nonrd_prune_ref_frame_search = 2; |
2191 | 18.5k | sf->rt_sf.nonrd_check_partition_merge_mode = 0; |
2192 | 18.5k | sf->rt_sf.var_part_split_threshold_shift = 8; |
2193 | 18.5k | sf->rt_sf.var_part_based_on_qidx = 4; |
2194 | 18.5k | sf->rt_sf.partition_direct_merging = 1; |
2195 | 18.5k | sf->rt_sf.prune_compoundmode_with_singlemode_var = false; |
2196 | 18.5k | sf->mv_sf.use_bsize_dependent_search_method = 4; |
2197 | 18.5k | sf->rt_sf.prune_hv_pred_modes_using_src_sad = true; |
2198 | 18.5k | } |
2199 | 34.7k | if (speed >= 9) { |
2200 | 11.5k | sf->rt_sf.sse_early_term_inter_search = EARLY_TERM_IDX_3; |
2201 | 11.5k | sf->rt_sf.estimate_motion_for_var_based_partition = 3; |
2202 | 11.5k | sf->rt_sf.prefer_large_partition_blocks = 3; |
2203 | 11.5k | sf->rt_sf.skip_intra_pred = 2; |
2204 | 11.5k | sf->rt_sf.var_part_split_threshold_shift = 9; |
2205 | 195k | for (int i = 0; i < BLOCK_SIZES; ++i) |
2206 | 184k | sf->rt_sf.intra_y_mode_bsize_mask_nrd[i] = INTRA_DC; |
2207 | 11.5k | sf->rt_sf.var_part_based_on_qidx = 0; |
2208 | 11.5k | sf->rt_sf.frame_level_mode_cost_update = true; |
2209 | 11.5k | sf->rt_sf.check_only_zero_zeromv_on_large_blocks = true; |
2210 | 11.5k | sf->rt_sf.reduce_mv_pel_precision_highmotion = 0; |
2211 | 11.5k | sf->rt_sf.use_adaptive_subpel_search = true; |
2212 | 11.5k | sf->mv_sf.use_bsize_dependent_search_method = 0; |
2213 | 11.5k | } |
2214 | 34.7k | if (speed >= 10) { |
2215 | 0 | sf->rt_sf.sse_early_term_inter_search = EARLY_TERM_IDX_4; |
2216 | 0 | sf->rt_sf.nonrd_prune_ref_frame_search = 3; |
2217 | 0 | sf->rt_sf.var_part_split_threshold_shift = 10; |
2218 | 0 | sf->mv_sf.subpel_search_method = SUBPEL_TREE_PRUNED_MORE; |
2219 | 0 | } |
2220 | 34.7k | if (speed >= 11 && !frame_is_intra_only(cm) && |
2221 | 0 | cpi->oxcf.tune_cfg.content == AOM_CONTENT_SCREEN) { |
2222 | 0 | sf->winner_mode_sf.dc_blk_pred_level = 3; |
2223 | 0 | } |
2224 | | |
2225 | 34.7k | if (cpi->oxcf.tune_cfg.tuning == AOM_TUNE_IQ || |
2226 | 34.7k | cpi->oxcf.tune_cfg.tuning == AOM_TUNE_SSIMULACRA2) { |
2227 | 0 | sf->intra_sf.skip_intra_in_interframe = 0; |
2228 | 0 | } |
2229 | 34.7k | } |
2230 | | |
2231 | 340k | static inline void init_hl_sf(HIGH_LEVEL_SPEED_FEATURES *hl_sf) { |
2232 | | // best quality defaults |
2233 | 340k | hl_sf->frame_parameter_update = 1; |
2234 | 340k | hl_sf->recode_loop = ALLOW_RECODE; |
2235 | | // Recode loop tolerance %. |
2236 | 340k | hl_sf->recode_tolerance = 25; |
2237 | 340k | hl_sf->high_precision_mv_usage = CURRENT_Q; |
2238 | 340k | hl_sf->superres_auto_search_type = SUPERRES_AUTO_ALL; |
2239 | 340k | hl_sf->disable_extra_sc_testing = 0; |
2240 | 340k | hl_sf->second_alt_ref_filtering = 1; |
2241 | 340k | hl_sf->adjust_num_frames_for_arf_filtering = 0; |
2242 | 340k | hl_sf->accurate_bit_estimate = 0; |
2243 | 340k | hl_sf->weight_calc_level_in_tf = 0; |
2244 | 340k | hl_sf->allow_sub_blk_me_in_tf = 0; |
2245 | 340k | hl_sf->ref_frame_mvs_lvl = 0; |
2246 | 340k | hl_sf->screen_detection_mode2_fast_detection = 0; |
2247 | 340k | } |
2248 | | |
2249 | 340k | static inline void init_fp_sf(FIRST_PASS_SPEED_FEATURES *fp_sf) { |
2250 | 340k | fp_sf->reduce_mv_step_param = 3; |
2251 | 340k | fp_sf->skip_motion_search_threshold = 0; |
2252 | 340k | fp_sf->disable_recon = 0; |
2253 | 340k | fp_sf->skip_zeromv_motion_search = 0; |
2254 | 340k | } |
2255 | | |
2256 | 340k | static inline void init_tpl_sf(TPL_SPEED_FEATURES *tpl_sf) { |
2257 | 340k | tpl_sf->gop_length_decision_method = 1; |
2258 | 340k | tpl_sf->prune_intra_modes = 0; |
2259 | 340k | tpl_sf->prune_starting_mv = 0; |
2260 | 340k | tpl_sf->reduce_first_step_size = 0; |
2261 | 340k | tpl_sf->skip_alike_starting_mv = 0; |
2262 | 340k | tpl_sf->subpel_force_stop = EIGHTH_PEL; |
2263 | 340k | tpl_sf->search_method = NSTEP; |
2264 | 340k | tpl_sf->prune_ref_frames_in_tpl = 0; |
2265 | 340k | tpl_sf->allow_compound_pred = 1; |
2266 | 340k | tpl_sf->use_y_only_rate_distortion = 0; |
2267 | 340k | tpl_sf->use_sad_for_mode_decision = 0; |
2268 | 340k | tpl_sf->reduce_num_frames = 0; |
2269 | 340k | } |
2270 | | |
2271 | 340k | static inline void init_gm_sf(GLOBAL_MOTION_SPEED_FEATURES *gm_sf) { |
2272 | 340k | gm_sf->gm_search_type = GM_FULL_SEARCH; |
2273 | 340k | gm_sf->prune_ref_frame_for_gm_search = 0; |
2274 | 340k | gm_sf->prune_zero_mv_with_sse = 0; |
2275 | 340k | gm_sf->disable_gm_search_based_on_stats = 0; |
2276 | 340k | gm_sf->downsample_level = 0; |
2277 | 340k | gm_sf->num_refinement_steps = GM_MAX_REFINEMENT_STEPS; |
2278 | 340k | gm_sf->gm_erroradv_tr_level = 0; |
2279 | 340k | } |
2280 | | |
2281 | 340k | static inline void init_part_sf(PARTITION_SPEED_FEATURES *part_sf) { |
2282 | 340k | part_sf->partition_search_type = SEARCH_PARTITION; |
2283 | 340k | part_sf->less_rectangular_check_level = 0; |
2284 | 340k | part_sf->use_square_partition_only_threshold = BLOCK_128X128; |
2285 | 340k | part_sf->auto_max_partition_based_on_simple_motion = NOT_IN_USE; |
2286 | 340k | part_sf->default_max_partition_size = BLOCK_LARGEST; |
2287 | 340k | part_sf->default_min_partition_size = BLOCK_4X4; |
2288 | 340k | part_sf->adjust_var_based_rd_partitioning = 0; |
2289 | 340k | part_sf->max_intra_bsize = BLOCK_LARGEST; |
2290 | | // This setting only takes effect when partition_search_type is set |
2291 | | // to FIXED_PARTITION. |
2292 | 340k | part_sf->fixed_partition_size = BLOCK_16X16; |
2293 | | // Recode loop tolerance %. |
2294 | 340k | part_sf->partition_search_breakout_dist_thr = 0; |
2295 | 340k | part_sf->partition_search_breakout_rate_thr = 0; |
2296 | 340k | part_sf->prune_ext_partition_types_search_level = 0; |
2297 | 340k | part_sf->prune_part4_search = 0; |
2298 | 340k | part_sf->ml_prune_partition = 0; |
2299 | 340k | part_sf->ml_early_term_after_part_split_level = 0; |
2300 | 2.04M | for (int i = 0; i < PARTITION_BLOCK_SIZES; ++i) { |
2301 | 1.70M | part_sf->ml_partition_search_breakout_thresh[i] = |
2302 | 1.70M | -1; // -1 means not enabled. |
2303 | 1.70M | } |
2304 | 340k | part_sf->ml_partition_search_breakout_model_index = 0; |
2305 | 340k | part_sf->ml_4_partition_search_level_index = 0; |
2306 | 340k | part_sf->simple_motion_search_prune_agg = SIMPLE_AGG_LVL0; |
2307 | 340k | part_sf->simple_motion_search_split = 0; |
2308 | 340k | part_sf->simple_motion_search_prune_rect = 0; |
2309 | 340k | part_sf->simple_motion_search_early_term_none = 0; |
2310 | 340k | part_sf->simple_motion_search_reduce_search_steps = 0; |
2311 | 340k | part_sf->intra_cnn_based_part_prune_level = 0; |
2312 | 340k | part_sf->ext_partition_eval_thresh = BLOCK_8X8; |
2313 | 340k | part_sf->rect_partition_eval_thresh = BLOCK_128X128; |
2314 | 340k | part_sf->ext_part_eval_based_on_cur_best = 0; |
2315 | 340k | part_sf->prune_ext_part_using_split_info = 0; |
2316 | 340k | part_sf->prune_rectangular_split_based_on_qidx = 0; |
2317 | 340k | part_sf->prune_rect_part_using_4x4_var_deviation = false; |
2318 | 340k | part_sf->prune_rect_part_using_none_pred_mode = false; |
2319 | 340k | part_sf->early_term_after_none_split = 0; |
2320 | 340k | part_sf->ml_predict_breakout_level = 0; |
2321 | 340k | part_sf->prune_sub_8x8_partition_level = 0; |
2322 | 340k | part_sf->simple_motion_search_rect_split = 0; |
2323 | 340k | part_sf->reuse_prev_rd_results_for_part_ab = 0; |
2324 | 340k | part_sf->reuse_best_prediction_for_part_ab = 0; |
2325 | 340k | part_sf->use_best_rd_for_pruning = 0; |
2326 | 340k | part_sf->skip_non_sq_part_based_on_none = 0; |
2327 | 340k | part_sf->disable_8x8_part_based_on_qidx = 0; |
2328 | 340k | part_sf->split_partition_penalty_level = 0; |
2329 | 340k | part_sf->prune_h_or_v_4part_using_sms_info = false; |
2330 | 340k | } |
2331 | | |
2332 | 340k | static inline void init_mv_sf(MV_SPEED_FEATURES *mv_sf) { |
2333 | 340k | mv_sf->full_pixel_search_level = 0; |
2334 | 340k | mv_sf->auto_mv_step_size = 0; |
2335 | 340k | mv_sf->exhaustive_searches_thresh = 0; |
2336 | 340k | mv_sf->obmc_full_pixel_search_level = 0; |
2337 | 340k | mv_sf->prune_mesh_search = PRUNE_MESH_SEARCH_DISABLED; |
2338 | 340k | mv_sf->reduce_search_range = 0; |
2339 | 340k | mv_sf->search_method = NSTEP; |
2340 | 340k | mv_sf->simple_motion_subpel_force_stop = EIGHTH_PEL; |
2341 | 340k | mv_sf->subpel_force_stop = EIGHTH_PEL; |
2342 | 340k | mv_sf->subpel_iters_per_step = 2; |
2343 | 340k | mv_sf->subpel_search_method = SUBPEL_TREE; |
2344 | 340k | mv_sf->use_accurate_subpel_search = USE_8_TAPS; |
2345 | 340k | mv_sf->use_bsize_dependent_search_method = 0; |
2346 | 340k | mv_sf->use_fullpel_costlist = 0; |
2347 | 340k | mv_sf->use_downsampled_sad = 0; |
2348 | 340k | mv_sf->disable_extensive_joint_motion_search = 0; |
2349 | 340k | mv_sf->disable_second_mv = 0; |
2350 | 340k | mv_sf->skip_fullpel_search_using_startmv_refmv = 0; |
2351 | 340k | mv_sf->warp_search_method = WARP_SEARCH_SQUARE; |
2352 | 340k | mv_sf->warp_search_iters = 8; |
2353 | 340k | mv_sf->use_intrabc = 1; |
2354 | 340k | mv_sf->prune_intrabc_candidate_block_hash_search = 0; |
2355 | 340k | mv_sf->intrabc_search_level = 0; |
2356 | 340k | mv_sf->hash_max_8x8_intrabc_blocks = 0; |
2357 | 340k | } |
2358 | | |
2359 | 340k | static inline void init_inter_sf(INTER_MODE_SPEED_FEATURES *inter_sf) { |
2360 | 340k | inter_sf->adaptive_rd_thresh = 0; |
2361 | 340k | inter_sf->model_based_post_interp_filter_breakout = 0; |
2362 | 340k | inter_sf->reduce_inter_modes = 0; |
2363 | 340k | inter_sf->alt_ref_search_fp = 0; |
2364 | 340k | inter_sf->prune_single_ref = 0; |
2365 | 340k | inter_sf->prune_comp_ref_frames = 0; |
2366 | 340k | inter_sf->selective_ref_frame = 0; |
2367 | 340k | inter_sf->prune_ref_frame_for_rect_partitions = 0; |
2368 | 340k | inter_sf->fast_wedge_sign_estimate = 0; |
2369 | 340k | inter_sf->use_dist_wtd_comp_flag = DIST_WTD_COMP_ENABLED; |
2370 | 340k | inter_sf->reuse_inter_intra_mode = 0; |
2371 | 340k | inter_sf->mv_cost_upd_level = INTERNAL_COST_UPD_SB; |
2372 | 340k | inter_sf->coeff_cost_upd_level = INTERNAL_COST_UPD_SB; |
2373 | 340k | inter_sf->mode_cost_upd_level = INTERNAL_COST_UPD_SB; |
2374 | 340k | inter_sf->prune_inter_modes_based_on_tpl = 0; |
2375 | 340k | inter_sf->prune_nearmv_using_neighbors = PRUNE_NEARMV_OFF; |
2376 | 340k | inter_sf->prune_comp_search_by_single_result = 0; |
2377 | 340k | inter_sf->skip_repeated_ref_mv = 0; |
2378 | 340k | inter_sf->skip_newmv_in_drl = 0; |
2379 | 340k | inter_sf->inter_mode_rd_model_estimation = 0; |
2380 | 340k | inter_sf->prune_compound_using_single_ref = 0; |
2381 | 340k | inter_sf->prune_ext_comp_using_neighbors = 0; |
2382 | 340k | inter_sf->skip_ext_comp_nearmv_mode = 0; |
2383 | 340k | inter_sf->prune_comp_using_best_single_mode_ref = 0; |
2384 | 340k | inter_sf->prune_nearest_near_mv_using_refmv_weight = 0; |
2385 | 340k | inter_sf->disable_onesided_comp = 0; |
2386 | 340k | inter_sf->prune_mode_search_simple_translation = 0; |
2387 | 340k | inter_sf->prune_comp_type_by_comp_avg = 0; |
2388 | 340k | inter_sf->disable_interinter_wedge_newmv_search = 0; |
2389 | 340k | inter_sf->fast_interintra_wedge_search = 0; |
2390 | 340k | inter_sf->prune_comp_type_by_model_rd = 0; |
2391 | 340k | inter_sf->perform_best_rd_based_gating_for_chroma = 0; |
2392 | 340k | inter_sf->prune_obmc_prob_thresh = 0; |
2393 | 340k | inter_sf->disable_interinter_wedge_var_thresh = 0; |
2394 | 340k | inter_sf->disable_interintra_wedge_var_thresh = 0; |
2395 | 340k | inter_sf->prune_ref_mv_idx_search = 0; |
2396 | 340k | inter_sf->prune_warped_prob_thresh = 0; |
2397 | 340k | inter_sf->reuse_compound_type_decision = 0; |
2398 | 340k | inter_sf->prune_inter_modes_if_skippable = 0; |
2399 | 340k | inter_sf->disable_masked_comp = 0; |
2400 | 340k | inter_sf->enable_fast_compound_mode_search = 0; |
2401 | 340k | inter_sf->reuse_mask_search_results = 0; |
2402 | 340k | inter_sf->enable_fast_wedge_mask_search = 0; |
2403 | 340k | inter_sf->inter_mode_txfm_breakout = 0; |
2404 | 340k | inter_sf->limit_inter_mode_cands = 0; |
2405 | 340k | inter_sf->limit_txfm_eval_per_mode = 0; |
2406 | 340k | inter_sf->skip_arf_compound = 0; |
2407 | 340k | inter_sf->bias_warp_mode_rd_scale_pct = 0; |
2408 | 340k | inter_sf->bias_obmc_mode_rd_scale_pct = 0.0f; |
2409 | 340k | inter_sf->skip_cmp_using_top_cmp_avg_est_rd_lvl = 0; |
2410 | 340k | inter_sf->skip_interinter_wedge_search_based_on_mse = 0; |
2411 | 340k | set_txfm_rd_gate_level(inter_sf->txfm_rd_gate_level, 0); |
2412 | 340k | } |
2413 | | |
2414 | 340k | static inline void init_interp_sf(INTERP_FILTER_SPEED_FEATURES *interp_sf) { |
2415 | 340k | interp_sf->adaptive_interp_filter_search = 0; |
2416 | 340k | interp_sf->cb_pred_filter_search = 0; |
2417 | 340k | interp_sf->disable_dual_filter = 0; |
2418 | 340k | interp_sf->skip_sharp_interp_filter_search = 0; |
2419 | 340k | interp_sf->use_fast_interpolation_filter_search = 0; |
2420 | 340k | interp_sf->use_interp_filter = 0; |
2421 | 340k | interp_sf->skip_interp_filter_search = 0; |
2422 | 340k | interp_sf->use_more_sharp_interp = 0; |
2423 | 340k | interp_sf->skip_model_rd_uv = 0; |
2424 | 340k | } |
2425 | | |
2426 | 340k | static inline void init_intra_sf(INTRA_MODE_SPEED_FEATURES *intra_sf) { |
2427 | 340k | intra_sf->dv_cost_upd_level = INTERNAL_COST_UPD_SB; |
2428 | 340k | intra_sf->skip_intra_in_interframe = 1; |
2429 | 340k | intra_sf->intra_pruning_with_hog = 0; |
2430 | 340k | intra_sf->chroma_intra_pruning_with_hog = 0; |
2431 | 340k | intra_sf->prune_palette_search_level = 0; |
2432 | 340k | intra_sf->prune_luma_palette_size_search_level = 0; |
2433 | | |
2434 | 2.04M | for (int i = 0; i < TX_SIZES; i++) { |
2435 | 1.70M | intra_sf->intra_y_mode_mask[i] = INTRA_ALL; |
2436 | 1.70M | intra_sf->intra_uv_mode_mask[i] = UV_INTRA_ALL; |
2437 | 1.70M | } |
2438 | 340k | intra_sf->disable_smooth_intra = 0; |
2439 | 340k | intra_sf->prune_smooth_intra_mode_for_chroma = 0; |
2440 | 340k | intra_sf->prune_filter_intra_level = 0; |
2441 | 340k | intra_sf->prune_chroma_modes_using_luma_winner = 0; |
2442 | 340k | intra_sf->cfl_search_range = 3; |
2443 | 340k | intra_sf->top_intra_model_count_allowed = TOP_INTRA_MODEL_COUNT; |
2444 | 340k | intra_sf->adapt_top_model_rd_count_using_neighbors = 0; |
2445 | 340k | intra_sf->early_term_chroma_palette_size_search = 0; |
2446 | 340k | intra_sf->skip_filter_intra_in_inter_frames = 0; |
2447 | 340k | intra_sf->prune_luma_odd_delta_angles_in_intra = 0; |
2448 | 340k | } |
2449 | | |
2450 | 340k | static inline void init_tx_sf(TX_SPEED_FEATURES *tx_sf) { |
2451 | 340k | tx_sf->inter_tx_size_search_init_depth_sqr = 0; |
2452 | 340k | tx_sf->inter_tx_size_search_init_depth_rect = 0; |
2453 | 340k | tx_sf->intra_tx_size_search_init_depth_rect = 0; |
2454 | 340k | tx_sf->intra_tx_size_search_init_depth_sqr = 0; |
2455 | 340k | tx_sf->tx_size_search_lgr_block = 0; |
2456 | 340k | tx_sf->model_based_prune_tx_search_level = 0; |
2457 | 340k | tx_sf->tx_type_search.prune_2d_txfm_mode = TX_TYPE_PRUNE_1; |
2458 | 340k | tx_sf->tx_type_search.ml_tx_split_thresh = 8500; |
2459 | 340k | tx_sf->tx_type_search.use_skip_flag_prediction = 1; |
2460 | 340k | tx_sf->tx_type_search.use_reduced_intra_txset = 0; |
2461 | 340k | tx_sf->tx_type_search.fast_intra_tx_type_search = 0; |
2462 | 340k | tx_sf->tx_type_search.fast_inter_tx_type_prob_thresh = INT_MAX; |
2463 | 340k | tx_sf->tx_type_search.skip_tx_search = 0; |
2464 | 340k | tx_sf->tx_type_search.prune_tx_type_using_stats = 0; |
2465 | 340k | tx_sf->tx_type_search.prune_tx_type_est_rd = 0; |
2466 | 340k | tx_sf->tx_type_search.winner_mode_tx_type_pruning = 0; |
2467 | 340k | tx_sf->txb_split_cap = 1; |
2468 | 340k | tx_sf->adaptive_txb_search_level = 0; |
2469 | 340k | tx_sf->refine_fast_tx_search_results = 1; |
2470 | 340k | tx_sf->prune_tx_size_level = 0; |
2471 | 340k | tx_sf->prune_intra_tx_depths_using_nn = false; |
2472 | 340k | tx_sf->use_rd_based_breakout_for_intra_tx_search = false; |
2473 | 340k | tx_sf->prune_inter_tx_split_rd_eval_lvl = 0; |
2474 | 340k | tx_sf->use_chroma_trellis_rd_mult = 0; |
2475 | 340k | } |
2476 | | |
2477 | | static inline void init_rd_sf(RD_CALC_SPEED_FEATURES *rd_sf, |
2478 | 340k | const AV1EncoderConfig *oxcf) { |
2479 | 340k | const int disable_trellis_quant = oxcf->algo_cfg.disable_trellis_quant; |
2480 | 340k | if (disable_trellis_quant == 3) { |
2481 | 340k | rd_sf->optimize_coefficients = !is_lossless_requested(&oxcf->rc_cfg) |
2482 | 340k | ? NO_ESTIMATE_YRD_TRELLIS_OPT |
2483 | 340k | : NO_TRELLIS_OPT; |
2484 | 340k | } else if (disable_trellis_quant == 2) { |
2485 | 0 | rd_sf->optimize_coefficients = !is_lossless_requested(&oxcf->rc_cfg) |
2486 | 0 | ? FINAL_PASS_TRELLIS_OPT |
2487 | 0 | : NO_TRELLIS_OPT; |
2488 | 0 | } else if (disable_trellis_quant == 0) { |
2489 | 0 | if (is_lossless_requested(&oxcf->rc_cfg)) { |
2490 | 0 | rd_sf->optimize_coefficients = NO_TRELLIS_OPT; |
2491 | 0 | } else { |
2492 | 0 | rd_sf->optimize_coefficients = FULL_TRELLIS_OPT; |
2493 | 0 | } |
2494 | 0 | } else if (disable_trellis_quant == 1) { |
2495 | 0 | rd_sf->optimize_coefficients = NO_TRELLIS_OPT; |
2496 | 0 | } else { |
2497 | 0 | assert(0 && "Invalid disable_trellis_quant value"); |
2498 | 0 | } |
2499 | 340k | rd_sf->use_mb_rd_hash = 0; |
2500 | 340k | rd_sf->simple_model_rd_from_var = 0; |
2501 | 340k | rd_sf->tx_domain_dist_level = 0; |
2502 | 340k | rd_sf->tx_domain_dist_thres_level = 0; |
2503 | 340k | rd_sf->perform_coeff_opt = 0; |
2504 | 340k | } |
2505 | | |
2506 | | static inline void init_winner_mode_sf( |
2507 | 340k | WINNER_MODE_SPEED_FEATURES *winner_mode_sf) { |
2508 | 340k | winner_mode_sf->motion_mode_for_winner_cand = 0; |
2509 | | // Set this at the appropriate speed levels |
2510 | 340k | winner_mode_sf->tx_size_search_level = 0; |
2511 | 340k | winner_mode_sf->enable_winner_mode_for_coeff_opt = 0; |
2512 | 340k | winner_mode_sf->enable_winner_mode_for_tx_size_srch = 0; |
2513 | 340k | winner_mode_sf->enable_winner_mode_for_use_tx_domain_dist = 0; |
2514 | 340k | winner_mode_sf->multi_winner_mode_type = 0; |
2515 | 340k | winner_mode_sf->dc_blk_pred_level = 0; |
2516 | 340k | winner_mode_sf->winner_mode_ifs = 0; |
2517 | 340k | winner_mode_sf->prune_winner_mode_eval_level = 0; |
2518 | 340k | } |
2519 | | |
2520 | 340k | static inline void init_lpf_sf(LOOP_FILTER_SPEED_FEATURES *lpf_sf) { |
2521 | 340k | lpf_sf->disable_loop_restoration_chroma = 0; |
2522 | 340k | lpf_sf->disable_loop_restoration_luma = 0; |
2523 | 340k | lpf_sf->min_lr_unit_size = RESTORATION_PROC_UNIT_SIZE; |
2524 | 340k | lpf_sf->max_lr_unit_size = RESTORATION_UNITSIZE_MAX; |
2525 | 340k | lpf_sf->prune_wiener_based_on_src_var = 0; |
2526 | 340k | lpf_sf->prune_sgr_based_on_wiener = 0; |
2527 | 340k | lpf_sf->enable_sgr_ep_pruning = 0; |
2528 | 340k | lpf_sf->reduce_wiener_window_size = 0; |
2529 | 340k | lpf_sf->adaptive_luma_loop_filter_skip = 0; |
2530 | 340k | lpf_sf->skip_loop_filter_using_filt_error = 0; |
2531 | 340k | lpf_sf->lpf_pick = LPF_PICK_FROM_FULL_IMAGE; |
2532 | 340k | lpf_sf->use_coarse_filter_level_search = 0; |
2533 | 340k | lpf_sf->cdef_pick_method = CDEF_FULL_SEARCH; |
2534 | 340k | lpf_sf->zero_low_cdef_strengths = 0; |
2535 | | // Set decoder side speed feature to use less dual sgr modes |
2536 | 340k | lpf_sf->dual_sgr_penalty_level = 0; |
2537 | | // Enable Wiener and Self-guided Loop restoration filters by default. |
2538 | 340k | lpf_sf->disable_wiener_filter = false; |
2539 | 340k | lpf_sf->disable_sgr_filter = false; |
2540 | 340k | lpf_sf->disable_wiener_coeff_refine_search = false; |
2541 | 340k | lpf_sf->use_downsampled_wiener_stats = 0; |
2542 | 340k | lpf_sf->switchable_lr_with_bias_level = 0; |
2543 | 340k | lpf_sf->adaptive_cdef_mode = 0; |
2544 | 340k | } |
2545 | | |
2546 | 340k | static inline void init_rt_sf(REAL_TIME_SPEED_FEATURES *rt_sf) { |
2547 | 340k | rt_sf->check_intra_pred_nonrd = 0; |
2548 | 340k | rt_sf->skip_intra_pred = 0; |
2549 | 340k | rt_sf->estimate_motion_for_var_based_partition = 0; |
2550 | 340k | rt_sf->nonrd_check_partition_merge_mode = 0; |
2551 | 340k | rt_sf->nonrd_check_partition_split = 0; |
2552 | 340k | rt_sf->mode_search_skip_flags = 0; |
2553 | 340k | rt_sf->nonrd_prune_ref_frame_search = 0; |
2554 | 340k | rt_sf->use_nonrd_pick_mode = 0; |
2555 | 340k | rt_sf->discount_color_cost = 0; |
2556 | 340k | rt_sf->use_nonrd_altref_frame = 0; |
2557 | 340k | rt_sf->use_comp_ref_nonrd = 0; |
2558 | 340k | rt_sf->use_real_time_ref_set = 0; |
2559 | 340k | rt_sf->short_circuit_low_temp_var = 0; |
2560 | 340k | rt_sf->reuse_inter_pred_nonrd = 0; |
2561 | 340k | rt_sf->num_inter_modes_for_tx_search = INT_MAX; |
2562 | 340k | rt_sf->use_nonrd_filter_search = 0; |
2563 | 340k | rt_sf->use_simple_rd_model = 0; |
2564 | 340k | rt_sf->hybrid_intra_pickmode = 0; |
2565 | 340k | rt_sf->prune_palette_search_nonrd = 0; |
2566 | 340k | rt_sf->source_metrics_sb_nonrd = 0; |
2567 | 340k | rt_sf->overshoot_detection_cbr = NO_DETECTION; |
2568 | 340k | rt_sf->check_scene_detection = 0; |
2569 | 340k | rt_sf->rc_adjust_keyframe = 0; |
2570 | 340k | rt_sf->rc_compute_spatial_var_sc_kf = 0; |
2571 | 340k | rt_sf->prefer_large_partition_blocks = 0; |
2572 | 340k | rt_sf->use_temporal_noise_estimate = 0; |
2573 | 340k | rt_sf->fullpel_search_step_param = 0; |
2574 | 5.78M | for (int i = 0; i < BLOCK_SIZES; ++i) |
2575 | 5.44M | rt_sf->intra_y_mode_bsize_mask_nrd[i] = INTRA_ALL; |
2576 | 340k | rt_sf->prune_hv_pred_modes_using_src_sad = false; |
2577 | 340k | rt_sf->nonrd_aggressive_skip = 0; |
2578 | 340k | rt_sf->skip_cdef_sb = 0; |
2579 | 340k | rt_sf->force_large_partition_blocks_intra = 0; |
2580 | 340k | rt_sf->skip_tx_no_split_var_based_partition = 0; |
2581 | 340k | rt_sf->skip_newmv_mode_based_on_sse = 0; |
2582 | 340k | rt_sf->gf_length_lvl = 0; |
2583 | 340k | rt_sf->prune_inter_modes_with_golden_ref = 0; |
2584 | 340k | rt_sf->prune_inter_modes_wrt_gf_arf_based_on_sad = 0; |
2585 | 340k | rt_sf->prune_inter_modes_using_temp_var = 0; |
2586 | 340k | rt_sf->reduce_mv_pel_precision_highmotion = 0; |
2587 | 340k | rt_sf->reduce_mv_pel_precision_lowcomplex = 0; |
2588 | 340k | rt_sf->prune_intra_mode_based_on_mv_range = 0; |
2589 | 340k | rt_sf->var_part_split_threshold_shift = 7; |
2590 | 340k | rt_sf->gf_refresh_based_on_qp = 0; |
2591 | 340k | rt_sf->use_rtc_tf = 0; |
2592 | 340k | rt_sf->use_idtx_nonrd = 0; |
2593 | 340k | rt_sf->prune_idtx_nonrd = 0; |
2594 | 340k | rt_sf->dct_only_palette_nonrd = 0; |
2595 | 340k | rt_sf->part_early_exit_zeromv = 0; |
2596 | 340k | rt_sf->sse_early_term_inter_search = EARLY_TERM_DISABLED; |
2597 | 340k | rt_sf->skip_lf_screen = 0; |
2598 | 340k | rt_sf->thresh_active_maps_skip_lf_cdef = 100; |
2599 | 340k | rt_sf->sad_based_adp_altref_lag = 0; |
2600 | 340k | rt_sf->partition_direct_merging = 0; |
2601 | 340k | rt_sf->var_part_based_on_qidx = 0; |
2602 | 340k | rt_sf->tx_size_level_based_on_qstep = 0; |
2603 | 340k | rt_sf->vbp_prune_16x16_split_using_min_max_sub_blk_var = false; |
2604 | 340k | rt_sf->prune_compoundmode_with_singlecompound_var = false; |
2605 | 340k | rt_sf->frame_level_mode_cost_update = false; |
2606 | 340k | rt_sf->prune_h_pred_using_best_mode_so_far = false; |
2607 | 340k | rt_sf->enable_intra_mode_pruning_using_neighbors = false; |
2608 | 340k | rt_sf->prune_intra_mode_using_best_sad_so_far = false; |
2609 | 340k | rt_sf->check_only_zero_zeromv_on_large_blocks = false; |
2610 | 340k | rt_sf->disable_cdf_update_non_reference_frame = false; |
2611 | 340k | rt_sf->prune_compoundmode_with_singlemode_var = false; |
2612 | 340k | rt_sf->skip_compound_based_on_var = false; |
2613 | 340k | rt_sf->set_zeromv_skip_based_on_source_sad = 1; |
2614 | 340k | rt_sf->use_adaptive_subpel_search = false; |
2615 | 340k | rt_sf->screen_content_cdef_filter_qindex_thresh = 0; |
2616 | 340k | rt_sf->enable_ref_short_signaling = false; |
2617 | 340k | rt_sf->check_globalmv_on_single_ref = true; |
2618 | 340k | rt_sf->increase_color_thresh_palette = false; |
2619 | 340k | rt_sf->selective_cdf_update = 0; |
2620 | 340k | rt_sf->force_only_last_ref = 0; |
2621 | 340k | rt_sf->higher_thresh_scene_detection = 1; |
2622 | 340k | rt_sf->skip_newmv_flat_blocks_screen = 0; |
2623 | 340k | rt_sf->skip_encoding_non_reference_slide_change = 0; |
2624 | 340k | rt_sf->rc_faster_convergence_static = 0; |
2625 | 340k | rt_sf->skip_newmv_mode_sad_screen = 0; |
2626 | 340k | } |
2627 | | |
2628 | | static fractional_mv_step_fp |
2629 | | *const fractional_mv_search[SUBPEL_SEARCH_METHODS] = { |
2630 | | av1_find_best_sub_pixel_tree, // SUBPEL_TREE = 0 |
2631 | | av1_find_best_sub_pixel_tree_pruned, // SUBPEL_TREE_PRUNED = 1 |
2632 | | av1_find_best_sub_pixel_tree_pruned_more // SUBPEL_TREE_PRUNED_MORE = 2 |
2633 | | }; |
2634 | | |
2635 | | // Populate appropriate sub-pel search method based on speed feature and user |
2636 | | // specified settings |
2637 | | static void set_subpel_search_method( |
2638 | | MotionVectorSearchParams *mv_search_params, |
2639 | | unsigned int motion_vector_unit_test, |
2640 | 770k | SUBPEL_SEARCH_METHOD subpel_search_method) { |
2641 | 770k | assert(subpel_search_method <= SUBPEL_TREE_PRUNED_MORE); |
2642 | 770k | mv_search_params->find_fractional_mv_step = |
2643 | 770k | fractional_mv_search[subpel_search_method]; |
2644 | | |
2645 | | // This is only used in motion vector unit test. |
2646 | 770k | if (motion_vector_unit_test == 1) |
2647 | 0 | mv_search_params->find_fractional_mv_step = av1_return_max_sub_pixel_mv; |
2648 | 770k | else if (motion_vector_unit_test == 2) |
2649 | 0 | mv_search_params->find_fractional_mv_step = av1_return_min_sub_pixel_mv; |
2650 | 770k | } |
2651 | | |
2652 | 322k | void av1_set_speed_features_framesize_dependent(AV1_COMP *cpi, int speed) { |
2653 | 322k | SPEED_FEATURES *const sf = &cpi->sf; |
2654 | 322k | const AV1EncoderConfig *const oxcf = &cpi->oxcf; |
2655 | | |
2656 | 322k | switch (oxcf->mode) { |
2657 | 74.4k | case GOOD: |
2658 | 74.4k | set_good_speed_feature_framesize_dependent(cpi, sf, speed); |
2659 | 74.4k | break; |
2660 | 213k | case ALLINTRA: |
2661 | 213k | set_allintra_speed_feature_framesize_dependent(cpi, sf, speed); |
2662 | 213k | break; |
2663 | 34.7k | case REALTIME: |
2664 | 34.7k | set_rt_speed_feature_framesize_dependent(cpi, sf, speed); |
2665 | 34.7k | break; |
2666 | 322k | } |
2667 | | |
2668 | 322k | if (!cpi->ppi->seq_params_locked) { |
2669 | 284k | cpi->common.seq_params->enable_masked_compound &= |
2670 | 284k | !sf->inter_sf.disable_masked_comp; |
2671 | 284k | cpi->common.seq_params->enable_interintra_compound &= |
2672 | 284k | (sf->inter_sf.disable_interintra_wedge_var_thresh != UINT_MAX); |
2673 | 284k | } |
2674 | | |
2675 | 322k | set_subpel_search_method(&cpi->mv_search_params, |
2676 | 322k | cpi->oxcf.unit_test_cfg.motion_vector_unit_test, |
2677 | 322k | sf->mv_sf.subpel_search_method); |
2678 | | |
2679 | | // For multi-thread use case with row_mt enabled, cost update for a set of |
2680 | | // SB rows is not desirable. Hence, the sf mv_cost_upd_level is set to |
2681 | | // INTERNAL_COST_UPD_SBROW in such cases. |
2682 | 322k | if ((cpi->oxcf.row_mt == 1) && (cpi->mt_info.num_workers > 1)) { |
2683 | 84.0k | if (sf->inter_sf.mv_cost_upd_level == INTERNAL_COST_UPD_SBROW_SET) { |
2684 | | // Set mv_cost_upd_level to use row level update. |
2685 | 22.3k | sf->inter_sf.mv_cost_upd_level = INTERNAL_COST_UPD_SBROW; |
2686 | 22.3k | } |
2687 | 84.0k | } |
2688 | 322k | } |
2689 | | |
2690 | 340k | void av1_set_speed_features_framesize_independent(AV1_COMP *cpi, int speed) { |
2691 | 340k | SPEED_FEATURES *const sf = &cpi->sf; |
2692 | 340k | WinnerModeParams *const winner_mode_params = &cpi->winner_mode_params; |
2693 | 340k | const AV1EncoderConfig *const oxcf = &cpi->oxcf; |
2694 | 340k | int i; |
2695 | | |
2696 | 340k | init_hl_sf(&sf->hl_sf); |
2697 | 340k | init_fp_sf(&sf->fp_sf); |
2698 | 340k | init_tpl_sf(&sf->tpl_sf); |
2699 | 340k | init_gm_sf(&sf->gm_sf); |
2700 | 340k | init_part_sf(&sf->part_sf); |
2701 | 340k | init_mv_sf(&sf->mv_sf); |
2702 | 340k | init_inter_sf(&sf->inter_sf); |
2703 | 340k | init_interp_sf(&sf->interp_sf); |
2704 | 340k | init_intra_sf(&sf->intra_sf); |
2705 | 340k | init_tx_sf(&sf->tx_sf); |
2706 | 340k | init_rd_sf(&sf->rd_sf, oxcf); |
2707 | 340k | init_winner_mode_sf(&sf->winner_mode_sf); |
2708 | 340k | init_lpf_sf(&sf->lpf_sf); |
2709 | 340k | init_rt_sf(&sf->rt_sf); |
2710 | | |
2711 | 340k | switch (oxcf->mode) { |
2712 | 91.8k | case GOOD: |
2713 | 91.8k | set_good_speed_features_framesize_independent(cpi, sf, speed); |
2714 | 91.8k | break; |
2715 | 213k | case ALLINTRA: |
2716 | 213k | set_allintra_speed_features_framesize_independent(cpi, sf, speed); |
2717 | 213k | break; |
2718 | 34.7k | case REALTIME: |
2719 | 34.7k | set_rt_speed_features_framesize_independent(cpi, sf, speed); |
2720 | 34.7k | break; |
2721 | 340k | } |
2722 | | |
2723 | | // Note: when use_nonrd_pick_mode is true, the transform size is the |
2724 | | // minimum of 16x16 and the largest possible size of the current block, |
2725 | | // which conflicts with the speed feature "enable_tx_size_search". |
2726 | 340k | if (!oxcf->txfm_cfg.enable_tx_size_search && |
2727 | 0 | sf->rt_sf.use_nonrd_pick_mode == 0) { |
2728 | 0 | sf->winner_mode_sf.tx_size_search_level = 3; |
2729 | 0 | } |
2730 | | |
2731 | 340k | if (cpi->mt_info.num_workers > 1) { |
2732 | | // Loop restoration stage is conditionally disabled for speed 5, 6 when |
2733 | | // num_workers > 1. Since av1_pick_filter_restoration() is not |
2734 | | // multi-threaded, enabling the Loop restoration stage will cause an |
2735 | | // increase in encode time (3% to 7% increase depends on frame |
2736 | | // resolution). |
2737 | | // TODO(aomedia:3446): Implement multi-threading of |
2738 | | // av1_pick_filter_restoration() and enable Wiener filter for speed 5, 6 |
2739 | | // similar to single thread encoding path. |
2740 | 95.0k | if (speed >= 5) { |
2741 | 95.0k | sf->lpf_sf.disable_sgr_filter = true; |
2742 | 95.0k | sf->lpf_sf.disable_wiener_filter = true; |
2743 | 95.0k | } |
2744 | 95.0k | } |
2745 | | |
2746 | 340k | if (!cpi->ppi->seq_params_locked) { |
2747 | 302k | cpi->common.seq_params->order_hint_info.enable_dist_wtd_comp &= |
2748 | 302k | (sf->inter_sf.use_dist_wtd_comp_flag != DIST_WTD_COMP_DISABLED); |
2749 | 302k | cpi->common.seq_params->enable_dual_filter &= |
2750 | 302k | !sf->interp_sf.disable_dual_filter; |
2751 | | // Set the flag 'enable_restoration', if one the Loop restoration filters |
2752 | | // (i.e., Wiener or Self-guided) is enabled. |
2753 | 302k | cpi->common.seq_params->enable_restoration &= |
2754 | 302k | (!sf->lpf_sf.disable_wiener_filter || !sf->lpf_sf.disable_sgr_filter); |
2755 | | |
2756 | 302k | cpi->common.seq_params->enable_interintra_compound &= |
2757 | 302k | (sf->inter_sf.disable_interintra_wedge_var_thresh != UINT_MAX); |
2758 | 302k | } |
2759 | | |
2760 | 340k | const int mesh_speed = AOMMIN(speed, MAX_MESH_SPEED); |
2761 | 1.70M | for (i = 0; i < MAX_MESH_STEP; ++i) { |
2762 | 1.36M | sf->mv_sf.mesh_patterns[i].range = |
2763 | 1.36M | good_quality_mesh_patterns[mesh_speed][i].range; |
2764 | 1.36M | sf->mv_sf.mesh_patterns[i].interval = |
2765 | 1.36M | good_quality_mesh_patterns[mesh_speed][i].interval; |
2766 | 1.36M | } |
2767 | | |
2768 | | // Update the mesh pattern of exhaustive motion search for intraBC |
2769 | | // Though intraBC mesh pattern is populated for all frame types, it is used |
2770 | | // only for intra frames of screen contents |
2771 | 1.70M | for (i = 0; i < MAX_MESH_STEP; ++i) { |
2772 | 1.36M | sf->mv_sf.intrabc_mesh_patterns[i].range = |
2773 | 1.36M | intrabc_mesh_patterns[mesh_speed][i].range; |
2774 | 1.36M | sf->mv_sf.intrabc_mesh_patterns[i].interval = |
2775 | 1.36M | intrabc_mesh_patterns[mesh_speed][i].interval; |
2776 | 1.36M | } |
2777 | | |
2778 | | // Slow quant, dct and trellis not worthwhile for first pass |
2779 | | // so make sure they are always turned off. |
2780 | 340k | if (is_stat_generation_stage(cpi)) |
2781 | 29.9k | sf->rd_sf.optimize_coefficients = NO_TRELLIS_OPT; |
2782 | | |
2783 | | // No recode for 1 pass. |
2784 | 340k | if (oxcf->pass == AOM_RC_ONE_PASS && has_no_stats_stage(cpi)) |
2785 | 279k | sf->hl_sf.recode_loop = DISALLOW_RECODE; |
2786 | | |
2787 | 340k | set_subpel_search_method(&cpi->mv_search_params, |
2788 | 340k | cpi->oxcf.unit_test_cfg.motion_vector_unit_test, |
2789 | 340k | sf->mv_sf.subpel_search_method); |
2790 | | |
2791 | | // assert ensures that tx_domain_dist_level is accessed correctly |
2792 | 340k | assert(cpi->sf.rd_sf.tx_domain_dist_thres_level >= 0 && |
2793 | 340k | cpi->sf.rd_sf.tx_domain_dist_thres_level < 4); |
2794 | 340k | memcpy(winner_mode_params->tx_domain_dist_threshold, |
2795 | 340k | tx_domain_dist_thresholds[cpi->sf.rd_sf.tx_domain_dist_thres_level], |
2796 | 340k | sizeof(winner_mode_params->tx_domain_dist_threshold)); |
2797 | | |
2798 | 340k | assert(cpi->sf.rd_sf.tx_domain_dist_level >= 0 && |
2799 | 340k | cpi->sf.rd_sf.tx_domain_dist_level < TX_DOMAIN_DIST_LEVELS); |
2800 | 340k | memcpy(winner_mode_params->use_transform_domain_distortion, |
2801 | 340k | tx_domain_dist_types[cpi->sf.rd_sf.tx_domain_dist_level], |
2802 | 340k | sizeof(winner_mode_params->use_transform_domain_distortion)); |
2803 | | |
2804 | | // assert ensures that coeff_opt_thresholds is accessed correctly |
2805 | 340k | assert(cpi->sf.rd_sf.perform_coeff_opt >= 0 && |
2806 | 340k | cpi->sf.rd_sf.perform_coeff_opt < 9); |
2807 | 340k | memcpy(winner_mode_params->coeff_opt_thresholds, |
2808 | 340k | &coeff_opt_thresholds[cpi->sf.rd_sf.perform_coeff_opt], |
2809 | 340k | sizeof(winner_mode_params->coeff_opt_thresholds)); |
2810 | | |
2811 | | // assert ensures that predict_skip_levels is accessed correctly |
2812 | 340k | assert(cpi->sf.tx_sf.tx_type_search.use_skip_flag_prediction >= 0 && |
2813 | 340k | cpi->sf.tx_sf.tx_type_search.use_skip_flag_prediction < 3); |
2814 | 340k | memcpy(winner_mode_params->skip_txfm_level, |
2815 | 340k | predict_skip_levels[cpi->sf.tx_sf.tx_type_search |
2816 | 340k | .use_skip_flag_prediction], |
2817 | 340k | sizeof(winner_mode_params->skip_txfm_level)); |
2818 | | |
2819 | | // assert ensures that tx_size_search_level is accessed correctly |
2820 | 340k | assert(cpi->sf.winner_mode_sf.tx_size_search_level >= 0 && |
2821 | 340k | cpi->sf.winner_mode_sf.tx_size_search_level <= 3); |
2822 | 340k | memcpy(winner_mode_params->tx_size_search_methods, |
2823 | 340k | tx_size_search_methods[cpi->sf.winner_mode_sf.tx_size_search_level], |
2824 | 340k | sizeof(winner_mode_params->tx_size_search_methods)); |
2825 | 340k | memcpy(winner_mode_params->predict_dc_level, |
2826 | 340k | predict_dc_levels[cpi->sf.winner_mode_sf.dc_blk_pred_level], |
2827 | 340k | sizeof(winner_mode_params->predict_dc_level)); |
2828 | | |
2829 | 340k | if (cpi->oxcf.row_mt == 1 && (cpi->mt_info.num_workers > 1)) { |
2830 | 95.0k | if (sf->inter_sf.inter_mode_rd_model_estimation == 1) { |
2831 | | // Revert to type 2 |
2832 | 33.3k | sf->inter_sf.inter_mode_rd_model_estimation = 2; |
2833 | 33.3k | } |
2834 | | |
2835 | 95.0k | #if !CONFIG_FPMT_TEST |
2836 | | // Disable the speed feature 'prune_ref_frame_for_gm_search' to achieve |
2837 | | // better parallelism when number of threads available are greater than or |
2838 | | // equal to maximum number of reference frames allowed for global motion. |
2839 | 95.0k | if (sf->gm_sf.gm_search_type != GM_DISABLE_SEARCH && |
2840 | 82.8k | (cpi->mt_info.num_workers >= |
2841 | 82.8k | gm_available_reference_frames[sf->gm_sf.gm_search_type])) |
2842 | 57.3k | sf->gm_sf.prune_ref_frame_for_gm_search = 0; |
2843 | 95.0k | #endif |
2844 | 95.0k | } |
2845 | | |
2846 | | // This only applies to the real time mode. Adaptive gf refresh is disabled if |
2847 | | // gf_cbr_boost_pct that is set by the user is larger than 0. |
2848 | 340k | if (cpi->oxcf.rc_cfg.gf_cbr_boost_pct > 0) |
2849 | 0 | sf->rt_sf.gf_refresh_based_on_qp = 0; |
2850 | 340k | } |
2851 | | |
2852 | | // Override some speed features for low complexity decode based on qindex. |
2853 | | static void set_good_speed_features_lc_dec_qindex_dependent( |
2854 | 0 | const AV1_COMP *const cpi, SPEED_FEATURES *const sf, int speed) { |
2855 | 0 | if (speed < 1 || speed > 3) return; |
2856 | | |
2857 | 0 | const AV1_COMMON *const cm = &cpi->common; |
2858 | 0 | const bool is_between_608p_and_1080p = AOMMIN(cm->width, cm->height) >= 608 && |
2859 | 0 | AOMMIN(cm->width, cm->height) <= 1080; |
2860 | 0 | const bool is_vertical_video = cm->width < cm->height; |
2861 | | |
2862 | | // Need to study the decoder time impact. |
2863 | 0 | sf->interp_sf.use_more_sharp_interp = 0; |
2864 | | |
2865 | | // Speed features for vertical videos |
2866 | 0 | if (is_vertical_video && is_between_608p_and_1080p) { |
2867 | 0 | sf->lpf_sf.min_lr_unit_size = RESTORATION_UNITSIZE_MAX >> 1; |
2868 | 0 | sf->lpf_sf.max_lr_unit_size = RESTORATION_UNITSIZE_MAX >> 1; |
2869 | 0 | } |
2870 | 0 | } |
2871 | | |
2872 | | // Override some speed features based on qindex |
2873 | 128k | void av1_set_speed_features_qindex_dependent(AV1_COMP *cpi, int speed) { |
2874 | 128k | AV1_COMMON *const cm = &cpi->common; |
2875 | 128k | SPEED_FEATURES *const sf = &cpi->sf; |
2876 | 128k | WinnerModeParams *const winner_mode_params = &cpi->winner_mode_params; |
2877 | 128k | const int boosted = frame_is_boosted(cpi); |
2878 | 128k | const int is_480p_or_lesser = AOMMIN(cm->width, cm->height) <= 480; |
2879 | 128k | const int is_480p_or_larger = AOMMIN(cm->width, cm->height) >= 480; |
2880 | 128k | const int is_720p_or_larger = AOMMIN(cm->width, cm->height) >= 720; |
2881 | 128k | const int is_1080p_or_larger = AOMMIN(cm->width, cm->height) >= 1080; |
2882 | 128k | const int is_1440p_or_larger = AOMMIN(cm->width, cm->height) >= 1440; |
2883 | 128k | const int is_arf2_bwd_type = |
2884 | 128k | cpi->ppi->gf_group.update_type[cpi->gf_frame_index] == INTNL_ARF_UPDATE; |
2885 | | |
2886 | 128k | if (cpi->oxcf.mode == ALLINTRA || cpi->oxcf.tune_cfg.tuning == AOM_TUNE_IQ || |
2887 | 71.1k | cpi->oxcf.tune_cfg.tuning == AOM_TUNE_SSIMULACRA2) { |
2888 | 71.1k | if (cm->quant_params.base_qindex <= 140) { |
2889 | 33.6k | sf->lpf_sf.zero_low_cdef_strengths = 1; |
2890 | 33.6k | } |
2891 | 71.1k | } |
2892 | | |
2893 | 128k | if (cpi->oxcf.mode == REALTIME) { |
2894 | 20.7k | if (speed >= 6) { |
2895 | 20.7k | const int qindex_thresh = boosted ? 190 : (is_720p_or_larger ? 120 : 150); |
2896 | 20.7k | sf->part_sf.adjust_var_based_rd_partitioning = |
2897 | 20.7k | frame_is_intra_only(cm) |
2898 | 20.7k | ? 0 |
2899 | 20.7k | : cm->quant_params.base_qindex > qindex_thresh; |
2900 | 20.7k | } |
2901 | 20.7k | return; |
2902 | 20.7k | } |
2903 | | |
2904 | 107k | if (speed == 0) { |
2905 | | // qindex_thresh for resolution < 720p |
2906 | 0 | const int qindex_thresh = boosted ? 70 : (is_arf2_bwd_type ? 110 : 140); |
2907 | 0 | if (!is_720p_or_larger && cm->quant_params.base_qindex <= qindex_thresh) { |
2908 | 0 | sf->part_sf.simple_motion_search_split = |
2909 | 0 | cm->features.allow_screen_content_tools ? 1 : 2; |
2910 | 0 | sf->part_sf.simple_motion_search_early_term_none = 1; |
2911 | 0 | sf->tx_sf.model_based_prune_tx_search_level = 0; |
2912 | 0 | } |
2913 | |
|
2914 | 0 | if (is_720p_or_larger && cm->quant_params.base_qindex <= 128) { |
2915 | 0 | sf->rd_sf.perform_coeff_opt = 2 + is_1080p_or_larger; |
2916 | 0 | memcpy(winner_mode_params->coeff_opt_thresholds, |
2917 | 0 | &coeff_opt_thresholds[sf->rd_sf.perform_coeff_opt], |
2918 | 0 | sizeof(winner_mode_params->coeff_opt_thresholds)); |
2919 | 0 | sf->part_sf.simple_motion_search_split = |
2920 | 0 | cm->features.allow_screen_content_tools ? 1 : 2; |
2921 | 0 | sf->tx_sf.inter_tx_size_search_init_depth_rect = 1; |
2922 | 0 | sf->tx_sf.inter_tx_size_search_init_depth_sqr = 1; |
2923 | 0 | sf->tx_sf.intra_tx_size_search_init_depth_rect = 1; |
2924 | 0 | sf->tx_sf.model_based_prune_tx_search_level = 0; |
2925 | |
|
2926 | 0 | if (is_1080p_or_larger && cm->quant_params.base_qindex <= 108) { |
2927 | 0 | sf->inter_sf.selective_ref_frame = 2; |
2928 | 0 | sf->rd_sf.tx_domain_dist_level = boosted ? 1 : 2; |
2929 | 0 | sf->rd_sf.tx_domain_dist_thres_level = 1; |
2930 | 0 | sf->part_sf.simple_motion_search_early_term_none = 1; |
2931 | 0 | sf->tx_sf.tx_type_search.ml_tx_split_thresh = 4000; |
2932 | 0 | sf->interp_sf.cb_pred_filter_search = 0; |
2933 | 0 | sf->tx_sf.tx_type_search.prune_2d_txfm_mode = TX_TYPE_PRUNE_2; |
2934 | 0 | sf->tx_sf.tx_type_search.skip_tx_search = 1; |
2935 | 0 | } |
2936 | 0 | } |
2937 | 0 | } |
2938 | | |
2939 | 107k | if (speed >= 2) { |
2940 | | // Disable extended partitions for lower quantizers |
2941 | 107k | const int aggr = AOMMIN(4, speed - 2); |
2942 | 107k | const int qindex_thresh1[4] = { 50, 50, 80, 100 }; |
2943 | 107k | const int qindex_thresh2[4] = { 80, 100, 120, 160 }; |
2944 | 107k | int qindex_thresh; |
2945 | 107k | if (aggr <= 1) { |
2946 | 0 | const int qthresh2 = |
2947 | 0 | (!aggr && !is_480p_or_larger) ? 70 : qindex_thresh2[aggr]; |
2948 | 0 | qindex_thresh = cm->features.allow_screen_content_tools |
2949 | 0 | ? qindex_thresh1[aggr] |
2950 | 0 | : qthresh2; |
2951 | 0 | if (cm->quant_params.base_qindex <= qindex_thresh && !boosted) |
2952 | 0 | sf->part_sf.ext_partition_eval_thresh = BLOCK_128X128; |
2953 | 107k | } else if (aggr <= 2) { |
2954 | 0 | qindex_thresh = boosted ? qindex_thresh1[aggr] : qindex_thresh2[aggr]; |
2955 | 0 | if (cm->quant_params.base_qindex <= qindex_thresh && |
2956 | 0 | !frame_is_intra_only(cm)) |
2957 | 0 | sf->part_sf.ext_partition_eval_thresh = BLOCK_128X128; |
2958 | 107k | } else if (aggr <= 3) { |
2959 | 0 | if (!is_480p_or_larger) { |
2960 | 0 | sf->part_sf.ext_partition_eval_thresh = BLOCK_128X128; |
2961 | 0 | } else if (!is_720p_or_larger && !frame_is_intra_only(cm) && |
2962 | 0 | !cm->features.allow_screen_content_tools) { |
2963 | 0 | sf->part_sf.ext_partition_eval_thresh = BLOCK_128X128; |
2964 | 0 | } else { |
2965 | 0 | qindex_thresh = boosted ? qindex_thresh1[aggr] : qindex_thresh2[aggr]; |
2966 | 0 | if (cm->quant_params.base_qindex <= qindex_thresh && |
2967 | 0 | !frame_is_intra_only(cm)) |
2968 | 0 | sf->part_sf.ext_partition_eval_thresh = BLOCK_128X128; |
2969 | 0 | } |
2970 | 107k | } else { |
2971 | 107k | sf->part_sf.ext_partition_eval_thresh = BLOCK_128X128; |
2972 | 107k | } |
2973 | 107k | } |
2974 | | |
2975 | 107k | if (speed >= 3) { |
2976 | | // Disable rectangular partitions for lower quantizers |
2977 | 107k | const int aggr = (speed <= 4) ? 0 : 1; |
2978 | 107k | const int qindex_thresh[2] = { 65, 80 }; |
2979 | 107k | int disable_rect_part; |
2980 | 107k | disable_rect_part = !boosted; |
2981 | 107k | if (cm->quant_params.base_qindex <= qindex_thresh[aggr] && |
2982 | 28.0k | disable_rect_part && is_480p_or_larger) { |
2983 | 0 | sf->part_sf.rect_partition_eval_thresh = BLOCK_8X8; |
2984 | 0 | } |
2985 | 107k | } |
2986 | | |
2987 | 107k | if (speed <= 2) { |
2988 | 0 | if (!is_stat_generation_stage(cpi)) { |
2989 | | // Use faster full-pel motion search for high quantizers. |
2990 | | // Also use reduced total search range for low resolutions at high |
2991 | | // quantizers. |
2992 | 0 | const int aggr = speed; |
2993 | | |
2994 | | // For < 720p resolutions: |
2995 | 0 | if (!is_720p_or_larger) { |
2996 | | // For < 720p resolutions: |
2997 | 0 | const int ms_qindex_thresh[3][2] = { { 200, 70 }, |
2998 | 0 | { 170, 50 }, |
2999 | 0 | { 170, 40 } }; |
3000 | 0 | const int qindex_thresh1 = ms_qindex_thresh[aggr][0]; |
3001 | 0 | const int qindex_thresh2 = ms_qindex_thresh[aggr][1]; |
3002 | 0 | if (cm->quant_params.base_qindex > qindex_thresh1) { |
3003 | 0 | sf->mv_sf.search_method = CLAMPED_DIAMOND; |
3004 | 0 | sf->tpl_sf.search_method = CLAMPED_DIAMOND; |
3005 | 0 | } else if (cm->quant_params.base_qindex > qindex_thresh2) { |
3006 | 0 | sf->mv_sf.search_method = NSTEP_8PT; |
3007 | 0 | } |
3008 | 0 | } else { |
3009 | | // For >= 720p resolutions: |
3010 | 0 | const int ms_qindex_thresh[3][2] = { { MAXQ, 200 }, |
3011 | 0 | { MAXQ, -1 }, |
3012 | 0 | { 200, -1 } }; |
3013 | 0 | const SEARCH_METHODS motion_search_method[3][2] = { |
3014 | 0 | { NSTEP_8PT, NSTEP_8PT }, |
3015 | 0 | { NSTEP_8PT, DIAMOND }, |
3016 | 0 | { NSTEP_8PT, DIAMOND } |
3017 | 0 | }; |
3018 | 0 | const int qindex_thresh1 = ms_qindex_thresh[aggr][0]; |
3019 | 0 | const int qindex_thresh2 = ms_qindex_thresh[aggr][1]; |
3020 | 0 | if (cm->quant_params.base_qindex > qindex_thresh1) { |
3021 | 0 | sf->mv_sf.search_method = DIAMOND; |
3022 | 0 | sf->tpl_sf.search_method = DIAMOND; |
3023 | 0 | } else if (cm->quant_params.base_qindex > qindex_thresh2) { |
3024 | 0 | sf->mv_sf.search_method = motion_search_method[aggr][0]; |
3025 | 0 | sf->tpl_sf.search_method = motion_search_method[aggr][1]; |
3026 | 0 | } |
3027 | 0 | } |
3028 | 0 | } |
3029 | 0 | sf->part_sf.less_rectangular_check_level = 1; |
3030 | 0 | } |
3031 | | |
3032 | 107k | if (speed == 3) |
3033 | 0 | sf->part_sf.less_rectangular_check_level = |
3034 | 0 | (cm->quant_params.base_qindex >= 170) ? 1 : 2; |
3035 | | |
3036 | 107k | if (speed >= 4) { |
3037 | | // Disable LR search at low and high quantizers and enable only for |
3038 | | // mid-quantizer range. |
3039 | 107k | if (!boosted && !is_arf2_bwd_type) { |
3040 | 14.7k | const int qindex_low[2] = { 100, 60 }; |
3041 | 14.7k | const int qindex_high[2] = { 180, 160 }; |
3042 | 14.7k | if (cm->quant_params.base_qindex <= qindex_low[is_720p_or_larger] || |
3043 | 9.86k | cm->quant_params.base_qindex > qindex_high[is_720p_or_larger]) { |
3044 | 8.54k | sf->lpf_sf.disable_sgr_filter = true; |
3045 | 8.54k | sf->lpf_sf.disable_wiener_coeff_refine_search = true; |
3046 | 8.54k | } |
3047 | 14.7k | } |
3048 | 107k | sf->part_sf.less_rectangular_check_level = 2; |
3049 | 107k | } |
3050 | | |
3051 | 107k | if (speed == 1) { |
3052 | | // Reuse interinter wedge mask search from first search for non-boosted |
3053 | | // non-internal-arf frames, except at very high quantizers. |
3054 | 0 | if (cm->quant_params.base_qindex <= 200) { |
3055 | 0 | if (!boosted && !is_arf2_bwd_type) |
3056 | 0 | sf->inter_sf.reuse_mask_search_results = 1; |
3057 | 0 | } |
3058 | 0 | } |
3059 | | |
3060 | 107k | if (speed == 5) { |
3061 | 0 | if (!(frame_is_intra_only(&cpi->common) || |
3062 | 0 | cm->features.allow_screen_content_tools)) { |
3063 | 0 | const int qindex[2] = { 256, 128 }; |
3064 | | // Set the sf value as 3 for low resolution and |
3065 | | // for higher resolutions with low quantizers. |
3066 | 0 | if (cm->quant_params.base_qindex < qindex[is_480p_or_larger]) |
3067 | 0 | sf->tx_sf.tx_type_search.winner_mode_tx_type_pruning = 3; |
3068 | 0 | } |
3069 | 0 | } |
3070 | | |
3071 | 107k | if (speed >= 5) { |
3072 | | // Disable the sf for low quantizers in case of low resolution screen |
3073 | | // contents. |
3074 | 107k | if (cm->features.allow_screen_content_tools && |
3075 | 7.21k | cm->quant_params.base_qindex < 128 && is_480p_or_lesser) { |
3076 | 3.12k | sf->part_sf.prune_sub_8x8_partition_level = 0; |
3077 | 3.12k | } |
3078 | 107k | } |
3079 | | |
3080 | | // Loop restoration size search |
3081 | | // At speed 0, always search all available sizes for the maximum possible gain |
3082 | 107k | sf->lpf_sf.min_lr_unit_size = RESTORATION_PROC_UNIT_SIZE; |
3083 | 107k | sf->lpf_sf.max_lr_unit_size = RESTORATION_UNITSIZE_MAX; |
3084 | | |
3085 | 107k | if (speed >= 1) { |
3086 | | // For large frames, small restoration units are almost never useful, |
3087 | | // so prune them away |
3088 | 107k | if (is_1440p_or_larger) { |
3089 | 0 | sf->lpf_sf.min_lr_unit_size = RESTORATION_UNITSIZE_MAX; |
3090 | 107k | } else if (is_720p_or_larger) { |
3091 | 0 | sf->lpf_sf.min_lr_unit_size = RESTORATION_UNITSIZE_MAX >> 1; |
3092 | 0 | } |
3093 | 107k | } |
3094 | | |
3095 | 107k | if (speed >= 3 || (cpi->oxcf.mode == ALLINTRA && speed >= 1)) { |
3096 | | // At this speed, a full search is too expensive. Instead, pick a single |
3097 | | // size based on size and qindex. Note that, in general, higher quantizers |
3098 | | // (== lower quality) and larger frames generally want to use larger |
3099 | | // restoration units. |
3100 | 107k | int qindex_thresh = 96; |
3101 | 107k | if (cm->quant_params.base_qindex <= qindex_thresh && !is_1440p_or_larger) { |
3102 | 34.3k | sf->lpf_sf.min_lr_unit_size = RESTORATION_UNITSIZE_MAX >> 1; |
3103 | 34.3k | sf->lpf_sf.max_lr_unit_size = RESTORATION_UNITSIZE_MAX >> 1; |
3104 | 73.5k | } else { |
3105 | 73.5k | sf->lpf_sf.min_lr_unit_size = RESTORATION_UNITSIZE_MAX; |
3106 | 73.5k | sf->lpf_sf.max_lr_unit_size = RESTORATION_UNITSIZE_MAX; |
3107 | 73.5k | } |
3108 | 107k | } |
3109 | | |
3110 | 107k | set_subpel_search_method(&cpi->mv_search_params, |
3111 | 107k | cpi->oxcf.unit_test_cfg.motion_vector_unit_test, |
3112 | 107k | sf->mv_sf.subpel_search_method); |
3113 | | |
3114 | 107k | if (cpi->oxcf.enable_low_complexity_decode && cpi->oxcf.mode == GOOD) |
3115 | 0 | set_good_speed_features_lc_dec_qindex_dependent(cpi, sf, speed); |
3116 | 107k | } |