jmorecfg.h revision 5996a25e2f50d20d6a8f09830724035b49c3927b
136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* 236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * jmorecfg.h 336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * 45ead57a34a398aa798f35bd7a6abad19b2e453e2Thomas G. Lane * Copyright (C) 1991-1997, Thomas G. Lane. 55996a25e2f50d20d6a8f09830724035b49c3927bGuido Vollbeding * Modified 1997-2009 by Guido Vollbeding. 636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * This file is part of the Independent JPEG Group's software. 736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * For conditions of distribution and use, see the accompanying README file. 836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * 936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * This file contains additional configuration options that customize the 1036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * JPEG software for special applications or support machine-dependent 1136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * optimizations. Most users will not need to touch this file. 1236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */ 1336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 1436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 1536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* 1636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * Define BITS_IN_JSAMPLE as either 1736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * 8 for 8-bit sample values (the usual setting) 1836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * 12 for 12-bit sample values 1936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * Only 8 and 12 are legal data precisions for lossy JPEG according to the 2036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * JPEG standard, and the IJG code does not support anything else! 2136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * We do not support run-time selection of data precision, sorry. 2236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */ 2336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 2436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */ 2536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 2636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 2736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* 2836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * Maximum number of components (color channels) allowed in JPEG image. 2936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * To meet the letter of the JPEG spec, set this to 255. However, darn 3036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * few applications need more than 4 channels (maybe 5 for CMYK + alpha 3136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * mask). We recommend 10 as a reasonable compromise; use 4 if you are 3236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * really short on memory. (Each allowed component costs a hundred or so 3336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * bytes of storage, whether actually used in an image or not.) 3436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */ 3536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 3636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define MAX_COMPONENTS 10 /* maximum number of image components */ 3736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 3836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 3936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* 4036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * Basic data types. 4136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * You may need to change these if you have a machine with unusual data 4236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * type sizes; for example, "char" not 8 bits, "short" not 16 bits, 4336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits, 4436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * but it had better be at least 16. 4536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */ 4636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 4736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Representation of a single sample (pixel element value). 4836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * We frequently allocate large arrays of these, so it's important to keep 4936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * them small. But if you have memory to burn and access to char or short 5036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * arrays is very slow on your hardware, you might want to change these. 5136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */ 5236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 5336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#if BITS_IN_JSAMPLE == 8 5436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* JSAMPLE should be the smallest type that will hold the values 0..255. 5536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * You can use a signed char by having GETJSAMPLE mask it with 0xFF. 5636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */ 5736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 5836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifdef HAVE_UNSIGNED_CHAR 5936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 6036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanetypedef unsigned char JSAMPLE; 6136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define GETJSAMPLE(value) ((int) (value)) 6236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 6336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#else /* not HAVE_UNSIGNED_CHAR */ 6436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 6536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanetypedef char JSAMPLE; 6636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifdef CHAR_IS_UNSIGNED 6736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define GETJSAMPLE(value) ((int) (value)) 6836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#else 6936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define GETJSAMPLE(value) ((int) (value) & 0xFF) 7036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif /* CHAR_IS_UNSIGNED */ 7136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 7236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif /* HAVE_UNSIGNED_CHAR */ 7336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 7436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define MAXJSAMPLE 255 7536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define CENTERJSAMPLE 128 7636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 7736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif /* BITS_IN_JSAMPLE == 8 */ 7836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 7936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 8036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#if BITS_IN_JSAMPLE == 12 8136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* JSAMPLE should be the smallest type that will hold the values 0..4095. 8236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * On nearly all machines "short" will do nicely. 8336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */ 8436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 8536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanetypedef short JSAMPLE; 8636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define GETJSAMPLE(value) ((int) (value)) 8736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 8836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define MAXJSAMPLE 4095 8936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define CENTERJSAMPLE 2048 9036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 9136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif /* BITS_IN_JSAMPLE == 12 */ 9236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 9336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 9436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Representation of a DCT frequency coefficient. 9536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * This should be a signed value of at least 16 bits; "short" is usually OK. 9636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * Again, we allocate large arrays of these, but you can change to int 9736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * if you have memory to burn and "short" is really slow. 9836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */ 9936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 10036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanetypedef short JCOEF; 10136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 10236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 10336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Compressed datastreams are represented as arrays of JOCTET. 10436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * These must be EXACTLY 8 bits wide, at least once they are written to 10536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * external storage. Note that when using the stdio data source/destination 10636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * managers, this is also the data type passed to fread/fwrite. 10736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */ 10836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 10936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifdef HAVE_UNSIGNED_CHAR 11036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 11136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanetypedef unsigned char JOCTET; 11236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define GETJOCTET(value) (value) 11336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 11436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#else /* not HAVE_UNSIGNED_CHAR */ 11536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 11636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanetypedef char JOCTET; 11736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifdef CHAR_IS_UNSIGNED 11836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define GETJOCTET(value) (value) 11936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#else 12036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define GETJOCTET(value) ((value) & 0xFF) 12136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif /* CHAR_IS_UNSIGNED */ 12236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 12336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif /* HAVE_UNSIGNED_CHAR */ 12436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 12536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 12636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* These typedefs are used for various table entries and so forth. 12736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * They must be at least as wide as specified; but making them too big 12836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * won't cost a huge amount of memory, so we don't provide special 12936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * extraction code like we did for JSAMPLE. (In other words, these 13036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * typedefs live at a different point on the speed/space tradeoff curve.) 13136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */ 13236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 13336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* UINT8 must hold at least the values 0..255. */ 13436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 13536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifdef HAVE_UNSIGNED_CHAR 13636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanetypedef unsigned char UINT8; 13736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#else /* not HAVE_UNSIGNED_CHAR */ 13836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifdef CHAR_IS_UNSIGNED 13936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanetypedef char UINT8; 14036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#else /* not CHAR_IS_UNSIGNED */ 14136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanetypedef short UINT8; 14236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif /* CHAR_IS_UNSIGNED */ 14336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif /* HAVE_UNSIGNED_CHAR */ 14436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 14536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* UINT16 must hold at least the values 0..65535. */ 14636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 14736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifdef HAVE_UNSIGNED_SHORT 14836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanetypedef unsigned short UINT16; 14936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#else /* not HAVE_UNSIGNED_SHORT */ 15036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanetypedef unsigned int UINT16; 15136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif /* HAVE_UNSIGNED_SHORT */ 15236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 15336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* INT16 must hold at least the values -32768..32767. */ 15436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 15536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */ 15636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanetypedef short INT16; 15736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif 15836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 15936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* INT32 must hold at least signed 32-bit values. */ 16036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 16136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ 1625996a25e2f50d20d6a8f09830724035b49c3927bGuido Vollbeding#ifndef _BASETSD_H_ /* Microsoft defines it in basetsd.h */ 1635996a25e2f50d20d6a8f09830724035b49c3927bGuido Vollbeding#ifndef QGLOBAL_H /* Qt defines it in qglobal.h */ 16436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanetypedef long INT32; 16536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif 1665996a25e2f50d20d6a8f09830724035b49c3927bGuido Vollbeding#endif 1675996a25e2f50d20d6a8f09830724035b49c3927bGuido Vollbeding#endif 16836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 16936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Datatype used for image dimensions. The JPEG standard only supports 17036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * images up to 64K*64K due to 16-bit fields in SOF markers. Therefore 17136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * "unsigned int" is sufficient on all machines. However, if you need to 17236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * handle larger images and you don't mind deviating from the spec, you 17336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * can change this datatype. 17436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */ 17536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 17636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanetypedef unsigned int JDIMENSION; 17736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 17836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */ 17936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 18036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 181489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane/* These macros are used in all function definitions and extern declarations. 182489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane * You could modify them if you need to change function linkage conventions; 183489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane * in particular, you'll need to do that to make the library a Windows DLL. 18436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * Another application is to make all functions global for use with debuggers 18536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * or code profilers that require it. 18636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */ 18736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 188489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane/* a function called through method pointers: */ 189489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane#define METHODDEF(type) static type 190489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane/* a function used only in its module: */ 191489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane#define LOCAL(type) static type 192489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane/* a function referenced thru EXTERNs: */ 193489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane#define GLOBAL(type) type 194489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane/* a reference to a GLOBAL function: */ 195489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane#define EXTERN(type) extern type 196489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane 197489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane 198489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane/* This macro is used to declare a "method", that is, a function pointer. 199489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane * We want to supply prototype parameters if the compiler can cope. 200489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane * Note that the arglist parameter must be parenthesized! 201489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane * Again, you can customize this if you need special linkage keywords. 202489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane */ 203489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane 204489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane#ifdef HAVE_PROTOTYPES 205489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane#define JMETHOD(type,methodname,arglist) type (*methodname) arglist 206489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane#else 207489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane#define JMETHOD(type,methodname,arglist) type (*methodname) () 208489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane#endif 20936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 21036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 21136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Here is the pseudo-keyword for declaring pointers that must be "far" 21236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * on 80x86 machines. Most of the specialized coding for 80x86 is handled 21336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * by just saying "FAR *" where such a pointer is needed. In a few places 21436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol. 21536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */ 21636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 2175996a25e2f50d20d6a8f09830724035b49c3927bGuido Vollbeding#ifndef FAR 21836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifdef NEED_FAR_POINTERS 21936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define FAR far 22036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#else 22136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define FAR 22236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif 2235996a25e2f50d20d6a8f09830724035b49c3927bGuido Vollbeding#endif 22436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 22536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 22636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* 22736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * On a few systems, type boolean and/or its values FALSE, TRUE may appear 22836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * in standard header files. Or you may have conflicts with application- 22936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * specific header files that you want to include together with these files. 23036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * Defining HAVE_BOOLEAN before including jpeglib.h should make it work. 23136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */ 23236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 23336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifndef HAVE_BOOLEAN 23436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanetypedef int boolean; 23536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif 23636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifndef FALSE /* in case these macros already exist */ 23736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define FALSE 0 /* values of boolean */ 23836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif 23936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifndef TRUE 24036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define TRUE 1 24136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif 24236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 24336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 24436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* 24536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * The remaining options affect code selection within the JPEG library, 24636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * but they don't need to be visible to most applications using the library. 24736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * To minimize application namespace pollution, the symbols won't be 24836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined. 24936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */ 25036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 25136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifdef JPEG_INTERNALS 25236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define JPEG_INTERNAL_OPTIONS 25336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif 25436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 25536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifdef JPEG_INTERNAL_OPTIONS 25636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 25736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 25836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* 25936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * These defines indicate whether to include various optional functions. 26036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * Undefining some of these symbols will produce a smaller but less capable 26136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * library. Note that you can leave certain source files out of the 26236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * compilation/linking process if you've #undef'd the corresponding symbols. 26336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * (You may HAVE to do that if your compiler doesn't like null source files.) 26436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */ 26536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 26636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Capability options common to encoder and decoder: */ 26736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 26836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */ 26936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */ 27036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */ 27136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 27236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Encoder capability options: */ 27336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 2741e247ac854f8e33682bcfea475f6bccc42377208Guido Vollbeding#define C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ 275bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ 276bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ 2775996a25e2f50d20d6a8f09830724035b49c3927bGuido Vollbeding#define DCT_SCALING_SUPPORTED /* Input rescaling via DCT? (Requires DCT_ISLOW)*/ 27836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */ 27936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Note: if you selected 12-bit data precision, it is dangerous to turn off 28036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit 28136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * precision, so jchuff.c normally uses entropy optimization to compute 28236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * usable tables for higher precision. If you don't want to do optimization, 28336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * you'll have to supply different default Huffman tables. 284bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane * The exact same statements apply for progressive JPEG: the default tables 285bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane * don't work for progressive mode. (This may get fixed, however.) 28636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */ 28736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */ 28836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 28936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Decoder capability options: */ 29036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 2911e247ac854f8e33682bcfea475f6bccc42377208Guido Vollbeding#define D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ 29236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ 293bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ 2945996a25e2f50d20d6a8f09830724035b49c3927bGuido Vollbeding#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */ 2955ead57a34a398aa798f35bd7a6abad19b2e453e2Thomas G. Lane#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */ 296bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */ 29736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */ 29836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */ 29936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */ 30036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */ 30136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 30236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* more capability options later, no doubt */ 30336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 30436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 30536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* 30636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * Ordering of RGB data in scanlines passed to or from the application. 30736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * If your application wants to deal with data in the order B,G,R, just 30836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * change these macros. You can also deal with formats such as R,G,B,X 30936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing 31036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * the offsets will also change the order in which colormap data is organized. 31136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * RESTRICTIONS: 31236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats. 31336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * 2. These macros only affect RGB<=>YCbCr color conversion, so they are not 31436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * useful if you are using JPEG color spaces other than YCbCr or grayscale. 31536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE 31636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * is not 3 (they don't understand about dummy color components!). So you 31736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * can't use color quantization if you change that value. 31836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */ 31936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 32036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define RGB_RED 0 /* Offset of Red in an RGB scanline element */ 32136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define RGB_GREEN 1 /* Offset of Green */ 32236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define RGB_BLUE 2 /* Offset of Blue */ 32336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */ 32436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 32536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 32636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Definitions for speed-related optimizations. */ 32736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 32836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 32936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* If your compiler supports inline functions, define INLINE 33036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * as the inline keyword; otherwise define it as empty. 33136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */ 33236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 33336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifndef INLINE 33436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifdef __GNUC__ /* for instance, GNU C knows about inline */ 33536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define INLINE __inline__ 33636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif 33736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifndef INLINE 33836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define INLINE /* default is to define it as empty */ 33936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif 34036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif 34136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 34236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 34336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying 34436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER 34536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * as short on such a machine. MULTIPLIER must be at least 16 bits wide. 34636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */ 34736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 34836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifndef MULTIPLIER 34936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define MULTIPLIER int /* type for fastest integer multiply */ 35036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif 35136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 35236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 35336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* FAST_FLOAT should be either float or double, whichever is done faster 35436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * by your compiler. (Note that this type is only used in the floating point 35536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.) 35636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * Typically, float is faster in ANSI C compilers, while double is faster in 35736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * pre-ANSI compilers (because they insist on converting to double anyway). 35836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * The code below therefore chooses float if we have ANSI-style prototypes. 35936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */ 36036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 36136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifndef FAST_FLOAT 36236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifdef HAVE_PROTOTYPES 36336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define FAST_FLOAT float 36436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#else 36536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define FAST_FLOAT double 36636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif 36736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif 36836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane 36936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif /* JPEG_INTERNAL_OPTIONS */ 370