[FFmpeg-cvslog] avfilter/avf_showspectrum: fix scaling in zoom mode

Paul B Mahol git at videolan.org
Fri Oct 5 01:16:24 EEST 2018


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Oct  5 00:15:26 2018 +0200| [d39fae08866efebbfdf25951fbaff4df9d26e6b3] | committer: Paul B Mahol

avfilter/avf_showspectrum: fix scaling in zoom mode

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

 libavfilter/avf_showspectrum.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index 38d0a9d768..a750b9a3f1 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -340,12 +340,12 @@ static int run_channel_fft(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo
         FFTComplex *h = s->fft_scratch[ch];
         int L = s->buf_size;
         int N = s->win_size;
-        int M = s->win_size;
+        int M = s->win_size / 2;
 
-        phi = 2.0 * M_PI * (s->stop - s->start) / (double)inlink->sample_rate / (s->win_size - 1);
+        phi = 2.0 * M_PI * (s->stop - s->start) / (double)inlink->sample_rate / (M - 1);
         theta = 2.0 * M_PI * s->start / (double)inlink->sample_rate;
 
-        for (int n = 0; n < s->win_size; n++) {
+        for (int n = 0; n < M; n++) {
             h[n].re = cos(n * n / 2.0 * phi);
             h[n].im = sin(n * n / 2.0 * phi);
         }



More information about the ffmpeg-cvslog mailing list