From 3a83b2461e4ce9d48ad6ab037eb14569d0e53506 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 26 Nov 2011 20:11:12 +0000 Subject: [PATCH] dnxhdenc: fix signed overflows Signed-off-by: Mans Rullgard --- libavcodec/dnxhdenc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c index 89e5c085ab..d1ab597d1d 100644 --- a/libavcodec/dnxhdenc.c +++ b/libavcodec/dnxhdenc.c @@ -682,7 +682,8 @@ static int dnxhd_encode_rdo(AVCodecContext *avctx, DNXHDEncContext *ctx) int qscale = 1; int mb = y*ctx->m.mb_width+x; for (q = 1; q < avctx->qmax; q++) { - unsigned score = ctx->mb_rc[q][mb].bits*lambda+(ctx->mb_rc[q][mb].ssd<mb_rc[q][mb].bits*lambda+ + ((unsigned)ctx->mb_rc[q][mb].ssd<>1; else lambda -= down_step; - down_step *= 5; // XXX tune ? + down_step = FFMIN((int64_t)down_step*5, INT_MAX); up_step = 1<