From a6edfd669f97154571f203cfa69d634a639800ff Mon Sep 17 00:00:00 2001 From: Loren Merritt Date: Thu, 20 Sep 2007 08:10:45 +0000 Subject: [PATCH] fix an arithmetic overflow in trellis at high qp. git-svn-id: svn://svn.videolan.org/x264/trunk@677 df754926-b1dd-0310-bc7b-ec298dee348c --- encoder/rdo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/encoder/rdo.c b/encoder/rdo.c index b204639f..d722c229 100644 --- a/encoder/rdo.c +++ b/encoder/rdo.c @@ -397,8 +397,8 @@ static void quant_trellis_cabac( x264_t *h, int16_t *dct, { // no need to calculate ssd of 0s: it's the same in all nodes. // no need to modify level_tree for ctx=0: it starts with an infinite loop of 0s. - const int cost_sig0 = x264_cabac_size_decision_noup( &cabac_state_sig[i], 0 ) - * i_lambda2 >> ( CABAC_SIZE_BITS - LAMBDA_BITS ); + const uint32_t cost_sig0 = x264_cabac_size_decision_noup( &cabac_state_sig[i], 0 ) + * (uint64_t)i_lambda2 >> ( CABAC_SIZE_BITS - LAMBDA_BITS ); for( j = 1; j < 8; j++ ) { if( nodes_cur[j].score != TRELLIS_SCORE_MAX ) -- 2.47.3