Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

380 lines
12 KiB

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