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}
13 type
20 type
23 type
27 { Define BITS_IN_JSAMPLE as either
28 8 for 8-bit sample values (the usual setting)
29 12 for 12-bit sample values
30 Only 8 and 12 are legal data precisions for lossy JPEG according to the
31 JPEG standard, and the IJG code does not support anything else!
32 We do not support run-time selection of data precision, sorry. }
36 const
38 {$else}
39 const
41 {$endif}
44 { Maximum number of components (color channels) allowed in JPEG image.
45 To meet the letter of the JPEG spec, set this to 255. However, darn
46 few applications need more than 4 channels (maybe 5 for CMYK + alpha
47 mask). We recommend 10 as a reasonable compromise; use 4 if you are
48 really short on memory. (Each allowed component costs a hundred or so
49 bytes of storage, whether actually used in an image or not.) }
52 const
56 { Basic data types.
57 You may need to change these if you have a machine with unusual data
58 type sizes; for example, "char" not 8 bits, "short" not 16 bits,
59 or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits,
60 but it had better be at least 16. }
63 { Representation of a single sample (pixel element value).
64 We frequently allocate large arrays of these, so it's important to keep
65 them small. But if you have memory to burn and access to char or short
66 arrays is very slow on your hardware, you might want to change these. }
69 {$ifdef BITS_IN_JSAMPLE_IS_8}
70 { JSAMPLE should be the smallest type that will hold the values 0..255.
71 You can use a signed char by having GETJSAMPLE mask it with $FF. }
73 { CHAR_IS_UNSIGNED }
74 type
78 const
82 {$endif}
84 {$ifndef BITS_IN_JSAMPLE_IS_8}
85 { JSAMPLE should be the smallest type that will hold the values 0..4095.
86 On nearly all machines "short" will do nicely. }
88 type
92 const
99 { Representation of a DCT frequency coefficient.
100 This should be a signed value of at least 16 bits; "short" is usually OK.
101 Again, we allocate large arrays of these, but you can change to int
102 if you have memory to burn and "short" is really slow. }
103 type
108 { Compressed datastreams are represented as arrays of JOCTET.
109 These must be EXACTLY 8 bits wide, at least once they are written to
110 external storage. Note that when using the stdio data source/destination
111 managers, this is also the data type passed to fread/fwrite. }
114 type
124 { These typedefs are used for various table entries and so forth.
125 They must be at least as wide as specified; but making them too big
126 won't cost a huge amount of memory, so we don't provide special
127 extraction code like we did for JSAMPLE. (In other words, these
128 typedefs live at a different point on the speed/space tradeoff curve.) }
131 { UINT8 must hold at least the values 0..255. }
133 type
136 { UINT16 must hold at least the values 0..65535. }
140 { INT16 must hold at least the values -32768..32767. }
144 { INT32 must hold at least signed 32-bit values. }
147 type
150 { Datatype used for image dimensions. The JPEG standard only supports
151 images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
152 "unsigned int" is sufficient on all machines. However, if you need to
153 handle larger images and you don't mind deviating from the spec, you
154 can change this datatype. }
156 type
159 const
163 { Ordering of RGB data in scanlines passed to or from the application.
164 If your application wants to deal with data in the order B,G,R, just
165 change these macros. You can also deal with formats such as R,G,B,X
166 (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing
167 the offsets will also change the order in which colormap data is organized.
168 RESTRICTIONS:
169 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
170 2. These macros only affect RGB<=>YCbCr color conversion, so they are not
171 useful if you are using JPEG color spaces other than YCbCr or grayscale.
172 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
173 is not 3 (they don't understand about dummy color components!). So you
174 can't use color quantization if you change that value. }
176 {$ifdef RGB_RED_IS_0}
177 const
181 {$else}
182 const
186 {$endif}
188 {$ifdef RGB_PIXELSIZE_IS_3}
189 const
191 {$else}
192 const
194 {$endif}
196 { Definitions for speed-related optimizations. }
198 { On some machines (notably 68000 series) "int" is 32 bits, but multiplying
199 two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER
200 as short on such a machine. MULTIPLIER must be at least 16 bits wide. }
201 type
205 { FAST_FLOAT should be either float or double, whichever is done faster
206 by your compiler. (Note that this type is only used in the floating point
207 DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
208 Typically, float is faster in ANSI C compilers, while double is faster in
209 pre-ANSI compilers (because they insist on converting to double anyway).
210 The code below therefore chooses float if we have ANSI-style prototypes. }
212 type
216 implementation