From 014ead1df2405e1d18615f2b9fd92e29c812fd31 Mon Sep 17 00:00:00 2001 From: cristy Date: Mon, 29 Apr 2013 08:47:36 +0000 Subject: [PATCH] --- MagickCore/colorspace.c | 372 ++++++++++++++++++++-------------------- MagickCore/delegate.c | 7 +- 2 files changed, 190 insertions(+), 189 deletions(-) diff --git a/MagickCore/colorspace.c b/MagickCore/colorspace.c index 2ff9d6846..c34754af9 100644 --- a/MagickCore/colorspace.c +++ b/MagickCore/colorspace.c @@ -129,9 +129,9 @@ static inline void ConvertXYZToLMS(const double x,const double y, assert(L != (double *) NULL); assert(M != (double *) NULL); assert(S != (double *) NULL); - l=0.7328f*x+0.4296f*y-0.1624f*z; - m=(-0.7036f*x+1.6975f*y+0.0061f*z); - s=0.0030f*x+0.0136f*y+0.9834f*z; + l=0.7328*x+0.4296*y-0.1624*z; + m=(-0.7036*x+1.6975*y+0.0061*z); + s=0.0030*x+0.0136*y+0.9834*z; *L=QuantumRange*l; *M=QuantumRange*m; *S=QuantumRange*s; @@ -890,10 +890,10 @@ static MagickBooleanType sRGBTransformImage(Image *image, } case LogColorspace: { -#define DisplayGamma (1.0f/1.7f) -#define FilmGamma 0.6f -#define ReferenceBlack 95.0f -#define ReferenceWhite 685.0f +#define DisplayGamma (1.0/1.7) +#define FilmGamma 0.6 +#define ReferenceBlack 95.0 +#define ReferenceWhite 685.0 const char *value; @@ -934,7 +934,7 @@ static MagickBooleanType sRGBTransformImage(Image *image, if (logmap == (Quantum *) NULL) ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed", image->filename); - black=pow(10.0,(reference_black-reference_white)*(gamma/density)*0.002f/ + 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,4) \ @@ -942,7 +942,7 @@ static MagickBooleanType sRGBTransformImage(Image *image, #endif for (i=0; i <= (ssize_t) MaxMap; i++) logmap[i]=ScaleMapToQuantum((double) (MaxMap*(reference_white+ - log10(black+(1.0*i/MaxMap)*(1.0-black))/((gamma/density)*0.002f/ + log10(black+(1.0*i/MaxMap)*(1.0-black))/((gamma/density)*0.002/ film_gamma))/1024.0)); image_view=AcquireAuthenticCacheView(image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) @@ -1225,23 +1225,23 @@ static MagickBooleanType sRGBTransformImage(Image *image, I and Q, normally -0.5 through 0.5, are normalized to the range 0 through QuantumRange. */ - primary_info.y=(double) (MaxMap+1.0f)/2.0f; - primary_info.z=(double) (MaxMap+1.0f)/2.0f; + 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,4) \ magick_threads(image,image,1,1) #endif for (i=0; i <= (ssize_t) MaxMap; i++) { - x_map[i].x=(MagickRealType) (0.33333f*(float) i); - y_map[i].x=(MagickRealType) (0.33334f*(float) i); - z_map[i].x=(MagickRealType) (0.33333f*(float) i); - x_map[i].y=(MagickRealType) (0.50000f*(float) i); - y_map[i].y=(MagickRealType) (0.00000f*(float) i); - z_map[i].y=(MagickRealType) (-0.50000f*(float) i); - x_map[i].z=(MagickRealType) (-0.25000f*(float) i); - y_map[i].z=(MagickRealType) (0.50000f*(float) i); - z_map[i].z=(MagickRealType) (-0.25000f*(float) i); + x_map[i].x=(MagickRealType) (0.33333*(double) i); + y_map[i].x=(MagickRealType) (0.33334*(double) i); + z_map[i].x=(MagickRealType) (0.33333*(double) i); + x_map[i].y=(MagickRealType) (0.50000*(double) i); + y_map[i].y=(MagickRealType) (0.00000*(double) i); + z_map[i].y=(MagickRealType) (-0.50000*(double) i); + x_map[i].z=(MagickRealType) (-0.25000*(double) i); + y_map[i].z=(MagickRealType) (0.50000*(double) i); + z_map[i].z=(MagickRealType) (-0.25000*(double) i); } break; } @@ -1258,23 +1258,23 @@ static MagickBooleanType sRGBTransformImage(Image *image, Cb and Cr, normally -0.5 through 0.5, are normalized to the range 0 through QuantumRange. */ - primary_info.y=(double) (MaxMap+1.0f)/2.0f; - primary_info.z=(double) (MaxMap+1.0f)/2.0f; + 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,4) \ magick_threads(image,image,1,1) #endif for (i=0; i <= (ssize_t) MaxMap; i++) { - x_map[i].x=(MagickRealType) (0.298839f*(float) i); - y_map[i].x=(MagickRealType) (0.586811f*(float) i); - z_map[i].x=(MagickRealType) (0.114350f*(float) i); - x_map[i].y=(MagickRealType) (-0.1687367f*(float) i); - y_map[i].y=(MagickRealType) (-0.331264f*(float) i); - z_map[i].y=(MagickRealType) (0.500000f*(float) i); - x_map[i].z=(MagickRealType) (0.500000f*(float) i); - y_map[i].z=(MagickRealType) (-0.418688f*(float) i); - z_map[i].z=(MagickRealType) (-0.081312f*(float) i); + x_map[i].x=(MagickRealType) (0.298839*(double) i); + y_map[i].x=(MagickRealType) (0.586811*(double) i); + z_map[i].x=(MagickRealType) (0.114350*(double) i); + x_map[i].y=(MagickRealType) (-0.1687367*(double) i); + y_map[i].y=(MagickRealType) (-0.331264*(double) i); + z_map[i].y=(MagickRealType) (0.500000*(double) i); + x_map[i].z=(MagickRealType) (0.500000*(double) i); + y_map[i].z=(MagickRealType) (-0.418688*(double) i); + z_map[i].z=(MagickRealType) (-0.081312*(double) i); } break; } @@ -1290,23 +1290,23 @@ static MagickBooleanType sRGBTransformImage(Image *image, Cb and Cr, normally -0.5 through 0.5, are normalized to the range 0 through QuantumRange. */ - primary_info.y=(double) (MaxMap+1.0f)/2.0f; - primary_info.z=(double) (MaxMap+1.0f)/2.0f; + 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,4) \ magick_threads(image,image,1,1) #endif for (i=0; i <= (ssize_t) MaxMap; i++) { - x_map[i].x=(MagickRealType) (0.212600f*(float) i); - y_map[i].x=(MagickRealType) (0.715200f*(float) i); - z_map[i].x=(MagickRealType) (0.072200f*(float) i); - x_map[i].y=(MagickRealType) (-0.114572f*(float) i); - y_map[i].y=(MagickRealType) (-0.385428f*(float) i); - z_map[i].y=(MagickRealType) (0.500000f*(float) i); - x_map[i].z=(MagickRealType) (0.500000f*(float) i); - y_map[i].z=(MagickRealType) (-0.454153f*(float) i); - z_map[i].z=(MagickRealType) (-0.045847f*(float) i); + x_map[i].x=(MagickRealType) (0.212600*(double) i); + y_map[i].x=(MagickRealType) (0.715200*(double) i); + z_map[i].x=(MagickRealType) (0.072200*(double) i); + x_map[i].y=(MagickRealType) (-0.114572*(double) i); + y_map[i].y=(MagickRealType) (-0.385428*(double) i); + z_map[i].y=(MagickRealType) (0.500000*(double) i); + x_map[i].z=(MagickRealType) (0.500000*(double) i); + y_map[i].z=(MagickRealType) (-0.454153*(double) i); + z_map[i].z=(MagickRealType) (-0.045847*(double) i); } break; } @@ -1315,15 +1315,15 @@ static MagickBooleanType sRGBTransformImage(Image *image, /* Initialize YCC tables: - Y = 0.298839f*R+0.586811f*G+0.114350f*B - C1= -0.298839f*R-0.586811f*G+0.88600*B - C2= 0.70100*R-0.586811f*G-0.114350f*B + Y = 0.298839*R+0.586811*G+0.114350*B + C1= -0.298839*R-0.586811*G+0.88600*B + C2= 0.70100*R-0.586811*G-0.114350*B YCC is scaled by 1.3584. C1 zero is 156 and C2 is at 137. */ primary_info.y=(double) ScaleQuantumToMap(ScaleCharToQuantum(156)); primary_info.z=(double) ScaleQuantumToMap(ScaleCharToQuantum(137)); - for (i=0; i <= (ssize_t) (0.018f*MaxMap); i++) + for (i=0; i <= (ssize_t) (0.018*MaxMap); i++) { x_map[i].x=0.003962014134275617*i; y_map[i].x=0.007778268551236748*i; @@ -1354,30 +1354,30 @@ static MagickBooleanType sRGBTransformImage(Image *image, /* Initialize YIQ tables: - Y = 0.298839f*R+0.586811f*G+0.114350f*B + Y = 0.298839*R+0.586811*G+0.114350*B I = 0.595716*R-0.274453*G-0.321263*B Q = 0.211456*R-0.522591*G+0.311135*B I and Q, normally -0.5 through 0.5, are normalized to the range 0 through QuantumRange. */ - primary_info.y=(double) (MaxMap+1.0f)/2.0f; - primary_info.z=(double) (MaxMap+1.0f)/2.0f; + 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,4) \ magick_threads(image,image,1,1) #endif for (i=0; i <= (ssize_t) MaxMap; i++) { - x_map[i].x=(MagickRealType) (0.298839f*(float) i); - y_map[i].x=(MagickRealType) (0.586811f*(float) i); - z_map[i].x=(MagickRealType) (0.114350f*(float) i); - x_map[i].y=(MagickRealType) (0.595716*(float) i); - y_map[i].y=(MagickRealType) (-0.274453f*(float) i); - z_map[i].y=(MagickRealType) (-0.321263f*(float) i); - x_map[i].z=(MagickRealType) (0.211456f*(float) i); - y_map[i].z=(MagickRealType) (-0.522591f*(float) i); - z_map[i].z=(MagickRealType) (0.311135f*(float) i); + x_map[i].x=(MagickRealType) (0.298839*(double) i); + y_map[i].x=(MagickRealType) (0.586811*(double) i); + z_map[i].x=(MagickRealType) (0.114350*(double) i); + x_map[i].y=(MagickRealType) (0.595716*(double) i); + y_map[i].y=(MagickRealType) (-0.274453*(double) i); + z_map[i].y=(MagickRealType) (-0.321263*(double) i); + x_map[i].z=(MagickRealType) (0.211456*(double) i); + y_map[i].z=(MagickRealType) (-0.522591*(double) i); + z_map[i].z=(MagickRealType) (0.311135*(double) i); } break; } @@ -1393,23 +1393,23 @@ static MagickBooleanType sRGBTransformImage(Image *image, Pb and Pr, normally -0.5 through 0.5, are normalized to the range 0 through QuantumRange. */ - primary_info.y=(double) (MaxMap+1.0f)/2.0f; - primary_info.z=(double) (MaxMap+1.0f)/2.0f; + 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,4) \ magick_threads(image,image,1,1) #endif for (i=0; i <= (ssize_t) MaxMap; i++) { - x_map[i].x=(MagickRealType) (0.298839f*(float) i); - y_map[i].x=(MagickRealType) (0.586811f*(float) i); - z_map[i].x=(MagickRealType) (0.114350f*(float) i); - x_map[i].y=(MagickRealType) (-0.1687367f*(float) i); - y_map[i].y=(MagickRealType) (-0.331264*(float) i); - z_map[i].y=(MagickRealType) (0.500000f*(float) i); - x_map[i].z=(MagickRealType) (0.500000f*(float) i); - y_map[i].z=(MagickRealType) (-0.418688f*(float) i); - z_map[i].z=(MagickRealType) (-0.081312f*(float) i); + x_map[i].x=(MagickRealType) (0.298839*(double) i); + y_map[i].x=(MagickRealType) (0.586811*(double) i); + z_map[i].x=(MagickRealType) (0.114350*(double) i); + x_map[i].y=(MagickRealType) (-0.1687367*(double) i); + y_map[i].y=(MagickRealType) (-0.331264*(double) i); + z_map[i].y=(MagickRealType) (0.500000*(double) i); + x_map[i].z=(MagickRealType) (0.500000*(double) i); + y_map[i].z=(MagickRealType) (-0.418688*(double) i); + z_map[i].z=(MagickRealType) (-0.081312*(double) i); } break; } @@ -1425,23 +1425,23 @@ static MagickBooleanType sRGBTransformImage(Image *image, U and V, normally -0.5 through 0.5, are normalized to the range 0 through QuantumRange. Note that U = 0.493*(B-Y), V = 0.877*(R-Y). */ - primary_info.y=(double) (MaxMap+1.0f)/2.0f; - primary_info.z=(double) (MaxMap+1.0f)/2.0f; + 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,4) \ magick_threads(image,image,1,1) #endif for (i=0; i <= (ssize_t) MaxMap; i++) { - x_map[i].x=(MagickRealType) (0.298839f*(float) i); - y_map[i].x=(MagickRealType) (0.586811f*(float) i); - z_map[i].x=(MagickRealType) (0.114350f*(float) i); - x_map[i].y=(MagickRealType) (-0.147130f*(float) i); - y_map[i].y=(MagickRealType) (-0.288860f*(float) i); - z_map[i].y=(MagickRealType) (0.436000f*(float) i); - x_map[i].z=(MagickRealType) (0.615000f*(float) i); - y_map[i].z=(MagickRealType) (-0.514990f*(float) i); - z_map[i].z=(MagickRealType) (-0.100001f*(float) i); + x_map[i].x=(MagickRealType) (0.298839*(double) i); + y_map[i].x=(MagickRealType) (0.586811*(double) i); + z_map[i].x=(MagickRealType) (0.114350*(double) i); + x_map[i].y=(MagickRealType) (-0.147130*(double) i); + y_map[i].y=(MagickRealType) (-0.288860*(double) i); + z_map[i].y=(MagickRealType) (0.436000*(double) i); + x_map[i].z=(MagickRealType) (0.615000*(double) i); + y_map[i].z=(MagickRealType) (-0.514990*(double) i); + z_map[i].z=(MagickRealType) (-0.100001*(double) i); } break; } @@ -1456,15 +1456,15 @@ static MagickBooleanType sRGBTransformImage(Image *image, #endif for (i=0; i <= (ssize_t) MaxMap; i++) { - x_map[i].x=(MagickRealType) (1.0*(float) i); - y_map[i].x=(MagickRealType) 0.0f; - z_map[i].x=(MagickRealType) 0.0f; - x_map[i].y=(MagickRealType) 0.0f; - y_map[i].y=(MagickRealType) (1.0*(float) i); - z_map[i].y=(MagickRealType) 0.0f; - x_map[i].z=(MagickRealType) 0.0f; - y_map[i].z=(MagickRealType) 0.0f; - z_map[i].z=(MagickRealType) (1.0*(float) i); + x_map[i].x=(MagickRealType) (1.0*(double) i); + y_map[i].x=(MagickRealType) 0.0; + z_map[i].x=(MagickRealType) 0.0; + x_map[i].y=(MagickRealType) 0.0; + y_map[i].y=(MagickRealType) (1.0*(double) i); + z_map[i].y=(MagickRealType) 0.0; + x_map[i].z=(MagickRealType) 0.0; + y_map[i].z=(MagickRealType) 0.0; + z_map[i].z=(MagickRealType) (1.0*(double) i); } break; } @@ -1629,35 +1629,35 @@ MagickExport MagickBooleanType SetImageColorspace(Image *image, return(MagickTrue); image->colorspace=colorspace; image->rendering_intent=UndefinedIntent; - image->gamma=1.000f; + image->gamma=1.000; (void) ResetMagickMemory(&image->chromaticity,0,sizeof(image->chromaticity)); if (IsGrayColorspace(colorspace) != MagickFalse) { if ((image->intensity != Rec601LuminancePixelIntensityMethod) && (image->intensity != Rec709LuminancePixelIntensityMethod) && (image->intensity != UndefinedPixelIntensityMethod)) - image->gamma=1.000f/2.200f; + image->gamma=1.000/2.200; image->type=GrayscaleType; } else if (IssRGBColorspace(colorspace) != MagickFalse) - image->gamma=1.000f/2.200f; - if (image->gamma == (1.000f/2.200f)) + image->gamma=1.000/2.200; + if (image->gamma == (1.000/2.200)) { 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; + image->gamma=1.000/2.200; + image->chromaticity.red_primary.x=0.6400; + image->chromaticity.red_primary.y=0.3300; + image->chromaticity.red_primary.z=0.0300; + image->chromaticity.green_primary.x=0.3000; + image->chromaticity.green_primary.y=0.6000; + image->chromaticity.green_primary.z=0.1000; + image->chromaticity.blue_primary.x=0.1500; + image->chromaticity.blue_primary.y=0.0600; + image->chromaticity.blue_primary.z=0.7900; + image->chromaticity.white_point.x=0.3127; + image->chromaticity.white_point.y=0.3290; + image->chromaticity.white_point.z=0.3583; } if (IsGrayColorspace(colorspace) != MagickFalse) image->type=GrayscaleType; @@ -1778,11 +1778,11 @@ static inline void ConvertLMSToXYZ(const double L,const double M,const double S, static inline ssize_t RoundToYCC(const double value) { - if (value <= 0.0f) + if (value <= 0.0) return(0); - if (value >= 1388.0f) + if (value >= 1388.0) return(1388); - return((ssize_t) (value+0.5f)); + return((ssize_t) (value+0.5)); } static inline void ConvertCMYKToRGB(PixelInfo *pixel) @@ -2822,13 +2822,13 @@ static MagickBooleanType TransformsRGBImage(Image *image, if (logmap == (Quantum *) NULL) ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed", image->filename); - black=pow(10.0,(reference_black-reference_white)*(gamma/density)*0.002f/ + black=pow(10.0,(reference_black-reference_white)*(gamma/density)*0.002/ film_gamma); - for (i=0; i <= (ssize_t) (reference_black*MaxMap/1024.0f); i++) + for (i=0; i <= (ssize_t) (reference_black*MaxMap/1024.0); i++) logmap[i]=(Quantum) 0; - for ( ; i < (ssize_t) (reference_white*MaxMap/1024.0f); i++) - logmap[i]=ClampToQuantum(QuantumRange/(1.0f-black)* - (pow(10.0,(1024.0*i/MaxMap-reference_white)*(gamma/density)*0.002f/ + for ( ; i < (ssize_t) (reference_white*MaxMap/1024.0); i++) + logmap[i]=ClampToQuantum(QuantumRange/(1.0-black)* + (pow(10.0,(1024.0*i/MaxMap-reference_white)*(gamma/density)*0.002/ film_gamma)-black)); for ( ; i <= (ssize_t) MaxMap; i++) logmap[i]=QuantumRange; @@ -3133,15 +3133,15 @@ static MagickBooleanType TransformsRGBImage(Image *image, #endif for (i=0; i <= (ssize_t) MaxMap; i++) { - x_map[i].x=(MagickRealType) (1.0f*(float) i); - y_map[i].x=(MagickRealType) (0.5f*(2.0f*(float) i-MaxMap)); - z_map[i].x=(MagickRealType) ((-0.333340f)*(2.0f*(float) i-MaxMap)); - x_map[i].y=(MagickRealType) (1.0f*(float) i); - y_map[i].y=(MagickRealType) 0.000000f; - z_map[i].y=(MagickRealType) (0.666665f*(2.0f*(float) i-MaxMap)); - x_map[i].z=(MagickRealType) (1.0f*(float) i); - y_map[i].z=(MagickRealType) (-0.500000f*(2.0f*(float) i-MaxMap)); - z_map[i].z=(MagickRealType) (-0.333340f*(2.0f*(float) i-MaxMap)); + x_map[i].x=(MagickRealType) (1.0*(double) i); + y_map[i].x=(MagickRealType) (0.5*(2.0*(double) i-MaxMap)); + z_map[i].x=(MagickRealType) ((-0.333340)*(2.0*(double) i-MaxMap)); + x_map[i].y=(MagickRealType) (1.0*(double) i); + y_map[i].y=(MagickRealType) 0.000000; + z_map[i].y=(MagickRealType) (0.666665*(2.0*(double) i-MaxMap)); + x_map[i].z=(MagickRealType) (1.0*(double) i); + y_map[i].z=(MagickRealType) (-0.500000*(2.0*(double) i-MaxMap)); + z_map[i].z=(MagickRealType) (-0.333340*(2.0*(double) i-MaxMap)); } break; } @@ -3164,15 +3164,15 @@ static MagickBooleanType TransformsRGBImage(Image *image, #endif for (i=0; i <= (ssize_t) MaxMap; i++) { - x_map[i].x=0.99999999999914679361f*(float) i; - y_map[i].x=(-1.2188941887145875e-06f)*(float) i; - z_map[i].x=0.5f*1.4019995886561440468f*(2.00f*(float) i-MaxMap); - x_map[i].y=0.99999975910502514331f*(float) i; - y_map[i].y=0.5f*(-0.34413567816504303521f)*(2.00f*(float) i-MaxMap); - z_map[i].y=0.5f*(-0.71413649331646789076f)*(2.00f*(float) i-MaxMap); - x_map[i].z=1.00000124040004623180f*(float) i; - y_map[i].z=0.5f*1.77200006607230409200f*(2.00f*(float) i-MaxMap); - z_map[i].z=2.1453384174593273e-06f*(float) i; + x_map[i].x=0.99999999999914679361*(double) i; + y_map[i].x=(-1.2188941887145875e-06)*(double) i; + z_map[i].x=0.5*1.4019995886561440468*(2.00*(double) i-MaxMap); + x_map[i].y=0.99999975910502514331*(double) i; + y_map[i].y=0.5*(-0.34413567816504303521)*(2.00*(double) i-MaxMap); + z_map[i].y=0.5*(-0.71413649331646789076)*(2.00*(double) i-MaxMap); + x_map[i].z=1.00000124040004623180*(double) i; + y_map[i].z=0.5*1.77200006607230409200*(2.00*(double) i-MaxMap); + z_map[i].z=2.1453384174593273e-06*(double) i; } break; } @@ -3194,15 +3194,15 @@ static MagickBooleanType TransformsRGBImage(Image *image, #endif for (i=0; i <= (ssize_t) MaxMap; i++) { - x_map[i].x=(MagickRealType) (1.0f*i); - y_map[i].x=(MagickRealType) (0.000000f*(2.0f*i-MaxMap)); - z_map[i].x=(MagickRealType) (0.5f*1.574800f*(2.0f*i-MaxMap)); - x_map[i].y=(MagickRealType) (1.0f*i); - y_map[i].y=(MagickRealType) (0.5f*(-0.187324f)*(2.0f*i-MaxMap)); - z_map[i].y=(MagickRealType) (0.5f*(-0.468124f)*(2.0f*i-MaxMap)); - x_map[i].z=(MagickRealType) (1.0f*i); - y_map[i].z=(MagickRealType) (0.5f*1.855600f*(2.0f*i-MaxMap)); - z_map[i].z=(MagickRealType) (0.000000f*(2.0f*i-MaxMap)); + x_map[i].x=(MagickRealType) (1.0*i); + y_map[i].x=(MagickRealType) (0.000000*(2.0*i-MaxMap)); + z_map[i].x=(MagickRealType) (0.5*1.574800*(2.0*i-MaxMap)); + x_map[i].y=(MagickRealType) (1.0*i); + y_map[i].y=(MagickRealType) (0.5*(-0.187324)*(2.0*i-MaxMap)); + z_map[i].y=(MagickRealType) (0.5*(-0.468124)*(2.0*i-MaxMap)); + x_map[i].z=(MagickRealType) (1.0*i); + y_map[i].z=(MagickRealType) (0.5*1.855600*(2.0*i-MaxMap)); + z_map[i].z=(MagickRealType) (0.000000*(2.0*i-MaxMap)); } break; } @@ -3223,19 +3223,19 @@ static MagickBooleanType TransformsRGBImage(Image *image, #endif for (i=0; i <= (ssize_t) MaxMap; i++) { - x_map[i].x=(MagickRealType) (1.3584000f*(float) i); - y_map[i].x=(MagickRealType) 0.0000000f; - z_map[i].x=(MagickRealType) (1.8215000f*(1.0f*(float) i-(double) + x_map[i].x=(MagickRealType) (1.3584000*(double) i); + y_map[i].x=(MagickRealType) 0.0000000; + z_map[i].x=(MagickRealType) (1.8215000*(1.0*(double) i-(double) ScaleQuantumToMap(ScaleCharToQuantum(137)))); - x_map[i].y=(MagickRealType) (1.3584000f*(float) i); - y_map[i].y=(MagickRealType) (-0.4302726f*(1.0f*(float) i-(double) + x_map[i].y=(MagickRealType) (1.3584000*(double) i); + y_map[i].y=(MagickRealType) (-0.4302726*(1.0*(double) i-(double) ScaleQuantumToMap(ScaleCharToQuantum(156)))); - z_map[i].y=(MagickRealType) (-0.9271435f*(1.0f*(float) i-(double) + z_map[i].y=(MagickRealType) (-0.9271435*(1.0*(double) i-(double) ScaleQuantumToMap(ScaleCharToQuantum(137)))); - x_map[i].z=(MagickRealType) (1.3584000f*(float) i); - y_map[i].z=(MagickRealType) (2.2179000f*(1.0f*(float) i-(double) + x_map[i].z=(MagickRealType) (1.3584000*(double) i); + y_map[i].z=(MagickRealType) (2.2179000*(1.0*(double) i-(double) ScaleQuantumToMap(ScaleCharToQuantum(156)))); - z_map[i].z=(MagickRealType) 0.0000000f; + z_map[i].z=(MagickRealType) 0.0000000; } break; } @@ -3257,15 +3257,15 @@ static MagickBooleanType TransformsRGBImage(Image *image, #endif for (i=0; i <= (ssize_t) MaxMap; i++) { - x_map[i].x=1.0f*(float) i; - y_map[i].x=0.5f*0.9562957197589482261f*(2.00000f*(float) i-MaxMap); - z_map[i].x=0.5f*0.6210244164652610754f*(2.00000f*(float) i-MaxMap); - x_map[i].y=1.0f*(float) i; - y_map[i].y=0.5f*(-0.2721220993185104464f)*(2.00000f*(float) i-MaxMap); - z_map[i].y=0.5f*(-0.6473805968256950427f)*(2.00000f*(float) i-MaxMap); - x_map[i].z=1.0f*(float) i; - y_map[i].z=0.5f*(-1.1069890167364901945f)*(2.00000f*(float) i-MaxMap); - z_map[i].z=0.5f*1.7046149983646481374f*(2.00000f*(float) i-MaxMap); + x_map[i].x=1.0*(double) i; + y_map[i].x=0.5*0.9562957197589482261*(2.00000*(double) i-MaxMap); + z_map[i].x=0.5*0.6210244164652610754*(2.00000*(double) i-MaxMap); + x_map[i].y=1.0*(double) i; + y_map[i].y=0.5*(-0.2721220993185104464)*(2.00000*(double) i-MaxMap); + z_map[i].y=0.5*(-0.6473805968256950427)*(2.00000*(double) i-MaxMap); + x_map[i].z=1.0*(double) i; + y_map[i].z=0.5*(-1.1069890167364901945)*(2.00000*(double) i-MaxMap); + z_map[i].z=0.5*1.7046149983646481374*(2.00000*(double) i-MaxMap); } break; } @@ -3287,15 +3287,15 @@ static MagickBooleanType TransformsRGBImage(Image *image, #endif for (i=0; i <= (ssize_t) MaxMap; i++) { - x_map[i].x=0.99999999999914679361f*(float) i; - y_map[i].x=(-1.2188941887145875e-06f)*(2.0f*(float) i-MaxMap); - z_map[i].x=0.5f*1.4019995886561440468f*(2.0f*(float) i-MaxMap); - x_map[i].y=0.99999975910502514331f*(float) i; - y_map[i].y=0.5f*(-0.34413567816504303521f)*(2.0f*(float) i-MaxMap); - z_map[i].y=0.5f*(-0.71413649331646789076f)*(2.0f*(float) i-MaxMap); - x_map[i].z=1.00000124040004623180f*(float) i; - y_map[i].z=0.5f*1.77200006607230409200f*(2.0f*(float) i-MaxMap); - z_map[i].z=2.1453384174593273e-06f*(2.0f*(float) i-MaxMap); + x_map[i].x=0.99999999999914679361*(double) i; + y_map[i].x=(-1.2188941887145875e-06)*(2.0*(double) i-MaxMap); + z_map[i].x=0.5*1.4019995886561440468*(2.0*(double) i-MaxMap); + x_map[i].y=0.99999975910502514331*(double) i; + y_map[i].y=0.5*(-0.34413567816504303521)*(2.0*(double) i-MaxMap); + z_map[i].y=0.5*(-0.71413649331646789076)*(2.0*(double) i-MaxMap); + x_map[i].z=1.00000124040004623180*(double) i; + y_map[i].z=0.5*1.77200006607230409200*(2.0*(double) i-MaxMap); + z_map[i].z=2.1453384174593273e-06*(2.0*(double) i-MaxMap); } break; } @@ -3317,15 +3317,15 @@ static MagickBooleanType TransformsRGBImage(Image *image, #endif for (i=0; i <= (ssize_t) MaxMap; i++) { - x_map[i].x=1.0f*(float) i; - y_map[i].x=(-3.945707070708279e-05f)*(2.0f*(float) i-MaxMap); - z_map[i].x=0.5f*1.1398279671717170825f*(2.0f*(float) i-MaxMap); - x_map[i].y=1.0f*(float) i; - y_map[i].y=0.5f*(-0.3946101641414141437f)*(2.0f*(float) i-MaxMap); - z_map[i].y=0.5f*(-0.5805003156565656797f)*(2.0f*(float) i-MaxMap); - x_map[i].z=1.0f*(float) i; - y_map[i].z=0.5f*2.0319996843434342537f*(2.0f*(float) i-MaxMap); - z_map[i].z=(-4.813762626262513e-04)*(2.0f*(float) i-MaxMap); + x_map[i].x=1.0*(double) i; + y_map[i].x=(-3.945707070708279e-05)*(2.0*(double) i-MaxMap); + z_map[i].x=0.5*1.1398279671717170825*(2.0*(double) i-MaxMap); + x_map[i].y=1.0*(double) i; + y_map[i].y=0.5*(-0.3946101641414141437)*(2.0*(double) i-MaxMap); + z_map[i].y=0.5*(-0.5805003156565656797)*(2.0*(double) i-MaxMap); + x_map[i].z=1.0*(double) i; + y_map[i].z=0.5*2.0319996843434342537*(2.0*(double) i-MaxMap); + z_map[i].z=(-4.813762626262513e-04)*(2.0*(double) i-MaxMap); } break; } @@ -3340,15 +3340,15 @@ static MagickBooleanType TransformsRGBImage(Image *image, #endif for (i=0; i <= (ssize_t) MaxMap; i++) { - x_map[i].x=(MagickRealType) (1.0*(float) i); + x_map[i].x=(MagickRealType) (1.0*(double) i); y_map[i].x=(MagickRealType) 0.0; z_map[i].x=(MagickRealType) 0.0; x_map[i].y=(MagickRealType) 0.0; - y_map[i].y=(MagickRealType) (1.0*(float) i); + y_map[i].y=(MagickRealType) (1.0*(double) i); z_map[i].y=(MagickRealType) 0.0; x_map[i].z=(MagickRealType) 0.0; y_map[i].z=(MagickRealType) 0.0; - z_map[i].z=(MagickRealType) (1.0*(float) i); + z_map[i].z=(MagickRealType) (1.0*(double) i); } break; } @@ -3407,11 +3407,11 @@ static MagickBooleanType TransformsRGBImage(Image *image, pixel.blue=x_map[red].z+y_map[green].z+z_map[blue].z; if (image->colorspace == YCCColorspace) { - pixel.red=QuantumRange*YCCMap[RoundToYCC(1024.0f*pixel.red/ + pixel.red=QuantumRange*YCCMap[RoundToYCC(1024.0*pixel.red/ (double) MaxMap)]; - pixel.green=QuantumRange*YCCMap[RoundToYCC(1024.0f*pixel.green/ + pixel.green=QuantumRange*YCCMap[RoundToYCC(1024.0*pixel.green/ (double) MaxMap)]; - pixel.blue=QuantumRange*YCCMap[RoundToYCC(1024.0f*pixel.blue/ + pixel.blue=QuantumRange*YCCMap[RoundToYCC(1024.0*pixel.blue/ (double) MaxMap)]; } else @@ -3475,11 +3475,11 @@ static MagickBooleanType TransformsRGBImage(Image *image, pixel.blue=x_map[red].z+y_map[green].z+z_map[blue].z; if (image->colorspace == YCCColorspace) { - pixel.red=QuantumRange*YCCMap[RoundToYCC(1024.0f*pixel.red/ + pixel.red=QuantumRange*YCCMap[RoundToYCC(1024.0*pixel.red/ (double) MaxMap)]; - pixel.green=QuantumRange*YCCMap[RoundToYCC(1024.0f*pixel.green/ + pixel.green=QuantumRange*YCCMap[RoundToYCC(1024.0*pixel.green/ (double) MaxMap)]; - pixel.blue=QuantumRange*YCCMap[RoundToYCC(1024.0f*pixel.blue/ + pixel.blue=QuantumRange*YCCMap[RoundToYCC(1024.0*pixel.blue/ (double) MaxMap)]; } else diff --git a/MagickCore/delegate.c b/MagickCore/delegate.c index c67ffe3e8..b601a8b8c 100644 --- a/MagickCore/delegate.c +++ b/MagickCore/delegate.c @@ -284,11 +284,12 @@ MagickExport char *GetDelegateCommand(const ImageInfo *image_info,Image *image, if (commands == (char **) NULL) { (void) ThrowMagickException(exception,GetMagickModule(), - ResourceLimitError,"MemoryAllocationFailed","`%s'", - decode ? decode : encode); + ResourceLimitError,"MemoryAllocationFailed","`%s'",decode ? decode : + encode); return((char *) NULL); } - command=InterpretImageProperties(image_info,image,commands[0],exception); + command=InterpretImageProperties((ImageInfo *) image_info,image,commands[0], + exception); if (command == (char *) NULL) (void) ThrowMagickException(exception,GetMagickModule(),ResourceLimitError, "MemoryAllocationFailed","`%s'",commands[0]); -- 2.40.0