diff options
Diffstat (limited to 'apps/codecs/libmusepack/huffman.h')
-rw-r--r-- | apps/codecs/libmusepack/huffman.h | 56 |
1 files changed, 43 insertions, 13 deletions
diff --git a/apps/codecs/libmusepack/huffman.h b/apps/codecs/libmusepack/huffman.h index 87fd5c15a4..1244149184 100644 --- a/apps/codecs/libmusepack/huffman.h +++ b/apps/codecs/libmusepack/huffman.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | Copyright (c) 2005, The Musepack Development Team | 2 | Copyright (c) 2005-2009, The Musepack Development Team |
3 | All rights reserved. | 3 | All rights reserved. |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without | 5 | Redistribution and use in source and binary forms, with or without |
@@ -31,23 +31,53 @@ | |||
31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 32 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
33 | */ | 33 | */ |
34 | |||
35 | /// \file huffman.h | 34 | /// \file huffman.h |
36 | /// Data structures and functions for huffman coding. | 35 | /// Data structures and functions for huffman coding. |
37 | 36 | ||
38 | #ifndef _mpcdec_huffman_h_ | 37 | #ifndef _MPCDEC_HUFFMAN_H_ |
39 | #define _mpcdec_huffman_h_ | 38 | #define _MPCDEC_HUFFMAN_H_ |
39 | #ifdef WIN32 | ||
40 | #pragma once | ||
41 | #endif | ||
42 | |||
43 | #include "mpc_types.h" | ||
40 | 44 | ||
41 | #include "config_types.h" | 45 | #ifdef __cplusplus |
42 | #include "decoder.h" | 46 | extern "C" { |
47 | #endif | ||
43 | 48 | ||
44 | struct mpc_decoder_t; // forward declare to break circular dependencies | 49 | // LUT size parameter, LUT size is 1 << LUT_DEPTH |
50 | #define LUT_DEPTH 6 | ||
45 | 51 | ||
46 | /// Huffman table entry. | 52 | /// Huffman table entry. |
47 | typedef struct huffman_type_t { | 53 | typedef struct mpc_huffman_t { |
48 | mpc_uint32_t Code; | 54 | mpc_uint16_t Code; |
49 | mpc_uint8_t Length; | 55 | mpc_uint8_t Length; |
50 | mpc_int8_t Value; | 56 | mpc_int8_t Value; |
51 | } HuffmanTyp; | 57 | } mpc_huffman; |
58 | |||
59 | /// Huffman LUT entry. | ||
60 | typedef struct mpc_huff_lut_t { | ||
61 | mpc_uint8_t Length; | ||
62 | mpc_int8_t Value; | ||
63 | } mpc_huff_lut; | ||
64 | |||
65 | /// Type used for huffman LUT decoding | ||
66 | typedef struct mpc_lut_data_t { | ||
67 | mpc_huffman const *table; | ||
68 | mpc_huff_lut lut[1 << LUT_DEPTH]; | ||
69 | } mpc_lut_data; | ||
70 | |||
71 | /// Type used for canonical huffman decoding | ||
72 | typedef struct mpc_can_data_t { | ||
73 | mpc_huffman const *table; | ||
74 | mpc_int8_t const *sym; | ||
75 | mpc_huff_lut lut[1 << LUT_DEPTH]; | ||
76 | } mpc_can_data; | ||
77 | |||
78 | void huff_init_lut(const int bits); | ||
52 | 79 | ||
53 | #endif // _mpcdec_huffman_h_ | 80 | #ifdef __cplusplus |
81 | } | ||
82 | #endif | ||
83 | #endif | ||