]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - libs/jpeg6/jmorecfg.h
eol style
[xonotic/netradiant.git] / libs / jpeg6 / jmorecfg.h
index afb6e26c9322e9c9eacabe4aa07ab0d402bb42f7..29ae0f5cb3733661b455bcafb7bf9eb3b6e2771e 100644 (file)
-/*\r
-\r
- * jmorecfg.h\r
-\r
- *\r
-\r
- * Copyright (C) 1991-1995, Thomas G. Lane.\r
-\r
- * This file is part of the Independent JPEG Group's software.\r
-\r
- * For conditions of distribution and use, see the accompanying README file.\r
-\r
- *\r
-\r
- * This file contains additional configuration options that customize the\r
-\r
- * JPEG software for special applications or support machine-dependent\r
-\r
- * optimizations.  Most users will not need to touch this file.\r
-\r
- */\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Define BITS_IN_JSAMPLE as either\r
-\r
- *   8   for 8-bit sample values (the usual setting)\r
-\r
- *   12  for 12-bit sample values\r
-\r
- * Only 8 and 12 are legal data precisions for lossy JPEG according to the\r
-\r
- * JPEG standard, and the IJG code does not support anything else!\r
-\r
- * We do not support run-time selection of data precision, sorry.\r
-\r
- */\r
-\r
-\r
-\r
-#define BITS_IN_JSAMPLE  8     /* use 8 or 12 */\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Maximum number of components (color channels) allowed in JPEG image.\r
-\r
- * To meet the letter of the JPEG spec, set this to 255.  However, darn\r
-\r
- * few applications need more than 4 channels (maybe 5 for CMYK + alpha\r
-\r
- * mask).  We recommend 10 as a reasonable compromise; use 4 if you are\r
-\r
- * really short on memory.  (Each allowed component costs a hundred or so\r
-\r
- * bytes of storage, whether actually used in an image or not.)\r
-\r
- */\r
-\r
-\r
-\r
-#define MAX_COMPONENTS  10     /* maximum number of image components */\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Basic data types.\r
-\r
- * You may need to change these if you have a machine with unusual data\r
-\r
- * type sizes; for example, "char" not 8 bits, "short" not 16 bits,\r
-\r
- * or "long" not 32 bits.  We don't care whether "int" is 16 or 32 bits,\r
-\r
- * but it had better be at least 16.\r
-\r
- */\r
-\r
-\r
-\r
-/* Representation of a single sample (pixel element value).\r
-\r
- * We frequently allocate large arrays of these, so it's important to keep\r
-\r
- * them small.  But if you have memory to burn and access to char or short\r
-\r
- * arrays is very slow on your hardware, you might want to change these.\r
-\r
- */\r
-\r
-\r
-\r
-#if BITS_IN_JSAMPLE == 8\r
-\r
-/* JSAMPLE should be the smallest type that will hold the values 0..255.\r
-\r
- * You can use a signed char by having GETJSAMPLE mask it with 0xFF.\r
-\r
- */\r
-\r
-\r
-\r
-#ifdef HAVE_UNSIGNED_CHAR\r
-\r
-\r
-\r
-typedef unsigned char JSAMPLE;\r
-\r
-#define GETJSAMPLE(value)  ((int) (value))\r
-\r
-\r
-\r
-#else /* not HAVE_UNSIGNED_CHAR */\r
-\r
-\r
-\r
-typedef char JSAMPLE;\r
-\r
-#ifdef CHAR_IS_UNSIGNED\r
-\r
-#define GETJSAMPLE(value)  ((int) (value))\r
-\r
-#else\r
-\r
-#define GETJSAMPLE(value)  ((int) (value) & 0xFF)\r
-\r
-#endif /* CHAR_IS_UNSIGNED */\r
-\r
-\r
-\r
-#endif /* HAVE_UNSIGNED_CHAR */\r
-\r
-\r
-\r
-#define MAXJSAMPLE     255\r
-\r
-#define CENTERJSAMPLE  128\r
-\r
-\r
-\r
-#endif /* BITS_IN_JSAMPLE == 8 */\r
-\r
-\r
-\r
-\r
-\r
-#if BITS_IN_JSAMPLE == 12\r
-\r
-/* JSAMPLE should be the smallest type that will hold the values 0..4095.\r
-\r
- * On nearly all machines "short" will do nicely.\r
-\r
- */\r
-\r
-\r
-\r
-typedef short JSAMPLE;\r
-\r
-#define GETJSAMPLE(value)  ((int) (value))\r
-\r
-\r
-\r
-#define MAXJSAMPLE     4095\r
-\r
-#define CENTERJSAMPLE  2048\r
-\r
-\r
-\r
-#endif /* BITS_IN_JSAMPLE == 12 */\r
-\r
-\r
-\r
-\r
-\r
-/* Representation of a DCT frequency coefficient.\r
-\r
- * This should be a signed value of at least 16 bits; "short" is usually OK.\r
-\r
- * Again, we allocate large arrays of these, but you can change to int\r
-\r
- * if you have memory to burn and "short" is really slow.\r
-\r
- */\r
-\r
-\r
-\r
-typedef short JCOEF;\r
-\r
-\r
-\r
-\r
-\r
-/* Compressed datastreams are represented as arrays of JOCTET.\r
-\r
- * These must be EXACTLY 8 bits wide, at least once they are written to\r
-\r
- * external storage.  Note that when using the stdio data source/destination\r
-\r
- * managers, this is also the data type passed to fread/fwrite.\r
-\r
- */\r
-\r
-\r
-\r
-#ifdef HAVE_UNSIGNED_CHAR\r
-\r
-\r
-\r
-typedef unsigned char JOCTET;\r
-\r
-#define GETJOCTET(value)  (value)\r
-\r
-\r
-\r
-#else /* not HAVE_UNSIGNED_CHAR */\r
-\r
-\r
-\r
-typedef char JOCTET;\r
-\r
-#ifdef CHAR_IS_UNSIGNED\r
-\r
-#define GETJOCTET(value)  (value)\r
-\r
-#else\r
-\r
-#define GETJOCTET(value)  ((value) & 0xFF)\r
-\r
-#endif /* CHAR_IS_UNSIGNED */\r
-\r
-\r
-\r
-#endif /* HAVE_UNSIGNED_CHAR */\r
-\r
-\r
-\r
-\r
-\r
-/* These typedefs are used for various table entries and so forth.\r
-\r
- * They must be at least as wide as specified; but making them too big\r
-\r
- * won't cost a huge amount of memory, so we don't provide special\r
-\r
- * extraction code like we did for JSAMPLE.  (In other words, these\r
-\r
- * typedefs live at a different point on the speed/space tradeoff curve.)\r
-\r
- */\r
-\r
-\r
-\r
-/* UINT8 must hold at least the values 0..255. */\r
-\r
-\r
-\r
-#ifdef HAVE_UNSIGNED_CHAR\r
-\r
-typedef unsigned char UINT8;\r
-\r
-#else /* not HAVE_UNSIGNED_CHAR */\r
-\r
-#ifdef CHAR_IS_UNSIGNED\r
-\r
-typedef char UINT8;\r
-\r
-#else /* not CHAR_IS_UNSIGNED */\r
-\r
-typedef short UINT8;\r
-\r
-#endif /* CHAR_IS_UNSIGNED */\r
-\r
-#endif /* HAVE_UNSIGNED_CHAR */\r
-\r
-\r
-\r
-/* UINT16 must hold at least the values 0..65535. */\r
-\r
-\r
-\r
-#ifdef HAVE_UNSIGNED_SHORT\r
-\r
-typedef unsigned short UINT16;\r
-\r
-#else /* not HAVE_UNSIGNED_SHORT */\r
-\r
-typedef unsigned int UINT16;\r
-\r
-#endif /* HAVE_UNSIGNED_SHORT */\r
-\r
-\r
-\r
-/* INT16 must hold at least the values -32768..32767. */\r
-\r
-\r
-\r
-#ifndef XMD_H                  /* X11/xmd.h correctly defines INT16 */\r
-\r
-typedef short INT16;\r
-\r
-#endif\r
-\r
-\r
-\r
-/* INT32 must hold at least signed 32-bit values. */\r
-\r
-\r
-\r
-//#ifndef XMD_H                        /* X11/xmd.h correctly defines INT32 */\r
-\r
-//typedef long INT32;\r
-\r
-//#endif\r
-\r
-\r
-\r
-/* Datatype used for image dimensions.  The JPEG standard only supports\r
-\r
- * images up to 64K*64K due to 16-bit fields in SOF markers.  Therefore\r
-\r
- * "unsigned int" is sufficient on all machines.  However, if you need to\r
-\r
- * handle larger images and you don't mind deviating from the spec, you\r
-\r
- * can change this datatype.\r
-\r
- */\r
-\r
-\r
-\r
-typedef unsigned int JDIMENSION;\r
-\r
-\r
-\r
-#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */\r
-\r
-\r
-\r
-\r
-\r
-/* These defines are used in all function definitions and extern declarations.\r
-\r
- * You could modify them if you need to change function linkage conventions.\r
-\r
- * Another application is to make all functions global for use with debuggers\r
-\r
- * or code profilers that require it.\r
-\r
- */\r
-\r
-\r
-\r
-#define METHODDEF static       /* a function called through method pointers */\r
-\r
-#define LOCAL    static        /* a function used only in its module */\r
-\r
-#define GLOBAL                 /* a function referenced thru EXTERNs */\r
-\r
-#define EXTERN   extern        /* a reference to a GLOBAL function */\r
-\r
-\r
-\r
-\r
-\r
-/* Here is the pseudo-keyword for declaring pointers that must be "far"\r
-\r
- * on 80x86 machines.  Most of the specialized coding for 80x86 is handled\r
-\r
- * by just saying "FAR *" where such a pointer is needed.  In a few places\r
-\r
- * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.\r
-\r
- */\r
-\r
-\r
-\r
-#ifdef NEED_FAR_POINTERS\r
-\r
-#undef FAR\r
-\r
-#define FAR  far\r
-\r
-#else\r
-\r
-#undef FAR\r
-\r
-#define FAR\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * On a few systems, type boolean and/or its values FALSE, TRUE may appear\r
-\r
- * in standard header files.  Or you may have conflicts with application-\r
-\r
- * specific header files that you want to include together with these files.\r
-\r
- * Defining HAVE_BOOLEAN before including jpeglib.h should make it work.\r
-\r
- */\r
-\r
-\r
-\r
-//#ifndef HAVE_BOOLEAN\r
-\r
-//typedef int boolean;\r
-\r
-//#endif\r
-\r
-#ifndef FALSE                  /* in case these macros already exist */\r
-\r
-#define FALSE  0               /* values of boolean */\r
-\r
-#endif\r
-\r
-#ifndef TRUE\r
-\r
-#define TRUE   1\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * The remaining options affect code selection within the JPEG library,\r
-\r
- * but they don't need to be visible to most applications using the library.\r
-\r
- * To minimize application namespace pollution, the symbols won't be\r
-\r
- * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined.\r
-\r
- */\r
-\r
-\r
-\r
-#ifdef JPEG_INTERNALS\r
-\r
-#define JPEG_INTERNAL_OPTIONS\r
-\r
-#endif\r
-\r
-\r
-\r
-#ifdef JPEG_INTERNAL_OPTIONS\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * These defines indicate whether to include various optional functions.\r
-\r
- * Undefining some of these symbols will produce a smaller but less capable\r
-\r
- * library.  Note that you can leave certain source files out of the\r
-\r
- * compilation/linking process if you've #undef'd the corresponding symbols.\r
-\r
- * (You may HAVE to do that if your compiler doesn't like null source files.)\r
-\r
- */\r
-\r
-\r
-\r
-/* Arithmetic coding is unsupported for legal reasons.  Complaints to IBM. */\r
-\r
-\r
-\r
-/* Capability options common to encoder and decoder: */\r
-\r
-\r
-\r
-#undef DCT_ISLOW_SUPPORTED     /* slow but accurate integer algorithm */\r
-\r
-#undef DCT_IFAST_SUPPORTED     /* faster, less accurate integer method */\r
-\r
-#define DCT_FLOAT_SUPPORTED    /* floating-point: accurate, fast on fast HW */\r
-\r
-\r
-\r
-/* Encoder capability options: */\r
-\r
-\r
-\r
-#undef  C_ARITH_CODING_SUPPORTED    /* Arithmetic coding back end? */\r
-\r
-#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */\r
-\r
-#define C_PROGRESSIVE_SUPPORTED            /* Progressive JPEG? (Requires MULTISCAN)*/\r
-\r
-#define ENTROPY_OPT_SUPPORTED      /* Optimization of entropy coding parms? */\r
-\r
-/* Note: if you selected 12-bit data precision, it is dangerous to turn off\r
-\r
- * ENTROPY_OPT_SUPPORTED.  The standard Huffman tables are only good for 8-bit\r
-\r
- * precision, so jchuff.c normally uses entropy optimization to compute\r
-\r
- * usable tables for higher precision.  If you don't want to do optimization,\r
-\r
- * you'll have to supply different default Huffman tables.\r
-\r
- * The exact same statements apply for progressive JPEG: the default tables\r
-\r
- * don't work for progressive mode.  (This may get fixed, however.)\r
-\r
- */\r
-\r
-#define INPUT_SMOOTHING_SUPPORTED   /* Input image smoothing option? */\r
-\r
-\r
-\r
-/* Decoder capability options: */\r
-\r
-\r
-\r
-#undef  D_ARITH_CODING_SUPPORTED    /* Arithmetic coding back end? */\r
-\r
-#undef D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */\r
-\r
-#undef D_PROGRESSIVE_SUPPORTED     /* Progressive JPEG? (Requires MULTISCAN)*/\r
-\r
-#undef BLOCK_SMOOTHING_SUPPORTED   /* Block smoothing? (Progressive only) */\r
-\r
-#undef IDCT_SCALING_SUPPORTED      /* Output rescaling via IDCT? */\r
-\r
-#undef  UPSAMPLE_SCALING_SUPPORTED  /* Output rescaling at upsample stage? */\r
-\r
-#undef UPSAMPLE_MERGING_SUPPORTED  /* Fast path for sloppy upsampling? */\r
-\r
-#undef QUANT_1PASS_SUPPORTED       /* 1-pass color quantization? */\r
-\r
-#undef QUANT_2PASS_SUPPORTED       /* 2-pass color quantization? */\r
-\r
-\r
-\r
-/* more capability options later, no doubt */\r
-\r
-\r
-\r
-\r
-\r
-/*\r
-\r
- * Ordering of RGB data in scanlines passed to or from the application.\r
-\r
- * If your application wants to deal with data in the order B,G,R, just\r
-\r
- * change these macros.  You can also deal with formats such as R,G,B,X\r
-\r
- * (one extra byte per pixel) by changing RGB_PIXELSIZE.  Note that changing\r
-\r
- * the offsets will also change the order in which colormap data is organized.\r
-\r
- * RESTRICTIONS:\r
-\r
- * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.\r
-\r
- * 2. These macros only affect RGB<=>YCbCr color conversion, so they are not\r
-\r
- *    useful if you are using JPEG color spaces other than YCbCr or grayscale.\r
-\r
- * 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE\r
-\r
- *    is not 3 (they don't understand about dummy color components!).  So you\r
-\r
- *    can't use color quantization if you change that value.\r
-\r
- */\r
-\r
-\r
-\r
-#define RGB_RED                0       /* Offset of Red in an RGB scanline element */\r
-\r
-#define RGB_GREEN      1       /* Offset of Green */\r
-\r
-#define RGB_BLUE       2       /* Offset of Blue */\r
-\r
-// http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=900\r
-// ydnar: setting this fucks jpeg loading in q3map2, disabling "fix" (3)\r
-#define RGB_PIXELSIZE  4       /* JSAMPLEs per RGB scanline element */\r
-\r
-\r
-\r
-\r
-\r
-/* Definitions for speed-related optimizations. */\r
-\r
-\r
-\r
-\r
-\r
-/* If your compiler supports inline functions, define INLINE\r
-\r
- * as the inline keyword; otherwise define it as empty.\r
-\r
- */\r
-\r
-\r
-\r
-#ifndef INLINE\r
-\r
-#ifdef __GNUC__                        /* for instance, GNU C knows about inline */\r
-\r
-#define INLINE __inline__\r
-\r
-#endif\r
-\r
-#ifndef INLINE\r
-\r
-#define INLINE                 /* default is to define it as empty */\r
-\r
-#endif\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
-\r
-/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying\r
-\r
- * two 16-bit shorts is faster than multiplying two ints.  Define MULTIPLIER\r
-\r
- * as short on such a machine.  MULTIPLIER must be at least 16 bits wide.\r
-\r
- */\r
-\r
-\r
-\r
-#ifndef MULTIPLIER\r
-\r
-#define MULTIPLIER  int                /* type for fastest integer multiply */\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
-\r
-/* FAST_FLOAT should be either float or double, whichever is done faster\r
-\r
- * by your compiler.  (Note that this type is only used in the floating point\r
-\r
- * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)\r
-\r
- * Typically, float is faster in ANSI C compilers, while double is faster in\r
-\r
- * pre-ANSI compilers (because they insist on converting to double anyway).\r
-\r
- * The code below therefore chooses float if we have ANSI-style prototypes.\r
-\r
- */\r
-\r
-\r
-\r
-#ifndef FAST_FLOAT\r
-\r
-#ifdef HAVE_PROTOTYPES\r
-\r
-#define FAST_FLOAT  float\r
-\r
-#else\r
-\r
-#define FAST_FLOAT  double\r
-\r
-#endif\r
-\r
-#endif\r
-\r
-\r
-\r
-#endif /* JPEG_INTERNAL_OPTIONS */\r
+/*
+
+ * jmorecfg.h
+
+ *
+
+ * Copyright (C) 1991-1995, Thomas G. Lane.
+
+ * This file is part of the Independent JPEG Group's software.
+
+ * For conditions of distribution and use, see the accompanying README file.
+
+ *
+
+ * This file contains additional configuration options that customize the
+
+ * JPEG software for special applications or support machine-dependent
+
+ * optimizations.  Most users will not need to touch this file.
+
+ */
+
+
+
+
+
+/*
+
+ * Define BITS_IN_JSAMPLE as either
+
+ *   8   for 8-bit sample values (the usual setting)
+
+ *   12  for 12-bit sample values
+
+ * Only 8 and 12 are legal data precisions for lossy JPEG according to the
+
+ * JPEG standard, and the IJG code does not support anything else!
+
+ * We do not support run-time selection of data precision, sorry.
+
+ */
+
+
+
+#define BITS_IN_JSAMPLE  8     /* use 8 or 12 */
+
+
+
+
+
+/*
+
+ * Maximum number of components (color channels) allowed in JPEG image.
+
+ * To meet the letter of the JPEG spec, set this to 255.  However, darn
+
+ * few applications need more than 4 channels (maybe 5 for CMYK + alpha
+
+ * mask).  We recommend 10 as a reasonable compromise; use 4 if you are
+
+ * really short on memory.  (Each allowed component costs a hundred or so
+
+ * bytes of storage, whether actually used in an image or not.)
+
+ */
+
+
+
+#define MAX_COMPONENTS  10     /* maximum number of image components */
+
+
+
+
+
+/*
+
+ * Basic data types.
+
+ * You may need to change these if you have a machine with unusual data
+
+ * type sizes; for example, "char" not 8 bits, "short" not 16 bits,
+
+ * or "long" not 32 bits.  We don't care whether "int" is 16 or 32 bits,
+
+ * but it had better be at least 16.
+
+ */
+
+
+
+/* Representation of a single sample (pixel element value).
+
+ * We frequently allocate large arrays of these, so it's important to keep
+
+ * them small.  But if you have memory to burn and access to char or short
+
+ * arrays is very slow on your hardware, you might want to change these.
+
+ */
+
+
+
+#if BITS_IN_JSAMPLE == 8
+
+/* JSAMPLE should be the smallest type that will hold the values 0..255.
+
+ * You can use a signed char by having GETJSAMPLE mask it with 0xFF.
+
+ */
+
+
+
+#ifdef HAVE_UNSIGNED_CHAR
+
+
+
+typedef unsigned char JSAMPLE;
+
+#define GETJSAMPLE(value)  ((int) (value))
+
+
+
+#else /* not HAVE_UNSIGNED_CHAR */
+
+
+
+typedef char JSAMPLE;
+
+#ifdef CHAR_IS_UNSIGNED
+
+#define GETJSAMPLE(value)  ((int) (value))
+
+#else
+
+#define GETJSAMPLE(value)  ((int) (value) & 0xFF)
+
+#endif /* CHAR_IS_UNSIGNED */
+
+
+
+#endif /* HAVE_UNSIGNED_CHAR */
+
+
+
+#define MAXJSAMPLE     255
+
+#define CENTERJSAMPLE  128
+
+
+
+#endif /* BITS_IN_JSAMPLE == 8 */
+
+
+
+
+
+#if BITS_IN_JSAMPLE == 12
+
+/* JSAMPLE should be the smallest type that will hold the values 0..4095.
+
+ * On nearly all machines "short" will do nicely.
+
+ */
+
+
+
+typedef short JSAMPLE;
+
+#define GETJSAMPLE(value)  ((int) (value))
+
+
+
+#define MAXJSAMPLE     4095
+
+#define CENTERJSAMPLE  2048
+
+
+
+#endif /* BITS_IN_JSAMPLE == 12 */
+
+
+
+
+
+/* Representation of a DCT frequency coefficient.
+
+ * This should be a signed value of at least 16 bits; "short" is usually OK.
+
+ * Again, we allocate large arrays of these, but you can change to int
+
+ * if you have memory to burn and "short" is really slow.
+
+ */
+
+
+
+typedef short JCOEF;
+
+
+
+
+
+/* Compressed datastreams are represented as arrays of JOCTET.
+
+ * These must be EXACTLY 8 bits wide, at least once they are written to
+
+ * external storage.  Note that when using the stdio data source/destination
+
+ * managers, this is also the data type passed to fread/fwrite.
+
+ */
+
+
+
+#ifdef HAVE_UNSIGNED_CHAR
+
+
+
+typedef unsigned char JOCTET;
+
+#define GETJOCTET(value)  (value)
+
+
+
+#else /* not HAVE_UNSIGNED_CHAR */
+
+
+
+typedef char JOCTET;
+
+#ifdef CHAR_IS_UNSIGNED
+
+#define GETJOCTET(value)  (value)
+
+#else
+
+#define GETJOCTET(value)  ((value) & 0xFF)
+
+#endif /* CHAR_IS_UNSIGNED */
+
+
+
+#endif /* HAVE_UNSIGNED_CHAR */
+
+
+
+
+
+/* These typedefs are used for various table entries and so forth.
+
+ * They must be at least as wide as specified; but making them too big
+
+ * won't cost a huge amount of memory, so we don't provide special
+
+ * extraction code like we did for JSAMPLE.  (In other words, these
+
+ * typedefs live at a different point on the speed/space tradeoff curve.)
+
+ */
+
+
+
+/* UINT8 must hold at least the values 0..255. */
+
+
+
+#ifdef HAVE_UNSIGNED_CHAR
+
+typedef unsigned char UINT8;
+
+#else /* not HAVE_UNSIGNED_CHAR */
+
+#ifdef CHAR_IS_UNSIGNED
+
+typedef char UINT8;
+
+#else /* not CHAR_IS_UNSIGNED */
+
+typedef short UINT8;
+
+#endif /* CHAR_IS_UNSIGNED */
+
+#endif /* HAVE_UNSIGNED_CHAR */
+
+
+
+/* UINT16 must hold at least the values 0..65535. */
+
+
+
+#ifdef HAVE_UNSIGNED_SHORT
+
+typedef unsigned short UINT16;
+
+#else /* not HAVE_UNSIGNED_SHORT */
+
+typedef unsigned int UINT16;
+
+#endif /* HAVE_UNSIGNED_SHORT */
+
+
+
+/* INT16 must hold at least the values -32768..32767. */
+
+
+
+#ifndef XMD_H                  /* X11/xmd.h correctly defines INT16 */
+
+typedef short INT16;
+
+#endif
+
+
+
+/* INT32 must hold at least signed 32-bit values. */
+
+
+
+//#ifndef XMD_H                        /* X11/xmd.h correctly defines INT32 */
+
+//typedef long INT32;
+
+//#endif
+
+
+
+/* Datatype used for image dimensions.  The JPEG standard only supports
+
+ * images up to 64K*64K due to 16-bit fields in SOF markers.  Therefore
+
+ * "unsigned int" is sufficient on all machines.  However, if you need to
+
+ * handle larger images and you don't mind deviating from the spec, you
+
+ * can change this datatype.
+
+ */
+
+
+
+typedef unsigned int JDIMENSION;
+
+
+
+#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
+
+
+
+
+
+/* These defines are used in all function definitions and extern declarations.
+
+ * You could modify them if you need to change function linkage conventions.
+
+ * Another application is to make all functions global for use with debuggers
+
+ * or code profilers that require it.
+
+ */
+
+
+
+#define METHODDEF static       /* a function called through method pointers */
+
+#define LOCAL    static        /* a function used only in its module */
+
+#define GLOBAL                 /* a function referenced thru EXTERNs */
+
+#define EXTERN   extern        /* a reference to a GLOBAL function */
+
+
+
+
+
+/* Here is the pseudo-keyword for declaring pointers that must be "far"
+
+ * on 80x86 machines.  Most of the specialized coding for 80x86 is handled
+
+ * by just saying "FAR *" where such a pointer is needed.  In a few places
+
+ * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
+
+ */
+
+
+
+#ifdef NEED_FAR_POINTERS
+
+#undef FAR
+
+#define FAR  far
+
+#else
+
+#undef FAR
+
+#define FAR
+
+#endif
+
+
+
+
+
+/*
+
+ * On a few systems, type boolean and/or its values FALSE, TRUE may appear
+
+ * in standard header files.  Or you may have conflicts with application-
+
+ * specific header files that you want to include together with these files.
+
+ * Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
+
+ */
+
+
+
+//#ifndef HAVE_BOOLEAN
+
+//typedef int boolean;
+
+//#endif
+
+#ifndef FALSE                  /* in case these macros already exist */
+
+#define FALSE  0               /* values of boolean */
+
+#endif
+
+#ifndef TRUE
+
+#define TRUE   1
+
+#endif
+
+
+
+
+
+/*
+
+ * The remaining options affect code selection within the JPEG library,
+
+ * but they don't need to be visible to most applications using the library.
+
+ * To minimize application namespace pollution, the symbols won't be
+
+ * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined.
+
+ */
+
+
+
+#ifdef JPEG_INTERNALS
+
+#define JPEG_INTERNAL_OPTIONS
+
+#endif
+
+
+
+#ifdef JPEG_INTERNAL_OPTIONS
+
+
+
+
+
+/*
+
+ * These defines indicate whether to include various optional functions.
+
+ * Undefining some of these symbols will produce a smaller but less capable
+
+ * library.  Note that you can leave certain source files out of the
+
+ * compilation/linking process if you've #undef'd the corresponding symbols.
+
+ * (You may HAVE to do that if your compiler doesn't like null source files.)
+
+ */
+
+
+
+/* Arithmetic coding is unsupported for legal reasons.  Complaints to IBM. */
+
+
+
+/* Capability options common to encoder and decoder: */
+
+
+
+#undef DCT_ISLOW_SUPPORTED     /* slow but accurate integer algorithm */
+
+#undef DCT_IFAST_SUPPORTED     /* faster, less accurate integer method */
+
+#define DCT_FLOAT_SUPPORTED    /* floating-point: accurate, fast on fast HW */
+
+
+
+/* Encoder capability options: */
+
+
+
+#undef  C_ARITH_CODING_SUPPORTED    /* Arithmetic coding back end? */
+
+#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
+
+#define C_PROGRESSIVE_SUPPORTED            /* Progressive JPEG? (Requires MULTISCAN)*/
+
+#define ENTROPY_OPT_SUPPORTED      /* Optimization of entropy coding parms? */
+
+/* Note: if you selected 12-bit data precision, it is dangerous to turn off
+
+ * ENTROPY_OPT_SUPPORTED.  The standard Huffman tables are only good for 8-bit
+
+ * precision, so jchuff.c normally uses entropy optimization to compute
+
+ * usable tables for higher precision.  If you don't want to do optimization,
+
+ * you'll have to supply different default Huffman tables.
+
+ * The exact same statements apply for progressive JPEG: the default tables
+
+ * don't work for progressive mode.  (This may get fixed, however.)
+
+ */
+
+#define INPUT_SMOOTHING_SUPPORTED   /* Input image smoothing option? */
+
+
+
+/* Decoder capability options: */
+
+
+
+#undef  D_ARITH_CODING_SUPPORTED    /* Arithmetic coding back end? */
+
+#undef D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
+
+#undef D_PROGRESSIVE_SUPPORTED     /* Progressive JPEG? (Requires MULTISCAN)*/
+
+#undef BLOCK_SMOOTHING_SUPPORTED   /* Block smoothing? (Progressive only) */
+
+#undef IDCT_SCALING_SUPPORTED      /* Output rescaling via IDCT? */
+
+#undef  UPSAMPLE_SCALING_SUPPORTED  /* Output rescaling at upsample stage? */
+
+#undef UPSAMPLE_MERGING_SUPPORTED  /* Fast path for sloppy upsampling? */
+
+#undef QUANT_1PASS_SUPPORTED       /* 1-pass color quantization? */
+
+#undef QUANT_2PASS_SUPPORTED       /* 2-pass color quantization? */
+
+
+
+/* more capability options later, no doubt */
+
+
+
+
+
+/*
+
+ * Ordering of RGB data in scanlines passed to or from the application.
+
+ * If your application wants to deal with data in the order B,G,R, just
+
+ * change these macros.  You can also deal with formats such as R,G,B,X
+
+ * (one extra byte per pixel) by changing RGB_PIXELSIZE.  Note that changing
+
+ * the offsets will also change the order in which colormap data is organized.
+
+ * RESTRICTIONS:
+
+ * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
+
+ * 2. These macros only affect RGB<=>YCbCr color conversion, so they are not
+
+ *    useful if you are using JPEG color spaces other than YCbCr or grayscale.
+
+ * 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
+
+ *    is not 3 (they don't understand about dummy color components!).  So you
+
+ *    can't use color quantization if you change that value.
+
+ */
+
+
+
+#define RGB_RED                0       /* Offset of Red in an RGB scanline element */
+
+#define RGB_GREEN      1       /* Offset of Green */
+
+#define RGB_BLUE       2       /* Offset of Blue */
+
+// http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=900
+// ydnar: setting this fucks jpeg loading in q3map2, disabling "fix" (3)
+#define RGB_PIXELSIZE  4       /* JSAMPLEs per RGB scanline element */
+
+
+
+
+
+/* Definitions for speed-related optimizations. */
+
+
+
+
+
+/* If your compiler supports inline functions, define INLINE
+
+ * as the inline keyword; otherwise define it as empty.
+
+ */
+
+
+
+#ifndef INLINE
+
+#ifdef __GNUC__                        /* for instance, GNU C knows about inline */
+
+#define INLINE __inline__
+
+#endif
+
+#ifndef INLINE
+
+#define INLINE                 /* default is to define it as empty */
+
+#endif
+
+#endif
+
+
+
+
+
+/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying
+
+ * two 16-bit shorts is faster than multiplying two ints.  Define MULTIPLIER
+
+ * as short on such a machine.  MULTIPLIER must be at least 16 bits wide.
+
+ */
+
+
+
+#ifndef MULTIPLIER
+
+#define MULTIPLIER  int                /* type for fastest integer multiply */
+
+#endif
+
+
+
+
+
+/* FAST_FLOAT should be either float or double, whichever is done faster
+
+ * by your compiler.  (Note that this type is only used in the floating point
+
+ * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
+
+ * Typically, float is faster in ANSI C compilers, while double is faster in
+
+ * pre-ANSI compilers (because they insist on converting to double anyway).
+
+ * The code below therefore chooses float if we have ANSI-style prototypes.
+
+ */
+
+
+
+#ifndef FAST_FLOAT
+
+#ifdef HAVE_PROTOTYPES
+
+#define FAST_FLOAT  float
+
+#else
+
+#define FAST_FLOAT  double
+
+#endif
+
+#endif
+
+
+
+#endif /* JPEG_INTERNAL_OPTIONS */