Handbook
Glossary
run-length-uncompress-bitmap8 ( byte-array m n -- byte-array' )
Vocabulary
compression
.
run-length
Inputs
byte-array
an
object
m
an
object
n
an
object
Outputs
byte-array'
an
object
Definition
USING:
arrays
combinators
kernel
math
math.matrices
math.order
sequences
sequences.parser
;
IN:
compression.run-length
::
run-length-uncompress-bitmap8
( byte-array m n -- byte-array' )
byte-array
<sequence-parser>
:>
sp m 1
+
n
<zero-matrix>
:>
matrix n 4
mod
n
+
:>
stride 0
:>
i! 0
:>
j!
f
:>
done?!
[
sp
consume
dup
0
=
[
sp
consume
dup
3 255
between?
[
nip
[
sp
]
dip
dup
odd?
[
1
+
take-n
but-last
]
[
take-n
]
if
[
j matrix i
swap
nth
copy
]
[
length
j
+
j!
]
bi
]
[
nip
{
{
0 ~quotation~
}
{
1 ~quotation~
}
{
2 ~quotation~
}
}
case
]
if
]
[
sp
consume
<array>
[
j matrix i
swap
nth
copy
]
[
length
j
+
j!
]
bi
]
if
j stride
>=
[
0 j!
]
when
done?
not
]
loop
matrix
B{
}
concat-as
;