mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-02-03 13:24:05 +00:00
avfilter/af_astats: fix calculations involving last sample
This commit is contained in:
parent
2a4a364f6a
commit
bd6942b4c0
@ -196,6 +196,7 @@ static void reset_stats(AudioStatsContext *s)
|
||||
p->nb_nans = 0;
|
||||
p->nb_infs = 0;
|
||||
p->nb_denormals = 0;
|
||||
p->last = NAN;
|
||||
}
|
||||
}
|
||||
|
||||
@ -285,10 +286,12 @@ static inline void update_stat(AudioStatsContext *s, ChannelStats *p, double d,
|
||||
p->sigma_x += nd;
|
||||
p->sigma_x2 += nd * nd;
|
||||
p->avg_sigma_x2 = p->avg_sigma_x2 * s->mult + (1.0 - s->mult) * nd * nd;
|
||||
if (!isnan(p->last)) {
|
||||
p->min_diff = FFMIN(p->min_diff, fabs(d - p->last));
|
||||
p->max_diff = FFMAX(p->max_diff, fabs(d - p->last));
|
||||
p->diff1_sum += fabs(d - p->last);
|
||||
p->diff1_sum_x2 += (d - p->last) * (d - p->last);
|
||||
}
|
||||
p->last = d;
|
||||
p->mask |= i;
|
||||
p->imask &= i;
|
||||
|
Loading…
Reference in New Issue
Block a user