Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1 | /* |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 2 | * Copyright (c) 2016, Alliance for Open Media. All rights reserved |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 3 | * |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 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. |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 10 | */ |
| 11 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 12 | #ifndef AV1_ENCODER_SPEED_FEATURES_H_ |
| 13 | #define AV1_ENCODER_SPEED_FEATURES_H_ |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 14 | |
| 15 | #include "av1/common/enums.h" |
| 16 | |
| 17 | #ifdef __cplusplus |
| 18 | extern "C" { |
| 19 | #endif |
| 20 | |
| 21 | enum { |
| 22 | INTRA_ALL = (1 << DC_PRED) | (1 << V_PRED) | (1 << H_PRED) | (1 << D45_PRED) | |
| 23 | (1 << D135_PRED) | (1 << D117_PRED) | (1 << D153_PRED) | |
Urvang Joshi | 6be4a54 | 2016-11-03 15:24:05 -0700 | [diff] [blame] | 24 | (1 << D207_PRED) | (1 << D63_PRED) | |
| 25 | #if CONFIG_ALT_INTRA |
| 26 | (1 << SMOOTH_PRED) | |
Urvang Joshi | e6ca8e8 | 2017-03-15 14:57:41 -0700 | [diff] [blame] | 27 | #if CONFIG_SMOOTH_HV |
| 28 | (1 << SMOOTH_V_PRED) | (1 << SMOOTH_H_PRED) | |
| 29 | #endif // CONFIG_SMOOTH_HV |
Urvang Joshi | 6be4a54 | 2016-11-03 15:24:05 -0700 | [diff] [blame] | 30 | #endif // CONFIG_ALT_INTRA |
| 31 | (1 << TM_PRED), |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 32 | INTRA_DC = (1 << DC_PRED), |
| 33 | INTRA_DC_TM = (1 << DC_PRED) | (1 << TM_PRED), |
| 34 | INTRA_DC_H_V = (1 << DC_PRED) | (1 << V_PRED) | (1 << H_PRED), |
| 35 | INTRA_DC_TM_H_V = |
| 36 | (1 << DC_PRED) | (1 << TM_PRED) | (1 << V_PRED) | (1 << H_PRED) |
| 37 | }; |
| 38 | |
| 39 | #if CONFIG_EXT_INTER |
| 40 | enum { |
Zoe Liu | 85b6646 | 2017-04-20 14:28:19 -0700 | [diff] [blame] | 41 | #if CONFIG_COMPOUND_SINGLEREF |
| 42 | // TODO(zoeliu): To further consider following single ref comp modes: |
| 43 | // SR_NEAREST_NEARMV, SR_NEAREST_NEWMV, SR_NEAR_NEWMV, |
| 44 | // SR_ZERO_NEWMV, and SR_NEW_NEWMV. |
| 45 | #endif // CONFIG_COMPOUND_SINGLEREF |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 46 | INTER_ALL = (1 << NEARESTMV) | (1 << NEARMV) | (1 << ZEROMV) | (1 << NEWMV) | |
Debargha Mukherjee | bb6e134 | 2017-04-17 16:05:04 -0700 | [diff] [blame] | 47 | (1 << NEAREST_NEARESTMV) | (1 << NEAR_NEARMV) | (1 << NEW_NEWMV) | |
Zoe Liu | 7f24e1b | 2017-03-17 17:42:05 -0700 | [diff] [blame] | 48 | (1 << NEAREST_NEWMV) | (1 << NEAR_NEWMV) | (1 << NEW_NEARMV) | |
| 49 | (1 << NEW_NEARESTMV) | (1 << ZERO_ZEROMV), |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 50 | INTER_NEAREST = (1 << NEARESTMV) | (1 << NEAREST_NEARESTMV) | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 51 | (1 << NEW_NEARESTMV) | (1 << NEAREST_NEWMV), |
Zoe Liu | 7f24e1b | 2017-03-17 17:42:05 -0700 | [diff] [blame] | 52 | INTER_NEAREST_NEW = (1 << NEARESTMV) | (1 << NEWMV) | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 53 | (1 << NEAREST_NEARESTMV) | (1 << NEW_NEWMV) | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 54 | (1 << NEW_NEARESTMV) | (1 << NEAREST_NEWMV) | |
| 55 | (1 << NEW_NEARMV) | (1 << NEAR_NEWMV), |
| 56 | INTER_NEAREST_ZERO = (1 << NEARESTMV) | (1 << ZEROMV) | |
| 57 | (1 << NEAREST_NEARESTMV) | (1 << ZERO_ZEROMV) | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 58 | (1 << NEAREST_NEWMV) | (1 << NEW_NEARESTMV), |
Debargha Mukherjee | bb6e134 | 2017-04-17 16:05:04 -0700 | [diff] [blame] | 59 | INTER_NEAREST_NEW_ZERO = (1 << NEARESTMV) | (1 << ZEROMV) | (1 << NEWMV) | |
| 60 | (1 << NEAREST_NEARESTMV) | (1 << ZERO_ZEROMV) | |
| 61 | (1 << NEW_NEWMV) | (1 << NEW_NEARESTMV) | |
| 62 | (1 << NEAREST_NEWMV) | (1 << NEW_NEARMV) | |
| 63 | (1 << NEAR_NEWMV), |
| 64 | INTER_NEAREST_NEAR_NEW = (1 << NEARESTMV) | (1 << NEARMV) | (1 << NEWMV) | |
| 65 | (1 << NEAREST_NEARESTMV) | (1 << NEW_NEWMV) | |
| 66 | (1 << NEW_NEARESTMV) | (1 << NEAREST_NEWMV) | |
| 67 | (1 << NEW_NEARMV) | (1 << NEAR_NEWMV) | |
| 68 | (1 << NEAR_NEARMV), |
| 69 | INTER_NEAREST_NEAR_ZERO = (1 << NEARESTMV) | (1 << NEARMV) | (1 << ZEROMV) | |
| 70 | (1 << NEAREST_NEARESTMV) | (1 << ZERO_ZEROMV) | |
| 71 | (1 << NEAREST_NEWMV) | (1 << NEW_NEARESTMV) | |
| 72 | (1 << NEW_NEARMV) | (1 << NEAR_NEWMV) | |
| 73 | (1 << NEAR_NEARMV), |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 74 | }; |
Zoe Liu | 85b6646 | 2017-04-20 14:28:19 -0700 | [diff] [blame] | 75 | #else // !CONFIG_EXT_INTER |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 76 | enum { |
| 77 | INTER_ALL = (1 << NEARESTMV) | (1 << NEARMV) | (1 << ZEROMV) | (1 << NEWMV), |
| 78 | INTER_NEAREST = (1 << NEARESTMV), |
| 79 | INTER_NEAREST_NEW = (1 << NEARESTMV) | (1 << NEWMV), |
| 80 | INTER_NEAREST_ZERO = (1 << NEARESTMV) | (1 << ZEROMV), |
| 81 | INTER_NEAREST_NEW_ZERO = (1 << NEARESTMV) | (1 << ZEROMV) | (1 << NEWMV), |
| 82 | INTER_NEAREST_NEAR_NEW = (1 << NEARESTMV) | (1 << NEARMV) | (1 << NEWMV), |
| 83 | INTER_NEAREST_NEAR_ZERO = (1 << NEARESTMV) | (1 << NEARMV) | (1 << ZEROMV), |
| 84 | }; |
| 85 | #endif // CONFIG_EXT_INTER |
| 86 | |
| 87 | enum { |
| 88 | DISABLE_ALL_INTER_SPLIT = (1 << THR_COMP_GA) | (1 << THR_COMP_LA) | |
| 89 | (1 << THR_ALTR) | (1 << THR_GOLD) | (1 << THR_LAST), |
| 90 | |
| 91 | DISABLE_ALL_SPLIT = (1 << THR_INTRA) | DISABLE_ALL_INTER_SPLIT, |
| 92 | |
| 93 | DISABLE_COMPOUND_SPLIT = (1 << THR_COMP_GA) | (1 << THR_COMP_LA), |
| 94 | |
| 95 | LAST_AND_INTRA_SPLIT_ONLY = (1 << THR_COMP_GA) | (1 << THR_COMP_LA) | |
| 96 | (1 << THR_ALTR) | (1 << THR_GOLD) |
| 97 | }; |
| 98 | |
| 99 | typedef enum { |
| 100 | DIAMOND = 0, |
| 101 | NSTEP = 1, |
| 102 | HEX = 2, |
| 103 | BIGDIA = 3, |
| 104 | SQUARE = 4, |
| 105 | FAST_HEX = 5, |
| 106 | FAST_DIAMOND = 6 |
| 107 | } SEARCH_METHODS; |
| 108 | |
| 109 | typedef enum { |
| 110 | // No recode. |
| 111 | DISALLOW_RECODE = 0, |
| 112 | // Allow recode for KF and exceeding maximum frame bandwidth. |
| 113 | ALLOW_RECODE_KFMAXBW = 1, |
| 114 | // Allow recode only for KF/ARF/GF frames. |
| 115 | ALLOW_RECODE_KFARFGF = 2, |
| 116 | // Allow recode for all frames based on bitrate constraints. |
| 117 | ALLOW_RECODE = 3, |
| 118 | } RECODE_LOOP_TYPE; |
| 119 | |
| 120 | typedef enum { |
| 121 | SUBPEL_TREE = 0, |
| 122 | SUBPEL_TREE_PRUNED = 1, // Prunes 1/2-pel searches |
| 123 | SUBPEL_TREE_PRUNED_MORE = 2, // Prunes 1/2-pel searches more aggressively |
| 124 | SUBPEL_TREE_PRUNED_EVENMORE = 3, // Prunes 1/2- and 1/4-pel searches |
| 125 | // Other methods to come |
| 126 | } SUBPEL_SEARCH_METHODS; |
| 127 | |
| 128 | typedef enum { |
| 129 | NO_MOTION_THRESHOLD = 0, |
| 130 | LOW_MOTION_THRESHOLD = 7 |
| 131 | } MOTION_THRESHOLD; |
| 132 | |
| 133 | typedef enum { |
| 134 | USE_FULL_RD = 0, |
| 135 | USE_LARGESTALL, |
| 136 | USE_TX_8X8 |
| 137 | } TX_SIZE_SEARCH_METHOD; |
| 138 | |
| 139 | typedef enum { |
| 140 | NOT_IN_USE = 0, |
Thomas Daede | 8082614 | 2017-03-20 15:44:24 -0700 | [diff] [blame] | 141 | RELAXED_NEIGHBORING_MIN_MAX = 1 |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 142 | } AUTO_MIN_MAX_MODE; |
| 143 | |
| 144 | typedef enum { |
| 145 | // Try the full image with different values. |
| 146 | LPF_PICK_FROM_FULL_IMAGE, |
| 147 | // Try a small portion of the image with different values. |
| 148 | LPF_PICK_FROM_SUBIMAGE, |
| 149 | // Estimate the level based on quantizer and frame type |
| 150 | LPF_PICK_FROM_Q, |
| 151 | // Pick 0 to disable LPF if LPF was enabled last frame |
| 152 | LPF_PICK_MINIMAL_LPF |
| 153 | } LPF_PICK_METHOD; |
| 154 | |
| 155 | typedef enum { |
| 156 | // Terminate search early based on distortion so far compared to |
| 157 | // qp step, distortion in the neighborhood of the frame, etc. |
| 158 | FLAG_EARLY_TERMINATE = 1 << 0, |
| 159 | |
| 160 | // Skips comp inter modes if the best so far is an intra mode. |
| 161 | FLAG_SKIP_COMP_BESTINTRA = 1 << 1, |
| 162 | |
| 163 | // Skips oblique intra modes if the best so far is an inter mode. |
| 164 | FLAG_SKIP_INTRA_BESTINTER = 1 << 3, |
| 165 | |
| 166 | // Skips oblique intra modes at angles 27, 63, 117, 153 if the best |
| 167 | // intra so far is not one of the neighboring directions. |
| 168 | FLAG_SKIP_INTRA_DIRMISMATCH = 1 << 4, |
| 169 | |
| 170 | // Skips intra modes other than DC_PRED if the source variance is small |
| 171 | FLAG_SKIP_INTRA_LOWVAR = 1 << 5, |
| 172 | } MODE_SEARCH_SKIP_LOGIC; |
| 173 | |
| 174 | typedef enum { |
| 175 | FLAG_SKIP_EIGHTTAP_REGULAR = 1 << EIGHTTAP_REGULAR, |
| 176 | FLAG_SKIP_EIGHTTAP_SMOOTH = 1 << EIGHTTAP_SMOOTH, |
| 177 | FLAG_SKIP_MULTITAP_SHARP = 1 << MULTITAP_SHARP, |
| 178 | } INTERP_FILTER_MASK; |
| 179 | |
| 180 | typedef enum { |
| 181 | NO_PRUNE = 0, |
| 182 | // eliminates one tx type in vertical and horizontal direction |
| 183 | PRUNE_ONE = 1, |
| 184 | #if CONFIG_EXT_TX |
| 185 | // eliminates two tx types in each direction |
| 186 | PRUNE_TWO = 2, |
| 187 | #endif |
| 188 | } TX_TYPE_PRUNE_MODE; |
| 189 | |
| 190 | typedef struct { |
| 191 | TX_TYPE_PRUNE_MODE prune_mode; |
| 192 | int fast_intra_tx_type_search; |
| 193 | int fast_inter_tx_type_search; |
| 194 | } TX_TYPE_SEARCH; |
| 195 | |
| 196 | typedef enum { |
| 197 | // Search partitions using RD criterion |
| 198 | SEARCH_PARTITION, |
| 199 | |
| 200 | // Always use a fixed size partition |
| 201 | FIXED_PARTITION, |
| 202 | |
Thomas Daede | 8ea3319 | 2017-05-10 15:40:06 -0700 | [diff] [blame] | 203 | REFERENCE_PARTITION |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 204 | } PARTITION_SEARCH_TYPE; |
| 205 | |
| 206 | typedef enum { |
| 207 | // Does a dry run to see if any of the contexts need to be updated or not, |
| 208 | // before the final run. |
| 209 | TWO_LOOP = 0, |
| 210 | |
| 211 | // No dry run, also only half the coef contexts and bands are updated. |
| 212 | // The rest are not updated at all. |
| 213 | ONE_LOOP_REDUCED = 1 |
| 214 | } FAST_COEFF_UPDATE; |
| 215 | |
| 216 | typedef struct MV_SPEED_FEATURES { |
| 217 | // Motion search method (Diamond, NSTEP, Hex, Big Diamond, Square, etc). |
| 218 | SEARCH_METHODS search_method; |
| 219 | |
| 220 | // This parameter controls which step in the n-step process we start at. |
| 221 | // It's changed adaptively based on circumstances. |
| 222 | int reduce_first_step_size; |
| 223 | |
| 224 | // If this is set to 1, we limit the motion search range to 2 times the |
| 225 | // largest motion vector found in the last frame. |
| 226 | int auto_mv_step_size; |
| 227 | |
| 228 | // Subpel_search_method can only be subpel_tree which does a subpixel |
| 229 | // logarithmic search that keeps stepping at 1/2 pixel units until |
| 230 | // you stop getting a gain, and then goes on to 1/4 and repeats |
| 231 | // the same process. Along the way it skips many diagonals. |
| 232 | SUBPEL_SEARCH_METHODS subpel_search_method; |
| 233 | |
| 234 | // Maximum number of steps in logarithmic subpel search before giving up. |
| 235 | int subpel_iters_per_step; |
| 236 | |
| 237 | // Control when to stop subpel search |
| 238 | int subpel_force_stop; |
| 239 | |
| 240 | // This variable sets the step_param used in full pel motion search. |
| 241 | int fullpel_search_step_param; |
| 242 | } MV_SPEED_FEATURES; |
| 243 | |
| 244 | #define MAX_MESH_STEP 4 |
| 245 | |
| 246 | typedef struct MESH_PATTERN { |
| 247 | int range; |
| 248 | int interval; |
| 249 | } MESH_PATTERN; |
| 250 | |
Debargha Mukherjee | 2a9d746 | 2017-05-04 17:37:52 -0700 | [diff] [blame] | 251 | #if CONFIG_GLOBAL_MOTION |
| 252 | typedef enum { |
| 253 | GM_FULL_SEARCH, |
| 254 | GM_REDUCED_REF_SEARCH, |
| 255 | GM_DISABLE_SEARCH |
| 256 | } GM_SEARCH_TYPE; |
| 257 | #endif // CONFIG_GLOBAL_MOTION |
| 258 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 259 | typedef struct SPEED_FEATURES { |
| 260 | MV_SPEED_FEATURES mv; |
| 261 | |
| 262 | // Frame level coding parameter update |
| 263 | int frame_parameter_update; |
| 264 | |
| 265 | RECODE_LOOP_TYPE recode_loop; |
| 266 | |
| 267 | // Trellis (dynamic programming) optimization of quantized values (+1, 0). |
| 268 | int optimize_coefficients; |
| 269 | |
| 270 | // Always set to 0. If on it enables 0 cost background transmission |
| 271 | // (except for the initial transmission of the segmentation). The feature is |
| 272 | // disabled because the addition of very large block sizes make the |
| 273 | // backgrounds very to cheap to encode, and the segmentation we have |
| 274 | // adds overhead. |
| 275 | int static_segmentation; |
| 276 | |
| 277 | // If 1 we iterate finding a best reference for 2 ref frames together - via |
| 278 | // a log search that iterates 4 times (check around mv for last for best |
| 279 | // error of combined predictor then check around mv for alt). If 0 we |
| 280 | // we just use the best motion vector found for each frame by itself. |
| 281 | BLOCK_SIZE comp_inter_joint_search_thresh; |
| 282 | |
| 283 | // This variable is used to cap the maximum number of times we skip testing a |
| 284 | // mode to be evaluated. A high value means we will be faster. |
| 285 | int adaptive_rd_thresh; |
| 286 | |
| 287 | // Coefficient probability model approximation step size |
| 288 | int coeff_prob_appx_step; |
| 289 | |
| 290 | // The threshold is to determine how slow the motino is, it is used when |
| 291 | // use_lastframe_partitioning is set to LAST_FRAME_PARTITION_LOW_MOTION |
| 292 | MOTION_THRESHOLD lf_motion_threshold; |
| 293 | |
| 294 | // Determine which method we use to determine transform size. We can choose |
| 295 | // between options like full rd, largest for prediction size, largest |
| 296 | // for intra and model coefs for the rest. |
| 297 | TX_SIZE_SEARCH_METHOD tx_size_search_method; |
| 298 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 299 | // After looking at the first set of modes (set by index here), skip |
| 300 | // checking modes for reference frames that don't match the reference frame |
| 301 | // of the best so far. |
| 302 | int mode_skip_start; |
| 303 | |
| 304 | PARTITION_SEARCH_TYPE partition_search_type; |
| 305 | |
| 306 | TX_TYPE_SEARCH tx_type_search; |
| 307 | |
| 308 | // Used if partition_search_type = FIXED_SIZE_PARTITION |
| 309 | BLOCK_SIZE always_this_block_size; |
| 310 | |
| 311 | // Skip rectangular partition test when partition type none gives better |
| 312 | // rd than partition type split. |
| 313 | int less_rectangular_check; |
| 314 | |
| 315 | // Disable testing non square partitions. (eg 16x32) |
| 316 | int use_square_partition_only; |
| 317 | |
| 318 | // Sets min and max partition sizes for this superblock based on the |
| 319 | // same superblock in last encoded frame, and the left and above neighbor. |
| 320 | AUTO_MIN_MAX_MODE auto_min_max_partition_size; |
| 321 | // Ensures the rd based auto partition search will always |
| 322 | // go down at least to the specified level. |
| 323 | BLOCK_SIZE rd_auto_partition_min_limit; |
| 324 | |
| 325 | // Min and max partition size we enable (block_size) as per auto |
| 326 | // min max, but also used by adjust partitioning, and pick_partitioning. |
| 327 | BLOCK_SIZE default_min_partition_size; |
| 328 | BLOCK_SIZE default_max_partition_size; |
| 329 | |
| 330 | // Whether or not we allow partitions one smaller or one greater than the last |
| 331 | // frame's partitioning. Only used if use_lastframe_partitioning is set. |
| 332 | int adjust_partitioning_from_last_frame; |
| 333 | |
| 334 | // How frequently we re do the partitioning from scratch. Only used if |
| 335 | // use_lastframe_partitioning is set. |
| 336 | int last_partitioning_redo_frequency; |
| 337 | |
| 338 | // Disables sub 8x8 blocksizes in different scenarios: Choices are to disable |
| 339 | // it always, to allow it for only Last frame and Intra, disable it for all |
| 340 | // inter modes or to enable it always. |
| 341 | int disable_split_mask; |
| 342 | |
| 343 | // TODO(jingning): combine the related motion search speed features |
| 344 | // This allows us to use motion search at other sizes as a starting |
| 345 | // point for this motion search and limits the search range around it. |
| 346 | int adaptive_motion_search; |
| 347 | |
| 348 | // Flag for allowing some use of exhaustive searches; |
| 349 | int allow_exhaustive_searches; |
| 350 | |
| 351 | // Threshold for allowing exhaistive motion search. |
| 352 | int exhaustive_searches_thresh; |
| 353 | |
| 354 | // Maximum number of exhaustive searches for a frame. |
| 355 | int max_exaustive_pct; |
| 356 | |
| 357 | // Pattern to be used for any exhaustive mesh searches. |
| 358 | MESH_PATTERN mesh_patterns[MAX_MESH_STEP]; |
| 359 | |
| 360 | int schedule_mode_search; |
| 361 | |
| 362 | // Allows sub 8x8 modes to use the prediction filter that was determined |
| 363 | // best for 8x8 mode. If set to 0 we always re check all the filters for |
| 364 | // sizes less than 8x8, 1 means we check all filter modes if no 8x8 filter |
| 365 | // was selected, and 2 means we use 8 tap if no 8x8 filter mode was selected. |
| 366 | int adaptive_pred_interp_filter; |
| 367 | |
| 368 | // Adaptive prediction mode search |
| 369 | int adaptive_mode_search; |
| 370 | |
| 371 | // Chessboard pattern prediction filter type search |
| 372 | int cb_pred_filter_search; |
| 373 | |
| 374 | int cb_partition_search; |
| 375 | |
| 376 | int alt_ref_search_fp; |
| 377 | |
| 378 | // Use finer quantizer in every other few frames that run variable block |
| 379 | // partition type search. |
| 380 | int force_frame_boost; |
| 381 | |
| 382 | // Maximally allowed base quantization index fluctuation. |
| 383 | int max_delta_qindex; |
| 384 | |
| 385 | // Implements various heuristics to skip searching modes |
| 386 | // The heuristics selected are based on flags |
| 387 | // defined in the MODE_SEARCH_SKIP_HEURISTICS enum |
| 388 | unsigned int mode_search_skip_flags; |
| 389 | |
| 390 | // A source variance threshold below which filter search is disabled |
| 391 | // Choose a very large value (UINT_MAX) to use 8-tap always |
| 392 | unsigned int disable_filter_search_var_thresh; |
| 393 | |
| 394 | #if CONFIG_EXT_INTER |
| 395 | // A source variance threshold below which wedge search is disabled |
| 396 | unsigned int disable_wedge_search_var_thresh; |
| 397 | |
| 398 | // Whether fast wedge sign estimate is used |
| 399 | int fast_wedge_sign_estimate; |
| 400 | #endif // CONFIG_EXT_INTER |
| 401 | |
| 402 | // These bit masks allow you to enable or disable intra modes for each |
| 403 | // transform size separately. |
| 404 | int intra_y_mode_mask[TX_SIZES]; |
| 405 | int intra_uv_mode_mask[TX_SIZES]; |
| 406 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 407 | // This variable enables an early break out of mode testing if the model for |
| 408 | // rd built from the prediction signal indicates a value that's much |
| 409 | // higher than the best rd we've seen so far. |
| 410 | int use_rd_breakout; |
| 411 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 412 | // This feature controls how the loop filter level is determined. |
| 413 | LPF_PICK_METHOD lpf_pick; |
| 414 | |
| 415 | // This feature limits the number of coefficients updates we actually do |
| 416 | // by only looking at counts from 1/2 the bands. |
| 417 | FAST_COEFF_UPDATE use_fast_coef_updates; |
| 418 | |
| 419 | // A binary mask indicating if NEARESTMV, NEARMV, ZEROMV, NEWMV |
| 420 | // modes are used in order from LSB to MSB for each BLOCK_SIZE. |
| 421 | int inter_mode_mask[BLOCK_SIZES]; |
| 422 | |
| 423 | // This feature controls whether we do the expensive context update and |
| 424 | // calculation in the rd coefficient costing loop. |
| 425 | int use_fast_coef_costing; |
| 426 | |
| 427 | // This feature controls the tolerence vs target used in deciding whether to |
| 428 | // recode a frame. It has no meaning if recode is disabled. |
| 429 | int recode_tolerance; |
| 430 | |
| 431 | // This variable controls the maximum block size where intra blocks can be |
| 432 | // used in inter frames. |
| 433 | // TODO(aconverse): Fold this into one of the other many mode skips |
| 434 | BLOCK_SIZE max_intra_bsize; |
| 435 | |
Thomas Daede | 2e30063 | 2017-05-10 15:25:26 -0700 | [diff] [blame] | 436 | // The frequency that we check if |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 437 | // FIXED_PARTITION search type should be used. |
| 438 | int search_type_check_frequency; |
| 439 | |
| 440 | // When partition is pre-set, the inter prediction result from pick_inter_mode |
| 441 | // can be reused in final block encoding process. It is enabled only for real- |
| 442 | // time mode speed 6. |
| 443 | int reuse_inter_pred_sby; |
| 444 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 445 | // default interp filter choice |
James Zern | 7b9407a | 2016-05-18 23:48:05 -0700 | [diff] [blame] | 446 | InterpFilter default_interp_filter; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 447 | |
| 448 | // Early termination in transform size search, which only applies while |
| 449 | // tx_size_search_method is USE_FULL_RD. |
| 450 | int tx_size_search_breakout; |
| 451 | |
| 452 | // adaptive interp_filter search to allow skip of certain filter types. |
| 453 | int adaptive_interp_filter_search; |
| 454 | |
| 455 | // mask for skip evaluation of certain interp_filter type. |
| 456 | INTERP_FILTER_MASK interp_filter_search_mask; |
| 457 | |
| 458 | // Partition search early breakout thresholds. |
| 459 | int64_t partition_search_breakout_dist_thr; |
| 460 | int partition_search_breakout_rate_thr; |
| 461 | |
| 462 | // Allow skipping partition search for still image frame |
| 463 | int allow_partition_search_skip; |
| 464 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 465 | // Fast approximation of av1_model_rd_from_var_lapndz |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 466 | int simple_model_rd_from_var; |
| 467 | |
| 468 | // Do sub-pixel search in up-sampled reference frames |
| 469 | int use_upsampled_references; |
| 470 | |
| 471 | // Whether to compute distortion in the image domain (slower but |
| 472 | // more accurate), or in the transform domain (faster but less acurate). |
| 473 | int use_transform_domain_distortion; |
Debargha Mukherjee | 2a9d746 | 2017-05-04 17:37:52 -0700 | [diff] [blame] | 474 | |
| 475 | #if CONFIG_GLOBAL_MOTION |
| 476 | GM_SEARCH_TYPE gm_search_type; |
| 477 | #endif // CONFIG_GLOBAL_MOTION |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 478 | } SPEED_FEATURES; |
| 479 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 480 | struct AV1_COMP; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 481 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 482 | void av1_set_speed_features_framesize_independent(struct AV1_COMP *cpi); |
| 483 | void av1_set_speed_features_framesize_dependent(struct AV1_COMP *cpi); |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 484 | |
| 485 | #ifdef __cplusplus |
| 486 | } // extern "C" |
| 487 | #endif |
| 488 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 489 | #endif // AV1_ENCODER_SPEED_FEATURES_H_ |