Handbook
Glossary
inflate-huffman ( bitstream tables -- bytes )
Vocabulary
compression
.
inflate
.
private
Inputs
bitstream
an
object
tables
an
object
Outputs
bytes
an
object
Definition
USING:
arrays
bitstreams
compression.huffman
kernel
math
sequences
;
IN:
compression.inflate.private
::
inflate-huffman
( bitstream tables -- bytes )
bitstream tables
[
<huffman-decoder>
]
with
map
:>
tables
[
tables
first
read1-huff2
dup
256
>
[
dup
285
=
[
dup
264
>
[
dup
261
-
4
/i
dup
5
>
[
bad-zlib-data
]
when
bitstream
read
2array
]
when
]
unless
tables
second
read1-huff2
dup
3
>
[
dup
2
-
2
/i
dup
13
>
[
bad-zlib-data
]
when
bitstream
read
2array
]
when
2array
]
when
dup
256
=
not
]
[
]
produce
nip
[
dup
array?
[
first2
[
dup
array?
[
first2
]
[
0
]
if
[
257
-
length-table
nth
]
[
+
]
bi*
]
[
dup
array?
[
first2
]
[
0
]
if
[
dist-table
nth
]
[
+
]
bi*
]
bi*
2array
]
when
]
map
;