Blame gtkmm-osx/jpeg-6b/jmorecfg.h

darco 56a656
/*
darco 56a656
 * jmorecfg.h
darco 56a656
 *
darco 56a656
 * Copyright (C) 1991-1997, Thomas G. Lane.
darco 56a656
 * This file is part of the Independent JPEG Group's software.
darco 56a656
 * For conditions of distribution and use, see the accompanying README file.
darco 56a656
 *
darco 56a656
 * This file contains additional configuration options that customize the
darco 56a656
 * JPEG software for special applications or support machine-dependent
darco 56a656
 * optimizations.  Most users will not need to touch this file.
darco 56a656
 */
darco 56a656
darco 56a656
darco 56a656
/*
darco 56a656
 * Define BITS_IN_JSAMPLE as either
darco 56a656
 *   8   for 8-bit sample values (the usual setting)
darco 56a656
 *   12  for 12-bit sample values
darco 56a656
 * Only 8 and 12 are legal data precisions for lossy JPEG according to the
darco 56a656
 * JPEG standard, and the IJG code does not support anything else!
darco 56a656
 * We do not support run-time selection of data precision, sorry.
darco 56a656
 */
darco 56a656
darco 56a656
#define BITS_IN_JSAMPLE  8	/* use 8 or 12 */
darco 56a656
darco 56a656
darco 56a656
/*
darco 56a656
 * Maximum number of components (color channels) allowed in JPEG image.
darco 56a656
 * To meet the letter of the JPEG spec, set this to 255.  However, darn
darco 56a656
 * few applications need more than 4 channels (maybe 5 for CMYK + alpha
darco 56a656
 * mask).  We recommend 10 as a reasonable compromise; use 4 if you are
darco 56a656
 * really short on memory.  (Each allowed component costs a hundred or so
darco 56a656
 * bytes of storage, whether actually used in an image or not.)
darco 56a656
 */
darco 56a656
darco 56a656
#define MAX_COMPONENTS  10	/* maximum number of image components */
darco 56a656
darco 56a656
darco 56a656
/*
darco 56a656
 * Basic data types.
darco 56a656
 * You may need to change these if you have a machine with unusual data
darco 56a656
 * type sizes; for example, "char" not 8 bits, "short" not 16 bits,
darco 56a656
 * or "long" not 32 bits.  We don't care whether "int" is 16 or 32 bits,
darco 56a656
 * but it had better be at least 16.
darco 56a656
 */
darco 56a656
darco 56a656
/* Representation of a single sample (pixel element value).
darco 56a656
 * We frequently allocate large arrays of these, so it's important to keep
darco 56a656
 * them small.  But if you have memory to burn and access to char or short
darco 56a656
 * arrays is very slow on your hardware, you might want to change these.
darco 56a656
 */
darco 56a656
darco 56a656
#if BITS_IN_JSAMPLE == 8
darco 56a656
/* JSAMPLE should be the smallest type that will hold the values 0..255.
darco 56a656
 * You can use a signed char by having GETJSAMPLE mask it with 0xFF.
darco 56a656
 */
darco 56a656
darco 56a656
#ifdef HAVE_UNSIGNED_CHAR
darco 56a656
darco 56a656
typedef unsigned char JSAMPLE;
darco 56a656
#define GETJSAMPLE(value)  ((int) (value))
darco 56a656
darco 56a656
#else /* not HAVE_UNSIGNED_CHAR */
darco 56a656
darco 56a656
typedef char JSAMPLE;
darco 56a656
#ifdef CHAR_IS_UNSIGNED
darco 56a656
#define GETJSAMPLE(value)  ((int) (value))
darco 56a656
#else
darco 56a656
#define GETJSAMPLE(value)  ((int) (value) & 0xFF)
darco 56a656
#endif /* CHAR_IS_UNSIGNED */
darco 56a656
darco 56a656
#endif /* HAVE_UNSIGNED_CHAR */
darco 56a656
darco 56a656
#define MAXJSAMPLE	255
darco 56a656
#define CENTERJSAMPLE	128
darco 56a656
darco 56a656
#endif /* BITS_IN_JSAMPLE == 8 */
darco 56a656
darco 56a656
darco 56a656
#if BITS_IN_JSAMPLE == 12
darco 56a656
/* JSAMPLE should be the smallest type that will hold the values 0..4095.
darco 56a656
 * On nearly all machines "short" will do nicely.
darco 56a656
 */
