| 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 |
| 11 #include <limits.h> | 11 #include <limits.h> |
| 12 | 12 |
| 13 #include "vp9/encoder/vp9_encoder.h" | 13 #include "vp9/encoder/vp9_encoder.h" |
| 14 #include "vp9/encoder/vp9_speed_features.h" | 14 #include "vp9/encoder/vp9_speed_features.h" |
| 15 | 15 |
| 16 enum { | |
| 17 INTRA_ALL = (1 << DC_PRED) | | |
| 18 (1 << V_PRED) | (1 << H_PRED) | | |
| 19 (1 << D45_PRED) | (1 << D135_PRED) | | |
| 20 (1 << D117_PRED) | (1 << D153_PRED) | | |
| 21 (1 << D207_PRED) | (1 << D63_PRED) | | |
| 22 (1 << TM_PRED), | |
| 23 INTRA_DC = (1 << DC_PRED), | |
| 24 INTRA_DC_TM = (1 << DC_PRED) | (1 << TM_PRED), | |
| 25 INTRA_DC_H_V = (1 << DC_PRED) | (1 << V_PRED) | (1 << H_PRED), | |
| 26 INTRA_DC_TM_H_V = (1 << DC_PRED) | (1 << TM_PRED) | (1 << V_PRED) | | |
| 27 (1 << H_PRED) | |
| 28 }; | |
| 29 | |
| 30 enum { | |
| 31 INTER_ALL = (1 << NEARESTMV) | (1 << NEARMV) | (1 << ZEROMV) | (1 << NEWMV), | |
| 32 INTER_NEAREST = (1 << NEARESTMV), | |
| 33 INTER_NEAREST_NEAR_NEW = (1 << NEARESTMV) | (1 << NEARMV) | (1 << NEWMV) | |
| 34 }; | |
| 35 | |
| 36 enum { | |
| 37 DISABLE_ALL_INTER_SPLIT = (1 << THR_COMP_GA) | | |
| 38 (1 << THR_COMP_LA) | | |
| 39 (1 << THR_ALTR) | | |
| 40 (1 << THR_GOLD) | | |
| 41 (1 << THR_LAST), | |
| 42 | |
| 43 DISABLE_ALL_SPLIT = (1 << THR_INTRA) | DISABLE_ALL_INTER_SPLIT, | |
| 44 | |
| 45 DISABLE_COMPOUND_SPLIT = (1 << THR_COMP_GA) | (1 << THR_COMP_LA), | |
| 46 | |
| 47 LAST_AND_INTRA_SPLIT_ONLY = (1 << THR_COMP_GA) | | |
| 48 (1 << THR_COMP_LA) | | |
| 49 (1 << THR_ALTR) | | |
| 50 (1 << THR_GOLD) | |
| 51 }; | |
| 52 | |
| 53 // Intra only frames, golden frames (except alt ref overlays) and | 16 // Intra only frames, golden frames (except alt ref overlays) and |
| 54 // alt ref frames tend to be coded at a higher than ambient quality | 17 // alt ref frames tend to be coded at a higher than ambient quality |
| 55 static int frame_is_boosted(const VP9_COMP *cpi) { | 18 static int frame_is_boosted(const VP9_COMP *cpi) { |
| 56 return frame_is_intra_only(&cpi->common) || | 19 return frame_is_intra_only(&cpi->common) || |
| 57 cpi->refresh_alt_ref_frame || | 20 cpi->refresh_alt_ref_frame || |
| 58 (cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref) || | 21 (cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref) || |
| 59 vp9_is_upper_layer_key_frame(cpi); | 22 vp9_is_upper_layer_key_frame(cpi); |
| 60 } | 23 } |
| 61 | 24 |
| 62 | 25 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 else | 60 else |
| 98 sf->partition_search_breakout_dist_thr = (1 << 21); | 61 sf->partition_search_breakout_dist_thr = (1 << 21); |
| 99 sf->partition_search_breakout_rate_thr = 500; | 62 sf->partition_search_breakout_rate_thr = 500; |
| 100 } | 63 } |
| 101 | 64 |
| 102 if (speed >= 2) { | 65 if (speed >= 2) { |
| 103 sf->tx_size_search_method = frame_is_boosted(cpi) ? USE_FULL_RD | 66 sf->tx_size_search_method = frame_is_boosted(cpi) ? USE_FULL_RD |
| 104 : USE_LARGESTALL; | 67 : USE_LARGESTALL; |
| 105 | 68 |
| 106 if (MIN(cm->width, cm->height) >= 720) { | 69 if (MIN(cm->width, cm->height) >= 720) { |
| 107 sf->lf_motion_threshold = LOW_MOTION_THRESHOLD; | |
| 108 sf->last_partitioning_redo_frequency = 3; | |
| 109 sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT | 70 sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT |
| 110 : DISABLE_ALL_INTER_SPLIT; | 71 : DISABLE_ALL_INTER_SPLIT; |
| 111 sf->adaptive_pred_interp_filter = 0; | 72 sf->adaptive_pred_interp_filter = 0; |
| 112 } else { | 73 } else { |
| 113 sf->disable_split_mask = LAST_AND_INTRA_SPLIT_ONLY; | 74 sf->disable_split_mask = LAST_AND_INTRA_SPLIT_ONLY; |
| 114 sf->last_partitioning_redo_frequency = 2; | |
| 115 sf->lf_motion_threshold = NO_MOTION_THRESHOLD; | |
| 116 } | 75 } |
| 117 | 76 |
| 118 sf->reference_masking = 1; | 77 sf->reference_masking = 1; |
| 119 sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH | | 78 sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH | |
| 120 FLAG_SKIP_INTRA_BESTINTER | | 79 FLAG_SKIP_INTRA_BESTINTER | |
| 121 FLAG_SKIP_COMP_BESTINTRA | | 80 FLAG_SKIP_COMP_BESTINTRA | |
| 122 FLAG_SKIP_INTRA_LOWVAR; | 81 FLAG_SKIP_INTRA_LOWVAR; |
| 123 sf->disable_filter_search_var_thresh = 100; | 82 sf->disable_filter_search_var_thresh = 100; |
| 124 sf->comp_inter_joint_search_thresh = BLOCK_SIZES; | 83 sf->comp_inter_joint_search_thresh = BLOCK_SIZES; |
| 125 sf->auto_min_max_partition_size = CONSTRAIN_NEIGHBORING_MIN_MAX; | 84 sf->auto_min_max_partition_size = CONSTRAIN_NEIGHBORING_MIN_MAX; |
| 126 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_LOW_MOTION; | |
| 127 sf->adjust_partitioning_from_last_frame = 1; | |
| 128 | 85 |
| 129 if (MIN(cm->width, cm->height) >= 720) | 86 if (MIN(cm->width, cm->height) >= 720) |
| 130 sf->partition_search_breakout_dist_thr = (1 << 24); | 87 sf->partition_search_breakout_dist_thr = (1 << 24); |
| 131 else | 88 else |
| 132 sf->partition_search_breakout_dist_thr = (1 << 22); | 89 sf->partition_search_breakout_dist_thr = (1 << 22); |
| 133 sf->partition_search_breakout_rate_thr = 700; | 90 sf->partition_search_breakout_rate_thr = 700; |
| 134 } | 91 } |
| 135 | 92 |
| 136 if (speed >= 3) { | 93 if (speed >= 3) { |
| 137 sf->tx_size_search_method = frame_is_intra_only(cm) ? USE_FULL_RD | 94 sf->tx_size_search_method = frame_is_intra_only(cm) ? USE_FULL_RD |
| 138 : USE_LARGESTALL; | 95 : USE_LARGESTALL; |
| 139 if (MIN(cm->width, cm->height) >= 720) { | 96 if (MIN(cm->width, cm->height) >= 720) { |
| 140 sf->disable_split_mask = DISABLE_ALL_SPLIT; | 97 sf->disable_split_mask = DISABLE_ALL_SPLIT; |
| 98 sf->schedule_mode_search = cm->base_qindex < 220 ? 1 : 0; |
| 141 } else { | 99 } else { |
| 142 sf->max_intra_bsize = BLOCK_32X32; | 100 sf->max_intra_bsize = BLOCK_32X32; |
| 143 sf->disable_split_mask = DISABLE_ALL_INTER_SPLIT; | 101 sf->disable_split_mask = DISABLE_ALL_INTER_SPLIT; |
| 102 sf->schedule_mode_search = cm->base_qindex < 175 ? 1 : 0; |
| 144 } | 103 } |
| 145 sf->adaptive_pred_interp_filter = 0; | 104 sf->adaptive_pred_interp_filter = 0; |
| 146 sf->adaptive_mode_search = 1; | 105 sf->adaptive_mode_search = 1; |
| 147 sf->cb_partition_search = !boosted; | 106 sf->cb_partition_search = !boosted; |
| 148 sf->cb_pred_filter_search = 1; | 107 sf->cb_pred_filter_search = 1; |
| 149 sf->alt_ref_search_fp = 1; | 108 sf->alt_ref_search_fp = 1; |
| 150 sf->motion_field_mode_search = !boosted; | 109 sf->motion_field_mode_search = !boosted; |
| 151 sf->lf_motion_threshold = LOW_MOTION_THRESHOLD; | |
| 152 sf->last_partitioning_redo_frequency = 2; | |
| 153 sf->recode_loop = ALLOW_RECODE_KFMAXBW; | 110 sf->recode_loop = ALLOW_RECODE_KFMAXBW; |
| 154 sf->adaptive_rd_thresh = 3; | 111 sf->adaptive_rd_thresh = 3; |
| 155 sf->mode_skip_start = 6; | 112 sf->mode_skip_start = 6; |
| 156 sf->intra_y_mode_mask[TX_32X32] = INTRA_DC; | 113 sf->intra_y_mode_mask[TX_32X32] = INTRA_DC; |
| 157 sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC; | 114 sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC; |
| 158 sf->adaptive_interp_filter_search = 1; | 115 sf->adaptive_interp_filter_search = 1; |
| 159 | 116 |
| 160 if (MIN(cm->width, cm->height) >= 720) | 117 if (MIN(cm->width, cm->height) >= 720) |
| 161 sf->partition_search_breakout_dist_thr = (1 << 25); | 118 sf->partition_search_breakout_dist_thr = (1 << 25); |
| 162 else | 119 else |
| 163 sf->partition_search_breakout_dist_thr = (1 << 23); | 120 sf->partition_search_breakout_dist_thr = (1 << 23); |
| 164 sf->partition_search_breakout_rate_thr = 1000; | 121 sf->partition_search_breakout_rate_thr = 1000; |
| 165 } | 122 } |
| 166 | 123 |
| 167 if (speed >= 4) { | 124 if (speed >= 4) { |
| 168 sf->use_square_partition_only = 1; | 125 sf->use_square_partition_only = 1; |
| 169 sf->tx_size_search_method = USE_LARGESTALL; | 126 sf->tx_size_search_method = USE_LARGESTALL; |
| 170 sf->disable_split_mask = DISABLE_ALL_SPLIT; | 127 sf->disable_split_mask = DISABLE_ALL_SPLIT; |
| 128 sf->mv.search_method = BIGDIA; |
| 129 sf->mv.subpel_search_method = SUBPEL_TREE_PRUNED; |
| 171 sf->adaptive_rd_thresh = 4; | 130 sf->adaptive_rd_thresh = 4; |
| 172 sf->mode_search_skip_flags |= FLAG_SKIP_COMP_REFMISMATCH | | 131 sf->mode_search_skip_flags |= FLAG_EARLY_TERMINATE; |
| 173 FLAG_EARLY_TERMINATE; | |
| 174 sf->disable_filter_search_var_thresh = 200; | 132 sf->disable_filter_search_var_thresh = 200; |
| 175 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_ALL; | |
| 176 sf->use_lp32x32fdct = 1; | 133 sf->use_lp32x32fdct = 1; |
| 177 sf->use_fast_coef_updates = ONE_LOOP_REDUCED; | 134 sf->use_fast_coef_updates = ONE_LOOP_REDUCED; |
| 178 sf->use_fast_coef_costing = 1; | 135 sf->use_fast_coef_costing = 1; |
| 179 | 136 |
| 180 if (MIN(cm->width, cm->height) >= 720) | 137 if (MIN(cm->width, cm->height) >= 720) |
| 181 sf->partition_search_breakout_dist_thr = (1 << 26); | 138 sf->partition_search_breakout_dist_thr = (1 << 26); |
| 182 else | 139 else |
| 183 sf->partition_search_breakout_dist_thr = (1 << 24); | 140 sf->partition_search_breakout_dist_thr = (1 << 24); |
| 184 sf->partition_search_breakout_rate_thr = 1500; | 141 sf->partition_search_breakout_rate_thr = 1500; |
| 185 } | 142 } |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 sf->intra_uv_mode_mask[i] = INTRA_ALL; | 371 sf->intra_uv_mode_mask[i] = INTRA_ALL; |
| 415 } | 372 } |
| 416 sf->use_rd_breakout = 0; | 373 sf->use_rd_breakout = 0; |
| 417 sf->skip_encode_sb = 0; | 374 sf->skip_encode_sb = 0; |
| 418 sf->use_uv_intra_rd_estimate = 0; | 375 sf->use_uv_intra_rd_estimate = 0; |
| 419 sf->allow_skip_recode = 0; | 376 sf->allow_skip_recode = 0; |
| 420 sf->lpf_pick = LPF_PICK_FROM_FULL_IMAGE; | 377 sf->lpf_pick = LPF_PICK_FROM_FULL_IMAGE; |
| 421 sf->use_fast_coef_updates = TWO_LOOP; | 378 sf->use_fast_coef_updates = TWO_LOOP; |
| 422 sf->use_fast_coef_costing = 0; | 379 sf->use_fast_coef_costing = 0; |
| 423 sf->mode_skip_start = MAX_MODES; // Mode index at which mode skip mask set | 380 sf->mode_skip_start = MAX_MODES; // Mode index at which mode skip mask set |
| 381 sf->schedule_mode_search = 0; |
| 424 sf->use_nonrd_pick_mode = 0; | 382 sf->use_nonrd_pick_mode = 0; |
| 425 for (i = 0; i < BLOCK_SIZES; ++i) | 383 for (i = 0; i < BLOCK_SIZES; ++i) |
| 426 sf->inter_mode_mask[i] = INTER_ALL; | 384 sf->inter_mode_mask[i] = INTER_ALL; |
| 427 sf->max_intra_bsize = BLOCK_64X64; | 385 sf->max_intra_bsize = BLOCK_64X64; |
| 428 sf->reuse_inter_pred_sby = 0; | 386 sf->reuse_inter_pred_sby = 0; |
| 429 // This setting only takes effect when partition_search_type is set | 387 // This setting only takes effect when partition_search_type is set |
| 430 // to FIXED_PARTITION. | 388 // to FIXED_PARTITION. |
| 431 sf->always_this_block_size = BLOCK_16X16; | 389 sf->always_this_block_size = BLOCK_16X16; |
| 432 sf->search_type_check_frequency = 50; | 390 sf->search_type_check_frequency = 50; |
| 433 sf->encode_breakout_thresh = 0; | 391 sf->encode_breakout_thresh = 0; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 sf->adaptive_pred_interp_filter = 0; | 431 sf->adaptive_pred_interp_filter = 0; |
| 474 | 432 |
| 475 if (!cpi->oxcf.frame_periodic_boost) { | 433 if (!cpi->oxcf.frame_periodic_boost) { |
| 476 sf->max_delta_qindex = 0; | 434 sf->max_delta_qindex = 0; |
| 477 } | 435 } |
| 478 | 436 |
| 479 if (cpi->encode_breakout && oxcf->mode == REALTIME && | 437 if (cpi->encode_breakout && oxcf->mode == REALTIME && |
| 480 sf->encode_breakout_thresh > cpi->encode_breakout) | 438 sf->encode_breakout_thresh > cpi->encode_breakout) |
| 481 cpi->encode_breakout = sf->encode_breakout_thresh; | 439 cpi->encode_breakout = sf->encode_breakout_thresh; |
| 482 } | 440 } |
| OLD | NEW |