diff options
author | Sean Bartell <wingedtachikoma@gmail.com> | 2011-06-25 21:32:25 -0400 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2012-04-25 22:13:20 +0200 |
commit | f40bfc9267b13b54e6379dfe7539447662879d24 (patch) | |
tree | 9b20069d5e62809ff434061ad730096836f916f2 /lib/rbcodec/codecs/libmusepack/huffman.h | |
parent | a0009907de7a0107d49040d8a180f140e2eff299 (diff) | |
download | rockbox-f40bfc9267b13b54e6379dfe7539447662879d24.tar.gz rockbox-f40bfc9267b13b54e6379dfe7539447662879d24.zip |
Add codecs to librbcodec.
Change-Id: Id7f4717d51ed02d67cb9f9cb3c0ada4a81843f97
Reviewed-on: http://gerrit.rockbox.org/137
Reviewed-by: Nils Wallménius <nils@rockbox.org>
Tested-by: Nils Wallménius <nils@rockbox.org>
Diffstat (limited to 'lib/rbcodec/codecs/libmusepack/huffman.h')
-rw-r--r-- | lib/rbcodec/codecs/libmusepack/huffman.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/libmusepack/huffman.h b/lib/rbcodec/codecs/libmusepack/huffman.h new file mode 100644 index 0000000000..1244149184 --- /dev/null +++ b/lib/rbcodec/codecs/libmusepack/huffman.h | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | Copyright (c) 2005-2009, The Musepack Development Team | ||
3 | All rights reserved. | ||
4 | |||
5 | Redistribution and use in source and binary forms, with or without | ||
6 | modification, are permitted provided that the following conditions are | ||
7 | met: | ||
8 | |||
9 | * Redistributions of source code must retain the above copyright | ||
10 | notice, this list of conditions and the following disclaimer. | ||
11 | |||
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. | ||
16 | |||
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 | ||
20 | written permission. | ||
21 | |||
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. | ||
33 | */ | ||
34 | /// \file huffman.h | ||
35 | /// Data structures and functions for huffman coding. | ||
36 | |||
37 | #ifndef _MPCDEC_HUFFMAN_H_ | ||
38 | #define _MPCDEC_HUFFMAN_H_ | ||
39 | #ifdef WIN32 | ||
40 | #pragma once | ||
41 | #endif | ||
42 | |||
43 | #include "mpc_types.h" | ||
44 | |||
45 | #ifdef __cplusplus | ||
46 | extern "C" { | ||
47 | #endif | ||
48 | |||
49 | // LUT size parameter, LUT size is 1 << LUT_DEPTH | ||
50 | #define LUT_DEPTH 6 | ||
51 | |||
52 | /// Huffman table entry. | ||
53 | typedef struct mpc_huffman_t { | ||
54 | mpc_uint16_t Code; | ||
55 | mpc_uint8_t Length; | ||
56 | mpc_int8_t Value; | ||
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); | ||
79 | |||
80 | #ifdef __cplusplus | ||
81 | } | ||
82 | #endif | ||
83 | #endif | ||