diff options
author | John Koleszar <jkoleszar@google.com> | 2011-04-25 10:48:13 -0700 |
---|---|---|
committer | Code Review <code-review@webmproject.org> | 2011-04-25 10:48:13 -0700 |
commit | 76557e34d212220b1e6b86be5f2d0b733622796d (patch) | |
tree | c04931b928ac2f022b91625ea63d72309ef720c5 /vp8/encoder | |
parent | d9f898ab6dbf2e5f9f031b808c13c204254c0a21 (diff) | |
parent | 454cbc96b7c81109b1d7fd24df1da99ba30f5207 (diff) | |
download | libvpx-76557e34d212220b1e6b86be5f2d0b733622796d.tar libvpx-76557e34d212220b1e6b86be5f2d0b733622796d.tar.gz libvpx-76557e34d212220b1e6b86be5f2d0b733622796d.tar.bz2 libvpx-76557e34d212220b1e6b86be5f2d0b733622796d.zip |
Merge "Limit size of initial keyframe in one-pass."
Diffstat (limited to 'vp8/encoder')
-rw-r--r-- | vp8/encoder/onyx_if.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index cbaab5fb0..4208f1fe4 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -1459,10 +1459,6 @@ static void init_config(VP8_PTR ptr, VP8_CONFIG *oxcf) cpi->avg_frame_qindex = cpi->oxcf.worst_allowed_q; // Initialise the starting buffer levels - cpi->oxcf.starting_buffer_level = - rescale(cpi->oxcf.starting_buffer_level, - cpi->oxcf.target_bandwidth, 1000); - cpi->buffer_level = cpi->oxcf.starting_buffer_level; cpi->bits_off_target = cpi->oxcf.starting_buffer_level; @@ -1635,6 +1631,10 @@ void vp8_change_config(VP8_PTR ptr, VP8_CONFIG *oxcf) // Convert target bandwidth from Kbit/s to Bit/s cpi->oxcf.target_bandwidth *= 1000; + cpi->oxcf.starting_buffer_level = + rescale(cpi->oxcf.starting_buffer_level, + cpi->oxcf.target_bandwidth, 1000); + // Set or reset optimal and maximum buffer levels. if (cpi->oxcf.optimal_buffer_level == 0) cpi->oxcf.optimal_buffer_level = cpi->oxcf.target_bandwidth / 8; @@ -2661,16 +2661,17 @@ static int pick_frame_size(VP8_COMP *cpi) if (cpi->pass == 2) vp8_calc_auto_iframe_target_size(cpi); - // 1 Pass there is no information on which to base size so use bandwidth per second * fixed fraction else #endif - cpi->this_frame_target = cpi->oxcf.target_bandwidth / 2; - - // in error resilient mode the first frame is bigger since it likely contains - // all the static background - if (cpi->oxcf.error_resilient_mode == 1 || (cpi->compressor_speed == 2)) { - cpi->this_frame_target *= 3; // 5; + /* 1 Pass there is no information on which to base size so use + * bandwidth per second * fraction of the initial buffer + * level + */ + cpi->this_frame_target = cpi->oxcf.starting_buffer_level / 2; + + if(cpi->this_frame_target > cpi->oxcf.target_bandwidth * 3 / 2) + cpi->this_frame_target = cpi->oxcf.target_bandwidth * 3 / 2; } // Key frame from VFW/auto-keyframe/first frame |