Published
Edited
Nov 6, 2021
9 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
filter((orig, a, b, c) => mod256(orig - a))
Insert cell
Insert cell
Insert cell
Insert cell
mod256 = x => x & 0xFF
Insert cell
Insert cell
Insert cell
Insert cell
filter((orig, a, b, c) => mod256(orig - b))
Insert cell
Insert cell
Insert cell
filter((orig, a, b, c) => mod256(orig - mod256(Math.floor((a + b) / 2))))
Insert cell
Insert cell
function paeth(a, b, c) {
const p = a + b - c; // extend the gradient
// return whatever input is closest to p
const pa = Math.abs(p - a);
const pb = Math.abs(p - b);
const pc = Math.abs(p - c);
if (pa <= pb && pa <= pc) {
return a;
} else if (pb <= pc) {
return b;
} else {
return c;
}
}
Insert cell
Insert cell
filter((orig, a, b, c) => mod256(orig - paeth(a, b, c)))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more