From a7357c57579c582a10003d005e9e5eb36100b85a Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Sun, 19 Jul 2020 15:29:03 +0100 Subject: [PATCH] Perf: improve conversion to LCH by ~30%, avoid costly atan2 --- libvips/colour/Lab2LCh.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/libvips/colour/Lab2LCh.c b/libvips/colour/Lab2LCh.c index 9dccb587..7453a397 100644 --- a/libvips/colour/Lab2LCh.c +++ b/libvips/colour/Lab2LCh.c @@ -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 );