Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly x86 > Re: MMX speedup...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 16 of 26 Topic 4642 of 4825
Post > Topic >>

Re: MMX speedup for Floyd Steinberg error diffusion

by Phil Carmody <thefatphil_demunged@[EMAIL PROTECTED] > May 9, 2008 at 05:18 PM

Terje Mathisen  <spamtrap@[EMAIL PROTECTED]
> writes:
> rep_movsd wrote:
>> On May 8, 7:00 pm, Terje Mathisen  <spamt...@[EMAIL PROTECTED]
> wrote:
>>> How does it handle the corner/edge cases?
>>
>> The edges are handled by ignoring all pixels which do not have the
>> neighbours, the simplest way I found was to keep my x and y loops
>> ranging over [1, width-1) and [0, height-1).
>
> OK. Quick & dirty indeed.
>>
>>> It seems to me like the getNearestPalColor() function could easily
>>> dominate the processing time here!
>>
>> Well Initially the code used the standard distance matching algorithm
>> as seen in zillions of color reduction libraries :
>>
>> For each color in the palette
>> Compute the RGB colorspace distance between the palette entry and the
>> target color -> (r - rp)^2 + (g - gp)^2 + (b - bp)^2
>> Choose the index with the minimum distance.
>>
>> This was pathetically slow... It has to loop 256 times for each pixel
>> doing several arithmetic ops!
>> One optimization is to use abs and get rid of the multiplications.
>
> But that messes up the distance calculation because it gives the wrong
> answer for many edge cases. OTOH, the error diffusion would tend to
> distribute this error across the neighboring pixels, making the visual
> impact much less.

It doesn't "mess up the distance calculations" at all, it
simply selects a different metric, namely the L_1 metric
rather than the L_2 metric. However, both are "wrong" in
the strict sense, as a metric which models human vision with
any attempt at fidelity would weight the three different 
chroma components differently, giving more weight to the 
green component, and less to the red component. (Or even 
take place in a different colour-space entirely.) The 
volume of space for which the unweighted L_2 metric choses 
the wrong palate colour (not the nearest according to the 
model of human visual perception) will most probably be 
larger than the volume of the corner cases where L_2 selects 
the correct colour but L_1 doesn't. (And of course, 
there will even be times where the L_1 selects a better 
palate colour than L_2.)

Phil
-- 
Dear aunt, let's set so double the killer delete select all.
-- Microsoft voice recognition live demonstration
 




 26 Posts in Topic:
MMX speedup for Floyd Steinberg error diffusion
rep_movsd <spamtrap@[  2008-05-05 04:04:14 
Re: MMX speedup for Floyd Steinberg error diffusion
"Maarten Kronenburg&  2008-05-07 19:56:39 
Re: MMX speedup for Floyd Steinberg error diffusion
"Maarten Kronenburg&  2008-05-07 20:49:56 
Re: MMX speedup for Floyd Steinberg error diffusion
"Maarten Kronenburg&  2008-05-07 22:35:41 
Re: MMX speedup for Floyd Steinberg error diffusion
James Harris <spamtra  2008-05-07 16:26:13 
Re: MMX speedup for Floyd Steinberg error diffusion
rep_movsd <spamtrap@[  2008-05-08 00:57:41 
Re: MMX speedup for Floyd Steinberg error diffusion
Terje Mathisen <spamt  2008-05-08 18:00:18 
Re: MMX speedup for Floyd Steinberg error diffusion
"Maarten Kronenburg&  2008-05-08 17:14:21 
Re: MMX speedup for Floyd Steinberg error diffusion
Robert Redelmeier <red  2008-05-09 14:19:08 
Re: MMX speedup for Floyd Steinberg error diffusion
Terje Mathisen <spamt  2008-05-09 21:03:11 
Re: MMX speedup for Floyd Steinberg error diffusion
rep_movsd <spamtrap@[  2008-05-08 07:23:41 
Re: MMX speedup for Floyd Steinberg error diffusion
Jim Leonard <spamtrap  2008-05-08 13:48:14 
Re: MMX speedup for Floyd Steinberg error diffusion
Terje Mathisen <spamt  2008-05-09 10:21:40 
Re: MMX speedup for Floyd Steinberg error diffusion
rep_movsd <spamtrap@[  2008-05-09 00:24:23 
Re: MMX speedup for Floyd Steinberg error diffusion
Terje Mathisen <spamt  2008-05-09 15:31:53 
Re: MMX speedup for Floyd Steinberg error diffusion
Phil Carmody <thefatph  2008-05-09 17:18:44 
Re: MMX speedup for Floyd Steinberg error diffusion
Terje Mathisen <spamt  2008-05-09 21:03:09 
Re: MMX speedup for Floyd Steinberg error diffusion
rep_movsd <spamtrap@[  2008-05-10 00:28:25 
Re: MMX speedup for Floyd Steinberg error diffusion
Terje Mathisen <spamt  2008-05-10 21:25:29 
Re: MMX speedup for Floyd Steinberg error diffusion
Phil Carmody <thefatph  2008-05-10 22:48:49 
Re: MMX speedup for Floyd Steinberg error diffusion
Phil Carmody <thefatph  2008-05-10 22:07:04 
Re: MMX speedup for Floyd Steinberg error diffusion
rep_movsd <spamtrap@[  2008-05-10 02:28:42 
Re: MMX speedup for Floyd Steinberg error diffusion
Terje Mathisen <spamt  2008-05-10 21:17:34 
Re: MMX speedup for Floyd Steinberg error diffusion
rep_movsd <spamtrap@[  2008-05-11 01:33:13 
Re: MMX speedup for Floyd Steinberg error diffusion
Phil Carmody <thefatph  2008-05-11 13:14:37 
Re: MMX speedup for Floyd Steinberg error diffusion
rep_movsd <spamtrap@[  2008-05-11 01:25:56 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 14 8:37:54 CDT 2008.