Merge pull request #1729 from lovell/perf-lab-clip

Performance: improve XYZ to LAB conversion by ~15%
This commit is contained in:
John Cupitt 2020-07-20 13:36:03 +01:00 committed by GitHub
commit ef6ad7f4bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -133,15 +133,15 @@ vips_XYZ2Lab_line( VipsColour *colour, VipsPel *out, VipsPel **in, int width )
nZ = QUANT_ELEMENTS * p[2] / XYZ2Lab->Z0;
p += 3;
i = VIPS_FCLIP( 0, nX, QUANT_ELEMENTS - 2 );
i = VIPS_CLIP( 0, nX, QUANT_ELEMENTS - 2 );
f = nX - i;
cbx = cbrt_table[i] + f * (cbrt_table[i + 1] - cbrt_table[i]);
i = VIPS_FCLIP( 0, nY, QUANT_ELEMENTS - 2 );
i = VIPS_CLIP( 0, nY, QUANT_ELEMENTS - 2 );
f = nY - i;
cby = cbrt_table[i] + f * (cbrt_table[i + 1] - cbrt_table[i]);
i = VIPS_FCLIP( 0, nZ, QUANT_ELEMENTS - 2 );
i = VIPS_CLIP( 0, nZ, QUANT_ELEMENTS - 2 );
f = nZ - i;
cbz = cbrt_table[i] + f * (cbrt_table[i + 1] - cbrt_table[i]);