Merge "Cleaning up accumulate_frame_motion_stats()."
This commit is contained in:
@@ -1083,38 +1083,30 @@ static int detect_flash(const TWO_PASS *twopass, int offset) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the motion related elements to the GF arf boost calculation.
|
// Update the motion related elements to the GF arf boost calculation.
|
||||||
static void accumulate_frame_motion_stats(
|
static void accumulate_frame_motion_stats(const FIRSTPASS_STATS *stats,
|
||||||
FIRSTPASS_STATS *this_frame,
|
double *mv_in_out,
|
||||||
double *this_frame_mv_in_out,
|
|
||||||
double *mv_in_out_accumulator,
|
double *mv_in_out_accumulator,
|
||||||
double *abs_mv_in_out_accumulator,
|
double *abs_mv_in_out_accumulator,
|
||||||
double *mv_ratio_accumulator) {
|
double *mv_ratio_accumulator) {
|
||||||
double motion_pct;
|
const double pct = stats->pcnt_motion;
|
||||||
|
|
||||||
// Accumulate motion stats.
|
|
||||||
motion_pct = this_frame->pcnt_motion;
|
|
||||||
|
|
||||||
// Accumulate Motion In/Out of frame stats.
|
// Accumulate Motion In/Out of frame stats.
|
||||||
*this_frame_mv_in_out = this_frame->mv_in_out_count * motion_pct;
|
*mv_in_out = stats->mv_in_out_count * pct;
|
||||||
*mv_in_out_accumulator += this_frame->mv_in_out_count * motion_pct;
|
*mv_in_out_accumulator += *mv_in_out;
|
||||||
*abs_mv_in_out_accumulator += fabs(this_frame->mv_in_out_count * motion_pct);
|
*abs_mv_in_out_accumulator += fabs(*mv_in_out);
|
||||||
|
|
||||||
// Accumulate a measure of how uniform (or conversely how random)
|
// Accumulate a measure of how uniform (or conversely how random) the motion
|
||||||
// the motion field is (a ratio of absmv / mv).
|
// field is (a ratio of abs(mv) / mv).
|
||||||
if (motion_pct > 0.05) {
|
if (pct > 0.05) {
|
||||||
const double this_frame_mvr_ratio = fabs(this_frame->mvr_abs) /
|
const double mvr_ratio = fabs(stats->mvr_abs) /
|
||||||
DOUBLE_DIVIDE_CHECK(fabs(this_frame->MVr));
|
DOUBLE_DIVIDE_CHECK(fabs(stats->MVr));
|
||||||
|
const double mvc_ratio = fabs(stats->mvc_abs) /
|
||||||
|
DOUBLE_DIVIDE_CHECK(fabs(stats->MVc));
|
||||||
|
|
||||||
const double this_frame_mvc_ratio = fabs(this_frame->mvc_abs) /
|
*mv_ratio_accumulator += pct * (mvr_ratio < stats->mvr_abs ?
|
||||||
DOUBLE_DIVIDE_CHECK(fabs(this_frame->MVc));
|
mvr_ratio : stats->mvr_abs);
|
||||||
|
*mv_ratio_accumulator += pct * (mvc_ratio < stats->mvc_abs ?
|
||||||
*mv_ratio_accumulator += (this_frame_mvr_ratio < this_frame->mvr_abs)
|
mvc_ratio : stats->mvc_abs);
|
||||||
? (this_frame_mvr_ratio * motion_pct)
|
|
||||||
: this_frame->mvr_abs * motion_pct;
|
|
||||||
|
|
||||||
*mv_ratio_accumulator += (this_frame_mvc_ratio < this_frame->mvc_abs)
|
|
||||||
? (this_frame_mvc_ratio * motion_pct)
|
|
||||||
: this_frame->mvc_abs * motion_pct;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user