*/
#if defined(MAGICKCORE_LCMS_DELEGATE)
-static unsigned short **DestroyPixelThreadSet(unsigned short **pixels)
+static double **DestroyPixelThreadSet(double **pixels)
{
register ssize_t
i;
- assert(pixels != (unsigned short **) NULL);
+ assert(pixels != (double **) NULL);
for (i=0; i < (ssize_t) GetMagickResourceLimit(ThreadResource); i++)
- if (pixels[i] != (unsigned short *) NULL)
- pixels[i]=(unsigned short *) RelinquishMagickMemory(pixels[i]);
- pixels=(unsigned short **) RelinquishMagickMemory(pixels);
+ if (pixels[i] != (double *) NULL)
+ pixels[i]=(double *) RelinquishMagickMemory(pixels[i]);
+ pixels=(double **) RelinquishMagickMemory(pixels);
return(pixels);
}
-static unsigned short **AcquirePixelThreadSet(const size_t columns,
+static double **AcquirePixelThreadSet(const size_t columns,
const size_t channels)
{
+ double
+ **pixels;
+
register ssize_t
i;
- unsigned short
- **pixels;
-
size_t
number_threads;
number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
- pixels=(unsigned short **) AcquireQuantumMemory(number_threads,
- sizeof(*pixels));
- if (pixels == (unsigned short **) NULL)
- return((unsigned short **) NULL);
+ pixels=(double **) AcquireQuantumMemory(number_threads,sizeof(*pixels));
+ if (pixels == (double **) NULL)
+ return((double **) NULL);
(void) ResetMagickMemory(pixels,0,number_threads*sizeof(*pixels));
for (i=0; i < (ssize_t) number_threads; i++)
{
- pixels[i]=(unsigned short *) AcquireQuantumMemory(columns,channels*
+ pixels[i]=(double *) AcquireQuantumMemory(columns,channels*
sizeof(**pixels));
- if (pixels[i] == (unsigned short *) NULL)
+ if (pixels[i] == (double *) NULL)
return(DestroyPixelThreadSet(pixels));
}
return(pixels);
source_type,
target_type;
+ double
+ **magick_restrict source_pixels,
+ source_scale,
+ **magick_restrict target_pixels,
+ target_scale;
+
int
intent;
ssize_t
y;
- unsigned short
- **magick_restrict source_pixels,
- **magick_restrict target_pixels;
-
target_profile=(cmsHPROFILE) NULL;
if (icc_profile != (StringInfo *) NULL)
{
ThrowProfileException(ResourceLimitError,
"ColorspaceColorProfileMismatch",name);
}
+ source_scale=1.0;
+ source_channels=3;
switch (cmsGetColorSpace(source_profile))
{
case cmsSigCmykData:
{
source_colorspace=CMYKColorspace;
- source_type=(cmsUInt32Number) TYPE_CMYK_16;
+ source_type=(cmsUInt32Number) TYPE_CMYK_DBL;
source_channels=4;
+ source_scale=100.0;
break;
}
case cmsSigGrayData:
{
source_colorspace=GRAYColorspace;
- source_type=(cmsUInt32Number) TYPE_GRAY_16;
+ source_type=(cmsUInt32Number) TYPE_GRAY_DBL;
source_channels=1;
break;
}
case cmsSigLabData:
{
source_colorspace=LabColorspace;
- source_type=(cmsUInt32Number) TYPE_Lab_16;
- source_channels=3;
- break;
- }
- case cmsSigLuvData:
- {
- source_colorspace=YUVColorspace;
- source_type=(cmsUInt32Number) TYPE_YUV_16;
- source_channels=3;
+ source_type=(cmsUInt32Number) TYPE_Lab_DBL;
break;
}
case cmsSigRgbData:
{
source_colorspace=sRGBColorspace;
- source_type=(cmsUInt32Number) TYPE_RGB_16;
- source_channels=3;
+ source_type=(cmsUInt32Number) TYPE_RGB_DBL;
break;
}
case cmsSigXYZData:
{
source_colorspace=XYZColorspace;
- source_type=(cmsUInt32Number) TYPE_XYZ_16;
- source_channels=3;
- break;
- }
- case cmsSigYCbCrData:
- {
- source_colorspace=YCbCrColorspace;
- source_type=(cmsUInt32Number) TYPE_YCbCr_16;
- source_channels=3;
+ source_type=(cmsUInt32Number) TYPE_XYZ_DBL;
break;
}
default:
{
source_colorspace=UndefinedColorspace;
- source_type=(cmsUInt32Number) TYPE_RGB_16;
- source_channels=3;
+ source_type=(cmsUInt32Number) TYPE_RGB_DBL;
break;
}
}
signature=cmsGetPCS(source_profile);
if (target_profile != (cmsHPROFILE) NULL)
signature=cmsGetColorSpace(target_profile);
+ target_scale=1.0;
+ target_channels=3;
switch (signature)
{
case cmsSigCmykData:
{
target_colorspace=CMYKColorspace;
- target_type=(cmsUInt32Number) TYPE_CMYK_16;
+ target_type=(cmsUInt32Number) TYPE_CMYK_DBL;
target_channels=4;
+ target_scale=0.01;
break;
}
case cmsSigLabData:
{
target_colorspace=LabColorspace;
- target_type=(cmsUInt32Number) TYPE_Lab_16;
- target_channels=3;
+ target_type=(cmsUInt32Number) TYPE_Lab_DBL;
break;
}
case cmsSigGrayData:
{
target_colorspace=GRAYColorspace;
- target_type=(cmsUInt32Number) TYPE_GRAY_16;
+ target_type=(cmsUInt32Number) TYPE_GRAY_DBL;
target_channels=1;
break;
}
- case cmsSigLuvData:
- {
- target_colorspace=YUVColorspace;
- target_type=(cmsUInt32Number) TYPE_YUV_16;
- target_channels=3;
- break;
- }
case cmsSigRgbData:
{
target_colorspace=sRGBColorspace;
- target_type=(cmsUInt32Number) TYPE_RGB_16;
- target_channels=3;
+ target_type=(cmsUInt32Number) TYPE_RGB_DBL;
break;
}
case cmsSigXYZData:
{
target_colorspace=XYZColorspace;
- target_type=(cmsUInt32Number) TYPE_XYZ_16;
- target_channels=3;
- break;
- }
- case cmsSigYCbCrData:
- {
- target_colorspace=YCbCrColorspace;
- target_type=(cmsUInt32Number) TYPE_YCbCr_16;
- target_channels=3;
+ target_type=(cmsUInt32Number) TYPE_XYZ_DBL;
break;
}
default:
{
target_colorspace=UndefinedColorspace;
- target_type=(cmsUInt32Number) TYPE_RGB_16;
- target_channels=3;
+ target_type=(cmsUInt32Number) TYPE_RGB_DBL;
break;
}
}
*/
source_pixels=AcquirePixelThreadSet(image->columns,source_channels);
target_pixels=AcquirePixelThreadSet(image->columns,target_channels);
- if ((source_pixels == (unsigned short **) NULL) ||
- (target_pixels == (unsigned short **) NULL))
+ if ((source_pixels == (double **) NULL) ||
+ (target_pixels == (double **) NULL))
{
transform=DestroyTransformThreadSet(transform);
ThrowProfileException(ResourceLimitError,
MagickBooleanType
sync;
- register ssize_t
- x;
+ register double
+ *p;
register Quantum
*magick_restrict q;
- register unsigned short
- *p;
+ register ssize_t
+ x;
if (status == MagickFalse)
continue;
p=source_pixels[id];
for (x=0; x < (ssize_t) image->columns; x++)
{
- *p++=ScaleQuantumToShort(GetPixelRed(image,q));
+ *p++=source_scale*QuantumScale*GetPixelRed(image,q);
if (source_channels > 1)
{
- *p++=ScaleQuantumToShort(GetPixelGreen(image,q));
- *p++=ScaleQuantumToShort(GetPixelBlue(image,q));
+ *p++=source_scale*QuantumScale*GetPixelGreen(image,q);
+ *p++=source_scale*QuantumScale*GetPixelBlue(image,q);
}
if (source_channels > 3)
- *p++=ScaleQuantumToShort(GetPixelBlack(image,q));
+ *p++=source_scale*QuantumScale*GetPixelBlack(image,q);
q+=GetPixelChannels(image);
}
cmsDoTransform(transform[id],source_pixels[id],target_pixels[id],
for (x=0; x < (ssize_t) image->columns; x++)
{
if (target_channels == 1)
- SetPixelGray(image,ScaleShortToQuantum(*p),q);
+ SetPixelGray(image,target_scale*QuantumRange*(*p),q);
else
- SetPixelRed(image,ScaleShortToQuantum(*p),q);
+ SetPixelRed(image,target_scale*QuantumRange*(*p),q);
p++;
if (target_channels > 1)
{
- SetPixelGreen(image,ScaleShortToQuantum(*p),q);
+ SetPixelGreen(image,target_scale*QuantumRange*(*p),q);
p++;
- SetPixelBlue(image,ScaleShortToQuantum(*p),q);
+ SetPixelBlue(image,target_scale*QuantumRange*(*p),q);
p++;
}
if (target_channels > 3)
{
- SetPixelBlack(image,ScaleShortToQuantum(*p),q);
+ SetPixelBlack(image,target_scale*QuantumRange*(*p),q);
p++;
}
q+=GetPixelChannels(image);