ref: b74eeb8675a2653c4961a22a747a7a75b107ed15
parent: ec8c25ca2a4b959ff09a3859ab559e84e9452017
parent: 5e5da2e963c08f8b0e4a5af42b7401ebbc135ae0
author: Paul Wilkins <[email protected]>
date: Thu Nov 20 10:45:41 EST 2014
Merge "Fix bug in calculating number of mbs with scaling."
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -949,9 +949,8 @@
// where the typical "real" energy per MB also falls.
// Initial estimate here uses sqrt(mbs) to define the min_err, where the
// number of mbs is proportional to the image area.
- const int num_mbs =
- cpi->oxcf.resize_mode == RESIZE_FIXED ?
- cpi->initial_mbs : cpi->common.MBs;
+ const int num_mbs = (cpi->oxcf.resize_mode != RESIZE_NONE)
+ ? cpi->initial_mbs : cpi->common.MBs;
const double min_err = 200 * sqrt(num_mbs);
intra_factor = intra_factor / (double)num_mbs;
@@ -1091,9 +1090,8 @@
if (section_target_bandwidth <= 0) {
return rc->worst_quality; // Highest value allowed
} else {
- const int num_mbs =
- cpi->oxcf.resize_mode == RESIZE_FIXED ?
- cpi->initial_mbs : cpi->common.MBs;
+ const int num_mbs = (cpi->oxcf.resize_mode != RESIZE_NONE)
+ ? cpi->initial_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 * oxcf->speed;
@@ -1210,9 +1208,8 @@
static double get_sr_decay_rate(const VP9_COMP *cpi,
const FIRSTPASS_STATS *frame) {
- const int num_mbs =
- cpi->oxcf.resize_mode == RESIZE_FIXED ?
- cpi->initial_mbs : cpi->common.MBs;
+ const int num_mbs = (cpi->oxcf.resize_mode != RESIZE_NONE)
+ ? cpi->initial_mbs : cpi->common.MBs;
double sr_diff =
(frame->sr_coded_error - frame->coded_error) / num_mbs;
double sr_decay = 1.0;
@@ -1338,9 +1335,8 @@
vp9_convert_qindex_to_q(cpi->rc.avg_frame_qindex[INTER_FRAME],
cpi->common.bit_depth);
const double boost_q_correction = MIN((0.5 + (lq * 0.015)), 1.5);
- const int num_mbs =
- cpi->oxcf.resize_mode == RESIZE_FIXED ?
- cpi->initial_mbs : cpi->common.MBs;
+ const int num_mbs = (cpi->oxcf.resize_mode != RESIZE_NONE)
+ ? cpi->initial_mbs : cpi->common.MBs;
// Underlying boost factor is based on inter error ratio.
frame_boost = (BASELINE_ERR_PER_MB * num_mbs) /