Just a thought here -- there's a practically infinite number of simple
filters like this (i.e. filters for which every pixel is operated on
independently). Would it not be better to port something like
Avisynth's MT_LUT filter, which allows the user to specify a
mathematical operation to create a LUT from, which is then applied to
all pixels? This could serve as the basis for many simple filters,
reducing code duplication.
Jason