quantize.c File Reference

#include "magick/studio.h"
#include "magick/artifact.h"
#include "magick/attribute.h"
#include "magick/cache-view.h"
#include "magick/color.h"
#include "magick/color-private.h"
#include "magick/colormap.h"
#include "magick/colorspace.h"
#include "magick/colorspace-private.h"
#include "magick/enhance.h"
#include "magick/exception.h"
#include "magick/exception-private.h"
#include "magick/histogram.h"
#include "magick/image.h"
#include "magick/image-private.h"
#include "magick/list.h"
#include "magick/memory_.h"
#include "magick/monitor.h"
#include "magick/monitor-private.h"
#include "magick/option.h"
#include "magick/pixel-private.h"
#include "magick/quantize.h"
#include "magick/quantum.h"
#include "magick/resource_.h"
#include "magick/string_.h"
#include "magick/string-private.h"
#include "magick/thread-private.h"
Include dependency graph for quantize.c:

Data Structures

struct  _NodeInfo
struct  _Nodes
struct  _CubeInfo

Defines

#define CacheShift   2
#define ErrorQueueLength   16
#define MaxNodes   266817
#define MaxTreeDepth   8
#define NodesInAList   1920
#define AssignImageTag   "Assign/Image"
#define ClassifyImageTag   "Classify/Image"
#define RedShift(pixel)   (((pixel) >> CacheShift) << (0*(8-CacheShift)))
#define GreenShift(pixel)   (((pixel) >> CacheShift) << (1*(8-CacheShift)))
#define BlueShift(pixel)   (((pixel) >> CacheShift) << (2*(8-CacheShift)))
#define AlphaShift(pixel)   (((pixel) >> CacheShift) << (3*(8-CacheShift)))
#define DitherImageTag   "Dither/Image"
#define DitherImageTag   "Dither/Image"
#define PosterizeImageTag   "Posterize/Image"
#define PosterizePixel(pixel)
#define ReduceImageTag   "Reduce/Image"

Typedefs

typedef struct _NodeInfo NodeInfo
typedef struct _Nodes Nodes
typedef struct _CubeInfo CubeInfo

Functions

static CubeInfoGetCubeInfo (const QuantizeInfo *, const size_t, const size_t)
static NodeInfoGetNodeInfo (CubeInfo *, const size_t, const size_t, NodeInfo *)
static MagickBooleanType AssignImageColors (Image *, CubeInfo *)
static MagickBooleanType ClassifyImageColors (CubeInfo *, const Image *, ExceptionInfo *)
static MagickBooleanType DitherImage (Image *, CubeInfo *)
static MagickBooleanType SetGrayscaleImage (Image *)
static void ClosestColor (const Image *, CubeInfo *, const NodeInfo *)
static void DefineImageColormap (Image *, CubeInfo *, NodeInfo *)
static void DestroyCubeInfo (CubeInfo *)
static void PruneLevel (CubeInfo *, const NodeInfo *)
static void PruneToCubeDepth (CubeInfo *, const NodeInfo *)
static void ReduceImageColors (const Image *, CubeInfo *)
MagickExport QuantizeInfoAcquireQuantizeInfo (const ImageInfo *image_info)
static void AssociateAlphaPixel (const CubeInfo *cube_info, const PixelPacket *pixel, DoublePixelPacket *alpha_pixel)
static size_t ColorToNodeId (const CubeInfo *cube_info, const DoublePixelPacket *pixel, size_t index)
static MagickBooleanType IsSameColor (const Image *image, const PixelPacket *p, const PixelPacket *q)
static void SetAssociatedAlpha (const Image *image, CubeInfo *cube_info)
MagickExport QuantizeInfoCloneQuantizeInfo (const QuantizeInfo *quantize_info)
MagickExport MagickBooleanType CompressImageColormap (Image *image)
MagickExport QuantizeInfoDestroyQuantizeInfo (QuantizeInfo *quantize_info)
static DoublePixelPacket ** DestroyPixelThreadSet (DoublePixelPacket **pixels)
static DoublePixelPacket ** AcquirePixelThreadSet (const size_t count)
static ssize_t CacheOffset (CubeInfo *cube_info, const DoublePixelPacket *pixel)
static MagickBooleanType FloydSteinbergDither (Image *image, CubeInfo *cube_info)
static MagickBooleanType RiemersmaDither (Image *, CacheView *, CubeInfo *, const unsigned int)
static void Riemersma (Image *image, CacheView *image_view, CubeInfo *cube_info, const size_t level, const unsigned int direction)
MagickExport MagickBooleanType GetImageQuantizeError (Image *image)
MagickExport void GetQuantizeInfo (QuantizeInfo *quantize_info)
static double MagickRound (double x)
MagickExport MagickBooleanType PosterizeImage (Image *image, const size_t levels, const MagickBooleanType dither)
MagickExport MagickBooleanType PosterizeImageChannel (Image *image, const ChannelType channel, const size_t levels, const MagickBooleanType dither)
static void PruneChild (CubeInfo *cube_info, const NodeInfo *node_info)
MagickExport MagickBooleanType QuantizeImage (const QuantizeInfo *quantize_info, Image *image)
MagickExport MagickBooleanType QuantizeImages (const QuantizeInfo *quantize_info, Image *images)
static size_t QuantizeErrorFlatten (const CubeInfo *cube_info, const NodeInfo *node_info, const ssize_t offset, MagickRealType *quantize_error)
static void Reduce (CubeInfo *cube_info, const NodeInfo *node_info)
static int MagickRealTypeCompare (const void *error_p, const void *error_q)
MagickExport MagickBooleanType RemapImage (const QuantizeInfo *quantize_info, Image *image, const Image *remap_image)
MagickExport MagickBooleanType RemapImages (const QuantizeInfo *quantize_info, Image *images, const Image *remap_image)
static int IntensityCompare (const void *x, const void *y)

