Merge pull request #1733 from lovell/perf-xyz2lab-clip
Performance: safely improve XYZ to LAB conversion by ~12%
This commit is contained in:
commit
a6557eb94f
@ -133,15 +133,15 @@ vips_XYZ2Lab_line( VipsColour *colour, VipsPel *out, VipsPel **in, int width )
|
|||||||
nZ = QUANT_ELEMENTS * p[2] / XYZ2Lab->Z0;
|
nZ = QUANT_ELEMENTS * p[2] / XYZ2Lab->Z0;
|
||||||
p += 3;
|
p += 3;
|
||||||
|
|
||||||
i = VIPS_FCLIP( 0, nX, QUANT_ELEMENTS - 2 );
|
i = VIPS_CLIP( 0, (int) nX, QUANT_ELEMENTS - 2 );
|
||||||
f = nX - i;
|
f = nX - i;
|
||||||
cbx = cbrt_table[i] + f * (cbrt_table[i + 1] - cbrt_table[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, (int) nY, QUANT_ELEMENTS - 2 );
|
||||||
f = nY - i;
|
f = nY - i;
|
||||||
cby = cbrt_table[i] + f * (cbrt_table[i + 1] - cbrt_table[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, (int) nZ, QUANT_ELEMENTS - 2 );
|
||||||
f = nZ - i;
|
f = nZ - i;
|
||||||
cbz = cbrt_table[i] + f * (cbrt_table[i + 1] - cbrt_table[i]);
|
cbz = cbrt_table[i] + f * (cbrt_table[i + 1] - cbrt_table[i]);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user