Dear all, I have just prepared a pull request that contains a small fix in the Amaze demosaicing code to make it compatible to the way PhotoFlow processes the image buffers.
By the way, let me take advantage of this to briefly explain the PhotoFlow requirements regarding the āregion of interestā (ROI) processing in librtprocess.
PhotoFlow processes the image in chunks, i.e. small regions (tiles) of more or less arbitrary geometry (they could be square tiles or strips or scan-lines). When a function processes a tile, it gets pointer to the input and output ROIs. In the general case, the input region is larger than the output one, because the algorithm needs some border pixels.
Letās use the Amaze demosaicing as an example. Amaze requires a 16 pixels border around each output ROI. This means that the ārawDataā buffer corresponds to a region defined as
{left=(winx-16), top=(winy-16), width=(winw+32), height=(winh+32)}
except when the region is close to the edges of the image.
Another crucial point is how the algorithm addresses the pixels. The amaze function loops over the pixels, starting from (winx-16, winy-16). This means that the pixels are addressed relative to the origin of the image, not the origin of the ROI. This requires a bit of pointer arithmetics when the input and output buffers do not hold the entire image. For example, the first valid pixel in the input RAW data is accessed with
rawData[winy-16][winx-16]
and this must correspond to the first element of the input buffer. On the other hand, the pixel accessed with
rawData[winy-16][winx-16-1]
corresponds to one element before the beginning of the input buffer, and therefore is not valid.
The client code should take care of properly initialising the input and output float**
pointers, but I will gladly provide an helper function if it can be useful.