summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/pasjpeg/src/jmorecfg.pas
blob: 7bd76c95ff78134967dcaa99ec967da562aaf15f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
Unit JmoreCfg;

{ This file contains additional configuration options that customize the
  JPEG software for special applications or support machine-dependent
  optimizations.  Most users will not need to touch this file. }

{ Source: jmorecfg.h; Copyright (C) 1991-1996, Thomas G. Lane. }

interface

{$I jconfig.inc}

{$IFDEF FPC}  { Free Pascal Compiler }
    type
      int = longint;
      uInt = Cardinal; { unsigned int }
      short = Integer;
      ushort = Word;
      long = longint;
{$ELSE}
{$IFDEF WIN32}
  { Delphi 2.0 }
  type
    int = Integer;
    uInt = Cardinal;
    short = SmallInt;
    ushort = Word;
    long = longint;
  {$ELSE}
    {$IFDEF VIRTUALPASCAL}
    type
      int = longint;
      uInt = longint; { unsigned int }
      short = system.Integer;
      ushort = system.Word;
      long = longint;
    {$ELSE}
    type
      int = Integer;
      uInt = Word; { unsigned int }
      short = Integer;
      ushort = Word;
      long = longint;
    {$ENDIF}
{$ENDIF}
{$ENDIF}
type
  voidp = pointer;

type
  int_ptr = ^int;
  size_t = int;

{ Define BITS_IN_JSAMPLE as either
    8   for 8-bit sample values (the usual setting)
    12  for 12-bit sample values
  Only 8 and 12 are legal data precisions for lossy JPEG according to the
  JPEG standard, and the IJG code does not support anything else!
  We do not support run-time selection of data precision, sorry. }

{$ifdef BITS_IN_JSAMPLE_IS_8}   { use 8 or 12 }
const
  BITS_IN_JSAMPLE = 8;
{$else}
const
  BITS_IN_JSAMPLE = 12;
{$endif}




{ Maximum number of components (color channels) allowed in JPEG image.
  To meet the letter of the JPEG spec, set this to 255.  However, darn
  few applications need more than 4 channels (maybe 5 for CMYK + alpha
  mask).  We recommend 10 as a reasonable compromise; use 4 if you are
  really short on memory.  (Each allowed component costs a hundred or so
  bytes of storage, whether actually used in an image or not.) }


const
  MAX_COMPONENTS = 10;          { maximum number of image components }


{ Basic data types.
  You may need to change these if you have a machine with unusual data
  type sizes; for example, "char" not 8 bits, "short" not 16 bits,
  or "long" not 32 bits.  We don't care whether "int" is 16 or 32 bits,
  but it had better be at least 16. }


{ Representation of a single sample (pixel element value).
  We frequently allocate large arrays of these, so it's important to keep
  them small.  But if you have memory to burn and access to char or short
  arrays is very slow on your hardware, you might want to change these. }


{$ifdef BITS_IN_JSAMPLE_IS_8}
{ JSAMPLE should be the smallest type that will hold the values 0..255.
  You can use a signed char by having GETJSAMPLE mask it with $FF. }

{ CHAR_IS_UNSIGNED }
type
  JSAMPLE = byte; { Pascal unsigned char }
  GETJSAMPLE = int;

const
  MAXJSAMPLE = 255;
  CENTERJSAMPLE = 128;

{$endif}

{$ifndef BITS_IN_JSAMPLE_IS_8}
{ JSAMPLE should be the smallest type that will hold the values 0..4095.
  On nearly all machines "short" will do nicely. }

type
  JSAMPLE = short;
  GETJSAMPLE = int;

const
  MAXJSAMPLE = 4095;
  CENTERJSAMPLE = 2048;

{$endif} { BITS_IN_JSAMPLE = 12 }


{ Representation of a DCT frequency coefficient.
  This should be a signed value of at least 16 bits; "short" is usually OK.
  Again, we allocate large arrays of these, but you can change to int
  if you have memory to burn and "short" is really slow. }