darco 56a656
darco 56a656
typedef short JSAMPLE;
darco 56a656
#define GETJSAMPLE(value)  ((int) (value))
darco 56a656
darco 56a656
#define MAXJSAMPLE	4095
darco 56a656
#define CENTERJSAMPLE	2048
darco 56a656
darco 56a656
#endif /* BITS_IN_JSAMPLE == 12 */
darco 56a656
darco 56a656
darco 56a656
/* Representation of a DCT frequency coefficient.
darco 56a656
 * This should be a signed value of at least 16 bits; "short" is usually OK.
darco 56a656
 * Again, we allocate large arrays of these, but you can change to int
darco 56a656
 * if you have memory to burn and "short" is really slow.
darco 56a656
 */
darco 56a656
darco 56a656
typedef short JCOEF;
darco 56a656
darco 56a656
darco 56a656
/* Compressed datastreams are represented as arrays of JOCTET.
darco 56a656
 * These must be EXACTLY 8 bits wide, at least once they are written to
darco 56a656
 * external storage.  Note that when using the stdio data source/destination
darco 56a656
 * managers, this is also the data type passed to fread/fwrite.
darco 56a656
 */
darco 56a656
darco 56a656
#ifdef HAVE_UNSIGNED_CHAR
darco 56a656
darco 56a656
typedef unsigned char JOCTET;
darco 56a656
#define GETJOCTET(value)  (value)
darco 56a656
darco 56a656
#else /* not HAVE_UNSIGNED_CHAR */
darco 56a656
darco 56a656
typedef char JOCTET;
darco 56a656
#ifdef CHAR_IS_UNSIGNED
darco 56a656
#define GETJOCTET(value)  (value)
darco 56a656
#else
darco 56a656
#define GETJOCTET(value)  ((value) & 0xFF)
darco 56a656
#endif /* CHAR_IS_UNSIGNED */
darco 56a656
darco 56a656
#endif /* HAVE_UNSIGNED_CHAR */
darco 56a656
darco 56a656
darco 56a656
/* These typedefs are used for various table entries and so forth.
darco 56a656
 * They must be at least as wide as specified; but making them too big
darco 56a656
 * won't cost a huge amount of memory, so we don't provide special
darco 56a656
 * extraction code like we did for JSAMPLE.  (In other words, these
darco 56a656
 * typedefs live at a different point on the speed/space tradeoff curve.)
darco 56a656
 */
