2
Copyright (c) 2005-2009, The Musepack Development Team
5
Redistribution and use in source and binary forms, with or without
6
modification, are permitted provided that the following conditions are
9
* Redistributions of source code must retain the above copyright
10
notice, this list of conditions and the following disclaimer.
12
* Redistributions in binary form must reproduce the above
13
copyright notice, this list of conditions and the following
14
disclaimer in the documentation and/or other materials provided
15
with the distribution.
17
* Neither the name of the The Musepack Development Team nor the
18
names of its contributors may be used to endorse or promote
19
products derived from this software without specific prior
22
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35
/// Data structures and functions for huffman coding.
37
#ifndef _MPCDEC_HUFFMAN_H_
38
#define _MPCDEC_HUFFMAN_H_
43
#include <mpc/mpc_types.h>
49
// LUT size parameter, LUT size is 1 << LUT_DEPTH
52
/// Huffman table entry.
53
typedef struct mpc_huffman_t {
59
/// Huffman LUT entry.
60
typedef struct mpc_huff_lut_t {
65
/// Type used for huffman LUT decoding
66
typedef struct mpc_lut_data_t {
67
mpc_huffman const * const table;
68
mpc_huff_lut lut[1 << LUT_DEPTH];
71
/// Type used for canonical huffman decoding
72
typedef struct mpc_can_data_t {
73
mpc_huffman const * const table;
74
mpc_int8_t const * const sym;
75
mpc_huff_lut lut[1 << LUT_DEPTH];
78
void huff_init_lut(const int bits);