type
  JCOEF = int;
  JCOEF_PTR = ^JCOEF;


{ Compressed datastreams are represented as arrays of JOCTET.
  These must be EXACTLY 8 bits wide, at least once they are written to
  external storage.  Note that when using the stdio data source/destination
  managers, this is also the data type passed to fread/fwrite. }


type
  JOCTET = Byte;
  jTOctet = 0..(MaxInt div SizeOf(JOCTET))-1;
  JOCTET_FIELD = array[jTOctet] of JOCTET;
  JOCTET_FIELD_PTR = ^JOCTET_FIELD;
  JOCTETPTR = ^JOCTET;

  GETJOCTET = JOCTET; { A work around }


{ These typedefs are used for various table entries and so forth.
  They must be at least as wide as specified; but making them too big
  won't cost a huge amount of memory, so we don't provide special
  extraction code like we did for JSAMPLE.  (In other words, these
  typedefs live at a different point on the speed/space tradeoff curve.) }


{ UINT8 must hold at least the values 0..255. }

type
  UINT8 = byte;

{ UINT16 must hold at least the values 0..65535. }

  UINT16 = Word;

{ INT16 must hold at least the values -32768..32767. }

  INT16 = int;

{ INT32 must hold at least signed 32-bit values. }

  INT32 = longint;
type
  INT32PTR = ^INT32;

{ Datatype used for image dimensions.  The JPEG standard only supports
  images up to 64K*64K due to 16-bit fields in SOF markers.  Therefore
  "unsigned int" is sufficient on all machines.  However, if you need to
  handle larger images and you don't mind deviating from the spec, you
  can change this datatype. }

type
  JDIMENSION = uInt;

const
  JPEG_MAX_DIMENSION = 65500;  { a tad under 64K to prevent overflows }


{ Ordering of RGB data in scanlines passed to or from the application.
  If your application wants to deal with data in the order B,G,R, just
  change these macros.  You can also deal with formats such as R,G,B,X
  (one extra byte per pixel) by changing RGB_PIXELSIZE.  Note that changing
  the offsets will also change the order in which colormap data is organized.
  RESTRICTIONS:
  1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
  2. These macros only affect RGB<=>YCbCr color conversion, so they are not
     useful if you are using JPEG color spaces other than YCbCr or grayscale.
  3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
     is not 3 (they don't understand about dummy color components!).  So you
     can't use color quantization if you change that value. }

{$ifdef RGB_RED_IS_0}
const
  RGB_RED       = 0;    { Offset of Red in an RGB scanline element }
  RGB_GREEN     = 1;    { Offset of Green }
  RGB_BLUE      = 2;    { Offset of Blue }
{$else}
const
  RGB_RED       = 2;    { Offset of Red in an RGB scanline element }
  RGB_GREEN     = 1;    { Offset of Green }
  RGB_BLUE      = 0;    { Offset of Blue }
{$endif}

{$ifdef RGB_PIXELSIZE_IS_3}
const
  RGB_PIXELSIZE = 3;    { JSAMPLEs per RGB scanline element }
{$else}
const
  RGB_PIXELSIZE = ??;   { Nomssi: deliberate syntax error. Set this value }
{$endif}

{ Definitions for speed-related optimizations. }

{ On some machines (notably 68000 series) "int" is 32 bits, but multiplying
  two 16-bit shorts is faster than multiplying two ints.  Define MULTIPLIER
  as short on such a machine.  MULTIPLIER must be at least 16 bits wide. }
type
  MULTIPLIER = int;     { type for fastest integer multiply }


{ FAST_FLOAT should be either float or double, whichever is done faster
  by your compiler.  (Note that this type is only used in the floating point
  DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
  Typically, float is faster in ANSI C compilers, while double is faster in
  pre-ANSI compilers (because they insist on converting to double anyway).
  The code below therefore chooses float if we have ANSI-style prototypes. }

type
  FAST_FLOAT = double; {float}


implementation


end.