Commit 52d27367 authored by Deb Mukherjee's avatar Deb Mukherjee

Further rate control cleanups

Includes various cleanups.
Streamlines the interfaces so that all rate control state
updates happen in the vp9_rc_postencode_update() function.
This will hopefully make it easier to support multiple
rate control schemes.
Removes some unnecessary code, which in rare cases can casue
a difference in the constrained quality mode output, but
other than that there is no bitstream change yet.

Change-Id: I3198cc37249932feea1e3691c0b2650e7b0c22fc
parent e7922a5b
......@@ -2170,21 +2170,6 @@ void vp9_second_pass(VP9_COMP *cpi) {
(int)(cpi->twopass.bits_left / frames_left);
cpi->twopass.est_max_qcorrection_factor = 1.0;
// Set a cq_level in constrained quality mode.
// Commenting this code out for now since it does not seem to be
// working well.
/*
if (cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY) {
int est_cq = estimate_cq(cpi, &cpi->twopass.total_left_stats,
section_target_bandwidth);
if (est_cq > cpi->cq_target_quality)
cpi->cq_target_quality = est_cq;
else
cpi->cq_target_quality = cpi->oxcf.cq_level;
}
*/
// guess at maxq needed in 2nd pass
cpi->twopass.maxq_max_limit = cpi->rc.worst_quality;
cpi->twopass.maxq_min_limit = cpi->rc.best_quality;
......
This diff is collapsed.
......@@ -338,7 +338,7 @@ typedef struct {
int worst_quality;
int active_worst_quality;
int best_quality;
int active_best_quality;
// int active_best_quality;
} RATE_CONTROL;
typedef struct VP9_COMP {
......@@ -695,7 +695,7 @@ int vp9_calc_ss_err(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest);
void vp9_alloc_compressor_data(VP9_COMP *cpi);
int vp9_compute_qdelta(VP9_COMP *cpi, double qstart, double qtarget);
int vp9_compute_qdelta(const VP9_COMP *cpi, double qstart, double qtarget);
static int get_token_alloc(int mb_rows, int mb_cols) {
return mb_rows * mb_cols * (48 * 16 + 4);
......
This diff is collapsed.
......@@ -31,23 +31,29 @@ void vp9_rc_update_rate_correction_factors(VP9_COMP *cpi, int damp_var);
void vp9_rc_init_minq_luts(void);
// return of 0 means drop frame
// Changes rc.this_frame_target and rc.sb64_rate_target
int vp9_rc_pick_frame_size_and_bounds(VP9_COMP *cpi,
// Changes only rc.this_frame_target and rc.sb64_rate_target
int vp9_rc_pick_frame_size_target(VP9_COMP *cpi);
void vp9_rc_compute_frame_size_bounds(const VP9_COMP *cpi,
int this_frame_target,
int *frame_under_shoot_limit,
int *frame_over_shoot_limit);
// Picks q and q bounds given the target for bits
int vp9_rc_pick_q_and_adjust_q_bounds(VP9_COMP *cpi,
int * bottom_index,
int * top_index);
int vp9_rc_pick_q_and_adjust_q_bounds(const VP9_COMP *cpi,
int *bottom_index,
int *top_index,
int *top_index_prop);
// Estimates q to achieve a target bits per frame
int vp9_rc_regulate_q(const VP9_COMP *cpi, int target_bits_per_frame);
int vp9_rc_regulate_q(const VP9_COMP *cpi, int target_bits_per_frame,
int active_best_quality, int active_worst_quality);
// Post encode update of the rate control parameters based
// on bytes used and q used for the frame
void vp9_rc_postencode_update(VP9_COMP *cpi,
uint64_t bytes_used,
int q_used);
int worst_q);
// estimates bits per mb for a given qindex and correction factor
int vp9_rc_bits_per_mb(FRAME_TYPE frame_type, int qindex,
......
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