[FFmpeg-cvslog] swr/dither: fix division by 0

Michael Niedermayer git at videolan.org
Mon Jan 14 03:05:14 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Jan 14 01:06:48 2013 +0100| [55d05286696473487ce51e347985378e28c0713b] | committer: Michael Niedermayer

swr/dither: fix division by 0

Found-by: Daemon404
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libswresample/dither.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libswresample/dither.c b/libswresample/dither.c
index ae56c8c..d70505c 100644
--- a/libswresample/dither.c
+++ b/libswresample/dither.c
@@ -97,7 +97,7 @@ int swri_dither_init(SwrContext *s, enum AVSampleFormat out_fmt, enum AVSampleFo
     s->dither.ns_pos = 0;
     s->dither.noise_scale=   scale;
     s->dither.ns_scale   =   scale;
-    s->dither.ns_scale_1 = 1/scale;
+    s->dither.ns_scale_1 = scale ? 1/scale : 0;
     memset(s->dither.ns_errors, 0, sizeof(s->dither.ns_errors));
     for (i=0; filters[i].coefs; i++) {
         const filter_t *f = &filters[i];



More information about the ffmpeg-cvslog mailing list