fix VP8LHistogramNumCodes to handle the case palette_code_bits == 0

-> lot of simplifications ensue and we should be able to get rid of
 ClearHuffmanTreeIfOnlyOneSymbol() too, in a subsequent patch.

Change-Id: Ic4c51d05e4b1970e37f94ffd85fae6a02e4a6422
This commit is contained in:
Pascal Massimino
2012-05-14 01:23:58 -07:00
parent b5551d2e1d
commit 9c7a3cf5e7
2 changed files with 50 additions and 74 deletions

View File

@ -118,7 +118,8 @@ static WEBP_INLINE void VP8LHistogramRemove(VP8LHistogram* const p,
}
static WEBP_INLINE int VP8LHistogramNumCodes(const VP8LHistogram* const p) {
return 256 + kLengthCodes + (1 << p->palette_code_bits_);
return 256 + kLengthCodes +
((p->palette_code_bits_ > 0) ? (1 << p->palette_code_bits_) : 0);
}
void VP8LConvertPopulationCountTableToBitEstimates(