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

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

Issue 1124333011: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: only update to last nights LKGR Created 5 years, 7 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
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_speed_features.h ('k') | source/libvpx/vp9/encoder/vp9_ssim.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 if (speed >= 4) { 65 if (speed >= 4) {
66 if (MIN(cm->width, cm->height) >= 720) { 66 if (MIN(cm->width, cm->height) >= 720) {
67 sf->partition_search_breakout_dist_thr = (1 << 26); 67 sf->partition_search_breakout_dist_thr = (1 << 26);
68 } else { 68 } else {
69 sf->partition_search_breakout_dist_thr = (1 << 24); 69 sf->partition_search_breakout_dist_thr = (1 << 24);
70 } 70 }
71 sf->disable_split_mask = DISABLE_ALL_SPLIT; 71 sf->disable_split_mask = DISABLE_ALL_SPLIT;
72 } 72 }
73 } 73 }
74 74
75 // Sets a partition size down to which the auto partition code will always
76 // search (can go lower), based on the image dimensions. The logic here
77 // is that the extent to which ringing artefacts are offensive, depends
78 // partly on the screen area that over which they propogate. Propogation is
79 // limited by transform block size but the screen area take up by a given block
80 // size will be larger for a small image format stretched to full screen.
81 static BLOCK_SIZE set_partition_min_limit(VP9_COMP *cpi) {
82 VP9_COMMON *const cm = &cpi->common;
83 unsigned int screen_area = (cm->width * cm->height);
84
85 // Select block size based on image format size.
86 if (screen_area < 1280 * 720) {
87 // Formats smaller in area than 720P
88 return BLOCK_4X4;
89 } else if (screen_area < 1920 * 1080) {
90 // Format >= 720P and < 1080P
91 return BLOCK_8X8;
92 } else {
93 // Formats 1080P and up
94 return BLOCK_16X16;
95 }
96 }
97
75 static void set_good_speed_feature(VP9_COMP *cpi, VP9_COMMON *cm, 98 static void set_good_speed_feature(VP9_COMP *cpi, VP9_COMMON *cm,
76 SPEED_FEATURES *sf, int speed) { 99 SPEED_FEATURES *sf, int speed) {
77 const int boosted = frame_is_boosted(cpi); 100 const int boosted = frame_is_boosted(cpi);
78 101
79 sf->adaptive_rd_thresh = 1; 102 sf->adaptive_rd_thresh = 1;
80 sf->allow_skip_recode = 1; 103 sf->allow_skip_recode = 1;
81 104
82 if (speed >= 1) { 105 if (speed >= 1) {
83 sf->use_square_partition_only = !frame_is_intra_only(cm); 106 sf->use_square_partition_only = !frame_is_intra_only(cm);
84 sf->less_rectangular_check = 1; 107 sf->less_rectangular_check = 1;
(...skipping 23 matching lines...) Expand all
108 // Reference masking is not supported in dynamic scaling mode. 131 // Reference masking is not supported in dynamic scaling mode.
109 sf->reference_masking = cpi->oxcf.resize_mode != RESIZE_DYNAMIC ? 1 : 0; 132 sf->reference_masking = cpi->oxcf.resize_mode != RESIZE_DYNAMIC ? 1 : 0;
110 133
111 sf->mode_search_skip_flags = (cm->frame_type == KEY_FRAME) ? 0 : 134 sf->mode_search_skip_flags = (cm->frame_type == KEY_FRAME) ? 0 :
112 FLAG_SKIP_INTRA_DIRMISMATCH | 135 FLAG_SKIP_INTRA_DIRMISMATCH |
113 FLAG_SKIP_INTRA_BESTINTER | 136 FLAG_SKIP_INTRA_BESTINTER |
114 FLAG_SKIP_COMP_BESTINTRA | 137 FLAG_SKIP_COMP_BESTINTRA |
115 FLAG_SKIP_INTRA_LOWVAR; 138 FLAG_SKIP_INTRA_LOWVAR;
116 sf->disable_filter_search_var_thresh = 100; 139 sf->disable_filter_search_var_thresh = 100;
117 sf->comp_inter_joint_search_thresh = BLOCK_SIZES; 140 sf->comp_inter_joint_search_thresh = BLOCK_SIZES;
118 sf->auto_min_max_partition_size = CONSTRAIN_NEIGHBORING_MIN_MAX; 141 sf->auto_min_max_partition_size = RELAXED_NEIGHBORING_MIN_MAX;
119 142 sf->rd_auto_partition_min_limit = set_partition_min_limit(cpi);
120 sf->allow_partition_search_skip = 1; 143 sf->allow_partition_search_skip = 1;
121 } 144 }
122 145
123 if (speed >= 3) { 146 if (speed >= 3) {
124 sf->tx_size_search_method = frame_is_intra_only(cm) ? USE_FULL_RD 147 sf->tx_size_search_method = frame_is_intra_only(cm) ? USE_FULL_RD
125 : USE_LARGESTALL; 148 : USE_LARGESTALL;
126 sf->mv.subpel_search_method = SUBPEL_TREE_PRUNED; 149 sf->mv.subpel_search_method = SUBPEL_TREE_PRUNED;
127 sf->adaptive_pred_interp_filter = 0; 150 sf->adaptive_pred_interp_filter = 0;
128 sf->adaptive_mode_search = 1; 151 sf->adaptive_mode_search = 1;
129 sf->cb_partition_search = !boosted; 152 sf->cb_partition_search = !boosted;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 if (speed >= 5) { 317 if (speed >= 5) {
295 sf->use_quant_fp = !is_keyframe; 318 sf->use_quant_fp = !is_keyframe;
296 sf->auto_min_max_partition_size = is_keyframe ? RELAXED_NEIGHBORING_MIN_MAX 319 sf->auto_min_max_partition_size = is_keyframe ? RELAXED_NEIGHBORING_MIN_MAX
297 : STRICT_NEIGHBORING_MIN_MAX; 320 : STRICT_NEIGHBORING_MIN_MAX;
298 sf->default_max_partition_size = BLOCK_32X32; 321 sf->default_max_partition_size = BLOCK_32X32;
299 sf->default_min_partition_size = BLOCK_8X8; 322 sf->default_min_partition_size = BLOCK_8X8;
300 sf->force_frame_boost = is_keyframe || 323 sf->force_frame_boost = is_keyframe ||
301 (frames_since_key % (sf->last_partitioning_redo_frequency << 1) == 1); 324 (frames_since_key % (sf->last_partitioning_redo_frequency << 1) == 1);
302 sf->max_delta_qindex = is_keyframe ? 20 : 15; 325 sf->max_delta_qindex = is_keyframe ? 20 : 15;
303 sf->partition_search_type = REFERENCE_PARTITION; 326 sf->partition_search_type = REFERENCE_PARTITION;
304 sf->use_nonrd_pick_mode = !is_keyframe; 327 sf->use_nonrd_pick_mode = 1;
305 sf->allow_skip_recode = 0; 328 sf->allow_skip_recode = 0;
306 sf->inter_mode_mask[BLOCK_32X32] = INTER_NEAREST_NEW_ZERO; 329 sf->inter_mode_mask[BLOCK_32X32] = INTER_NEAREST_NEW_ZERO;
307 sf->inter_mode_mask[BLOCK_32X64] = INTER_NEAREST_NEW_ZERO; 330 sf->inter_mode_mask[BLOCK_32X64] = INTER_NEAREST_NEW_ZERO;
308 sf->inter_mode_mask[BLOCK_64X32] = INTER_NEAREST_NEW_ZERO; 331 sf->inter_mode_mask[BLOCK_64X32] = INTER_NEAREST_NEW_ZERO;
309 sf->inter_mode_mask[BLOCK_64X64] = INTER_NEAREST_NEW_ZERO; 332 sf->inter_mode_mask[BLOCK_64X64] = INTER_NEAREST_NEW_ZERO;
310 sf->adaptive_rd_thresh = 2; 333 sf->adaptive_rd_thresh = 2;
311 // This feature is only enabled when partition search is disabled. 334 // This feature is only enabled when partition search is disabled.
312 sf->reuse_inter_pred_sby = 1; 335 sf->reuse_inter_pred_sby = 1;
313 sf->partition_search_breakout_rate_thr = 200; 336 sf->partition_search_breakout_rate_thr = 200;
314 sf->coeff_prob_appx_step = 4; 337 sf->coeff_prob_appx_step = 4;
315 sf->use_fast_coef_updates = is_keyframe ? TWO_LOOP : ONE_LOOP_REDUCED; 338 sf->use_fast_coef_updates = is_keyframe ? TWO_LOOP : ONE_LOOP_REDUCED;
316 sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH; 339 sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH;
317 340
318 if (!is_keyframe) { 341 if (!is_keyframe) {
319 int i; 342 int i;
320 if (content == VP9E_CONTENT_SCREEN) { 343 if (content == VP9E_CONTENT_SCREEN) {
321 for (i = 0; i < TX_SIZES; ++i) 344 for (i = 0; i < BLOCK_SIZES; ++i)
322 sf->intra_y_mode_mask[i] = INTRA_DC_TM_H_V; 345 sf->intra_y_mode_bsize_mask[i] = INTRA_DC_TM_H_V;
323 } else { 346 } else {
324 for (i = 0; i < TX_SIZES; i++) 347 for (i = 0; i < BLOCK_SIZES; ++i)
325 sf->intra_y_mode_mask[i] = INTRA_DC; 348 if (i >= BLOCK_16X16)
349 sf->intra_y_mode_bsize_mask[i] = INTRA_DC;
350 else
351 // Use H and V intra mode for block sizes <= 16X16.
352 sf->intra_y_mode_bsize_mask[i] = INTRA_DC_H_V;
326 } 353 }
327 } 354 }
328 } 355 }
329 356
330 if (speed >= 6) { 357 if (speed >= 6) {
331 // Adaptively switch between SOURCE_VAR_BASED_PARTITION and FIXED_PARTITION. 358 // Adaptively switch between SOURCE_VAR_BASED_PARTITION and FIXED_PARTITION.
332 sf->partition_search_type = VAR_BASED_PARTITION; 359 sf->partition_search_type = VAR_BASED_PARTITION;
333 // Turn on this to use non-RD key frame coding mode. 360 // Turn on this to use non-RD key frame coding mode.
334 sf->use_nonrd_pick_mode = 1; 361 sf->use_nonrd_pick_mode = 1;
335 sf->mv.search_method = NSTEP; 362 sf->mv.search_method = NSTEP;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 sf->cb_pred_filter_search = 0; 436 sf->cb_pred_filter_search = 0;
410 sf->cb_partition_search = 0; 437 sf->cb_partition_search = 0;
411 sf->motion_field_mode_search = 0; 438 sf->motion_field_mode_search = 0;
412 sf->alt_ref_search_fp = 0; 439 sf->alt_ref_search_fp = 0;
413 sf->use_quant_fp = 0; 440 sf->use_quant_fp = 0;
414 sf->reference_masking = 0; 441 sf->reference_masking = 0;
415 sf->partition_search_type = SEARCH_PARTITION; 442 sf->partition_search_type = SEARCH_PARTITION;
416 sf->less_rectangular_check = 0; 443 sf->less_rectangular_check = 0;
417 sf->use_square_partition_only = 0; 444 sf->use_square_partition_only = 0;
418 sf->auto_min_max_partition_size = NOT_IN_USE; 445 sf->auto_min_max_partition_size = NOT_IN_USE;
446 sf->rd_auto_partition_min_limit = BLOCK_4X4;
419 sf->default_max_partition_size = BLOCK_64X64; 447 sf->default_max_partition_size = BLOCK_64X64;
420 sf->default_min_partition_size = BLOCK_4X4; 448 sf->default_min_partition_size = BLOCK_4X4;
421 sf->adjust_partitioning_from_last_frame = 0; 449 sf->adjust_partitioning_from_last_frame = 0;
422 sf->last_partitioning_redo_frequency = 4; 450 sf->last_partitioning_redo_frequency = 4;
423 sf->disable_split_mask = 0; 451 sf->disable_split_mask = 0;
424 sf->mode_search_skip_flags = 0; 452 sf->mode_search_skip_flags = 0;
425 sf->force_frame_boost = 0; 453 sf->force_frame_boost = 0;
426 sf->max_delta_qindex = 0; 454 sf->max_delta_qindex = 0;
427 sf->disable_filter_search_var_thresh = 0; 455 sf->disable_filter_search_var_thresh = 0;
428 sf->adaptive_interp_filter_search = 0; 456 sf->adaptive_interp_filter_search = 0;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 518
491 x->optimize = sf->optimize_coefficients == 1 && oxcf->pass != 1; 519 x->optimize = sf->optimize_coefficients == 1 && oxcf->pass != 1;
492 520
493 x->min_partition_size = sf->default_min_partition_size; 521 x->min_partition_size = sf->default_min_partition_size;
494 x->max_partition_size = sf->default_max_partition_size; 522 x->max_partition_size = sf->default_max_partition_size;
495 523
496 if (!cpi->oxcf.frame_periodic_boost) { 524 if (!cpi->oxcf.frame_periodic_boost) {
497 sf->max_delta_qindex = 0; 525 sf->max_delta_qindex = 0;
498 } 526 }
499 } 527 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_speed_features.h ('k') | source/libvpx/vp9/encoder/vp9_ssim.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698