darco 56a656
darco 56a656
/* UINT8 must hold at least the values 0..255. */
darco 56a656
darco 56a656
#ifdef HAVE_UNSIGNED_CHAR
darco 56a656
typedef unsigned char UINT8;
darco 56a656
#else /* not HAVE_UNSIGNED_CHAR */
darco 56a656
#ifdef CHAR_IS_UNSIGNED
darco 56a656
typedef char UINT8;
darco 56a656
#else /* not CHAR_IS_UNSIGNED */
darco 56a656
typedef short UINT8;
darco 56a656
#endif /* CHAR_IS_UNSIGNED */
darco 56a656
#endif /* HAVE_UNSIGNED_CHAR */
darco 56a656
darco 56a656
/* UINT16 must hold at least the values 0..65535. */
darco 56a656
darco 56a656
#ifdef HAVE_UNSIGNED_SHORT
darco 56a656
typedef unsigned short UINT16;
darco 56a656
#else /* not HAVE_UNSIGNED_SHORT */
darco 56a656
typedef unsigned int UINT16;
darco 56a656
#endif /* HAVE_UNSIGNED_SHORT */
darco 56a656
darco 56a656
/* INT16 must hold at least the values -32768..32767. */
darco 56a656
darco 56a656
#ifndef XMD_H			/* X11/xmd.h correctly defines INT16 */
darco 56a656
typedef short INT16;
darco 56a656
#endif
darco 56a656
darco 56a656
/* INT32 must hold at least signed 32-bit values. */
darco 56a656
darco 56a656
#ifndef XMD_H			/* X11/xmd.h correctly defines INT32 */
darco 56a656
typedef long INT32;
darco 56a656
#endif
darco 56a656
darco 56a656
/* Datatype used for image dimensions.  The JPEG standard only supports
darco 56a656
 * images up to 64K*64K due to 16-bit fields in SOF markers.  Therefore
darco 56a656
 * "unsigned int" is sufficient on all machines.  However, if you need to
darco 56a656
 * handle larger images and you don't mind deviating from the spec, you
darco 56a656
 * can change this datatype.
darco 56a656
 */
darco 56a656
darco 56a656
typedef unsigned int JDIMENSION;
darco 56a656
darco 56a656
#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
darco 56a656
darco 56a656
darco 56a656
/* These macros are used in all function definitions and extern declarations.
darco 56a656
 * You could modify them if you need to change function linkage conventions;
darco 56a656
 * in particular, you'll need to do that to make the library a Windows DLL.
darco 56a656
 * Another application is to make all functions global for use with debuggers
darco 56a656
 * or code profilers that require it.
darco 56a656
 */
darco 56a656
darco 56a656
/* a function called through method pointers: */
darco 56a656
#define METHODDEF(type)		static type
darco 56a656
/* a function used only in its module: */
darco 56a656
#define LOCAL(type)		static type
darco 56a656
/* a function referenced thru EXTERNs: */
darco 56a656
#define GLOBAL(type)		type
darco 56a656
/* a reference to a GLOBAL function: */
darco 56a656
#define EXTERN(type)		extern type
darco 56a656
darco 56a656
darco 56a656
/* This macro is used to declare a "method", that is, a function pointer.
darco 56a656
 * We want to supply prototype parameters if the compiler can cope.
darco 56a656
 * Note that the arglist parameter must be parenthesized!
darco 56a656
 * Again, you can customize this if you need special linkage keywords.
darco 56a656
 */
darco 56a656
darco 56a656
#ifdef HAVE_PROTOTYPES
darco 56a656
#define JMETHOD(type,methodname,arglist)  type (*methodname) arglist
darco 56a656
#else
darco 56a656
#define JMETHOD(type,methodname,arglist)  type (*methodname) ()
darco 56a656
#endif
darco 56a656
darco 56a656
darco 56a656
/* Here is the pseudo-keyword for declaring pointers that must be "far"
darco 56a656
 * on 80x86 machines.  Most of the specialized coding for 80x86 is handled
darco 56a656
 * by just saying "FAR *" where such a pointer is needed.  In a few places
darco 56a656
 * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
darco 56a656
 */
darco 56a656
darco 56a656
#ifdef NEED_FAR_POINTERS
darco 56a656
#define FAR  far
darco 56a656
#else
darco 56a656
#define FAR
darco 56a656
#endif
darco 56a656
darco 56a656
darco 56a656
/*
darco 56a656
 * On a few systems, type boolean and/or its values FALSE, TRUE may appear
darco 56a656
 * in standard header files.  Or you may have conflicts with application-
darco 56a656
 * specific header files that you want to include together with these files.
darco 56a656
 * Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
darco 56a656
 */