Define Documentation

#define AlphaShift ( pixel   )     (((pixel) >> CacheShift) << (3*(8-CacheShift)))

Referenced by CacheOffset().

#define AssignImageTag   "Assign/Image"
#define BlueShift ( pixel   )     (((pixel) >> CacheShift) << (2*(8-CacheShift)))

Referenced by CacheOffset().

#define CacheShift   2

Referenced by GetCubeInfo().

#define ClassifyImageTag   "Classify/Image"

Referenced by ClassifyImageColors().

#define DitherImageTag   "Dither/Image"
#define DitherImageTag   "Dither/Image"
#define ErrorQueueLength   16
#define GreenShift ( pixel   )     (((pixel) >> CacheShift) << (1*(8-CacheShift)))

Referenced by CacheOffset().

#define MaxNodes   266817

Referenced by ClassifyImageColors().

#define MaxTreeDepth   8
#define NodesInAList   1920
#define PosterizeImageTag   "Posterize/Image"

Referenced by PosterizeImageChannel().

#define PosterizePixel ( pixel   ) 
Value:
ClampToQuantum((MagickRealType) QuantumRange*( \
  MagickRound(QuantumScale*pixel*(levels-1)))/MagickMax((ssize_t) levels-1,1))

Referenced by PosterizeImageChannel().

#define RedShift ( pixel   )     (((pixel) >> CacheShift) << (0*(8-CacheShift)))

Referenced by CacheOffset().

#define ReduceImageTag   "Reduce/Image"

Referenced by ReduceImageColors().


Typedef Documentation

typedef struct _CubeInfo CubeInfo
typedef struct _NodeInfo NodeInfo
typedef struct _Nodes Nodes

Function Documentation

