[FFmpeg-cvslog] avfilter/avf_showspectrum: improve dB scale description

Paul B Mahol git at videolan.org
Sun Aug 7 21:21:58 EEST 2016


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Aug  7 20:19:34 2016 +0200| [571f33de0aa8639b4f9b863e04ee6bcfd4d78070] | committer: Paul B Mahol

avfilter/avf_showspectrum: improve dB scale description

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

 libavfilter/avf_showspectrum.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index 648901f..8185faa 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -1181,6 +1181,18 @@ static int showspectrumpic_request_frame(AVFilterLink *outlink)
                     memset(s->outpicref->data[1]+(s->start_y + h * (ch + 1) - y - 1) * s->outpicref->linesize[1] + s->w + s->start_x + 20, av_clip_uint8(out[1]), 10);
                     memset(s->outpicref->data[2]+(s->start_y + h * (ch + 1) - y - 1) * s->outpicref->linesize[2] + s->w + s->start_x + 20, av_clip_uint8(out[2]), 10);
                 }
+
+                for (y = 0; ch == 0 && y < h; y += h / 10) {
+                    float value = 120.0 * log10(1. - y / (float)h);
+                    char *text;
+
+                    if (value < -120)
+                        break;
+                    text = av_asprintf("%.0f dB", value);
+                    if (!text)
+                        continue;
+                    drawtext(s->outpicref, s->w + s->start_x + 35, s->start_y + y - 5, text, 0);
+                }
             }
         }
 



More information about the ffmpeg-cvslog mailing list