Index: source/libvpx/vp8/encoder/pickinter.c |
=================================================================== |
--- source/libvpx/vp8/encoder/pickinter.c (revision 292608) |
+++ source/libvpx/vp8/encoder/pickinter.c (working copy) |
@@ -516,9 +516,8 @@ |
// Adjust rd for ZEROMV and LAST, if LAST is the closest reference frame. |
if (this_mode == ZEROMV && |
x->e_mbd.mode_info_context->mbmi.ref_frame == LAST_FRAME && |
- (denoise_aggressive || cpi->closest_reference_frame == LAST_FRAME)) |
- { |
- this_rd = ((int64_t)this_rd) * rd_adj / 100; |
+ (denoise_aggressive || cpi->closest_reference_frame == LAST_FRAME)) { |
+ this_rd = ((int64_t)this_rd) * rd_adj / 100; |
} |
check_for_encode_breakout(*sse, x); |
@@ -1083,7 +1082,14 @@ |
{ |
/* Store for later use by denoiser. */ |
- if (this_mode == ZEROMV && sse < zero_mv_sse ) |
+ // Dont' denoise with GOLDEN OR ALTREF is they are old reference |
+ // frames (greater than MAX_GF_ARF_DENOISE_RANGE frames in past). |
+ int skip_old_reference = ((this_ref_frame != LAST_FRAME) && |
+ (cpi->common.current_video_frame - |
+ cpi->current_ref_frames[this_ref_frame] > |
+ MAX_GF_ARF_DENOISE_RANGE)) ? 1 : 0; |
+ if (this_mode == ZEROMV && sse < zero_mv_sse && |
+ !skip_old_reference) |
{ |
zero_mv_sse = sse; |
x->best_zeromv_reference_frame = |
@@ -1092,7 +1098,7 @@ |
/* Store the best NEWMV in x for later use in the denoiser. */ |
if (x->e_mbd.mode_info_context->mbmi.mode == NEWMV && |
- sse < best_sse) |
+ sse < best_sse && !skip_old_reference) |
{ |
best_sse = sse; |
x->best_sse_inter_mode = NEWMV; |