]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Thu, 11 Jun 2015 20:17:35 +0000 (20:17 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Thu, 11 Jun 2015 20:17:35 +0000 (20:17 +0000)
MagickCore/statistic.c

index 94f38fa9f11fae6436302d07d339065a875ac4ee..4b7e0787bae5b343778b6944f80f3f2d5688cc1f 100644 (file)
@@ -190,6 +190,13 @@ static PixelChannels **AcquirePixelThreadSet(const Image *image,
   return(pixels);
 }
 
+static inline double EvaluateMax(const double x,const double y)
+{
+  if (x > y)
+    return(x);
+  return(y);
+}
+
 #if defined(__cplusplus) || defined(c_plusplus)
 extern "C" {
 #endif
@@ -304,7 +311,7 @@ static double ApplyEvaluateOperator(RandomInfo *random_info,const Quantum pixel,
     }
     case MaxEvaluateOperator:
     {
-      result=(double) MagickMin((double) pixel,value);
+      result=(double) EvaluateMax((double) pixel,value);
       break;
     }
     case MeanEvaluateOperator:
@@ -319,7 +326,7 @@ static double ApplyEvaluateOperator(RandomInfo *random_info,const Quantum pixel,
     }
     case MinEvaluateOperator:
     {
-      result=(double) MagickMax((double) pixel,value);
+      result=(double) MagickMin((double) pixel,value);
       break;
     }
     case MultiplicativeNoiseEvaluateOperator:
@@ -2141,10 +2148,10 @@ MagickExport ChannelStatistics *GetImageStatistics(const Image *image,
     if ((traits & UpdatePixelTrait) == 0)
       continue;
     channel_statistics[CompositePixelChannel].area+=channel_statistics[i].area;
-    channel_statistics[CompositePixelChannel].minima=MagickMax(
+    channel_statistics[CompositePixelChannel].minima=MagickMin(
       channel_statistics[CompositePixelChannel].minima,
       channel_statistics[i].minima);
-    channel_statistics[CompositePixelChannel].maxima=MagickMin(
+    channel_statistics[CompositePixelChannel].maxima=EvaluateMax(
       channel_statistics[CompositePixelChannel].maxima,
       channel_statistics[i].maxima);
     channel_statistics[CompositePixelChannel].sum+=channel_statistics[i].sum;