summaryrefslogtreecommitdiff
path: root/vp8/encoder
diff options
context:
space:
mode:
authorJohn Koleszar <jkoleszar@google.com>2011-04-25 11:44:50 -0400
committerJohn Koleszar <jkoleszar@google.com>2011-04-25 13:47:14 -0400
commitaa926fbd273c7d62d43487f73f2f3cdce7bec5a8 (patch)
tree1a0fbae05abc5af5a5806291e5b14a0f70478616 /vp8/encoder
parentaeca599087409c83cf4e24a59b5830a380e22327 (diff)
downloadlibvpx-aa926fbd273c7d62d43487f73f2f3cdce7bec5a8.tar
libvpx-aa926fbd273c7d62d43487f73f2f3cdce7bec5a8.tar.gz
libvpx-aa926fbd273c7d62d43487f73f2f3cdce7bec5a8.tar.bz2
libvpx-aa926fbd273c7d62d43487f73f2f3cdce7bec5a8.zip
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
Diffstat (limited to 'vp8/encoder')
-rw-r--r--vp8/encoder/onyx_if.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index 7461edca4..cbaab5fb0 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -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;
}