stuff
This commit is contained in:
parent
9dfbc8968b
commit
99b0ea4f42
@ -67,11 +67,13 @@ imb_Lab2XYZ( float *p, float *q, int n, im_colour_temperature *temp )
|
|||||||
int x;
|
int x;
|
||||||
|
|
||||||
for( x = 0; x < n; x++ ) {
|
for( x = 0; x < n; x++ ) {
|
||||||
float L = p[0];
|
float L, a, b;
|
||||||
float a = p[1];
|
|
||||||
float b = p[2];
|
|
||||||
float X, Y, Z;
|
float X, Y, Z;
|
||||||
double cby, tmp;
|
double cby, tmp;
|
||||||
|
|
||||||
|
L = p[0];
|
||||||
|
a = p[1];
|
||||||
|
b = p[2];
|
||||||
p += 3;
|
p += 3;
|
||||||
|
|
||||||
if( L < 8.0 ) {
|
if( L < 8.0 ) {
|
||||||
@ -107,15 +109,16 @@ imb_Lab2XYZ( float *p, float *q, int n, im_colour_temperature *temp )
|
|||||||
int
|
int
|
||||||
im_Lab2XYZ_temp( IMAGE *in, IMAGE *out, double X0, double Y0, double Z0 )
|
im_Lab2XYZ_temp( IMAGE *in, IMAGE *out, double X0, double Y0, double Z0 )
|
||||||
{
|
{
|
||||||
im_colour_temperature *temp = IM_NEW( out, im_colour_temperature );
|
im_colour_temperature *temp;
|
||||||
|
|
||||||
/* Check input image.
|
/* Check input image.
|
||||||
*/
|
*/
|
||||||
if( !temp )
|
if( !(temp = IM_NEW( out, im_colour_temperature )) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
if( in->Bands != 3 || in->BandFmt != IM_BANDFMT_FLOAT ||
|
if( in->Bands != 3 ||
|
||||||
|
in->BandFmt != IM_BANDFMT_FLOAT ||
|
||||||
in->Coding != IM_CODING_NONE ) {
|
in->Coding != IM_CODING_NONE ) {
|
||||||
im_errormsg( "im_Lab2XYZ: 3-band uncoded float input only" );
|
im_error( "im_Lab2XYZ", _( "not 3-band uncoded float" ) );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,9 +77,14 @@ imb_XYZ2Lab_tables( void )
|
|||||||
{
|
{
|
||||||
static int built_tables = 0;
|
static int built_tables = 0;
|
||||||
|
|
||||||
|
int was_built;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if( built_tables )
|
g_mutex_lock( im__global_lock );
|
||||||
|
was_built = built_tables;
|
||||||
|
built_tables = 1;
|
||||||
|
g_mutex_unlock( im__global_lock );
|
||||||
|
if( was_built )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for( i = 0; i < QUANT_ELEMENTS; i++ ) {
|
for( i = 0; i < QUANT_ELEMENTS; i++ ) {
|
||||||
@ -90,8 +95,6 @@ imb_XYZ2Lab_tables( void )
|
|||||||
else
|
else
|
||||||
cbrt_table[i] = cbrt( Y );
|
cbrt_table[i] = cbrt( Y );
|
||||||
}
|
}
|
||||||
|
|
||||||
built_tables = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Process a buffer of data.
|
/* Process a buffer of data.
|
||||||
@ -146,16 +149,17 @@ imb_XYZ2Lab( float *p, float *q, int n, im_colour_temperature *temp )
|
|||||||
int
|
int
|
||||||
im_XYZ2Lab_temp( IMAGE *in, IMAGE *out,
|
im_XYZ2Lab_temp( IMAGE *in, IMAGE *out,
|
||||||
double X0, double Y0, double Z0 )
|
double X0, double Y0, double Z0 )
|
||||||
{
|
{
|
||||||
im_colour_temperature *temp = IM_NEW( out, im_colour_temperature );
|
im_colour_temperature *temp;
|
||||||
|
|
||||||
/* Check input image.
|
/* Check input image.
|
||||||
*/
|
*/
|
||||||
if( !temp )
|
if( !(temp = IM_NEW( out, im_colour_temperature )) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
if( in->Bands != 3 || in->BandFmt != IM_BANDFMT_FLOAT ||
|
if( in->Bands != 3 ||
|
||||||
|
in->BandFmt != IM_BANDFMT_FLOAT ||
|
||||||
in->Coding != IM_CODING_NONE ) {
|
in->Coding != IM_CODING_NONE ) {
|
||||||
im_errormsg( "im_XYZ2Lab: 3-band uncoded float only" );
|
im_error( "im_XYZ2Lab", _( "not 3-band uncoded float" ) );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user