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

Allow for frame overheads in min frame bandwidth.

Change-Id: I6ade229ff400fe492709010ac5bada37f8afa73e
parent 89ee68b1
......@@ -1286,7 +1286,12 @@ void vp8_init_second_pass(VP8_COMP *cpi)
FIRSTPASS_STATS this_frame;
FIRSTPASS_STATS *start_pos;
double two_pass_min_rate = (double)(cpi->oxcf.target_bandwidth * cpi->oxcf.two_pass_vbrmin_section / 100);
double lower_bounds_min_rate = FRAME_OVERHEAD_BITS*cpi->oxcf.frame_rate;
double two_pass_min_rate = (double)(cpi->oxcf.target_bandwidth
* cpi->oxcf.two_pass_vbrmin_section / 100);
if (two_pass_min_rate < lower_bounds_min_rate)
two_pass_min_rate = lower_bounds_min_rate;
zero_stats(cpi->twopass.total_stats);
zero_stats(cpi->twopass.total_left_stats);
......
......@@ -1187,6 +1187,9 @@ void vp8_new_frame_rate(VP8_COMP *cpi, double framerate)
cpi->av_per_frame_bandwidth = (int)(cpi->oxcf.target_bandwidth / cpi->output_frame_rate);
cpi->min_frame_bandwidth = (int)(cpi->av_per_frame_bandwidth * cpi->oxcf.two_pass_vbrmin_section / 100);
if (cpi->min_frame_bandwidth < FRAME_OVERHEAD_BITS )
cpi->min_frame_bandwidth = FRAME_OVERHEAD_BITS;
// Set Maximum gf/arf interval
cpi->max_gf_interval = ((int)(cpi->output_frame_rate / 2.0) + 2);
......@@ -3868,8 +3871,13 @@ static void Pass2Encode(VP8_COMP *cpi, unsigned long *size, unsigned char *dest,
if (!cpi->common.refresh_alt_ref_frame)
{
double lower_bounds_min_rate = FRAME_OVERHEAD_BITS*cpi->oxcf.frame_rate;
double two_pass_min_rate = (double)(cpi->oxcf.target_bandwidth
*cpi->oxcf.two_pass_vbrmin_section / 100);
if (two_pass_min_rate < lower_bounds_min_rate)
two_pass_min_rate = lower_bounds_min_rate;
cpi->twopass.bits_left += (int64_t)(two_pass_min_rate / cpi->oxcf.frame_rate);
}
}
......
......@@ -13,6 +13,8 @@
#include "onyx_int.h"
#define FRAME_OVERHEAD_BITS 200
extern void vp8_save_coding_context(VP8_COMP *cpi);
extern void vp8_restore_coding_context(VP8_COMP *cpi);
......
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