Changeset 290 for libmpc/branches/r2d/libmpcdec/mpc_bits_reader.h
- Timestamp:
- 04/23/07 16:47:30 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpc/branches/r2d/libmpcdec/mpc_bits_reader.h
r288 r290 61 61 } 62 62 63 // FIXME : this must be implemented with a lookup table64 63 // basic huffman decoding routine 65 64 // works with maximum lengths up to 16 … … 68 67 mpc_uint16_t code; 69 68 code = ((r->buff[0] << 16) | (r->buff[1] << 8) | r->buff[2]) >> r->count; 69 70 while (code < Table->Code) Table++; 71 72 r->buff -= (int)(r->count - Table->Length) >> 3; 73 r->count = (r->count - Table->Length) & 0x07; 74 75 return Table->Value; 76 } 77 78 // LUT-based huffman decoding routine 79 // works with maximum lengths up to 16 80 static mpc_inline mpc_int32_t mpc_bits_huff_lut(mpc_bits_reader * r, const mpc_lut_data *lut) 81 { 82 mpc_uint16_t code; 83 mpc_huff_lut tmp; 84 const mpc_huffman * Table; 85 code = ((r->buff[0] << 16) | (r->buff[1] << 8) | r->buff[2]) >> r->count; 86 87 tmp = lut->lut[code >> (16 - LUT_DEPTH)]; 88 if (tmp.Length != 0) { 89 r->buff -= (int)(r->count - tmp.Length) >> 3; 90 r->count = (r->count - tmp.Length) & 0x07; 91 return tmp.Value; 92 } 93 94 Table = lut->table + (unsigned char)tmp.Value; 70 95 71 96 while (code < Table->Code) Table++;
Note: See TracChangeset
for help on using the changeset viewer.