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

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

Issue 958693004: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 10 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_ratectrl.c ('k') | source/libvpx/vp9/encoder/vp9_rdopt.c » ('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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 rd->RDMULT = vp9_compute_rd_mult(cpi, cm->base_qindex + cm->y_dc_delta_q); 272 rd->RDMULT = vp9_compute_rd_mult(cpi, cm->base_qindex + cm->y_dc_delta_q);
273 273
274 x->errorperbit = rd->RDMULT / RD_MULT_EPB_RATIO; 274 x->errorperbit = rd->RDMULT / RD_MULT_EPB_RATIO;
275 x->errorperbit += (x->errorperbit == 0); 275 x->errorperbit += (x->errorperbit == 0);
276 276
277 x->select_tx_size = (cpi->sf.tx_size_search_method == USE_LARGESTALL && 277 x->select_tx_size = (cpi->sf.tx_size_search_method == USE_LARGESTALL &&
278 cm->frame_type != KEY_FRAME) ? 0 : 1; 278 cm->frame_type != KEY_FRAME) ? 0 : 1;
279 279
280 set_block_thresholds(cm, rd); 280 set_block_thresholds(cm, rd);
281 281
282 if (!cpi->sf.use_nonrd_pick_mode || cm->frame_type == KEY_FRAME) { 282 if (!cpi->sf.use_nonrd_pick_mode || cm->frame_type == KEY_FRAME)
283 fill_token_costs(x->token_costs, cm->fc->coef_probs); 283 fill_token_costs(x->token_costs, cm->fc->coef_probs);
284 284
285 if (cpi->sf.partition_search_type != VAR_BASED_PARTITION ||
286 cm->frame_type == KEY_FRAME) {
285 for (i = 0; i < PARTITION_CONTEXTS; ++i) 287 for (i = 0; i < PARTITION_CONTEXTS; ++i)
286 vp9_cost_tokens(cpi->partition_cost[i], get_partition_probs(cm, i), 288 vp9_cost_tokens(cpi->partition_cost[i], get_partition_probs(cm, i),
287 vp9_partition_tree); 289 vp9_partition_tree);
288 } 290 }
289 291
290 if (!cpi->sf.use_nonrd_pick_mode || (cm->current_video_frame & 0x07) == 1 || 292 if (!cpi->sf.use_nonrd_pick_mode || (cm->current_video_frame & 0x07) == 1 ||
291 cm->frame_type == KEY_FRAME) { 293 cm->frame_type == KEY_FRAME) {
292 fill_mode_costs(cpi); 294 fill_mode_costs(cpi);
293 295
294 if (!frame_is_intra_only(cm)) { 296 if (!frame_is_intra_only(cm)) {
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 int raster_block, int16_t *base) { 530 int raster_block, int16_t *base) {
529 const int stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize]; 531 const int stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
530 return base + vp9_raster_block_offset(plane_bsize, raster_block, stride); 532 return base + vp9_raster_block_offset(plane_bsize, raster_block, stride);
531 } 533 }
532 534
533 const YV12_BUFFER_CONFIG *vp9_get_scaled_ref_frame(const VP9_COMP *cpi, 535 const YV12_BUFFER_CONFIG *vp9_get_scaled_ref_frame(const VP9_COMP *cpi,
534 int ref_frame) { 536 int ref_frame) {
535 const VP9_COMMON *const cm = &cpi->common; 537 const VP9_COMMON *const cm = &cpi->common;
536 const int ref_idx = cm->ref_frame_map[get_ref_frame_idx(cpi, ref_frame)]; 538 const int ref_idx = cm->ref_frame_map[get_ref_frame_idx(cpi, ref_frame)];
537 const int scaled_idx = cpi->scaled_ref_idx[ref_frame - 1]; 539 const int scaled_idx = cpi->scaled_ref_idx[ref_frame - 1];
538 return (scaled_idx != ref_idx) ? &cm->frame_bufs[scaled_idx].buf : NULL; 540 return (scaled_idx != ref_idx) ?
541 &cm->buffer_pool->frame_bufs[scaled_idx].buf : NULL;
539 } 542 }
540 543
541 int vp9_get_switchable_rate(const VP9_COMP *cpi, const MACROBLOCKD *const xd) { 544 int vp9_get_switchable_rate(const VP9_COMP *cpi, const MACROBLOCKD *const xd) {
542 const MB_MODE_INFO *const mbmi = &xd->mi[0].src_mi->mbmi; 545 const MB_MODE_INFO *const mbmi = &xd->mi[0].src_mi->mbmi;
543 const int ctx = vp9_get_pred_context_switchable_interp(xd); 546 const int ctx = vp9_get_pred_context_switchable_interp(xd);
544 return SWITCHABLE_INTERP_RATE_FACTOR * 547 return SWITCHABLE_INTERP_RATE_FACTOR *
545 cpi->switchable_interp_costs[ctx][mbmi->interp_filter]; 548 cpi->switchable_interp_costs[ctx][mbmi->interp_filter];
546 } 549 }
547 550
548 void vp9_set_rd_speed_thresholds(VP9_COMP *cpi) { 551 void vp9_set_rd_speed_thresholds(VP9_COMP *cpi) {
(...skipping 14 matching lines...) Expand all
563 rd->thresh_mult[THR_NEARESTG] = 0; 566 rd->thresh_mult[THR_NEARESTG] = 0;
564 rd->thresh_mult[THR_NEARESTA] = 0; 567 rd->thresh_mult[THR_NEARESTA] = 0;
565 } 568 }
566 569
567 rd->thresh_mult[THR_DC] += 1000; 570 rd->thresh_mult[THR_DC] += 1000;
568 571
569 rd->thresh_mult[THR_NEWMV] += 1000; 572 rd->thresh_mult[THR_NEWMV] += 1000;
570 rd->thresh_mult[THR_NEWA] += 1000; 573 rd->thresh_mult[THR_NEWA] += 1000;
571 rd->thresh_mult[THR_NEWG] += 1000; 574 rd->thresh_mult[THR_NEWG] += 1000;
572 575
573 // Adjust threshold only in real time mode, which only uses last
574 // reference frame.
575 rd->thresh_mult[THR_NEWMV] += sf->elevate_newmv_thresh;
576
577 rd->thresh_mult[THR_NEARMV] += 1000; 576 rd->thresh_mult[THR_NEARMV] += 1000;
578 rd->thresh_mult[THR_NEARA] += 1000; 577 rd->thresh_mult[THR_NEARA] += 1000;
579 rd->thresh_mult[THR_COMP_NEARESTLA] += 1000; 578 rd->thresh_mult[THR_COMP_NEARESTLA] += 1000;
580 rd->thresh_mult[THR_COMP_NEARESTGA] += 1000; 579 rd->thresh_mult[THR_COMP_NEARESTGA] += 1000;
581 580
582 rd->thresh_mult[THR_TM] += 1000; 581 rd->thresh_mult[THR_TM] += 1000;
583 582
584 rd->thresh_mult[THR_COMP_NEARLA] += 1500; 583 rd->thresh_mult[THR_COMP_NEARLA] += 1500;
585 rd->thresh_mult[THR_COMP_NEWLA] += 2000; 584 rd->thresh_mult[THR_COMP_NEWLA] += 2000;
586 rd->thresh_mult[THR_NEARG] += 1000; 585 rd->thresh_mult[THR_NEARG] += 1000;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 return ROUND_POWER_OF_TWO(5 * q, 2); 647 return ROUND_POWER_OF_TWO(5 * q, 2);
649 default: 648 default:
650 assert(0 && "bit_depth should be VPX_BITS_8, VPX_BITS_10 or VPX_BITS_12"); 649 assert(0 && "bit_depth should be VPX_BITS_8, VPX_BITS_10 or VPX_BITS_12");
651 return -1; 650 return -1;
652 } 651 }
653 #else 652 #else
654 return 20 * q; 653 return 20 * q;
655 #endif // CONFIG_VP9_HIGHBITDEPTH 654 #endif // CONFIG_VP9_HIGHBITDEPTH
656 } 655 }
657 656
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_ratectrl.c ('k') | source/libvpx/vp9/encoder/vp9_rdopt.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698