ReactOS
0.4.16-dev-2613-g9533ad7
jmorecfg.h
Go to the documentation of this file.
1
/*
2
* jmorecfg.h
3
*
4
* Copyright (C) 1991-1997, Thomas G. Lane.
5
* Modified 1997-2025 by Guido Vollbeding.
6
* This file is part of the Independent JPEG Group's software.
7
* For conditions of distribution and use, see the accompanying README file.
8
*
9
* This file contains additional configuration options that customize the
10
* JPEG software for special applications or support machine-dependent
11
* optimizations. Most users will not need to touch this file.
12
*/
13
14
15
#define JPEG_DATA_PRECISION 8
/* see table below */
16
#define BITS_IN_JSAMPLE JPEG_DATA_PRECISION
/* see table below */
17
/*
18
* Most useful alternative for "HDR" (High Dynamic Range) application
19
* with backward compatibility for file interchange (see table below;
20
* move comment marks for selection):
21
#define BITS_IN_JSAMPLE 10
22
*/
23
/* For still higher demands (see table below):
24
#define BITS_IN_JSAMPLE 11
25
*/
26
/* or
27
#define BITS_IN_JSAMPLE 12
28
*/
29
30
/* | BITS_IN_JSAMPLE
31
* JPEG_DATA_PRECISION | read / write with full DCT up to lossless operation
32
* | exceptions see below
33
* -------------------------------------------------------------------------------
34
* {[_8_]} | _8_ <9> <10> <11>* <12>~
35
* [_9_] | <8> _9_ <10> <11> <12>*
36
* [_10_] | <8> <9> _10_ <11> <12> 13 *
37
* _11_ | <8> <9> <10> _11_ <12> 13 14 *
38
* _12_ | <8> <9> <10> <11> _12_ 13 14 15 *
39
* 13 | 8 9 10 11 12 13 14 15 16 *
40
*
41
* _x_ currently and previously implemented - default configuration
42
* <x> newly implemented
43
* {x} current standard for file interchange - backward compatible
44
* [x] next standard for file interchange - common DCT implementation category
45
* * does not support GCC lossless (GCbCr lossless - requires 1 extra bit)
46
* ~ 1 bit precision loss - effective 11 bits precision (lossy)
47
*
48
* Since the DCT coefficients are 3 bits larger than sample values with normal DCT
49
* processing, it is possible to support sample values with up to 3 more bits than
50
* the nominal JPEG data precision parameter by adapted DCT processing with up to
51
* lossless operation. The generated JPEG files are fully interchangeable for the
52
* same JPEG data precision parameter. Another BITS_IN_JSAMPLE setting will just
53
* reconstruct an image with corresponding precision.
54
*
55
* A special case for JPEG data precision 8 with 12-bit sample size (4 more bits)
56
* is provided so that all previously available sample formats are now supported
57
* for file interchange with backward compatibility.
58
* If full-feature DCT up to lossless operation with up to 12-bit sample size is
59
* required, it is recommended to select JPEG data precision 10, because it falls
60
* in the same DCT implementation category with 8 and 9 which may be commonly
61
* supported at run-time as the next standard for file interchange.
62
*
63
* Remaining bit depths and variability at run-time may be added later and
64
* are currently not supported, sorry.
65
* Exception: The transcoding part (jpegtran) supports all settings in a
66
* single instance, since it operates on the level of DCT coefficients and
67
* not sample values. The DCT coefficients are of the same type (16 bits)
68
* in all cases (see below).
69
*/
70
71
72
/*
73
* Maximum number of components (color channels) allowed in JPEG image.
74
* To meet the letter of the JPEG spec, set this to 255. However, darn
75
* few applications need more than 4 channels (maybe 5 for CMYK + alpha
76
* mask). We recommend 10 as a reasonable compromise; use 4 if you are
77
* really short on memory. (Each allowed component costs a hundred or so
78
* bytes of storage, whether actually used in an image or not.)
79
*/
80
81
#define MAX_COMPONENTS 10
/* maximum number of image components */
82
83
84
/*
85
* Basic data types.
86
* You may need to change these if you have a machine with unusual data
87
* type sizes; for example, "char" not 8 bits, "short" not 16 bits,
88
* or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits,
89
* but it had better be at least 16.
90
*/
91
92
/* Representation of a single sample (pixel element value).
93
* We frequently allocate large arrays of these, so it's important to keep
94
* them small. But if you have memory to burn and access to char or short
95
* arrays is very slow on your hardware, you might want to change these.
96
*/
97
98
#if BITS_IN_JSAMPLE == 8
99
/* JSAMPLE should be the smallest type that will hold the values 0..255.
100
* You can use a signed char by having GETJSAMPLE mask it with 0xFF.
101
*/
102
103
#ifdef HAVE_UNSIGNED_CHAR
104
105
typedef
unsigned
char
JSAMPLE
;
106
#define GETJSAMPLE(value) ((int) (value))
107
108
#else
/* not HAVE_UNSIGNED_CHAR */
109
110
typedef
char
JSAMPLE
;
111
#ifdef CHAR_IS_UNSIGNED
112
#define GETJSAMPLE(value) ((int) (value))
113
#else
114
#define GETJSAMPLE(value) ((int) (value) & 0xFF)
115
#endif
/* CHAR_IS_UNSIGNED */
116
117
#endif
/* HAVE_UNSIGNED_CHAR */
118
119
#define MAXJSAMPLE 255
120
#define CENTERJSAMPLE 128
121
122
#endif
/* BITS_IN_JSAMPLE == 8 */
123
124
125
#if BITS_IN_JSAMPLE == 9
126
/* JSAMPLE should be the smallest type that will hold the values 0..511.
127
* On nearly all machines "short" will do nicely.
128
*/
129
130
typedef
short
JSAMPLE
;
131
#define GETJSAMPLE(value) ((int) (value))
132
133
#define MAXJSAMPLE 511
134
#define CENTERJSAMPLE 256
135
136
#endif
/* BITS_IN_JSAMPLE == 9 */
137
138
139
#if BITS_IN_JSAMPLE == 10
140
/* JSAMPLE should be the smallest type that will hold the values 0..1023.
141
* On nearly all machines "short" will do nicely.
142
*/
143
144
typedef
short
JSAMPLE
;
145
#define GETJSAMPLE(value) ((int) (value))
146
147
#define MAXJSAMPLE 1023
148
#define CENTERJSAMPLE 512
149
150
#endif
/* BITS_IN_JSAMPLE == 10 */
151
152
153
#if BITS_IN_JSAMPLE == 11
154
/* JSAMPLE should be the smallest type that will hold the values 0..2047.
155
* On nearly all machines "short" will do nicely.
156
*/
157
158
typedef
short
JSAMPLE
;
159
#define GETJSAMPLE(value) ((int) (value))
160
161
#define MAXJSAMPLE 2047
162
#define CENTERJSAMPLE 1024
163
164
#endif
/* BITS_IN_JSAMPLE == 11 */
165
166
167
#if BITS_IN_JSAMPLE == 12
168
/* JSAMPLE should be the smallest type that will hold the values 0..4095.
169
* On nearly all machines "short" will do nicely.
170
*/
171
172
typedef
short
JSAMPLE
;
173
#define GETJSAMPLE(value) ((int) (value))
174
175
#define MAXJSAMPLE 4095
176
#define CENTERJSAMPLE 2048
177
178
#endif
/* BITS_IN_JSAMPLE == 12 */
179
180
181
/* Representation of a DCT frequency coefficient.
182
* This should be a signed value of at least 16 bits; "short" is usually OK.
183
* Again, we allocate large arrays of these, but you can change to int
184
* if you have memory to burn and "short" is really slow.
185
*/
186
187
typedef
short
JCOEF
;
188
189
190
/* Compressed datastreams are represented as arrays of JOCTET.
191
* These must be EXACTLY 8 bits wide, at least once they are written to
192
* external storage. Note that when using the stdio data source/destination
193
* managers, this is also the data type passed to fread/fwrite.
194
*/
195
196
#ifdef HAVE_UNSIGNED_CHAR
197
198
typedef
unsigned
char
JOCTET
;
199
#define GETJOCTET(value) (value)
200
201
#else
/* not HAVE_UNSIGNED_CHAR */
202
203
typedef
char
JOCTET
;
204
#ifdef CHAR_IS_UNSIGNED
205
#define GETJOCTET(value) (value)
206
#else
207
#define GETJOCTET(value) ((value) & 0xFF)
208
#endif
/* CHAR_IS_UNSIGNED */
209
210
#endif
/* HAVE_UNSIGNED_CHAR */
211
212
213
/* These typedefs are used for various table entries and so forth.
214
* They must be at least as wide as specified; but making them too big
215
* won't cost a huge amount of memory, so we don't provide special
216
* extraction code like we did for JSAMPLE. (In other words, these
217
* typedefs live at a different point on the speed/space tradeoff curve.)
218
*/
219
220
/* UINT8 must hold at least the values 0..255. */
221
222
#ifdef HAVE_UNSIGNED_CHAR
223
typedef
unsigned
char
UINT8
;
224
#else
/* not HAVE_UNSIGNED_CHAR */
225
#ifdef CHAR_IS_UNSIGNED
226
typedef
char
UINT8
;
227
#else
/* not CHAR_IS_UNSIGNED */
228
typedef
short
UINT8
;
229
#endif
/* CHAR_IS_UNSIGNED */
230
#endif
/* HAVE_UNSIGNED_CHAR */
231
232
/* UINT16 must hold at least the values 0..65535. */
233
234
#ifdef HAVE_UNSIGNED_SHORT
235
typedef
unsigned
short
UINT16
;
236
#else
/* not HAVE_UNSIGNED_SHORT */
237
typedef
unsigned
int
UINT16
;
238
#endif
/* HAVE_UNSIGNED_SHORT */
239
240
/* INT16 must hold at least the values -32768..32767. */
241
242
#ifndef XMD_H
/* X11/xmd.h correctly defines INT16 */
243
typedef
short
INT16
;
244
#endif
245
246
/* INT32 must hold at least signed 32-bit values. */
247
248
#ifndef XMD_H
/* X11/xmd.h correctly defines INT32 */
249
#ifndef _BASETSD_H_
/* Microsoft defines it in basetsd.h */
250
#ifndef _BASETSD_H
/* MinGW is slightly different */
251
#ifndef QGLOBAL_H
/* Qt defines it in qglobal.h */
252
typedef
long
INT32
;
253
#endif
254
#endif
255
#endif
256
#endif
257
258
/* Datatype used for image dimensions. The JPEG standard only supports
259
* images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
260
* "unsigned int" is sufficient on all machines. However, if you need to
261
* handle larger images and you don't mind deviating from the spec, you
262
* can change this datatype.
263
*/
264
265
typedef
unsigned
int
JDIMENSION
;
266
267
#define JPEG_MAX_DIMENSION 65500L
/* a tad under 64K to prevent overflows */
268
269
270
/* These macros are used in all function definitions and extern declarations.
271
* You could modify them if you need to change function linkage conventions;
272
* in particular, you'll need to do that to make the library a Windows DLL.
273
* Another application is to make all functions global for use with debuggers
274
* or code profilers that require it.
275
*/
276
277
#ifdef _WIN32
278
# if defined(ALL_STATIC)
279
# if defined(JPEG_DLL)
280
# undef JPEG_DLL
281
# endif
282
# if !defined(JPEG_STATIC)
283
# define JPEG_STATIC
284
# endif
285
# endif
286
# if defined(JPEG_DLL)
287
# if defined(JPEG_STATIC)
288
# undef JPEG_STATIC
289
# endif
290
# endif
291
# if defined(JPEG_DLL)
292
/* building a DLL */
293
# define JPEG_IMPEXP __declspec(dllexport)
294
# elif defined(JPEG_STATIC)
295
/* building or linking to a static library */
296
# define JPEG_IMPEXP
297
# else
298
/* linking to the DLL */
299
# define JPEG_IMPEXP __declspec(dllimport)
300
# endif
301
# if !defined(JPEG_API)
302
# define JPEG_API __cdecl
303
# endif
304
/* The only remaining magic that is necessary for cygwin */
305
#elif defined(__CYGWIN__)
306
# if !defined(JPEG_IMPEXP)
307
# define JPEG_IMPEXP
308
# endif
309
# if !defined(JPEG_API)
310
# define JPEG_API __cdecl
311
# endif
312
#endif
313
314
/* Ensure our magic doesn't hurt other platforms */
315
#if !defined(JPEG_IMPEXP)
316
# define JPEG_IMPEXP
317
#endif
318
#if !defined(JPEG_API)
319
# define JPEG_API
320
#endif
321
322
/* a function called through method pointers: */
323
#define METHODDEF(type) static type
324
/* a function used only in its module: */
325
#define LOCAL(type) static type
326
/* a function referenced thru EXTERNs: */
327
#define GLOBAL(type) type JPEG_API
328
/* a reference to a GLOBAL function: */
329
#ifndef EXTERN
330
# define EXTERN(type) extern JPEG_IMPEXP type JPEG_API
331
/* a reference to a "GLOBAL" function exported by sourcefiles of utility progs */
332
#endif
/* EXTERN */
333
334
335
/* This macro is used to declare a "method", that is, a function pointer.
336
* We want to supply prototype parameters if the compiler can cope.
337
* Note that the arglist parameter must be parenthesized!
338
* Again, you can customize this if you need special linkage keywords.
339
*/
340
341
#ifdef HAVE_PROTOTYPES
342
#define JMETHOD(type,methodname,arglist) type (*methodname) arglist
343
#else
344
#define JMETHOD(type,methodname,arglist) type (*methodname) ()
345
#endif
346
347
348
/* The noreturn type identifier is used to declare functions
349
* which cannot return.
350
* Compilers can thus create more optimized code and perform
351
* better checks for warnings and errors.
352
* Static analyzer tools can make improved inferences about
353
* execution paths and are prevented from giving false alerts.
354
*
355
* Unfortunately, the proposed specifications of corresponding
356
* extensions in the Dec 2011 ISO C standard revision (C11),
357
* GCC, MSVC, etc. are not viable.
358
* Thus we introduce a user defined type to declare noreturn
359
* functions at least for clarity. A proper compiler would
360
* have a suitable noreturn type to match in place of void.
361
*/
362
363
#ifndef HAVE_NORETURN_T
364
typedef
void
noreturn_t
;
365
#endif
366
367
368
/* Here is the pseudo-keyword for declaring pointers that must be "far"
369
* on 80x86 machines. Most of the specialized coding for 80x86 is handled
370
* by just saying "FAR *" where such a pointer is needed. In a few places
371
* explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
372
*/
373
374
#ifndef FAR
375
#ifdef NEED_FAR_POINTERS
376
#define FAR far
377
#else
378
#define FAR
379
#endif
380
#endif
381
382
383
/*
384
* On a few systems, type boolean and/or its values FALSE, TRUE may appear
385
* in standard header files. Or you may have conflicts with application-
386
* specific header files that you want to include together with these files.
387
* Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
388
*/
389
390
#ifndef HAVE_BOOLEAN
391
#if defined FALSE || defined TRUE || defined QGLOBAL_H
392
/* Qt3 defines FALSE and TRUE as "const" variables in qglobal.h */
393
typedef
int
boolean
;
394
#ifndef FALSE
/* in case these macros already exist */
395
#define FALSE 0
/* values of boolean */
396
#endif
397
#ifndef TRUE
398
#define TRUE 1
399
#endif
400
#else
401
typedef
enum
{
FALSE
= 0,
TRUE
= 1 }
boolean
;
402
#endif
403
#endif
404
405
406
/*
407
* The remaining options affect code selection within the JPEG library,
408
* but they don't need to be visible to most applications using the library.
409
* To minimize application namespace pollution, the symbols won't be
410
* defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined.
411
*/
412
413
#ifdef JPEG_INTERNALS
414
#define JPEG_INTERNAL_OPTIONS
415
#endif
416
417
#ifdef JPEG_INTERNAL_OPTIONS
418
419
420
/*
421
* These defines indicate whether to include various optional functions.
422
* Undefining some of these symbols will produce a smaller but less capable
423
* library. Note that you can leave certain source files out of the
424
* compilation/linking process if you've #undef'd the corresponding symbols.
425
* (You may HAVE to do that if your compiler doesn't like null source files.)
426
*/
427
428
/* Capability options common to encoder and decoder: */
429
430
#define DCT_ISLOW_SUPPORTED
/* slow but accurate integer algorithm */
431
#define DCT_IFAST_SUPPORTED
/* faster, less accurate integer method */
432
#define DCT_FLOAT_SUPPORTED
/* floating-point: accurate, fast on fast HW */
433
434
/* Encoder capability options: */
435
436
#define C_ARITH_CODING_SUPPORTED
/* Arithmetic coding back end? */
437
#define C_MULTISCAN_FILES_SUPPORTED
/* Multiple-scan JPEG files? */
438
#define C_PROGRESSIVE_SUPPORTED
/* Progressive JPEG? (Requires MULTISCAN) */
439
#define DCT_SCALING_SUPPORTED
/* Input rescaling via DCT? (Requires DCT_ISLOW) */
440
#define ENTROPY_OPT_SUPPORTED
/* Optimization of entropy coding parms? */
441
/* Note: if you selected more than 8-bit data precision, it is dangerous to
442
* turn off ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only
443
* good for 8-bit precision, so arithmetic coding is recommended for higher
444
* precision. The Huffman encoder normally uses entropy optimization to
445
* compute usable tables for higher precision. Otherwise, you'll have to
446
* supply different default Huffman tables.
447
* The exact same statements apply for progressive JPEG: the default tables
448
* don't work for progressive mode. (This may get fixed, however.)
449
*/
450
#define INPUT_SMOOTHING_SUPPORTED
/* Input image smoothing option? */
451
452
/* Decoder capability options: */
453
454
#define D_ARITH_CODING_SUPPORTED
/* Arithmetic coding back end? */
455
#define D_MULTISCAN_FILES_SUPPORTED
/* Multiple-scan JPEG files? */
456
#define D_PROGRESSIVE_SUPPORTED
/* Progressive JPEG? (Requires MULTISCAN) */
457
#define IDCT_SCALING_SUPPORTED
/* Output rescaling via IDCT? (Requires DCT_ISLOW) */
458
#define SAVE_MARKERS_SUPPORTED
/* jpeg_save_markers() needed? */
459
#define BLOCK_SMOOTHING_SUPPORTED
/* Block smoothing? (Progressive only) */
460
#undef UPSAMPLE_SCALING_SUPPORTED
/* Output rescaling at upsample stage? */
461
#define UPSAMPLE_MERGING_SUPPORTED
/* Fast path for sloppy upsampling? */
462
#define QUANT_1PASS_SUPPORTED
/* 1-pass color quantization? */
463
#define QUANT_2PASS_SUPPORTED
/* 2-pass color quantization? */
464
465
/* more capability options later, no doubt */
466
467
468
/*
469
* Ordering of RGB data in scanlines passed to or from the application.
470
* If your application wants to deal with data in the order B,G,R, just
471
* #define JPEG_USE_RGB_CUSTOM in jconfig.h, or define your own custom
472
* order in jconfig.h and #define JPEG_HAVE_RGB_CUSTOM.
473
* You can also deal with formats such as R,G,B,X (one extra byte per pixel)
474
* by changing RGB_PIXELSIZE.
475
* Note that changing the offsets will also change
476
* the order in which colormap data is organized.
477
* RESTRICTIONS:
478
* 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
479
* 2. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
480
* is not 3 (they don't understand about dummy color components!).
481
* So you can't use color quantization if you change that value.
482
*/
483
484
#ifndef JPEG_HAVE_RGB_CUSTOM
485
#ifdef JPEG_USE_RGB_CUSTOM
486
#define RGB_RED 2
/* Offset of Red in an RGB scanline element */
487
#define RGB_GREEN 1
/* Offset of Green */
488
#define RGB_BLUE 0
/* Offset of Blue */
489
#else
490
#define RGB_RED 0
/* Offset of Red in an RGB scanline element */
491
#define RGB_GREEN 1
/* Offset of Green */
492
#define RGB_BLUE 2
/* Offset of Blue */
493
#endif
494
#define RGB_PIXELSIZE 3
/* JSAMPLEs per RGB scanline element */
495
#endif
496
497
498
/* Definitions for speed-related optimizations. */
499
500
501
/* If your compiler supports inline functions, define INLINE
502
* as the inline keyword; otherwise define it as empty.
503
*/
504
505
#ifndef INLINE
506
#ifdef __GNUC__
/* for instance, GNU C knows about inline */
507
#define INLINE __inline__
508
#endif
509
#ifndef INLINE
510
#define INLINE
/* default is to define it as empty */
511
#endif
512
#endif
513
514
515
/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying
516
* two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER
517
* as short on such a machine. MULTIPLIER must be at least 16 bits wide.
518
*/
519
520
#ifndef MULTIPLIER
521
#define MULTIPLIER int
/* type for fastest integer multiply */
522
#endif
523
524
525
/* FAST_FLOAT should be either float or double, whichever is done faster
526
* by your compiler. (Note that this type is only used in the floating point
527
* DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
528
* Typically, float is faster in ANSI C compilers, while double is faster in
529
* pre-ANSI compilers (because they insist on converting to double anyway).
530
* The code below therefore chooses float if we have ANSI-style prototypes.
531
*/
532
533
#ifndef FAST_FLOAT
534
#ifdef HAVE_PROTOTYPES
535
#define FAST_FLOAT float
536
#else
537
#define FAST_FLOAT double
538
#endif
539
#endif
540
541
#endif
/* JPEG_INTERNAL_OPTIONS */
JDIMENSION
unsigned int JDIMENSION
Definition:
jmorecfg.h:265
INT32
long INT32
Definition:
jmorecfg.h:252
JOCTET
char JOCTET
Definition:
jmorecfg.h:203
JSAMPLE
char JSAMPLE
Definition:
jmorecfg.h:110
INT16
short INT16
Definition:
jmorecfg.h:243
boolean
boolean
Definition:
jmorecfg.h:401
FALSE
@ FALSE
Definition:
jmorecfg.h:401
TRUE
@ TRUE
Definition:
jmorecfg.h:401
UINT16
unsigned int UINT16
Definition:
jmorecfg.h:237
noreturn_t
void noreturn_t
Definition:
jmorecfg.h:364
UINT8
short UINT8
Definition:
jmorecfg.h:228
JCOEF
short JCOEF
Definition:
jmorecfg.h:187
sdk
include
reactos
libs
libjpeg
jmorecfg.h
Generated on Sat Apr 18 2026 06:15:08 for ReactOS by
1.9.6