From: cristy Date: Sun, 10 Aug 2014 13:21:04 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~2110 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e22513c47799a2fc63e145f93c6ee03269767ba0;p=imagemagick --- diff --git a/MagickCore/statistic.c b/MagickCore/statistic.c index ca5d03d11..4bb3508bc 100644 --- a/MagickCore/statistic.c +++ b/MagickCore/statistic.c @@ -1380,6 +1380,26 @@ MagickExport MagickBooleanType GetImageMean(const Image *image,double *mean, % o exception: return any errors or warnings in this structure. % */ + +static size_t GetImageChannels(const Image *image) +{ + register ssize_t + i; + + size_t + channels; + + channels=0; + for (i=0; i < (ssize_t) GetPixelChannels(image); i++) + { + PixelChannel channel=GetPixelChannelChannel(image,i); + PixelTrait traits=GetPixelChannelTraits(image,channel); + if ((traits & UpdatePixelTrait) != 0) + channels++; + } + return(channels == 0 ? 1 : channels); +} + MagickExport ChannelMoments *GetImageMoments(const Image *image, ExceptionInfo *exception) { @@ -1560,17 +1580,17 @@ MagickExport ChannelMoments *GetImageMoments(const Image *image, p+=GetPixelChannels(image); } } - M00[MaxPixelChannels]/=GetPixelChannels(image); - M01[MaxPixelChannels]/=GetPixelChannels(image); - M02[MaxPixelChannels]/=GetPixelChannels(image); - M03[MaxPixelChannels]/=GetPixelChannels(image); - M10[MaxPixelChannels]/=GetPixelChannels(image); - M11[MaxPixelChannels]/=GetPixelChannels(image); - M12[MaxPixelChannels]/=GetPixelChannels(image); - M20[MaxPixelChannels]/=GetPixelChannels(image); - M21[MaxPixelChannels]/=GetPixelChannels(image); - M22[MaxPixelChannels]/=GetPixelChannels(image); - M30[MaxPixelChannels]/=GetPixelChannels(image); + M00[MaxPixelChannels]/=GetImageChannels(image); + M01[MaxPixelChannels]/=GetImageChannels(image); + M02[MaxPixelChannels]/=GetImageChannels(image); + M03[MaxPixelChannels]/=GetImageChannels(image); + M10[MaxPixelChannels]/=GetImageChannels(image); + M11[MaxPixelChannels]/=GetImageChannels(image); + M12[MaxPixelChannels]/=GetImageChannels(image); + M20[MaxPixelChannels]/=GetImageChannels(image); + M21[MaxPixelChannels]/=GetImageChannels(image); + M22[MaxPixelChannels]/=GetImageChannels(image); + M30[MaxPixelChannels]/=GetImageChannels(image); for (channel=0; channel <= MaxPixelChannels; channel++) { /* @@ -1912,26 +1932,6 @@ MagickExport MagickBooleanType GetImageRange(const Image *image,double *minima, % o exception: return any errors or warnings in this structure. % */ - -static size_t GetImageChannels(const Image *image) -{ - register ssize_t - i; - - size_t - channels; - - channels=0; - for (i=0; i < (ssize_t) GetPixelChannels(image); i++) - { - PixelChannel channel=GetPixelChannelChannel(image,i); - PixelTrait traits=GetPixelChannelTraits(image,channel); - if ((traits & UpdatePixelTrait) != 0) - channels++; - } - return(channels == 0 ? 1 : channels); -} - MagickExport ChannelStatistics *GetImageStatistics(const Image *image, ExceptionInfo *exception) {