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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 #if CONFIG_TEMPORAL_DENOISING | 509 #if CONFIG_TEMPORAL_DENOISING |
510 if (cpi->oxcf.noise_sensitivity > 0) { | 510 if (cpi->oxcf.noise_sensitivity > 0) { |
511 denoise_aggressive = | 511 denoise_aggressive = |
512 (cpi->denoiser.denoiser_mode == kDenoiserOnYUVAggressive) ? 1 : 0; | 512 (cpi->denoiser.denoiser_mode == kDenoiserOnYUVAggressive) ? 1 : 0; |
513 } | 513 } |
514 #endif | 514 #endif |
515 | 515 |
516 // 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. |
517 if (this_mode == ZEROMV && | 517 if (this_mode == ZEROMV && |
518 x->e_mbd.mode_info_context->mbmi.ref_frame == LAST_FRAME && | 518 x->e_mbd.mode_info_context->mbmi.ref_frame == LAST_FRAME && |
519 (denoise_aggressive || cpi->closest_reference_frame == LAST_FRAME)) | 519 (denoise_aggressive || cpi->closest_reference_frame == LAST_FRAME)) { |
520 { | 520 this_rd = ((int64_t)this_rd) * rd_adj / 100; |
521 this_rd = ((int64_t)this_rd) * rd_adj / 100; | |
522 } | 521 } |
523 | 522 |
524 check_for_encode_breakout(*sse, x); | 523 check_for_encode_breakout(*sse, x); |
525 return this_rd; | 524 return this_rd; |
526 } | 525 } |
527 | 526 |
528 static void calculate_zeromv_rd_adjustment(VP8_COMP *cpi, MACROBLOCK *x, | 527 static void calculate_zeromv_rd_adjustment(VP8_COMP *cpi, MACROBLOCK *x, |
529 int *rd_adjustment) | 528 int *rd_adjustment) |
530 { | 529 { |
531 MODE_INFO *mic = x->e_mbd.mode_info_context; | 530 MODE_INFO *mic = x->e_mbd.mode_info_context; |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 break; | 1075 break; |
1077 default: | 1076 default: |
1078 break; | 1077 break; |
1079 } | 1078 } |
1080 | 1079 |
1081 #if CONFIG_TEMPORAL_DENOISING | 1080 #if CONFIG_TEMPORAL_DENOISING |
1082 if (cpi->oxcf.noise_sensitivity) | 1081 if (cpi->oxcf.noise_sensitivity) |
1083 { | 1082 { |
1084 | 1083 |
1085 /* Store for later use by denoiser. */ | 1084 /* Store for later use by denoiser. */ |
1086 if (this_mode == ZEROMV && sse < zero_mv_sse ) | 1085 // Dont' denoise with GOLDEN OR ALTREF is they are old reference |
| 1086 // frames (greater than MAX_GF_ARF_DENOISE_RANGE frames in past). |
| 1087 int skip_old_reference = ((this_ref_frame != LAST_FRAME) && |
| 1088 (cpi->common.current_video_frame - |
| 1089 cpi->current_ref_frames[this_ref_frame] > |
| 1090 MAX_GF_ARF_DENOISE_RANGE)) ? 1 : 0; |
| 1091 if (this_mode == ZEROMV && sse < zero_mv_sse && |
| 1092 !skip_old_reference) |
1087 { | 1093 { |
1088 zero_mv_sse = sse; | 1094 zero_mv_sse = sse; |
1089 x->best_zeromv_reference_frame = | 1095 x->best_zeromv_reference_frame = |
1090 x->e_mbd.mode_info_context->mbmi.ref_frame; | 1096 x->e_mbd.mode_info_context->mbmi.ref_frame; |
1091 } | 1097 } |
1092 | 1098 |
1093 /* Store the best NEWMV in x for later use in the denoiser. */ | 1099 /* Store the best NEWMV in x for later use in the denoiser. */ |
1094 if (x->e_mbd.mode_info_context->mbmi.mode == NEWMV && | 1100 if (x->e_mbd.mode_info_context->mbmi.mode == NEWMV && |
1095 sse < best_sse) | 1101 sse < best_sse && !skip_old_reference) |
1096 { | 1102 { |
1097 best_sse = sse; | 1103 best_sse = sse; |
1098 x->best_sse_inter_mode = NEWMV; | 1104 x->best_sse_inter_mode = NEWMV; |
1099 x->best_sse_mv = x->e_mbd.mode_info_context->mbmi.mv; | 1105 x->best_sse_mv = x->e_mbd.mode_info_context->mbmi.mv; |
1100 x->need_to_clamp_best_mvs = | 1106 x->need_to_clamp_best_mvs = |
1101 x->e_mbd.mode_info_context->mbmi.need_to_clamp_mvs; | 1107 x->e_mbd.mode_info_context->mbmi.need_to_clamp_mvs; |
1102 x->best_reference_frame = | 1108 x->best_reference_frame = |
1103 x->e_mbd.mode_info_context->mbmi.ref_frame; | 1109 x->e_mbd.mode_info_context->mbmi.ref_frame; |
1104 } | 1110 } |
1105 } | 1111 } |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 error4x4 = pick_intra4x4mby_modes(x, &rate, | 1306 error4x4 = pick_intra4x4mby_modes(x, &rate, |
1301 &best_sse); | 1307 &best_sse); |
1302 if (error4x4 < error16x16) | 1308 if (error4x4 < error16x16) |
1303 { | 1309 { |
1304 xd->mode_info_context->mbmi.mode = B_PRED; | 1310 xd->mode_info_context->mbmi.mode = B_PRED; |
1305 best_rate = rate; | 1311 best_rate = rate; |
1306 } | 1312 } |
1307 | 1313 |
1308 *rate_ = best_rate; | 1314 *rate_ = best_rate; |
1309 } | 1315 } |
OLD | NEW |