Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2016-02-26 12:35:19 +0300
committerPaul B Mahol <onemda@gmail.com>2016-02-26 13:12:45 +0300
commit2a7f056d880774fc7711a4b588af3841cd5a84af (patch)
tree52cb2de655c970531fc9a840b3abec4713f80b2e /libavfilter/af_astats.c
parentdedcb3c5a5e6beb2f2977e7cde307c8486078c2e (diff)
avfilter/af_astats: do not clear previous sample value
Should help when using reset=1 and metadata=1 Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavfilter/af_astats.c')
-rw-r--r--libavfilter/af_astats.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/libavfilter/af_astats.c b/libavfilter/af_astats.c
index c8b034a65a..17b8ad0aa7 100644
--- a/libavfilter/af_astats.c
+++ b/libavfilter/af_astats.c
@@ -98,14 +98,27 @@ static void reset_stats(AudioStatsContext *s)
{
int c;
- memset(s->chstats, 0, sizeof(*s->chstats) * s->nb_channels);
-
for (c = 0; c < s->nb_channels; c++) {
ChannelStats *p = &s->chstats[c];
p->min = p->min_sigma_x2 = DBL_MAX;
p->max = p->max_sigma_x2 = DBL_MIN;
- p->min_diff = p->max_diff = -1;
+ p->min_diff = DBL_MAX;
+ p->max_diff = DBL_MIN;
+ p->sigma_x = 0;
+ p->sigma_x2 = 0;
+ p->avg_sigma_x2 = 0;
+ p->min_sigma_x2 = 0;
+ p->max_sigma_x2 = 0;
+ p->min_run = 0;
+ p->max_run = 0;
+ p->min_runs = 0;
+ p->max_runs = 0;
+ p->diff1_sum = 0;
+ p->mask = 0;
+ p->min_count = 0;
+ p->max_count = 0;
+ p->nb_samples = 0;
}
}
@@ -164,8 +177,8 @@ 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->min_diff = FFMIN(p->min_diff == -1 ? DBL_MAX : p->min_diff, fabs(d - (p->min_diff == -1 ? DBL_MAX : p->last)));
- p->max_diff = FFMAX(p->max_diff, fabs(d - (p->max_diff == -1 ? d : 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->last = d;
p->mask |= llrint(d * (UINT64_C(1) << 63));