Reverted to the previous algorithm, which is just another version of the same one: they produce slightly different results, but this one should be faster as it doesn't use divisions.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13097 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2005-06-13 15:29:08 +00:00
parent 44bb301774
commit d039af7469

View File

@ -148,9 +148,12 @@ color_distance(uint8 red1, uint8 green1, uint8 blue1,
// distance according to psycho-visual tests
int rmean = ((int)red1 + (int)red2) / 2;
return (2 + rmean / 256) * rd * rd
/*return (2 + rmean / 256) * rd * rd
+ 4 * gd * gd
+ (2 + (255 - rmean) / 256) * bd * bd;
+ (2 + (255 - rmean) / 256) * bd * bd;*/
return (((512 + rmean) * rd * rd) >> 8)
+ 4 * gd * gd
+ (((767 - rmean) * bd * bd) >> 8);
}