Handbook
Glossary
png-unfilter-line ( width prev curr filter -- curr' )
Vocabulary
images
.
png
Inputs
width
an
object
prev
an
object
curr
an
object
filter
an
object
Outputs
curr'
an
object
Definition
USING:
combinators
kernel
math
math.bitwise
sequences
;
IN:
images.png
::
png-unfilter-line
( width prev curr filter -- curr' )
prev
:>
c prev width
tail-slice
:>
b curr
:>
a curr width
tail-slice
:>
x x
length
<iota>
filter
{
{
filter-none
[
drop
]
}
{
filter-sub
[
[|
n | n x
nth
n a
nth
+
256
wrap
n x
set-nth
]
each
]
}
{
filter-up
[
[|
n | n x
nth
n b
nth
+
256
wrap
n x
set-nth
]
each
]
}
{
filter-average
[
[|
n |
n x
nth
n a
nth
n b
nth
+
2/
+
256
wrap
n x
set-nth
]
each
]
}
{
filter-paeth
[
[|
n |
n x
nth
n a
nth
n b
nth
n c
nth
paeth
+
256
wrap
n x
set-nth
]
each
]
}
[
bad-filter
]
}
case
curr width
tail
;