Browse Source

svq1enc: fix signed multiplication overflow

This multiplication can overflow the signed range but not the
unsigned.  After right-shifting it will thus fit in the signed
range again.

Signed-off-by: Mans Rullgard <mans@mansr.com>
tags/n0.9
Mans Rullgard 14 years ago
parent
commit
f7f892e4d5
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      libavcodec/svq1enc.c

+ 1
- 1
libavcodec/svq1enc.c View File

@@ -160,7 +160,7 @@ static int encode_block(SVQ1Context *s, uint8_t *src, uint8_t *ref, uint8_t *dec
}

best_count=0;
best_score -= ((block_sum[0]*block_sum[0])>>(level+3));
best_score -= (int)(((unsigned)block_sum[0]*block_sum[0])>>(level+3));
best_mean= (block_sum[0] + (size>>1)) >> (level+3);

if(level<4){


Loading…
Cancel
Save