diff options
author | Paul Wilkins <paulwilkins@google.com> | 2014-01-03 14:14:04 +0000 |
---|---|---|
committer | Paul Wilkins <paulwilkins@google.com> | 2014-01-13 11:35:02 +0000 |
commit | a00dad39bd8a64aec35b987c730a8f54112472ee (patch) | |
tree | 665872ecfbbcb13fc852ea2bec18f6fd4c923da3 | |
parent | 603075fa04d7a8c119304f52a559e51db5045bcf (diff) | |
download | libvpx-a00dad39bd8a64aec35b987c730a8f54112472ee.tar libvpx-a00dad39bd8a64aec35b987c730a8f54112472ee.tar.gz libvpx-a00dad39bd8a64aec35b987c730a8f54112472ee.tar.bz2 libvpx-a00dad39bd8a64aec35b987c730a8f54112472ee.zip |
No arf right before real scene cut.
To reduce pulsing we now allow an arf just before forced key frames
and at the end of a clip or section (which may be stitched to
another clip or section). However, this does not make sense for
key frames arising from real scene cuts.
Change from original patch reflects other recent changes in regard
to alignment of gf/arf and kf groups.
Change-Id: I074a91d1207e9b3e28085af982f6718aa599775f
-rw-r--r-- | vp9/encoder/vp9_firstpass.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index 34f8a9442..812ffa96d 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -1660,7 +1660,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { // Don't allow a gf too near the next kf if ((cpi->rc.frames_to_key - i) < MIN_GF_INTERVAL) { - while (i < cpi->rc.frames_to_key) { + while (i < (cpi->rc.frames_to_key + !cpi->rc.next_key_frame_forced)) { i++; if (EOF == input_stats(&cpi->twopass, this_frame)) @@ -1695,6 +1695,9 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { if (allow_alt_ref && (i < cpi->oxcf.lag_in_frames) && (i >= MIN_GF_INTERVAL) && + // for real scene cuts (not forced kfs) dont allow arf very near kf. + (cpi->rc.next_key_frame_forced || + (i <= (cpi->rc.frames_to_key - MIN_GF_INTERVAL))) && ((next_frame.pcnt_inter > 0.75) || (next_frame.pcnt_second_ref > 0.5)) && ((mv_in_out_accumulator / (double)i > -0.2) || @@ -2368,6 +2371,8 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { input_stats(&cpi->twopass, &tmp_frame); } cpi->rc.next_key_frame_forced = 1; + } else if (cpi->twopass.stats_in == cpi->twopass.stats_in_end) { + cpi->rc.next_key_frame_forced = 1; } else { cpi->rc.next_key_frame_forced = 0; } |