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

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

Issue 375983002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 5 months 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
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 sf->recode_loop = ALLOW_RECODE_KFARFGF; 78 sf->recode_loop = ALLOW_RECODE_KFARFGF;
79 sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_H_V; 79 sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_H_V;
80 sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC_H_V; 80 sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC_H_V;
81 sf->intra_y_mode_mask[TX_16X16] = INTRA_DC_H_V; 81 sf->intra_y_mode_mask[TX_16X16] = INTRA_DC_H_V;
82 sf->intra_uv_mode_mask[TX_16X16] = INTRA_DC_H_V; 82 sf->intra_uv_mode_mask[TX_16X16] = INTRA_DC_H_V;
83 } 83 }
84 84
85 if (speed >= 2) { 85 if (speed >= 2) {
86 if (MIN(cm->width, cm->height) >= 720) { 86 if (MIN(cm->width, cm->height) >= 720) {
87 sf->lf_motion_threshold = LOW_MOITION_THRESHOLD; 87 sf->lf_motion_threshold = LOW_MOTION_THRESHOLD;
88 sf->last_partitioning_redo_frequency = 3; 88 sf->last_partitioning_redo_frequency = 3;
89 sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT 89 sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT
90 : DISABLE_ALL_INTER_SPLIT; 90 : DISABLE_ALL_INTER_SPLIT;
91 } else { 91 } else {
92 sf->disable_split_mask = LAST_AND_INTRA_SPLIT_ONLY; 92 sf->disable_split_mask = LAST_AND_INTRA_SPLIT_ONLY;
93 sf->last_partitioning_redo_frequency = 2; 93 sf->last_partitioning_redo_frequency = 2;
94 sf->lf_motion_threshold = NO_MOITION_THRESHOLD; 94 sf->lf_motion_threshold = NO_MOTION_THRESHOLD;
95 } 95 }
96 sf->adaptive_pred_interp_filter = 2; 96
97 sf->adaptive_pred_interp_filter = 0;
97 sf->reference_masking = 1; 98 sf->reference_masking = 1;
98 sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH | 99 sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH |
99 FLAG_SKIP_INTRA_BESTINTER | 100 FLAG_SKIP_INTRA_BESTINTER |
100 FLAG_SKIP_COMP_BESTINTRA | 101 FLAG_SKIP_COMP_BESTINTRA |
101 FLAG_SKIP_INTRA_LOWVAR; 102 FLAG_SKIP_INTRA_LOWVAR;
102 sf->disable_filter_search_var_thresh = 100; 103 sf->disable_filter_search_var_thresh = 100;
103 sf->comp_inter_joint_search_thresh = BLOCK_SIZES; 104 sf->comp_inter_joint_search_thresh = BLOCK_SIZES;
104 sf->auto_min_max_partition_size = RELAXED_NEIGHBORING_MIN_MAX; 105 sf->auto_min_max_partition_size = RELAXED_NEIGHBORING_MIN_MAX;
105 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_LOW_MOTION; 106 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_LOW_MOTION;
106 sf->adjust_partitioning_from_last_frame = 1; 107 sf->adjust_partitioning_from_last_frame = 1;
107 } 108 }
108 109
109 if (speed >= 3) { 110 if (speed >= 3) {
110 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
111 : USE_LARGESTALL; 112 : USE_LARGESTALL;
112 if (MIN(cm->width, cm->height) >= 720) 113 if (MIN(cm->width, cm->height) >= 720)
113 sf->disable_split_mask = DISABLE_ALL_SPLIT; 114 sf->disable_split_mask = DISABLE_ALL_SPLIT;
114 else 115 else
115 sf->disable_split_mask = DISABLE_ALL_INTER_SPLIT; 116 sf->disable_split_mask = DISABLE_ALL_INTER_SPLIT;
116 117
117 sf->lf_motion_threshold = LOW_MOITION_THRESHOLD; 118 sf->lf_motion_threshold = LOW_MOTION_THRESHOLD;
118 sf->last_partitioning_redo_frequency = 3; 119 sf->last_partitioning_redo_frequency = 3;
119 sf->recode_loop = ALLOW_RECODE_KFMAXBW; 120 sf->recode_loop = ALLOW_RECODE_KFMAXBW;
120 sf->adaptive_rd_thresh = 3; 121 sf->adaptive_rd_thresh = 3;
121 sf->mode_skip_start = 6; 122 sf->mode_skip_start = 6;
122 sf->use_fast_coef_updates = ONE_LOOP_REDUCED; 123 sf->use_fast_coef_updates = ONE_LOOP_REDUCED;
123 sf->use_fast_coef_costing = 1; 124 sf->use_fast_coef_costing = 1;
124 } 125 }
125 126
126 if (speed >= 4) { 127 if (speed >= 4) {
127 sf->use_square_partition_only = 1; 128 sf->use_square_partition_only = 1;
(...skipping 13 matching lines...) Expand all
141 sf->partition_search_type = FIXED_PARTITION; 142 sf->partition_search_type = FIXED_PARTITION;
142 sf->optimize_coefficients = 0; 143 sf->optimize_coefficients = 0;
143 sf->mv.search_method = HEX; 144 sf->mv.search_method = HEX;
144 sf->disable_filter_search_var_thresh = 500; 145 sf->disable_filter_search_var_thresh = 500;
145 for (i = 0; i < TX_SIZES; ++i) { 146 for (i = 0; i < TX_SIZES; ++i) {
146 sf->intra_y_mode_mask[i] = INTRA_DC; 147 sf->intra_y_mode_mask[i] = INTRA_DC;
147 sf->intra_uv_mode_mask[i] = INTRA_DC; 148 sf->intra_uv_mode_mask[i] = INTRA_DC;
148 } 149 }
149 cpi->allow_encode_breakout = ENCODE_BREAKOUT_ENABLED; 150 cpi->allow_encode_breakout = ENCODE_BREAKOUT_ENABLED;
150 } 151 }
152 if (speed >= 6) {
153 sf->mv.reduce_first_step_size = 1;
154 }
151 } 155 }
152 156
153 static void set_rt_speed_feature(VP9_COMP *cpi, SPEED_FEATURES *sf, 157 static void set_rt_speed_feature(VP9_COMP *cpi, SPEED_FEATURES *sf,
154 int speed) { 158 int speed) {
155 VP9_COMMON *const cm = &cpi->common; 159 VP9_COMMON *const cm = &cpi->common;
156 const int frames_since_key = 160 const int frames_since_key =
157 cm->frame_type == KEY_FRAME ? 0 : cpi->rc.frames_since_key; 161 cm->frame_type == KEY_FRAME ? 0 : cpi->rc.frames_since_key;
158 sf->static_segmentation = 0; 162 sf->static_segmentation = 0;
159 sf->adaptive_rd_thresh = 1; 163 sf->adaptive_rd_thresh = 1;
160 sf->use_fast_coef_costing = 1; 164 sf->use_fast_coef_costing = 1;
(...skipping 30 matching lines...) Expand all
191 sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH | 195 sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH |
192 FLAG_SKIP_INTRA_BESTINTER | 196 FLAG_SKIP_INTRA_BESTINTER |
193 FLAG_SKIP_COMP_BESTINTRA | 197 FLAG_SKIP_COMP_BESTINTRA |
194 FLAG_SKIP_INTRA_LOWVAR; 198 FLAG_SKIP_INTRA_LOWVAR;
195 sf->adaptive_pred_interp_filter = 2; 199 sf->adaptive_pred_interp_filter = 2;
196 sf->reference_masking = 1; 200 sf->reference_masking = 1;
197 sf->disable_filter_search_var_thresh = 50; 201 sf->disable_filter_search_var_thresh = 50;
198 sf->comp_inter_joint_search_thresh = BLOCK_SIZES; 202 sf->comp_inter_joint_search_thresh = BLOCK_SIZES;
199 sf->auto_min_max_partition_size = RELAXED_NEIGHBORING_MIN_MAX; 203 sf->auto_min_max_partition_size = RELAXED_NEIGHBORING_MIN_MAX;
200 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_LOW_MOTION; 204 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_LOW_MOTION;
201 sf->lf_motion_threshold = LOW_MOITION_THRESHOLD; 205 sf->lf_motion_threshold = LOW_MOTION_THRESHOLD;
202 sf->adjust_partitioning_from_last_frame = 1; 206 sf->adjust_partitioning_from_last_frame = 1;
203 sf->last_partitioning_redo_frequency = 3; 207 sf->last_partitioning_redo_frequency = 3;
204 sf->use_lp32x32fdct = 1; 208 sf->use_lp32x32fdct = 1;
205 sf->mode_skip_start = 11; 209 sf->mode_skip_start = 11;
206 sf->intra_y_mode_mask[TX_16X16] = INTRA_DC_H_V; 210 sf->intra_y_mode_mask[TX_16X16] = INTRA_DC_H_V;
207 } 211 }
208 212
209 if (speed >= 3) { 213 if (speed >= 3) {
210 sf->use_square_partition_only = 1; 214 sf->use_square_partition_only = 1;
211 sf->disable_filter_search_var_thresh = 100; 215 sf->disable_filter_search_var_thresh = 100;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 sf->partition_search_type = REFERENCE_PARTITION; 266 sf->partition_search_type = REFERENCE_PARTITION;
263 sf->use_nonrd_pick_mode = 1; 267 sf->use_nonrd_pick_mode = 1;
264 sf->mv.search_method = FAST_DIAMOND; 268 sf->mv.search_method = FAST_DIAMOND;
265 sf->allow_skip_recode = 0; 269 sf->allow_skip_recode = 0;
266 } 270 }
267 271
268 if (speed >= 6) { 272 if (speed >= 6) {
269 // Adaptively switch between SOURCE_VAR_BASED_PARTITION and FIXED_PARTITION. 273 // Adaptively switch between SOURCE_VAR_BASED_PARTITION and FIXED_PARTITION.
270 sf->partition_search_type = SOURCE_VAR_BASED_PARTITION; 274 sf->partition_search_type = SOURCE_VAR_BASED_PARTITION;
271 sf->search_type_check_frequency = 50; 275 sf->search_type_check_frequency = 50;
272 sf->source_var_thresh = 360;
273 276
274 sf->tx_size_search_method = USE_TX_8X8; 277 sf->tx_size_search_method = (cm->frame_type == KEY_FRAME) ?
275 // TODO(yunqingwang): max_intra_bsize is used to decide if DC_PRED mode 278 USE_LARGESTALL : USE_TX_8X8;
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 sf->max_intra_bsize = BLOCK_8X8;
280
281 // This feature is only enabled when partition search is disabled.
282 sf->reuse_inter_pred_sby = 1;
283
284 // Increase mode checking threshold for NEWMV.
285 sf->elevate_newmv_thresh = 2000;
286
287 sf->mv.reduce_first_step_size = 1;
279 } 288 }
280
281 if (speed >= 7) { 289 if (speed >= 7) {
290 sf->use_quant_fp = cm->frame_type == KEY_FRAME ? 0 : 1;
291 sf->mv.fullpel_search_step_param = 10;
292 sf->lpf_pick = LPF_PICK_MINIMAL_LPF;
293 sf->encode_breakout_thresh = (MIN(cm->width, cm->height) >= 720) ?
294 800 : 300;
295 sf->elevate_newmv_thresh = 2500;
296 }
297 if (speed >= 8) {
282 int i; 298 int i;
283 for (i = 0; i < BLOCK_SIZES; ++i) 299 for (i = 0; i < BLOCK_SIZES; ++i)
284 sf->inter_mode_mask[i] = INTER_NEAREST; 300 sf->inter_mode_mask[i] = INTER_NEAREST;
285 } 301 }
286 } 302 }
287 303
288 void vp9_set_speed_features(VP9_COMP *cpi) { 304 void vp9_set_speed_features(VP9_COMP *cpi) {
289 SPEED_FEATURES *const sf = &cpi->sf; 305 SPEED_FEATURES *const sf = &cpi->sf;
290 VP9_COMMON *const cm = &cpi->common; 306 VP9_COMMON *const cm = &cpi->common;
291 const VP9EncoderConfig *const oxcf = &cpi->oxcf; 307 const VP9EncoderConfig *const oxcf = &cpi->oxcf;
292 int i; 308 int i;
293 309
294 // best quality defaults 310 // best quality defaults
295 sf->frame_parameter_update = 1; 311 sf->frame_parameter_update = 1;
296 sf->mv.search_method = NSTEP; 312 sf->mv.search_method = NSTEP;
297 sf->recode_loop = ALLOW_RECODE; 313 sf->recode_loop = ALLOW_RECODE;
298 sf->mv.subpel_search_method = SUBPEL_TREE; 314 sf->mv.subpel_search_method = SUBPEL_TREE;
299 sf->mv.subpel_iters_per_step = 2; 315 sf->mv.subpel_iters_per_step = 2;
300 sf->mv.subpel_force_stop = 0; 316 sf->mv.subpel_force_stop = 0;
301 sf->optimize_coefficients = !is_lossless_requested(&cpi->oxcf); 317 sf->optimize_coefficients = !is_lossless_requested(&cpi->oxcf);
302 sf->mv.reduce_first_step_size = 0; 318 sf->mv.reduce_first_step_size = 0;
303 sf->mv.auto_mv_step_size = 0; 319 sf->mv.auto_mv_step_size = 0;
304 sf->mv.max_step_search_steps = MAX_MVSEARCH_STEPS; 320 sf->mv.fullpel_search_step_param = 6;
305 sf->comp_inter_joint_search_thresh = BLOCK_4X4; 321 sf->comp_inter_joint_search_thresh = BLOCK_4X4;
306 sf->adaptive_rd_thresh = 0; 322 sf->adaptive_rd_thresh = 0;
307 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_OFF; 323 sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_OFF;
308 sf->tx_size_search_method = USE_FULL_RD; 324 sf->tx_size_search_method = USE_FULL_RD;
309 sf->use_lp32x32fdct = 0; 325 sf->use_lp32x32fdct = 0;
310 sf->adaptive_motion_search = 0; 326 sf->adaptive_motion_search = 0;
311 sf->adaptive_pred_interp_filter = 0; 327 sf->adaptive_pred_interp_filter = 0;
328 sf->use_quant_fp = 0;
312 sf->reference_masking = 0; 329 sf->reference_masking = 0;
313 sf->partition_search_type = SEARCH_PARTITION; 330 sf->partition_search_type = SEARCH_PARTITION;
314 sf->less_rectangular_check = 0; 331 sf->less_rectangular_check = 0;
315 sf->use_square_partition_only = 0; 332 sf->use_square_partition_only = 0;
316 sf->auto_min_max_partition_size = NOT_IN_USE; 333 sf->auto_min_max_partition_size = NOT_IN_USE;
317 sf->max_partition_size = BLOCK_64X64; 334 sf->max_partition_size = BLOCK_64X64;
318 sf->min_partition_size = BLOCK_4X4; 335 sf->min_partition_size = BLOCK_4X4;
319 sf->adjust_partitioning_from_last_frame = 0; 336 sf->adjust_partitioning_from_last_frame = 0;
320 sf->last_partitioning_redo_frequency = 4; 337 sf->last_partitioning_redo_frequency = 4;
321 sf->constrain_copy_partition = 0; 338 sf->constrain_copy_partition = 0;
(...skipping 12 matching lines...) Expand all
334 sf->use_uv_intra_rd_estimate = 0; 351 sf->use_uv_intra_rd_estimate = 0;
335 sf->allow_skip_recode = 0; 352 sf->allow_skip_recode = 0;
336 sf->lpf_pick = LPF_PICK_FROM_FULL_IMAGE; 353 sf->lpf_pick = LPF_PICK_FROM_FULL_IMAGE;
337 sf->use_fast_coef_updates = TWO_LOOP; 354 sf->use_fast_coef_updates = TWO_LOOP;
338 sf->use_fast_coef_costing = 0; 355 sf->use_fast_coef_costing = 0;
339 sf->mode_skip_start = MAX_MODES; // Mode index at which mode skip mask set 356 sf->mode_skip_start = MAX_MODES; // Mode index at which mode skip mask set
340 sf->use_nonrd_pick_mode = 0; 357 sf->use_nonrd_pick_mode = 0;
341 for (i = 0; i < BLOCK_SIZES; ++i) 358 for (i = 0; i < BLOCK_SIZES; ++i)
342 sf->inter_mode_mask[i] = INTER_ALL; 359 sf->inter_mode_mask[i] = INTER_ALL;
343 sf->max_intra_bsize = BLOCK_64X64; 360 sf->max_intra_bsize = BLOCK_64X64;
361 sf->reuse_inter_pred_sby = 0;
344 // This setting only takes effect when partition_search_type is set 362 // This setting only takes effect when partition_search_type is set
345 // to FIXED_PARTITION. 363 // to FIXED_PARTITION.
346 sf->always_this_block_size = BLOCK_16X16; 364 sf->always_this_block_size = BLOCK_16X16;
347 sf->search_type_check_frequency = 50; 365 sf->search_type_check_frequency = 50;
348 sf->source_var_thresh = 100; 366 sf->encode_breakout_thresh = 0;
349 367 sf->elevate_newmv_thresh = 0;
350 // Recode loop tolerence %. 368 // Recode loop tolerence %.
351 sf->recode_tolerance = 25; 369 sf->recode_tolerance = 25;
352 370
353 switch (oxcf->mode) { 371 switch (oxcf->mode) {
354 case ONE_PASS_BEST: 372 case ONE_PASS_BEST:
355 case TWO_PASS_SECOND_BEST: // This is the best quality mode. 373 case TWO_PASS_SECOND_BEST: // This is the best quality mode.
356 cpi->diamond_search_sad = vp9_full_range_search; 374 cpi->diamond_search_sad = vp9_full_range_search;
357 break; 375 break;
358 case TWO_PASS_FIRST: 376 case TWO_PASS_FIRST:
359 case ONE_PASS_GOOD: 377 case ONE_PASS_GOOD:
(...skipping 22 matching lines...) Expand all
382 } 400 }
383 401
384 cpi->mb.optimize = sf->optimize_coefficients == 1 && cpi->pass != 1; 402 cpi->mb.optimize = sf->optimize_coefficients == 1 && cpi->pass != 1;
385 403
386 if (sf->disable_split_mask == DISABLE_ALL_SPLIT) 404 if (sf->disable_split_mask == DISABLE_ALL_SPLIT)
387 sf->adaptive_pred_interp_filter = 0; 405 sf->adaptive_pred_interp_filter = 0;
388 406
389 if (!cpi->oxcf.frame_periodic_boost) { 407 if (!cpi->oxcf.frame_periodic_boost) {
390 sf->max_delta_qindex = 0; 408 sf->max_delta_qindex = 0;
391 } 409 }
410
411 if (cpi->encode_breakout && oxcf->mode == REALTIME &&
412 sf->encode_breakout_thresh > cpi->encode_breakout)
413 cpi->encode_breakout = sf->encode_breakout_thresh;
392 } 414 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_speed_features.h ('k') | source/libvpx/vp9/encoder/vp9_svc_layercontext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698