212 #if !defined(__APPLE__) && !defined(TARGET_OS_IPHONE) 217 #define ErrorQueueLength 16 218 #define MaxNodes 266817 219 #define MaxTreeDepth 8 220 #define NodesInAList 1920 391 if (option != (
const char *) NULL)
396 return(quantize_info);
470 alpha_pixel->
red=(double) pixel->
red;
472 alpha_pixel->
blue=(double) pixel->
blue;
477 alpha_pixel->
red=alpha*pixel->
red;
479 alpha_pixel->
blue=alpha*pixel->
blue;
489 id=(size_t) (((ScaleQuantumToChar(
ClampPixel(pixel->
red)) >> index) & 0x01) |
490 ((ScaleQuantumToChar(
ClampPixel(pixel->
green)) >> index) & 0x01) << 1 |
491 ((ScaleQuantumToChar(
ClampPixel(pixel->
blue)) >> index) & 0x01) << 2);
493 id|=((ScaleQuantumToChar(
ClampPixel(pixel->
alpha)) >> index) & 0x1) << 3;
500 #define AssignImageTag "Assign/Image" 534 #if defined(MAGICKCORE_OPENMP_SUPPORT) 535 #pragma omp parallel for schedule(static) shared(status) \ 536 magick_number_threads(image,image,image->rows,1) 538 for (y=0; y < (ssize_t) image->
rows; y++)
562 for (x=0; x < (ssize_t) image->
columns; x+=count)
580 for (count=1; (x+count) < (ssize_t) image->
columns; count++)
591 for (index=
MaxTreeDepth-1; (ssize_t) index > 0; index--)
596 node_info=node_info->
child[id];
606 for (i=0; i < (ssize_t) count; i++)
756 #define ClassifyImageTag "Classify/Image" 806 for (y=0; y < (ssize_t) image->
rows; y++)
815 if (p == (
const Quantum *) NULL)
825 for (x=0; x < (ssize_t) image->
columns; x+=(ssize_t) count)
830 for (count=1; (x+(ssize_t) count) < (ssize_t) image->
columns; count++)
843 node_info=cube_info->
root;
851 mid.
red+=(
id & 1) != 0 ? bisect : -bisect;
852 mid.
green+=(
id & 2) != 0 ? bisect : -bisect;
853 mid.
blue+=(
id & 4) != 0 ? bisect : -bisect;
854 mid.
alpha+=(
id & 8) != 0 ? bisect : -bisect;
874 node_info=node_info->
child[id];
882 if (
IsNaN(distance) != 0)
913 for (y++; y < (ssize_t) image->
rows; y++)
922 if (p == (
const Quantum *) NULL)
932 for (x=0; x < (ssize_t) image->
columns; x+=(ssize_t) count)
937 for (count=1; (x+(ssize_t) count) < (ssize_t) image->
columns; count++)
950 node_info=cube_info->
root;
951 for (level=1; level <= cube_info->
depth; level++)
958 mid.
red+=(
id & 1) != 0 ? bisect : -bisect;
959 mid.
green+=(
id & 2) != 0 ? bisect : -bisect;
960 mid.
blue+=(
id & 4) != 0 ? bisect : -bisect;
961 mid.
alpha+=(
id & 8) != 0 ? bisect : -bisect;
975 if (level == cube_info->
depth)
981 node_info=node_info->
child[id];
989 if (
IsNaN(distance) != 0)
1108 for (i=0; i < (ssize_t) number_children; i++)
1139 pixel=alpha*p->red-beta*q->red;
1140 distance=pixel*pixel;
1141 if (distance <= cube_info->distance)
1143 pixel=alpha*p->green-beta*q->green;
1144 distance+=pixel*pixel;
1145 if (distance <= cube_info->distance)
1147 pixel=alpha*p->blue-beta*q->blue;
1148 distance+=pixel*pixel;
1149 if (distance <= cube_info->distance)
1153 pixel=p->alpha-q->alpha;
1154 distance+=pixel*pixel;
1156 if (distance <= cube_info->distance)
1199 assert(image != (
Image *) NULL);
1254 for (i=0; i < (ssize_t) number_children; i++)
1396 return(quantize_info);
1459 (void) memset(pixels,0,number_threads*
sizeof(*pixels));
1460 for (i=0; i < (ssize_t) number_threads; i++)
1473 #define RedShift(pixel) (((pixel) >> CacheShift) << (0*(8-CacheShift))) 1474 #define GreenShift(pixel) (((pixel) >> CacheShift) << (1*(8-CacheShift))) 1475 #define BlueShift(pixel) (((pixel) >> CacheShift) << (2*(8-CacheShift))) 1476 #define AlphaShift(pixel) (((pixel) >> CacheShift) << (3*(8-CacheShift))) 1492 #define DitherImageTag "Dither/Image" 1521 if (artifact != (
const char *) NULL)
1524 for (y=0; y < (ssize_t) image->
rows; y++)
1557 current=pixels[id]+(y & 0x01)*image->
columns;
1558 previous=pixels[
id]+((y+1) & 0x01)*image->
columns;
1559 v=(ssize_t) ((y & 0x01) != 0 ? -1 : 1);
1560 for (x=0; x < (ssize_t) image->
columns; x++)
1572 u=(y & 0x01) != 0 ? (ssize_t) image->
columns-1-x : x;
1576 pixel.
red+=7.0*amount*current[u-v].
red/16;
1577 pixel.
green+=7.0*amount*current[u-v].
green/16;
1578 pixel.
blue+=7.0*amount*current[u-v].
blue/16;
1580 pixel.
alpha+=7.0*amount*current[u-v].
alpha/16;
1584 if (x < (ssize_t) (image->
columns-1))
1586 pixel.
red+=previous[u+v].
red/16;
1592 pixel.
red+=5.0*amount*previous[u].
red/16;
1593 pixel.
green+=5.0*amount*previous[u].
green/16;
1594 pixel.
blue+=5.0*amount*previous[u].
blue/16;
1596 pixel.
alpha+=5.0*amount*previous[u].
alpha/16;
1599 pixel.
red+=3.0*amount*previous[u-v].
red/16;
1600 pixel.
green+=3.0*amount*previous[u-v].
green/16;
1601 pixel.
blue+=3.0*amount*previous[u-v].
blue/16;
1603 pixel.
alpha+=3.0*amount*previous[u-v].
alpha/16;
1612 if (cube.
cache[i] < 0)
1623 node_info=cube.
root;
1624 for (index=
MaxTreeDepth-1; (ssize_t) index > 0; index--)
1629 node_info=node_info->
child[node_id];
1643 index=(size_t) cube.
cache[i];
1691 const size_t level,
const unsigned int direction,
ExceptionInfo *exception)
1822 #define DitherImageTag "Dither/Image" 1838 if ((p->
x >= 0) && (p->
x < (ssize_t) image->
columns) &&
1839 (p->
y >= 0) && (p->
y < (ssize_t) image->
rows))
1868 if (p->
cache[i] < 0)
1880 for (index=
MaxTreeDepth-1; (ssize_t) index > 0; index--)
1885 node_info=node_info->
child[id];
1899 index=(size_t) p->
cache[i];
1916 sizeof(p->
error[0]));
1962 for (depth=1; i != 0; depth++)
2011 const size_t depth,
const size_t maximum_colors)
2030 if (cube_info == (
CubeInfo *) NULL)
2032 (void) memset(cube_info,0,
sizeof(*cube_info));
2033 cube_info->
depth=depth;
2036 if (cube_info->
depth < 2)
2060 (void) memset(cube_info->
cache,(-1),
sizeof(*cube_info->
cache)*length);
2075 weight+=cube_info->
weights[i];
2079 cube_info->
weights[i]/=weight;
2082 cube_info->
weights[0]+=1.0-sum;
2115 const size_t level,
NodeInfo *parent)
2129 if (nodes == (
Nodes *) NULL)
2132 sizeof(*nodes->
nodes));
2143 (void) memset(node_info,0,
sizeof(*node_info));
2144 node_info->
parent=parent;
2146 node_info->
level=level;
2205 mean_error_per_pixel;
2211 assert(image != (
Image *) NULL);
2216 (void) memset(&image->
error,0,
sizeof(image->
error));
2223 mean_error_per_pixel=0.0;
2226 for (y=0; y < (ssize_t) image->
rows; y++)
2235 if (p == (
const Quantum *) NULL)
2237 for (x=0; x < (ssize_t) image->
columns; x++)
2245 distance=fabs((
double) (alpha*
GetPixelRed(image,p)-beta*
2247 mean_error_per_pixel+=distance;
2248 mean_error+=distance*distance;
2249 if (distance > maximum_error)
2250 maximum_error=distance;
2253 mean_error_per_pixel+=distance;
2254 mean_error+=distance*distance;
2255 if (distance > maximum_error)
2256 maximum_error=distance;
2257 distance=fabs((
double) (alpha*
GetPixelBlue(image,p)-beta*
2259 mean_error_per_pixel+=distance;
2260 mean_error+=distance*distance;
2261 if (distance > maximum_error)
2262 maximum_error=distance;
2300 (void) memset(quantize_info,0,
sizeof(*quantize_info));
2364 return(kmeans_info);
2380 sizeof(*kmeans_info));
2383 (void) memset(kmeans_info,0,number_threads*
sizeof(*kmeans_info));
2384 for (i=0; i < (ssize_t) number_threads; i++)
2387 sizeof(**kmeans_info));
2391 return(kmeans_info);
2409 metric+=pixel*pixel;
2418 metric+=gamma*pixel*pixel;
2426 if (fabs((
double) pixel) > 0.5)
2430 metric+=gamma*pixel*pixel;
2432 metric+=gamma*pixel*pixel;
2434 metric+=gamma*pixel*pixel;
2439 const size_t number_colors,
const size_t max_iterations,
const double tolerance,
2442 #define KmeansImageTag "Kmeans/Image" 2443 #define RandomColorComponent(info) (QuantumRange*GetPseudoRandomValue(info)) 2467 assert(image != (
Image *) NULL);
2474 if (colors == (
const char *) NULL)
2493 colors=number_colors;
2494 for (depth=1; colors != 0; depth++)
2496 cube_info=
GetCubeInfo(quantize_info,depth,number_colors);
2497 if (cube_info == (
CubeInfo *) NULL)
2529 for (n=0, p=colors; n < (ssize_t) image->
colors; n++)
2534 for (q=p; *q !=
'\0'; q++)
2548 if (n < (ssize_t) image->
colors)
2557 for ( ; n < (ssize_t) image->
colors; n++)
2579 previous_tolerance=0.0;
2583 for (n=0; n < (ssize_t) max_iterations; n++)
2594 for (i=0; i < (ssize_t) number_threads; i++)
2595 (
void) memset(kmeans_pixels[i],0,image->
colors*
sizeof(*kmeans_pixels[i]));
2596 #if defined(MAGICKCORE_OPENMP_SUPPORT) 2597 #pragma omp parallel for schedule(dynamic) shared(status) \ 2598 magick_number_threads(image,image,image->rows,1) 2600 for (y=0; y < (ssize_t) image->
rows; y++)
2619 for (x=0; x < (ssize_t) image->
columns; x++)
2635 for (i=1; i < (ssize_t) image->
colors; i++)
2643 if (distance < min_distance)
2645 min_distance=distance;
2656 kmeans_pixels[id][j].
count++;
2657 kmeans_pixels[id][j].
distortion+=min_distance;
2669 for (i=1; i < (ssize_t) number_threads; i++)
2674 for (j=0; j < (ssize_t) image->
colors; j++)
2676 kmeans_pixels[0][j].
red+=kmeans_pixels[i][j].
red;
2677 kmeans_pixels[0][j].
green+=kmeans_pixels[i][j].
green;
2678 kmeans_pixels[0][j].
blue+=kmeans_pixels[i][j].
blue;
2680 kmeans_pixels[0][j].
alpha+=kmeans_pixels[i][j].
alpha;
2682 kmeans_pixels[0][j].
black+=kmeans_pixels[i][j].
black;
2683 kmeans_pixels[0][j].
count+=kmeans_pixels[i][j].
count;
2691 for (i=0; i < (ssize_t) image->
colors; i++)
2709 fabs(distortion-previous_tolerance));
2710 if (fabs(distortion-previous_tolerance) <= tolerance)
2712 previous_tolerance=distortion;
2728 max_iterations-1,max_iterations);
2772 if ((x-floor(x)) < (ceil(x)-x))
2780 #define PosterizeImageTag "Posterize/Image" 2781 #define PosterizePixel(pixel) ClampToQuantum((MagickRealType) QuantumRange*( \ 2782 MagickRound(QuantumScale*pixel*(levels-1)))/MagickMax((ssize_t) levels-1,1)) 2802 assert(image != (
Image *) NULL);
2809 #if defined(MAGICKCORE_OPENMP_SUPPORT) 2810 #pragma omp parallel for schedule(static) shared(progress,status) \ 2811 magick_number_threads(image,image,image->colors,1) 2813 for (i=0; i < (ssize_t) image->
colors; i++)
2837 #if defined(MAGICKCORE_OPENMP_SUPPORT) 2838 #pragma omp parallel for schedule(static) shared(progress,status) \ 2839 magick_number_threads(image,image,image->rows,1) 2841 for (y=0; y < (ssize_t) image->
rows; y++)
2857 for (x=0; x < (ssize_t) image->
columns; x++)
2880 #if defined(MAGICKCORE_OPENMP_SUPPORT) 2940 for (i=0; i < (ssize_t) number_children; i++)
2946 parent=node_info->
parent;
2993 for (i=0; i < (ssize_t) number_children; i++)
3038 for (i=0; i < (ssize_t) number_children; i++)
3090 assert(image != (
Image *) NULL);
3097 if (maximum_colors == 0)
3115 colors=maximum_colors;
3116 for (depth=1; colors != 0; depth++)
3128 cube_info=
GetCubeInfo(quantize_info,depth,maximum_colors);
3129 if (cube_info == (
CubeInfo *) NULL)
3202 assert(images != (
Image *) NULL);
3218 if (maximum_colors == 0)
3231 colors=maximum_colors;
3232 for (depth=1; colors != 0; depth++)
3240 cube_info=
GetCubeInfo(quantize_info,depth,maximum_colors);
3241 if (cube_info == (
CubeInfo *) NULL)
3249 for (i=0; image != (
Image *) NULL; i++)
3270 for (i=0; image != (
Image *) NULL; i++)
3324 const NodeInfo *node_info,
const ssize_t offset,
double *quantize_error)
3333 if (offset >= (ssize_t) cube_info->
nodes)
3338 for (i=0; i < (ssize_t) number_children ; i++)
3382 for (i=0; i < (ssize_t) number_children; i++)
3460 p=(
double *) error_p;
3461 q=(
double *) error_q;
3471 #define ReduceImageTag "Reduce/Image" 3492 sizeof(*quantize_error));
3493 if (quantize_error != (
double *) NULL)
3497 qsort(quantize_error,cube_info->
nodes,
sizeof(
double),
3561 assert(image != (
Image *) NULL);
3565 assert(remap_image != (
Image *) NULL);
3571 if (cube_info == (
CubeInfo *) NULL)
3629 assert(images != (
Image *) NULL);
3636 if (remap_image == (
Image *) NULL)
3649 if (cube_info == (
CubeInfo *) NULL)
3697 #if defined(__cplusplus) || defined(c_plusplus) 3714 if (intensity < (
double) INT_MIN)
3715 intensity=(double) INT_MIN;
3716 if (intensity > (
double) INT_MAX)
3717 intensity=(
double) INT_MAX;
3718 return((
int) intensity);
3721 #if defined(__cplusplus) || defined(c_plusplus) 3748 assert(image != (
Image *) NULL);
3754 sizeof(*colormap_index));
3755 if (colormap_index == (ssize_t *) NULL)
3760 (void) memset(colormap_index,(-1),extent*
sizeof(*colormap_index));
3770 #if defined(MAGICKCORE_OPENMP_SUPPORT) 3771 #pragma omp parallel for schedule(static) shared(status) \ 3772 magick_number_threads(image,image,image->rows,1) 3774 for (y=0; y < (ssize_t) image->
rows; y++)
3791 for (x=0; x < (ssize_t) image->
columns; x++)
3796 intensity=ScaleQuantumToMap(
GetPixelRed(image,q));
3797 if (colormap_index[intensity] < 0)
3799 #if defined(MAGICKCORE_OPENMP_SUPPORT) 3800 #pragma omp critical (MagickCore_SetGrayscaleImage) 3802 if (colormap_index[intensity] < 0)
3804 colormap_index[intensity]=(ssize_t) image->
colors;
3822 (void) memset(colormap_index,0,extent*
sizeof(*colormap_index));
3823 for (i=0; i < (ssize_t) image->
colors; i++)
3836 for (i=0; i < (ssize_t) image->
colors; i++)
3845 image->
colors=(size_t) (j+1);
3850 #if defined(MAGICKCORE_OPENMP_SUPPORT) 3851 #pragma omp parallel for schedule(static) shared(status) \ 3852 magick_number_threads(image,image,image->rows,1) 3854 for (y=0; y < (ssize_t) image->
rows; y++)
3870 for (x=0; x < (ssize_t) image->
columns; x++)
3929 if (image->
colors != number_colors)
MagickExport MagickBooleanType CompressImageColormap(Image *image, ExceptionInfo *exception)
MagickBooleanType associate_alpha
MagickDoubleType MagickRealType
MagickExport CacheView * DestroyCacheView(CacheView *cache_view)
MagickExport MemoryInfo * RelinquishVirtualMemory(MemoryInfo *memory_info)
MagickProgressMonitor progress_monitor
static PixelTrait GetPixelBlackTraits(const Image *magick_restrict image)
MagickExport MagickBooleanType SyncImage(Image *image, ExceptionInfo *exception)
static Quantum GetPixelAlpha(const Image *magick_restrict image, const Quantum *magick_restrict pixel)
static PixelTrait GetPixelRedTraits(const Image *magick_restrict image)
MagickExport MagickBooleanType TransformImageColorspace(Image *image, const ColorspaceType colorspace, ExceptionInfo *exception)
static PixelTrait GetPixelAlphaTraits(const Image *magick_restrict image)
MagickExport MagickBooleanType PosterizeImage(Image *image, const size_t levels, const DitherMethod dither_method, ExceptionInfo *exception)
static Quantum GetPixelRed(const Image *magick_restrict image, const Quantum *magick_restrict pixel)
ColorspaceType colorspace
#define RandomColorComponent(info)
MagickExport ssize_t ParseCommandOption(const CommandOption option, const MagickBooleanType list, const char *options)
static size_t QuantizeErrorFlatten(const CubeInfo *cube_info, const NodeInfo *node_info, const ssize_t offset, double *quantize_error)
MagickExport MemoryInfo * AcquireVirtualMemory(const size_t count, const size_t quantum)
static void DestroyCubeInfo(CubeInfo *)
static MagickBooleanType DitherImage(Image *, CubeInfo *, ExceptionInfo *)
MagickExport QuantizeInfo * DestroyQuantizeInfo(QuantizeInfo *quantize_info)
MagickExport const char * GetImageArtifact(const Image *image, const char *artifact)
QuantizeInfo * quantize_info
double mean_error_per_pixel
static KmeansInfo ** AcquireKmeansThreadSet(const size_t number_colors)
struct _CubeInfo CubeInfo
MagickExport size_t CopyMagickString(char *magick_restrict destination, const char *magick_restrict source, const size_t length)
MagickExport const Quantum * GetCacheViewVirtualPixels(const CacheView *cache_view, const ssize_t x, const ssize_t y, const size_t columns, const size_t rows, ExceptionInfo *exception)
static void Reduce(CubeInfo *cube_info, const NodeInfo *node_info)
MagickBooleanType verbose
MagickExport const char * GetImageOption(const ImageInfo *image_info, const char *option)
#define PosterizeImageTag
MagickExport void * ResizeQuantumMemory(void *memory, const size_t count, const size_t quantum)
static MagickBooleanType RiemersmaDither(Image *, CacheView *, CubeInfo *, const unsigned int, ExceptionInfo *)
static NodeInfo * GetNodeInfo(CubeInfo *, const size_t, const size_t, NodeInfo *)
#define ThrowBinaryException(severity, tag, context)
static Quantum ClampToQuantum(const MagickRealType quantum)
static MagickBooleanType IsPixelInfoEquivalent(const PixelInfo *magick_restrict p, const PixelInfo *magick_restrict q)
MagickExport RandomInfo * DestroyRandomInfo(RandomInfo *random_info)
MagickExport MagickBooleanType SetImageGray(Image *image, ExceptionInfo *exception)
static MagickBooleanType IsPixelEquivalent(const Image *magick_restrict image, const Quantum *magick_restrict p, const PixelInfo *magick_restrict q)
#define MagickCoreSignature
double normalized_mean_error
MagickExport Quantum * GetCacheViewAuthenticPixels(CacheView *cache_view, const ssize_t x, const ssize_t y, const size_t columns, const size_t rows, ExceptionInfo *exception)
static Quantum ClampPixel(const MagickRealType pixel)
#define AlphaShift(pixel)
static void Riemersma(Image *image, CacheView *image_view, CubeInfo *cube_info, const size_t level, const unsigned int direction, ExceptionInfo *exception)
static MagickBooleanType IsHueCompatibleColorspace(const ColorspaceType colorspace)
MagickExport MagickBooleanType RemapImages(const QuantizeInfo *quantize_info, Image *images, const Image *remap_image, ExceptionInfo *exception)
static MagickBooleanType FloydSteinbergDither(Image *image, CubeInfo *cube_info, ExceptionInfo *exception)
MagickExport ssize_t FormatLocaleFile(FILE *file, const char *magick_restrict format,...)
static double PerceptibleReciprocal(const double x)
double weights[ErrorQueueLength]
DoublePixelPacket total_color
struct _KmeansInfo KmeansInfo
static void PruneChild(CubeInfo *cube_info, const NodeInfo *node_info)
MagickExport void * AcquireCriticalMemory(const size_t size)
static MagickBooleanType IssRGBCompatibleColorspace(const ColorspaceType colorspace)
MagickExport void * AcquireQuantumMemory(const size_t count, const size_t quantum)
MagickExport MagickBooleanType QuantizeImages(const QuantizeInfo *quantize_info, Image *images, ExceptionInfo *exception)
static int GetOpenMPThreadId(void)
static CubeInfo * GetCubeInfo(const QuantizeInfo *, const size_t, const size_t)
static Quantum GetPixelGreen(const Image *magick_restrict image, const Quantum *magick_restrict pixel)
MagickExport MagickBooleanType IsStringTrue(const char *value)
static void GetPixelInfoPixel(const Image *magick_restrict image, const Quantum *magick_restrict pixel, PixelInfo *magick_restrict pixel_info)
MagickExport int GetMagickPrecision(void)
MagickExport void GetQuantizeInfo(QuantizeInfo *quantize_info)
static Quantum GetPixelIndex(const Image *magick_restrict image, const Quantum *magick_restrict pixel)
MagickSizeType transparent_pixels
static double MagickRound(double x)
static Quantum GetPixelBlack(const Image *magick_restrict image, const Quantum *magick_restrict pixel)
struct _NodeInfo * child[16]
MagickExport MagickRealType GetPixelInfoIntensity(const Image *magick_restrict image, const PixelInfo *magick_restrict pixel)
MagickExport MagickBooleanType RemapImage(const QuantizeInfo *quantize_info, Image *image, const Image *remap_image, ExceptionInfo *exception)
MagickExport MagickBooleanType ThrowMagickException(ExceptionInfo *exception, const char *module, const char *function, const size_t line, const ExceptionType severity, const char *tag, const char *format,...)
static void AssociateAlphaPixelInfo(const CubeInfo *cube_info, const PixelInfo *pixel, DoublePixelPacket *alpha_pixel)
MagickExport MagickBooleanType LogMagickEvent(const LogEventType type, const char *module, const char *function, const size_t line, const char *format,...)
MagickExport MagickBooleanType QuantizeImage(const QuantizeInfo *quantize_info, Image *image, ExceptionInfo *exception)
MagickExport MagickBooleanType GetImageQuantizeError(Image *image, ExceptionInfo *exception)
ssize_t transparent_index
static void PruneLevel(CubeInfo *, const NodeInfo *)
MagickExport RandomInfo * AcquireRandomInfo(void)
MagickExport MagickSizeType GetMagickResourceLimit(const ResourceType type)
static DoublePixelPacket ** DestroyPixelThreadSet(DoublePixelPacket **pixels)
MagickBooleanType(* MagickProgressMonitor)(const char *, const MagickOffsetType, const MagickSizeType, void *)
static DoublePixelPacket ** AcquirePixelThreadSet(const size_t count)
struct _NodeInfo * parent
static PixelTrait GetPixelGreenTraits(const Image *magick_restrict image)
MagickExport MagickBooleanType QueryColorCompliance(const char *name, const ComplianceType compliance, PixelInfo *color, ExceptionInfo *exception)
static void SetPixelBlue(const Image *magick_restrict image, const Quantum blue, Quantum *magick_restrict pixel)
MagickExport MagickProgressMonitor SetImageProgressMonitor(Image *image, const MagickProgressMonitor progress_monitor, void *client_data)
MagickSizeType number_unique
static size_t GetPixelChannels(const Image *magick_restrict image)
MagickExport MagickBooleanType AcquireImageColormap(Image *image, const size_t colors, ExceptionInfo *exception)
MagickExport MagickBooleanType IsPaletteImage(const Image *image)
MagickExport QuantizeInfo * AcquireQuantizeInfo(const ImageInfo *image_info)
static MagickBooleanType AssignImageColors(Image *, CubeInfo *, ExceptionInfo *)
char filename[MagickPathExtent]
#define GetMagickModule()
NodeInfo nodes[NodesInAList]
MagickExport size_t GetNumberColors(const Image *image, FILE *file, ExceptionInfo *exception)
MagickExport CacheView * AcquireVirtualCacheView(const Image *image, ExceptionInfo *exception)
static double StringToDoubleInterval(const char *string, const double interval)
static int IntensityCompare(const void *x, const void *y)
DitherMethod dither_method
double normalized_maximum_error
struct _NodeInfo NodeInfo
DoublePixelPacket error[ErrorQueueLength]
static size_t ColorToNodeId(const CubeInfo *cube_info, const DoublePixelPacket *pixel, size_t index)
MagickExport Image * GetNextImageInList(const Image *images)
MagickExport void * AcquireMagickMemory(const size_t size)
MagickExport QuantizeInfo * CloneQuantizeInfo(const QuantizeInfo *quantize_info)
static void SetPixelIndex(const Image *magick_restrict image, const Quantum index, Quantum *magick_restrict pixel)
static MagickBooleanType SetGrayscaleImage(Image *, ExceptionInfo *)
static MagickBooleanType ClassifyImageColors(CubeInfo *, const Image *, ExceptionInfo *)
MagickBooleanType measure_error
static int QuantizeErrorCompare(const void *error_p, const void *error_q)
static void SetPixelAlpha(const Image *magick_restrict image, const Quantum alpha, Quantum *magick_restrict pixel)
static void DefineImageColormap(Image *, CubeInfo *, NodeInfo *)
static RandomInfo * random_info
MagickExport void * RelinquishMagickMemory(void *memory)
MagickExport MagickBooleanType KmeansImage(Image *image, const size_t number_colors, const size_t max_iterations, const double tolerance, ExceptionInfo *exception)
static void AssociateAlphaPixel(const Image *image, const CubeInfo *cube_info, const Quantum *pixel, DoublePixelPacket *alpha_pixel)
static void SetPixelRed(const Image *magick_restrict image, const Quantum red, Quantum *magick_restrict pixel)
static ssize_t CacheOffset(CubeInfo *cube_info, const DoublePixelPacket *pixel)
static void ReduceImageColors(const Image *, CubeInfo *)
static MagickRealType GetPixelInfoLuma(const PixelInfo *magick_restrict pixel)
MagickExport MagickBooleanType SyncCacheViewAuthenticPixels(CacheView *magick_restrict cache_view, ExceptionInfo *exception)
MagickExport CacheView * AcquireAuthenticCacheView(const Image *image, ExceptionInfo *exception)
MagickExport MagickBooleanType SetImageMonochrome(Image *image, ExceptionInfo *exception)
static void PruneToCubeDepth(CubeInfo *, const NodeInfo *)
static void SetPixelBlack(const Image *magick_restrict image, const Quantum black, Quantum *magick_restrict pixel)
static KmeansInfo ** DestroyKmeansThreadSet(KmeansInfo **kmeans_info)
static Quantum GetPixelBlue(const Image *magick_restrict image, const Quantum *magick_restrict pixel)
static MagickBooleanType SetImageColormap(Image *, CubeInfo *, ExceptionInfo *)
MagickExport void * GetVirtualMemoryBlob(const MemoryInfo *memory_info)
#define PosterizePixel(pixel)
MagickExport size_t GetImageListLength(const Image *images)
struct _DoublePixelPacket DoublePixelPacket
static void SetAssociatedAlpha(const Image *image, CubeInfo *cube_info)
static double KmeansMetric(const Image *magick_restrict image, const Quantum *magick_restrict p, const PixelInfo *magick_restrict q)
ColorspaceType colorspace
MagickExport MagickBooleanType SetImageProgress(const Image *image, const char *tag, const MagickOffsetType offset, const MagickSizeType extent)
static void ClosestColor(const Image *, CubeInfo *, const NodeInfo *)
#define GreenShift(pixel)
static void SetPixelGreen(const Image *magick_restrict image, const Quantum green, Quantum *magick_restrict pixel)
static PixelTrait GetPixelBlueTraits(const Image *magick_restrict image)