Main MRPT website
>
C++ reference for MRPT 1.9.9
utils
jpeglib
jmorecfg.h
Go to the documentation of this file.
1
/* +------------------------------------------------------------------------+
2
| Mobile Robot Programming Toolkit (MRPT) |
3
| http://www.mrpt.org/ |
4
| |
5
| Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6
| See: http://www.mrpt.org/Authors - All rights reserved. |
7
| Released under BSD License. See details in http://www.mrpt.org/License |
8
+------------------------------------------------------------------------+ */
9
10
/*
11
* Define BITS_IN_JSAMPLE as either
12
* 8 for 8-bit sample values (the usual setting)
13
* 12 for 12-bit sample values
14
* Only 8 and 12 are legal data precisions for lossy JPEG according to the
15
* JPEG standard, and the IJG code does not support anything else!
16
* We do not support run-time selection of data precision, sorry.
17
*/
18
19
#define BITS_IN_JSAMPLE 8
/* use 8 or 12 */
20
21
/*
22
* Maximum number of components (color channels) allowed in JPEG image.
23
* To meet the letter of the JPEG spec, set this to 255. However, darn
24
* few applications need more than 4 channels (maybe 5 for CMYK + alpha
25
* mask). We recommend 10 as a reasonable compromise; use 4 if you are
26
* really short on memory. (Each allowed component costs a hundred or so
27
* bytes of storage, whether actually used in an image or not.)
28
*/
29
30
#define MAX_COMPONENTS 10
/* maximum number of image components */
31
32
/*
33
* Basic data types.
34
* You may need to change these if you have a machine with unusual data
35
* type sizes; for example, "char" not 8 bits, "short" not 16 bits,
36
* or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits,
37
* but it had better be at least 16.
38
*/
39
40
/* Representation of a single sample (pixel element value).
41
* We frequently allocate large arrays of these, so it's important to keep
42
* them small. But if you have memory to burn and access to char or short
43
* arrays is very slow on your hardware, you might want to change these.
44
*/
45
46
#if BITS_IN_JSAMPLE == 8
47
/* JSAMPLE should be the smallest type that will hold the values 0..255.
48
* You can use a signed char by having GETJSAMPLE mask it with 0xFF.
49
*/
50
51
#ifdef HAVE_UNSIGNED_CHAR
52
53
typedef
unsigned
char
JSAMPLE
;
54
#define GETJSAMPLE(value) ((int)(value))
55
56
#else
/* not HAVE_UNSIGNED_CHAR */
57
58
typedef
char
JSAMPLE
;
59
#ifdef CHAR_IS_UNSIGNED
60
#define GETJSAMPLE(value) ((int)(value))
61
#else
62
#define GETJSAMPLE(value) ((int)(value)&0xFF)
63
#endif
/* CHAR_IS_UNSIGNED */
64
65
#endif
/* HAVE_UNSIGNED_CHAR */
66
67
#define MAXJSAMPLE 255
68
#define CENTERJSAMPLE 128
69
70
#endif
/* BITS_IN_JSAMPLE == 8 */
71
72
#if BITS_IN_JSAMPLE == 12
73
/* JSAMPLE should be the smallest type that will hold the values 0..4095.
74
* On nearly all machines "short" will do nicely.
75
*/
76
77
typedef
short
JSAMPLE
;
78
#define GETJSAMPLE(value) ((int)(value))
79
80
#define MAXJSAMPLE 4095
81
#define CENTERJSAMPLE 2048
82
83
#endif
/* BITS_IN_JSAMPLE == 12 */
84
85
/* Representation of a DCT frequency coefficient.
86
* This should be a signed value of at least 16 bits; "short" is usually OK.
87
* Again, we allocate large arrays of these, but you can change to int
88
* if you have memory to burn and "short" is really slow.
89
*/
90
91
typedef
short
JCOEF
;
92
93
/* Compressed datastreams are represented as arrays of JOCTET.
94
* These must be EXACTLY 8 bits wide, at least once they are written to
95
* external storage. Note that when using the stdio data source/destination
96
* managers, this is also the data type passed to fread/fwrite.
97
*/
98
99
#ifdef HAVE_UNSIGNED_CHAR
100
101
typedef
unsigned
char
JOCTET
;
102
#define GETJOCTET(value) (value)
103
104
#else
/* not HAVE_UNSIGNED_CHAR */
105
106
typedef
char
JOCTET
;
107
#ifdef CHAR_IS_UNSIGNED
108
#define GETJOCTET(value) (value)
109
#else
110
#define GETJOCTET(value) ((value)&0xFF)
111
#endif
/* CHAR_IS_UNSIGNED */
112
113
#endif
/* HAVE_UNSIGNED_CHAR */
114
115
/* These typedefs are used for various table entries and so forth.
116
* They must be at least as wide as specified; but making them too big
117
* won't cost a huge amount of memory, so we don't provide special
118
* extraction code like we did for JSAMPLE. (In other words, these
119
* typedefs live at a different point on the speed/space tradeoff curve.)
120
*/
121
122
/* UINT8 must hold at least the values 0..255. */
123
124
#ifdef HAVE_UNSIGNED_CHAR
125
typedef
unsigned
char
UINT8
;
126
#else
/* not HAVE_UNSIGNED_CHAR */
127
#ifdef CHAR_IS_UNSIGNED
128
typedef
char
UINT8
;
129
#else
/* not CHAR_IS_UNSIGNED */
130
typedef
short
UINT8
;
131
#endif
/* CHAR_IS_UNSIGNED */
132
#endif
/* HAVE_UNSIGNED_CHAR */
133
134
/* UINT16 must hold at least the values 0..65535. */
135
136
#ifdef HAVE_UNSIGNED_SHORT
137
typedef
unsigned
short
UINT16
;
138
#else
/* not HAVE_UNSIGNED_SHORT */
139
typedef
unsigned
int
UINT16
;
140
#endif
/* HAVE_UNSIGNED_SHORT */
141
142
/* INT16 must hold at least the values -32768..32767. */
143
144
#ifndef XMD_H
/* X11/xmd.h correctly defines INT16 */
145
typedef
short
INT16
;
146
#endif
147
148
/* INT32 must hold at least signed 32-bit values. */
149
150
#ifndef XMD_H
/* X11/xmd.h correctly defines INT32 */
151
typedef
long
INT32
;
152
#endif
153
154
/* Datatype used for image dimensions. The JPEG standard only supports
155
* images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
156
* "unsigned int" is sufficient on all machines. However, if you need to
157
* handle larger images and you don't mind deviating from the spec, you
158
* can change this datatype.
159
*/
160
161
typedef
unsigned
int
JDIMENSION
;
162
163
#define JPEG_MAX_DIMENSION 65500L
/* a tad under 64K to prevent overflows */
164
165
/* These macros are used in all function definitions and extern declarations.
166
* You could modify them if you need to change function linkage conventions;
167
* in particular, you'll need to do that to make the library a Windows DLL.
168
* Another application is to make all functions global for use with debuggers
169
* or code profilers that require it.
170
*/
171
172
/* a function called through method pointers: */
173
#define METHODDEF(type) static type
174
/* a function used only in its module: */
175
#define LOCAL(type) static type
176
/* a function referenced thru EXTERNs: */
177
#define GLOBAL(type) type
178
/* a reference to a GLOBAL function: */
179
#define EXTERN(type) extern type
180
181
/* This macro is used to declare a "method", that is, a function pointer.
182
* We want to supply prototype parameters if the compiler can cope.
183
* Note that the arglist parameter must be parenthesized!
184
* Again, you can customize this if you need special linkage keywords.
185
*/
186
187
#ifdef HAVE_PROTOTYPES
188
#define JMETHOD(type, methodname, arglist) type(*methodname) arglist
189
#else
190
#define JMETHOD(type, methodname, arglist) type (*methodname)()
191
#endif
192
193
/* Here is the pseudo-keyword for declaring pointers that must be "far"
194
* on 80x86 machines. Most of the specialized coding for 80x86 is handled
195
* by just saying "FAR *" where such a pointer is needed. In a few places
196
* explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
197
*/
198
199
#ifdef NEED_FAR_POINTERS
200
#define FAR far
201
#else
202
#define FAR
203
#endif
204
205
/*
206
* On a few systems, type boolean and/or its values FALSE, TRUE may appear
207
* in standard header files. Or you may have conflicts with application-
208
* specific header files that you want to include together with these files.
209
* Defining HAVE_BOOLEAN before including mrpt_jpeglib.h should make it work.
210
*/
211
212
#ifndef HAVE_BOOLEAN
213
typedef
int
boolean
;
214
#endif
215
#ifndef FALSE
/* in case these macros already exist */
216
#define FALSE 0
/* values of boolean */
217
#endif
218
#ifndef TRUE
219
#define TRUE 1
220
#endif
221
222
/*
223
* The remaining options affect code selection within the JPEG library,
224
* but they don't need to be visible to most applications using the library.
225
* To minimize application namespace pollution, the symbols won't be
226
* defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined.
227
*/
228
229
#ifdef JPEG_INTERNALS
230
#define JPEG_INTERNAL_OPTIONS
231
#endif
232
233
#ifdef JPEG_INTERNAL_OPTIONS
234
235
/*
236
* These defines indicate whether to include various optional functions.
237
* Undefining some of these symbols will produce a smaller but less capable
238
* library. Note that you can leave certain source files out of the
239
* compilation/linking process if you've #undef'd the corresponding symbols.
240
* (You may HAVE to do that if your compiler doesn't like null source files.)
241
*/
242
243
/* Arithmetic coding is unsupported for legal reasons. Complaints to IBM. */
244
245
/* Capability options common to encoder and decoder: */
246
247
#define DCT_ISLOW_SUPPORTED
/* slow but accurate integer algorithm */
248
#define DCT_IFAST_SUPPORTED
/* faster, less accurate integer method */
249
#define DCT_FLOAT_SUPPORTED
/* floating-point: accurate, fast on fast HW */
250
251
/* Encoder capability options: */
252
253
#undef C_ARITH_CODING_SUPPORTED
/* Arithmetic coding back end? */
254
#define C_MULTISCAN_FILES_SUPPORTED
/* Multiple-scan JPEG files? */
255
#define C_PROGRESSIVE_SUPPORTED
/* Progressive JPEG? (Requires MULTISCAN)*/
256
#define ENTROPY_OPT_SUPPORTED
/* Optimization of entropy coding parms? */
257
/* Note: if you selected 12-bit data precision, it is dangerous to turn off
258
* ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit
259
* precision, so jchuff.c normally uses entropy optimization to compute
260
* usable tables for higher precision. If you don't want to do optimization,
261
* you'll have to supply different default Huffman tables.
262
* The exact same statements apply for progressive JPEG: the default tables
263
* don't work for progressive mode. (This may get fixed, however.)
264
*/
265
#define INPUT_SMOOTHING_SUPPORTED
/* Input image smoothing option? */
266
267
/* Decoder capability options: */
268
269
#undef D_ARITH_CODING_SUPPORTED
/* Arithmetic coding back end? */
270
#define D_MULTISCAN_FILES_SUPPORTED
/* Multiple-scan JPEG files? */
271
#define D_PROGRESSIVE_SUPPORTED
/* Progressive JPEG? (Requires MULTISCAN)*/
272
#define SAVE_MARKERS_SUPPORTED
/* jpeg_save_markers() needed? */
273
#define BLOCK_SMOOTHING_SUPPORTED
/* Block smoothing? (Progressive only) */
274
#define IDCT_SCALING_SUPPORTED
/* Output rescaling via IDCT? */
275
#undef UPSAMPLE_SCALING_SUPPORTED
/* Output rescaling at upsample stage? */
276
#define UPSAMPLE_MERGING_SUPPORTED
/* Fast path for sloppy upsampling? */
277
#define QUANT_1PASS_SUPPORTED
/* 1-pass color quantization? */
278
#define QUANT_2PASS_SUPPORTED
/* 2-pass color quantization? */
279
280
/* more capability options later, no doubt */
281
282
/*
283
* Ordering of RGB data in scanlines passed to or from the application.
284
* If your application wants to deal with data in the order B,G,R, just
285
* change these macros. You can also deal with formats such as R,G,B,X
286
* (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing
287
* the offsets will also change the order in which colormap data is organized.
288
* RESTRICTIONS:
289
* 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
290
* 2. These macros only affect RGB<=>YCbCr color conversion, so they are not
291
* useful if you are using JPEG color spaces other than YCbCr or grayscale.
292
* 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
293
* is not 3 (they don't understand about dummy color components!). So you
294
* can't use color quantization if you change that value.
295
*/
296
297
#define RGB_RED 0
/* Offset of Red in an RGB scanline element */
298
#define RGB_GREEN 1
/* Offset of Green */
299
#define RGB_BLUE 2
/* Offset of Blue */
300
#define RGB_PIXELSIZE 3
/* JSAMPLEs per RGB scanline element */
301
302
/* Definitions for speed-related optimizations. */
303
304
/* If your compiler supports inline functions, define INLINE
305
* as the inline keyword; otherwise define it as empty.
306
*/
307
308
#ifndef INLINE
309
#ifdef __GNUC__
/* for instance, GNU C knows about inline */
310
#define INLINE __inline__
311
#endif
312
#ifndef INLINE
313
#define INLINE
/* default is to define it as empty */
314
#endif
315
#endif
316
317
/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying
318
* two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER
319
* as short on such a machine. MULTIPLIER must be at least 16 bits wide.
320
*/
321
322
#ifndef MULTIPLIER
323
#define MULTIPLIER int
/* type for fastest integer multiply */
324
#endif
325
326
/* FAST_FLOAT should be either float or double, whichever is done faster
327
* by your compiler. (Note that this type is only used in the floating point
328
* DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
329
* Typically, float is faster in ANSI C compilers, while double is faster in
330
* pre-ANSI compilers (because they insist on converting to double anyway).
331
* The code below therefore chooses float if we have ANSI-style prototypes.
332
*/
333
334
#ifndef FAST_FLOAT
335
#ifdef HAVE_PROTOTYPES
336
#define FAST_FLOAT float
337
#else
338
#define FAST_FLOAT double
339
#endif
340
#endif
341
342
#endif
/* JPEG_INTERNAL_OPTIONS */
JSAMPLE
char JSAMPLE
Definition:
jmorecfg.h:58
INT16
short INT16
Definition:
jmorecfg.h:145
JCOEF
short JCOEF
Definition:
jmorecfg.h:91
INT32
long INT32
Definition:
jmorecfg.h:151
boolean
int boolean
Definition:
jmorecfg.h:213
UINT8
short UINT8
Definition:
jmorecfg.h:130
UINT16
unsigned int UINT16
Definition:
jmorecfg.h:139
JDIMENSION
unsigned int JDIMENSION
Definition:
jmorecfg.h:161
JOCTET
char JOCTET
Definition:
jmorecfg.h:106
Page generated by
Doxygen 1.8.14
for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019