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