OLD | NEW |
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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 x->skip = 0; | 480 x->skip = 0; |
481 } | 481 } |
482 } | 482 } |
483 | 483 |
484 static int evaluate_inter_mode(unsigned int* sse, int rate2, int* distortion2, | 484 static int evaluate_inter_mode(unsigned int* sse, int rate2, int* distortion2, |
485 VP8_COMP *cpi, MACROBLOCK *x, int rd_adj) | 485 VP8_COMP *cpi, MACROBLOCK *x, int rd_adj) |
486 { | 486 { |
487 MB_PREDICTION_MODE this_mode = x->e_mbd.mode_info_context->mbmi.mode; | 487 MB_PREDICTION_MODE this_mode = x->e_mbd.mode_info_context->mbmi.mode; |
488 int_mv mv = x->e_mbd.mode_info_context->mbmi.mv; | 488 int_mv mv = x->e_mbd.mode_info_context->mbmi.mv; |
489 int this_rd; | 489 int this_rd; |
| 490 int denoise_aggressive = 0; |
490 /* Exit early and don't compute the distortion if this macroblock | 491 /* Exit early and don't compute the distortion if this macroblock |
491 * is marked inactive. */ | 492 * is marked inactive. */ |
492 if (cpi->active_map_enabled && x->active_ptr[0] == 0) | 493 if (cpi->active_map_enabled && x->active_ptr[0] == 0) |
493 { | 494 { |
494 *sse = 0; | 495 *sse = 0; |
495 *distortion2 = 0; | 496 *distortion2 = 0; |
496 x->skip = 1; | 497 x->skip = 1; |
497 return INT_MAX; | 498 return INT_MAX; |
498 } | 499 } |
499 | 500 |
500 if((this_mode != NEWMV) || | 501 if((this_mode != NEWMV) || |
501 !(cpi->sf.half_pixel_search) || cpi->common.full_pixel==1) | 502 !(cpi->sf.half_pixel_search) || cpi->common.full_pixel==1) |
502 *distortion2 = vp8_get_inter_mbpred_error(x, | 503 *distortion2 = vp8_get_inter_mbpred_error(x, |
503 &cpi->fn_ptr[BLOCK_16X16], | 504 &cpi->fn_ptr[BLOCK_16X16], |
504 sse, mv); | 505 sse, mv); |
505 | 506 |
506 this_rd = RDCOST(x->rdmult, x->rddiv, rate2, *distortion2); | 507 this_rd = RDCOST(x->rdmult, x->rddiv, rate2, *distortion2); |
507 | 508 |
| 509 #if CONFIG_TEMPORAL_DENOISING |
| 510 if (cpi->oxcf.noise_sensitivity > 0) { |
| 511 denoise_aggressive = |
| 512 (cpi->denoiser.denoiser_mode == kDenoiserOnYUVAggressive) ? 1 : 0; |
| 513 } |
| 514 #endif |
| 515 |
508 // Adjust rd for ZEROMV and LAST, if LAST is the closest reference frame. | 516 // Adjust rd for ZEROMV and LAST, if LAST is the closest reference frame. |
509 if (this_mode == ZEROMV && | 517 if (this_mode == ZEROMV && |
510 x->e_mbd.mode_info_context->mbmi.ref_frame == LAST_FRAME && | 518 x->e_mbd.mode_info_context->mbmi.ref_frame == LAST_FRAME && |
511 cpi->closest_reference_frame == LAST_FRAME) | 519 (denoise_aggressive || cpi->closest_reference_frame == LAST_FRAME)) |
512 { | 520 { |
513 this_rd = ((int64_t)this_rd) * rd_adj / 100; | 521 this_rd = ((int64_t)this_rd) * rd_adj / 100; |
514 } | 522 } |
515 | 523 |
516 check_for_encode_breakout(*sse, x); | 524 check_for_encode_breakout(*sse, x); |
517 return this_rd; | 525 return this_rd; |
518 } | 526 } |
519 | 527 |
520 static void calculate_zeromv_rd_adjustment(VP8_COMP *cpi, MACROBLOCK *x, | 528 static void calculate_zeromv_rd_adjustment(VP8_COMP *cpi, MACROBLOCK *x, |
521 int *rd_adjustment) | 529 int *rd_adjustment) |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1292 error4x4 = pick_intra4x4mby_modes(x, &rate, | 1300 error4x4 = pick_intra4x4mby_modes(x, &rate, |
1293 &best_sse); | 1301 &best_sse); |
1294 if (error4x4 < error16x16) | 1302 if (error4x4 < error16x16) |
1295 { | 1303 { |
1296 xd->mode_info_context->mbmi.mode = B_PRED; | 1304 xd->mode_info_context->mbmi.mode = B_PRED; |
1297 best_rate = rate; | 1305 best_rate = rate; |
1298 } | 1306 } |
1299 | 1307 |
1300 *rate_ = best_rate; | 1308 *rate_ = best_rate; |
1301 } | 1309 } |
OLD | NEW |