Add rc_max_intra_bitrate_pct control

Adds a control to limit the maximum size of a keyframe, as a function of
the per-frame bitrate. See this thread[1] for more detailed discussion:

[1]: http://groups.google.com/a/webmproject.org/group/codec-devel/browse_thread/thread/271b944a5e47ca38

Change-Id: I7337707642eb8041d1e593efc2edfdf66db02a94
This commit is contained in:
John Koleszar
2011-04-25 11:44:50 -04:00
parent aeca599087
commit aa926fbd27
5 changed files with 36 additions and 1 deletions

View File

@@ -2704,6 +2704,19 @@ static int pick_frame_size(VP8_COMP *cpi)
}
}
/* Apply limits on keyframe target.
*
* TODO: move this after consolidating
* vp8_calc_iframe_target_size() and vp8_calc_auto_iframe_target_size()
*/
if (cm->frame_type == KEY_FRAME && cpi->oxcf.rc_max_intra_bitrate_pct)
{
unsigned int max_rate = cpi->av_per_frame_bandwidth
* cpi->oxcf.rc_max_intra_bitrate_pct / 100;
if (cpi->this_frame_target > max_rate)
cpi->this_frame_target = max_rate;
}
return 1;
}