[FFmpeg-cvslog] avfilter/avf_showspectrum: improve axes drawing

Paul B Mahol git at videolan.org
Sun Jun 3 13:13:59 EEST 2018


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Jun  3 12:06:35 2018 +0200| [d0bf1aa3c5f7668a817ef7e315442514c9dd9f77] | committer: Paul B Mahol

avfilter/avf_showspectrum: improve axes drawing

Signed-off-by: Paul B Mahol <onemda at gmail.com>

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

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

diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index 956f62f3ad..c86cb739f7 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -1099,14 +1099,15 @@ static int showspectrumpic_request_frame(AVFilterLink *outlink)
             }
             if (s->orientation == VERTICAL) {
                 int h = s->mode == SEPARATE ? s->h / s->nb_display_channels : s->h;
+                int hh = s->mode == SEPARATE ? -(s->h % s->nb_display_channels) + 1 : 1;
                 for (ch = 0; ch < (s->mode == SEPARATE ? s->nb_display_channels : 1); ch++) {
                     for (y = 0; y < h; y += 20) {
-                        dst = s->outpicref->data[0] + (s->start_y + h * (ch + 1) - y - 1) * s->outpicref->linesize[0];
+                        dst = s->outpicref->data[0] + (s->start_y + h * (ch + 1) - y - hh) * s->outpicref->linesize[0];
                         dst[s->start_x - 2] = 200;
                         dst[s->start_x + s->w + 1] = 200;
                     }
                     for (y = 0; y < h; y += 40) {
-                        dst = s->outpicref->data[0] + (s->start_y + h * (ch + 1) - y - 1) * s->outpicref->linesize[0];
+                        dst = s->outpicref->data[0] + (s->start_y + h * (ch + 1) - y - hh) * s->outpicref->linesize[0];
                         dst[s->start_x - 3] = 200;
                         dst[s->start_x + s->w + 2] = 200;
                     }
@@ -1135,7 +1136,7 @@ static int showspectrumpic_request_frame(AVFilterLink *outlink)
                         if (!units)
                             return AVERROR(ENOMEM);
 
-                        drawtext(s->outpicref, s->start_x - 8 * strlen(units) - 4, h * (ch + 1) + s->start_y - y - 4, units, 0);
+                        drawtext(s->outpicref, s->start_x - 8 * strlen(units) - 4, h * (ch + 1) + s->start_y - y - 4 - hh, units, 0);
                         av_free(units);
                     }
                 }



More information about the ffmpeg-cvslog mailing list