| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 sf->disable_filter_search_var_thresh = 100; | 103 sf->disable_filter_search_var_thresh = 100; |
| 104 sf->comp_inter_joint_search_thresh = BLOCK_SIZES; | 104 sf->comp_inter_joint_search_thresh = BLOCK_SIZES; |
| 105 sf->auto_min_max_partition_size = RELAXED_NEIGHBORING_MIN_MAX; | 105 sf->auto_min_max_partition_size = RELAXED_NEIGHBORING_MIN_MAX; |
| 106 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_LOW_MOTION; | 106 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_LOW_MOTION; |
| 107 sf->adjust_partitioning_from_last_frame = 1; | 107 sf->adjust_partitioning_from_last_frame = 1; |
| 108 } | 108 } |
| 109 | 109 |
| 110 if (speed >= 3) { | 110 if (speed >= 3) { |
| 111 sf->tx_size_search_method = frame_is_intra_only(cm) ? USE_FULL_RD | 111 sf->tx_size_search_method = frame_is_intra_only(cm) ? USE_FULL_RD |
| 112 : USE_LARGESTALL; | 112 : USE_LARGESTALL; |
| 113 if (MIN(cm->width, cm->height) >= 720) | 113 if (MIN(cm->width, cm->height) >= 720) { |
| 114 sf->disable_split_mask = DISABLE_ALL_SPLIT; | 114 sf->disable_split_mask = DISABLE_ALL_SPLIT; |
| 115 else | 115 } else { |
| 116 sf->max_intra_bsize = BLOCK_32X32; |
| 116 sf->disable_split_mask = DISABLE_ALL_INTER_SPLIT; | 117 sf->disable_split_mask = DISABLE_ALL_INTER_SPLIT; |
| 117 | 118 } |
| 118 sf->adaptive_pred_interp_filter = 0; | 119 sf->adaptive_pred_interp_filter = 0; |
| 120 sf->cb_partition_search = frame_is_boosted(cpi) ? 0 : 1; |
| 119 sf->cb_pred_filter_search = 1; | 121 sf->cb_pred_filter_search = 1; |
| 120 | 122 sf->motion_field_mode_search = frame_is_boosted(cpi) ? 0 : 1; |
| 121 sf->lf_motion_threshold = LOW_MOTION_THRESHOLD; | 123 sf->lf_motion_threshold = LOW_MOTION_THRESHOLD; |
| 122 sf->last_partitioning_redo_frequency = 3; | 124 sf->last_partitioning_redo_frequency = 3; |
| 123 sf->recode_loop = ALLOW_RECODE_KFMAXBW; | 125 sf->recode_loop = ALLOW_RECODE_KFMAXBW; |
| 124 sf->adaptive_rd_thresh = 3; | 126 sf->adaptive_rd_thresh = 3; |
| 125 sf->mode_skip_start = 6; | 127 sf->mode_skip_start = 6; |
| 126 sf->use_fast_coef_updates = ONE_LOOP_REDUCED; | 128 sf->intra_y_mode_mask[TX_32X32] = INTRA_DC; |
| 127 sf->use_fast_coef_costing = 1; | 129 sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC; |
| 128 } | 130 } |
| 129 | 131 |
| 130 if (speed >= 4) { | 132 if (speed >= 4) { |
| 131 sf->use_square_partition_only = 1; | 133 sf->use_square_partition_only = 1; |
| 132 sf->tx_size_search_method = USE_LARGESTALL; | 134 sf->tx_size_search_method = USE_LARGESTALL; |
| 133 sf->disable_split_mask = DISABLE_ALL_SPLIT; | 135 sf->disable_split_mask = DISABLE_ALL_SPLIT; |
| 134 sf->adaptive_rd_thresh = 4; | 136 sf->adaptive_rd_thresh = 4; |
| 135 sf->mode_search_skip_flags |= FLAG_SKIP_COMP_REFMISMATCH | | 137 sf->mode_search_skip_flags |= FLAG_SKIP_COMP_REFMISMATCH | |
| 136 FLAG_EARLY_TERMINATE; | 138 FLAG_EARLY_TERMINATE; |
| 137 sf->disable_filter_search_var_thresh = 200; | 139 sf->disable_filter_search_var_thresh = 200; |
| 138 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_ALL; | 140 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_ALL; |
| 139 sf->use_lp32x32fdct = 1; | 141 sf->use_lp32x32fdct = 1; |
| 142 sf->use_fast_coef_updates = ONE_LOOP_REDUCED; |
| 143 sf->use_fast_coef_costing = 1; |
| 140 } | 144 } |
| 141 | 145 |
| 142 if (speed >= 5) { | 146 if (speed >= 5) { |
| 143 int i; | 147 int i; |
| 144 | 148 |
| 145 sf->partition_search_type = FIXED_PARTITION; | 149 sf->partition_search_type = FIXED_PARTITION; |
| 146 sf->optimize_coefficients = 0; | 150 sf->optimize_coefficients = 0; |
| 147 sf->mv.search_method = HEX; | 151 sf->mv.search_method = HEX; |
| 148 sf->disable_filter_search_var_thresh = 500; | 152 sf->disable_filter_search_var_thresh = 500; |
| 149 for (i = 0; i < TX_SIZES; ++i) { | 153 for (i = 0; i < TX_SIZES; ++i) { |
| 150 sf->intra_y_mode_mask[i] = INTRA_DC; | 154 sf->intra_y_mode_mask[i] = INTRA_DC; |
| 151 sf->intra_uv_mode_mask[i] = INTRA_DC; | 155 sf->intra_uv_mode_mask[i] = INTRA_DC; |
| 152 } | 156 } |
| 153 cpi->allow_encode_breakout = ENCODE_BREAKOUT_ENABLED; | 157 cpi->allow_encode_breakout = ENCODE_BREAKOUT_ENABLED; |
| 154 } | 158 } |
| 155 if (speed >= 6) { | 159 if (speed >= 6) { |
| 156 sf->mv.reduce_first_step_size = 1; | 160 sf->mv.reduce_first_step_size = 1; |
| 157 } | 161 } |
| 158 } | 162 } |
| 159 | 163 |
| 160 static void set_rt_speed_feature(VP9_COMP *cpi, SPEED_FEATURES *sf, | 164 static void set_rt_speed_feature(VP9_COMP *cpi, SPEED_FEATURES *sf, |
| 161 int speed) { | 165 int speed, vp9e_tune_content content) { |
| 162 VP9_COMMON *const cm = &cpi->common; | 166 VP9_COMMON *const cm = &cpi->common; |
| 163 const int frames_since_key = | 167 const int frames_since_key = |
| 164 cm->frame_type == KEY_FRAME ? 0 : cpi->rc.frames_since_key; | 168 cm->frame_type == KEY_FRAME ? 0 : cpi->rc.frames_since_key; |
| 165 sf->static_segmentation = 0; | 169 sf->static_segmentation = 0; |
| 166 sf->adaptive_rd_thresh = 1; | 170 sf->adaptive_rd_thresh = 1; |
| 167 sf->use_fast_coef_costing = 1; | 171 sf->use_fast_coef_costing = 1; |
| 168 | 172 |
| 169 if (speed >= 1) { | 173 if (speed >= 1) { |
| 170 sf->use_square_partition_only = !frame_is_intra_only(cm); | 174 sf->use_square_partition_only = !frame_is_intra_only(cm); |
| 171 sf->less_rectangular_check = 1; | 175 sf->less_rectangular_check = 1; |
| 172 sf->tx_size_search_method = frame_is_intra_only(cm) ? USE_FULL_RD | 176 sf->tx_size_search_method = frame_is_intra_only(cm) ? USE_FULL_RD |
| 173 : USE_LARGESTALL; | 177 : USE_LARGESTALL; |
| 174 | 178 |
| 175 if (MIN(cm->width, cm->height) >= 720) | 179 if (MIN(cm->width, cm->height) >= 720) |
| 176 sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT | 180 sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT |
| 177 : DISABLE_ALL_INTER_SPLIT; | 181 : DISABLE_ALL_INTER_SPLIT; |
| 178 else | 182 else |
| 179 sf->disable_split_mask = DISABLE_COMPOUND_SPLIT; | 183 sf->disable_split_mask = DISABLE_COMPOUND_SPLIT; |
| 180 | 184 |
| 181 sf->use_rd_breakout = 1; | 185 sf->use_rd_breakout = 1; |
| 186 |
| 182 sf->adaptive_motion_search = 1; | 187 sf->adaptive_motion_search = 1; |
| 183 sf->adaptive_pred_interp_filter = 1; | 188 sf->adaptive_pred_interp_filter = 1; |
| 184 sf->mv.auto_mv_step_size = 1; | 189 sf->mv.auto_mv_step_size = 1; |
| 185 sf->adaptive_rd_thresh = 2; | 190 sf->adaptive_rd_thresh = 2; |
| 186 sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_H_V; | 191 sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_H_V; |
| 187 sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC_H_V; | 192 sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC_H_V; |
| 188 sf->intra_uv_mode_mask[TX_16X16] = INTRA_DC_H_V; | 193 sf->intra_uv_mode_mask[TX_16X16] = INTRA_DC_H_V; |
| 189 } | 194 } |
| 190 | 195 |
| 191 if (speed >= 2) { | 196 if (speed >= 2) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 sf->force_frame_boost = cm->frame_type == KEY_FRAME || | 271 sf->force_frame_boost = cm->frame_type == KEY_FRAME || |
| 267 (frames_since_key % | 272 (frames_since_key % |
| 268 (sf->last_partitioning_redo_frequency << 1) == 1); | 273 (sf->last_partitioning_redo_frequency << 1) == 1); |
| 269 sf->max_delta_qindex = (cm->frame_type == KEY_FRAME) ? 20 : 15; | 274 sf->max_delta_qindex = (cm->frame_type == KEY_FRAME) ? 20 : 15; |
| 270 sf->partition_search_type = REFERENCE_PARTITION; | 275 sf->partition_search_type = REFERENCE_PARTITION; |
| 271 sf->use_nonrd_pick_mode = 1; | 276 sf->use_nonrd_pick_mode = 1; |
| 272 sf->allow_skip_recode = 0; | 277 sf->allow_skip_recode = 0; |
| 273 } | 278 } |
| 274 | 279 |
| 275 if (speed >= 6) { | 280 if (speed >= 6) { |
| 281 if (content == VP9E_CONTENT_SCREEN) { |
| 282 int i; |
| 283 // Allow fancy modes at all sizes since SOURCE_VAR_BASED_PARTITION is used |
| 284 for (i = 0; i < BLOCK_SIZES; ++i) |
| 285 sf->inter_mode_mask[i] = INTER_ALL; |
| 286 } |
| 287 |
| 276 // Adaptively switch between SOURCE_VAR_BASED_PARTITION and FIXED_PARTITION. | 288 // Adaptively switch between SOURCE_VAR_BASED_PARTITION and FIXED_PARTITION. |
| 277 sf->partition_search_type = SOURCE_VAR_BASED_PARTITION; | 289 sf->partition_search_type = SOURCE_VAR_BASED_PARTITION; |
| 278 sf->search_type_check_frequency = 50; | 290 sf->search_type_check_frequency = 50; |
| 279 | 291 |
| 280 sf->tx_size_search_method = (cm->frame_type == KEY_FRAME) ? | 292 sf->tx_size_search_method = (cm->frame_type == KEY_FRAME) ? |
| 281 USE_LARGESTALL : USE_TX_8X8; | 293 USE_LARGESTALL : USE_TX_8X8; |
| 282 sf->max_intra_bsize = BLOCK_8X8; | |
| 283 | 294 |
| 284 // This feature is only enabled when partition search is disabled. | 295 // This feature is only enabled when partition search is disabled. |
| 285 sf->reuse_inter_pred_sby = 1; | 296 sf->reuse_inter_pred_sby = 1; |
| 286 | 297 |
| 287 // Increase mode checking threshold for NEWMV. | 298 // Increase mode checking threshold for NEWMV. |
| 288 sf->elevate_newmv_thresh = 2000; | 299 sf->elevate_newmv_thresh = 2000; |
| 289 | 300 |
| 290 sf->mv.reduce_first_step_size = 1; | 301 sf->mv.reduce_first_step_size = 1; |
| 291 } | 302 } |
| 292 if (speed >= 7) { | 303 if (speed >= 7) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 sf->mv.auto_mv_step_size = 0; | 338 sf->mv.auto_mv_step_size = 0; |
| 328 sf->mv.fullpel_search_step_param = 6; | 339 sf->mv.fullpel_search_step_param = 6; |
| 329 sf->comp_inter_joint_search_thresh = BLOCK_4X4; | 340 sf->comp_inter_joint_search_thresh = BLOCK_4X4; |
| 330 sf->adaptive_rd_thresh = 0; | 341 sf->adaptive_rd_thresh = 0; |
| 331 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_OFF; | 342 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_OFF; |
| 332 sf->tx_size_search_method = USE_FULL_RD; | 343 sf->tx_size_search_method = USE_FULL_RD; |
| 333 sf->use_lp32x32fdct = 0; | 344 sf->use_lp32x32fdct = 0; |
| 334 sf->adaptive_motion_search = 0; | 345 sf->adaptive_motion_search = 0; |
| 335 sf->adaptive_pred_interp_filter = 0; | 346 sf->adaptive_pred_interp_filter = 0; |
| 336 sf->cb_pred_filter_search = 0; | 347 sf->cb_pred_filter_search = 0; |
| 348 sf->cb_partition_search = 0; |
| 349 sf->motion_field_mode_search = 0; |
| 337 sf->use_quant_fp = 0; | 350 sf->use_quant_fp = 0; |
| 338 sf->reference_masking = 0; | 351 sf->reference_masking = 0; |
| 339 sf->partition_search_type = SEARCH_PARTITION; | 352 sf->partition_search_type = SEARCH_PARTITION; |
| 340 sf->less_rectangular_check = 0; | 353 sf->less_rectangular_check = 0; |
| 341 sf->use_square_partition_only = 0; | 354 sf->use_square_partition_only = 0; |
| 342 sf->auto_min_max_partition_size = NOT_IN_USE; | 355 sf->auto_min_max_partition_size = NOT_IN_USE; |
| 343 sf->max_partition_size = BLOCK_64X64; | 356 sf->max_partition_size = BLOCK_64X64; |
| 344 sf->min_partition_size = BLOCK_4X4; | 357 sf->min_partition_size = BLOCK_4X4; |
| 345 sf->adjust_partitioning_from_last_frame = 0; | 358 sf->adjust_partitioning_from_last_frame = 0; |
| 346 sf->last_partitioning_redo_frequency = 4; | 359 sf->last_partitioning_redo_frequency = 4; |
| 347 sf->constrain_copy_partition = 0; | 360 sf->constrain_copy_partition = 0; |
| 348 sf->disable_split_mask = 0; | 361 sf->disable_split_mask = 0; |
| 349 sf->mode_search_skip_flags = 0; | 362 sf->mode_search_skip_flags = 0; |
| 350 sf->force_frame_boost = 0; | 363 sf->force_frame_boost = 0; |
| 351 sf->max_delta_qindex = 0; | 364 sf->max_delta_qindex = 0; |
| 352 sf->disable_split_var_thresh = 0; | |
| 353 sf->disable_filter_search_var_thresh = 0; | 365 sf->disable_filter_search_var_thresh = 0; |
| 354 for (i = 0; i < TX_SIZES; i++) { | 366 for (i = 0; i < TX_SIZES; i++) { |
| 355 sf->intra_y_mode_mask[i] = INTRA_ALL; | 367 sf->intra_y_mode_mask[i] = INTRA_ALL; |
| 356 sf->intra_uv_mode_mask[i] = INTRA_ALL; | 368 sf->intra_uv_mode_mask[i] = INTRA_ALL; |
| 357 } | 369 } |
| 358 sf->use_rd_breakout = 0; | 370 sf->use_rd_breakout = 0; |
| 359 sf->skip_encode_sb = 0; | 371 sf->skip_encode_sb = 0; |
| 360 sf->use_uv_intra_rd_estimate = 0; | 372 sf->use_uv_intra_rd_estimate = 0; |
| 361 sf->allow_skip_recode = 0; | 373 sf->allow_skip_recode = 0; |
| 362 sf->lpf_pick = LPF_PICK_FROM_FULL_IMAGE; | 374 sf->lpf_pick = LPF_PICK_FROM_FULL_IMAGE; |
| 363 sf->use_fast_coef_updates = TWO_LOOP; | 375 sf->use_fast_coef_updates = TWO_LOOP; |
| 364 sf->use_fast_coef_costing = 0; | 376 sf->use_fast_coef_costing = 0; |
| 365 sf->mode_skip_start = MAX_MODES; // Mode index at which mode skip mask set | 377 sf->mode_skip_start = MAX_MODES; // Mode index at which mode skip mask set |
| 366 sf->use_nonrd_pick_mode = 0; | 378 sf->use_nonrd_pick_mode = 0; |
| 367 for (i = 0; i < BLOCK_SIZES; ++i) | 379 for (i = 0; i < BLOCK_SIZES; ++i) |
| 368 sf->inter_mode_mask[i] = INTER_ALL; | 380 sf->inter_mode_mask[i] = INTER_ALL; |
| 369 sf->max_intra_bsize = BLOCK_64X64; | 381 sf->max_intra_bsize = BLOCK_64X64; |
| 370 sf->reuse_inter_pred_sby = 0; | 382 sf->reuse_inter_pred_sby = 0; |
| 371 // This setting only takes effect when partition_search_type is set | 383 // This setting only takes effect when partition_search_type is set |
| 372 // to FIXED_PARTITION. | 384 // to FIXED_PARTITION. |
| 373 sf->always_this_block_size = BLOCK_16X16; | 385 sf->always_this_block_size = BLOCK_16X16; |
| 374 sf->search_type_check_frequency = 50; | 386 sf->search_type_check_frequency = 50; |
| 375 sf->encode_breakout_thresh = 0; | 387 sf->encode_breakout_thresh = 0; |
| 376 sf->elevate_newmv_thresh = 0; | 388 sf->elevate_newmv_thresh = 0; |
| 377 // Recode loop tolerence %. | 389 // Recode loop tolerence %. |
| 378 sf->recode_tolerance = 25; | 390 sf->recode_tolerance = 25; |
| 379 sf->default_interp_filter = SWITCHABLE; | 391 sf->default_interp_filter = SWITCHABLE; |
| 380 | 392 |
| 381 switch (oxcf->mode) { | 393 if (oxcf->mode == REALTIME) { |
| 382 case ONE_PASS_BEST: | 394 set_rt_speed_feature(cpi, sf, oxcf->speed, oxcf->content); |
| 383 case TWO_PASS_SECOND_BEST: // This is the best quality mode. | 395 } else { |
| 384 cpi->diamond_search_sad = vp9_full_range_search; | 396 if (!is_best_mode(oxcf->mode)) |
| 385 break; | |
| 386 case TWO_PASS_FIRST: | |
| 387 case ONE_PASS_GOOD: | |
| 388 case TWO_PASS_SECOND_GOOD: | |
| 389 set_good_speed_feature(cpi, cm, sf, oxcf->speed); | 397 set_good_speed_feature(cpi, cm, sf, oxcf->speed); |
| 390 break; | |
| 391 case REALTIME: | |
| 392 set_rt_speed_feature(cpi, sf, oxcf->speed); | |
| 393 break; | |
| 394 } | 398 } |
| 395 | 399 |
| 400 cpi->full_search_sad = vp9_full_search_sad; |
| 401 cpi->diamond_search_sad = is_best_mode(oxcf->mode) ? vp9_full_range_search |
| 402 : vp9_diamond_search_sad; |
| 403 cpi->refining_search_sad = vp9_refining_search_sad; |
| 404 |
| 405 |
| 396 // Slow quant, dct and trellis not worthwhile for first pass | 406 // Slow quant, dct and trellis not worthwhile for first pass |
| 397 // so make sure they are always turned off. | 407 // so make sure they are always turned off. |
| 398 if (cpi->pass == 1) | 408 if (oxcf->pass == 1) |
| 399 sf->optimize_coefficients = 0; | 409 sf->optimize_coefficients = 0; |
| 400 | 410 |
| 401 // No recode for 1 pass. | 411 // No recode for 1 pass. |
| 402 if (cpi->pass == 0) { | 412 if (oxcf->pass == 0) { |
| 403 sf->recode_loop = DISALLOW_RECODE; | 413 sf->recode_loop = DISALLOW_RECODE; |
| 404 sf->optimize_coefficients = 0; | 414 sf->optimize_coefficients = 0; |
| 405 } | 415 } |
| 406 | 416 |
| 407 if (sf->mv.subpel_search_method == SUBPEL_TREE) { | 417 if (sf->mv.subpel_search_method == SUBPEL_TREE) { |
| 408 cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_tree; | 418 cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_tree; |
| 409 } | 419 } |
| 410 | 420 |
| 411 cpi->mb.optimize = sf->optimize_coefficients == 1 && cpi->pass != 1; | 421 cpi->mb.optimize = sf->optimize_coefficients == 1 && oxcf->pass != 1; |
| 412 | 422 |
| 413 if (sf->disable_split_mask == DISABLE_ALL_SPLIT) | 423 if (sf->disable_split_mask == DISABLE_ALL_SPLIT) |
| 414 sf->adaptive_pred_interp_filter = 0; | 424 sf->adaptive_pred_interp_filter = 0; |
| 415 | 425 |
| 416 if (!cpi->oxcf.frame_periodic_boost) { | 426 if (!cpi->oxcf.frame_periodic_boost) { |
| 417 sf->max_delta_qindex = 0; | 427 sf->max_delta_qindex = 0; |
| 418 } | 428 } |
| 419 | 429 |
| 420 if (cpi->encode_breakout && oxcf->mode == REALTIME && | 430 if (cpi->encode_breakout && oxcf->mode == REALTIME && |
| 421 sf->encode_breakout_thresh > cpi->encode_breakout) | 431 sf->encode_breakout_thresh > cpi->encode_breakout) |
| 422 cpi->encode_breakout = sf->encode_breakout_thresh; | 432 cpi->encode_breakout = sf->encode_breakout_thresh; |
| 423 } | 433 } |
| OLD | NEW |