316a9a7a00606e3714d43fc8b73c13eb4b3cadbd
3 { This file contains additional configuration options that customize the
4 JPEG software for special applications or support machine-dependent
5 optimizations. Most users will not need to touch this file. }
7 { Source: jmorecfg.h; Copyright (C) 1991-1996, Thomas G. Lane. }
9 interface
11 {$I imjconfig.inc}
14 type
20 {$ELSE}
21 {$IFDEF WIN32}
22 { Delphi 2.0 }
23 type
29 {$ELSE}
30 {$IFDEF VIRTUALPASCAL}
31 type
37 {$ELSE}
38 type
44 {$ENDIF}
45 {$ENDIF}
46 {$ENDIF}
47 type
50 type
54 { Define BITS_IN_JSAMPLE as either
55 8 for 8-bit sample values (the usual setting)
56 12 for 12-bit sample values
57 Only 8 and 12 are legal data precisions for lossy JPEG according to the
58 JPEG standard, and the IJG code does not support anything else!
59 We do not support run-time selection of data precision, sorry. }
62 const
64 {$else}
65 const
67 {$endif}
72 { Maximum number of components (color channels) allowed in JPEG image.
73 To meet the letter of the JPEG spec, set this to 255. However, darn
74 few applications need more than 4 channels (maybe 5 for CMYK + alpha
75 mask). We recommend 10 as a reasonable compromise; use 4 if you are
76 really short on memory. (Each allowed component costs a hundred or so
77 bytes of storage, whether actually used in an image or not.) }
80 const
84 { Basic data types.
85 You may need to change these if you have a machine with unusual data
86 type sizes; for example, "char" not 8 bits, "short" not 16 bits,
87 or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits,
88 but it had better be at least 16. }
91 { Representation of a single sample (pixel element value).
92 We frequently allocate large arrays of these, so it's important to keep
93 them small. But if you have memory to burn and access to char or short
94 arrays is very slow on your hardware, you might want to change these. }
97 {$ifdef BITS_IN_JSAMPLE_IS_8}
98 { JSAMPLE should be the smallest type that will hold the values 0..255.
99 You can use a signed char by having GETJSAMPLE mask it with $FF. }
101 { CHAR_IS_UNSIGNED }
102 type
106 const
110 {$endif}
112 {$ifndef BITS_IN_JSAMPLE_IS_8}
113 { JSAMPLE should be the smallest type that will hold the values 0..4095.
114 On nearly all machines "short" will do nicely. }
116 type
120 const
127 { Representation of a DCT frequency coefficient.
128 This should be a signed value of at least 16 bits; "short" is usually OK.
129 Again, we allocate large arrays of these, but you can change to int
130 if you have memory to burn and "short" is really slow. }
131 type
136 { Compressed datastreams are represented as arrays of JOCTET.
137 These must be EXACTLY 8 bits wide, at least once they are written to
138 external storage. Note that when using the stdio data source/destination
139 managers, this is also the data type passed to fread/fwrite. }
142 type
152 { These typedefs are used for various table entries and so forth.
153 They must be at least as wide as specified; but making them too big
154 won't cost a huge amount of memory, so we don't provide special
155 extraction code like we did for JSAMPLE. (In other words, these
156 typedefs live at a different point on the speed/space tradeoff curve.) }
159 { UINT8 must hold at least the values 0..255. }
161 type
164 { UINT16 must hold at least the values 0..65535. }
168 { INT16 must hold at least the values -32768..32767. }
172 { INT32 must hold at least signed 32-bit values. }
175 type
178 { Datatype used for image dimensions. The JPEG standard only supports
179 images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
180 "unsigned int" is sufficient on all machines. However, if you need to
181 handle larger images and you don't mind deviating from the spec, you
182 can change this datatype. }
184 type
187 const
191 { Ordering of RGB data in scanlines passed to or from the application.
192 If your application wants to deal with data in the order B,G,R, just
193 change these macros. You can also deal with formats such as R,G,B,X
194 (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing
195 the offsets will also change the order in which colormap data is organized.
196 RESTRICTIONS:
197 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
198 2. These macros only affect RGB<=>YCbCr color conversion, so they are not
199 useful if you are using JPEG color spaces other than YCbCr or grayscale.
200 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
201 is not 3 (they don't understand about dummy color components!). So you
202 can't use color quantization if you change that value. }
204 {$ifdef RGB_RED_IS_0}
205 const
209 {$else}
210 const
214 {$endif}
216 {$ifdef RGB_PIXELSIZE_IS_3}
217 const
219 {$else}
220 const
222 {$endif}
224 { Definitions for speed-related optimizations. }
226 { On some machines (notably 68000 series) "int" is 32 bits, but multiplying
227 two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER
228 as short on such a machine. MULTIPLIER must be at least 16 bits wide. }
229 type
233 { FAST_FLOAT should be either float or double, whichever is done faster
234 by your compiler. (Note that this type is only used in the floating point
235 DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
236 Typically, float is faster in ANSI C compilers, while double is faster in
237 pre-ANSI compilers (because they insist on converting to double anyway).
238 The code below therefore chooses float if we have ANSI-style prototypes. }
240 type
244 implementation