private float [ ] LABtoXYZ ( float L , float a , float b , float [ ] xyzResult ) { // Significant speedup: Removing Math.pow float y = ( L + 16.0f ) / 116.0f ; float y3 = y * y * y ; // Math.pow(y, 3.0); float x = ( a / 500.0f ) + y ; float x3 = x * x * x ; // Math.pow(x, 3.0); float z = y - ( b / 200.0f ) ; float z3 = z * z * z ; // Math.pow(z, 3.0); if ( y3 > 0.008856f ) { y = y3 ; } else { y = ( y - ( 16.0f / 116.0f ) ) / 7.787f ; } if ( x3 > 0.008856f ) { x = x3 ; } else { x = ( x - ( 16.0f / 116.0f ) ) / 7.787f ; } if ( z3 > 0.008856f ) { z = z3 ; } else { z = ( z - ( 16.0f / 116.0f ) ) / 7.787f ; } xyzResult [ 0 ] = x * whitePoint [ 0 ] ; xyzResult [ 1 ] = y * whitePoint [ 1 ] ; xyzResult [ 2 ] = z * whitePoint [ 2 ] ; return xyzResult ; }
Convert LAB to XYZ .