Composite Filter, arithmetic mode
Hi,
I've been studying the filter primitives. While the work that has been done is quite impressive, there seems to be quite a bit of polishing to do. I am currently having trouble with the Composite filter primitive. As I read the standard, the K values in the Arithmetic mode can be negative. This leads to the case where one or more of the calculated RGBA values can be negative. Of course these must eventually be clamped at zero. However, the calculation is done by using integers with the K values multiplied by a power of 255. The resulting integer is then normalized to be between 0 and 255 by the NR_NORMALIZE_31 function located in nrpixops.h. This function uses the FAST_DIV_ROUND routine (also in nrpixops.h) which is only valid for nonnegative numbers.... thus it gives the wrong result (a positive value instead of zero). Can an expert suggest a fix?
Tav
participants (1)

Tavmjong Bah