Handbook
Glossary
decode-huffman-tables ( bitstream -- tables )
Vocabulary
compression
.
inflate
.
private
Inputs
bitstream
an
object
Outputs
tables
an
object
Definition
USING:
accessors
arrays
bitstreams
combinators
combinators.short-circuit
compression.huffman
kernel
math
sequences
;
IN:
compression.inflate.private
::
decode-huffman-tables
( bitstream -- tables )
5 bitstream
read
257
+
5 bitstream
read
1
+
4 bitstream
read
4
+
clen-shuffle
swap
head
dup
length
[
3 bitstream
read
]
replicate
get-table
bitstream
swap
<huffman-decoder>
[
2dup
+
]
dip
swap
:>
k!
[
read1-huff2
{
{
[
dup
16
=
]
[
2 bitstream
read
3
+
2array
]
}
{
[
dup
17
=
]
[
3 bitstream
read
3
+
2array
]
}
{
[
dup
18
=
]
[
7 bitstream
read
11
+
2array
]
}
[
]
}
cond
dup
array?
[
dup
second
]
[
1
]
if
k
swap
-
dup
k! 0
>
]
curry
[
]
produce
swap
suffix
{
}
[
dup
{
[
array?
]
[
first
16
=
]
}
1&&
[
[
unclip-last-slice
]
[
second
1
+
swap
<repetition>
append
]
bi*
]
[
suffix
]
if
]
reduce
[
dup
array?
[
second
0
<repetition>
]
[
1array
]
if
]
map
concat
nip
swap
cut
2array
[
[
length>>
<iota>
]
[
]
bi
get-table
]
map
;