From: cristy Date: Sun, 5 May 2013 19:04:17 +0000 (+0000) Subject: M MagickCore/enhance.c X-Git-Tag: 7.0.1-0~3732 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=38e97388bb9ab2d86c7b6b99057c0b0a374dd028;p=imagemagick M MagickCore/enhance.c M MagickCore/colorspace.c --- diff --git a/MagickCore/colorspace.c b/MagickCore/colorspace.c index 5c9938df8..a7dd6e31b 100644 --- a/MagickCore/colorspace.c +++ b/MagickCore/colorspace.c @@ -190,14 +190,14 @@ static void ConvertRGBToYPbPr(const double red,const double green, assert(Pr != (double *) NULL); *Y=QuantumScale*(0.298839*red+0.586811*green+0.114350*blue); *Pb=QuantumScale*((-0.1687367)*red-0.331264*green+0.5*blue)+0.5; - *Pr=QuantumScale*(0.5*QuantumScale*red-0.418688*green-0.081312*blue)+0.5; + *Pr=QuantumScale*(0.5*red-0.418688*green-0.081312*blue)+0.5; } static void ConvertRGBToYCbCr(const double red,const double green, const double blue,double *Y,double *Cb,double *Cr) { /* - Convert RGB to -YCbCr colorspace. + Convert RGB to YCbCr colorspace. */ assert(Y != (double *) NULL); assert(Cb != (double *) NULL); @@ -1328,7 +1328,7 @@ static void ConvertYCbCrToRGB(const double Y,const double Cb, const double Cr,double *red,double *green,double *blue) { /* - Convert -YCbCr to RGB colorspace. + Convert YCbCr to RGB colorspace. */ assert(red != (double *) NULL); assert(green != (double *) NULL); diff --git a/MagickCore/enhance.c b/MagickCore/enhance.c index 79a894cd9..d72338a60 100644 --- a/MagickCore/enhance.c +++ b/MagickCore/enhance.c @@ -1748,7 +1748,7 @@ MagickExport MagickBooleanType EqualizeImage(Image *image, static inline double gamma_pow(const double value,const double gamma) { - return(value < 0.0 ? value : pow(value,1.0/gamma)); + return(value < 0.0 ? value : pow(value,gamma)); } MagickExport MagickBooleanType GammaImage(Image *image,const double gamma, @@ -1813,13 +1813,17 @@ MagickExport MagickBooleanType GammaImage(Image *image,const double gamma, ClampToQuantum(image->colormap[i].alpha))]; #else if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0) - image->colormap[i].red=gamma_pow(image->colormap[i].red,1.0/gamma); + image->colormap[i].red=QuantumRange*gamma_pow(QuantumScale* + image->colormap[i].red,1.0/gamma); if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0) - image->colormap[i].green=gamma_pow(image->colormap[i].green,1.0/gamma); + image->colormap[i].green=QuantumRange*gamma_pow(QuantumScale* + image->colormap[i].green,1.0/gamma); if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0) - image->colormap[i].blue=gamma_pow(image->colormap[i].blue,1.0/gamma); + image->colormap[i].blue=QuantumRange*gamma_pow(QuantumScale* + image->colormap[i].blue,1.0/gamma); if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) - image->colormap[i].alpha=gamma_pow(image->colormap[i].alpha,1.0/gamma); + image->colormap[i].alpha=QuantumRange*gamma_pow(QuantumScale* + image->colormap[i].alpha,1.0/gamma); #endif } /* @@ -1867,7 +1871,7 @@ MagickExport MagickBooleanType GammaImage(Image *image,const double gamma, #if !defined(MAGICKCORE_HDRI_SUPPORT) q[i]=gamma_map[ScaleQuantumToMap(q[i])]; #else - q[i]=gamma_pow((double) q[i],1.0/gamma); + q[i]=QuantumRange*gamma_pow(QuantumScale*q[i],1.0/gamma); #endif } q+=GetPixelChannels(image);