jmorecfg.pas 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. Unit JmoreCfg;
  2. { This file contains additional configuration options that customize the
  3. JPEG software for special applications or support machine-dependent
  4. optimizations. Most users will not need to touch this file. }
  5. { Source: jmorecfg.h; Copyright (C) 1991-1996, Thomas G. Lane. }
  6. interface
  7. {$I jconfig.inc}
  8. {$IFDEF FPC} { Free Pascal Compiler }
  9. type
  10. int = longint;
  11. uInt = Cardinal; { unsigned int }
  12. short = Integer;
  13. ushort = Word;
  14. long = longint;
  15. {$ELSE}
  16. {$IFDEF WIN32}
  17. { Delphi 2.0 }
  18. type
  19. int = Integer;
  20. uInt = Cardinal;
  21. short = SmallInt;
  22. ushort = Word;
  23. long = longint;
  24. {$ELSE}
  25. {$IFDEF VIRTUALPASCAL}
  26. type
  27. int = longint;
  28. uInt = longint; { unsigned int }
  29. short = system.Integer;
  30. ushort = system.Word;
  31. long = longint;
  32. {$ELSE}
  33. type
  34. int = Integer;
  35. uInt = Word; { unsigned int }
  36. short = Integer;
  37. ushort = Word;
  38. long = longint;
  39. {$ENDIF}
  40. {$ENDIF}
  41. {$ENDIF}
  42. type
  43. voidp = pointer;
  44. type
  45. int_ptr = ^int;
  46. size_t = int;
  47. { Define BITS_IN_JSAMPLE as either
  48. 8 for 8-bit sample values (the usual setting)
  49. 12 for 12-bit sample values
  50. Only 8 and 12 are legal data precisions for lossy JPEG according to the
  51. JPEG standard, and the IJG code does not support anything else!
  52. We do not support run-time selection of data precision, sorry. }
  53. {$ifdef BITS_IN_JSAMPLE_IS_8} { use 8 or 12 }
  54. const
  55. BITS_IN_JSAMPLE = 8;
  56. {$else}
  57. const
  58. BITS_IN_JSAMPLE = 12;
  59. {$endif}
  60. { Maximum number of components (color channels) allowed in JPEG image.
  61. To meet the letter of the JPEG spec, set this to 255. However, darn
  62. few applications need more than 4 channels (maybe 5 for CMYK + alpha
  63. mask). We recommend 10 as a reasonable compromise; use 4 if you are
  64. really short on memory. (Each allowed component costs a hundred or so
  65. bytes of storage, whether actually used in an image or not.) }
  66. const
  67. MAX_COMPONENTS = 10; { maximum number of image components }
  68. { Basic data types.
  69. You may need to change these if you have a machine with unusual data
  70. type sizes; for example, "char" not 8 bits, "short" not 16 bits,
  71. or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits,
  72. but it had better be at least 16. }
  73. { Representation of a single sample (pixel element value).
  74. We frequently allocate large arrays of these, so it's important to keep
  75. them small. But if you have memory to burn and access to char or short
  76. arrays is very slow on your hardware, you might want to change these. }
  77. {$ifdef BITS_IN_JSAMPLE_IS_8}
  78. { JSAMPLE should be the smallest type that will hold the values 0..255.
  79. You can use a signed char by having GETJSAMPLE mask it with $FF. }
  80. { CHAR_IS_UNSIGNED }
  81. type
  82. JSAMPLE = byte; { Pascal unsigned char }
  83. GETJSAMPLE = int;
  84. const
  85. MAXJSAMPLE = 255;
  86. CENTERJSAMPLE = 128;
  87. {$endif}
  88. {$ifndef BITS_IN_JSAMPLE_IS_8}
  89. { JSAMPLE should be the smallest type that will hold the values 0..4095.
  90. On nearly all machines "short" will do nicely. }
  91. type
  92. JSAMPLE = short;
  93. GETJSAMPLE = int;
  94. const
  95. MAXJSAMPLE = 4095;
  96. CENTERJSAMPLE = 2048;
  97. {$endif} { BITS_IN_JSAMPLE = 12 }
  98. { Representation of a DCT frequency coefficient.
  99. This should be a signed value of at least 16 bits; "short" is usually OK.
  100. Again, we allocate large arrays of these, but you can change to int
  101. if you have memory to burn and "short" is really slow. }
  102. type
  103. JCOEF = int;
  104. JCOEF_PTR = ^JCOEF;
  105. { Compressed datastreams are represented as arrays of JOCTET.
  106. These must be EXACTLY 8 bits wide, at least once they are written to
  107. external storage. Note that when using the stdio data source/destination
  108. managers, this is also the data type passed to fread/fwrite. }
  109. type
  110. JOCTET = Byte;
  111. jTOctet = 0..(MaxInt div SizeOf(JOCTET))-1;
  112. JOCTET_FIELD = array[jTOctet] of JOCTET;
  113. JOCTET_FIELD_PTR = ^JOCTET_FIELD;
  114. JOCTETPTR = ^JOCTET;
  115. GETJOCTET = JOCTET; { A work around }
  116. { These typedefs are used for various table entries and so forth.
  117. They must be at least as wide as specified; but making them too big
  118. won't cost a huge amount of memory, so we don't provide special
  119. extraction code like we did for JSAMPLE. (In other words, these
  120. typedefs live at a different point on the speed/space tradeoff curve.) }
  121. { UINT8 must hold at least the values 0..255. }
  122. type
  123. UINT8 = byte;
  124. { UINT16 must hold at least the values 0..65535. }
  125. UINT16 = Word;
  126. { INT16 must hold at least the values -32768..32767. }
  127. INT16 = int;
  128. { INT32 must hold at least signed 32-bit values. }
  129. INT32 = longint;
  130. type
  131. INT32PTR = ^INT32;
  132. { Datatype used for image dimensions. The JPEG standard only supports
  133. images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
  134. "unsigned int" is sufficient on all machines. However, if you need to
  135. handle larger images and you don't mind deviating from the spec, you
  136. can change this datatype. }
  137. type
  138. JDIMENSION = uInt;
  139. const
  140. JPEG_MAX_DIMENSION = 65500; { a tad under 64K to prevent overflows }
  141. { Ordering of RGB data in scanlines passed to or from the application.
  142. If your application wants to deal with data in the order B,G,R, just
  143. change these macros. You can also deal with formats such as R,G,B,X
  144. (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing
  145. the offsets will also change the order in which colormap data is organized.
  146. RESTRICTIONS:
  147. 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
  148. 2. These macros only affect RGB<=>YCbCr color conversion, so they are not
  149. useful if you are using JPEG color spaces other than YCbCr or grayscale.
  150. 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
  151. is not 3 (they don't understand about dummy color components!). So you
  152. can't use color quantization if you change that value. }
  153. {$ifdef RGB_RED_IS_0}
  154. const
  155. RGB_RED = 0; { Offset of Red in an RGB scanline element }
  156. RGB_GREEN = 1; { Offset of Green }
  157. RGB_BLUE = 2; { Offset of Blue }
  158. {$else}
  159. const
  160. RGB_RED = 2; { Offset of Red in an RGB scanline element }
  161. RGB_GREEN = 1; { Offset of Green }
  162. RGB_BLUE = 0; { Offset of Blue }
  163. {$endif}
  164. {$ifdef RGB_PIXELSIZE_IS_3}
  165. const
  166. RGB_PIXELSIZE = 3; { JSAMPLEs per RGB scanline element }
  167. {$else}
  168. const
  169. RGB_PIXELSIZE = ??; { Nomssi: deliberate syntax error. Set this value }
  170. {$endif}
  171. { Definitions for speed-related optimizations. }
  172. { On some machines (notably 68000 series) "int" is 32 bits, but multiplying
  173. two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER
  174. as short on such a machine. MULTIPLIER must be at least 16 bits wide. }
  175. type
  176. MULTIPLIER = int; { type for fastest integer multiply }
  177. { FAST_FLOAT should be either float or double, whichever is done faster
  178. by your compiler. (Note that this type is only used in the floating point
  179. DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
  180. Typically, float is faster in ANSI C compilers, while double is faster in
  181. pre-ANSI compilers (because they insist on converting to double anyway).
  182. The code below therefore chooses float if we have ANSI-style prototypes. }
  183. type
  184. FAST_FLOAT = double; {float}
  185. implementation
  186. end.