API change for samplers to pass inverse Jacobian data to samplers
In working on an implementation of Exact Area Box Filtering (modified
so it does well both upsampling, downsampling, and actually, for
arbitrary warps), which is particularly well-suited for downsampling,
I have determined that the sampler should receive the inverse of the
Jacobian matrix from the (currently, affine) transformation that is
calling it. This inverse need not be exact--it can be an
approximation, though the more accurate the approximation, the better
the results. The motivation for this modification is that future
developments such as warps, perspective, and other transformations of
the same type will also be able to rely on the new sampler and use it
to maximal effect.
I propose modifying each affine transformation's create_matrix ()
method to generate both the Jacobian and (an approximation of) the
inverse Jacobian. In addition, I will need to expand the OpAffine
struct to include an additional GeglMatrix3 (call it matrix_inverse or
inverse_jacobian?) to store this data.
Now, I will also require passing this new matrix to the sampler. This
appears to necessitate a slight API change, though the pre-existing
samplers will simply ignore this new information. This expansion
encourages further development of methods that take advantage of this
inverse Jacobian data and sets a framework for future transformations
that may also want to pass inverse Jacobian data to samplers that use
it.
My question at the moment is: what is the best way to pass this data
to the sampler?
Note: Passing the Jacobian matrix itself may be better, but Nicolas is
of the opinion that degenerate cases are easier to handle if the
inverse is passed.
Adam Turcotte