istereo
diff libs/libjpeg/jmorecfg.h @ 26:862a3329a8f0
wohooo, added a shitload of code from zlib/libpng/libjpeg. When the good lord was raining shared libraries the iphone held a fucking umbrella...
author | John Tsiombikas <nuclear@mutantstargoat.com> |
---|---|
date | Thu, 08 Sep 2011 06:28:38 +0300 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libs/libjpeg/jmorecfg.h Thu Sep 08 06:28:38 2011 +0300 1.3 @@ -0,0 +1,367 @@ 1.4 +/* 1.5 + * jmorecfg.h 1.6 + * 1.7 + * Copyright (C) 1991-1997, Thomas G. Lane. 1.8 + * This file is part of the Independent JPEG Group's software. 1.9 + * For conditions of distribution and use, see the accompanying README file. 1.10 + * 1.11 + * This file contains additional configuration options that customize the 1.12 + * JPEG software for special applications or support machine-dependent 1.13 + * optimizations. Most users will not need to touch this file. 1.14 + */ 1.15 + 1.16 + 1.17 +/* 1.18 + * Define BITS_IN_JSAMPLE as either 1.19 + * 8 for 8-bit sample values (the usual setting) 1.20 + * 12 for 12-bit sample values 1.21 + * Only 8 and 12 are legal data precisions for lossy JPEG according to the 1.22 + * JPEG standard, and the IJG code does not support anything else! 1.23 + * We do not support run-time selection of data precision, sorry. 1.24 + */ 1.25 + 1.26 +#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */ 1.27 + 1.28 + 1.29 +/* 1.30 + * Maximum number of components (color channels) allowed in JPEG image. 1.31 + * To meet the letter of the JPEG spec, set this to 255. However, darn 1.32 + * few applications need more than 4 channels (maybe 5 for CMYK + alpha 1.33 + * mask). We recommend 10 as a reasonable compromise; use 4 if you are 1.34 + * really short on memory. (Each allowed component costs a hundred or so 1.35 + * bytes of storage, whether actually used in an image or not.) 1.36 + */ 1.37 + 1.38 +#define MAX_COMPONENTS 10 /* maximum number of image components */ 1.39 + 1.40 + 1.41 +/* 1.42 + * Basic data types. 1.43 + * You may need to change these if you have a machine with unusual data 1.44 + * type sizes; for example, "char" not 8 bits, "short" not 16 bits, 1.45 + * or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits, 1.46 + * but it had better be at least 16. 1.47 + */ 1.48 + 1.49 +/* Representation of a single sample (pixel element value). 1.50 + * We frequently allocate large arrays of these, so it's important to keep 1.51 + * them small. But if you have memory to burn and access to char or short 1.52 + * arrays is very slow on your hardware, you might want to change these. 1.53 + */ 1.54 + 1.55 +#if BITS_IN_JSAMPLE == 8 1.56 +/* JSAMPLE should be the smallest type that will hold the values 0..255. 1.57 + * You can use a signed char by having GETJSAMPLE mask it with 0xFF. 1.58 + */ 1.59 + 1.60 +#ifdef HAVE_UNSIGNED_CHAR 1.61 + 1.62 +typedef unsigned char JSAMPLE; 1.63 +#define GETJSAMPLE(value) ((int) (value)) 1.64 + 1.65 +#else /* not HAVE_UNSIGNED_CHAR */ 1.66 + 1.67 +typedef char JSAMPLE; 1.68 +#ifdef CHAR_IS_UNSIGNED 1.69 +#define GETJSAMPLE(value) ((int) (value)) 1.70 +#else 1.71 +#define GETJSAMPLE(value) ((int) (value) & 0xFF) 1.72 +#endif /* CHAR_IS_UNSIGNED */ 1.73 + 1.74 +#endif /* HAVE_UNSIGNED_CHAR */ 1.75 + 1.76 +#define MAXJSAMPLE 255 1.77 +#define CENTERJSAMPLE 128 1.78 + 1.79 +#endif /* BITS_IN_JSAMPLE == 8 */ 1.80 + 1.81 + 1.82 +#if BITS_IN_JSAMPLE == 12 1.83 +/* JSAMPLE should be the smallest type that will hold the values 0..4095. 1.84 + * On nearly all machines "short" will do nicely. 1.85 + */ 1.86 + 1.87 +typedef short JSAMPLE; 1.88 +#define GETJSAMPLE(value) ((int) (value)) 1.89 + 1.90 +#define MAXJSAMPLE 4095 1.91 +#define CENTERJSAMPLE 2048 1.92 + 1.93 +#endif /* BITS_IN_JSAMPLE == 12 */ 1.94 + 1.95 + 1.96 +/* Representation of a DCT frequency coefficient. 1.97 + * This should be a signed value of at least 16 bits; "short" is usually OK. 1.98 + * Again, we allocate large arrays of these, but you can change to int 1.99 + * if you have memory to burn and "short" is really slow. 1.100 + */ 1.101 + 1.102 +typedef short JCOEF; 1.103 + 1.104 + 1.105 +/* Compressed datastreams are represented as arrays of JOCTET. 1.106 + * These must be EXACTLY 8 bits wide, at least once they are written to 1.107 + * external storage. Note that when using the stdio data source/destination 1.108 + * managers, this is also the data type passed to fread/fwrite. 1.109 + */ 1.110 + 1.111 +#ifdef HAVE_UNSIGNED_CHAR 1.112 + 1.113 +typedef unsigned char JOCTET; 1.114 +#define GETJOCTET(value) (value) 1.115 + 1.116 +#else /* not HAVE_UNSIGNED_CHAR */ 1.117 + 1.118 +typedef char JOCTET; 1.119 +#ifdef CHAR_IS_UNSIGNED 1.120 +#define GETJOCTET(value) (value) 1.121 +#else 1.122 +#define GETJOCTET(value) ((value) & 0xFF) 1.123 +#endif /* CHAR_IS_UNSIGNED */ 1.124 + 1.125 +#endif /* HAVE_UNSIGNED_CHAR */ 1.126 + 1.127 + 1.128 +/* These typedefs are used for various table entries and so forth. 1.129 + * They must be at least as wide as specified; but making them too big 1.130 + * won't cost a huge amount of memory, so we don't provide special 1.131 + * extraction code like we did for JSAMPLE. (In other words, these 1.132 + * typedefs live at a different point on the speed/space tradeoff curve.) 1.133 + */ 1.134 + 1.135 +/* UINT8 must hold at least the values 0..255. */ 1.136 + 1.137 +#ifdef HAVE_UNSIGNED_CHAR 1.138 +typedef unsigned char UINT8; 1.139 +#else /* not HAVE_UNSIGNED_CHAR */ 1.140 +#ifdef CHAR_IS_UNSIGNED 1.141 +typedef char UINT8; 1.142 +#else /* not CHAR_IS_UNSIGNED */ 1.143 +typedef short UINT8; 1.144 +#endif /* CHAR_IS_UNSIGNED */ 1.145 +#endif /* HAVE_UNSIGNED_CHAR */ 1.146 + 1.147 +/* UINT16 must hold at least the values 0..65535. */ 1.148 + 1.149 +#ifdef HAVE_UNSIGNED_SHORT 1.150 +typedef unsigned short UINT16; 1.151 +#else /* not HAVE_UNSIGNED_SHORT */ 1.152 +typedef unsigned int UINT16; 1.153 +#endif /* HAVE_UNSIGNED_SHORT */ 1.154 + 1.155 +/* INT16 must hold at least the values -32768..32767. */ 1.156 + 1.157 +#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */ 1.158 +typedef short INT16; 1.159 +#endif 1.160 + 1.161 +/* INT32 must hold at least signed 32-bit values. */ 1.162 + 1.163 +#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ 1.164 +typedef int INT32; 1.165 +#endif 1.166 + 1.167 +/* Datatype used for image dimensions. The JPEG standard only supports 1.168 + * images up to 64K*64K due to 16-bit fields in SOF markers. Therefore 1.169 + * "unsigned int" is sufficient on all machines. However, if you need to 1.170 + * handle larger images and you don't mind deviating from the spec, you 1.171 + * can change this datatype. 1.172 + */ 1.173 + 1.174 +typedef unsigned int JDIMENSION; 1.175 + 1.176 +#define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */ 1.177 + 1.178 + 1.179 +/* These macros are used in all function definitions and extern declarations. 1.180 + * You could modify them if you need to change function linkage conventions; 1.181 + * in particular, you'll need to do that to make the library a Windows DLL. 1.182 + * Another application is to make all functions global for use with debuggers 1.183 + * or code profilers that require it. 1.184 + */ 1.185 + 1.186 +/* a function called through method pointers: */ 1.187 +#define METHODDEF(type) static type 1.188 +/* a function used only in its module: */ 1.189 +#define LOCAL(type) static type 1.190 +/* a function referenced thru EXTERNs: */ 1.191 +#define GLOBAL(type) type 1.192 +/* a reference to a GLOBAL function: */ 1.193 +#define EXTERN(type) extern type 1.194 + 1.195 + 1.196 +/* This macro is used to declare a "method", that is, a function pointer. 1.197 + * We want to supply prototype parameters if the compiler can cope. 1.198 + * Note that the arglist parameter must be parenthesized! 1.199 + * Again, you can customize this if you need special linkage keywords. 1.200 + */ 1.201 + 1.202 +#ifdef HAVE_PROTOTYPES 1.203 +#define JMETHOD(type,methodname,arglist) type (*methodname) arglist 1.204 +#else 1.205 +#define JMETHOD(type,methodname,arglist) type (*methodname) () 1.206 +#endif 1.207 + 1.208 + 1.209 +/* Here is the pseudo-keyword for declaring pointers that must be "far" 1.210 + * on 80x86 machines. Most of the specialized coding for 80x86 is handled 1.211 + * by just saying "FAR *" where such a pointer is needed. In a few places 1.212 + * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol. 1.213 + */ 1.214 + 1.215 +#ifdef FAR 1.216 +#undef FAR 1.217 +#endif 1.218 + 1.219 +#ifdef NEED_FAR_POINTERS 1.220 +#define FAR far 1.221 +#else 1.222 +#define FAR 1.223 +#endif 1.224 + 1.225 + 1.226 +/* 1.227 + * On a few systems, type boolean and/or its values FALSE, TRUE may appear 1.228 + * in standard header files. Or you may have conflicts with application- 1.229 + * specific header files that you want to include together with these files. 1.230 + * Defining HAVE_BOOLEAN before including jpeglib.h should make it work. 1.231 + */ 1.232 + 1.233 +#ifndef HAVE_BOOLEAN 1.234 +typedef int boolean; 1.235 +#endif 1.236 +#ifndef FALSE /* in case these macros already exist */ 1.237 +#define FALSE 0 /* values of boolean */ 1.238 +#endif 1.239 +#ifndef TRUE 1.240 +#define TRUE 1 1.241 +#endif 1.242 + 1.243 + 1.244 +/* 1.245 + * The remaining options affect code selection within the JPEG library, 1.246 + * but they don't need to be visible to most applications using the library. 1.247 + * To minimize application namespace pollution, the symbols won't be 1.248 + * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined. 1.249 + */ 1.250 + 1.251 +#ifdef JPEG_INTERNALS 1.252 +#define JPEG_INTERNAL_OPTIONS 1.253 +#endif 1.254 + 1.255 +#ifdef JPEG_INTERNAL_OPTIONS 1.256 + 1.257 + 1.258 +/* 1.259 + * These defines indicate whether to include various optional functions. 1.260 + * Undefining some of these symbols will produce a smaller but less capable 1.261 + * library. Note that you can leave certain source files out of the 1.262 + * compilation/linking process if you've #undef'd the corresponding symbols. 1.263 + * (You may HAVE to do that if your compiler doesn't like null source files.) 1.264 + */ 1.265 + 1.266 +/* Arithmetic coding is unsupported for legal reasons. Complaints to IBM. */ 1.267 + 1.268 +/* Capability options common to encoder and decoder: */ 1.269 + 1.270 +#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */ 1.271 +#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */ 1.272 +#define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */ 1.273 + 1.274 +/* Encoder capability options: */ 1.275 + 1.276 +#undef C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ 1.277 +#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ 1.278 +#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ 1.279 +#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */ 1.280 +/* Note: if you selected 12-bit data precision, it is dangerous to turn off 1.281 + * ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit 1.282 + * precision, so jchuff.c normally uses entropy optimization to compute 1.283 + * usable tables for higher precision. If you don't want to do optimization, 1.284 + * you'll have to supply different default Huffman tables. 1.285 + * The exact same statements apply for progressive JPEG: the default tables 1.286 + * don't work for progressive mode. (This may get fixed, however.) 1.287 + */ 1.288 +#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */ 1.289 + 1.290 +/* Decoder capability options: */ 1.291 + 1.292 +#undef D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ 1.293 +#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ 1.294 +#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ 1.295 +#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */ 1.296 +#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */ 1.297 +#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */ 1.298 +#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */ 1.299 +#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */ 1.300 +#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */ 1.301 +#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */ 1.302 + 1.303 +/* more capability options later, no doubt */ 1.304 + 1.305 + 1.306 +/* 1.307 + * Ordering of RGB data in scanlines passed to or from the application. 1.308 + * If your application wants to deal with data in the order B,G,R, just 1.309 + * change these macros. You can also deal with formats such as R,G,B,X 1.310 + * (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing 1.311 + * the offsets will also change the order in which colormap data is organized. 1.312 + * RESTRICTIONS: 1.313 + * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats. 1.314 + * 2. These macros only affect RGB<=>YCbCr color conversion, so they are not 1.315 + * useful if you are using JPEG color spaces other than YCbCr or grayscale. 1.316 + * 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE 1.317 + * is not 3 (they don't understand about dummy color components!). So you 1.318 + * can't use color quantization if you change that value. 1.319 + */ 1.320 + 1.321 +#define RGB_RED 0 /* Offset of Red in an RGB scanline element */ 1.322 +#define RGB_GREEN 1 /* Offset of Green */ 1.323 +#define RGB_BLUE 2 /* Offset of Blue */ 1.324 +#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */ 1.325 + 1.326 + 1.327 +/* Definitions for speed-related optimizations. */ 1.328 + 1.329 + 1.330 +/* If your compiler supports inline functions, define INLINE 1.331 + * as the inline keyword; otherwise define it as empty. 1.332 + */ 1.333 + 1.334 +#ifndef INLINE 1.335 +#ifdef __GNUC__ /* for instance, GNU C knows about inline */ 1.336 +#define INLINE __inline__ 1.337 +#endif 1.338 +#ifndef INLINE 1.339 +#define INLINE /* default is to define it as empty */ 1.340 +#endif 1.341 +#endif 1.342 + 1.343 + 1.344 +/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying 1.345 + * two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER 1.346 + * as short on such a machine. MULTIPLIER must be at least 16 bits wide. 1.347 + */ 1.348 + 1.349 +#ifndef MULTIPLIER 1.350 +#define MULTIPLIER int /* type for fastest integer multiply */ 1.351 +#endif 1.352 + 1.353 + 1.354 +/* FAST_FLOAT should be either float or double, whichever is done faster 1.355 + * by your compiler. (Note that this type is only used in the floating point 1.356 + * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.) 1.357 + * Typically, float is faster in ANSI C compilers, while double is faster in 1.358 + * pre-ANSI compilers (because they insist on converting to double anyway). 1.359 + * The code below therefore chooses float if we have ANSI-style prototypes. 1.360 + */ 1.361 + 1.362 +#ifndef FAST_FLOAT 1.363 +#ifdef HAVE_PROTOTYPES 1.364 +#define FAST_FLOAT float 1.365 +#else 1.366 +#define FAST_FLOAT double 1.367 +#endif 1.368 +#endif 1.369 + 1.370 +#endif /* JPEG_INTERNAL_OPTIONS */