Lcd companion boards support (VKLCD50RTA & VKLCD70RT)

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers jmorecfg.h Source File

jmorecfg.h

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