Commit 9f002bee authored by Ronald S. Bultje's avatar Ronald S. Bultje
Browse files

Don't allow very short GF groups even when the GF is predicted from an ARF.

This is basically a slightly modified version of the previous patch,
and it has a moderately positive effect (SSIM/PSNR both +0.08% avg
on derf-set). Most clips show no change, except waterfall/coastguard,
each ~ +0.8% SSIM/PSNR. You can see similar effects in other clips
by shortening their length to terminate at a very short last group
of frames.

Change-Id: I7a70de99ca1f9fe6a8b6ca7a6e30e8a4b64383e4
parent 34ba1876
......@@ -1553,6 +1553,24 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
cpi->gfu_boost = (int)(boost_score * 100.0) >> 4;
// Dont allow conventional gf too near the next kf
if ((cpi->twopass.frames_to_key - i) < MIN_GF_INTERVAL)
{
while (i < cpi->twopass.frames_to_key)
{
i++;
if (EOF == input_stats(cpi, this_frame))
break;
if (i < cpi->twopass.frames_to_key)
{
mod_frame_err = calculate_modified_err(cpi, this_frame);
gf_group_err += mod_frame_err;
}
}
}
// Should we use the alternate refernce frame
if (allow_alt_ref &&
(i >= MIN_GF_INTERVAL) &&
......@@ -1675,25 +1693,6 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
cpi->baseline_gf_interval = i;
}
// Conventional GF
if (!cpi->source_alt_ref_pending)
{
// Dont allow conventional gf too near the next kf
if ((cpi->twopass.frames_to_key - cpi->baseline_gf_interval) < MIN_GF_INTERVAL)
{
while (cpi->baseline_gf_interval < cpi->twopass.frames_to_key)
{
if (EOF == input_stats(cpi, this_frame))
break;
cpi->baseline_gf_interval++;
if (cpi->baseline_gf_interval < cpi->twopass.frames_to_key)
gf_group_err += calculate_modified_err(cpi, this_frame);
}
}
}
// Now decide how many bits should be allocated to the GF group as a proportion of those remaining in the kf group.
// The final key frame group in the clip is treated as a special case where cpi->twopass.kf_group_bits is tied to cpi->twopass.bits_left.
// This is also important for short clips where there may only be one key frame.
......
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