summaryrefslogtreecommitdiff
path: root/libavfilter/avf_showspectrum.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2021-07-24 17:30:58 +0200
committerPaul B Mahol <onemda@gmail.com>2021-07-24 17:30:58 +0200
commit94c90b3261fe1eb8b8f4131c4eb135b611e10e30 (patch)
tree1b5d286abfffa847fddfddd96c6a2042e25284c8 /libavfilter/avf_showspectrum.c
parent60e2348e278fa2f76709710b2a0a4b907ef66a65 (diff)
avfilter/avf_showspectrum: fix not rendering all channels with fscale=log:mode=separate
Diffstat (limited to 'libavfilter/avf_showspectrum.c')
-rw-r--r--libavfilter/avf_showspectrum.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index f9ff5b567d..8aa6c668fa 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -977,8 +977,8 @@ static int plot_channel_log(AVFilterContext *ctx, void *arg, int jobnr, int nb_j
a0 = get_value(ctx, ch, yy+0);
a1 = get_value(ctx, ch, FFMIN(yy+1, h-1));
for (float j = pos0; j < pos1 && y + j - pos0 < h; j++) {
- float row = (s->mode == COMBINED) ? y + j - pos0 : ch * h + y + j - pos0;
- float *out = &s->color_buffer[ch][3 * FFMIN(lrintf(row), h-1)];
+ float row = (s->mode == COMBINED) ? av_clipf(y + j - pos0, 0, h - 1) : ch * h + av_clipf(y + j - pos0, 0, h - 1);
+ float *out = &s->color_buffer[ch][3 * lrintf(row)];
float lerpfrac = (j - pos0) / delta;
pick_color(s, yf, uf, vf, lerpfrac * a1 + (1.f-lerpfrac) * a0, out);