| 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 { | 16 enum { |
| 17 ALL_INTRA_MODES = (1 << DC_PRED) | | 17 INTRA_ALL = (1 << DC_PRED) | |
| 18 (1 << V_PRED) | (1 << H_PRED) | | 18 (1 << V_PRED) | (1 << H_PRED) | |
| 19 (1 << D45_PRED) | (1 << D135_PRED) | | 19 (1 << D45_PRED) | (1 << D135_PRED) | |
| 20 (1 << D117_PRED) | (1 << D153_PRED) | | 20 (1 << D117_PRED) | (1 << D153_PRED) | |
| 21 (1 << D207_PRED) | (1 << D63_PRED) | | 21 (1 << D207_PRED) | (1 << D63_PRED) | |
| 22 (1 << TM_PRED), | 22 (1 << TM_PRED), |
| 23 | 23 INTRA_DC = (1 << DC_PRED), |
| 24 INTRA_DC_ONLY = (1 << DC_PRED), | 24 INTRA_DC_TM = (1 << DC_PRED) | (1 << TM_PRED), |
| 25 | |
| 26 INTRA_DC_TM = (1 << TM_PRED) | (1 << DC_PRED), | |
| 27 | |
| 28 INTRA_DC_H_V = (1 << DC_PRED) | (1 << V_PRED) | (1 << H_PRED), | 25 INTRA_DC_H_V = (1 << DC_PRED) | (1 << V_PRED) | (1 << H_PRED), |
| 29 | 26 INTRA_DC_TM_H_V = (1 << DC_PRED) | (1 << TM_PRED) | (1 << V_PRED) | |
| 30 INTRA_DC_TM_H_V = INTRA_DC_TM | (1 << V_PRED) | (1 << H_PRED) | 27 (1 << H_PRED) |
| 31 }; | 28 }; |
| 32 | 29 |
| 33 enum { | 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 { |
| 34 DISABLE_ALL_INTER_SPLIT = (1 << THR_COMP_GA) | | 37 DISABLE_ALL_INTER_SPLIT = (1 << THR_COMP_GA) | |
| 35 (1 << THR_COMP_LA) | | 38 (1 << THR_COMP_LA) | |
| 36 (1 << THR_ALTR) | | 39 (1 << THR_ALTR) | |
| 37 (1 << THR_GOLD) | | 40 (1 << THR_GOLD) | |
| 38 (1 << THR_LAST), | 41 (1 << THR_LAST), |
| 39 | 42 |
| 40 DISABLE_ALL_SPLIT = (1 << THR_INTRA) | DISABLE_ALL_INTER_SPLIT, | 43 DISABLE_ALL_SPLIT = (1 << THR_INTRA) | DISABLE_ALL_INTER_SPLIT, |
| 41 | 44 |
| 42 DISABLE_COMPOUND_SPLIT = (1 << THR_COMP_GA) | (1 << THR_COMP_LA), | 45 DISABLE_COMPOUND_SPLIT = (1 << THR_COMP_GA) | (1 << THR_COMP_LA), |
| 43 | 46 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 59 sf->tx_size_search_method = frame_is_boosted(cpi) ? USE_FULL_RD | 62 sf->tx_size_search_method = frame_is_boosted(cpi) ? USE_FULL_RD |
| 60 : USE_LARGESTALL; | 63 : USE_LARGESTALL; |
| 61 | 64 |
| 62 if (MIN(cm->width, cm->height) >= 720) | 65 if (MIN(cm->width, cm->height) >= 720) |
| 63 sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT | 66 sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT |
| 64 : DISABLE_ALL_INTER_SPLIT; | 67 : DISABLE_ALL_INTER_SPLIT; |
| 65 else | 68 else |
| 66 sf->disable_split_mask = DISABLE_COMPOUND_SPLIT; | 69 sf->disable_split_mask = DISABLE_COMPOUND_SPLIT; |
| 67 sf->use_rd_breakout = 1; | 70 sf->use_rd_breakout = 1; |
| 68 sf->adaptive_motion_search = 1; | 71 sf->adaptive_motion_search = 1; |
| 69 sf->auto_mv_step_size = 1; | 72 sf->mv.auto_mv_step_size = 1; |
| 70 sf->adaptive_rd_thresh = 2; | 73 sf->adaptive_rd_thresh = 2; |
| 71 sf->subpel_iters_per_step = 1; | 74 sf->mv.subpel_iters_per_step = 1; |
| 72 sf->mode_skip_start = 10; | 75 sf->mode_skip_start = 10; |
| 73 sf->adaptive_pred_interp_filter = 1; | 76 sf->adaptive_pred_interp_filter = 1; |
| 74 | 77 |
| 75 sf->recode_loop = ALLOW_RECODE_KFARFGF; | 78 sf->recode_loop = ALLOW_RECODE_KFARFGF; |
| 76 sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_H_V; | 79 sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_H_V; |
| 77 sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC_H_V; | 80 sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC_H_V; |
| 78 sf->intra_y_mode_mask[TX_16X16] = INTRA_DC_H_V; | 81 sf->intra_y_mode_mask[TX_16X16] = INTRA_DC_H_V; |
| 79 sf->intra_uv_mode_mask[TX_16X16] = INTRA_DC_H_V; | 82 sf->intra_uv_mode_mask[TX_16X16] = INTRA_DC_H_V; |
| 80 } | 83 } |
| 81 | 84 |
| 82 if (speed >= 2) { | 85 if (speed >= 2) { |
| 83 if (MIN(cm->width, cm->height) >= 720) | 86 if (MIN(cm->width, cm->height) >= 720) { |
| 87 sf->lf_motion_threshold = LOW_MOITION_THRESHOLD; |
| 88 sf->last_partitioning_redo_frequency = 3; |
| 84 sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT | 89 sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT |
| 85 : DISABLE_ALL_INTER_SPLIT; | 90 : DISABLE_ALL_INTER_SPLIT; |
| 86 else | 91 } else { |
| 87 sf->disable_split_mask = LAST_AND_INTRA_SPLIT_ONLY; | 92 sf->disable_split_mask = LAST_AND_INTRA_SPLIT_ONLY; |
| 88 | 93 sf->last_partitioning_redo_frequency = 2; |
| 94 sf->lf_motion_threshold = NO_MOITION_THRESHOLD; |
| 95 } |
| 89 sf->adaptive_pred_interp_filter = 2; | 96 sf->adaptive_pred_interp_filter = 2; |
| 90 sf->reference_masking = 1; | 97 sf->reference_masking = 1; |
| 91 sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH | | 98 sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH | |
| 92 FLAG_SKIP_INTRA_BESTINTER | | 99 FLAG_SKIP_INTRA_BESTINTER | |
| 93 FLAG_SKIP_COMP_BESTINTRA | | 100 FLAG_SKIP_COMP_BESTINTRA | |
| 94 FLAG_SKIP_INTRA_LOWVAR; | 101 FLAG_SKIP_INTRA_LOWVAR; |
| 95 sf->disable_filter_search_var_thresh = 100; | 102 sf->disable_filter_search_var_thresh = 100; |
| 96 sf->comp_inter_joint_search_thresh = BLOCK_SIZES; | 103 sf->comp_inter_joint_search_thresh = BLOCK_SIZES; |
| 97 sf->auto_min_max_partition_size = RELAXED_NEIGHBORING_MIN_MAX; | 104 sf->auto_min_max_partition_size = RELAXED_NEIGHBORING_MIN_MAX; |
| 98 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_LOW_MOTION; | 105 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_LOW_MOTION; |
| 99 sf->adjust_partitioning_from_last_frame = 1; | 106 sf->adjust_partitioning_from_last_frame = 1; |
| 100 sf->last_partitioning_redo_frequency = 3; | |
| 101 } | 107 } |
| 102 | 108 |
| 103 if (speed >= 3) { | 109 if (speed >= 3) { |
| 104 sf->tx_size_search_method = frame_is_intra_only(cm) ? USE_FULL_RD | 110 sf->tx_size_search_method = frame_is_intra_only(cm) ? USE_FULL_RD |
| 105 : USE_LARGESTALL; | 111 : USE_LARGESTALL; |
| 106 if (MIN(cm->width, cm->height) >= 720) | 112 if (MIN(cm->width, cm->height) >= 720) |
| 107 sf->disable_split_mask = DISABLE_ALL_SPLIT; | 113 sf->disable_split_mask = DISABLE_ALL_SPLIT; |
| 108 else | 114 else |
| 109 sf->disable_split_mask = DISABLE_ALL_INTER_SPLIT; | 115 sf->disable_split_mask = DISABLE_ALL_INTER_SPLIT; |
| 110 | 116 |
| 117 sf->lf_motion_threshold = LOW_MOITION_THRESHOLD; |
| 118 sf->last_partitioning_redo_frequency = 3; |
| 111 sf->recode_loop = ALLOW_RECODE_KFMAXBW; | 119 sf->recode_loop = ALLOW_RECODE_KFMAXBW; |
| 112 sf->adaptive_rd_thresh = 3; | 120 sf->adaptive_rd_thresh = 3; |
| 113 sf->mode_skip_start = 6; | 121 sf->mode_skip_start = 6; |
| 114 sf->use_fast_coef_updates = ONE_LOOP_REDUCED; | 122 sf->use_fast_coef_updates = ONE_LOOP_REDUCED; |
| 115 sf->use_fast_coef_costing = 1; | 123 sf->use_fast_coef_costing = 1; |
| 116 } | 124 } |
| 117 | 125 |
| 118 if (speed >= 4) { | 126 if (speed >= 4) { |
| 119 sf->use_square_partition_only = 1; | 127 sf->use_square_partition_only = 1; |
| 120 sf->tx_size_search_method = USE_LARGESTALL; | 128 sf->tx_size_search_method = USE_LARGESTALL; |
| 121 sf->disable_split_mask = DISABLE_ALL_SPLIT; | 129 sf->disable_split_mask = DISABLE_ALL_SPLIT; |
| 122 sf->adaptive_rd_thresh = 4; | 130 sf->adaptive_rd_thresh = 4; |
| 123 sf->mode_search_skip_flags |= FLAG_SKIP_COMP_REFMISMATCH | | 131 sf->mode_search_skip_flags |= FLAG_SKIP_COMP_REFMISMATCH | |
| 124 FLAG_EARLY_TERMINATE; | 132 FLAG_EARLY_TERMINATE; |
| 125 sf->disable_filter_search_var_thresh = 200; | 133 sf->disable_filter_search_var_thresh = 200; |
| 126 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_ALL; | 134 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_ALL; |
| 127 sf->use_lp32x32fdct = 1; | 135 sf->use_lp32x32fdct = 1; |
| 128 } | 136 } |
| 129 | 137 |
| 130 if (speed >= 5) { | 138 if (speed >= 5) { |
| 131 int i; | 139 int i; |
| 132 | 140 |
| 133 sf->partition_search_type = FIXED_PARTITION; | 141 sf->partition_search_type = FIXED_PARTITION; |
| 134 sf->optimize_coefficients = 0; | 142 sf->optimize_coefficients = 0; |
| 135 sf->search_method = HEX; | 143 sf->mv.search_method = HEX; |
| 136 sf->disable_filter_search_var_thresh = 500; | 144 sf->disable_filter_search_var_thresh = 500; |
| 137 for (i = 0; i < TX_SIZES; ++i) { | 145 for (i = 0; i < TX_SIZES; ++i) { |
| 138 sf->intra_y_mode_mask[i] = INTRA_DC_ONLY; | 146 sf->intra_y_mode_mask[i] = INTRA_DC; |
| 139 sf->intra_uv_mode_mask[i] = INTRA_DC_ONLY; | 147 sf->intra_uv_mode_mask[i] = INTRA_DC; |
| 140 } | 148 } |
| 141 cpi->allow_encode_breakout = ENCODE_BREAKOUT_ENABLED; | 149 cpi->allow_encode_breakout = ENCODE_BREAKOUT_ENABLED; |
| 142 } | 150 } |
| 143 } | 151 } |
| 144 | 152 |
| 145 static void set_rt_speed_feature(VP9_COMMON *cm, SPEED_FEATURES *sf, | 153 static void set_rt_speed_feature(VP9_COMP *cpi, SPEED_FEATURES *sf, |
| 146 int speed) { | 154 int speed) { |
| 155 VP9_COMMON *const cm = &cpi->common; |
| 156 const int frames_since_key = |
| 157 cm->frame_type == KEY_FRAME ? 0 : cpi->rc.frames_since_key; |
| 147 sf->static_segmentation = 0; | 158 sf->static_segmentation = 0; |
| 148 sf->adaptive_rd_thresh = 1; | 159 sf->adaptive_rd_thresh = 1; |
| 149 sf->encode_breakout_thresh = 1; | |
| 150 sf->use_fast_coef_costing = 1; | 160 sf->use_fast_coef_costing = 1; |
| 151 | 161 |
| 152 if (speed == 1) { | 162 if (speed >= 1) { |
| 153 sf->use_square_partition_only = !frame_is_intra_only(cm); | 163 sf->use_square_partition_only = !frame_is_intra_only(cm); |
| 154 sf->less_rectangular_check = 1; | 164 sf->less_rectangular_check = 1; |
| 155 sf->tx_size_search_method = frame_is_intra_only(cm) ? USE_FULL_RD | 165 sf->tx_size_search_method = frame_is_intra_only(cm) ? USE_FULL_RD |
| 156 : USE_LARGESTALL; | 166 : USE_LARGESTALL; |
| 157 | 167 |
| 158 if (MIN(cm->width, cm->height) >= 720) | 168 if (MIN(cm->width, cm->height) >= 720) |
| 159 sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT | 169 sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT |
| 160 : DISABLE_ALL_INTER_SPLIT; | 170 : DISABLE_ALL_INTER_SPLIT; |
| 161 else | 171 else |
| 162 sf->disable_split_mask = DISABLE_COMPOUND_SPLIT; | 172 sf->disable_split_mask = DISABLE_COMPOUND_SPLIT; |
| 163 | 173 |
| 164 sf->use_rd_breakout = 1; | 174 sf->use_rd_breakout = 1; |
| 165 sf->adaptive_motion_search = 1; | 175 sf->adaptive_motion_search = 1; |
| 166 sf->adaptive_pred_interp_filter = 1; | 176 sf->adaptive_pred_interp_filter = 1; |
| 167 sf->auto_mv_step_size = 1; | 177 sf->mv.auto_mv_step_size = 1; |
| 168 sf->adaptive_rd_thresh = 2; | 178 sf->adaptive_rd_thresh = 2; |
| 169 sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_H_V; | 179 sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_H_V; |
| 170 sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC_H_V; | 180 sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC_H_V; |
| 171 sf->intra_uv_mode_mask[TX_16X16] = INTRA_DC_H_V; | 181 sf->intra_uv_mode_mask[TX_16X16] = INTRA_DC_H_V; |
| 172 sf->encode_breakout_thresh = 8; | |
| 173 } | 182 } |
| 174 | 183 |
| 175 if (speed >= 2) { | 184 if (speed >= 2) { |
| 176 sf->use_square_partition_only = !frame_is_intra_only(cm); | |
| 177 sf->less_rectangular_check = 1; | |
| 178 sf->tx_size_search_method = frame_is_intra_only(cm) ? USE_FULL_RD | |
| 179 : USE_LARGESTALL; | |
| 180 if (MIN(cm->width, cm->height) >= 720) | 185 if (MIN(cm->width, cm->height) >= 720) |
| 181 sf->disable_split_mask = cm->show_frame ? | 186 sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT |
| 182 DISABLE_ALL_SPLIT : DISABLE_ALL_INTER_SPLIT; | 187 : DISABLE_ALL_INTER_SPLIT; |
| 183 else | 188 else |
| 184 sf->disable_split_mask = LAST_AND_INTRA_SPLIT_ONLY; | 189 sf->disable_split_mask = LAST_AND_INTRA_SPLIT_ONLY; |
| 185 | 190 |
| 186 sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH | | 191 sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH | |
| 187 FLAG_SKIP_INTRA_BESTINTER | | 192 FLAG_SKIP_INTRA_BESTINTER | |
| 188 FLAG_SKIP_COMP_BESTINTRA | | 193 FLAG_SKIP_COMP_BESTINTRA | |
| 189 FLAG_SKIP_INTRA_LOWVAR; | 194 FLAG_SKIP_INTRA_LOWVAR; |
| 190 sf->use_rd_breakout = 1; | |
| 191 sf->adaptive_motion_search = 1; | |
| 192 sf->adaptive_pred_interp_filter = 2; | 195 sf->adaptive_pred_interp_filter = 2; |
| 193 sf->auto_mv_step_size = 1; | |
| 194 sf->reference_masking = 1; | 196 sf->reference_masking = 1; |
| 195 | |
| 196 sf->disable_filter_search_var_thresh = 50; | 197 sf->disable_filter_search_var_thresh = 50; |
| 197 sf->comp_inter_joint_search_thresh = BLOCK_SIZES; | 198 sf->comp_inter_joint_search_thresh = BLOCK_SIZES; |
| 198 | |
| 199 sf->auto_min_max_partition_size = RELAXED_NEIGHBORING_MIN_MAX; | 199 sf->auto_min_max_partition_size = RELAXED_NEIGHBORING_MIN_MAX; |
| 200 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_LOW_MOTION; | 200 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_LOW_MOTION; |
| 201 sf->lf_motion_threshold = LOW_MOITION_THRESHOLD; |
| 201 sf->adjust_partitioning_from_last_frame = 1; | 202 sf->adjust_partitioning_from_last_frame = 1; |
| 202 sf->last_partitioning_redo_frequency = 3; | 203 sf->last_partitioning_redo_frequency = 3; |
| 203 | |
| 204 sf->adaptive_rd_thresh = 2; | |
| 205 sf->use_lp32x32fdct = 1; | 204 sf->use_lp32x32fdct = 1; |
| 206 sf->mode_skip_start = 11; | 205 sf->mode_skip_start = 11; |
| 207 sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_H_V; | |
| 208 sf->intra_y_mode_mask[TX_16X16] = INTRA_DC_H_V; | 206 sf->intra_y_mode_mask[TX_16X16] = INTRA_DC_H_V; |
| 209 sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC_H_V; | |
| 210 sf->intra_uv_mode_mask[TX_16X16] = INTRA_DC_H_V; | |
| 211 sf->encode_breakout_thresh = 200; | |
| 212 } | 207 } |
| 213 | 208 |
| 214 if (speed >= 3) { | 209 if (speed >= 3) { |
| 215 sf->use_square_partition_only = 1; | 210 sf->use_square_partition_only = 1; |
| 216 sf->disable_filter_search_var_thresh = 100; | 211 sf->disable_filter_search_var_thresh = 100; |
| 217 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_ALL; | 212 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_ALL; |
| 218 sf->constrain_copy_partition = 1; | 213 sf->constrain_copy_partition = 1; |
| 219 sf->use_uv_intra_rd_estimate = 1; | 214 sf->use_uv_intra_rd_estimate = 1; |
| 220 sf->skip_encode_sb = 1; | 215 sf->skip_encode_sb = 1; |
| 221 sf->subpel_iters_per_step = 1; | 216 sf->mv.subpel_iters_per_step = 1; |
| 222 sf->use_fast_coef_updates = ONE_LOOP_REDUCED; | 217 sf->use_fast_coef_updates = ONE_LOOP_REDUCED; |
| 223 sf->adaptive_rd_thresh = 4; | 218 sf->adaptive_rd_thresh = 4; |
| 224 sf->mode_skip_start = 6; | 219 sf->mode_skip_start = 6; |
| 225 sf->allow_skip_recode = 0; | 220 sf->allow_skip_recode = 0; |
| 226 sf->optimize_coefficients = 0; | 221 sf->optimize_coefficients = 0; |
| 227 sf->disable_split_mask = DISABLE_ALL_SPLIT; | 222 sf->disable_split_mask = DISABLE_ALL_SPLIT; |
| 228 sf->lpf_pick = LPF_PICK_FROM_Q; | 223 sf->lpf_pick = LPF_PICK_FROM_Q; |
| 229 sf->encode_breakout_thresh = 700; | |
| 230 } | 224 } |
| 231 | 225 |
| 232 if (speed >= 4) { | 226 if (speed >= 4) { |
| 233 int i; | 227 int i; |
| 234 sf->last_partitioning_redo_frequency = 4; | 228 sf->last_partitioning_redo_frequency = 4; |
| 235 sf->adaptive_rd_thresh = 5; | 229 sf->adaptive_rd_thresh = 5; |
| 236 sf->use_fast_coef_costing = 0; | 230 sf->use_fast_coef_costing = 0; |
| 237 sf->auto_min_max_partition_size = STRICT_NEIGHBORING_MIN_MAX; | 231 sf->auto_min_max_partition_size = STRICT_NEIGHBORING_MIN_MAX; |
| 238 sf->adjust_partitioning_from_last_frame = | 232 sf->adjust_partitioning_from_last_frame = |
| 239 cm->last_frame_type != cm->frame_type || (0 == | 233 cm->last_frame_type != cm->frame_type || (0 == |
| 240 (cm->current_video_frame + 1) % sf->last_partitioning_redo_frequency); | 234 (frames_since_key + 1) % sf->last_partitioning_redo_frequency); |
| 241 sf->subpel_force_stop = 1; | 235 sf->mv.subpel_force_stop = 1; |
| 242 for (i = 0; i < TX_SIZES; i++) { | 236 for (i = 0; i < TX_SIZES; i++) { |
| 243 sf->intra_y_mode_mask[i] = INTRA_DC_H_V; | 237 sf->intra_y_mode_mask[i] = INTRA_DC_H_V; |
| 244 sf->intra_uv_mode_mask[i] = INTRA_DC_ONLY; | 238 sf->intra_uv_mode_mask[i] = INTRA_DC; |
| 245 } | 239 } |
| 246 sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_ONLY; | 240 sf->intra_y_mode_mask[TX_32X32] = INTRA_DC; |
| 247 sf->frame_parameter_update = 0; | 241 sf->frame_parameter_update = 0; |
| 248 sf->encode_breakout_thresh = 1000; | 242 sf->mv.search_method = FAST_HEX; |
| 249 sf->search_method = FAST_HEX; | 243 sf->inter_mode_mask[BLOCK_32X32] = INTER_NEAREST_NEAR_NEW; |
| 250 sf->disable_inter_mode_mask[BLOCK_32X32] = 1 << INTER_OFFSET(ZEROMV); | 244 sf->inter_mode_mask[BLOCK_32X64] = INTER_NEAREST; |
| 251 sf->disable_inter_mode_mask[BLOCK_32X64] = ~(1 << INTER_OFFSET(NEARESTMV)); | 245 sf->inter_mode_mask[BLOCK_64X32] = INTER_NEAREST; |
| 252 sf->disable_inter_mode_mask[BLOCK_64X32] = ~(1 << INTER_OFFSET(NEARESTMV)); | 246 sf->inter_mode_mask[BLOCK_64X64] = INTER_NEAREST; |
| 253 sf->disable_inter_mode_mask[BLOCK_64X64] = ~(1 << INTER_OFFSET(NEARESTMV)); | |
| 254 sf->max_intra_bsize = BLOCK_32X32; | 247 sf->max_intra_bsize = BLOCK_32X32; |
| 255 sf->allow_skip_recode = 1; | 248 sf->allow_skip_recode = 1; |
| 256 } | 249 } |
| 257 | 250 |
| 258 if (speed >= 5) { | 251 if (speed >= 5) { |
| 252 sf->auto_min_max_partition_size = (cm->frame_type == KEY_FRAME) ? |
| 253 RELAXED_NEIGHBORING_MIN_MAX : STRICT_NEIGHBORING_MIN_MAX; |
| 259 sf->max_partition_size = BLOCK_32X32; | 254 sf->max_partition_size = BLOCK_32X32; |
| 260 sf->min_partition_size = BLOCK_8X8; | 255 sf->min_partition_size = BLOCK_8X8; |
| 261 sf->partition_check = | 256 sf->partition_check = |
| 262 (cm->current_video_frame % sf->last_partitioning_redo_frequency == 1); | 257 (frames_since_key % sf->last_partitioning_redo_frequency == 1); |
| 263 sf->force_frame_boost = cm->frame_type == KEY_FRAME || | 258 sf->force_frame_boost = cm->frame_type == KEY_FRAME || |
| 264 (cm->current_video_frame % | 259 (frames_since_key % |
| 265 (sf->last_partitioning_redo_frequency << 1) == 1); | 260 (sf->last_partitioning_redo_frequency << 1) == 1); |
| 266 sf->max_delta_qindex = (cm->frame_type == KEY_FRAME) ? 20 : 15; | 261 sf->max_delta_qindex = (cm->frame_type == KEY_FRAME) ? 20 : 15; |
| 267 sf->partition_search_type = REFERENCE_PARTITION; | 262 sf->partition_search_type = REFERENCE_PARTITION; |
| 268 sf->use_nonrd_pick_mode = 1; | 263 sf->use_nonrd_pick_mode = 1; |
| 269 sf->search_method = FAST_DIAMOND; | 264 sf->mv.search_method = FAST_DIAMOND; |
| 270 sf->allow_skip_recode = 0; | 265 sf->allow_skip_recode = 0; |
| 271 sf->chessboard_index = cm->current_video_frame & 0x01; | |
| 272 } | 266 } |
| 273 | 267 |
| 274 if (speed >= 6) { | 268 if (speed >= 6) { |
| 275 // Adaptively switch between SOURCE_VAR_BASED_PARTITION and FIXED_PARTITION. | 269 // Adaptively switch between SOURCE_VAR_BASED_PARTITION and FIXED_PARTITION. |
| 276 sf->partition_search_type = SOURCE_VAR_BASED_PARTITION; | 270 sf->partition_search_type = SOURCE_VAR_BASED_PARTITION; |
| 277 sf->search_type_check_frequency = 50; | 271 sf->search_type_check_frequency = 50; |
| 278 sf->source_var_thresh = 360; | 272 sf->source_var_thresh = 360; |
| 273 |
| 274 sf->tx_size_search_method = USE_TX_8X8; |
| 275 // TODO(yunqingwang): max_intra_bsize is used to decide if DC_PRED mode |
| 276 // is checked for a partition block. Later, we can try to allow large |
| 277 // partitions to do intra mode checking. |
| 278 sf->max_intra_bsize = BLOCK_8X8; |
| 279 } | 279 } |
| 280 | 280 |
| 281 if (speed >= 7) { | 281 if (speed >= 7) { |
| 282 int i; | 282 int i; |
| 283 for (i = 0; i < BLOCK_SIZES; ++i) | 283 for (i = 0; i < BLOCK_SIZES; ++i) |
| 284 sf->disable_inter_mode_mask[i] = ~(1 << INTER_OFFSET(NEARESTMV)); | 284 sf->inter_mode_mask[i] = INTER_NEAREST; |
| 285 } | 285 } |
| 286 } | 286 } |
| 287 | 287 |
| 288 void vp9_set_speed_features(VP9_COMP *cpi) { | 288 void vp9_set_speed_features(VP9_COMP *cpi) { |
| 289 SPEED_FEATURES *const sf = &cpi->sf; | 289 SPEED_FEATURES *const sf = &cpi->sf; |
| 290 VP9_COMMON *const cm = &cpi->common; | 290 VP9_COMMON *const cm = &cpi->common; |
| 291 const VP9EncoderConfig *const oxcf = &cpi->oxcf; | 291 const VP9EncoderConfig *const oxcf = &cpi->oxcf; |
| 292 int i; | 292 int i; |
| 293 | 293 |
| 294 // best quality defaults | 294 // best quality defaults |
| 295 sf->frame_parameter_update = 1; | 295 sf->frame_parameter_update = 1; |
| 296 sf->search_method = NSTEP; | 296 sf->mv.search_method = NSTEP; |
| 297 sf->recode_loop = ALLOW_RECODE; | 297 sf->recode_loop = ALLOW_RECODE; |
| 298 sf->subpel_search_method = SUBPEL_TREE; | 298 sf->mv.subpel_search_method = SUBPEL_TREE; |
| 299 sf->subpel_iters_per_step = 2; | 299 sf->mv.subpel_iters_per_step = 2; |
| 300 sf->subpel_force_stop = 0; | 300 sf->mv.subpel_force_stop = 0; |
| 301 sf->optimize_coefficients = !oxcf->lossless; | 301 sf->optimize_coefficients = !is_lossless_requested(&cpi->oxcf); |
| 302 sf->reduce_first_step_size = 0; | 302 sf->mv.reduce_first_step_size = 0; |
| 303 sf->auto_mv_step_size = 0; | 303 sf->mv.auto_mv_step_size = 0; |
| 304 sf->max_step_search_steps = MAX_MVSEARCH_STEPS; | 304 sf->mv.max_step_search_steps = MAX_MVSEARCH_STEPS; |
| 305 sf->comp_inter_joint_search_thresh = BLOCK_4X4; | 305 sf->comp_inter_joint_search_thresh = BLOCK_4X4; |
| 306 sf->adaptive_rd_thresh = 0; | 306 sf->adaptive_rd_thresh = 0; |
| 307 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_OFF; | 307 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_OFF; |
| 308 sf->tx_size_search_method = USE_FULL_RD; | 308 sf->tx_size_search_method = USE_FULL_RD; |
| 309 sf->use_lp32x32fdct = 0; | 309 sf->use_lp32x32fdct = 0; |
| 310 sf->adaptive_motion_search = 0; | 310 sf->adaptive_motion_search = 0; |
| 311 sf->adaptive_pred_interp_filter = 0; | 311 sf->adaptive_pred_interp_filter = 0; |
| 312 sf->reference_masking = 0; | 312 sf->reference_masking = 0; |
| 313 sf->partition_search_type = SEARCH_PARTITION; | 313 sf->partition_search_type = SEARCH_PARTITION; |
| 314 sf->less_rectangular_check = 0; | 314 sf->less_rectangular_check = 0; |
| 315 sf->use_square_partition_only = 0; | 315 sf->use_square_partition_only = 0; |
| 316 sf->auto_min_max_partition_size = NOT_IN_USE; | 316 sf->auto_min_max_partition_size = NOT_IN_USE; |
| 317 sf->max_partition_size = BLOCK_64X64; | 317 sf->max_partition_size = BLOCK_64X64; |
| 318 sf->min_partition_size = BLOCK_4X4; | 318 sf->min_partition_size = BLOCK_4X4; |
| 319 sf->adjust_partitioning_from_last_frame = 0; | 319 sf->adjust_partitioning_from_last_frame = 0; |
| 320 sf->last_partitioning_redo_frequency = 4; | 320 sf->last_partitioning_redo_frequency = 4; |
| 321 sf->constrain_copy_partition = 0; | 321 sf->constrain_copy_partition = 0; |
| 322 sf->disable_split_mask = 0; | 322 sf->disable_split_mask = 0; |
| 323 sf->mode_search_skip_flags = 0; | 323 sf->mode_search_skip_flags = 0; |
| 324 sf->force_frame_boost = 0; | 324 sf->force_frame_boost = 0; |
| 325 sf->max_delta_qindex = 0; | 325 sf->max_delta_qindex = 0; |
| 326 sf->disable_split_var_thresh = 0; | 326 sf->disable_split_var_thresh = 0; |
| 327 sf->disable_filter_search_var_thresh = 0; | 327 sf->disable_filter_search_var_thresh = 0; |
| 328 for (i = 0; i < TX_SIZES; i++) { | 328 for (i = 0; i < TX_SIZES; i++) { |
| 329 sf->intra_y_mode_mask[i] = ALL_INTRA_MODES; | 329 sf->intra_y_mode_mask[i] = INTRA_ALL; |
| 330 sf->intra_uv_mode_mask[i] = ALL_INTRA_MODES; | 330 sf->intra_uv_mode_mask[i] = INTRA_ALL; |
| 331 } | 331 } |
| 332 sf->use_rd_breakout = 0; | 332 sf->use_rd_breakout = 0; |
| 333 sf->skip_encode_sb = 0; | 333 sf->skip_encode_sb = 0; |
| 334 sf->use_uv_intra_rd_estimate = 0; | 334 sf->use_uv_intra_rd_estimate = 0; |
| 335 sf->allow_skip_recode = 0; | 335 sf->allow_skip_recode = 0; |
| 336 sf->lpf_pick = LPF_PICK_FROM_FULL_IMAGE; | 336 sf->lpf_pick = LPF_PICK_FROM_FULL_IMAGE; |
| 337 sf->use_fast_coef_updates = TWO_LOOP; | 337 sf->use_fast_coef_updates = TWO_LOOP; |
| 338 sf->use_fast_coef_costing = 0; | 338 sf->use_fast_coef_costing = 0; |
| 339 sf->mode_skip_start = MAX_MODES; // Mode index at which mode skip mask set | 339 sf->mode_skip_start = MAX_MODES; // Mode index at which mode skip mask set |
| 340 sf->use_nonrd_pick_mode = 0; | 340 sf->use_nonrd_pick_mode = 0; |
| 341 sf->encode_breakout_thresh = 0; | |
| 342 for (i = 0; i < BLOCK_SIZES; ++i) | 341 for (i = 0; i < BLOCK_SIZES; ++i) |
| 343 sf->disable_inter_mode_mask[i] = 0; | 342 sf->inter_mode_mask[i] = INTER_ALL; |
| 344 sf->max_intra_bsize = BLOCK_64X64; | 343 sf->max_intra_bsize = BLOCK_64X64; |
| 345 // This setting only takes effect when partition_search_type is set | 344 // This setting only takes effect when partition_search_type is set |
| 346 // to FIXED_PARTITION. | 345 // to FIXED_PARTITION. |
| 347 sf->always_this_block_size = BLOCK_16X16; | 346 sf->always_this_block_size = BLOCK_16X16; |
| 348 sf->search_type_check_frequency = 50; | 347 sf->search_type_check_frequency = 50; |
| 349 sf->source_var_thresh = 100; | 348 sf->source_var_thresh = 100; |
| 350 | 349 |
| 351 // Recode loop tolerence %. | 350 // Recode loop tolerence %. |
| 352 sf->recode_tolerance = 25; | 351 sf->recode_tolerance = 25; |
| 353 | 352 |
| 354 switch (oxcf->mode) { | 353 switch (oxcf->mode) { |
| 355 case ONE_PASS_BEST: | 354 case ONE_PASS_BEST: |
| 356 case TWO_PASS_SECOND_BEST: // This is the best quality mode. | 355 case TWO_PASS_SECOND_BEST: // This is the best quality mode. |
| 357 cpi->diamond_search_sad = vp9_full_range_search; | 356 cpi->diamond_search_sad = vp9_full_range_search; |
| 358 break; | 357 break; |
| 359 case TWO_PASS_FIRST: | 358 case TWO_PASS_FIRST: |
| 360 case ONE_PASS_GOOD: | 359 case ONE_PASS_GOOD: |
| 361 case TWO_PASS_SECOND_GOOD: | 360 case TWO_PASS_SECOND_GOOD: |
| 362 set_good_speed_feature(cpi, cm, sf, oxcf->speed); | 361 set_good_speed_feature(cpi, cm, sf, oxcf->speed); |
| 363 break; | 362 break; |
| 364 case REALTIME: | 363 case REALTIME: |
| 365 set_rt_speed_feature(cm, sf, oxcf->speed); | 364 set_rt_speed_feature(cpi, sf, oxcf->speed); |
| 366 break; | 365 break; |
| 367 } | 366 } |
| 368 | 367 |
| 369 // Slow quant, dct and trellis not worthwhile for first pass | 368 // Slow quant, dct and trellis not worthwhile for first pass |
| 370 // so make sure they are always turned off. | 369 // so make sure they are always turned off. |
| 371 if (cpi->pass == 1) | 370 if (cpi->pass == 1) |
| 372 sf->optimize_coefficients = 0; | 371 sf->optimize_coefficients = 0; |
| 373 | 372 |
| 374 // No recode for 1 pass. | 373 // No recode for 1 pass. |
| 375 if (cpi->pass == 0) { | 374 if (cpi->pass == 0) { |
| 376 sf->recode_loop = DISALLOW_RECODE; | 375 sf->recode_loop = DISALLOW_RECODE; |
| 377 sf->optimize_coefficients = 0; | 376 sf->optimize_coefficients = 0; |
| 378 } | 377 } |
| 379 | 378 |
| 380 if (sf->subpel_search_method == SUBPEL_TREE) { | 379 if (sf->mv.subpel_search_method == SUBPEL_TREE) { |
| 381 cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_tree; | 380 cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_tree; |
| 382 cpi->find_fractional_mv_step_comp = vp9_find_best_sub_pixel_comp_tree; | 381 cpi->find_fractional_mv_step_comp = vp9_find_best_sub_pixel_comp_tree; |
| 383 } | 382 } |
| 384 | 383 |
| 385 cpi->mb.optimize = sf->optimize_coefficients == 1 && cpi->pass != 1; | 384 cpi->mb.optimize = sf->optimize_coefficients == 1 && cpi->pass != 1; |
| 386 | 385 |
| 387 if (cpi->encode_breakout && oxcf->mode == REALTIME && | |
| 388 sf->encode_breakout_thresh > cpi->encode_breakout) | |
| 389 cpi->encode_breakout = sf->encode_breakout_thresh; | |
| 390 | |
| 391 if (sf->disable_split_mask == DISABLE_ALL_SPLIT) | 386 if (sf->disable_split_mask == DISABLE_ALL_SPLIT) |
| 392 sf->adaptive_pred_interp_filter = 0; | 387 sf->adaptive_pred_interp_filter = 0; |
| 393 | 388 |
| 394 if (!cpi->oxcf.frame_periodic_boost) { | 389 if (!cpi->oxcf.frame_periodic_boost) { |
| 395 sf->max_delta_qindex = 0; | 390 sf->max_delta_qindex = 0; |
| 396 } | 391 } |
| 397 } | 392 } |
| OLD | NEW |