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