From 9c8ad79fdc8af25988dd071703a51d379f2849ce Mon Sep 17 00:00:00 2001 From: Fritz Koenig Date: Thu, 18 Nov 2010 10:40:58 -0800 Subject: [PATCH] Set refresh_alt_ref_frame on keyframe encode. On a keyframe alt ref and golden are refreshed. The flag was not being set and so on the frame after a keyframe, motion search would occur on the alt ref frame. This is not necessary because the alt ref frame identical to the last frame in this scenario. Handle corner case where a forward alt-ref frame is put directly after a keyframe. Change-Id: I9be4cf290d694f8cf2f9a31852014b5ccf1504d3 --- vp8/encoder/onyx_if.c | 2 +- vp8/encoder/ratectrl.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index 52d17a3..ea72de2 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -4583,7 +4583,7 @@ static void encode_frame_to_data_rate } else { - if (cpi->oxcf.play_alternate && cpi->common.refresh_alt_ref_frame) + if (cpi->oxcf.play_alternate && cpi->common.refresh_alt_ref_frame && (cpi->common.frame_type != KEY_FRAME)) // Update the alternate reference frame and stats as appropriate. update_alt_ref_frame_and_stats(cpi); else diff --git a/vp8/encoder/ratectrl.c b/vp8/encoder/ratectrl.c index c05e80e..a7d8f48 100644 --- a/vp8/encoder/ratectrl.c +++ b/vp8/encoder/ratectrl.c @@ -326,6 +326,7 @@ void vp8_setup_key_frame(VP8_COMP *cpi) cpi->frames_till_gf_update_due = cpi->goldfreq; cpi->common.refresh_golden_frame = TRUE; + cpi->common.refresh_alt_ref_frame = TRUE; } void vp8_calc_auto_iframe_target_size(VP8_COMP *cpi) -- 2.7.4