diff options
author | Björn Stenberg <bjorn@haxx.se> | 2007-01-08 23:53:00 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2007-01-08 23:53:00 +0000 |
commit | 7039a05147b8bbfc829babea1c65bd436450b505 (patch) | |
tree | 4ba555eb84ed97b72b0575034d5b0530a393713e /songdbj/javazoom/jl/decoder/huffcodetab.java | |
parent | 6d4c19707ef95942e323cbdc89fbbfdbe45e7cc5 (diff) | |
download | rockbox-7039a05147b8bbfc829babea1c65bd436450b505.tar.gz rockbox-7039a05147b8bbfc829babea1c65bd436450b505.zip |
Splitting out songdbj
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11953 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'songdbj/javazoom/jl/decoder/huffcodetab.java')
-rw-r--r-- | songdbj/javazoom/jl/decoder/huffcodetab.java | 600 |
1 files changed, 0 insertions, 600 deletions
diff --git a/songdbj/javazoom/jl/decoder/huffcodetab.java b/songdbj/javazoom/jl/decoder/huffcodetab.java deleted file mode 100644 index 86975646f0..0000000000 --- a/songdbj/javazoom/jl/decoder/huffcodetab.java +++ /dev/null | |||
@@ -1,600 +0,0 @@ | |||
1 | /* | ||
2 | * 11/19/04 1.0 moved to LGPL. | ||
3 | * 16/11/99 Renamed class, added javadoc, and changed table | ||
4 | * name from String to 3 chars. mdm@techie.com | ||
5 | * 02/15/99 Java Conversion by E.B, javalayer@javazoom.net | ||
6 | * | ||
7 | * 04/19/97 : Adapted from the ISO MPEG Audio Subgroup Software Simulation | ||
8 | * Group's public c source for its MPEG audio decoder. Miscellaneous | ||
9 | * changes by Jeff Tsay (ctsay@pasteur.eecs.berkeley.edu). | ||
10 | *----------------------------------------------------------------------- | ||
11 | * Copyright (c) 1991 MPEG/audio software simulation group, All Rights Reserved | ||
12 | * MPEG/audio coding/decoding software, work in progress | ||
13 | * NOT for public distribution until verified and approved by the | ||
14 | * MPEG/audio committee. For further information, please contact | ||
15 | * Davis Pan, 508-493-2241, e-mail: pan@3d.enet.dec.com | ||
16 | * | ||
17 | * VERSION 4.1 | ||
18 | * changes made since last update: | ||
19 | * date programmers comment | ||
20 | * 27.2.92 F.O.Witte (ITT Intermetall) | ||
21 | * 8/24/93 M. Iwadare Changed for 1 pass decoding. | ||
22 | * 7/14/94 J. Koller useless 'typedef' before huffcodetab removed | ||
23 | *----------------------------------------------------------------------- | ||
24 | * This program is free software; you can redistribute it and/or modify | ||
25 | * it under the terms of the GNU Library General Public License as published | ||
26 | * by the Free Software Foundation; either version 2 of the License, or | ||
27 | * (at your option) any later version. | ||
28 | * | ||
29 | * This program is distributed in the hope that it will be useful, | ||
30 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
31 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
32 | * GNU Library General Public License for more details. | ||
33 | * | ||
34 | * You should have received a copy of the GNU Library General Public | ||
35 | * License along with this program; if not, write to the Free Software | ||
36 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
37 | *---------------------------------------------------------------------- | ||
38 | */ | ||
39 | |||
40 | package javazoom.jl.decoder; | ||
41 | |||
42 | /** | ||
43 | * Class to implements Huffman decoder. | ||
44 | */ | ||
45 | final class huffcodetab | ||
46 | { | ||
47 | private static final int MXOFF=250; | ||
48 | private static final int HTN=34; | ||
49 | |||
50 | private char tablename0 = ' '; /* string, containing table_description */ | ||
51 | private char tablename1 = ' '; /* string, containing table_description */ | ||
52 | private char tablename2 = ' '; /* string, containing table_description */ | ||
53 | |||
54 | private int xlen; /* max. x-index+ */ | ||
55 | private int ylen; /* max. y-index+ */ | ||
56 | private int linbits; /* number of linbits */ | ||
57 | private int linmax; /* max number to be stored in linbits */ | ||
58 | private int ref; /* a positive value indicates a reference */ | ||
59 | private int[] table=null; /* pointer to array[xlen][ylen] */ | ||
60 | private int[] hlen=null; /* pointer to array[xlen][ylen] */ | ||
61 | private int[][] val=null; /* decoder tree */ | ||
62 | private int treelen; /* length of decoder tree */ | ||
63 | |||
64 | private static int ValTab0[][] = { | ||
65 | {0,0} // dummy | ||
66 | }; | ||
67 | |||
68 | private static int ValTab1[][] = { | ||
69 | {2,1},{0,0},{2,1},{0,16},{2,1},{0,1},{0,17}, | ||
70 | }; | ||
71 | |||
72 | private static int ValTab2[][] = { | ||
73 | {2,1},{0,0},{4,1},{2,1},{0,16},{0,1},{2,1},{0,17},{4,1},{2,1}, | ||
74 | {0,32},{0,33},{2,1},{0,18},{2,1},{0,2},{0,34}, | ||
75 | }; | ||
76 | |||
77 | private static int ValTab3[][] = { | ||
78 | {4,1},{2,1},{0,0},{0,1},{2,1},{0,17},{2,1},{0,16},{4,1},{2,1}, | ||
79 | {0,32},{0,33},{2,1},{0,18},{2,1},{0,2},{0,34}, | ||
80 | }; | ||
81 | |||
82 | private static int ValTab4[][] = {{0,0}}; // dummy | ||
83 | |||
84 | private static int ValTab5[][] = { | ||
85 | {2,1},{0,0},{4,1},{2,1},{0,16},{0,1},{2,1},{0,17},{8,1},{4,1}, | ||
86 | {2,1},{0,32},{0,2},{2,1},{0,33},{0,18},{8,1},{4,1},{2,1},{0,34}, | ||
87 | {0,48},{2,1},{0,3},{0,19},{2,1},{0,49},{2,1},{0,50},{2,1},{0,35}, | ||
88 | {0,51}, | ||
89 | }; | ||
90 | |||
91 | private static int ValTab6[][] = { | ||
92 | {6,1},{4,1},{2,1},{0,0},{0,16},{0,17},{6,1},{2,1},{0,1},{2,1}, | ||
93 | {0,32},{0,33},{6,1},{2,1},{0,18},{2,1},{0,2},{0,34},{4,1},{2,1}, | ||
94 | {0,49},{0,19},{4,1},{2,1},{0,48},{0,50},{2,1},{0,35},{2,1},{0,3}, | ||
95 | {0,51}, | ||
96 | }; | ||
97 | |||
98 | private static int ValTab7[][] = { | ||
99 | {2,1},{0,0},{4,1},{2,1},{0,16},{0,1},{8,1},{2,1},{0,17},{4,1}, | ||
100 | {2,1},{0,32},{0,2},{0,33},{18,1},{6,1},{2,1},{0,18},{2,1},{0,34}, | ||
101 | {0,48},{4,1},{2,1},{0,49},{0,19},{4,1},{2,1},{0,3},{0,50},{2,1}, | ||
102 | {0,35},{0,4},{10,1},{4,1},{2,1},{0,64},{0,65},{2,1},{0,20},{2,1}, | ||
103 | {0,66},{0,36},{12,1},{6,1},{4,1},{2,1},{0,51},{0,67},{0,80},{4,1}, | ||
104 | {2,1},{0,52},{0,5},{0,81},{6,1},{2,1},{0,21},{2,1},{0,82},{0,37}, | ||
105 | {4,1},{2,1},{0,68},{0,53},{4,1},{2,1},{0,83},{0,84},{2,1},{0,69}, | ||
106 | {0,85}, | ||
107 | }; | ||
108 | |||
109 | private static int ValTab8[][] = { | ||
110 | {6,1},{2,1},{0,0},{2,1},{0,16},{0,1},{2,1},{0,17},{4,1},{2,1}, | ||
111 | {0,33},{0,18},{14,1},{4,1},{2,1},{0,32},{0,2},{2,1},{0,34},{4,1}, | ||
112 | {2,1},{0,48},{0,3},{2,1},{0,49},{0,19},{14,1},{8,1},{4,1},{2,1}, | ||
113 | {0,50},{0,35},{2,1},{0,64},{0,4},{2,1},{0,65},{2,1},{0,20},{0,66}, | ||
114 | {12,1},{6,1},{2,1},{0,36},{2,1},{0,51},{0,80},{4,1},{2,1},{0,67}, | ||
115 | {0,52},{0,81},{6,1},{2,1},{0,21},{2,1},{0,5},{0,82},{6,1},{2,1}, | ||
116 | {0,37},{2,1},{0,68},{0,53},{2,1},{0,83},{2,1},{0,69},{2,1},{0,84}, | ||
117 | {0,85}, | ||
118 | }; | ||
119 | |||
120 | private static int ValTab9[][] = { | ||
121 | {8,1},{4,1},{2,1},{0,0},{0,16},{2,1},{0,1},{0,17},{10,1},{4,1}, | ||
122 | {2,1},{0,32},{0,33},{2,1},{0,18},{2,1},{0,2},{0,34},{12,1},{6,1}, | ||
123 | {4,1},{2,1},{0,48},{0,3},{0,49},{2,1},{0,19},{2,1},{0,50},{0,35}, | ||
124 | {12,1},{4,1},{2,1},{0,65},{0,20},{4,1},{2,1},{0,64},{0,51},{2,1}, | ||
125 | {0,66},{0,36},{10,1},{6,1},{4,1},{2,1},{0,4},{0,80},{0,67},{2,1}, | ||
126 | {0,52},{0,81},{8,1},{4,1},{2,1},{0,21},{0,82},{2,1},{0,37},{0,68}, | ||
127 | {6,1},{4,1},{2,1},{0,5},{0,84},{0,83},{2,1},{0,53},{2,1},{0,69}, | ||
128 | {0,85}, | ||
129 | }; | ||
130 | |||
131 | private static int ValTab10[][] = { | ||
132 | {2,1},{0,0},{4,1},{2,1},{0,16},{0,1},{10,1},{2,1},{0,17},{4,1}, | ||
133 | {2,1},{0,32},{0,2},{2,1},{0,33},{0,18},{28,1},{8,1},{4,1},{2,1}, | ||
134 | {0,34},{0,48},{2,1},{0,49},{0,19},{8,1},{4,1},{2,1},{0,3},{0,50}, | ||
135 | {2,1},{0,35},{0,64},{4,1},{2,1},{0,65},{0,20},{4,1},{2,1},{0,4}, | ||
136 | {0,51},{2,1},{0,66},{0,36},{28,1},{10,1},{6,1},{4,1},{2,1},{0,80}, | ||
137 | {0,5},{0,96},{2,1},{0,97},{0,22},{12,1},{6,1},{4,1},{2,1},{0,67}, | ||
138 | {0,52},{0,81},{2,1},{0,21},{2,1},{0,82},{0,37},{4,1},{2,1},{0,38}, | ||
139 | {0,54},{0,113},{20,1},{8,1},{2,1},{0,23},{4,1},{2,1},{0,68},{0,83}, | ||
140 | {0,6},{6,1},{4,1},{2,1},{0,53},{0,69},{0,98},{2,1},{0,112},{2,1}, | ||
141 | {0,7},{0,100},{14,1},{4,1},{2,1},{0,114},{0,39},{6,1},{2,1},{0,99}, | ||
142 | {2,1},{0,84},{0,85},{2,1},{0,70},{0,115},{8,1},{4,1},{2,1},{0,55}, | ||
143 | {0,101},{2,1},{0,86},{0,116},{6,1},{2,1},{0,71},{2,1},{0,102},{0,117}, | ||
144 | {4,1},{2,1},{0,87},{0,118},{2,1},{0,103},{0,119}, | ||
145 | }; | ||
146 | |||
147 | private static int ValTab11[][] = { | ||
148 | {6,1},{2,1},{0,0},{2,1},{0,16},{0,1},{8,1},{2,1},{0,17},{4,1}, | ||
149 | {2,1},{0,32},{0,2},{0,18},{24,1},{8,1},{2,1},{0,33},{2,1},{0,34}, | ||
150 | {2,1},{0,48},{0,3},{4,1},{2,1},{0,49},{0,19},{4,1},{2,1},{0,50}, | ||
151 | {0,35},{4,1},{2,1},{0,64},{0,4},{2,1},{0,65},{0,20},{30,1},{16,1}, | ||
152 | {10,1},{4,1},{2,1},{0,66},{0,36},{4,1},{2,1},{0,51},{0,67},{0,80}, | ||
153 | {4,1},{2,1},{0,52},{0,81},{0,97},{6,1},{2,1},{0,22},{2,1},{0,6}, | ||
154 | {0,38},{2,1},{0,98},{2,1},{0,21},{2,1},{0,5},{0,82},{16,1},{10,1}, | ||
155 | {6,1},{4,1},{2,1},{0,37},{0,68},{0,96},{2,1},{0,99},{0,54},{4,1}, | ||
156 | {2,1},{0,112},{0,23},{0,113},{16,1},{6,1},{4,1},{2,1},{0,7},{0,100}, | ||
157 | {0,114},{2,1},{0,39},{4,1},{2,1},{0,83},{0,53},{2,1},{0,84},{0,69}, | ||
158 | {10,1},{4,1},{2,1},{0,70},{0,115},{2,1},{0,55},{2,1},{0,101},{0,86}, | ||
159 | {10,1},{6,1},{4,1},{2,1},{0,85},{0,87},{0,116},{2,1},{0,71},{0,102}, | ||
160 | {4,1},{2,1},{0,117},{0,118},{2,1},{0,103},{0,119}, | ||
161 | }; | ||
162 | |||
163 | private static int ValTab12[][] = { | ||
164 | {12,1},{4,1},{2,1},{0,16},{0,1},{2,1},{0,17},{2,1},{0,0},{2,1}, | ||
165 | {0,32},{0,2},{16,1},{4,1},{2,1},{0,33},{0,18},{4,1},{2,1},{0,34}, | ||
166 | {0,49},{2,1},{0,19},{2,1},{0,48},{2,1},{0,3},{0,64},{26,1},{8,1}, | ||
167 | {4,1},{2,1},{0,50},{0,35},{2,1},{0,65},{0,51},{10,1},{4,1},{2,1}, | ||
168 | {0,20},{0,66},{2,1},{0,36},{2,1},{0,4},{0,80},{4,1},{2,1},{0,67}, | ||
169 | {0,52},{2,1},{0,81},{0,21},{28,1},{14,1},{8,1},{4,1},{2,1},{0,82}, | ||
170 | {0,37},{2,1},{0,83},{0,53},{4,1},{2,1},{0,96},{0,22},{0,97},{4,1}, | ||
171 | {2,1},{0,98},{0,38},{6,1},{4,1},{2,1},{0,5},{0,6},{0,68},{2,1}, | ||
172 | {0,84},{0,69},{18,1},{10,1},{4,1},{2,1},{0,99},{0,54},{4,1},{2,1}, | ||
173 | {0,112},{0,7},{0,113},{4,1},{2,1},{0,23},{0,100},{2,1},{0,70},{0,114}, | ||
174 | {10,1},{6,1},{2,1},{0,39},{2,1},{0,85},{0,115},{2,1},{0,55},{0,86}, | ||
175 | {8,1},{4,1},{2,1},{0,101},{0,116},{2,1},{0,71},{0,102},{4,1},{2,1}, | ||
176 | {0,117},{0,87},{2,1},{0,118},{2,1},{0,103},{0,119}, | ||
177 | }; | ||
178 | |||
179 | private static int ValTab13[][] = { | ||
180 | {2,1},{0,0},{6,1},{2,1},{0,16},{2,1},{0,1},{0,17},{28,1},{8,1}, | ||
181 | {4,1},{2,1},{0,32},{0,2},{2,1},{0,33},{0,18},{8,1},{4,1},{2,1}, | ||
182 | {0,34},{0,48},{2,1},{0,3},{0,49},{6,1},{2,1},{0,19},{2,1},{0,50}, | ||
183 | {0,35},{4,1},{2,1},{0,64},{0,4},{0,65},{70,1},{28,1},{14,1},{6,1}, | ||
184 | {2,1},{0,20},{2,1},{0,51},{0,66},{4,1},{2,1},{0,36},{0,80},{2,1}, | ||
185 | {0,67},{0,52},{4,1},{2,1},{0,81},{0,21},{4,1},{2,1},{0,5},{0,82}, | ||
186 | {2,1},{0,37},{2,1},{0,68},{0,83},{14,1},{8,1},{4,1},{2,1},{0,96}, | ||
187 | {0,6},{2,1},{0,97},{0,22},{4,1},{2,1},{0,128},{0,8},{0,129},{16,1}, | ||
188 | {8,1},{4,1},{2,1},{0,53},{0,98},{2,1},{0,38},{0,84},{4,1},{2,1}, | ||
189 | {0,69},{0,99},{2,1},{0,54},{0,112},{6,1},{4,1},{2,1},{0,7},{0,85}, | ||
190 | {0,113},{2,1},{0,23},{2,1},{0,39},{0,55},{72,1},{24,1},{12,1},{4,1}, | ||
191 | {2,1},{0,24},{0,130},{2,1},{0,40},{4,1},{2,1},{0,100},{0,70},{0,114}, | ||
192 | {8,1},{4,1},{2,1},{0,132},{0,72},{2,1},{0,144},{0,9},{2,1},{0,145}, | ||
193 | {0,25},{24,1},{14,1},{8,1},{4,1},{2,1},{0,115},{0,101},{2,1},{0,86}, | ||
194 | {0,116},{4,1},{2,1},{0,71},{0,102},{0,131},{6,1},{2,1},{0,56},{2,1}, | ||
195 | {0,117},{0,87},{2,1},{0,146},{0,41},{14,1},{8,1},{4,1},{2,1},{0,103}, | ||
196 | {0,133},{2,1},{0,88},{0,57},{2,1},{0,147},{2,1},{0,73},{0,134},{6,1}, | ||
197 | {2,1},{0,160},{2,1},{0,104},{0,10},{2,1},{0,161},{0,26},{68,1},{24,1}, | ||
198 | {12,1},{4,1},{2,1},{0,162},{0,42},{4,1},{2,1},{0,149},{0,89},{2,1}, | ||
199 | {0,163},{0,58},{8,1},{4,1},{2,1},{0,74},{0,150},{2,1},{0,176},{0,11}, | ||
200 | {2,1},{0,177},{0,27},{20,1},{8,1},{2,1},{0,178},{4,1},{2,1},{0,118}, | ||
201 | {0,119},{0,148},{6,1},{4,1},{2,1},{0,135},{0,120},{0,164},{4,1},{2,1}, | ||
202 | {0,105},{0,165},{0,43},{12,1},{6,1},{4,1},{2,1},{0,90},{0,136},{0,179}, | ||
203 | {2,1},{0,59},{2,1},{0,121},{0,166},{6,1},{4,1},{2,1},{0,106},{0,180}, | ||
204 | {0,192},{4,1},{2,1},{0,12},{0,152},{0,193},{60,1},{22,1},{10,1},{6,1}, | ||
205 | {2,1},{0,28},{2,1},{0,137},{0,181},{2,1},{0,91},{0,194},{4,1},{2,1}, | ||
206 | {0,44},{0,60},{4,1},{2,1},{0,182},{0,107},{2,1},{0,196},{0,76},{16,1}, | ||
207 | {8,1},{4,1},{2,1},{0,168},{0,138},{2,1},{0,208},{0,13},{2,1},{0,209}, | ||
208 | {2,1},{0,75},{2,1},{0,151},{0,167},{12,1},{6,1},{2,1},{0,195},{2,1}, | ||
209 | {0,122},{0,153},{4,1},{2,1},{0,197},{0,92},{0,183},{4,1},{2,1},{0,29}, | ||
210 | {0,210},{2,1},{0,45},{2,1},{0,123},{0,211},{52,1},{28,1},{12,1},{4,1}, | ||
211 | {2,1},{0,61},{0,198},{4,1},{2,1},{0,108},{0,169},{2,1},{0,154},{0,212}, | ||
212 | {8,1},{4,1},{2,1},{0,184},{0,139},{2,1},{0,77},{0,199},{4,1},{2,1}, | ||
213 | {0,124},{0,213},{2,1},{0,93},{0,224},{10,1},{4,1},{2,1},{0,225},{0,30}, | ||
214 | {4,1},{2,1},{0,14},{0,46},{0,226},{8,1},{4,1},{2,1},{0,227},{0,109}, | ||
215 | {2,1},{0,140},{0,228},{4,1},{2,1},{0,229},{0,186},{0,240},{38,1},{16,1}, | ||
216 | {4,1},{2,1},{0,241},{0,31},{6,1},{4,1},{2,1},{0,170},{0,155},{0,185}, | ||
217 | {2,1},{0,62},{2,1},{0,214},{0,200},{12,1},{6,1},{2,1},{0,78},{2,1}, | ||
218 | {0,215},{0,125},{2,1},{0,171},{2,1},{0,94},{0,201},{6,1},{2,1},{0,15}, | ||
219 | {2,1},{0,156},{0,110},{2,1},{0,242},{0,47},{32,1},{16,1},{6,1},{4,1}, | ||
220 | {2,1},{0,216},{0,141},{0,63},{6,1},{2,1},{0,243},{2,1},{0,230},{0,202}, | ||
221 | {2,1},{0,244},{0,79},{8,1},{4,1},{2,1},{0,187},{0,172},{2,1},{0,231}, | ||
222 | {0,245},{4,1},{2,1},{0,217},{0,157},{2,1},{0,95},{0,232},{30,1},{12,1}, | ||
223 | {6,1},{2,1},{0,111},{2,1},{0,246},{0,203},{4,1},{2,1},{0,188},{0,173}, | ||
224 | {0,218},{8,1},{2,1},{0,247},{4,1},{2,1},{0,126},{0,127},{0,142},{6,1}, | ||
225 | {4,1},{2,1},{0,158},{0,174},{0,204},{2,1},{0,248},{0,143},{18,1},{8,1}, | ||
226 | {4,1},{2,1},{0,219},{0,189},{2,1},{0,234},{0,249},{4,1},{2,1},{0,159}, | ||
227 | {0,235},{2,1},{0,190},{2,1},{0,205},{0,250},{14,1},{4,1},{2,1},{0,221}, | ||
228 | {0,236},{6,1},{4,1},{2,1},{0,233},{0,175},{0,220},{2,1},{0,206},{0,251}, | ||
229 | {8,1},{4,1},{2,1},{0,191},{0,222},{2,1},{0,207},{0,238},{4,1},{2,1}, | ||
230 | {0,223},{0,239},{2,1},{0,255},{2,1},{0,237},{2,1},{0,253},{2,1},{0,252}, | ||
231 | {0,254}, | ||
232 | }; | ||
233 | |||
234 | private static int ValTab14[][] = { | ||
235 | {0,0} // dummy | ||
236 | }; | ||
237 | |||
238 | private static int ValTab15[][] = { | ||
239 | {16,1},{6,1},{2,1},{0,0},{2,1},{0,16},{0,1},{2,1},{0,17},{4,1}, | ||
240 | {2,1},{0,32},{0,2},{2,1},{0,33},{0,18},{50,1},{16,1},{6,1},{2,1}, | ||
241 | {0,34},{2,1},{0,48},{0,49},{6,1},{2,1},{0,19},{2,1},{0,3},{0,64}, | ||
242 | {2,1},{0,50},{0,35},{14,1},{6,1},{4,1},{2,1},{0,4},{0,20},{0,65}, | ||
243 | {4,1},{2,1},{0,51},{0,66},{2,1},{0,36},{0,67},{10,1},{6,1},{2,1}, | ||
244 | {0,52},{2,1},{0,80},{0,5},{2,1},{0,81},{0,21},{4,1},{2,1},{0,82}, | ||
245 | {0,37},{4,1},{2,1},{0,68},{0,83},{0,97},{90,1},{36,1},{18,1},{10,1}, | ||
246 | {6,1},{2,1},{0,53},{2,1},{0,96},{0,6},{2,1},{0,22},{0,98},{4,1}, | ||
247 | {2,1},{0,38},{0,84},{2,1},{0,69},{0,99},{10,1},{6,1},{2,1},{0,54}, | ||
248 | {2,1},{0,112},{0,7},{2,1},{0,113},{0,85},{4,1},{2,1},{0,23},{0,100}, | ||
249 | {2,1},{0,114},{0,39},{24,1},{16,1},{8,1},{4,1},{2,1},{0,70},{0,115}, | ||
250 | {2,1},{0,55},{0,101},{4,1},{2,1},{0,86},{0,128},{2,1},{0,8},{0,116}, | ||
251 | {4,1},{2,1},{0,129},{0,24},{2,1},{0,130},{0,40},{16,1},{8,1},{4,1}, | ||
252 | {2,1},{0,71},{0,102},{2,1},{0,131},{0,56},{4,1},{2,1},{0,117},{0,87}, | ||
253 | {2,1},{0,132},{0,72},{6,1},{4,1},{2,1},{0,144},{0,25},{0,145},{4,1}, | ||
254 | {2,1},{0,146},{0,118},{2,1},{0,103},{0,41},{92,1},{36,1},{18,1},{10,1}, | ||
255 | {4,1},{2,1},{0,133},{0,88},{4,1},{2,1},{0,9},{0,119},{0,147},{4,1}, | ||
256 | {2,1},{0,57},{0,148},{2,1},{0,73},{0,134},{10,1},{6,1},{2,1},{0,104}, | ||
257 | {2,1},{0,160},{0,10},{2,1},{0,161},{0,26},{4,1},{2,1},{0,162},{0,42}, | ||
258 | {2,1},{0,149},{0,89},{26,1},{14,1},{6,1},{2,1},{0,163},{2,1},{0,58}, | ||
259 | {0,135},{4,1},{2,1},{0,120},{0,164},{2,1},{0,74},{0,150},{6,1},{4,1}, | ||
260 | {2,1},{0,105},{0,176},{0,177},{4,1},{2,1},{0,27},{0,165},{0,178},{14,1}, | ||
261 | {8,1},{4,1},{2,1},{0,90},{0,43},{2,1},{0,136},{0,151},{2,1},{0,179}, | ||
262 | {2,1},{0,121},{0,59},{8,1},{4,1},{2,1},{0,106},{0,180},{2,1},{0,75}, | ||
263 | {0,193},{4,1},{2,1},{0,152},{0,137},{2,1},{0,28},{0,181},{80,1},{34,1}, | ||
264 | {16,1},{6,1},{4,1},{2,1},{0,91},{0,44},{0,194},{6,1},{4,1},{2,1}, | ||
265 | {0,11},{0,192},{0,166},{2,1},{0,167},{0,122},{10,1},{4,1},{2,1},{0,195}, | ||
266 | {0,60},{4,1},{2,1},{0,12},{0,153},{0,182},{4,1},{2,1},{0,107},{0,196}, | ||
267 | {2,1},{0,76},{0,168},{20,1},{10,1},{4,1},{2,1},{0,138},{0,197},{4,1}, | ||
268 | {2,1},{0,208},{0,92},{0,209},{4,1},{2,1},{0,183},{0,123},{2,1},{0,29}, | ||
269 | {2,1},{0,13},{0,45},{12,1},{4,1},{2,1},{0,210},{0,211},{4,1},{2,1}, | ||
270 | {0,61},{0,198},{2,1},{0,108},{0,169},{6,1},{4,1},{2,1},{0,154},{0,184}, | ||
271 | {0,212},{4,1},{2,1},{0,139},{0,77},{2,1},{0,199},{0,124},{68,1},{34,1}, | ||
272 | {18,1},{10,1},{4,1},{2,1},{0,213},{0,93},{4,1},{2,1},{0,224},{0,14}, | ||
273 | {0,225},{4,1},{2,1},{0,30},{0,226},{2,1},{0,170},{0,46},{8,1},{4,1}, | ||
274 | {2,1},{0,185},{0,155},{2,1},{0,227},{0,214},{4,1},{2,1},{0,109},{0,62}, | ||
275 | {2,1},{0,200},{0,140},{16,1},{8,1},{4,1},{2,1},{0,228},{0,78},{2,1}, | ||
276 | {0,215},{0,125},{4,1},{2,1},{0,229},{0,186},{2,1},{0,171},{0,94},{8,1}, | ||
277 | {4,1},{2,1},{0,201},{0,156},{2,1},{0,241},{0,31},{6,1},{4,1},{2,1}, | ||
278 | {0,240},{0,110},{0,242},{2,1},{0,47},{0,230},{38,1},{18,1},{8,1},{4,1}, | ||
279 | {2,1},{0,216},{0,243},{2,1},{0,63},{0,244},{6,1},{2,1},{0,79},{2,1}, | ||
280 | {0,141},{0,217},{2,1},{0,187},{0,202},{8,1},{4,1},{2,1},{0,172},{0,231}, | ||
281 | {2,1},{0,126},{0,245},{8,1},{4,1},{2,1},{0,157},{0,95},{2,1},{0,232}, | ||
282 | {0,142},{2,1},{0,246},{0,203},{34,1},{18,1},{10,1},{6,1},{4,1},{2,1}, | ||
283 | {0,15},{0,174},{0,111},{2,1},{0,188},{0,218},{4,1},{2,1},{0,173},{0,247}, | ||
284 | {2,1},{0,127},{0,233},{8,1},{4,1},{2,1},{0,158},{0,204},{2,1},{0,248}, | ||
285 | {0,143},{4,1},{2,1},{0,219},{0,189},{2,1},{0,234},{0,249},{16,1},{8,1}, | ||
286 | {4,1},{2,1},{0,159},{0,220},{2,1},{0,205},{0,235},{4,1},{2,1},{0,190}, | ||
287 | {0,250},{2,1},{0,175},{0,221},{14,1},{6,1},{4,1},{2,1},{0,236},{0,206}, | ||
288 | {0,251},{4,1},{2,1},{0,191},{0,237},{2,1},{0,222},{0,252},{6,1},{4,1}, | ||
289 | {2,1},{0,207},{0,253},{0,238},{4,1},{2,1},{0,223},{0,254},{2,1},{0,239}, | ||
290 | {0,255}, | ||
291 | }; | ||
292 | |||
293 | private static int ValTab16[][] = { | ||
294 | {2,1},{0,0},{6,1},{2,1},{0,16},{2,1},{0,1},{0,17},{42,1},{8,1}, | ||
295 | {4,1},{2,1},{0,32},{0,2},{2,1},{0,33},{0,18},{10,1},{6,1},{2,1}, | ||
296 | {0,34},{2,1},{0,48},{0,3},{2,1},{0,49},{0,19},{10,1},{4,1},{2,1}, | ||
297 | {0,50},{0,35},{4,1},{2,1},{0,64},{0,4},{0,65},{6,1},{2,1},{0,20}, | ||
298 | {2,1},{0,51},{0,66},{4,1},{2,1},{0,36},{0,80},{2,1},{0,67},{0,52}, | ||
299 | {138,1},{40,1},{16,1},{6,1},{4,1},{2,1},{0,5},{0,21},{0,81},{4,1}, | ||
300 | {2,1},{0,82},{0,37},{4,1},{2,1},{0,68},{0,53},{0,83},{10,1},{6,1}, | ||
301 | {4,1},{2,1},{0,96},{0,6},{0,97},{2,1},{0,22},{0,98},{8,1},{4,1}, | ||
302 | {2,1},{0,38},{0,84},{2,1},{0,69},{0,99},{4,1},{2,1},{0,54},{0,112}, | ||
303 | {0,113},{40,1},{18,1},{8,1},{2,1},{0,23},{2,1},{0,7},{2,1},{0,85}, | ||
304 | {0,100},{4,1},{2,1},{0,114},{0,39},{4,1},{2,1},{0,70},{0,101},{0,115}, | ||
305 | {10,1},{6,1},{2,1},{0,55},{2,1},{0,86},{0,8},{2,1},{0,128},{0,129}, | ||
306 | {6,1},{2,1},{0,24},{2,1},{0,116},{0,71},{2,1},{0,130},{2,1},{0,40}, | ||
307 | {0,102},{24,1},{14,1},{8,1},{4,1},{2,1},{0,131},{0,56},{2,1},{0,117}, | ||
308 | {0,132},{4,1},{2,1},{0,72},{0,144},{0,145},{6,1},{2,1},{0,25},{2,1}, | ||
309 | {0,9},{0,118},{2,1},{0,146},{0,41},{14,1},{8,1},{4,1},{2,1},{0,133}, | ||
310 | {0,88},{2,1},{0,147},{0,57},{4,1},{2,1},{0,160},{0,10},{0,26},{8,1}, | ||
311 | {2,1},{0,162},{2,1},{0,103},{2,1},{0,87},{0,73},{6,1},{2,1},{0,148}, | ||
312 | {2,1},{0,119},{0,134},{2,1},{0,161},{2,1},{0,104},{0,149},{220,1},{126,1}, | ||
313 | {50,1},{26,1},{12,1},{6,1},{2,1},{0,42},{2,1},{0,89},{0,58},{2,1}, | ||
314 | {0,163},{2,1},{0,135},{0,120},{8,1},{4,1},{2,1},{0,164},{0,74},{2,1}, | ||
315 | {0,150},{0,105},{4,1},{2,1},{0,176},{0,11},{0,177},{10,1},{4,1},{2,1}, | ||
316 | {0,27},{0,178},{2,1},{0,43},{2,1},{0,165},{0,90},{6,1},{2,1},{0,179}, | ||
317 | {2,1},{0,166},{0,106},{4,1},{2,1},{0,180},{0,75},{2,1},{0,12},{0,193}, | ||
318 | {30,1},{14,1},{6,1},{4,1},{2,1},{0,181},{0,194},{0,44},{4,1},{2,1}, | ||
319 | {0,167},{0,195},{2,1},{0,107},{0,196},{8,1},{2,1},{0,29},{4,1},{2,1}, | ||
320 | {0,136},{0,151},{0,59},{4,1},{2,1},{0,209},{0,210},{2,1},{0,45},{0,211}, | ||
321 | {18,1},{6,1},{4,1},{2,1},{0,30},{0,46},{0,226},{6,1},{4,1},{2,1}, | ||
322 | {0,121},{0,152},{0,192},{2,1},{0,28},{2,1},{0,137},{0,91},{14,1},{6,1}, | ||
323 | {2,1},{0,60},{2,1},{0,122},{0,182},{4,1},{2,1},{0,76},{0,153},{2,1}, | ||
324 | {0,168},{0,138},{6,1},{2,1},{0,13},{2,1},{0,197},{0,92},{4,1},{2,1}, | ||
325 | {0,61},{0,198},{2,1},{0,108},{0,154},{88,1},{86,1},{36,1},{16,1},{8,1}, | ||
326 | {4,1},{2,1},{0,139},{0,77},{2,1},{0,199},{0,124},{4,1},{2,1},{0,213}, | ||
327 | {0,93},{2,1},{0,224},{0,14},{8,1},{2,1},{0,227},{4,1},{2,1},{0,208}, | ||
328 | {0,183},{0,123},{6,1},{4,1},{2,1},{0,169},{0,184},{0,212},{2,1},{0,225}, | ||
329 | {2,1},{0,170},{0,185},{24,1},{10,1},{6,1},{4,1},{2,1},{0,155},{0,214}, | ||
330 | {0,109},{2,1},{0,62},{0,200},{6,1},{4,1},{2,1},{0,140},{0,228},{0,78}, | ||
331 | {4,1},{2,1},{0,215},{0,229},{2,1},{0,186},{0,171},{12,1},{4,1},{2,1}, | ||
332 | {0,156},{0,230},{4,1},{2,1},{0,110},{0,216},{2,1},{0,141},{0,187},{8,1}, | ||
333 | {4,1},{2,1},{0,231},{0,157},{2,1},{0,232},{0,142},{4,1},{2,1},{0,203}, | ||
334 | {0,188},{0,158},{0,241},{2,1},{0,31},{2,1},{0,15},{0,47},{66,1},{56,1}, | ||
335 | {2,1},{0,242},{52,1},{50,1},{20,1},{8,1},{2,1},{0,189},{2,1},{0,94}, | ||
336 | {2,1},{0,125},{0,201},{6,1},{2,1},{0,202},{2,1},{0,172},{0,126},{4,1}, | ||
337 | {2,1},{0,218},{0,173},{0,204},{10,1},{6,1},{2,1},{0,174},{2,1},{0,219}, | ||
338 | {0,220},{2,1},{0,205},{0,190},{6,1},{4,1},{2,1},{0,235},{0,237},{0,238}, | ||
339 | {6,1},{4,1},{2,1},{0,217},{0,234},{0,233},{2,1},{0,222},{4,1},{2,1}, | ||
340 | {0,221},{0,236},{0,206},{0,63},{0,240},{4,1},{2,1},{0,243},{0,244},{2,1}, | ||
341 | {0,79},{2,1},{0,245},{0,95},{10,1},{2,1},{0,255},{4,1},{2,1},{0,246}, | ||
342 | {0,111},{2,1},{0,247},{0,127},{12,1},{6,1},{2,1},{0,143},{2,1},{0,248}, | ||
343 | {0,249},{4,1},{2,1},{0,159},{0,250},{0,175},{8,1},{4,1},{2,1},{0,251}, | ||
344 | {0,191},{2,1},{0,252},{0,207},{4,1},{2,1},{0,253},{0,223},{2,1},{0,254}, | ||
345 | {0,239}, | ||
346 | }; | ||
347 | |||
348 | private static int ValTab24[][] = { | ||
349 | {60,1},{8,1},{4,1},{2,1},{0,0},{0,16},{2,1},{0,1},{0,17},{14,1}, | ||
350 | {6,1},{4,1},{2,1},{0,32},{0,2},{0,33},{2,1},{0,18},{2,1},{0,34}, | ||
351 | {2,1},{0,48},{0,3},{14,1},{4,1},{2,1},{0,49},{0,19},{4,1},{2,1}, | ||
352 | {0,50},{0,35},{4,1},{2,1},{0,64},{0,4},{0,65},{8,1},{4,1},{2,1}, | ||
353 | {0,20},{0,51},{2,1},{0,66},{0,36},{6,1},{4,1},{2,1},{0,67},{0,52}, | ||
354 | {0,81},{6,1},{4,1},{2,1},{0,80},{0,5},{0,21},{2,1},{0,82},{0,37}, | ||
355 | {250,1},{98,1},{34,1},{18,1},{10,1},{4,1},{2,1},{0,68},{0,83},{2,1}, | ||
356 | {0,53},{2,1},{0,96},{0,6},{4,1},{2,1},{0,97},{0,22},{2,1},{0,98}, | ||
357 | {0,38},{8,1},{4,1},{2,1},{0,84},{0,69},{2,1},{0,99},{0,54},{4,1}, | ||
358 | {2,1},{0,113},{0,85},{2,1},{0,100},{0,70},{32,1},{14,1},{6,1},{2,1}, | ||
359 | {0,114},{2,1},{0,39},{0,55},{2,1},{0,115},{4,1},{2,1},{0,112},{0,7}, | ||
360 | {0,23},{10,1},{4,1},{2,1},{0,101},{0,86},{4,1},{2,1},{0,128},{0,8}, | ||
361 | {0,129},{4,1},{2,1},{0,116},{0,71},{2,1},{0,24},{0,130},{16,1},{8,1}, | ||
362 | {4,1},{2,1},{0,40},{0,102},{2,1},{0,131},{0,56},{4,1},{2,1},{0,117}, | ||
363 | {0,87},{2,1},{0,132},{0,72},{8,1},{4,1},{2,1},{0,145},{0,25},{2,1}, | ||
364 | {0,146},{0,118},{4,1},{2,1},{0,103},{0,41},{2,1},{0,133},{0,88},{92,1}, | ||
365 | {34,1},{16,1},{8,1},{4,1},{2,1},{0,147},{0,57},{2,1},{0,148},{0,73}, | ||
366 | {4,1},{2,1},{0,119},{0,134},{2,1},{0,104},{0,161},{8,1},{4,1},{2,1}, | ||
367 | {0,162},{0,42},{2,1},{0,149},{0,89},{4,1},{2,1},{0,163},{0,58},{2,1}, | ||
368 | {0,135},{2,1},{0,120},{0,74},{22,1},{12,1},{4,1},{2,1},{0,164},{0,150}, | ||
369 | {4,1},{2,1},{0,105},{0,177},{2,1},{0,27},{0,165},{6,1},{2,1},{0,178}, | ||
370 | {2,1},{0,90},{0,43},{2,1},{0,136},{0,179},{16,1},{10,1},{6,1},{2,1}, | ||
371 | {0,144},{2,1},{0,9},{0,160},{2,1},{0,151},{0,121},{4,1},{2,1},{0,166}, | ||
372 | {0,106},{0,180},{12,1},{6,1},{2,1},{0,26},{2,1},{0,10},{0,176},{2,1}, | ||
373 | {0,59},{2,1},{0,11},{0,192},{4,1},{2,1},{0,75},{0,193},{2,1},{0,152}, | ||
374 | {0,137},{67,1},{34,1},{16,1},{8,1},{4,1},{2,1},{0,28},{0,181},{2,1}, | ||
375 | {0,91},{0,194},{4,1},{2,1},{0,44},{0,167},{2,1},{0,122},{0,195},{10,1}, | ||
376 | {6,1},{2,1},{0,60},{2,1},{0,12},{0,208},{2,1},{0,182},{0,107},{4,1}, | ||
377 | {2,1},{0,196},{0,76},{2,1},{0,153},{0,168},{16,1},{8,1},{4,1},{2,1}, | ||
378 | {0,138},{0,197},{2,1},{0,92},{0,209},{4,1},{2,1},{0,183},{0,123},{2,1}, | ||
379 | {0,29},{0,210},{9,1},{4,1},{2,1},{0,45},{0,211},{2,1},{0,61},{0,198}, | ||
380 | {85,250},{4,1},{2,1},{0,108},{0,169},{2,1},{0,154},{0,212},{32,1},{16,1}, | ||
381 | {8,1},{4,1},{2,1},{0,184},{0,139},{2,1},{0,77},{0,199},{4,1},{2,1}, | ||
382 | {0,124},{0,213},{2,1},{0,93},{0,225},{8,1},{4,1},{2,1},{0,30},{0,226}, | ||
383 | {2,1},{0,170},{0,185},{4,1},{2,1},{0,155},{0,227},{2,1},{0,214},{0,109}, | ||
384 | {20,1},{10,1},{6,1},{2,1},{0,62},{2,1},{0,46},{0,78},{2,1},{0,200}, | ||
385 | {0,140},{4,1},{2,1},{0,228},{0,215},{4,1},{2,1},{0,125},{0,171},{0,229}, | ||
386 | {10,1},{4,1},{2,1},{0,186},{0,94},{2,1},{0,201},{2,1},{0,156},{0,110}, | ||
387 | {8,1},{2,1},{0,230},{2,1},{0,13},{2,1},{0,224},{0,14},{4,1},{2,1}, | ||
388 | {0,216},{0,141},{2,1},{0,187},{0,202},{74,1},{2,1},{0,255},{64,1},{58,1}, | ||
389 | {32,1},{16,1},{8,1},{4,1},{2,1},{0,172},{0,231},{2,1},{0,126},{0,217}, | ||
390 | {4,1},{2,1},{0,157},{0,232},{2,1},{0,142},{0,203},{8,1},{4,1},{2,1}, | ||
391 | {0,188},{0,218},{2,1},{0,173},{0,233},{4,1},{2,1},{0,158},{0,204},{2,1}, | ||
392 | {0,219},{0,189},{16,1},{8,1},{4,1},{2,1},{0,234},{0,174},{2,1},{0,220}, | ||
393 | {0,205},{4,1},{2,1},{0,235},{0,190},{2,1},{0,221},{0,236},{8,1},{4,1}, | ||
394 | {2,1},{0,206},{0,237},{2,1},{0,222},{0,238},{0,15},{4,1},{2,1},{0,240}, | ||
395 | {0,31},{0,241},{4,1},{2,1},{0,242},{0,47},{2,1},{0,243},{0,63},{18,1}, | ||
396 | {8,1},{4,1},{2,1},{0,244},{0,79},{2,1},{0,245},{0,95},{4,1},{2,1}, | ||
397 | {0,246},{0,111},{2,1},{0,247},{2,1},{0,127},{0,143},{10,1},{4,1},{2,1}, | ||
398 | {0,248},{0,249},{4,1},{2,1},{0,159},{0,175},{0,250},{8,1},{4,1},{2,1}, | ||
399 | {0,251},{0,191},{2,1},{0,252},{0,207},{4,1},{2,1},{0,253},{0,223},{2,1}, | ||
400 | {0,254},{0,239}, | ||
401 | }; | ||
402 | |||
403 | private static int ValTab32[][] = { | ||
404 | {2,1},{0,0},{8,1},{4,1},{2,1},{0,8},{0,4},{2,1},{0,1},{0,2}, | ||
405 | {8,1},{4,1},{2,1},{0,12},{0,10},{2,1},{0,3},{0,6},{6,1},{2,1}, | ||
406 | {0,9},{2,1},{0,5},{0,7},{4,1},{2,1},{0,14},{0,13},{2,1},{0,15}, | ||
407 | {0,11}, | ||
408 | }; | ||
409 | |||
410 | private static int ValTab33[][] = { | ||
411 | {16,1},{8,1},{4,1},{2,1},{0,0},{0,1},{2,1},{0,2},{0,3},{4,1}, | ||
412 | {2,1},{0,4},{0,5},{2,1},{0,6},{0,7},{8,1},{4,1},{2,1},{0,8}, | ||
413 | {0,9},{2,1},{0,10},{0,11},{4,1},{2,1},{0,12},{0,13},{2,1},{0,14}, | ||
414 | {0,15}, | ||
415 | }; | ||
416 | |||
417 | |||
418 | public static huffcodetab[] ht = null; /* Simulate extern struct */ | ||
419 | |||
420 | private static int[] bitbuf = new int[32]; | ||
421 | |||
422 | /** | ||
423 | * Big Constructor : Computes all Huffman Tables. | ||
424 | */ | ||
425 | private huffcodetab(String S,int XLEN, int YLEN, int LINBITS, int LINMAX, int REF, | ||
426 | int[] TABLE, int[] HLEN, int[][] VAL, int TREELEN) | ||
427 | { | ||
428 | tablename0 = S.charAt(0); | ||
429 | tablename1 = S.charAt(1); | ||
430 | tablename2 = S.charAt(2); | ||
431 | xlen = XLEN; | ||
432 | ylen = YLEN; | ||
433 | linbits = LINBITS; | ||
434 | linmax = LINMAX; | ||
435 | ref = REF; | ||
436 | table = TABLE; | ||
437 | hlen = HLEN; | ||
438 | val = VAL; | ||
439 | treelen = TREELEN; | ||
440 | } | ||
441 | |||
442 | |||
443 | |||
444 | /** | ||
445 | * Do the huffman-decoding. | ||
446 | * note! for counta,countb -the 4 bit value is returned in y, | ||
447 | * discard x. | ||
448 | */ | ||
449 | public static int huffman_decoder(huffcodetab h, int[] x, int[] y, int[] v, int[] w, BitReserve br) | ||
450 | { | ||
451 | // array of all huffcodtable headers | ||
452 | // 0..31 Huffman code table 0..31 | ||
453 | // 32,33 count1-tables | ||
454 | |||
455 | int dmask = 1 << ((4 * 8) - 1); | ||
456 | int hs = 4 * 8; | ||
457 | int level; | ||
458 | int point = 0; | ||
459 | int error = 1; | ||
460 | level = dmask; | ||
461 | |||
462 | if (h.val == null) return 2; | ||
463 | |||
464 | /* table 0 needs no bits */ | ||
465 | if ( h.treelen == 0) | ||
466 | { | ||
467 | x[0] = y[0] = 0; | ||
468 | return 0; | ||
469 | } | ||
470 | |||
471 | /* Lookup in Huffman table. */ | ||
472 | |||
473 | /*int bitsAvailable = 0; | ||
474 | int bitIndex = 0; | ||
475 | |||
476 | int bits[] = bitbuf;*/ | ||
477 | do | ||
478 | { | ||
479 | if (h.val[point][0]==0) | ||
480 | { /*end of tree*/ | ||
481 | x[0] = h.val[point][1] >>> 4; | ||
482 | y[0] = h.val[point][1] & 0xf; | ||
483 | error = 0; | ||
484 | break; | ||
485 | } | ||
486 | |||
487 | // hget1bit() is called thousands of times, and so needs to be | ||
488 | // ultra fast. | ||
489 | /* | ||
490 | if (bitIndex==bitsAvailable) | ||
491 | { | ||
492 | bitsAvailable = br.readBits(bits, 32); | ||
493 | bitIndex = 0; | ||
494 | } | ||
495 | */ | ||
496 | //if (bits[bitIndex++]!=0) | ||
497 | if (br.hget1bit()!=0) | ||
498 | { | ||
499 | while (h.val[point][1] >= MXOFF) point += h.val[point][1]; | ||
500 | point += h.val[point][1]; | ||
501 | } | ||
502 | else | ||
503 | { | ||
504 | while (h.val[point][0] >= MXOFF) point += h.val[point][0]; | ||
505 | point += h.val[point][0]; | ||
506 | } | ||
507 | level >>>= 1; | ||
508 | // MDM: ht[0] is always 0; | ||
509 | } while ((level !=0 ) || (point < 0 /*ht[0].treelen*/) ); | ||
510 | |||
511 | // put back any bits not consumed | ||
512 | /* | ||
513 | int unread = (bitsAvailable-bitIndex); | ||
514 | if (unread>0) | ||
515 | br.rewindNbits(unread); | ||
516 | */ | ||
517 | /* Process sign encodings for quadruples tables. */ | ||
518 | // System.out.println(h.tablename); | ||
519 | if (h.tablename0 == '3' && (h.tablename1 == '2' || h.tablename1 == '3')) | ||
520 | { | ||
521 | v[0] = (y[0]>>3) & 1; | ||
522 | w[0] = (y[0]>>2) & 1; | ||
523 | x[0] = (y[0]>>1) & 1; | ||
524 | y[0] = y[0] & 1; | ||
525 | |||
526 | /* v, w, x and y are reversed in the bitstream. | ||
527 | switch them around to make test bistream work. */ | ||
528 | |||
529 | if (v[0]!=0) | ||
530 | if (br.hget1bit() != 0) v[0] = -v[0]; | ||
531 | if (w[0]!=0) | ||
532 | if (br.hget1bit() != 0) w[0] = -w[0]; | ||
533 | if (x[0]!=0) | ||
534 | if (br.hget1bit() != 0) x[0] = -x[0]; | ||
535 | if (y[0]!=0) | ||
536 | if (br.hget1bit() != 0) y[0] = -y[0]; | ||
537 | } | ||
538 | else | ||
539 | { | ||
540 | // Process sign and escape encodings for dual tables. | ||
541 | // x and y are reversed in the test bitstream. | ||
542 | // Reverse x and y here to make test bitstream work. | ||
543 | |||
544 | if (h.linbits != 0) | ||
545 | if ((h.xlen-1) == x[0]) | ||
546 | x[0] += br.hgetbits(h.linbits); | ||
547 | if (x[0] != 0) | ||
548 | if (br.hget1bit() != 0) x[0] = -x[0]; | ||
549 | if (h.linbits != 0) | ||
550 | if ((h.ylen-1) == y[0]) | ||
551 | y[0] += br.hgetbits(h.linbits); | ||
552 | if (y[0] != 0) | ||
553 | if (br.hget1bit() != 0) y[0] = -y[0]; | ||
554 | } | ||
555 | return error; | ||
556 | } | ||
557 | |||
558 | public static void inithuff() | ||
559 | { | ||
560 | |||
561 | if (ht!=null) | ||
562 | return; | ||
563 | |||
564 | ht = new huffcodetab[HTN]; | ||
565 | ht[0] = new huffcodetab("0 ",0,0,0,0,-1,null,null,ValTab0,0); | ||
566 | ht[1] = new huffcodetab("1 ",2,2,0,0,-1,null,null,ValTab1,7); | ||
567 | ht[2] = new huffcodetab("2 ",3,3,0,0,-1,null,null,ValTab2,17); | ||
568 | ht[3] = new huffcodetab("3 ",3,3,0,0,-1,null,null,ValTab3,17); | ||
569 | ht[4] = new huffcodetab("4 ",0,0,0,0,-1,null,null,ValTab4,0); | ||
570 | ht[5] = new huffcodetab("5 ",4,4,0,0,-1,null,null,ValTab5,31); | ||
571 | ht[6] = new huffcodetab("6 ",4,4,0,0,-1,null,null,ValTab6,31); | ||
572 | ht[7] = new huffcodetab("7 ",6,6,0,0,-1,null,null,ValTab7,71); | ||
573 | ht[8] = new huffcodetab("8 ",6,6,0,0,-1,null,null,ValTab8,71); | ||
574 | ht[9] = new huffcodetab("9 ",6,6,0,0,-1,null,null,ValTab9,71); | ||
575 | ht[10] = new huffcodetab("10 ",8,8,0,0,-1,null,null,ValTab10,127); | ||
576 | ht[11] = new huffcodetab("11 ",8,8,0,0,-1,null,null,ValTab11,127); | ||
577 | ht[12] = new huffcodetab("12 ",8,8,0,0,-1,null,null,ValTab12,127); | ||
578 | ht[13] = new huffcodetab("13 ",16,16,0,0,-1,null,null,ValTab13,511); | ||
579 | ht[14] = new huffcodetab("14 ",0,0,0,0,-1,null,null,ValTab14,0); | ||
580 | ht[15] = new huffcodetab("15 ",16,16,0,0,-1,null,null,ValTab15,511); | ||
581 | ht[16] = new huffcodetab("16 ",16,16,1,1,-1,null,null,ValTab16,511); | ||
582 | ht[17] = new huffcodetab("17 ",16,16,2,3,16,null,null,ValTab16,511); | ||
583 | ht[18] = new huffcodetab("18 ",16,16,3,7,16,null,null,ValTab16,511); | ||
584 | ht[19] = new huffcodetab("19 ",16,16,4,15,16,null,null,ValTab16,511); | ||
585 | ht[20] = new huffcodetab("20 ",16,16,6,63,16,null,null,ValTab16,511); | ||
586 | ht[21] = new huffcodetab("21 ",16,16,8,255,16,null,null,ValTab16,511); | ||
587 | ht[22] = new huffcodetab("22 ",16,16,10,1023,16,null,null,ValTab16,511); | ||
588 | ht[23] = new huffcodetab("23 ",16,16,13,8191,16,null,null,ValTab16,511); | ||
589 | ht[24] = new huffcodetab("24 ",16,16,4,15,-1,null,null,ValTab24,512); | ||
590 | ht[25] = new huffcodetab("25 ",16,16,5,31,24,null,null,ValTab24,512); | ||
591 | ht[26] = new huffcodetab("26 ",16,16,6,63,24,null,null,ValTab24,512); | ||
592 | ht[27] = new huffcodetab("27 ",16,16,7,127,24,null,null,ValTab24,512); | ||
593 | ht[28] = new huffcodetab("28 ",16,16,8,255,24,null,null,ValTab24,512); | ||
594 | ht[29] = new huffcodetab("29 ",16,16,9,511,24,null,null,ValTab24,512); | ||
595 | ht[30] = new huffcodetab("30 ",16,16,11,2047,24,null,null,ValTab24,512); | ||
596 | ht[31] = new huffcodetab("31 ",16,16,13,8191,24,null,null,ValTab24,512); | ||
597 | ht[32] = new huffcodetab("32 ",1,16,0,0,-1,null,null,ValTab32,31); | ||
598 | ht[33] = new huffcodetab("33 ",1,16,0,0,-1,null,null,ValTab33,31); | ||
599 | } | ||
600 | } | ||