News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

[SSE2]Make all bytes positive

Started by Farabi, December 21, 2012, 07:58:19 PM

Previous topic - Next topic

Farabi

Hool:
The speed is impressive. 4 times faster than my fastest compare algo.
http://farabidatacenter.url.ph/MySoftware/
My 3D Game Engine Demo.

Contact me at Whatsapp: 6283818314165

Farabi



The white color is example of same color but different intensity, but on real life, sometime some color even the same, is distorted, it had different pattern of color.

For example, a color consist of (RGB) 22h-22h-22h is the same with 66h-66h-66h but in real life, sometime the color become 66h-64h-65h and it make my algo confused to determine wheter if this pixel is the same color or not. So, now I decided, if the substraction had equal result, it is the same. For example, 33h-33h-33h substract with 22h-22h-22h which have result RGB 11h for R and 11h for G and 11h for B is the same color because the intensity is the same. But, if the R is 10 and the G is 9 and the B is 10 it was a different color because the result component is different. But to make thing easier, I make a tolerance( I used word "Tol") to 10d for the difference tobe acceptable.
http://farabidatacenter.url.ph/MySoftware/
My 3D Game Engine Demo.

Contact me at Whatsapp: 6283818314165

dedndave

color space is not a cube, either

R, G, and B each have different non-linear weights

this will approximate the "distance" between 2 colors


there are probably a number of good short-cuts   :P
this equation is a short-cut, already
the real formula would be extremely complex

hool

faster version of absolute difference between 2 values

simply:movdqa  xmm3, xmm1
psubusb xmm1, xmm0
psubusb xmm0, xmm3
por     xmm0, xmm1

Farabi

Quote from: dedndave on December 26, 2012, 01:29:11 AM
color space is not a cube, either

R, G, and B each have different non-linear weights

this will approximate the "distance" between 2 colors


there are probably a number of good short-cuts   :P
this equation is a short-cut, already
the real formula would be extremely complex

Anyway dave, where did you get that formula, that formula is exactly what Im looking for.
http://farabidatacenter.url.ph/MySoftware/
My 3D Game Engine Demo.

Contact me at Whatsapp: 6283818314165

dedndave

sorry - i should have mentioned that
it is a slightly modified version of Thiadmer's equation found here...

http://www.compuphase.com/cmetric.htm

he based it on previous work by Charles Poynton, who is a guru for such things
then, he did some experimentation and testing to arrive at that equation