avcodec/wavpackenc: Fix log2sample() result value

Found-by: CSA
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-08-02 18:15:12 +02:00
parent 2b501b553f
commit e706fe7640

View File

@ -638,7 +638,7 @@ static uint32_t log2sample(uint32_t v, int limit, uint32_t *result)
if ((v += v >> 9) < (1 << 8)) { if ((v += v >> 9) < (1 << 8)) {
dbits = nbits_table[v]; dbits = nbits_table[v];
result += (dbits << 8) + wp_log2_table[(v << (9 - dbits)) & 0xff]; *result += (dbits << 8) + wp_log2_table[(v << (9 - dbits)) & 0xff];
} else { } else {
if (v < (1L << 16)) if (v < (1L << 16))
dbits = nbits_table[v >> 8] + 8; dbits = nbits_table[v >> 8] + 8;
@ -647,7 +647,7 @@ static uint32_t log2sample(uint32_t v, int limit, uint32_t *result)
else else
dbits = nbits_table[v >> 24] + 24; dbits = nbits_table[v >> 24] + 24;
result += dbits = (dbits << 8) + wp_log2_table[(v >> (dbits - 9)) & 0xff]; *result += dbits = (dbits << 8) + wp_log2_table[(v >> (dbits - 9)) & 0xff];
if (limit && dbits >= limit) if (limit && dbits >= limit)
return 1; return 1;