[FFmpeg-cvslog] avfilter/avf_ahistogram: make use of av_rescale

Paul B Mahol git at videolan.org
Tue May 28 12:17:00 EEST 2019


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue May 28 10:51:57 2019 +0200| [cd753968976deecdf2aac12f610b54f74f322c1e] | committer: Paul B Mahol

avfilter/avf_ahistogram: make use of av_rescale

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

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

diff --git a/libavfilter/avf_ahistogram.c b/libavfilter/avf_ahistogram.c
index 7795f3913c..a0931bfa58 100644
--- a/libavfilter/avf_ahistogram.c
+++ b/libavfilter/avf_ahistogram.c
@@ -120,7 +120,7 @@ static int config_input(AVFilterLink *inlink)
     AVFilterContext *ctx = inlink->dst;
     AudioHistogramContext *s = ctx->priv;
 
-    s->nb_samples = FFMAX(1, ((double)inlink->sample_rate / av_q2d(s->frame_rate)) + 0.5);
+    s->nb_samples = FFMAX(1, av_rescale(inlink->sample_rate, s->frame_rate.den, s->frame_rate.num));
     s->dchannels = s->dmode == SINGLE ? 1 : inlink->channels;
     s->shistogram = av_calloc(s->w, s->dchannels * sizeof(*s->shistogram));
     if (!s->shistogram)



More information about the ffmpeg-cvslog mailing list