But it is way more than 512 outcomes. It is more like
256+255+254+...+1 = 128*257=32896 values
or there about...
[EMAIL PROTECTED] wrote:
>
> In a message dated 3/14/00 5:15:06 AM Eastern Standard Time,
> [EMAIL PROTECTED] writes:
>
> << >Couldn't this be optimized by computing the squares for each color
> >table entry as it is set into the table?
>
> I don't think so. Well, anyway not much. To compute distance, you have to
> square the difference. (a-b)^2 = a^2 - 2ab - b^2. So, even if you had a^2
> precomputed you'd still have to do a bunch of multiplications.
>
> Also, in the normal course of using the OS, we don't actually do
> WinRGBToIndex very often. If you have an app that does it more frequently
> or has custom needs, you're probably better of computing the indexes once
> and caching them.
>
> Beyond that.. well, there's API to get the current palette, so you could
> always implement your own (better/faster) RGB to index routine!
> >>
>
> I would think that you would be able to use a table that holds the values for
> the whole distance equation. Since range for a and b are both [0..255], the
> range for (a-b) is -255 to +255 and you can make a 512 element table to hold
> the values.
> -Pete
> PS: Shouldn't the mentioned equation be (a-b)^2 = a^2 - 2ab + b^2?
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe, please see
>http://www.palm.com/devzone/mailinglists.html
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html