From e0d167051e93bad55a4c009399de1545aa07eeb5 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 14 Oct 2019 23:03:50 +0200 Subject: [PATCH] avcodec/snowenc: Set mb_num to avoid ratecontrol floating point divisions by 0.0 Fixes: Ticket7990 Signed-off-by: Michael Niedermayer (cherry picked from commit 55279d699fa64d8eb1185d8db04ab4ed92e8dea2) Signed-off-by: Michael Niedermayer --- libavcodec/snowenc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c index 4e51e18e1f..cdb65ea78b 100644 --- a/libavcodec/snowenc.c +++ b/libavcodec/snowenc.c @@ -86,6 +86,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));