jmorecfg.h

Go to the documentation of this file.
00001 /*
00002  * jmorecfg.h
00003  *
00004  * Copyright (C) 1991-1997, Thomas G. Lane.
00005  * This file is part of the Independent JPEG Group's software.
00006  * For conditions of distribution and use, see the accompanying README file.
00007  *
00008  * This file contains additional configuration options that customize the
00009  * JPEG software for special applications or support machine-dependent
00010  * optimizations.  Most users will not need to touch this file.
00011  */
00012 
00016 
00017 #ifdef _MSC_VER
00018 #   pragma warning (disable: 4127 4244)
00019 #endif
00020 
00021 /*
00022  * Define BITS_IN_JSAMPLE as either
00023  *   8   for 8-bit sample values (the usual setting)
00024  *   12  for 12-bit sample values
00025  * Only 8 and 12 are legal data precisions for lossy JPEG according to the
00026  * JPEG standard, and the IJG code does not support anything else!
00027  * We do not support run-time selection of data precision, sorry.
00028  */
00029 
00030 #define BITS_IN_JSAMPLE  8  /* use 8 or 12 */
00031 
00032 
00033 /*
00034  * Maximum number of components (color channels) allowed in JPEG image.
00035  * To meet the letter of the JPEG spec, set this to 255.  However, darn
00036  * few applications need more than 4 channels (maybe 5 for CMYK + alpha
00037  * mask).  We recommend 10 as a reasonable compromise; use 4 if you are
00038  * really short on memory.  (Each allowed component costs a hundred or so
00039  * bytes of storage, whether actually used in an image or not.)
00040  */
00041 
00042 #define MAX_COMPONENTS  10  /* maximum number of image components */
00043 
00044 
00045 /*
00046  * Basic data types.
00047  * You may need to change these if you have a machine with unusual data
00048  * type sizes; for example, "char" not 8 bits, "short" not 16 bits,
00049  * or "long" not 32 bits.  We don't care whether "int" is 16 or 32 bits,
00050  * but it had better be at least 16.
00051  */
00052 
00053 /* Representation of a single sample (pixel element value).
00054  * We frequently allocate large arrays of these, so it's important to keep
00055  * them small.  But if you have memory to burn and access to char or short
00056  * arrays is very slow on your hardware, you might want to change these.
00057  */
00058 
00059 #if BITS_IN_JSAMPLE == 8
00060 /* JSAMPLE should be the smallest type that will hold the values 0..255.
00061  * You can use a signed char by having GETJSAMPLE mask it with 0xFF.
00062  */
00063 
00064 #ifdef HAVE_UNSIGNED_CHAR
00065 
00066 typedef unsigned char JSAMPLE;
00067 #define GETJSAMPLE(value)  ((int) (value))
00068 
00069 #else /* not HAVE_UNSIGNED_CHAR */
00070 
00071 typedef char JSAMPLE;
00072 #ifdef CHAR_IS_UNSIGNED
00073 #define GETJSAMPLE(value)  ((int) (value))
00074 #else
00075 #define GETJSAMPLE(value)  ((int) (value) & 0xFF)
00076 #endif /* CHAR_IS_UNSIGNED */
00077 
00078 #endif /* HAVE_UNSIGNED_CHAR */
00079 
00080 #define MAXJSAMPLE  255
00081 #define CENTERJSAMPLE   128
00082 
00083 #endif /* BITS_IN_JSAMPLE == 8 */
00084 
00085 
00086 #if BITS_IN_JSAMPLE == 12
00087 /* JSAMPLE should be the smallest type that will hold the values 0..4095.
00088  * On nearly all machines "short" will do nicely.
00089  */
00090 
00091 typedef short JSAMPLE;
00092 #define GETJSAMPLE(value)  ((int) (value))
00093 
00094 #define MAXJSAMPLE  4095
00095 #define CENTERJSAMPLE   2048
00096 
00097 #endif /* BITS_IN_JSAMPLE == 12 */
00098 
00099 
00100 /* Representation of a DCT frequency coefficient.
00101  * This should be a signed value of at least 16 bits; "short" is usually OK.
00102  * Again, we allocate large arrays of these, but you can change to int
00103  * if you have memory to burn and "short" is really slow.
00104  */
00105 
00106 typedef short JCOEF;
00107 
00108 
00109 /* Compressed datastreams are represented as arrays of JOCTET.
00110  * These must be EXACTLY 8 bits wide, at least once they are written to
00111  * external storage.  Note that when using the stdio data source/destination
00112  * managers, this is also the data type passed to fread/fwrite.
00113  */
00114 
00115 #ifdef HAVE_UNSIGNED_CHAR
00116 
00117 typedef unsigned char JOCTET;
00118 #define GETJOCTET(value)  (value)
00119 
00120 #else /* not HAVE_UNSIGNED_CHAR */
00121 
00122 typedef char JOCTET;
00123 #ifdef CHAR_IS_UNSIGNED
00124 #define GETJOCTET(value)  (value)
00125 #else
00126 #define GETJOCTET(value)  ((value) & 0xFF)
00127 #endif /* CHAR_IS_UNSIGNED */
00128 
00129 #endif /* HAVE_UNSIGNED_CHAR */
00130 
00131 
00132 /* These typedefs are used for various table entries and so forth.
00133  * They must be at least as wide as specified; but making them too big
00134  * won't cost a huge amount of memory, so we don't provide special
00135  * extraction code like we did for JSAMPLE.  (In other words, these
00136  * typedefs live at a different point on the speed/space tradeoff curve.)
00137  */
00138 
00139 /* UINT8 must hold at least the values 0..255. */
00140 
00141 #ifdef HAVE_UNSIGNED_CHAR
00142 typedef unsigned char UINT8;
00143 #else /* not HAVE_UNSIGNED_CHAR */
00144 #ifdef CHAR_IS_UNSIGNED
00145 typedef char UINT8;
00146 #else /* not CHAR_IS_UNSIGNED */
00147 typedef short UINT8;
00148 #endif /* CHAR_IS_UNSIGNED */
00149 #endif /* HAVE_UNSIGNED_CHAR */
00150 
00151 /* UINT16 must hold at least the values 0..65535. */
00152 
00153 #ifdef HAVE_UNSIGNED_SHORT
00154 typedef unsigned short UINT16;
00155 #else /* not HAVE_UNSIGNED_SHORT */
00156 typedef unsigned int UINT16;
00157 #endif /* HAVE_UNSIGNED_SHORT */
00158 
00159 /* INT16 must hold at least the values -32768..32767. */
00160 
00161 #ifndef XMD_H           /* X11/xmd.h correctly defines INT16 */
00162 typedef short INT16;
00163 #endif
00164 
00165 /* INT32 must hold at least signed 32-bit values. */
00166 
00167 #ifdef _MSC_VER
00168 #pragma warning(disable: 4142)
00169 #endif
00170 #ifndef XMD_H           /* X11/xmd.h correctly defines INT32 */
00171 typedef long INT32;
00172 #endif
00173 
00174 /* Datatype used for image dimensions.  The JPEG standard only supports
00175  * images up to 64K*64K due to 16-bit fields in SOF markers.  Therefore
00176  * "unsigned int" is sufficient on all machines.  However, if you need to
00177  * handle larger images and you don't mind deviating from the spec, you
00178  * can change this datatype.
00179  */
00180 
00181 typedef unsigned int JDIMENSION;
00182 
00183 #define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
00184 
00185 
00186 /* These macros are used in all function definitions and extern declarations.
00187  * You could modify them if you need to change function linkage conventions;
00188  * in particular, you'll need to do that to make the library a Windows DLL.
00189  * Another application is to make all functions global for use with debuggers
00190  * or code profilers that require it.
00191  */
00192 
00193 /* a function called through method pointers: */
00194 #define METHODDEF(type)     static type
00195 /* a function used only in its module: */
00196 #define LOCAL(type)     static type
00197 /* a function referenced thru EXTERNs: */
00198 #define GLOBAL(type)        type
00199 /* a reference to a GLOBAL function: */
00200 #define EXTERN(type)        extern type
00201 
00202 
00203 /* This macro is used to declare a "method", that is, a function pointer.
00204  * We want to supply prototype parameters if the compiler can cope.
00205  * Note that the arglist parameter must be parenthesized!
00206  * Again, you can customize this if you need special linkage keywords.
00207  */
00208 
00209 #ifdef HAVE_PROTOTYPES
00210 #define JMETHOD(type,methodname,arglist)  type (*methodname) arglist
00211 #else
00212 #define JMETHOD(type,methodname,arglist)  type (*methodname) ()
00213 #endif
00214 
00215 
00216 /* Here is the pseudo-keyword for declaring pointers that must be "far"
00217  * on 80x86 machines.  Most of the specialized coding for 80x86 is handled
00218  * by just saying "FAR *" where such a pointer is needed.  In a few places
00219  * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
00220  */
00221 
00222 #ifdef NEED_FAR_POINTERS
00223 #define FAR  far
00224 #else
00225 #define FAR
00226 #endif
00227 
00228 
00229 /*
00230  * On a few systems, type boolean and/or its values FALSE, TRUE may appear
00231  * in standard header files.  Or you may have conflicts with application-
00232  * specific header files that you want to include together with these files.
00233  * Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
00234  */
00235 
00236 #ifndef HAVE_BOOLEAN
00237 typedef int boolean;
00238 #endif
00239 #ifndef FALSE           /* in case these macros already exist */
00240 #define FALSE   0       /* values of boolean */
00241 #endif
00242 #ifndef TRUE
00243 #define TRUE    1
00244 #endif
00245 
00246 
00247 /*
00248  * The remaining options affect code selection within the JPEG library,
00249  * but they don't need to be visible to most applications using the library.
00250  * To minimize application namespace pollution, the symbols won't be
00251  * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined.
00252  */
00253 
00254 #ifdef JPEG_INTERNALS
00255 #define JPEG_INTERNAL_OPTIONS
00256 #endif
00257 
00258 #ifdef JPEG_INTERNAL_OPTIONS
00259 
00260 
00261 /*
00262  * These defines indicate whether to include various optional functions.
00263  * Undefining some of these symbols will produce a smaller but less capable
00264  * library.  Note that you can leave certain source files out of the
00265  * compilation/linking process if you've #undef'd the corresponding symbols.
00266  * (You may HAVE to do that if your compiler doesn't like null source files.)
00267  */
00268 
00269 /* Arithmetic coding is unsupported for legal reasons.  Complaints to IBM. */
00270 
00271 /* Capability options common to encoder and decoder: */
00272 
00273 #define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */
00274 #define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */
00275 #define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */
00276 
00277 /* Encoder capability options: */
00278 
00279 #undef  C_ARITH_CODING_SUPPORTED    /* Arithmetic coding back end? */
00280 #define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
00281 #define C_PROGRESSIVE_SUPPORTED     /* Progressive JPEG? (Requires MULTISCAN)*/
00282 #define ENTROPY_OPT_SUPPORTED       /* Optimization of entropy coding parms? */
00283 /* Note: if you selected 12-bit data precision, it is dangerous to turn off
00284  * ENTROPY_OPT_SUPPORTED.  The standard Huffman tables are only good for 8-bit
00285  * precision, so jchuff.c normally uses entropy optimization to compute
00286  * usable tables for higher precision.  If you don't want to do optimization,
00287  * you'll have to supply different default Huffman tables.
00288  * The exact same statements apply for progressive JPEG: the default tables
00289  * don't work for progressive mode.  (This may get fixed, however.)
00290  */
00291 #define INPUT_SMOOTHING_SUPPORTED   /* Input image smoothing option? */
00292 
00293 /* Decoder capability options: */
00294 
00295 #undef  D_ARITH_CODING_SUPPORTED    /* Arithmetic coding back end? */
00296 #define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
00297 #define D_PROGRESSIVE_SUPPORTED     /* Progressive JPEG? (Requires MULTISCAN)*/
00298 #define SAVE_MARKERS_SUPPORTED      /* jpeg_save_markers() needed? */
00299 #define BLOCK_SMOOTHING_SUPPORTED   /* Block smoothing? (Progressive only) */
00300 #define IDCT_SCALING_SUPPORTED      /* Output rescaling via IDCT? */
00301 #undef  UPSAMPLE_SCALING_SUPPORTED  /* Output rescaling at upsample stage? */
00302 #define UPSAMPLE_MERGING_SUPPORTED  /* Fast path for sloppy upsampling? */
00303 #define QUANT_1PASS_SUPPORTED       /* 1-pass color quantization? */
00304 #define QUANT_2PASS_SUPPORTED       /* 2-pass color quantization? */
00305 
00306 /* more capability options later, no doubt */
00307 
00308 
00309 /*
00310  * Ordering of RGB data in scanlines passed to or from the application.
00311  * If your application wants to deal with data in the order B,G,R, just
00312  * change these macros.  You can also deal with formats such as R,G,B,X
00313  * (one extra byte per pixel) by changing RGB_PIXELSIZE.  Note that changing
00314  * the offsets will also change the order in which colormap data is organized.
00315  * RESTRICTIONS:
00316  * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
00317  * 2. These macros only affect RGB<=>YCbCr color conversion, so they are not
00318  *    useful if you are using JPEG color spaces other than YCbCr or grayscale.
00319  * 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
00320  *    is not 3 (they don't understand about dummy color components!).  So you
00321  *    can't use color quantization if you change that value.
00322  */
00323 
00324 #define RGB_RED     0   /* Offset of Red in an RGB scanline element */
00325 #define RGB_GREEN   1   /* Offset of Green */
00326 #define RGB_BLUE    2   /* Offset of Blue */
00327 #define RGB_PIXELSIZE   3   /* JSAMPLEs per RGB scanline element */
00328 
00329 
00330 /* Definitions for speed-related optimizations. */
00331 
00332 
00333 /* If your compiler supports inline functions, define INLINE
00334  * as the inline keyword; otherwise define it as empty.
00335  */
00336 
00337 #ifndef INLINE
00338 #ifdef __GNUC__         /* for instance, GNU C knows about inline */
00339 #define INLINE __inline__
00340 #endif
00341 #ifndef INLINE
00342 #define INLINE          /* default is to define it as empty */
00343 #endif
00344 #endif
00345 
00346 
00347 /* On some machines (notably 68000 series) "int" is 32 bits, but multiplying
00348  * two 16-bit shorts is faster than multiplying two ints.  Define MULTIPLIER
00349  * as short on such a machine.  MULTIPLIER must be at least 16 bits wide.
00350  */
00351 
00352 #ifndef MULTIPLIER
00353 #define MULTIPLIER  int     /* type for fastest integer multiply */
00354 #endif
00355 
00356 
00357 /* FAST_FLOAT should be either float or double, whichever is done faster
00358  * by your compiler.  (Note that this type is only used in the floating point
00359  * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
00360  * Typically, float is faster in ANSI C compilers, while double is faster in
00361  * pre-ANSI compilers (because they insist on converting to double anyway).
00362  * The code below therefore chooses float if we have ANSI-style prototypes.
00363  */
00364 
00365 #ifndef FAST_FLOAT
00366 #ifdef HAVE_PROTOTYPES
00367 #define FAST_FLOAT  float
00368 #else
00369 #define FAST_FLOAT  double
00370 #endif
00371 #endif
00372 
00373 #endif /* JPEG_INTERNAL_OPTIONS */

Generated on Tue Jan 6 22:41:37 2009 for Autodesk DWF 3D Toolkit by  doxygen 1.4.5