static DoublePixelPacket** AcquirePixelThreadSet ( const size_t  count  )  [static]
MagickExport QuantizeInfo* AcquireQuantizeInfo ( const ImageInfo image_info  ) 
static MagickBooleanType AssignImageColors ( Image image,
CubeInfo cube_info 
) [static]
static void AssociateAlphaPixel ( const CubeInfo cube_info,
const PixelPacket pixel,
DoublePixelPacket alpha_pixel 
) [inline, static]
static ssize_t CacheOffset ( CubeInfo cube_info,
const DoublePixelPacket pixel 
) [inline, static]
static MagickBooleanType ClassifyImageColors ( CubeInfo cube_info,
const Image image,
ExceptionInfo exception 
)
MagickExport QuantizeInfo* CloneQuantizeInfo ( const QuantizeInfo quantize_info  ) 
static void ClosestColor ( const Image image,
CubeInfo cube_info,
const NodeInfo node_info 
) [static]
static size_t ColorToNodeId ( const CubeInfo cube_info,
const DoublePixelPacket pixel,
size_t  index 
) [inline, static]
MagickExport MagickBooleanType CompressImageColormap ( Image image  ) 
static void DefineImageColormap ( Image image,
CubeInfo cube_info,
NodeInfo node_info 
)
static void DestroyCubeInfo ( CubeInfo cube_info  ) 
static DoublePixelPacket** DestroyPixelThreadSet ( DoublePixelPacket **  pixels  )  [static]
MagickExport QuantizeInfo* DestroyQuantizeInfo ( QuantizeInfo quantize_info  ) 
static MagickBooleanType DitherImage ( Image image,
CubeInfo cube_info 
)
static MagickBooleanType FloydSteinbergDither ( Image image,
CubeInfo cube_info 
) [static]
static CubeInfo * GetCubeInfo ( const QuantizeInfo quantize_info,
const size_t  depth,
const size_t  maximum_colors 
) [static]
MagickExport MagickBooleanType GetImageQuantizeError ( Image image  ) 
static NodeInfo * GetNodeInfo ( CubeInfo cube_info,
const size_t  id,
const size_t  level,
NodeInfo parent 
) [static]
MagickExport void GetQuantizeInfo ( QuantizeInfo quantize_info  ) 
static int IntensityCompare ( const void *  x,
const void *  y 
) [static]

References PixelPacketIntensity().

Referenced by SetGrayscaleImage().

static MagickBooleanType IsSameColor ( const Image image,
const PixelPacket p,
const PixelPacket q 
) [inline, static]
static int MagickRealTypeCompare ( const void *  error_p,
const void *  error_q 
) [static]

References MagickEpsilon.

Referenced by ReduceImageColors().

static double MagickRound ( double  x  )  [inline, static]
MagickExport MagickBooleanType PosterizeImage ( Image image,
const size_t  levels,
const MagickBooleanType  dither 
)
MagickExport MagickBooleanType PosterizeImageChannel ( Image image,
const ChannelType  channel,
const size_t  levels,
const MagickBooleanType  dither 
)
static void PruneChild ( CubeInfo cube_info,
const NodeInfo node_info 
) [static]
static void PruneLevel ( CubeInfo cube_info,
const NodeInfo node_info 
)
static void PruneToCubeDepth ( CubeInfo cube_info,
const NodeInfo node_info 
)
static size_t QuantizeErrorFlatten ( const CubeInfo cube_info,
const NodeInfo node_info,
const ssize_t  offset,
MagickRealType quantize_error 
) [static]
MagickExport MagickBooleanType QuantizeImage ( const QuantizeInfo quantize_info,
Image image 
)
MagickExport MagickBooleanType QuantizeImages ( const QuantizeInfo quantize_info,
Image images 
)
static void Reduce ( CubeInfo cube_info,
const NodeInfo node_info 
) [static]
static void ReduceImageColors ( const Image image,
CubeInfo cube_info 
)
MagickExport MagickBooleanType RemapImage ( const QuantizeInfo quantize_info,
Image image,
const Image remap_image 
)
MagickExport MagickBooleanType RemapImages ( const QuantizeInfo quantize_info,
Image images,
const Image remap_image 
)
static void Riemersma ( Image image,
CacheView image_view,
CubeInfo cube_info,
const size_t  level,
const unsigned int  direction 
) [static]
static MagickBooleanType RiemersmaDither ( Image image,
CacheView image_view,
CubeInfo cube_info,
const unsigned int  direction 
) [static]
static void SetAssociatedAlpha ( const Image image,
CubeInfo cube_info 
) [inline, static]
static MagickBooleanType SetGrayscaleImage ( Image image  ) 

Generated on 28 Apr 2020 for MagickCore by  doxygen 1.6.1