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