Bob Ebert wrote in message <4776@palm-dev-forum>...
...
>If we've gotten this far, we have to do a color best fit.  The current OS
>uses a shortest distance in RGB space algorithm.  That's not perceptually
>perfect, but it's reasonably fast and good enough.
>
>The RGB distance is computed by squaring the differences between the Red,
>Green, and Blue values in the passed table and each entry in the reference
>table.  The reference table entry with the lowest distance is considered
>the best match.  This loop is carefully written to do only (short) integer
>math, so it's reasonably fast, though there are three multiplications for
>each color table entry, so in the 8-bpp case that's 768 multiplies, which
>is a fairly significant cost.

Couldn't this be optimized by computing the squares for each color
table entry as it is set into the table?  Sure, there would be a -slight-
slowdown when you set a color (the 3 mults), and there would be the
memory overhead of storing these computations, but the gain in the
backend when you need to match colors and can just look up the
squares instead of computing them all should be significant.

--
-Richard M. Hartman
[EMAIL PROTECTED]

186,000 mi/sec: not just a good idea, it's the LAW!




-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to