darco 56a656
darco 56a656
#ifndef HAVE_BOOLEAN
darco 56a656
typedef int boolean;
darco 56a656
#endif
darco 56a656
#ifndef FALSE			/* in case these macros already exist */
darco 56a656
#define FALSE	0		/* values of boolean */
darco 56a656
#endif
darco 56a656
#ifndef TRUE
darco 56a656
#define TRUE	1
darco 56a656
#endif
darco 56a656
darco 56a656
darco 56a656
/*
darco 56a656
 * The remaining options affect code selection within the JPEG library,
darco 56a656
 * but they don't need to be visible to most applications using the library.
darco 56a656
 * To minimize application namespace pollution, the symbols won't be
darco 56a656
 * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined.
darco 56a656
 */
darco 56a656
darco 56a656
#ifdef JPEG_INTERNALS
darco 56a656
#define JPEG_INTERNAL_OPTIONS
darco 56a656
#endif
darco 56a656
darco 56a656
#ifdef JPEG_INTERNAL_OPTIONS
darco 56a656
darco 56a656
darco 56a656
/*
darco 56a656
 * These defines indicate whether to include various optional functions.
darco 56a656
 * Undefining some of these symbols will produce a smaller but less capable
darco 56a656
 * library.  Note that you can leave certain source files out of the
darco 56a656
 * compilation/linking process if you've #undef'd the corresponding symbols.
darco 56a656
 * (You may HAVE to do that if your compiler doesn't like null source files.)
darco 56a656
 */
darco 56a656
darco 56a656
/* Arithmetic coding is unsupported for legal reasons.  Complaints to IBM. */
darco 56a656
darco 56a656
/* Capability options common to encoder and decoder: */
darco 56a656
darco 56a656
#define DCT_ISLOW_SUPPORTED	/* slow but accurate integer algorithm */
darco 56a656
#define DCT_IFAST_SUPPORTED	/* faster, less accurate integer method */
darco 56a656
#define DCT_FLOAT_SUPPORTED	/* floating-point: accurate, fast on fast HW */
darco 56a656
darco 56a656
/* Encoder capability options: */
darco 56a656
darco 56a656
#undef  C_ARITH_CODING_SUPPORTED    /* Arithmetic coding back end? */
darco 56a656
#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
darco 56a656
#define C_PROGRESSIVE_SUPPORTED	    /* Progressive JPEG? (Requires MULTISCAN)*/
darco 56a656
#define ENTROPY_OPT_SUPPORTED	    /* Optimization of entropy coding parms? */
darco 56a656
/* Note: if you selected 12-bit data precision, it is dangerous to turn off
darco 56a656
 * ENTROPY_OPT_SUPPORTED.  The standard Huffman tables are only good for 8-bit
darco 56a656
 * precision, so jchuff.c normally uses entropy optimization to compute
darco 56a656
 * usable tables for higher precision.  If you don't want to do optimization,
darco 56a656
 * you'll have to supply different default Huffman tables.
darco 56a656
 * The exact same statements apply for progressive JPEG: the default tables
darco 56a656
 * don't work for progressive mode.  (This may get fixed, however.)
darco 56a656
 */
