Bug #64736 [Opn->Fbk]: Incorrect calculation in gdColorMatch
| From: | pajoye@php.net | Date: | Tue, 30 Apr 2013 05:21:35 +0000 |
| Subject: | Bug #64736 [Opn->Fbk]: Incorrect calculation in gdColorMatch | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-178703@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64736&edit=1
ID: 64736
Updated by: pajoye@php.net
Reported by: sixd@php.net
Summary: Incorrect calculation in gdColorMatch
-Status: Open
+Status: Feedback
Type: Bug
Package: GD related
Operating System: Linux
PHP Version: 5.5Git-2013-04-29 (Git)
Block user comment: N
Private report: N
New Comment:
That's the classic distance calculation in the RGB cube, does ^ not have
precedence with the compiler you use? It should (or has in all platforms I use)
:).
Previous Comments:
------------------------------------------------------------------------
[2013-04-29 23:05:06] sixd@php.net
Description:
------------
Compilations warnings in gd_crop.c flag a potential calculation issue in gdColorMatch:
/home/cjones/php-5.5/ext/gd/libgd/gd_crop.c:340: warning: suggest parentheses around arithmetic in
operand of ^
/home/cjones/php-5.5/ext/gd/libgd/gd_crop.c:340: warning: suggest parentheses around arithmetic in
operand of ^
The code at line 340 is:
const double dist_perc = sqrt(dist / (255^2 + 255^2 + 255^2));
The denominator is currently evaluated as 253. Was it instead intended be (3 * (255 * 255)) ==
195075 ?
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64736&edit=1