[FFmpeg-cvslog] avfilter/af_astats: clip input value to prevent overflow

Paul B Mahol git at videolan.org
Mon Jan 4 12:15:24 EET 2021


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon Jan  4 11:11:26 2021 +0100| [89c9c42c5b85b68eddf891e929cfdebd8c163547] | committer: Paul B Mahol

avfilter/af_astats: clip input value to prevent overflow

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=89c9c42c5b85b68eddf891e929cfdebd8c163547
---

 libavfilter/af_astats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/af_astats.c b/libavfilter/af_astats.c
index 27036385cd..ebaae29f44 100644
--- a/libavfilter/af_astats.c
+++ b/libavfilter/af_astats.c
@@ -329,7 +329,7 @@ static inline void update_stat(AudioStatsContext *s, ChannelStats *p, double d,
 
     drop = p->win_samples[p->win_pos];
     p->win_samples[p->win_pos] = nd;
-    index = av_clip(FFABS(nd) * HISTOGRAM_MAX, 0, HISTOGRAM_MAX);
+    index = av_clip(FFABS(av_clipd(nd, -1.0, 1.0)) * HISTOGRAM_MAX, 0, HISTOGRAM_MAX);
     p->max_index = FFMAX(p->max_index, index);
     p->histogram[index]++;
     if (!isnan(p->noise_floor))



More information about the ffmpeg-cvslog mailing list