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

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

Issue 1217053002: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 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
« 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 ? rd->thresh_mult_sub8x8[i] * t / 4 258 ? rd->thresh_mult_sub8x8[i] * t / 4
259 : INT_MAX; 259 : INT_MAX;
260 } 260 }
261 } 261 }
262 } 262 }
263 } 263 }
264 264
265 void vp9_initialize_rd_consts(VP9_COMP *cpi) { 265 void vp9_initialize_rd_consts(VP9_COMP *cpi) {
266 VP9_COMMON *const cm = &cpi->common; 266 VP9_COMMON *const cm = &cpi->common;
267 MACROBLOCK *const x = &cpi->td.mb; 267 MACROBLOCK *const x = &cpi->td.mb;
268 MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
268 RD_OPT *const rd = &cpi->rd; 269 RD_OPT *const rd = &cpi->rd;
269 int i; 270 int i;
270 271
271 vp9_clear_system_state(); 272 vp9_clear_system_state();
272 273
273 rd->RDDIV = RDDIV_BITS; // In bits (to multiply D by 128). 274 rd->RDDIV = RDDIV_BITS; // In bits (to multiply D by 128).
274 rd->RDMULT = vp9_compute_rd_mult(cpi, cm->base_qindex + cm->y_dc_delta_q); 275 rd->RDMULT = vp9_compute_rd_mult(cpi, cm->base_qindex + cm->y_dc_delta_q);
275 276
276 x->errorperbit = rd->RDMULT / RD_MULT_EPB_RATIO; 277 x->errorperbit = rd->RDMULT / RD_MULT_EPB_RATIO;
277 x->errorperbit += (x->errorperbit == 0); 278 x->errorperbit += (x->errorperbit == 0);
278 279
279 x->select_tx_size = (cpi->sf.tx_size_search_method == USE_LARGESTALL && 280 x->select_tx_size = (cpi->sf.tx_size_search_method == USE_LARGESTALL &&
280 cm->frame_type != KEY_FRAME) ? 0 : 1; 281 cm->frame_type != KEY_FRAME) ? 0 : 1;
281 282
282 set_block_thresholds(cm, rd); 283 set_block_thresholds(cm, rd);
284 set_partition_probs(cm, xd);
283 285
284 if (!cpi->sf.use_nonrd_pick_mode || cm->frame_type == KEY_FRAME) 286 if (!cpi->sf.use_nonrd_pick_mode || cm->frame_type == KEY_FRAME)
285 fill_token_costs(x->token_costs, cm->fc->coef_probs); 287 fill_token_costs(x->token_costs, cm->fc->coef_probs);
286 288
287 if (cpi->sf.partition_search_type != VAR_BASED_PARTITION || 289 if (cpi->sf.partition_search_type != VAR_BASED_PARTITION ||
288 cm->frame_type == KEY_FRAME) { 290 cm->frame_type == KEY_FRAME) {
289 for (i = 0; i < PARTITION_CONTEXTS; ++i) 291 for (i = 0; i < PARTITION_CONTEXTS; ++i)
290 vp9_cost_tokens(cpi->partition_cost[i], get_partition_probs(cm, i), 292 vp9_cost_tokens(cpi->partition_cost[i], get_partition_probs(xd, i),
291 vp9_partition_tree); 293 vp9_partition_tree);
292 } 294 }
293 295
294 if (!cpi->sf.use_nonrd_pick_mode || (cm->current_video_frame & 0x07) == 1 || 296 if (!cpi->sf.use_nonrd_pick_mode || (cm->current_video_frame & 0x07) == 1 ||
295 cm->frame_type == KEY_FRAME) { 297 cm->frame_type == KEY_FRAME) {
296 fill_mode_costs(cpi); 298 fill_mode_costs(cpi);
297 299
298 if (!frame_is_intra_only(cm)) { 300 if (!frame_is_intra_only(cm)) {
299 vp9_build_nmv_cost_table(x->nmvjointcost, 301 vp9_build_nmv_cost_table(x->nmvjointcost,
300 cm->allow_high_precision_mv ? x->nmvcost_hp 302 cm->allow_high_precision_mv ? x->nmvcost_hp
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 return ROUND_POWER_OF_TWO(5 * q, 2); 657 return ROUND_POWER_OF_TWO(5 * q, 2);
656 default: 658 default:
657 assert(0 && "bit_depth should be VPX_BITS_8, VPX_BITS_10 or VPX_BITS_12"); 659 assert(0 && "bit_depth should be VPX_BITS_8, VPX_BITS_10 or VPX_BITS_12");
658 return -1; 660 return -1;
659 } 661 }
660 #else 662 #else
661 return 20 * q; 663 return 20 * q;
662 #endif // CONFIG_VP9_HIGHBITDEPTH 664 #endif // CONFIG_VP9_HIGHBITDEPTH
663 } 665 }
664 666
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