[FFmpeg-devel] [PATCH 2/5] lavfi/avf_showspectrum: replace rint by lrint

Ganesh Ajjanagadde gajjanagadde at gmail.com
Sat Dec 26 01:00:17 CET 2015


avoids float to int cast, and is slightly superior in terms of rounding
("Dutch/Gauss rounding").

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
---
 libavfilter/avf_showspectrum.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index 7d5c438..f6f16fc 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -448,7 +448,7 @@ static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples)
                      (outlink->h - 1) * outpicref->linesize[plane] +
                      s->xpos;
         for (y = 0; y < outlink->h; y++) {
-            *p = rint(FFMAX(0, FFMIN(s->combine_buffer[3 * y + plane], 255)));
+            *p = lrint(FFMAX(0, FFMIN(s->combine_buffer[3 * y + plane], 255)));
             p -= outpicref->linesize[plane];
         }
     }
-- 
2.6.4



More information about the ffmpeg-devel mailing list