darco 56a656
#define INPUT_SMOOTHING_SUPPORTED   /* Input image smoothing option? */
darco 56a656
darco 56a656
/* Decoder capability options: */
darco 56a656
darco 56a656
#undef  D_ARITH_CODING_SUPPORTED    /* Arithmetic coding back end? */
darco 56a656
#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
darco 56a656
#define D_PROGRESSIVE_SUPPORTED	    /* Progressive JPEG? (Requires MULTISCAN)*/
darco 56a656
#define SAVE_MARKERS_SUPPORTED	    /* jpeg_save_markers() needed? */
darco 56a656
#define BLOCK_SMOOTHING_SUPPORTED   /* Block smoothing? (Progressive only) */
darco 56a656
#define IDCT_SCALING_SUPPORTED	    /* Output rescaling via IDCT? */
darco 56a656
#undef  UPSAMPLE_SCALING_SUPPORTED  /* Output rescaling at upsample stage? */
darco 56a656
#define UPSAMPLE_MERGING_SUPPORTED  /* Fast path for sloppy upsampling? */
darco 56a656
#define QUANT_1PASS_SUPPORTED	    /* 1-pass color quantization? */
darco 56a656
#define QUANT_2PASS_SUPPORTED	    /* 2-pass color quantization? */
darco 56a656
darco 56a656
/* more capability options later, no doubt */
darco 56a656
darco 56a656
darco 56a656
/*
darco 56a656
 * Ordering of RGB data in scanlines passed to or from the application.
darco 56a656
 * If your application wants to deal with data in the order B,G,R, just
darco 56a656
 * change these macros.  You can also deal with formats such as R,G,B,X
darco 56a656
 * (one extra byte per pixel) by changing RGB_PIXELSIZE.  Note that changing
darco 56a656
 * the offsets will also change the order in which colormap data is organized.
darco 56a656
 * RESTRICTIONS:
darco 56a656
 * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
darco 56a656
 * 2. These macros only affect RGB<=>YCbCr color conversion, so they are not
darco 56a656
 *    useful if you are using JPEG color spaces other than YCbCr or grayscale.
darco 56a656
 * 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
darco 56a656
 *    is not 3 (they don't understand about dummy color components!).  So you
darco 56a656
 *    can't use color quantization if you change that value.
darco 56a656
 */
darco 56a656
darco 56a656
#define RGB_RED		0	/* Offset of Red in an RGB scanline element */
darco 56a656
#define RGB_GREEN	1	/* Offset of Green */
darco 56a656
#define RGB_BLUE	2	/* Offset of Blue */
darco 56a656
#define RGB_PIXELSIZE	3	/* JSAMPLEs per RGB scanline element */
darco 56a656
darco 56a656
darco 56a656
/* Definitions for speed-related optimizations. */
darco 56a656
darco 56a656
darco 56a656
/* If your compiler supports inline functions, define INLINE
darco 56a656
 * as the inline keyword; otherwise define it as empty.
darco 56a656
 */
darco 56a656
darco 56a656
#ifndef INLINE
darco 56a656
#ifdef __GNUC__			/* for instance, GNU C knows about inline */
darco 56a656
#define INLINE __inline__
darco 56a656
#endif
darco 56a656
#ifndef INLINE
darco 56a656
#define INLINE			/* default is to define it as empty */
darco 56a656
#endif
darco 56a656
#endif
darco 56a656
darco 56a656
darco 56a656
/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying
darco 56a656
 * two 16-bit shorts is faster than multiplying two ints.  Define MULTIPLIER
darco 56a656
 * as short on such a machine.  MULTIPLIER must be at least 16 bits wide.
darco 56a656
 */
darco 56a656
darco 56a656
#ifndef MULTIPLIER
darco 56a656
#define MULTIPLIER  int		/* type for fastest integer multiply */
darco 56a656
#endif
darco 56a656
darco 56a656
darco 56a656
/* FAST_FLOAT should be either float or double, whichever is done faster
darco 56a656
 * by your compiler.  (Note that this type is only used in the floating point
darco 56a656
 * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
darco 56a656
 * Typically, float is faster in ANSI C compilers, while double is faster in
darco 56a656
 * pre-ANSI compilers (because they insist on converting to double anyway).
darco 56a656
 * The code below therefore chooses float if we have ANSI-style prototypes.
darco 56a656
 */
darco 56a656
darco 56a656
#ifndef FAST_FLOAT
darco 56a656
#ifdef HAVE_PROTOTYPES
darco 56a656
#define FAST_FLOAT  float
darco 56a656
#else
darco 56a656
#define FAST_FLOAT  double
darco 56a656
#endif
darco 56a656
#endif
darco 56a656
darco 56a656
#endif /* JPEG_INTERNAL_OPTIONS */