return log(var + 1.0);
}
+#define DEFAULT_E_MIDPOINT 10.0;
int vp9_block_energy(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs) {
double energy;
- energy = 0.9 * (vp9_log_block_var(cpi, x, bs) - 10.0);
+ double energy_midpoint;
+ vp9_clear_system_state();
+ energy_midpoint =
+ (cpi->oxcf.pass == 2) ? cpi->twopass.mb_av_energy : DEFAULT_E_MIDPOINT;
+ energy = vp9_log_block_var(cpi, x, bs) - energy_midpoint;
return clamp((int)round(energy), ENERGY_MIN, ENERGY_MAX);
}
rc->base_frame_target = target_rate;
+ {
+ const int num_mbs = (cpi->oxcf.resize_mode != RESIZE_NONE)
+ ? cpi->initial_mbs : cpi->common.MBs;
+ // The multiplication by 256 reverses a scaling factor of (>> 8)
+ // applied when combining MB error values for the frame.
+ twopass->mb_av_energy =
+ log(((this_frame.intra_error * 256.0) / num_mbs) + 1.0);
+ }
+
// Update the total stats remaining structure.
subtract_stats(&twopass->total_left_stats, &this_frame);
}
double modified_error_min;
double modified_error_max;
double modified_error_left;
+ double mb_av_energy;
#if CONFIG_FP_MB_STATS
uint8_t *frame_mb_stats_buf;