#include "MagickCore/quantize.h"
#include "MagickCore/quantum.h"
#include "MagickCore/quantum-private.h"
+#include "MagickCore/resource_.h"
#include "MagickCore/string_.h"
#include "MagickCore/string-private.h"
#include "MagickCore/utility.h"
assert(Y != (double *) NULL);
assert(Z != (double *) NULL);
r=QuantumScale*red;
- if (r > 0.04045)
+ if (r > 0.0404482362771082)
r=pow((r+0.055)/1.055,2.4);
else
r/=12.92;
g=QuantumScale*green;
- if (g > 0.04045)
+ if (g > 0.0404482362771082)
g=pow((g+0.055)/1.055,2.4);
else
g/=12.92;
b=QuantumScale*blue;
- if (b > 0.04045)
+ if (b > 0.0404482362771082)
b=pow((b+0.055)/1.055,2.4);
else
b/=12.92;
}
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ dynamic_number_threads(image->columns,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
GetPixelInfo(image,&zero);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ dynamic_number_threads(image->columns,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
}
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ dynamic_number_threads(image->columns,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
}
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ dynamic_number_threads(image->columns,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
}
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ dynamic_number_threads(image->columns,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
}
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ dynamic_number_threads(image->columns,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
black=pow(10.0,(reference_black-reference_white)*(gamma/density)*
0.002/film_gamma);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ dynamic_number_threads(image->columns,1,1)
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
logmap[i]=ScaleMapToQuantum((MagickRealType) (MaxMap*(reference_white+
0.002/film_gamma))/1024.0));
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ dynamic_number_threads(image->columns,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
primary_info.y=(double) (MaxMap+1.0)/2.0;
primary_info.z=(double) (MaxMap+1.0)/2.0;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ dynamic_number_threads(image->columns,1,1)
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
G = 0.29900*R+0.58700*G+0.11400*B
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ dynamic_number_threads(image->columns,1,1)
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
primary_info.y=(double) (MaxMap+1.0)/2.0;
primary_info.z=(double) (MaxMap+1.0)/2.0;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ dynamic_number_threads(image->columns,1,1)
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
G = 0.21260*R+0.71520*G+0.07220*B
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ dynamic_number_threads(image->columns,1,1)
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
primary_info.y=(double) (MaxMap+1.0)/2.0;
primary_info.z=(double) (MaxMap+1.0)/2.0;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ dynamic_number_threads(image->columns,1,1)
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
Mostly removal of a gamma function, but with a linear component
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ dynamic_number_threads(image->columns,1,1)
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
v;
v=(MagickRealType) i/(MagickRealType) MaxMap;
- if (((MagickRealType) i/(MagickRealType) MaxMap) <= 0.04045f)
+ if (((MagickRealType) i/(MagickRealType) MaxMap) <= 0.0404482362771082f)
v/=12.92f;
else
v=(MagickRealType) pow((((double) i/MaxMap)+0.055)/1.055,2.4);
Z = 0.0193339*R+0.1191920*G+0.9503041*B
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ dynamic_number_threads(image->columns,1,1)
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
primary_info.y=(double) (MaxMap+1.0)/2.0;
primary_info.z=(double) (MaxMap+1.0)/2.0;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ dynamic_number_threads(image->columns,1,1)
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
primary_info.y=(double) (MaxMap+1.0)/2.0;
primary_info.z=(double) (MaxMap+1.0)/2.0;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ dynamic_number_threads(image->columns,1,1)
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
primary_info.y=(double) (MaxMap+1.0)/2.0;
primary_info.z=(double) (MaxMap+1.0)/2.0;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ dynamic_number_threads(image->columns,1,1)
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
Linear conversion tables.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ dynamic_number_threads(image->columns,1,1)
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
*/
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ dynamic_number_threads(image->columns,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
const ColorspaceType colorspace,ExceptionInfo *exception)
{
image->colorspace=colorspace;
+ image->rendering_intent=UndefinedIntent;
+ image->gamma=1.000f;
+ ResetMagickMemory(&image->chromaticity,0,sizeof(image->chromaticity));
+ if (IssRGBColorspace(colorspace) != MagickFalse)
+ {
+ image->rendering_intent=PerceptualIntent;
+ image->gamma=1.000f/2.200f;
+ image->chromaticity.red_primary.x=0.6400f;
+ image->chromaticity.red_primary.y=0.3300f;
+ image->chromaticity.red_primary.z=0.0300f;
+ image->chromaticity.green_primary.x=0.3000f;
+ image->chromaticity.green_primary.y=0.6000f;
+ image->chromaticity.green_primary.z=0.1000f;
+ image->chromaticity.blue_primary.x=0.1500f;
+ image->chromaticity.blue_primary.y=0.0600f;
+ image->chromaticity.blue_primary.z=0.7900f;
+ image->chromaticity.white_point.x=0.3127f;
+ image->chromaticity.white_point.y=0.3290f;
+ image->chromaticity.white_point.z=0.3583f;
+ }
return(SyncImagePixelCache(image,exception));
}
\f
/*
Convert the reference image from an alternate colorspace to sRGB.
*/
- if ((colorspace == sRGBColorspace) || (colorspace == TransparentColorspace))
+ if (IssRGBColorspace(colorspace) != MagickFalse)
return(TransformsRGBImage(image,colorspace,exception));
status=MagickTrue;
+ if ((IsRGBColorspace(image->colorspace) != MagickFalse) ||
+ (IsGrayColorspace(image->colorspace) != MagickFalse))
+ status=TransformsRGBImage(image,sRGBColorspace,exception);
+ if (status == MagickFalse)
+ return(status);
if (IssRGBColorspace(image->colorspace) == MagickFalse)
status=TransformsRGBImage(image,image->colorspace,exception);
+ if (status == MagickFalse)
+ return(status);
/*
Convert the reference image from sRGB to an alternate colorspace.
*/
r=3.2404542*x-1.5371385*y-0.4985314*z;
g=(-0.9692660*x+1.8760108*y+0.0415560*z);
b=0.0556434*x-0.2040259*y+1.0572252*z;
- if (r > 0.0031308)
+ if (r > 0.00313066844250063)
r=1.055*pow(r,1.0/2.4)-0.055;
else
r*=12.92;
- if (g > 0.0031308)
+ if (g > 0.00313066844250063)
g=1.055*pow(g,1.0/2.4)-0.055;
else
g*=12.92;
- if (b > 0.0031308)
+ if (b > 0.00313066844250063)
b=1.055*pow(b,1.0/2.4)-0.055;
else
b*=12.92;
}
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ dynamic_number_threads(image->columns,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
GetPixelInfo(image,&zero);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ dynamic_number_threads(image->columns,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
}
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ dynamic_number_threads(image->columns,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
}
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ dynamic_number_threads(image->columns,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
}
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ dynamic_number_threads(image->columns,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
}
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ dynamic_number_threads(image->columns,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
return(MagickFalse);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ dynamic_number_threads(image->columns,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
through QuantumRange.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ dynamic_number_threads(image->columns,1,1)
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
through QuantumRange.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ dynamic_number_threads(image->columns,1,1)
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
through QuantumRange.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ dynamic_number_threads(image->columns,1,1)
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
B = 0.0*R+0.0*G+1.0*B
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ dynamic_number_threads(image->columns,1,1)
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
v;
v=(MagickRealType) i/(MagickRealType) MaxMap;
- if (((MagickRealType) i/(MagickRealType) MaxMap) <= 0.0031308)
+ if (((MagickRealType) i/(MagickRealType) MaxMap) <= 0.00313066844250063)
v*=12.92f;
else
v=(MagickRealType) (1.055*pow((double) i/MaxMap,1.0/2.4)-0.055);
B = 0.0556434*X-0.2040259*Y+1.057225*Z
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ dynamic_number_threads(image->columns,1,1)
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
YCC is scaled by 1.3584. C1 zero is 156 and C2 is at 137.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ dynamic_number_threads(image->columns,1,1)
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
through QuantumRange.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ dynamic_number_threads(image->columns,1,1)
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
through QuantumRange.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ dynamic_number_threads(image->columns,1,1)
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
through QuantumRange.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ dynamic_number_threads(image->columns,1,1)
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
Linear conversion tables.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static)
+ #pragma omp parallel for schedule(static) \
+ dynamic_number_threads(image->columns,1,1)
#endif
for (i=0; i <= (ssize_t) MaxMap; i++)
{
*/
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ dynamic_number_threads(image->columns,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
}
case RGBColorspace:
{
- if ((QuantumScale*pixel.red) <= 0.0031308)
+ if ((QuantumScale*pixel.red) <= 0.00313066844250063)
pixel.red*=12.92f;
else
pixel.red=(MagickRealType) QuantumRange*(1.055*pow(
QuantumScale*pixel.red,(1.0/2.4))-0.055);
- if ((QuantumScale*pixel.green) <= 0.0031308)
+ if ((QuantumScale*pixel.green) <= 0.00313066844250063)
pixel.green*=12.92f;
else
pixel.green=(MagickRealType) QuantumRange*(1.055*pow(
QuantumScale*pixel.green,(1.0/2.4))-0.055);
- if ((QuantumScale*pixel.blue) <= 0.0031308)
+ if ((QuantumScale*pixel.blue) <= 0.00313066844250063)
pixel.blue*=12.92f;
else
pixel.blue=(MagickRealType) QuantumRange*(1.055*pow(
default:
break;
}
- SetPixelRed(image,ScaleMapToQuantum((MagickRealType) MaxMap*
- QuantumScale*pixel.red),q);
- SetPixelGreen(image,ScaleMapToQuantum((MagickRealType) MaxMap*
- QuantumScale*pixel.green),q);
- SetPixelBlue(image,ScaleMapToQuantum((MagickRealType) MaxMap*
- QuantumScale*pixel.blue),q);
+ SetPixelRed(image,ScaleMapToQuantum(pixel.red),q);
+ SetPixelGreen(image,ScaleMapToQuantum(pixel.green),q);
+ SetPixelBlue(image,ScaleMapToQuantum(pixel.blue),q);
q+=GetPixelChannels(image);
}
sync=SyncCacheViewAuthenticPixels(image_view,exception);
Convert PseudoClass image.
*/
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ dynamic_number_threads(image->columns,1,1)
#endif
for (i=0; i < (ssize_t) image->colors; i++)
{
case YCCColorspace:
{
#if !defined(MAGICKCORE_HDRI_SUPPORT)
- image->colormap[i].red=(double) (QuantumRange*YCCMap[
- RoundToYCC(1024.0*QuantumScale*pixel.red)]);
- image->colormap[i].green=(double) (QuantumRange*YCCMap[
- RoundToYCC(1024.0*QuantumScale*pixel.green)]);
- image->colormap[i].blue=(double) (QuantumRange*YCCMap[
- RoundToYCC(1024.0*QuantumScale*pixel.blue)]);
+ pixel.red=QuantumRange*YCCMap[RoundToYCC(1024.0*QuantumScale*
+ pixel.red)];
+ pixel.green=QuantumRange*YCCMap[RoundToYCC(1024.0*QuantumScale*
+ pixel.green)];
+ pixel.blue=QuantumRange*YCCMap[RoundToYCC(1024.0*QuantumScale*
+ pixel.blue)];
#endif
break;
}
case RGBColorspace:
{
- if ((QuantumScale*pixel.red) <= 0.0031308)
+ if ((QuantumScale*pixel.red) <= 0.00313066844250063)
pixel.red*=12.92f;
else
pixel.red=(MagickRealType) QuantumRange*(1.055*
pow(QuantumScale*pixel.red,(1.0/2.4))-0.055);
- if ((QuantumScale*pixel.green) <= 0.0031308)
+ if ((QuantumScale*pixel.green) <= 0.00313066844250063)
pixel.green*=12.92f;
else
pixel.green=(MagickRealType) QuantumRange*(1.055*
pow(QuantumScale*pixel.green,(1.0/2.4))-0.055);
- if ((QuantumScale*pixel.blue) <= 0.0031308)
+ if ((QuantumScale*pixel.blue) <= 0.00313066844250063)
pixel.blue*=12.92f;
else
pixel.blue=(MagickRealType) QuantumRange*(1.055*
pow(QuantumScale*pixel.blue,(1.0/2.4))-0.055);
- break;
}
default:
- {
- image->colormap[i].red=(double) ScaleMapToQuantum((MagickRealType)
- MaxMap*QuantumScale*pixel.red);
- image->colormap[i].green=(double) ScaleMapToQuantum((MagickRealType)
- MaxMap*QuantumScale*pixel.green);
- image->colormap[i].blue=(double) ScaleMapToQuantum((MagickRealType)
- MaxMap*QuantumScale*pixel.blue);
break;
- }
}
+ image->colormap[i].red=(double) ScaleMapToQuantum(pixel.red);
+ image->colormap[i].green=(double) ScaleMapToQuantum(pixel.green);
+ image->colormap[i].blue=(double) ScaleMapToQuantum(pixel.blue);
}
(void) SyncImage(image,exception);
break;