[gs-bugs] [Bug 691307] fix computation of fz_mul255

bugzilla-daemon at ghostscript.com bugzilla-daemon at ghostscript.com
Mon May 17 12:11:16 UTC 2010


http://bugs.ghostscript.com/show_bug.cgi?id=691307

--- Comment #4 from riccardo <riccardo at openinkpot.org> 2010-05-17 12:11:14 UTC ---
If I understand correctly that the best thing to do is fixing the callers
passing negative arguments to fz_mull255 one could deal whith interpolations by
introducing something like:

#define fz_convex255(a,b,lambda)                                  \
                ({ unsigned int tmp;                              \
                   unsigned char _a = a;                          \
                   unsigned char _b = b;                          \
                   unsigned char _lambda = lambda;                \
                    tmp = _a*_lambda + _b*(255 ^ _lambda) + 0x80; \
                    tmp += tmp >> 8;                              \
                    tmp >> 8; })

[which has zero error-energy against round((float(a*lambda) +
float(b*(255-lambda)))/255.) over the set [0,255]^3] and switching those
call-sites to the new helper.

-- 
Configure bugmail: http://bugs.ghostscript.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the gs-bugs mailing list