]> granicus.if.org Git - imagemagick/commitdiff
M MagickCore/enhance.c
authorcristy <urban-warrior@git.imagemagick.org>
Sun, 5 May 2013 19:04:17 +0000 (19:04 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sun, 5 May 2013 19:04:17 +0000 (19:04 +0000)
M    MagickCore/colorspace.c

MagickCore/colorspace.c
MagickCore/enhance.c

index 5c9938df8a279356342cf54b546dd2a828daf873..a7dd6e31baf3b710475256b747e3b5c0684d683c 100644 (file)
@@ -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);
index 79a894cd98f6b04dafae987012a1ec967864bf09..d72338a60d60bb1f5ab25c1b5028ea4191146495 100644 (file)
@@ -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);