diff options
author | Paul B Mahol <onemda@gmail.com> | 2015-07-15 22:24:37 +0300 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2015-07-15 22:24:37 +0300 |
commit | 51925daafda9bbd7aba40d23b124ea967552e6dd (patch) | |
tree | 708a1fc6d9b937a8d8938b44c6a93fa1b56a174d /libavfilter/af_astats.c | |
parent | 59a9998908d89a88f05409b441a4be04c3327fdd (diff) |
avfilter/af_astats: make sure p->last is actually always set when measuring max difference
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavfilter/af_astats.c')
-rw-r--r-- | libavfilter/af_astats.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavfilter/af_astats.c b/libavfilter/af_astats.c index 81cede1cac..0e8c3e243a 100644 --- a/libavfilter/af_astats.c +++ b/libavfilter/af_astats.c @@ -104,6 +104,7 @@ static void reset_stats(AudioStatsContext *s) p->min = p->min_sigma_x2 = DBL_MAX; p->max = p->max_sigma_x2 = DBL_MIN; + p->max_diff = -1; } } @@ -161,7 +162,7 @@ static inline void update_stat(AudioStatsContext *s, ChannelStats *p, double d) p->sigma_x += d; p->sigma_x2 += d * d; p->avg_sigma_x2 = p->avg_sigma_x2 * s->mult + (1.0 - s->mult) * d * d; - p->max_diff = FFMAX(p->max_diff, FFABS(d - p->last)); + p->max_diff = FFMAX(p->max_diff, FFABS(d - (p->max_diff == -1 ? d : p->last))); p->last = d; p->mask |= llrint(d * (1LLU<<63)); |