cache_ptr += cm->mi_cols;
}
}
-static int is_slowest_mode(int mode) {
- return (mode == TWO_PASS_SECOND_BEST || mode == ONE_PASS_BEST);
-}
static void set_rd_speed_thresholds(VP9_COMP *cpi) {
int i;
// Set baseline threshold values
for (i = 0; i < MAX_MODES; ++i)
- rd->thresh_mult[i] = is_slowest_mode(cpi->oxcf.mode) ? -500 : 0;
+ rd->thresh_mult[i] = is_best_mode(cpi->oxcf.mode) ? -500 : 0;
rd->thresh_mult[THR_NEARESTMV] = 0;
rd->thresh_mult[THR_NEARESTG] = 0;
int i;
for (i = 0; i < MAX_REFS; ++i)
- rd->thresh_mult_sub8x8[i] = is_slowest_mode(cpi->oxcf.mode) ? -500 : 0;
+ rd->thresh_mult_sub8x8[i] = is_best_mode(cpi->oxcf.mode) ? -500 : 0;
rd->thresh_mult_sub8x8[THR_LAST] += 2500;
rd->thresh_mult_sub8x8[THR_GOLD] += 2500;
cpi->fixed_divide[i] = 0x80000 / i;
}
+ static int get_pass(MODE mode) {
+ switch (mode) {
+ case REALTIME:
+ case ONE_PASS_GOOD:
+ case ONE_PASS_BEST:
+ return 0;
+
+ case TWO_PASS_FIRST:
+ return 1;
+
+ case TWO_PASS_SECOND_GOOD:
+ case TWO_PASS_SECOND_BEST:
+ return 2;
+ }
+ return -1;
+ }
+
void vp9_change_config(struct VP9_COMP *cpi, const VP9_CONFIG *oxcf) {
VP9_COMMON *const cm = &cpi->common;
RATE_CONTROL *const rc = &cpi->rc;
assert(cm->bit_depth > BITS_8);
cpi->oxcf = *oxcf;
-
- switch (cpi->oxcf.mode) {
- // Real time and one pass deprecated in test code base
- case ONE_PASS_GOOD:
- cpi->pass = 0;
- break;
-
- case ONE_PASS_BEST:
- cpi->pass = 0;
- break;
-
- case TWO_PASS_FIRST:
- cpi->pass = 1;
- break;
-
- case TWO_PASS_SECOND_GOOD:
- cpi->pass = 2;
- break;
-
- case TWO_PASS_SECOND_BEST:
- cpi->pass = 2;
- break;
-
- case REALTIME:
- cpi->pass = 0;
- cpi->oxcf.play_alternate = 0;
- break;
- }
+ cpi->pass = get_pass(cpi->oxcf.mode);
+ if (cpi->oxcf.mode == REALTIME)
+ cpi->oxcf.play_alternate = 0;
cpi->oxcf.lossless = oxcf->lossless;
if (cpi->oxcf.lossless) {
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;
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.
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;
}
(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,