-
Notifications
You must be signed in to change notification settings - Fork 0
/
codetable_data.h
executable file
·169 lines (136 loc) · 5.4 KB
/
codetable_data.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/*
* Header file for Handling with Canonical Huffman Codes: Data Section
*
* (C) Frank Klemm 2002. All rights reserved.
*
* Designed for multiple include.
* You can generate code for encoder and decoder, for data definition and functions for data initialization.
*
* Behaviour depends on setting of one of those 4 defines:
*
* GENERATORMODE_DEFINE_ENCODER:
* Generates Huffman encoder tables (not the source table which is much smaller (8 bit per entry)
* and identically for encoder and decoder!)
* Must be done before including with GENERATORMODE_INIT_ENCODER to define and declare variables.
*
* GENERATORMODE_DEFINE_DECODER:
* Generates Huffman decoder tables (not the source table which is much smaller (8 bit per entry)
* and identically for encoder and decoder!)
* Must be done before including with GENERATORMODE_INIT_DECODER to define and declare variables.
*
* GENERATORMODE_INIT_ENCODER:
* Generates code for the function Init_Encoder_Huffman_Tables()
*
* GENERATORMODE_INIT_DECODER:
* Generates code for the function Init_Decoder_Huffman_Tables()
*
* none:
* Declarate prototypes of the
* - Huffman source data
* - Huffman encoder tables
* - Huffman decoder tables
* - functions Init_Decoder_Huffman_Tables() and Init_Encoder_Huffman_Tables()
*
* These defines (GENERATORMODE_*) will be reset at the end of this file.
*
* History:
* 2002-08-01 created
*/
#ifndef MAXLUTBITS
# define MAXLUTBITS 10 // Decoder Lookup tables can be up to 1024 bytes long
#endif
#include "codetable.h"
#ifndef _CONCAT2
# define _CONCAT2(x,y) x##y
#endif
#ifndef _CONCAT3
# define _CONCAT3(x,y,z) x##y##z
#endif
#if defined GENERATORMODE_INIT_ENCODER /*************************************/
# define MAKE_TABLE_PROTOTYPE( x ) \
_CONCAT2(Encodertable_,x) = MakeHuffEncTable ( & _CONCAT3 ( Coding_, x, _src) );
void
Init_Encoder_Huffman_Tables ( void )
{
#elif defined GENERATORMODE_INIT_DECODER /*************************************/
# define MAKE_TABLE_PROTOTYPE( x ) \
_CONCAT2 (Decodertable_,x) = MakeHuffDecTable ( & _CONCAT3 (Coding_,x,_src), MAXLUTBITS );
void
Init_Decoder_Huffman_Tables ( void )
{
#elif defined GENERATORMODE_DEFINE_ENCODER /***********************************/
# define MAKE_TABLE_PROTOTYPE( x ) \
extern const HuffSourceTable_t _CONCAT3 (Coding_,x,_src); \
HuffEncTable_t _CONCAT2 (Encodertable_,x);
#elif defined GENERATORMODE_DEFINE_DECODER /***********************************/
# define MAKE_TABLE_PROTOTYPE( x ) \
extern const HuffSourceTable_t _CONCAT3 (Coding_,x,_src); \
HuffDecTable_t _CONCAT2 (Decodertable_,x);
#elif defined GENERATORMODE_ARRAY_ENCODER /************************************/
# define MAKE_TABLE_PROTOTYPE( x ) &_CONCAT2 (Encodertable_,x),
const HuffEncTable_t* const Encodertables [] = {
#elif defined GENERATORMODE_ARRAY_DECODER /************************************/
# define MAKE_TABLE_PROTOTYPE( x ) &_CONCAT2 (Decodertable_,x),
const HuffDecTable_t* const Decodertables [] = {
#else /************************************************************************/
# define MAKE_TABLE_PROTOTYPE( x ) \
extern const HuffSourceTable_t _CONCAT3 (Coding_,x,_src); \
extern HuffDecTable_t _CONCAT2 (Decodertable_,x); \
extern HuffEncTable_t _CONCAT2 (Encodertable_,x);
void Init_Decoder_Huffman_Tables ( void );
void Init_Encoder_Huffman_Tables ( void );
#endif /**********************************************************************/
MAKE_TABLE_PROTOTYPE ( MAXSUB )
MAKE_TABLE_PROTOTYPE ( SCFI )
MAKE_TABLE_PROTOTYPE ( DSCF )
MAKE_TABLE_PROTOTYPE ( HDR0 )
MAKE_TABLE_PROTOTYPE ( DHDR1 )
MAKE_TABLE_PROTOTYPE ( DHDR )
MAKE_TABLE_PROTOTYPE ( Q1 )
MAKE_TABLE_PROTOTYPE ( Q11 )
MAKE_TABLE_PROTOTYPE ( Q12 )
MAKE_TABLE_PROTOTYPE ( Q13 )
MAKE_TABLE_PROTOTYPE ( Q14 )
MAKE_TABLE_PROTOTYPE ( Q2 )
MAKE_TABLE_PROTOTYPE ( Q21 )
MAKE_TABLE_PROTOTYPE ( Q22 )
MAKE_TABLE_PROTOTYPE ( Q23 )
MAKE_TABLE_PROTOTYPE ( Q24 )
MAKE_TABLE_PROTOTYPE ( Q3 )
MAKE_TABLE_PROTOTYPE ( Q31 )
MAKE_TABLE_PROTOTYPE ( Q32 )
MAKE_TABLE_PROTOTYPE ( Q33 )
MAKE_TABLE_PROTOTYPE ( Q34 )
MAKE_TABLE_PROTOTYPE ( Q41 )
MAKE_TABLE_PROTOTYPE ( Q42 )
MAKE_TABLE_PROTOTYPE ( Q51 )
MAKE_TABLE_PROTOTYPE ( Q52 )
MAKE_TABLE_PROTOTYPE ( Q71 )
MAKE_TABLE_PROTOTYPE ( Q72 )
MAKE_TABLE_PROTOTYPE ( Q101 )
MAKE_TABLE_PROTOTYPE ( Q102 )
MAKE_TABLE_PROTOTYPE ( Q151 )
MAKE_TABLE_PROTOTYPE ( Q152 )
MAKE_TABLE_PROTOTYPE ( Q311 )
MAKE_TABLE_PROTOTYPE ( Q312 )
MAKE_TABLE_PROTOTYPE ( BIGT )
MAKE_TABLE_PROTOTYPE ( BIG1 )
MAKE_TABLE_PROTOTYPE ( BIG2 )
MAKE_TABLE_PROTOTYPE ( BIG3 )
MAKE_TABLE_PROTOTYPE ( BIG4 )
MAKE_TABLE_PROTOTYPE ( BIGV1 )
MAKE_TABLE_PROTOTYPE ( BIGV2 )
MAKE_TABLE_PROTOTYPE ( BIGV3 )
#if defined GENERATORMODE_INIT_ENCODER || defined GENERATORMODE_INIT_DECODER
}
#endif
#if defined GENERATORMODE_ARRAY_ENCODER || defined GENERATORMODE_ARRAY_DECODER
NULL,
};
#endif
#undef MAKE_TABLE_PROTOTYPE
#undef GENERATORMODE_INIT_ENCODER
#undef GENERATORMODE_INIT_DECODER
#undef GENERATORMODE_DEFINE_ENCODER
#undef GENERATORMODE_DEFINE_DECODER
/* end of codetable_data.h */