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



Page generated by Doxygen 1.8.6 for MRPT 1.5.6 Git: 4c65e84 Tue Apr 24 08:18:17 2018 +0200 at mar abr 24 08:26:17 CEST 2018