3dphotoshoot

annotate libs/libjpeg/jmorecfg.h @ 14:06dc8b9b4f89

added libimago, libjpeg and libpng
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 07 Jun 2015 17:25:49 +0300
parents
children
rev   line source
nuclear@14 1 /*
nuclear@14 2 * jmorecfg.h
nuclear@14 3 *
nuclear@14 4 * Copyright (C) 1991-1997, Thomas G. Lane.
nuclear@14 5 * This file is part of the Independent JPEG Group's software.
nuclear@14 6 * For conditions of distribution and use, see the accompanying README file.
nuclear@14 7 *
nuclear@14 8 * This file contains additional configuration options that customize the
nuclear@14 9 * JPEG software for special applications or support machine-dependent
nuclear@14 10 * optimizations. Most users will not need to touch this file.
nuclear@14 11 */
nuclear@14 12
nuclear@14 13
nuclear@14 14 /*
nuclear@14 15 * Define BITS_IN_JSAMPLE as either
nuclear@14 16 * 8 for 8-bit sample values (the usual setting)
nuclear@14 17 * 12 for 12-bit sample values
nuclear@14 18 * Only 8 and 12 are legal data precisions for lossy JPEG according to the
nuclear@14 19 * JPEG standard, and the IJG code does not support anything else!
nuclear@14 20 * We do not support run-time selection of data precision, sorry.
nuclear@14 21 */
nuclear@14 22
nuclear@14 23 #define BITS_IN_JSAMPLE 8 /* use 8 or 12 */
nuclear@14 24
nuclear@14 25
nuclear@14 26 /*
nuclear@14 27 * Maximum number of components (color channels) allowed in JPEG image.
nuclear@14 28 * To meet the letter of the JPEG spec, set this to 255. However, darn
nuclear@14 29 * few applications need more than 4 channels (maybe 5 for CMYK + alpha
nuclear@14 30 * mask). We recommend 10 as a reasonable compromise; use 4 if you are
nuclear@14 31 * really short on memory. (Each allowed component costs a hundred or so
nuclear@14 32 * bytes of storage, whether actually used in an image or not.)
nuclear@14 33 */
nuclear@14 34
nuclear@14 35 #define MAX_COMPONENTS 10 /* maximum number of image components */
nuclear@14 36
nuclear@14 37
nuclear@14 38 /*
nuclear@14 39 * Basic data types.
nuclear@14 40 * You may need to change these if you have a machine with unusual data
nuclear@14 41 * type sizes; for example, "char" not 8 bits, "short" not 16 bits,
nuclear@14 42 * or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits,
nuclear@14 43 * but it had better be at least 16.
nuclear@14 44 */
nuclear@14 45
nuclear@14 46 /* Representation of a single sample (pixel element value).
nuclear@14 47 * We frequently allocate large arrays of these, so it's important to keep
nuclear@14 48 * them small. But if you have memory to burn and access to char or short
nuclear@14 49 * arrays is very slow on your hardware, you might want to change these.
nuclear@14 50 */
nuclear@14 51
nuclear@14 52 #if BITS_IN_JSAMPLE == 8
nuclear@14 53 /* JSAMPLE should be the smallest type that will hold the values 0..255.
nuclear@14 54 * You can use a signed char by having GETJSAMPLE mask it with 0xFF.
nuclear@14 55 */
nuclear@14 56
nuclear@14 57 #ifdef HAVE_UNSIGNED_CHAR
nuclear@14 58
nuclear@14 59 typedef unsigned char JSAMPLE;
nuclear@14 60 #define GETJSAMPLE(value) ((int) (value))
nuclear@14 61
nuclear@14 62 #else /* not HAVE_UNSIGNED_CHAR */
nuclear@14 63
nuclear@14 64 typedef char JSAMPLE;
nuclear@14 65 #ifdef CHAR_IS_UNSIGNED
nuclear@14 66 #define GETJSAMPLE(value) ((int) (value))
nuclear@14 67 #else
nuclear@14 68 #define GETJSAMPLE(value) ((int) (value) & 0xFF)
nuclear@14 69 #endif /* CHAR_IS_UNSIGNED */
nuclear@14 70
nuclear@14 71 #endif /* HAVE_UNSIGNED_CHAR */
nuclear@14 72
nuclear@14 73 #define MAXJSAMPLE 255
nuclear@14 74 #define CENTERJSAMPLE 128
nuclear@14 75
nuclear@14 76 #endif /* BITS_IN_JSAMPLE == 8 */
nuclear@14 77
nuclear@14 78
nuclear@14 79 #if BITS_IN_JSAMPLE == 12
nuclear@14 80 /* JSAMPLE should be the smallest type that will hold the values 0..4095.
nuclear@14 81 * On nearly all machines "short" will do nicely.
nuclear@14 82 */
nuclear@14 83
nuclear@14 84 typedef short JSAMPLE;
nuclear@14 85 #define GETJSAMPLE(value) ((int) (value))
nuclear@14 86
nuclear@14 87 #define MAXJSAMPLE 4095
nuclear@14 88 #define CENTERJSAMPLE 2048
nuclear@14 89
nuclear@14 90 #endif /* BITS_IN_JSAMPLE == 12 */
nuclear@14 91
nuclear@14 92
nuclear@14 93 /* Representation of a DCT frequency coefficient.
nuclear@14 94 * This should be a signed value of at least 16 bits; "short" is usually OK.
nuclear@14 95 * Again, we allocate large arrays of these, but you can change to int
nuclear@14 96 * if you have memory to burn and "short" is really slow.
nuclear@14 97 */
nuclear@14 98
nuclear@14 99 typedef short JCOEF;
nuclear@14 100
nuclear@14 101
nuclear@14 102 /* Compressed datastreams are represented as arrays of JOCTET.
nuclear@14 103 * These must be EXACTLY 8 bits wide, at least once they are written to
nuclear@14 104 * external storage. Note that when using the stdio data source/destination
nuclear@14 105 * managers, this is also the data type passed to fread/fwrite.
nuclear@14 106 */
nuclear@14 107
nuclear@14 108 #ifdef HAVE_UNSIGNED_CHAR
nuclear@14 109
nuclear@14 110 typedef unsigned char JOCTET;
nuclear@14 111 #define GETJOCTET(value) (value)
nuclear@14 112
nuclear@14 113 #else /* not HAVE_UNSIGNED_CHAR */
nuclear@14 114
nuclear@14 115 typedef char JOCTET;
nuclear@14 116 #ifdef CHAR_IS_UNSIGNED
nuclear@14 117 #define GETJOCTET(value) (value)
nuclear@14 118 #else
nuclear@14 119 #define GETJOCTET(value) ((value) & 0xFF)
nuclear@14 120 #endif /* CHAR_IS_UNSIGNED */
nuclear@14 121
nuclear@14 122 #endif /* HAVE_UNSIGNED_CHAR */
nuclear@14 123
nuclear@14 124
nuclear@14 125 /* These typedefs are used for various table entries and so forth.
nuclear@14 126 * They must be at least as wide as specified; but making them too big
nuclear@14 127 * won't cost a huge amount of memory, so we don't provide special
nuclear@14 128 * extraction code like we did for JSAMPLE. (In other words, these
nuclear@14 129 * typedefs live at a different point on the speed/space tradeoff curve.)
nuclear@14 130 */
nuclear@14 131
nuclear@14 132 /* UINT8 must hold at least the values 0..255. */
nuclear@14 133
nuclear@14 134 #ifdef HAVE_UNSIGNED_CHAR
nuclear@14 135 typedef unsigned char UINT8;
nuclear@14 136 #else /* not HAVE_UNSIGNED_CHAR */
nuclear@14 137 #ifdef CHAR_IS_UNSIGNED
nuclear@14 138 typedef char UINT8;
nuclear@14 139 #else /* not CHAR_IS_UNSIGNED */
nuclear@14 140 typedef short UINT8;
nuclear@14 141 #endif /* CHAR_IS_UNSIGNED */
nuclear@14 142 #endif /* HAVE_UNSIGNED_CHAR */
nuclear@14 143
nuclear@14 144 /* UINT16 must hold at least the values 0..65535. */
nuclear@14 145
nuclear@14 146 #ifdef HAVE_UNSIGNED_SHORT
nuclear@14 147 typedef unsigned short UINT16;
nuclear@14 148 #else /* not HAVE_UNSIGNED_SHORT */
nuclear@14 149 typedef unsigned int UINT16;
nuclear@14 150 #endif /* HAVE_UNSIGNED_SHORT */
nuclear@14 151
nuclear@14 152 /* INT16 must hold at least the values -32768..32767. */
nuclear@14 153
nuclear@14 154 #ifndef XMD_H /* X11/xmd.h correctly defines INT16 */
nuclear@14 155 typedef short INT16;
nuclear@14 156 #endif
nuclear@14 157
nuclear@14 158 /* INT32 must hold at least signed 32-bit values. */
nuclear@14 159
nuclear@14 160 #ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
nuclear@14 161 typedef int INT32;
nuclear@14 162 #endif
nuclear@14 163
nuclear@14 164 /* Datatype used for image dimensions. The JPEG standard only supports
nuclear@14 165 * images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
nuclear@14 166 * "unsigned int" is sufficient on all machines. However, if you need to
nuclear@14 167 * handle larger images and you don't mind deviating from the spec, you
nuclear@14 168 * can change this datatype.
nuclear@14 169 */
nuclear@14 170
nuclear@14 171 typedef unsigned int JDIMENSION;
nuclear@14 172
nuclear@14 173 #define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */
nuclear@14 174
nuclear@14 175
nuclear@14 176 /* These macros are used in all function definitions and extern declarations.
nuclear@14 177 * You could modify them if you need to change function linkage conventions;
nuclear@14 178 * in particular, you'll need to do that to make the library a Windows DLL.
nuclear@14 179 * Another application is to make all functions global for use with debuggers
nuclear@14 180 * or code profilers that require it.
nuclear@14 181 */
nuclear@14 182
nuclear@14 183 /* a function called through method pointers: */
nuclear@14 184 #define METHODDEF(type) static type
nuclear@14 185 /* a function used only in its module: */
nuclear@14 186 #define LOCAL(type) static type
nuclear@14 187 /* a function referenced thru EXTERNs: */
nuclear@14 188 #define GLOBAL(type) type
nuclear@14 189 /* a reference to a GLOBAL function: */
nuclear@14 190 #define EXTERN(type) extern type
nuclear@14 191
nuclear@14 192
nuclear@14 193 /* This macro is used to declare a "method", that is, a function pointer.
nuclear@14 194 * We want to supply prototype parameters if the compiler can cope.
nuclear@14 195 * Note that the arglist parameter must be parenthesized!
nuclear@14 196 * Again, you can customize this if you need special linkage keywords.
nuclear@14 197 */
nuclear@14 198
nuclear@14 199 #ifdef HAVE_PROTOTYPES
nuclear@14 200 #define JMETHOD(type,methodname,arglist) type (*methodname) arglist
nuclear@14 201 #else
nuclear@14 202 #define JMETHOD(type,methodname,arglist) type (*methodname) ()
nuclear@14 203 #endif
nuclear@14 204
nuclear@14 205
nuclear@14 206 /* Here is the pseudo-keyword for declaring pointers that must be "far"
nuclear@14 207 * on 80x86 machines. Most of the specialized coding for 80x86 is handled
nuclear@14 208 * by just saying "FAR *" where such a pointer is needed. In a few places
nuclear@14 209 * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
nuclear@14 210 */
nuclear@14 211
nuclear@14 212 #ifdef FAR
nuclear@14 213 #undef FAR
nuclear@14 214 #endif
nuclear@14 215
nuclear@14 216 #ifdef NEED_FAR_POINTERS
nuclear@14 217 #define FAR far
nuclear@14 218 #else
nuclear@14 219 #define FAR
nuclear@14 220 #endif
nuclear@14 221
nuclear@14 222
nuclear@14 223 /*
nuclear@14 224 * On a few systems, type boolean and/or its values FALSE, TRUE may appear
nuclear@14 225 * in standard header files. Or you may have conflicts with application-
nuclear@14 226 * specific header files that you want to include together with these files.
nuclear@14 227 * Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
nuclear@14 228 */
nuclear@14 229
nuclear@14 230 #ifndef HAVE_BOOLEAN
nuclear@14 231 typedef int boolean;
nuclear@14 232 #endif
nuclear@14 233 #ifndef FALSE /* in case these macros already exist */
nuclear@14 234 #define FALSE 0 /* values of boolean */
nuclear@14 235 #endif
nuclear@14 236 #ifndef TRUE
nuclear@14 237 #define TRUE 1
nuclear@14 238 #endif
nuclear@14 239
nuclear@14 240
nuclear@14 241 /*
nuclear@14 242 * The remaining options affect code selection within the JPEG library,
nuclear@14 243 * but they don't need to be visible to most applications using the library.
nuclear@14 244 * To minimize application namespace pollution, the symbols won't be
nuclear@14 245 * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined.
nuclear@14 246 */
nuclear@14 247
nuclear@14 248 #ifdef JPEG_INTERNALS
nuclear@14 249 #define JPEG_INTERNAL_OPTIONS
nuclear@14 250 #endif
nuclear@14 251
nuclear@14 252 #ifdef JPEG_INTERNAL_OPTIONS
nuclear@14 253
nuclear@14 254
nuclear@14 255 /*
nuclear@14 256 * These defines indicate whether to include various optional functions.
nuclear@14 257 * Undefining some of these symbols will produce a smaller but less capable
nuclear@14 258 * library. Note that you can leave certain source files out of the
nuclear@14 259 * compilation/linking process if you've #undef'd the corresponding symbols.
nuclear@14 260 * (You may HAVE to do that if your compiler doesn't like null source files.)
nuclear@14 261 */
nuclear@14 262
nuclear@14 263 /* Arithmetic coding is unsupported for legal reasons. Complaints to IBM. */
nuclear@14 264
nuclear@14 265 /* Capability options common to encoder and decoder: */
nuclear@14 266
nuclear@14 267 #define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */
nuclear@14 268 #define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */
nuclear@14 269 #define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */
nuclear@14 270
nuclear@14 271 /* Encoder capability options: */
nuclear@14 272
nuclear@14 273 #undef C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
nuclear@14 274 #define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
nuclear@14 275 #define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
nuclear@14 276 #define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */
nuclear@14 277 /* Note: if you selected 12-bit data precision, it is dangerous to turn off
nuclear@14 278 * ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit
nuclear@14 279 * precision, so jchuff.c normally uses entropy optimization to compute
nuclear@14 280 * usable tables for higher precision. If you don't want to do optimization,
nuclear@14 281 * you'll have to supply different default Huffman tables.
nuclear@14 282 * The exact same statements apply for progressive JPEG: the default tables
nuclear@14 283 * don't work for progressive mode. (This may get fixed, however.)
nuclear@14 284 */
nuclear@14 285 #define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */
nuclear@14 286
nuclear@14 287 /* Decoder capability options: */
nuclear@14 288
nuclear@14 289 #undef D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
nuclear@14 290 #define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
nuclear@14 291 #define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
nuclear@14 292 #define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */
nuclear@14 293 #define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */
nuclear@14 294 #define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */
nuclear@14 295 #undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */
nuclear@14 296 #define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */
nuclear@14 297 #define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */
nuclear@14 298 #define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */
nuclear@14 299
nuclear@14 300 /* more capability options later, no doubt */
nuclear@14 301
nuclear@14 302
nuclear@14 303 /*
nuclear@14 304 * Ordering of RGB data in scanlines passed to or from the application.
nuclear@14 305 * If your application wants to deal with data in the order B,G,R, just
nuclear@14 306 * change these macros. You can also deal with formats such as R,G,B,X
nuclear@14 307 * (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing
nuclear@14 308 * the offsets will also change the order in which colormap data is organized.
nuclear@14 309 * RESTRICTIONS:
nuclear@14 310 * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
nuclear@14 311 * 2. These macros only affect RGB<=>YCbCr color conversion, so they are not
nuclear@14 312 * useful if you are using JPEG color spaces other than YCbCr or grayscale.
nuclear@14 313 * 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
nuclear@14 314 * is not 3 (they don't understand about dummy color components!). So you
nuclear@14 315 * can't use color quantization if you change that value.
nuclear@14 316 */
nuclear@14 317
nuclear@14 318 #define RGB_RED 0 /* Offset of Red in an RGB scanline element */
nuclear@14 319 #define RGB_GREEN 1 /* Offset of Green */
nuclear@14 320 #define RGB_BLUE 2 /* Offset of Blue */
nuclear@14 321 #define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */
nuclear@14 322
nuclear@14 323
nuclear@14 324 /* Definitions for speed-related optimizations. */
nuclear@14 325
nuclear@14 326
nuclear@14 327 /* If your compiler supports inline functions, define INLINE
nuclear@14 328 * as the inline keyword; otherwise define it as empty.
nuclear@14 329 */
nuclear@14 330
nuclear@14 331 #ifndef INLINE
nuclear@14 332 #ifdef __GNUC__ /* for instance, GNU C knows about inline */
nuclear@14 333 #define INLINE __inline__
nuclear@14 334 #endif
nuclear@14 335 #ifndef INLINE
nuclear@14 336 #define INLINE /* default is to define it as empty */
nuclear@14 337 #endif
nuclear@14 338 #endif
nuclear@14 339
nuclear@14 340
nuclear@14 341 /* On some machines (notably 68000 series) "int" is 32 bits, but multiplying
nuclear@14 342 * two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER
nuclear@14 343 * as short on such a machine. MULTIPLIER must be at least 16 bits wide.
nuclear@14 344 */
nuclear@14 345
nuclear@14 346 #ifndef MULTIPLIER
nuclear@14 347 #define MULTIPLIER int /* type for fastest integer multiply */
nuclear@14 348 #endif
nuclear@14 349
nuclear@14 350
nuclear@14 351 /* FAST_FLOAT should be either float or double, whichever is done faster
nuclear@14 352 * by your compiler. (Note that this type is only used in the floating point
nuclear@14 353 * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
nuclear@14 354 * Typically, float is faster in ANSI C compilers, while double is faster in
nuclear@14 355 * pre-ANSI compilers (because they insist on converting to double anyway).
nuclear@14 356 * The code below therefore chooses float if we have ANSI-style prototypes.
nuclear@14 357 */
nuclear@14 358
nuclear@14 359 #ifndef FAST_FLOAT
nuclear@14 360 #ifdef HAVE_PROTOTYPES
nuclear@14 361 #define FAST_FLOAT float
nuclear@14 362 #else
nuclear@14 363 #define FAST_FLOAT double
nuclear@14 364 #endif
nuclear@14 365 #endif
nuclear@14 366
nuclear@14 367 #endif /* JPEG_INTERNAL_OPTIONS */