Merge pull request #1728 from lovell/lch-prefer-atan-over-atan2
Performance: improve LAB to LCH conversion by ~30%
This commit is contained in:
commit
8eefe9f4fb
@ -63,11 +63,6 @@ vips_col_ab2h( double a, double b )
|
||||
{
|
||||
double h;
|
||||
|
||||
#ifdef HAVE_ATAN2
|
||||
h = VIPS_DEG( atan2( b, a ) );
|
||||
if( h < 0.0 )
|
||||
h += 360;
|
||||
#else
|
||||
/* We have to get the right quadrant!
|
||||
*/
|
||||
if( a == 0 ) {
|
||||
@ -89,7 +84,6 @@ vips_col_ab2h( double a, double b )
|
||||
else
|
||||
h = VIPS_DEG( t + VIPS_PI );
|
||||
}
|
||||
#endif
|
||||
|
||||
return( h );
|
||||
}
|
||||
@ -97,13 +91,7 @@ vips_col_ab2h( double a, double b )
|
||||
void
|
||||
vips_col_ab2Ch( float a, float b, float *C, float *h )
|
||||
{
|
||||
#ifdef HAVE_ATAN2
|
||||
*h = VIPS_DEG( atan2( b, a ) );
|
||||
if( *h < 0.0 )
|
||||
*h += 360;
|
||||
#else
|
||||
*h = vips_col_ab2h( a, b );
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_HYPOT
|
||||
*C = hypot( a, b );
|
||||
|
Loading…
Reference in New Issue
Block a user