Commit cb865998 authored by Paul Wilkins's avatar Paul Wilkins
Browse files

Allow arf just before kfs or end of sequence.

This will hurt metrics in some cases (particularly for static
clips at low data rates where there is extra overhead, but it
helps smooth transitions around forced key frames between
stitched kf sections.

Change-Id: I7e1026ae0de6c77bba863061e115136d7f283cc0
parent e1312c36
...@@ -1639,9 +1639,8 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { ...@@ -1639,9 +1639,8 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
active_max_gf_interval = cpi->rc.max_gf_interval; active_max_gf_interval = cpi->rc.max_gf_interval;
i = 0; i = 0;
while (((i < cpi->twopass.static_scene_max_gf_interval) || while ((i < cpi->twopass.static_scene_max_gf_interval) &&
((cpi->rc.frames_to_key - i) < MIN_GF_INTERVAL)) && (i < (cpi->rc.frames_to_key - 1))) {
(i < cpi->rc.frames_to_key)) {
i++; // Increment the loop counter i++; // Increment the loop counter
// Accumulate error score of frames in this gf group // Accumulate error score of frames in this gf group
...@@ -1695,8 +1694,6 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { ...@@ -1695,8 +1694,6 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
( (
// Don't break out with a very short interval // Don't break out with a very short interval
(i > MIN_GF_INTERVAL) && (i > MIN_GF_INTERVAL) &&
// Don't break out very close to a key frame
((cpi->rc.frames_to_key - i) >= MIN_GF_INTERVAL) &&
((boost_score > 125.0) || (next_frame.pcnt_inter < 0.75)) && ((boost_score > 125.0) || (next_frame.pcnt_inter < 0.75)) &&
(!flash_detected) && (!flash_detected) &&
((mv_ratio_accumulator > mv_ratio_accumulator_thresh) || ((mv_ratio_accumulator > mv_ratio_accumulator_thresh) ||
...@@ -1716,7 +1713,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { ...@@ -1716,7 +1713,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
// Don't allow a gf too near the next kf // Don't allow a gf too near the next kf
if ((cpi->rc.frames_to_key - i) < MIN_GF_INTERVAL) { if ((cpi->rc.frames_to_key - i) < MIN_GF_INTERVAL) {
while (i < cpi->rc.frames_to_key) { while (i < (cpi->rc.frames_to_key - 1)) {
i++; i++;
if (EOF == input_stats(cpi, this_frame)) if (EOF == input_stats(cpi, this_frame))
...@@ -1729,6 +1726,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { ...@@ -1729,6 +1726,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
} }
} }
// Set the interval until the next gf or arf. // Set the interval until the next gf or arf.
cpi->rc.baseline_gf_interval = i; cpi->rc.baseline_gf_interval = i;
...@@ -1748,8 +1746,6 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { ...@@ -1748,8 +1746,6 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
if (allow_alt_ref && if (allow_alt_ref &&
(i < cpi->oxcf.lag_in_frames) && (i < cpi->oxcf.lag_in_frames) &&
(i >= MIN_GF_INTERVAL) && (i >= MIN_GF_INTERVAL) &&
// dont use ARF very near next kf
(i <= (cpi->rc.frames_to_key - MIN_GF_INTERVAL)) &&
((next_frame.pcnt_inter > 0.75) || ((next_frame.pcnt_inter > 0.75) ||
(next_frame.pcnt_second_ref > 0.5)) && (next_frame.pcnt_second_ref > 0.5)) &&
((mv_in_out_accumulator / (double)i > -0.2) || ((mv_in_out_accumulator / (double)i > -0.2) ||
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment