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:
parent
44bb301774
commit
d039af7469
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user