DEADSOFTWARE

added Vampyre Imaging Library; now textures can be in various formats, including...
[d2df-sdl.git] / src / lib / vampimg / JpegLib / imjmorecfg.pas
1 unit imjmorecfg;
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 {$IFDEF FPC} { Free Pascal Compiler }
14 type
15 int = longint;
16 uInt = Cardinal; { unsigned int }
17 short = Integer;
18 ushort = Word;
19 long = longint;
20 {$ELSE}
21 {$IFDEF WIN32}
22 { Delphi 2.0 }
23 type
24 int = Integer;
25 uInt = Cardinal;
26 short = SmallInt;
27 ushort = Word;
28 long = longint;
29 {$ELSE}
30 {$IFDEF VIRTUALPASCAL}
31 type
32 int = longint;
33 uInt = longint; { unsigned int }
34 short = system.Integer;
35 ushort = system.Word;
36 long = longint;
37 {$ELSE}
38 type
39 int = Integer;
40 uInt = Word; { unsigned int }
41 short = Integer;
42 ushort = Word;
43 long = longint;
44 {$ENDIF}
45 {$ENDIF}
46 {$ENDIF}
47 type
48 voidp = pointer;
50 type
51 int_ptr = ^int;
52 size_t = int;
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. }
61 {$ifdef BITS_IN_JSAMPLE_IS_8} { use 8 or 12 }
62 const
63 BITS_IN_JSAMPLE = 8;
64 {$else}
65 const
66 BITS_IN_JSAMPLE = 12;
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
81 MAX_COMPONENTS = 10; { maximum number of image components }
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
103 JSAMPLE = byte; { Pascal unsigned char }
104 GETJSAMPLE = int;
106 const
107 MAXJSAMPLE = 255;
108 CENTERJSAMPLE = 128;
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
117 JSAMPLE = short;
118 GETJSAMPLE = int;
120 const
121 MAXJSAMPLE = 4095;
122 CENTERJSAMPLE = 2048;
124 {$endif} { BITS_IN_JSAMPLE = 12 }
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
132 JCOEF = int;
133 JCOEF_PTR = ^JCOEF;
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
143 JOCTET = Byte;
144 jTOctet = 0..(MaxInt div SizeOf(JOCTET))-1;
145 JOCTET_FIELD = array[jTOctet] of JOCTET;
146 JOCTET_FIELD_PTR = ^JOCTET_FIELD;
147 JOCTETPTR = ^JOCTET;
149 GETJOCTET = JOCTET; { A work around }
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
162 UINT8 = byte;
164 { UINT16 must hold at least the values 0..65535. }
166 UINT16 = Word;
168 { INT16 must hold at least the values -32768..32767. }
170 INT16 = int;
172 { INT32 must hold at least signed 32-bit values. }
174 INT32 = longint;
175 type
176 INT32PTR = ^INT32;
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
185 JDIMENSION = uInt;
187 const
188 JPEG_MAX_DIMENSION = 65500; { a tad under 64K to prevent overflows }
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
206 RGB_RED = 0; { Offset of Red in an RGB scanline element }
207 RGB_GREEN = 1; { Offset of Green }
208 RGB_BLUE = 2; { Offset of Blue }
209 {$else}
210 const
211 RGB_RED = 2; { Offset of Red in an RGB scanline element }
212 RGB_GREEN = 1; { Offset of Green }
213 RGB_BLUE = 0; { Offset of Blue }
214 {$endif}
216 {$ifdef RGB_PIXELSIZE_IS_3}
217 const
218 RGB_PIXELSIZE = 3; { JSAMPLEs per RGB scanline element }
219 {$else}
220 const
221 RGB_PIXELSIZE = ??; { Nomssi: deliberate syntax error. Set this value }
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
230 MULTIPLIER = int; { type for fastest integer multiply }
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
241 FAST_FLOAT = double; {float}
244 implementation
247 end.