[FFmpeg-devel] [PATCH 2/3] avcodec/snowenc: Set mb_num to avoid ratecontrol floating point divisions by 0.0

Michael Niedermayer michael at niedermayer.cc
Tue Oct 15 02:48:39 EEST 2019


Fixes: Ticket7990

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/snowenc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index 4166ce4e1d..3f2a75a670 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -81,6 +81,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
     s->m.bit_rate= avctx->bit_rate;
     s->m.lmin    = avctx->mb_lmin;
     s->m.lmax    = avctx->mb_lmax;
+    s->m.mb_num  = (avctx->width * avctx->height + 255) / 256; // For ratecontrol
 
     s->m.me.temp      =
     s->m.me.scratchpad= av_mallocz_array((avctx->width+64), 2*16*2*sizeof(uint8_t));
-- 
2.23.0



More information about the ffmpeg-devel mailing list