diff options
author | Paul B Mahol <onemda@gmail.com> | 2021-07-24 16:56:51 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2021-07-24 16:56:51 +0200 |
commit | e5c860cd29f2ab9f8f47f876288934af108b9d15 (patch) | |
tree | 22a97ec778068510bdbd3f644510568ebf28bb2c | |
parent | 014ace8f98cc4a1a88e7a6d5890cef628eb9e8b0 (diff) |
avfilter/avf_showspectrum: fix hz scale with legend enabled
-rw-r--r-- | libavfilter/avf_showspectrum.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c index cec5915f90..f9ff5b567d 100644 --- a/libavfilter/avf_showspectrum.c +++ b/libavfilter/avf_showspectrum.c @@ -759,7 +759,7 @@ static int draw_legend(AVFilterContext *ctx, int samples) for (y = 0; y < h; y += 40) { float range = s->stop ? s->stop - s->start : inlink->sample_rate / 2; float bin = s->fscale == F_LINEAR ? y : get_log_hz(y, h, inlink->sample_rate); - float hertz = s->start + bin * range / (float)(1 << (int)ceil(log2(h))); + float hertz = s->start + bin * range / (float)h; char *units; if (hertz == 0) @@ -817,7 +817,7 @@ static int draw_legend(AVFilterContext *ctx, int samples) for (x = 0; x < w - 79; x += 80) { float range = s->stop ? s->stop - s->start : inlink->sample_rate / 2; float bin = s->fscale == F_LINEAR ? x : get_log_hz(x, w, inlink->sample_rate); - float hertz = s->start + bin * range / (float)(1 << (int)ceil(log2(w))); + float hertz = s->start + bin * range / (float)w; char *units; if (hertz == 0) |