Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: source/libvpx/vp9/encoder/vp9_speed_features.c

Issue 756673003: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // Intra only frames, golden frames (except alt ref overlays) and 16 // Intra only frames, golden frames (except alt ref overlays) and
17 // 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
18 static int frame_is_boosted(const VP9_COMP *cpi) { 18 static int frame_is_boosted(const VP9_COMP *cpi) {
19 return frame_is_intra_only(&cpi->common) || 19 return frame_is_kf_gf_arf(cpi) || vp9_is_upper_layer_key_frame(cpi);
20 cpi->refresh_alt_ref_frame ||
21 (cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref) ||
22 vp9_is_upper_layer_key_frame(cpi);
23 } 20 }
24 21
22 static void set_good_speed_feature_framesize_dependent(VP9_COMMON *cm,
23 SPEED_FEATURES *sf,
24 int speed) {
25 if (speed >= 1) {
26 if (MIN(cm->width, cm->height) >= 720) {
27 sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT
28 : DISABLE_ALL_INTER_SPLIT;
29 sf->partition_search_breakout_dist_thr = (1 << 23);
30 } else {
31 sf->disable_split_mask = DISABLE_COMPOUND_SPLIT;
32 sf->partition_search_breakout_dist_thr = (1 << 21);
33 }
34 }
35
36 if (speed >= 2) {
37 if (MIN(cm->width, cm->height) >= 720) {
38 sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT
39 : DISABLE_ALL_INTER_SPLIT;
40 sf->adaptive_pred_interp_filter = 0;
41 sf->partition_search_breakout_dist_thr = (1 << 24);
42 sf->partition_search_breakout_rate_thr = 120;
43 } else {
44 sf->disable_split_mask = LAST_AND_INTRA_SPLIT_ONLY;
45 sf->partition_search_breakout_dist_thr = (1 << 22);
46 sf->partition_search_breakout_rate_thr = 100;
47 }
48 }
49
50 if (speed >= 3) {
51 if (MIN(cm->width, cm->height) >= 720) {
52 sf->disable_split_mask = DISABLE_ALL_SPLIT;
53 sf->schedule_mode_search = cm->base_qindex < 220 ? 1 : 0;
54 sf->partition_search_breakout_dist_thr = (1 << 25);
55 sf->partition_search_breakout_rate_thr = 200;
56 } else {
57 sf->max_intra_bsize = BLOCK_32X32;
58 sf->disable_split_mask = DISABLE_ALL_INTER_SPLIT;
59 sf->schedule_mode_search = cm->base_qindex < 175 ? 1 : 0;
60 sf->partition_search_breakout_dist_thr = (1 << 23);
61 sf->partition_search_breakout_rate_thr = 120;
62 }
63 }
64
65 if (speed >= 4) {
66 if (MIN(cm->width, cm->height) >= 720) {
67 sf->partition_search_breakout_dist_thr = (1 << 26);
68 } else {
69 sf->partition_search_breakout_dist_thr = (1 << 24);
70 }
71 sf->disable_split_mask = DISABLE_ALL_SPLIT;
72 }
73 }
25 74
26 static void set_good_speed_feature(VP9_COMP *cpi, VP9_COMMON *cm, 75 static void set_good_speed_feature(VP9_COMP *cpi, VP9_COMMON *cm,
27 SPEED_FEATURES *sf, int speed) { 76 SPEED_FEATURES *sf, int speed) {
28 const int boosted = frame_is_boosted(cpi); 77 const int boosted = frame_is_boosted(cpi);
29 78
30 sf->adaptive_rd_thresh = 1; 79 sf->adaptive_rd_thresh = 1;
31 sf->allow_skip_recode = 1; 80 sf->allow_skip_recode = 1;
32 81
33 if (speed >= 1) { 82 if (speed >= 1) {
34 sf->use_square_partition_only = !frame_is_intra_only(cm); 83 sf->use_square_partition_only = !frame_is_intra_only(cm);
35 sf->less_rectangular_check = 1; 84 sf->less_rectangular_check = 1;
36 85
37 if (MIN(cm->width, cm->height) >= 720)
38 sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT
39 : DISABLE_ALL_INTER_SPLIT;
40 else
41 sf->disable_split_mask = DISABLE_COMPOUND_SPLIT;
42 sf->use_rd_breakout = 1; 86 sf->use_rd_breakout = 1;
43 sf->adaptive_motion_search = 1; 87 sf->adaptive_motion_search = 1;
44 sf->mv.auto_mv_step_size = 1; 88 sf->mv.auto_mv_step_size = 1;
45 sf->adaptive_rd_thresh = 2; 89 sf->adaptive_rd_thresh = 2;
46 sf->mv.subpel_iters_per_step = 1; 90 sf->mv.subpel_iters_per_step = 1;
47 sf->mode_skip_start = 10; 91 sf->mode_skip_start = 10;
48 sf->adaptive_pred_interp_filter = 1; 92 sf->adaptive_pred_interp_filter = 1;
49 93
50 sf->recode_loop = ALLOW_RECODE_KFARFGF; 94 sf->recode_loop = ALLOW_RECODE_KFARFGF;
51 sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_H_V; 95 sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_H_V;
52 sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC_H_V; 96 sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC_H_V;
53 sf->intra_y_mode_mask[TX_16X16] = INTRA_DC_H_V; 97 sf->intra_y_mode_mask[TX_16X16] = INTRA_DC_H_V;
54 sf->intra_uv_mode_mask[TX_16X16] = INTRA_DC_H_V; 98 sf->intra_uv_mode_mask[TX_16X16] = INTRA_DC_H_V;
55 99
56 sf->tx_size_search_breakout = 1; 100 sf->tx_size_search_breakout = 1;
57
58 if (MIN(cm->width, cm->height) >= 720)
59 sf->partition_search_breakout_dist_thr = (1 << 23);
60 else
61 sf->partition_search_breakout_dist_thr = (1 << 21);
62 sf->partition_search_breakout_rate_thr = 80; 101 sf->partition_search_breakout_rate_thr = 80;
63 } 102 }
64 103
65 if (speed >= 2) { 104 if (speed >= 2) {
66 sf->tx_size_search_method = frame_is_boosted(cpi) ? USE_FULL_RD 105 sf->tx_size_search_method = frame_is_boosted(cpi) ? USE_FULL_RD
67 : USE_LARGESTALL; 106 : USE_LARGESTALL;
68 107
69 if (MIN(cm->width, cm->height) >= 720) {
70 sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT
71 : DISABLE_ALL_INTER_SPLIT;
72 sf->adaptive_pred_interp_filter = 0;
73 sf->partition_search_breakout_dist_thr = (1 << 24);
74 sf->partition_search_breakout_rate_thr = 120;
75 } else {
76 sf->disable_split_mask = LAST_AND_INTRA_SPLIT_ONLY;
77 sf->partition_search_breakout_dist_thr = (1 << 22);
78 sf->partition_search_breakout_rate_thr = 100;
79 }
80
81 sf->reference_masking = 1; 108 sf->reference_masking = 1;
82 sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH | 109 sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH |
83 FLAG_SKIP_INTRA_BESTINTER | 110 FLAG_SKIP_INTRA_BESTINTER |
84 FLAG_SKIP_COMP_BESTINTRA | 111 FLAG_SKIP_COMP_BESTINTRA |
85 FLAG_SKIP_INTRA_LOWVAR; 112 FLAG_SKIP_INTRA_LOWVAR;
86 sf->disable_filter_search_var_thresh = 100; 113 sf->disable_filter_search_var_thresh = 100;
87 sf->comp_inter_joint_search_thresh = BLOCK_SIZES; 114 sf->comp_inter_joint_search_thresh = BLOCK_SIZES;
88 sf->auto_min_max_partition_size = CONSTRAIN_NEIGHBORING_MIN_MAX; 115 sf->auto_min_max_partition_size = CONSTRAIN_NEIGHBORING_MIN_MAX;
89 116
90 sf->allow_partition_search_skip = 1; 117 sf->allow_partition_search_skip = 1;
91 } 118 }
92 119
93 if (speed >= 3) { 120 if (speed >= 3) {
94 sf->tx_size_search_method = frame_is_intra_only(cm) ? USE_FULL_RD 121 sf->tx_size_search_method = frame_is_intra_only(cm) ? USE_FULL_RD
95 : USE_LARGESTALL; 122 : USE_LARGESTALL;
96 if (MIN(cm->width, cm->height) >= 720) {
97 sf->disable_split_mask = DISABLE_ALL_SPLIT;
98 sf->schedule_mode_search = cm->base_qindex < 220 ? 1 : 0;
99 sf->partition_search_breakout_dist_thr = (1 << 25);
100 sf->partition_search_breakout_rate_thr = 200;
101 } else {
102 sf->max_intra_bsize = BLOCK_32X32;
103 sf->disable_split_mask = DISABLE_ALL_INTER_SPLIT;
104 sf->schedule_mode_search = cm->base_qindex < 175 ? 1 : 0;
105 sf->partition_search_breakout_dist_thr = (1 << 23);
106 sf->partition_search_breakout_rate_thr = 120;
107 }
108 sf->mv.subpel_search_method = SUBPEL_TREE_PRUNED; 123 sf->mv.subpel_search_method = SUBPEL_TREE_PRUNED;
109 sf->adaptive_pred_interp_filter = 0; 124 sf->adaptive_pred_interp_filter = 0;
110 sf->adaptive_mode_search = 1; 125 sf->adaptive_mode_search = 1;
111 sf->cb_partition_search = !boosted; 126 sf->cb_partition_search = !boosted;
112 sf->cb_pred_filter_search = 1; 127 sf->cb_pred_filter_search = 1;
113 sf->alt_ref_search_fp = 1; 128 sf->alt_ref_search_fp = 1;
114 sf->recode_loop = ALLOW_RECODE_KFMAXBW; 129 sf->recode_loop = ALLOW_RECODE_KFMAXBW;
115 sf->adaptive_rd_thresh = 3; 130 sf->adaptive_rd_thresh = 3;
116 sf->mode_skip_start = 6; 131 sf->mode_skip_start = 6;
117 sf->intra_y_mode_mask[TX_32X32] = INTRA_DC; 132 sf->intra_y_mode_mask[TX_32X32] = INTRA_DC;
118 sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC; 133 sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC;
119 sf->adaptive_interp_filter_search = 1; 134 sf->adaptive_interp_filter_search = 1;
120 } 135 }
121 136
122 if (speed >= 4) { 137 if (speed >= 4) {
123 sf->use_square_partition_only = 1; 138 sf->use_square_partition_only = 1;
124 sf->tx_size_search_method = USE_LARGESTALL; 139 sf->tx_size_search_method = USE_LARGESTALL;
125 sf->disable_split_mask = DISABLE_ALL_SPLIT;
126 sf->mv.search_method = BIGDIA; 140 sf->mv.search_method = BIGDIA;
127 sf->mv.subpel_search_method = SUBPEL_TREE_PRUNED_MORE; 141 sf->mv.subpel_search_method = SUBPEL_TREE_PRUNED_MORE;
128 sf->adaptive_rd_thresh = 4; 142 sf->adaptive_rd_thresh = 4;
129 sf->mode_search_skip_flags |= FLAG_EARLY_TERMINATE; 143 sf->mode_search_skip_flags |= FLAG_EARLY_TERMINATE;
130 sf->disable_filter_search_var_thresh = 200; 144 sf->disable_filter_search_var_thresh = 200;
131 sf->use_lp32x32fdct = 1; 145 sf->use_lp32x32fdct = 1;
132 sf->use_fast_coef_updates = ONE_LOOP_REDUCED; 146 sf->use_fast_coef_updates = ONE_LOOP_REDUCED;
133 sf->use_fast_coef_costing = 1; 147 sf->use_fast_coef_costing = 1;
134 sf->motion_field_mode_search = !boosted; 148 sf->motion_field_mode_search = !boosted;
135
136 if (MIN(cm->width, cm->height) >= 720)
137 sf->partition_search_breakout_dist_thr = (1 << 26);
138 else
139 sf->partition_search_breakout_dist_thr = (1 << 24);
140 sf->partition_search_breakout_rate_thr = 300; 149 sf->partition_search_breakout_rate_thr = 300;
141 } 150 }
142 151
143 if (speed >= 5) { 152 if (speed >= 5) {
144 int i; 153 int i;
145
146 sf->partition_search_type = FIXED_PARTITION;
147 sf->optimize_coefficients = 0; 154 sf->optimize_coefficients = 0;
148 sf->mv.search_method = HEX; 155 sf->mv.search_method = HEX;
149 sf->disable_filter_search_var_thresh = 500; 156 sf->disable_filter_search_var_thresh = 500;
150 for (i = 0; i < TX_SIZES; ++i) { 157 for (i = 0; i < TX_SIZES; ++i) {
151 sf->intra_y_mode_mask[i] = INTRA_DC; 158 sf->intra_y_mode_mask[i] = INTRA_DC;
152 sf->intra_uv_mode_mask[i] = INTRA_DC; 159 sf->intra_uv_mode_mask[i] = INTRA_DC;
153 } 160 }
161 sf->partition_search_breakout_rate_thr = 500;
162 sf->mv.reduce_first_step_size = 1;
154 } 163 }
155 if (speed >= 6) { 164 }
156 sf->mv.reduce_first_step_size = 1; 165
166 static void set_rt_speed_feature_framesize_dependent(VP9_COMP *cpi,
167 SPEED_FEATURES *sf, int speed) {
168 VP9_COMMON *const cm = &cpi->common;
169
170 if (speed >= 1) {
171 if (MIN(cm->width, cm->height) >= 720) {
172 sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT
173 : DISABLE_ALL_INTER_SPLIT;
174 } else {
175 sf->disable_split_mask = DISABLE_COMPOUND_SPLIT;
176 }
177 }
178
179 if (speed >= 2) {
180 if (MIN(cm->width, cm->height) >= 720) {
181 sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT
182 : DISABLE_ALL_INTER_SPLIT;
183 } else {
184 sf->disable_split_mask = LAST_AND_INTRA_SPLIT_ONLY;
185 }
186 }
187
188 if (speed >= 5) {
189 if (MIN(cm->width, cm->height) >= 720) {
190 sf->partition_search_breakout_dist_thr = (1 << 25);
191 } else {
192 sf->partition_search_breakout_dist_thr = (1 << 23);
193 }
194 }
195
196 if (speed >= 7) {
197 sf->encode_breakout_thresh = (MIN(cm->width, cm->height) >= 720) ?
198 800 : 300;
157 } 199 }
158 } 200 }
159 201
160 static void set_rt_speed_feature(VP9_COMP *cpi, SPEED_FEATURES *sf, 202 static void set_rt_speed_feature(VP9_COMP *cpi, SPEED_FEATURES *sf,
161 int speed, vp9e_tune_content content) { 203 int speed, vp9e_tune_content content) {
162 VP9_COMMON *const cm = &cpi->common; 204 VP9_COMMON *const cm = &cpi->common;
163 const int is_keyframe = cm->frame_type == KEY_FRAME; 205 const int is_keyframe = cm->frame_type == KEY_FRAME;
164 const int frames_since_key = is_keyframe ? 0 : cpi->rc.frames_since_key; 206 const int frames_since_key = is_keyframe ? 0 : cpi->rc.frames_since_key;
165 sf->static_segmentation = 0; 207 sf->static_segmentation = 0;
166 sf->adaptive_rd_thresh = 1; 208 sf->adaptive_rd_thresh = 1;
167 sf->use_fast_coef_costing = 1; 209 sf->use_fast_coef_costing = 1;
168 210
169 if (speed >= 1) { 211 if (speed >= 1) {
170 sf->use_square_partition_only = !frame_is_intra_only(cm); 212 sf->use_square_partition_only = !frame_is_intra_only(cm);
171 sf->less_rectangular_check = 1; 213 sf->less_rectangular_check = 1;
172 sf->tx_size_search_method = frame_is_intra_only(cm) ? USE_FULL_RD 214 sf->tx_size_search_method = frame_is_intra_only(cm) ? USE_FULL_RD
173 : USE_LARGESTALL; 215 : USE_LARGESTALL;
174 216
175 if (MIN(cm->width, cm->height) >= 720)
176 sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT
177 : DISABLE_ALL_INTER_SPLIT;
178 else
179 sf->disable_split_mask = DISABLE_COMPOUND_SPLIT;
180
181 sf->use_rd_breakout = 1; 217 sf->use_rd_breakout = 1;
182 218
183 sf->adaptive_motion_search = 1; 219 sf->adaptive_motion_search = 1;
184 sf->adaptive_pred_interp_filter = 1; 220 sf->adaptive_pred_interp_filter = 1;
185 sf->mv.auto_mv_step_size = 1; 221 sf->mv.auto_mv_step_size = 1;
186 sf->adaptive_rd_thresh = 2; 222 sf->adaptive_rd_thresh = 2;
187 sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_H_V; 223 sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_H_V;
188 sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC_H_V; 224 sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC_H_V;
189 sf->intra_uv_mode_mask[TX_16X16] = INTRA_DC_H_V; 225 sf->intra_uv_mode_mask[TX_16X16] = INTRA_DC_H_V;
190 } 226 }
191 227
192 if (speed >= 2) { 228 if (speed >= 2) {
193 if (MIN(cm->width, cm->height) >= 720)
194 sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT
195 : DISABLE_ALL_INTER_SPLIT;
196 else
197 sf->disable_split_mask = LAST_AND_INTRA_SPLIT_ONLY;
198
199 sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH | 229 sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH |
200 FLAG_SKIP_INTRA_BESTINTER | 230 FLAG_SKIP_INTRA_BESTINTER |
201 FLAG_SKIP_COMP_BESTINTRA | 231 FLAG_SKIP_COMP_BESTINTRA |
202 FLAG_SKIP_INTRA_LOWVAR; 232 FLAG_SKIP_INTRA_LOWVAR;
203 sf->adaptive_pred_interp_filter = 2; 233 sf->adaptive_pred_interp_filter = 2;
204 sf->reference_masking = 1; 234 sf->reference_masking = 1;
205 sf->disable_filter_search_var_thresh = 50; 235 sf->disable_filter_search_var_thresh = 50;
206 sf->comp_inter_joint_search_thresh = BLOCK_SIZES; 236 sf->comp_inter_joint_search_thresh = BLOCK_SIZES;
207 sf->auto_min_max_partition_size = RELAXED_NEIGHBORING_MIN_MAX; 237 sf->auto_min_max_partition_size = RELAXED_NEIGHBORING_MIN_MAX;
208 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_LOW_MOTION;
209 sf->lf_motion_threshold = LOW_MOTION_THRESHOLD; 238 sf->lf_motion_threshold = LOW_MOTION_THRESHOLD;
210 sf->adjust_partitioning_from_last_frame = 1; 239 sf->adjust_partitioning_from_last_frame = 1;
211 sf->last_partitioning_redo_frequency = 3; 240 sf->last_partitioning_redo_frequency = 3;
212 sf->use_lp32x32fdct = 1; 241 sf->use_lp32x32fdct = 1;
213 sf->mode_skip_start = 11; 242 sf->mode_skip_start = 11;
214 sf->intra_y_mode_mask[TX_16X16] = INTRA_DC_H_V; 243 sf->intra_y_mode_mask[TX_16X16] = INTRA_DC_H_V;
215 } 244 }
216 245
217 if (speed >= 3) { 246 if (speed >= 3) {
218 sf->use_square_partition_only = 1; 247 sf->use_square_partition_only = 1;
219 sf->disable_filter_search_var_thresh = 100; 248 sf->disable_filter_search_var_thresh = 100;
220 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_ALL;
221 sf->constrain_copy_partition = 1;
222 sf->use_uv_intra_rd_estimate = 1; 249 sf->use_uv_intra_rd_estimate = 1;
223 sf->skip_encode_sb = 1; 250 sf->skip_encode_sb = 1;
224 sf->mv.subpel_iters_per_step = 1; 251 sf->mv.subpel_iters_per_step = 1;
225 sf->use_fast_coef_updates = ONE_LOOP_REDUCED; 252 sf->use_fast_coef_updates = ONE_LOOP_REDUCED;
226 sf->adaptive_rd_thresh = 4; 253 sf->adaptive_rd_thresh = 4;
227 sf->mode_skip_start = 6; 254 sf->mode_skip_start = 6;
228 sf->allow_skip_recode = 0; 255 sf->allow_skip_recode = 0;
229 sf->optimize_coefficients = 0; 256 sf->optimize_coefficients = 0;
230 sf->disable_split_mask = DISABLE_ALL_SPLIT; 257 sf->disable_split_mask = DISABLE_ALL_SPLIT;
231 sf->lpf_pick = LPF_PICK_FROM_Q; 258 sf->lpf_pick = LPF_PICK_FROM_Q;
(...skipping 22 matching lines...) Expand all
254 sf->inter_mode_mask[BLOCK_64X32] = INTER_NEAREST; 281 sf->inter_mode_mask[BLOCK_64X32] = INTER_NEAREST;
255 sf->inter_mode_mask[BLOCK_64X64] = INTER_NEAREST; 282 sf->inter_mode_mask[BLOCK_64X64] = INTER_NEAREST;
256 sf->max_intra_bsize = BLOCK_32X32; 283 sf->max_intra_bsize = BLOCK_32X32;
257 sf->allow_skip_recode = 1; 284 sf->allow_skip_recode = 1;
258 } 285 }
259 286
260 if (speed >= 5) { 287 if (speed >= 5) {
261 sf->use_quant_fp = !is_keyframe; 288 sf->use_quant_fp = !is_keyframe;
262 sf->auto_min_max_partition_size = is_keyframe ? RELAXED_NEIGHBORING_MIN_MAX 289 sf->auto_min_max_partition_size = is_keyframe ? RELAXED_NEIGHBORING_MIN_MAX
263 : STRICT_NEIGHBORING_MIN_MAX; 290 : STRICT_NEIGHBORING_MIN_MAX;
264 sf->max_partition_size = BLOCK_32X32; 291 sf->default_max_partition_size = BLOCK_32X32;
265 sf->min_partition_size = BLOCK_8X8; 292 sf->default_min_partition_size = BLOCK_8X8;
266 sf->partition_check =
267 (frames_since_key % sf->last_partitioning_redo_frequency == 1);
268 sf->force_frame_boost = is_keyframe || 293 sf->force_frame_boost = is_keyframe ||
269 (frames_since_key % (sf->last_partitioning_redo_frequency << 1) == 1); 294 (frames_since_key % (sf->last_partitioning_redo_frequency << 1) == 1);
270 sf->max_delta_qindex = is_keyframe ? 20 : 15; 295 sf->max_delta_qindex = is_keyframe ? 20 : 15;
271 sf->partition_search_type = REFERENCE_PARTITION; 296 sf->partition_search_type = REFERENCE_PARTITION;
272 sf->use_nonrd_pick_mode = 1; 297 sf->use_nonrd_pick_mode = 1;
273 sf->allow_skip_recode = 0; 298 sf->allow_skip_recode = 0;
274 sf->inter_mode_mask[BLOCK_32X32] = INTER_NEAREST_NEW_ZERO; 299 sf->inter_mode_mask[BLOCK_32X32] = INTER_NEAREST_NEW_ZERO;
275 sf->inter_mode_mask[BLOCK_32X64] = INTER_NEAREST_NEW_ZERO; 300 sf->inter_mode_mask[BLOCK_32X64] = INTER_NEAREST_NEW_ZERO;
276 sf->inter_mode_mask[BLOCK_64X32] = INTER_NEAREST_NEW_ZERO; 301 sf->inter_mode_mask[BLOCK_64X32] = INTER_NEAREST_NEW_ZERO;
277 sf->inter_mode_mask[BLOCK_64X64] = INTER_NEAREST_NEW_ZERO; 302 sf->inter_mode_mask[BLOCK_64X64] = INTER_NEAREST_NEW_ZERO;
278 303 sf->adaptive_rd_thresh = 2;
279 if (MIN(cm->width, cm->height) >= 720) 304 // This feature is only enabled when partition search is disabled.
280 sf->partition_search_breakout_dist_thr = (1 << 25); 305 sf->reuse_inter_pred_sby = 1;
281 else
282 sf->partition_search_breakout_dist_thr = (1 << 23);
283 sf->partition_search_breakout_rate_thr = 200; 306 sf->partition_search_breakout_rate_thr = 200;
307 if (!is_keyframe) {
308 int i;
309 if (content == VP9E_CONTENT_SCREEN) {
310 for (i = 0; i < TX_SIZES; ++i)
311 sf->intra_y_mode_mask[i] = INTRA_DC_TM_H_V;
312 } else {
313 for (i = 0; i < TX_SIZES; i++)
314 sf->intra_y_mode_mask[i] = INTRA_DC;
315 }
316 }
284 } 317 }
285 318
286 if (speed >= 6) { 319 if (speed >= 6) {
287 if (content == VP9E_CONTENT_SCREEN) {
288 int i;
289 // Allow fancy modes at all sizes since SOURCE_VAR_BASED_PARTITION is used
290 for (i = 0; i < BLOCK_SIZES; ++i)
291 sf->inter_mode_mask[i] = INTER_NEAREST_NEAR_NEW;
292 }
293
294 // Adaptively switch between SOURCE_VAR_BASED_PARTITION and FIXED_PARTITION. 320 // Adaptively switch between SOURCE_VAR_BASED_PARTITION and FIXED_PARTITION.
295 sf->partition_search_type = VAR_BASED_PARTITION; 321 sf->partition_search_type = VAR_BASED_PARTITION;
296 sf->search_type_check_frequency = 50; 322 sf->search_type_check_frequency = 50;
297 sf->mv.search_method = NSTEP; 323 sf->mv.search_method = NSTEP;
298
299 sf->tx_size_search_method = is_keyframe ? USE_LARGESTALL : USE_TX_8X8; 324 sf->tx_size_search_method = is_keyframe ? USE_LARGESTALL : USE_TX_8X8;
300
301 // This feature is only enabled when partition search is disabled.
302 sf->reuse_inter_pred_sby = 1;
303
304 // Increase mode checking threshold for NEWMV.
305 sf->elevate_newmv_thresh = 1000;
306
307 sf->mv.reduce_first_step_size = 1; 325 sf->mv.reduce_first_step_size = 1;
326 sf->skip_encode_sb = 0;
308 } 327 }
309 328
310 if (speed >= 7) { 329 if (speed >= 7) {
330 sf->adaptive_rd_thresh = 3;
311 sf->mv.search_method = FAST_DIAMOND; 331 sf->mv.search_method = FAST_DIAMOND;
312 sf->mv.fullpel_search_step_param = 10; 332 sf->mv.fullpel_search_step_param = 10;
313 sf->lpf_pick = LPF_PICK_MINIMAL_LPF; 333 sf->lpf_pick = LPF_PICK_MINIMAL_LPF;
314 sf->encode_breakout_thresh = (MIN(cm->width, cm->height) >= 720) ?
315 800 : 300;
316 sf->elevate_newmv_thresh = 2500;
317 } 334 }
318 335
319 if (speed >= 12) { 336 if (speed >= 12) {
320 sf->elevate_newmv_thresh = 4000; 337 sf->adaptive_rd_thresh = 4;
321 sf->mv.subpel_force_stop = 2; 338 sf->mv.subpel_force_stop = 2;
322 } 339 }
323 340
324 if (speed >= 13) { 341 if (speed >= 13) {
325 int i; 342 int i;
326 sf->max_intra_bsize = BLOCK_32X32; 343 sf->max_intra_bsize = BLOCK_32X32;
327 for (i = 0; i < BLOCK_SIZES; ++i) 344 for (i = 0; i < BLOCK_SIZES; ++i)
328 sf->inter_mode_mask[i] = INTER_NEAREST; 345 sf->inter_mode_mask[i] = INTER_NEAREST;
329 } 346 }
330 } 347 }
331 348
332 void vp9_set_speed_features(VP9_COMP *cpi) { 349 void vp9_set_speed_features_framesize_dependent(VP9_COMP *cpi) {
333 SPEED_FEATURES *const sf = &cpi->sf; 350 SPEED_FEATURES *const sf = &cpi->sf;
334 VP9_COMMON *const cm = &cpi->common; 351 VP9_COMMON *const cm = &cpi->common;
335 const VP9EncoderConfig *const oxcf = &cpi->oxcf; 352 const VP9EncoderConfig *const oxcf = &cpi->oxcf;
353 RD_OPT *const rd = &cpi->rd;
354 int i;
355
356 if (oxcf->mode == REALTIME) {
357 set_rt_speed_feature_framesize_dependent(cpi, sf, oxcf->speed);
358 } else if (oxcf->mode == GOOD) {
359 set_good_speed_feature_framesize_dependent(cm, sf, oxcf->speed);
360 }
361
362 if (sf->disable_split_mask == DISABLE_ALL_SPLIT) {
363 sf->adaptive_pred_interp_filter = 0;
364 }
365
366 if (cpi->encode_breakout && oxcf->mode == REALTIME &&
367 sf->encode_breakout_thresh > cpi->encode_breakout) {
368 cpi->encode_breakout = sf->encode_breakout_thresh;
369 }
370
371 // Check for masked out split cases.
372 for (i = 0; i < MAX_REFS; ++i) {
373 if (sf->disable_split_mask & (1 << i)) {
374 rd->thresh_mult_sub8x8[i] = INT_MAX;
375 }
376 }
377 }
378
379 void vp9_set_speed_features_framesize_independent(VP9_COMP *cpi) {
380 SPEED_FEATURES *const sf = &cpi->sf;
381 VP9_COMMON *const cm = &cpi->common;
382 MACROBLOCK *const x = &cpi->mb;
383 const VP9EncoderConfig *const oxcf = &cpi->oxcf;
336 int i; 384 int i;
337 385
338 // best quality defaults 386 // best quality defaults
339 sf->frame_parameter_update = 1; 387 sf->frame_parameter_update = 1;
340 sf->mv.search_method = NSTEP; 388 sf->mv.search_method = NSTEP;
341 sf->recode_loop = ALLOW_RECODE; 389 sf->recode_loop = ALLOW_RECODE;
342 sf->mv.subpel_search_method = SUBPEL_TREE; 390 sf->mv.subpel_search_method = SUBPEL_TREE;
343 sf->mv.subpel_iters_per_step = 2; 391 sf->mv.subpel_iters_per_step = 2;
344 sf->mv.subpel_force_stop = 0; 392 sf->mv.subpel_force_stop = 0;
345 sf->optimize_coefficients = !is_lossless_requested(&cpi->oxcf); 393 sf->optimize_coefficients = !is_lossless_requested(&cpi->oxcf);
346 sf->mv.reduce_first_step_size = 0; 394 sf->mv.reduce_first_step_size = 0;
347 sf->mv.auto_mv_step_size = 0; 395 sf->mv.auto_mv_step_size = 0;
348 sf->mv.fullpel_search_step_param = 6; 396 sf->mv.fullpel_search_step_param = 6;
349 sf->comp_inter_joint_search_thresh = BLOCK_4X4; 397 sf->comp_inter_joint_search_thresh = BLOCK_4X4;
350 sf->adaptive_rd_thresh = 0; 398 sf->adaptive_rd_thresh = 0;
351 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_OFF;
352 sf->tx_size_search_method = USE_FULL_RD; 399 sf->tx_size_search_method = USE_FULL_RD;
353 sf->use_lp32x32fdct = 0; 400 sf->use_lp32x32fdct = 0;
354 sf->adaptive_motion_search = 0; 401 sf->adaptive_motion_search = 0;
355 sf->adaptive_pred_interp_filter = 0; 402 sf->adaptive_pred_interp_filter = 0;
356 sf->adaptive_mode_search = 0; 403 sf->adaptive_mode_search = 0;
357 sf->cb_pred_filter_search = 0; 404 sf->cb_pred_filter_search = 0;
358 sf->cb_partition_search = 0; 405 sf->cb_partition_search = 0;
359 sf->motion_field_mode_search = 0; 406 sf->motion_field_mode_search = 0;
360 sf->alt_ref_search_fp = 0; 407 sf->alt_ref_search_fp = 0;
361 sf->use_quant_fp = 0; 408 sf->use_quant_fp = 0;
362 sf->reference_masking = 0; 409 sf->reference_masking = 0;
363 sf->partition_search_type = SEARCH_PARTITION; 410 sf->partition_search_type = SEARCH_PARTITION;
364 sf->less_rectangular_check = 0; 411 sf->less_rectangular_check = 0;
365 sf->use_square_partition_only = 0; 412 sf->use_square_partition_only = 0;
366 sf->auto_min_max_partition_size = NOT_IN_USE; 413 sf->auto_min_max_partition_size = NOT_IN_USE;
367 sf->max_partition_size = BLOCK_64X64; 414 sf->default_max_partition_size = BLOCK_64X64;
368 sf->min_partition_size = BLOCK_4X4; 415 sf->default_min_partition_size = BLOCK_4X4;
369 sf->adjust_partitioning_from_last_frame = 0; 416 sf->adjust_partitioning_from_last_frame = 0;
370 sf->last_partitioning_redo_frequency = 4; 417 sf->last_partitioning_redo_frequency = 4;
371 sf->constrain_copy_partition = 0;
372 sf->disable_split_mask = 0; 418 sf->disable_split_mask = 0;
373 sf->mode_search_skip_flags = 0; 419 sf->mode_search_skip_flags = 0;
374 sf->force_frame_boost = 0; 420 sf->force_frame_boost = 0;
375 sf->max_delta_qindex = 0; 421 sf->max_delta_qindex = 0;
376 sf->disable_filter_search_var_thresh = 0; 422 sf->disable_filter_search_var_thresh = 0;
377 sf->adaptive_interp_filter_search = 0; 423 sf->adaptive_interp_filter_search = 0;
378 sf->allow_partition_search_skip = 0; 424 sf->allow_partition_search_skip = 0;
379 425
380 for (i = 0; i < TX_SIZES; i++) { 426 for (i = 0; i < TX_SIZES; i++) {
381 sf->intra_y_mode_mask[i] = INTRA_ALL; 427 sf->intra_y_mode_mask[i] = INTRA_ALL;
(...skipping 12 matching lines...) Expand all
394 for (i = 0; i < BLOCK_SIZES; ++i) 440 for (i = 0; i < BLOCK_SIZES; ++i)
395 sf->inter_mode_mask[i] = INTER_ALL; 441 sf->inter_mode_mask[i] = INTER_ALL;
396 sf->max_intra_bsize = BLOCK_64X64; 442 sf->max_intra_bsize = BLOCK_64X64;
397 sf->reuse_inter_pred_sby = 0; 443 sf->reuse_inter_pred_sby = 0;
398 // This setting only takes effect when partition_search_type is set 444 // This setting only takes effect when partition_search_type is set
399 // to FIXED_PARTITION. 445 // to FIXED_PARTITION.
400 sf->always_this_block_size = BLOCK_16X16; 446 sf->always_this_block_size = BLOCK_16X16;
401 sf->search_type_check_frequency = 50; 447 sf->search_type_check_frequency = 50;
402 sf->encode_breakout_thresh = 0; 448 sf->encode_breakout_thresh = 0;
403 sf->elevate_newmv_thresh = 0; 449 sf->elevate_newmv_thresh = 0;
404 // Recode loop tolerence %. 450 // Recode loop tolerance %.
405 sf->recode_tolerance = 25; 451 sf->recode_tolerance = 25;
406 sf->default_interp_filter = SWITCHABLE; 452 sf->default_interp_filter = SWITCHABLE;
407 sf->tx_size_search_breakout = 0; 453 sf->tx_size_search_breakout = 0;
408 sf->partition_search_breakout_dist_thr = 0; 454 sf->partition_search_breakout_dist_thr = 0;
409 sf->partition_search_breakout_rate_thr = 0; 455 sf->partition_search_breakout_rate_thr = 0;
410 456
411 if (oxcf->mode == REALTIME) 457 if (oxcf->mode == REALTIME)
412 set_rt_speed_feature(cpi, sf, oxcf->speed, oxcf->content); 458 set_rt_speed_feature(cpi, sf, oxcf->speed, oxcf->content);
413 else if (oxcf->mode == GOOD) 459 else if (oxcf->mode == GOOD)
414 set_good_speed_feature(cpi, cm, sf, oxcf->speed); 460 set_good_speed_feature(cpi, cm, sf, oxcf->speed);
415 461
416 cpi->full_search_sad = vp9_full_search_sad; 462 cpi->full_search_sad = vp9_full_search_sad;
417 cpi->diamond_search_sad = oxcf->mode == BEST ? vp9_full_range_search 463 cpi->diamond_search_sad = oxcf->mode == BEST ? vp9_full_range_search
418 : vp9_diamond_search_sad; 464 : vp9_diamond_search_sad;
419 cpi->refining_search_sad = vp9_refining_search_sad;
420
421 465
422 // Slow quant, dct and trellis not worthwhile for first pass 466 // Slow quant, dct and trellis not worthwhile for first pass
423 // so make sure they are always turned off. 467 // so make sure they are always turned off.
424 if (oxcf->pass == 1) 468 if (oxcf->pass == 1)
425 sf->optimize_coefficients = 0; 469 sf->optimize_coefficients = 0;
426 470
427 // No recode for 1 pass. 471 // No recode for 1 pass.
428 if (oxcf->pass == 0) { 472 if (oxcf->pass == 0) {
429 sf->recode_loop = DISALLOW_RECODE; 473 sf->recode_loop = DISALLOW_RECODE;
430 sf->optimize_coefficients = 0; 474 sf->optimize_coefficients = 0;
431 } 475 }
432 476
433 if (sf->mv.subpel_search_method == SUBPEL_TREE) { 477 if (sf->mv.subpel_search_method == SUBPEL_TREE) {
434 cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_tree; 478 cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_tree;
435 } else if (sf->mv.subpel_search_method == SUBPEL_TREE_PRUNED) { 479 } else if (sf->mv.subpel_search_method == SUBPEL_TREE_PRUNED) {
436 cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_tree_pruned; 480 cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_tree_pruned;
437 } else if (sf->mv.subpel_search_method == SUBPEL_TREE_PRUNED_MORE) { 481 } else if (sf->mv.subpel_search_method == SUBPEL_TREE_PRUNED_MORE) {
438 cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_tree_pruned_more; 482 cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_tree_pruned_more;
439 } else if (sf->mv.subpel_search_method == SUBPEL_TREE_PRUNED_EVENMORE) { 483 } else if (sf->mv.subpel_search_method == SUBPEL_TREE_PRUNED_EVENMORE) {
440 cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_tree_pruned_evenmore; 484 cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_tree_pruned_evenmore;
441 } 485 }
442 486
443 cpi->mb.optimize = sf->optimize_coefficients == 1 && oxcf->pass != 1; 487 x->optimize = sf->optimize_coefficients == 1 && oxcf->pass != 1;
444 488
445 if (sf->disable_split_mask == DISABLE_ALL_SPLIT) 489 x->min_partition_size = sf->default_min_partition_size;
446 sf->adaptive_pred_interp_filter = 0; 490 x->max_partition_size = sf->default_max_partition_size;
447 491
448 if (!cpi->oxcf.frame_periodic_boost) { 492 if (!cpi->oxcf.frame_periodic_boost) {
449 sf->max_delta_qindex = 0; 493 sf->max_delta_qindex = 0;
450 } 494 }
451
452 if (cpi->encode_breakout && oxcf->mode == REALTIME &&
453 sf->encode_breakout_thresh > cpi->encode_breakout)
454 cpi->encode_breakout = sf->encode_breakout_thresh;
455 } 495 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_speed_features.h ('k') | source/libvpx/vp9/encoder/vp9_svc_layercontext.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698