Removing cq_target_quality from VP9_COMP.
Use cq_level (which is identical) from VP9_CONFIG instead. Change-Id: I1aaf2fcef3d2dbd4577f613d27693ff8a68989fd
This commit is contained in:
parent
69009e738e
commit
53dbc7f92c
@ -904,6 +904,7 @@ static int get_twopass_worst_quality(const VP9_COMP *cpi,
|
||||
const FIRSTPASS_STATS *stats,
|
||||
int section_target_bandwidth) {
|
||||
const RATE_CONTROL *const rc = &cpi->rc;
|
||||
const VP9_CONFIG *const oxcf = &cpi->oxcf;
|
||||
|
||||
if (section_target_bandwidth <= 0) {
|
||||
return rc->worst_quality; // Highest value allowed
|
||||
@ -911,7 +912,7 @@ static int get_twopass_worst_quality(const VP9_COMP *cpi,
|
||||
const int num_mbs = cpi->common.MBs;
|
||||
const double section_err = stats->coded_error / stats->count;
|
||||
const double err_per_mb = section_err / num_mbs;
|
||||
const double speed_term = 1.0 + 0.04 * cpi->oxcf.speed;
|
||||
const double speed_term = 1.0 + 0.04 * oxcf->speed;
|
||||
const int target_norm_bits_per_mb = ((uint64_t)section_target_bandwidth <<
|
||||
BPER_MB_NORMBITS) / num_mbs;
|
||||
int q;
|
||||
@ -928,8 +929,8 @@ static int get_twopass_worst_quality(const VP9_COMP *cpi,
|
||||
}
|
||||
|
||||
// Restriction on active max q for constrained quality mode.
|
||||
if (cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY)
|
||||
q = MAX(q, cpi->cq_target_quality);
|
||||
if (oxcf->end_usage == USAGE_CONSTRAINED_QUALITY)
|
||||
q = MAX(q, oxcf->cq_level);
|
||||
return q;
|
||||
}
|
||||
}
|
||||
|
@ -791,10 +791,6 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9_CONFIG *oxcf) {
|
||||
rc->worst_quality = cpi->oxcf.worst_allowed_q;
|
||||
rc->best_quality = cpi->oxcf.best_allowed_q;
|
||||
|
||||
// active values should only be modified if out of new range
|
||||
|
||||
cpi->cq_target_quality = cpi->oxcf.cq_level;
|
||||
|
||||
cm->interp_filter = DEFAULT_INTERP_FILTER;
|
||||
|
||||
cm->display_width = cpi->oxcf.width;
|
||||
@ -1698,6 +1694,7 @@ static int recode_loop_test(const VP9_COMP *cpi,
|
||||
int q, int maxq, int minq) {
|
||||
const VP9_COMMON *const cm = &cpi->common;
|
||||
const RATE_CONTROL *const rc = &cpi->rc;
|
||||
const VP9_CONFIG *const oxcf = &cpi->oxcf;
|
||||
int force_recode = 0;
|
||||
|
||||
// Special case trap if maximum allowed frame size exceeded.
|
||||
@ -1715,10 +1712,10 @@ static int recode_loop_test(const VP9_COMP *cpi,
|
||||
if ((rc->projected_frame_size > high_limit && q < maxq) ||
|
||||
(rc->projected_frame_size < low_limit && q > minq)) {
|
||||
force_recode = 1;
|
||||
} else if (cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY) {
|
||||
} else if (oxcf->end_usage == USAGE_CONSTRAINED_QUALITY) {
|
||||
// Deal with frame undershoot and whether or not we are
|
||||
// below the automatically set cq level.
|
||||
if (q > cpi->cq_target_quality &&
|
||||
if (q > oxcf->cq_level &&
|
||||
rc->projected_frame_size < ((rc->this_frame_target * 7) >> 3)) {
|
||||
force_recode = 1;
|
||||
}
|
||||
@ -1893,7 +1890,7 @@ static void output_frame_level_debug_stats(VP9_COMP *cpi) {
|
||||
(double)vp9_dc_quant(cm->base_qindex, 0) / 4.0,
|
||||
cpi->rc.avg_q,
|
||||
vp9_convert_qindex_to_q(cpi->rc.ni_av_qi),
|
||||
vp9_convert_qindex_to_q(cpi->cq_target_quality),
|
||||
vp9_convert_qindex_to_q(cpi->oxcf.cq_level),
|
||||
cpi->refresh_last_frame, cpi->refresh_golden_frame,
|
||||
cpi->refresh_alt_ref_frame, cm->frame_type, cpi->rc.gfu_boost,
|
||||
cpi->twopass.bits_left,
|
||||
|
@ -391,8 +391,6 @@ typedef struct VP9_COMP {
|
||||
|
||||
RATE_CONTROL rc;
|
||||
|
||||
int cq_target_quality;
|
||||
|
||||
vp9_coeff_count coef_counts[TX_SIZES][PLANE_TYPES];
|
||||
vp9_coeff_probs_model frame_coef_probs[TX_SIZES][PLANE_TYPES];
|
||||
|
||||
|
@ -613,6 +613,7 @@ static int rc_pick_q_and_bounds_one_pass_vbr(const VP9_COMP *cpi,
|
||||
const VP9_COMMON *const cm = &cpi->common;
|
||||
const RATE_CONTROL *const rc = &cpi->rc;
|
||||
const VP9_CONFIG *const oxcf = &cpi->oxcf;
|
||||
const int cq_level = oxcf->cq_level;
|
||||
int active_best_quality;
|
||||
int active_worst_quality = calc_active_worst_quality_one_pass_vbr(cpi);
|
||||
int q;
|
||||
@ -671,8 +672,8 @@ static int rc_pick_q_and_bounds_one_pass_vbr(const VP9_COMP *cpi,
|
||||
}
|
||||
// For constrained quality dont allow Q less than the cq level
|
||||
if (oxcf->end_usage == USAGE_CONSTRAINED_QUALITY) {
|
||||
if (q < cpi->cq_target_quality)
|
||||
q = cpi->cq_target_quality;
|
||||
if (q < cq_level)
|
||||
q = cq_level;
|
||||
if (rc->frames_since_key > 1) {
|
||||
active_best_quality = get_active_quality(q, rc->gfu_boost,
|
||||
gf_low, gf_high,
|
||||
@ -689,7 +690,7 @@ static int rc_pick_q_and_bounds_one_pass_vbr(const VP9_COMP *cpi,
|
||||
|
||||
} else if (oxcf->end_usage == USAGE_CONSTANT_QUALITY) {
|
||||
if (!cpi->refresh_alt_ref_frame) {
|
||||
active_best_quality = cpi->cq_target_quality;
|
||||
active_best_quality = cq_level;
|
||||
} else {
|
||||
if (rc->frames_since_key > 1) {
|
||||
active_best_quality = get_active_quality(
|
||||
@ -708,7 +709,7 @@ static int rc_pick_q_and_bounds_one_pass_vbr(const VP9_COMP *cpi,
|
||||
}
|
||||
} else {
|
||||
if (oxcf->end_usage == USAGE_CONSTANT_QUALITY) {
|
||||
active_best_quality = cpi->cq_target_quality;
|
||||
active_best_quality = cq_level;
|
||||
} else {
|
||||
// Use the lower of active_worst_quality and recent/average Q.
|
||||
if (cm->current_video_frame > 1)
|
||||
@ -718,14 +719,8 @@ static int rc_pick_q_and_bounds_one_pass_vbr(const VP9_COMP *cpi,
|
||||
// For the constrained quality mode we don't want
|
||||
// q to fall below the cq level.
|
||||
if ((oxcf->end_usage == USAGE_CONSTRAINED_QUALITY) &&
|
||||
(active_best_quality < cpi->cq_target_quality)) {
|
||||
// If we are strongly undershooting the target rate in the last
|
||||
// frames then use the user passed in cq value not the auto
|
||||
// cq value.
|
||||
if (rc->rolling_actual_bits < rc->min_frame_bandwidth)
|
||||
active_best_quality = oxcf->cq_level;
|
||||
else
|
||||
active_best_quality = cpi->cq_target_quality;
|
||||
(active_best_quality < cq_level)) {
|
||||
active_best_quality = cq_level;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -807,6 +802,7 @@ static int rc_pick_q_and_bounds_two_pass(const VP9_COMP *cpi,
|
||||
const VP9_COMMON *const cm = &cpi->common;
|
||||
const RATE_CONTROL *const rc = &cpi->rc;
|
||||
const VP9_CONFIG *const oxcf = &cpi->oxcf;
|
||||
const int cq_level = oxcf->cq_level;
|
||||
int active_best_quality;
|
||||
int active_worst_quality = cpi->twopass.active_worst_quality;
|
||||
int q;
|
||||
@ -867,8 +863,8 @@ static int rc_pick_q_and_bounds_two_pass(const VP9_COMP *cpi,
|
||||
}
|
||||
// For constrained quality dont allow Q less than the cq level
|
||||
if (oxcf->end_usage == USAGE_CONSTRAINED_QUALITY) {
|
||||
if (q < cpi->cq_target_quality)
|
||||
q = cpi->cq_target_quality;
|
||||
if (q < cq_level)
|
||||
q = cq_level;
|
||||
if (rc->frames_since_key > 1) {
|
||||
active_best_quality = get_active_quality(q, rc->gfu_boost,
|
||||
gf_low, gf_high,
|
||||
@ -885,7 +881,7 @@ static int rc_pick_q_and_bounds_two_pass(const VP9_COMP *cpi,
|
||||
|
||||
} else if (oxcf->end_usage == USAGE_CONSTANT_QUALITY) {
|
||||
if (!cpi->refresh_alt_ref_frame) {
|
||||
active_best_quality = cpi->cq_target_quality;
|
||||
active_best_quality = cq_level;
|
||||
} else {
|
||||
if (rc->frames_since_key > 1) {
|
||||
active_best_quality = get_active_quality(
|
||||
@ -904,21 +900,15 @@ static int rc_pick_q_and_bounds_two_pass(const VP9_COMP *cpi,
|
||||
}
|
||||
} else {
|
||||
if (oxcf->end_usage == USAGE_CONSTANT_QUALITY) {
|
||||
active_best_quality = cpi->cq_target_quality;
|
||||
active_best_quality = cq_level;
|
||||
} else {
|
||||
active_best_quality = inter_minq[active_worst_quality];
|
||||
|
||||
// For the constrained quality mode we don't want
|
||||
// q to fall below the cq level.
|
||||
if ((oxcf->end_usage == USAGE_CONSTRAINED_QUALITY) &&
|
||||
(active_best_quality < cpi->cq_target_quality)) {
|
||||
// If we are strongly undershooting the target rate in the last
|
||||
// frames then use the user passed in cq value not the auto
|
||||
// cq value.
|
||||
if (rc->rolling_actual_bits < rc->min_frame_bandwidth)
|
||||
active_best_quality = oxcf->cq_level;
|
||||
else
|
||||
active_best_quality = cpi->cq_target_quality;
|
||||
(active_best_quality < cq_level)) {
|
||||
active_best_quality = cq_level;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user