mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-18 12:05:14 -04:00
Fix huffman decoding bug. Now to implement LZ77 bit of deflate
This commit is contained in:
parent
7d1b66f8b4
commit
478d96328a
@ -278,10 +278,10 @@ Int32 Huffman_Decode(DeflateState* state, HuffmanTable* table) {
|
||||
|
||||
/* Slow, bit by bit lookup */
|
||||
Int32 codeword = 0;
|
||||
UInt32 i;
|
||||
for (i = 1; i < DEFLATE_MAX_BITS; i++) {
|
||||
UInt32 i, j;
|
||||
for (i = 1, j = 0; i < DEFLATE_MAX_BITS; i++, j++) {
|
||||
if (state->NumBits < i) return -1;
|
||||
codeword = (codeword << 1) | ((state->Bits >> i) & 1);
|
||||
codeword = (codeword << 1) | ((state->Bits >> j) & 1);
|
||||
|
||||
if (codeword >= table->FirstCodewords[i] && codeword <= table->EndCodewords[i]) {
|
||||
Int32 offset = table->FirstOffsets[i] + (codeword - table->FirstCodewords[i]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user