Palm Developer Forum digest wrote:

> 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.

I assume you already know not to do any expensive square roots when
computing the distance.

Is multiply more expensive than test-and-branch...?

i.e. if the difference in green values squared exceeds the minimum distance
found so far, is there a point to doing the other two multiplications?

Or perhaps there are some other heurustics which can be applied.  Perhaps
something like checking to see if the sum of the differences is below a certain
value?

--
Adam Wozniak
Senior Software Design Engineer
Surveyor Corporation
4501 Orcutt Rd.
San Luis Obispo, CA 93401



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

Reply via email to