Module

Puregrain.Internal.Ostromoukhov

Package
purescript-puregrain
Repository
roman-mkh/puregrain

Ostromoukhov's variable-coefficient error diffusion (SIGGRAPH 2001): its table, and the table by tone built from it. Internal: may change without notice; Puregrain.Dither.ostromoukhov is the public value.

The table is the author's C sample's, varcoeffED.c, "version 1 (August 2001), as described in the article" (http://www.iro.umontreal.ca/~ostrom/varcoeffED/varcoeffED.tar), which libdither uses too; it differs from the paper's Appendix I on rows 23–71, and looks better there (docs/weights-by-tone/ostromoukhov.md).

#coefficients Source

coefficients :: Array (Array Int)

The table as the C sample prints it, levels 0 to 127: right, down-left, down, and their sum, which divides them. Levels 128 to 255 are these mirrored (level i uses the row of 255 − i), as the paper says and the C sample's other 128 rows are.

#neighbours Source

neighbours :: Array { dx :: Int, dy :: Int }

The three neighbours, as the paper names them: right (its d10), down-left (d-11) and down (d01), in the order of each row below.

#ostromoukhovWeights Source

ostromoukhovWeights :: Unit -> WeightsByTone

The table by tone: each row divided by its sum, and mirrored to 256 rows. Built when called, once per run by the drivers, not when the module loads.