NAME: III_huffdecode() DESCRIPTION: decode Huffman code words of one channel of one granule */
| 972 | DESCRIPTION: decode Huffman code words of one channel of one granule |
| 973 | */ |
| 974 | static |
| 975 | enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xr[576], |
| 976 | struct channel *channel, |
| 977 | unsigned int const *sfbwidth, |
| 978 | unsigned int part2_length) |
| 979 | { |
| 980 | signed int exponents[39], exp; |
| 981 | signed int const *expptr; |
| 982 | struct mad_bitptr peek; |
| 983 | signed int bits_left, cachesz; |
| 984 | register mad_fixed_t *xrptr; |
| 985 | mad_fixed_t const *sfbound; |
| 986 | register unsigned long bitcache; |
| 987 | |
| 988 | stack(__FUNCTION__, __FILE__, __LINE__); |
| 989 | bits_left = (signed) channel->part2_3_length - (signed) part2_length; |
| 990 | if (bits_left < 0) |
| 991 | return MAD_ERROR_BADPART3LEN; |
| 992 | |
| 993 | III_exponents(channel, sfbwidth, exponents); |
| 994 | |
| 995 | peek = *ptr; |
| 996 | mad_bit_skip(ptr, bits_left); |
| 997 | |
| 998 | /* align bit reads to byte boundaries */ |
| 999 | cachesz = mad_bit_bitsleft(&peek); |
| 1000 | cachesz += ((32 - 1 - 24) + (24 - cachesz)) & ~7; |
| 1001 | |
| 1002 | bitcache = mad_bit_read(&peek, cachesz); |
| 1003 | bits_left -= cachesz; |
| 1004 | |
| 1005 | xrptr = &xr[0]; |
| 1006 | |
| 1007 | /* big_values */ |
| 1008 | { |
| 1009 | unsigned int region, rcount; |
| 1010 | struct hufftable const *entry; |
| 1011 | union huffpair const *table; |
| 1012 | unsigned int linbits, startbits, big_values, reqhits; |
| 1013 | mad_fixed_t reqcache[16]; |
| 1014 | |
| 1015 | sfbound = xrptr + *sfbwidth++; |
| 1016 | rcount = channel->region0_count + 1; |
| 1017 | |
| 1018 | entry = &mad_huff_pair_table[channel->table_select[region = 0]]; |
| 1019 | table = entry->table; |
| 1020 | linbits = entry->linbits; |
| 1021 | startbits = entry->startbits; |
| 1022 | |
| 1023 | if (table == 0) |
| 1024 | return MAD_ERROR_BADHUFFTABLE; |
| 1025 | |
| 1026 | expptr = &exponents[0]; |
| 1027 | exp = *expptr++; |
| 1028 | reqhits = 0; |
| 1029 | |
| 1030 | big_values = channel->big_values; |
| 1031 |
no test coverage detected