1*dfc6aa5cSAndroid Build Coastguard Worker /* 2*dfc6aa5cSAndroid Build Coastguard Worker * jmorecfg.h 3*dfc6aa5cSAndroid Build Coastguard Worker * 4*dfc6aa5cSAndroid Build Coastguard Worker * This file was part of the Independent JPEG Group's software: 5*dfc6aa5cSAndroid Build Coastguard Worker * Copyright (C) 1991-1997, Thomas G. Lane. 6*dfc6aa5cSAndroid Build Coastguard Worker * Modified 1997-2009 by Guido Vollbeding. 7*dfc6aa5cSAndroid Build Coastguard Worker * libjpeg-turbo Modifications: 8*dfc6aa5cSAndroid Build Coastguard Worker * Copyright (C) 2009, 2011, 2014-2015, 2018, 2020, D. R. Commander. 9*dfc6aa5cSAndroid Build Coastguard Worker * For conditions of distribution and use, see the accompanying README.ijg 10*dfc6aa5cSAndroid Build Coastguard Worker * file. 11*dfc6aa5cSAndroid Build Coastguard Worker * 12*dfc6aa5cSAndroid Build Coastguard Worker * This file contains additional configuration options that customize the 13*dfc6aa5cSAndroid Build Coastguard Worker * JPEG software for special applications or support machine-dependent 14*dfc6aa5cSAndroid Build Coastguard Worker * optimizations. Most users will not need to touch this file. 15*dfc6aa5cSAndroid Build Coastguard Worker */ 16*dfc6aa5cSAndroid Build Coastguard Worker 17*dfc6aa5cSAndroid Build Coastguard Worker 18*dfc6aa5cSAndroid Build Coastguard Worker /* 19*dfc6aa5cSAndroid Build Coastguard Worker * Maximum number of components (color channels) allowed in JPEG image. 20*dfc6aa5cSAndroid Build Coastguard Worker * To meet the letter of Rec. ITU-T T.81 | ISO/IEC 10918-1, set this to 255. 21*dfc6aa5cSAndroid Build Coastguard Worker * However, darn few applications need more than 4 channels (maybe 5 for CMYK + 22*dfc6aa5cSAndroid Build Coastguard Worker * alpha mask). We recommend 10 as a reasonable compromise; use 4 if you are 23*dfc6aa5cSAndroid Build Coastguard Worker * really short on memory. (Each allowed component costs a hundred or so 24*dfc6aa5cSAndroid Build Coastguard Worker * bytes of storage, whether actually used in an image or not.) 25*dfc6aa5cSAndroid Build Coastguard Worker */ 26*dfc6aa5cSAndroid Build Coastguard Worker 27*dfc6aa5cSAndroid Build Coastguard Worker #define MAX_COMPONENTS 10 /* maximum number of image components */ 28*dfc6aa5cSAndroid Build Coastguard Worker 29*dfc6aa5cSAndroid Build Coastguard Worker 30*dfc6aa5cSAndroid Build Coastguard Worker /* 31*dfc6aa5cSAndroid Build Coastguard Worker * Basic data types. 32*dfc6aa5cSAndroid Build Coastguard Worker * You may need to change these if you have a machine with unusual data 33*dfc6aa5cSAndroid Build Coastguard Worker * type sizes; for example, "char" not 8 bits, "short" not 16 bits, 34*dfc6aa5cSAndroid Build Coastguard Worker * or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits, 35*dfc6aa5cSAndroid Build Coastguard Worker * but it had better be at least 16. 36*dfc6aa5cSAndroid Build Coastguard Worker */ 37*dfc6aa5cSAndroid Build Coastguard Worker 38*dfc6aa5cSAndroid Build Coastguard Worker /* Representation of a single sample (pixel element value). 39*dfc6aa5cSAndroid Build Coastguard Worker * We frequently allocate large arrays of these, so it's important to keep 40*dfc6aa5cSAndroid Build Coastguard Worker * them small. But if you have memory to burn and access to char or short 41*dfc6aa5cSAndroid Build Coastguard Worker * arrays is very slow on your hardware, you might want to change these. 42*dfc6aa5cSAndroid Build Coastguard Worker */ 43*dfc6aa5cSAndroid Build Coastguard Worker 44*dfc6aa5cSAndroid Build Coastguard Worker #if BITS_IN_JSAMPLE == 8 45*dfc6aa5cSAndroid Build Coastguard Worker /* JSAMPLE should be the smallest type that will hold the values 0..255. 46*dfc6aa5cSAndroid Build Coastguard Worker */ 47*dfc6aa5cSAndroid Build Coastguard Worker 48*dfc6aa5cSAndroid Build Coastguard Worker typedef unsigned char JSAMPLE; 49*dfc6aa5cSAndroid Build Coastguard Worker #define GETJSAMPLE(value) ((int)(value)) 50*dfc6aa5cSAndroid Build Coastguard Worker 51*dfc6aa5cSAndroid Build Coastguard Worker #define MAXJSAMPLE 255 52*dfc6aa5cSAndroid Build Coastguard Worker #define CENTERJSAMPLE 128 53*dfc6aa5cSAndroid Build Coastguard Worker 54*dfc6aa5cSAndroid Build Coastguard Worker #endif /* BITS_IN_JSAMPLE == 8 */ 55*dfc6aa5cSAndroid Build Coastguard Worker 56*dfc6aa5cSAndroid Build Coastguard Worker 57*dfc6aa5cSAndroid Build Coastguard Worker #if BITS_IN_JSAMPLE == 12 58*dfc6aa5cSAndroid Build Coastguard Worker /* JSAMPLE should be the smallest type that will hold the values 0..4095. 59*dfc6aa5cSAndroid Build Coastguard Worker * On nearly all machines "short" will do nicely. 60*dfc6aa5cSAndroid Build Coastguard Worker */ 61*dfc6aa5cSAndroid Build Coastguard Worker 62*dfc6aa5cSAndroid Build Coastguard Worker typedef short JSAMPLE; 63*dfc6aa5cSAndroid Build Coastguard Worker #define GETJSAMPLE(value) ((int)(value)) 64*dfc6aa5cSAndroid Build Coastguard Worker 65*dfc6aa5cSAndroid Build Coastguard Worker #define MAXJSAMPLE 4095 66*dfc6aa5cSAndroid Build Coastguard Worker #define CENTERJSAMPLE 2048 67*dfc6aa5cSAndroid Build Coastguard Worker 68*dfc6aa5cSAndroid Build Coastguard Worker #endif /* BITS_IN_JSAMPLE == 12 */ 69*dfc6aa5cSAndroid Build Coastguard Worker 70*dfc6aa5cSAndroid Build Coastguard Worker 71*dfc6aa5cSAndroid Build Coastguard Worker /* Representation of a DCT frequency coefficient. 72*dfc6aa5cSAndroid Build Coastguard Worker * This should be a signed value of at least 16 bits; "short" is usually OK. 73*dfc6aa5cSAndroid Build Coastguard Worker * Again, we allocate large arrays of these, but you can change to int 74*dfc6aa5cSAndroid Build Coastguard Worker * if you have memory to burn and "short" is really slow. 75*dfc6aa5cSAndroid Build Coastguard Worker */ 76*dfc6aa5cSAndroid Build Coastguard Worker 77*dfc6aa5cSAndroid Build Coastguard Worker typedef short JCOEF; 78*dfc6aa5cSAndroid Build Coastguard Worker 79*dfc6aa5cSAndroid Build Coastguard Worker 80*dfc6aa5cSAndroid Build Coastguard Worker /* Compressed datastreams are represented as arrays of JOCTET. 81*dfc6aa5cSAndroid Build Coastguard Worker * These must be EXACTLY 8 bits wide, at least once they are written to 82*dfc6aa5cSAndroid Build Coastguard Worker * external storage. Note that when using the stdio data source/destination 83*dfc6aa5cSAndroid Build Coastguard Worker * managers, this is also the data type passed to fread/fwrite. 84*dfc6aa5cSAndroid Build Coastguard Worker */ 85*dfc6aa5cSAndroid Build Coastguard Worker 86*dfc6aa5cSAndroid Build Coastguard Worker typedef unsigned char JOCTET; 87*dfc6aa5cSAndroid Build Coastguard Worker #define GETJOCTET(value) (value) 88*dfc6aa5cSAndroid Build Coastguard Worker 89*dfc6aa5cSAndroid Build Coastguard Worker 90*dfc6aa5cSAndroid Build Coastguard Worker /* These typedefs are used for various table entries and so forth. 91*dfc6aa5cSAndroid Build Coastguard Worker * They must be at least as wide as specified; but making them too big 92*dfc6aa5cSAndroid Build Coastguard Worker * won't cost a huge amount of memory, so we don't provide special 93*dfc6aa5cSAndroid Build Coastguard Worker * extraction code like we did for JSAMPLE. (In other words, these 94*dfc6aa5cSAndroid Build Coastguard Worker * typedefs live at a different point on the speed/space tradeoff curve.) 95*dfc6aa5cSAndroid Build Coastguard Worker */ 96*dfc6aa5cSAndroid Build Coastguard Worker 97*dfc6aa5cSAndroid Build Coastguard Worker /* UINT8 must hold at least the values 0..255. */ 98*dfc6aa5cSAndroid Build Coastguard Worker 99*dfc6aa5cSAndroid Build Coastguard Worker typedef unsigned char UINT8; 100*dfc6aa5cSAndroid Build Coastguard Worker 101*dfc6aa5cSAndroid Build Coastguard Worker /* UINT16 must hold at least the values 0..65535. */ 102*dfc6aa5cSAndroid Build Coastguard Worker 103*dfc6aa5cSAndroid Build Coastguard Worker typedef unsigned short UINT16; 104*dfc6aa5cSAndroid Build Coastguard Worker 105*dfc6aa5cSAndroid Build Coastguard Worker /* INT16 must hold at least the values -32768..32767. */ 106*dfc6aa5cSAndroid Build Coastguard Worker 107*dfc6aa5cSAndroid Build Coastguard Worker #ifndef XMD_H /* X11/xmd.h correctly defines INT16 */ 108*dfc6aa5cSAndroid Build Coastguard Worker typedef short INT16; 109*dfc6aa5cSAndroid Build Coastguard Worker #endif 110*dfc6aa5cSAndroid Build Coastguard Worker 111*dfc6aa5cSAndroid Build Coastguard Worker /* INT32 must hold at least signed 32-bit values. 112*dfc6aa5cSAndroid Build Coastguard Worker * 113*dfc6aa5cSAndroid Build Coastguard Worker * NOTE: The INT32 typedef dates back to libjpeg v5 (1994.) Integers were 114*dfc6aa5cSAndroid Build Coastguard Worker * sometimes 16-bit back then (MS-DOS), which is why INT32 is typedef'd to 115*dfc6aa5cSAndroid Build Coastguard Worker * long. It also wasn't common (or at least as common) in 1994 for INT32 to be 116*dfc6aa5cSAndroid Build Coastguard Worker * defined by platform headers. Since then, however, INT32 is defined in 117*dfc6aa5cSAndroid Build Coastguard Worker * several other common places: 118*dfc6aa5cSAndroid Build Coastguard Worker * 119*dfc6aa5cSAndroid Build Coastguard Worker * Xmd.h (X11 header) typedefs INT32 to int on 64-bit platforms and long on 120*dfc6aa5cSAndroid Build Coastguard Worker * 32-bit platforms (i.e always a 32-bit signed type.) 121*dfc6aa5cSAndroid Build Coastguard Worker * 122*dfc6aa5cSAndroid Build Coastguard Worker * basetsd.h (Win32 header) typedefs INT32 to int (always a 32-bit signed type 123*dfc6aa5cSAndroid Build Coastguard Worker * on modern platforms.) 124*dfc6aa5cSAndroid Build Coastguard Worker * 125*dfc6aa5cSAndroid Build Coastguard Worker * qglobal.h (Qt header) typedefs INT32 to int (always a 32-bit signed type on 126*dfc6aa5cSAndroid Build Coastguard Worker * modern platforms.) 127*dfc6aa5cSAndroid Build Coastguard Worker * 128*dfc6aa5cSAndroid Build Coastguard Worker * This is a recipe for conflict, since "long" and "int" aren't always 129*dfc6aa5cSAndroid Build Coastguard Worker * compatible types. Since the definition of INT32 has technically been part 130*dfc6aa5cSAndroid Build Coastguard Worker * of the libjpeg API for more than 20 years, we can't remove it, but we do not 131*dfc6aa5cSAndroid Build Coastguard Worker * use it internally any longer. We instead define a separate type (JLONG) 132*dfc6aa5cSAndroid Build Coastguard Worker * for internal use, which ensures that internal behavior will always be the 133*dfc6aa5cSAndroid Build Coastguard Worker * same regardless of any external headers that may be included. 134*dfc6aa5cSAndroid Build Coastguard Worker */ 135*dfc6aa5cSAndroid Build Coastguard Worker 136*dfc6aa5cSAndroid Build Coastguard Worker #ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ 137*dfc6aa5cSAndroid Build Coastguard Worker #ifndef _BASETSD_H_ /* Microsoft defines it in basetsd.h */ 138*dfc6aa5cSAndroid Build Coastguard Worker #ifndef _BASETSD_H /* MinGW is slightly different */ 139*dfc6aa5cSAndroid Build Coastguard Worker #ifndef QGLOBAL_H /* Qt defines it in qglobal.h */ 140*dfc6aa5cSAndroid Build Coastguard Worker typedef long INT32; 141*dfc6aa5cSAndroid Build Coastguard Worker #endif 142*dfc6aa5cSAndroid Build Coastguard Worker #endif 143*dfc6aa5cSAndroid Build Coastguard Worker #endif 144*dfc6aa5cSAndroid Build Coastguard Worker #endif 145*dfc6aa5cSAndroid Build Coastguard Worker 146*dfc6aa5cSAndroid Build Coastguard Worker /* Datatype used for image dimensions. The JPEG standard only supports 147*dfc6aa5cSAndroid Build Coastguard Worker * images up to 64K*64K due to 16-bit fields in SOF markers. Therefore 148*dfc6aa5cSAndroid Build Coastguard Worker * "unsigned int" is sufficient on all machines. However, if you need to 149*dfc6aa5cSAndroid Build Coastguard Worker * handle larger images and you don't mind deviating from the spec, you 150*dfc6aa5cSAndroid Build Coastguard Worker * can change this datatype. (Note that changing this datatype will 151*dfc6aa5cSAndroid Build Coastguard Worker * potentially require modifying the SIMD code. The x86-64 SIMD extensions, 152*dfc6aa5cSAndroid Build Coastguard Worker * in particular, assume a 32-bit JDIMENSION.) 153*dfc6aa5cSAndroid Build Coastguard Worker */ 154*dfc6aa5cSAndroid Build Coastguard Worker 155*dfc6aa5cSAndroid Build Coastguard Worker typedef unsigned int JDIMENSION; 156*dfc6aa5cSAndroid Build Coastguard Worker 157*dfc6aa5cSAndroid Build Coastguard Worker #define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */ 158*dfc6aa5cSAndroid Build Coastguard Worker 159*dfc6aa5cSAndroid Build Coastguard Worker 160*dfc6aa5cSAndroid Build Coastguard Worker /* These macros are used in all function definitions and extern declarations. 161*dfc6aa5cSAndroid Build Coastguard Worker * You could modify them if you need to change function linkage conventions; 162*dfc6aa5cSAndroid Build Coastguard Worker * in particular, you'll need to do that to make the library a Windows DLL. 163*dfc6aa5cSAndroid Build Coastguard Worker * Another application is to make all functions global for use with debuggers 164*dfc6aa5cSAndroid Build Coastguard Worker * or code profilers that require it. 165*dfc6aa5cSAndroid Build Coastguard Worker */ 166*dfc6aa5cSAndroid Build Coastguard Worker 167*dfc6aa5cSAndroid Build Coastguard Worker /* a function called through method pointers: */ 168*dfc6aa5cSAndroid Build Coastguard Worker #define METHODDEF(type) static type 169*dfc6aa5cSAndroid Build Coastguard Worker /* a function used only in its module: */ 170*dfc6aa5cSAndroid Build Coastguard Worker #define LOCAL(type) static type 171*dfc6aa5cSAndroid Build Coastguard Worker /* a function referenced thru EXTERNs: */ 172*dfc6aa5cSAndroid Build Coastguard Worker #define GLOBAL(type) type 173*dfc6aa5cSAndroid Build Coastguard Worker /* a reference to a GLOBAL function: */ 174*dfc6aa5cSAndroid Build Coastguard Worker #define EXTERN(type) extern type 175*dfc6aa5cSAndroid Build Coastguard Worker 176*dfc6aa5cSAndroid Build Coastguard Worker 177*dfc6aa5cSAndroid Build Coastguard Worker /* Originally, this macro was used as a way of defining function prototypes 178*dfc6aa5cSAndroid Build Coastguard Worker * for both modern compilers as well as older compilers that did not support 179*dfc6aa5cSAndroid Build Coastguard Worker * prototype parameters. libjpeg-turbo has never supported these older, 180*dfc6aa5cSAndroid Build Coastguard Worker * non-ANSI compilers, but the macro is still included because there is some 181*dfc6aa5cSAndroid Build Coastguard Worker * software out there that uses it. 182*dfc6aa5cSAndroid Build Coastguard Worker */ 183*dfc6aa5cSAndroid Build Coastguard Worker 184*dfc6aa5cSAndroid Build Coastguard Worker #define JMETHOD(type, methodname, arglist) type (*methodname) arglist 185*dfc6aa5cSAndroid Build Coastguard Worker 186*dfc6aa5cSAndroid Build Coastguard Worker 187*dfc6aa5cSAndroid Build Coastguard Worker /* libjpeg-turbo no longer supports platforms that have far symbols (MS-DOS), 188*dfc6aa5cSAndroid Build Coastguard Worker * but again, some software relies on this macro. 189*dfc6aa5cSAndroid Build Coastguard Worker */ 190*dfc6aa5cSAndroid Build Coastguard Worker 191*dfc6aa5cSAndroid Build Coastguard Worker #undef FAR 192*dfc6aa5cSAndroid Build Coastguard Worker #define FAR 193*dfc6aa5cSAndroid Build Coastguard Worker 194*dfc6aa5cSAndroid Build Coastguard Worker 195*dfc6aa5cSAndroid Build Coastguard Worker /* 196*dfc6aa5cSAndroid Build Coastguard Worker * On a few systems, type boolean and/or its values FALSE, TRUE may appear 197*dfc6aa5cSAndroid Build Coastguard Worker * in standard header files. Or you may have conflicts with application- 198*dfc6aa5cSAndroid Build Coastguard Worker * specific header files that you want to include together with these files. 199*dfc6aa5cSAndroid Build Coastguard Worker * Defining HAVE_BOOLEAN before including jpeglib.h should make it work. 200*dfc6aa5cSAndroid Build Coastguard Worker */ 201*dfc6aa5cSAndroid Build Coastguard Worker 202*dfc6aa5cSAndroid Build Coastguard Worker #ifndef HAVE_BOOLEAN 203*dfc6aa5cSAndroid Build Coastguard Worker typedef int boolean; 204*dfc6aa5cSAndroid Build Coastguard Worker #endif 205*dfc6aa5cSAndroid Build Coastguard Worker #ifndef FALSE /* in case these macros already exist */ 206*dfc6aa5cSAndroid Build Coastguard Worker #define FALSE 0 /* values of boolean */ 207*dfc6aa5cSAndroid Build Coastguard Worker #endif 208*dfc6aa5cSAndroid Build Coastguard Worker #ifndef TRUE 209*dfc6aa5cSAndroid Build Coastguard Worker #define TRUE 1 210*dfc6aa5cSAndroid Build Coastguard Worker #endif 211*dfc6aa5cSAndroid Build Coastguard Worker 212*dfc6aa5cSAndroid Build Coastguard Worker 213*dfc6aa5cSAndroid Build Coastguard Worker /* 214*dfc6aa5cSAndroid Build Coastguard Worker * The remaining options affect code selection within the JPEG library, 215*dfc6aa5cSAndroid Build Coastguard Worker * but they don't need to be visible to most applications using the library. 216*dfc6aa5cSAndroid Build Coastguard Worker * To minimize application namespace pollution, the symbols won't be 217*dfc6aa5cSAndroid Build Coastguard Worker * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined. 218*dfc6aa5cSAndroid Build Coastguard Worker */ 219*dfc6aa5cSAndroid Build Coastguard Worker 220*dfc6aa5cSAndroid Build Coastguard Worker #ifdef JPEG_INTERNALS 221*dfc6aa5cSAndroid Build Coastguard Worker #define JPEG_INTERNAL_OPTIONS 222*dfc6aa5cSAndroid Build Coastguard Worker #endif 223*dfc6aa5cSAndroid Build Coastguard Worker 224*dfc6aa5cSAndroid Build Coastguard Worker #ifdef JPEG_INTERNAL_OPTIONS 225*dfc6aa5cSAndroid Build Coastguard Worker 226*dfc6aa5cSAndroid Build Coastguard Worker 227*dfc6aa5cSAndroid Build Coastguard Worker /* 228*dfc6aa5cSAndroid Build Coastguard Worker * These defines indicate whether to include various optional functions. 229*dfc6aa5cSAndroid Build Coastguard Worker * Undefining some of these symbols will produce a smaller but less capable 230*dfc6aa5cSAndroid Build Coastguard Worker * library. Note that you can leave certain source files out of the 231*dfc6aa5cSAndroid Build Coastguard Worker * compilation/linking process if you've #undef'd the corresponding symbols. 232*dfc6aa5cSAndroid Build Coastguard Worker * (You may HAVE to do that if your compiler doesn't like null source files.) 233*dfc6aa5cSAndroid Build Coastguard Worker */ 234*dfc6aa5cSAndroid Build Coastguard Worker 235*dfc6aa5cSAndroid Build Coastguard Worker /* Capability options common to encoder and decoder: */ 236*dfc6aa5cSAndroid Build Coastguard Worker 237*dfc6aa5cSAndroid Build Coastguard Worker #define DCT_ISLOW_SUPPORTED /* accurate integer method */ 238*dfc6aa5cSAndroid Build Coastguard Worker #define DCT_IFAST_SUPPORTED /* less accurate int method [legacy feature] */ 239*dfc6aa5cSAndroid Build Coastguard Worker #define DCT_FLOAT_SUPPORTED /* floating-point method [legacy feature] */ 240*dfc6aa5cSAndroid Build Coastguard Worker 241*dfc6aa5cSAndroid Build Coastguard Worker /* Encoder capability options: */ 242*dfc6aa5cSAndroid Build Coastguard Worker 243*dfc6aa5cSAndroid Build Coastguard Worker #define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ 244*dfc6aa5cSAndroid Build Coastguard Worker #define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ 245*dfc6aa5cSAndroid Build Coastguard Worker #define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */ 246*dfc6aa5cSAndroid Build Coastguard Worker /* Note: if you selected 12-bit data precision, it is dangerous to turn off 247*dfc6aa5cSAndroid Build Coastguard Worker * ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit 248*dfc6aa5cSAndroid Build Coastguard Worker * precision, so jchuff.c normally uses entropy optimization to compute 249*dfc6aa5cSAndroid Build Coastguard Worker * usable tables for higher precision. If you don't want to do optimization, 250*dfc6aa5cSAndroid Build Coastguard Worker * you'll have to supply different default Huffman tables. 251*dfc6aa5cSAndroid Build Coastguard Worker * The exact same statements apply for progressive JPEG: the default tables 252*dfc6aa5cSAndroid Build Coastguard Worker * don't work for progressive mode. (This may get fixed, however.) 253*dfc6aa5cSAndroid Build Coastguard Worker */ 254*dfc6aa5cSAndroid Build Coastguard Worker #define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */ 255*dfc6aa5cSAndroid Build Coastguard Worker 256*dfc6aa5cSAndroid Build Coastguard Worker /* Decoder capability options: */ 257*dfc6aa5cSAndroid Build Coastguard Worker 258*dfc6aa5cSAndroid Build Coastguard Worker #define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ 259*dfc6aa5cSAndroid Build Coastguard Worker #define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ 260*dfc6aa5cSAndroid Build Coastguard Worker #define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */ 261*dfc6aa5cSAndroid Build Coastguard Worker #define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */ 262*dfc6aa5cSAndroid Build Coastguard Worker #define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */ 263*dfc6aa5cSAndroid Build Coastguard Worker #undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */ 264*dfc6aa5cSAndroid Build Coastguard Worker #define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */ 265*dfc6aa5cSAndroid Build Coastguard Worker #define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */ 266*dfc6aa5cSAndroid Build Coastguard Worker #define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */ 267*dfc6aa5cSAndroid Build Coastguard Worker 268*dfc6aa5cSAndroid Build Coastguard Worker /* more capability options later, no doubt */ 269*dfc6aa5cSAndroid Build Coastguard Worker 270*dfc6aa5cSAndroid Build Coastguard Worker 271*dfc6aa5cSAndroid Build Coastguard Worker /* 272*dfc6aa5cSAndroid Build Coastguard Worker * The RGB_RED, RGB_GREEN, RGB_BLUE, and RGB_PIXELSIZE macros are a vestigial 273*dfc6aa5cSAndroid Build Coastguard Worker * feature of libjpeg. The idea was that, if an application developer needed 274*dfc6aa5cSAndroid Build Coastguard Worker * to compress from/decompress to a BGR/BGRX/RGBX/XBGR/XRGB buffer, they could 275*dfc6aa5cSAndroid Build Coastguard Worker * change these macros, rebuild libjpeg, and link their application statically 276*dfc6aa5cSAndroid Build Coastguard Worker * with it. In reality, few people ever did this, because there were some 277*dfc6aa5cSAndroid Build Coastguard Worker * severe restrictions involved (cjpeg and djpeg no longer worked properly, 278*dfc6aa5cSAndroid Build Coastguard Worker * compressing/decompressing RGB JPEGs no longer worked properly, and the color 279*dfc6aa5cSAndroid Build Coastguard Worker * quantizer wouldn't work with pixel sizes other than 3.) Furthermore, since 280*dfc6aa5cSAndroid Build Coastguard Worker * all of the O/S-supplied versions of libjpeg were built with the default 281*dfc6aa5cSAndroid Build Coastguard Worker * values of RGB_RED, RGB_GREEN, RGB_BLUE, and RGB_PIXELSIZE, many applications 282*dfc6aa5cSAndroid Build Coastguard Worker * have come to regard these values as immutable. 283*dfc6aa5cSAndroid Build Coastguard Worker * 284*dfc6aa5cSAndroid Build Coastguard Worker * The libjpeg-turbo colorspace extensions provide a much cleaner way of 285*dfc6aa5cSAndroid Build Coastguard Worker * compressing from/decompressing to buffers with arbitrary component orders 286*dfc6aa5cSAndroid Build Coastguard Worker * and pixel sizes. Thus, we do not support changing the values of RGB_RED, 287*dfc6aa5cSAndroid Build Coastguard Worker * RGB_GREEN, RGB_BLUE, or RGB_PIXELSIZE. In addition to the restrictions 288*dfc6aa5cSAndroid Build Coastguard Worker * listed above, changing these values will also break the SIMD extensions and 289*dfc6aa5cSAndroid Build Coastguard Worker * the regression tests. 290*dfc6aa5cSAndroid Build Coastguard Worker */ 291*dfc6aa5cSAndroid Build Coastguard Worker 292*dfc6aa5cSAndroid Build Coastguard Worker #define RGB_RED 0 /* Offset of Red in an RGB scanline element */ 293*dfc6aa5cSAndroid Build Coastguard Worker #define RGB_GREEN 1 /* Offset of Green */ 294*dfc6aa5cSAndroid Build Coastguard Worker #define RGB_BLUE 2 /* Offset of Blue */ 295*dfc6aa5cSAndroid Build Coastguard Worker #define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */ 296*dfc6aa5cSAndroid Build Coastguard Worker 297*dfc6aa5cSAndroid Build Coastguard Worker #define JPEG_NUMCS 17 298*dfc6aa5cSAndroid Build Coastguard Worker 299*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_RGB_RED 0 300*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_RGB_GREEN 1 301*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_RGB_BLUE 2 302*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_RGB_PIXELSIZE 3 303*dfc6aa5cSAndroid Build Coastguard Worker 304*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_RGBX_RED 0 305*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_RGBX_GREEN 1 306*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_RGBX_BLUE 2 307*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_RGBX_PIXELSIZE 4 308*dfc6aa5cSAndroid Build Coastguard Worker 309*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_BGR_RED 2 310*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_BGR_GREEN 1 311*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_BGR_BLUE 0 312*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_BGR_PIXELSIZE 3 313*dfc6aa5cSAndroid Build Coastguard Worker 314*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_BGRX_RED 2 315*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_BGRX_GREEN 1 316*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_BGRX_BLUE 0 317*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_BGRX_PIXELSIZE 4 318*dfc6aa5cSAndroid Build Coastguard Worker 319*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_XBGR_RED 3 320*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_XBGR_GREEN 2 321*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_XBGR_BLUE 1 322*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_XBGR_PIXELSIZE 4 323*dfc6aa5cSAndroid Build Coastguard Worker 324*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_XRGB_RED 1 325*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_XRGB_GREEN 2 326*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_XRGB_BLUE 3 327*dfc6aa5cSAndroid Build Coastguard Worker #define EXT_XRGB_PIXELSIZE 4 328*dfc6aa5cSAndroid Build Coastguard Worker 329*dfc6aa5cSAndroid Build Coastguard Worker static const int rgb_red[JPEG_NUMCS] = { 330*dfc6aa5cSAndroid Build Coastguard Worker -1, -1, RGB_RED, -1, -1, -1, EXT_RGB_RED, EXT_RGBX_RED, 331*dfc6aa5cSAndroid Build Coastguard Worker EXT_BGR_RED, EXT_BGRX_RED, EXT_XBGR_RED, EXT_XRGB_RED, 332*dfc6aa5cSAndroid Build Coastguard Worker EXT_RGBX_RED, EXT_BGRX_RED, EXT_XBGR_RED, EXT_XRGB_RED, 333*dfc6aa5cSAndroid Build Coastguard Worker -1 334*dfc6aa5cSAndroid Build Coastguard Worker }; 335*dfc6aa5cSAndroid Build Coastguard Worker 336*dfc6aa5cSAndroid Build Coastguard Worker static const int rgb_green[JPEG_NUMCS] = { 337*dfc6aa5cSAndroid Build Coastguard Worker -1, -1, RGB_GREEN, -1, -1, -1, EXT_RGB_GREEN, EXT_RGBX_GREEN, 338*dfc6aa5cSAndroid Build Coastguard Worker EXT_BGR_GREEN, EXT_BGRX_GREEN, EXT_XBGR_GREEN, EXT_XRGB_GREEN, 339*dfc6aa5cSAndroid Build Coastguard Worker EXT_RGBX_GREEN, EXT_BGRX_GREEN, EXT_XBGR_GREEN, EXT_XRGB_GREEN, 340*dfc6aa5cSAndroid Build Coastguard Worker -1 341*dfc6aa5cSAndroid Build Coastguard Worker }; 342*dfc6aa5cSAndroid Build Coastguard Worker 343*dfc6aa5cSAndroid Build Coastguard Worker static const int rgb_blue[JPEG_NUMCS] = { 344*dfc6aa5cSAndroid Build Coastguard Worker -1, -1, RGB_BLUE, -1, -1, -1, EXT_RGB_BLUE, EXT_RGBX_BLUE, 345*dfc6aa5cSAndroid Build Coastguard Worker EXT_BGR_BLUE, EXT_BGRX_BLUE, EXT_XBGR_BLUE, EXT_XRGB_BLUE, 346*dfc6aa5cSAndroid Build Coastguard Worker EXT_RGBX_BLUE, EXT_BGRX_BLUE, EXT_XBGR_BLUE, EXT_XRGB_BLUE, 347*dfc6aa5cSAndroid Build Coastguard Worker -1 348*dfc6aa5cSAndroid Build Coastguard Worker }; 349*dfc6aa5cSAndroid Build Coastguard Worker 350*dfc6aa5cSAndroid Build Coastguard Worker static const int rgb_pixelsize[JPEG_NUMCS] = { 351*dfc6aa5cSAndroid Build Coastguard Worker -1, -1, RGB_PIXELSIZE, -1, -1, -1, EXT_RGB_PIXELSIZE, EXT_RGBX_PIXELSIZE, 352*dfc6aa5cSAndroid Build Coastguard Worker EXT_BGR_PIXELSIZE, EXT_BGRX_PIXELSIZE, EXT_XBGR_PIXELSIZE, EXT_XRGB_PIXELSIZE, 353*dfc6aa5cSAndroid Build Coastguard Worker EXT_RGBX_PIXELSIZE, EXT_BGRX_PIXELSIZE, EXT_XBGR_PIXELSIZE, EXT_XRGB_PIXELSIZE, 354*dfc6aa5cSAndroid Build Coastguard Worker -1 355*dfc6aa5cSAndroid Build Coastguard Worker }; 356*dfc6aa5cSAndroid Build Coastguard Worker 357*dfc6aa5cSAndroid Build Coastguard Worker /* Definitions for speed-related optimizations. */ 358*dfc6aa5cSAndroid Build Coastguard Worker 359*dfc6aa5cSAndroid Build Coastguard Worker /* On some machines (notably 68000 series) "int" is 32 bits, but multiplying 360*dfc6aa5cSAndroid Build Coastguard Worker * two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER 361*dfc6aa5cSAndroid Build Coastguard Worker * as short on such a machine. MULTIPLIER must be at least 16 bits wide. 362*dfc6aa5cSAndroid Build Coastguard Worker */ 363*dfc6aa5cSAndroid Build Coastguard Worker 364*dfc6aa5cSAndroid Build Coastguard Worker #ifndef MULTIPLIER 365*dfc6aa5cSAndroid Build Coastguard Worker #ifndef WITH_SIMD 366*dfc6aa5cSAndroid Build Coastguard Worker #define MULTIPLIER int /* type for fastest integer multiply */ 367*dfc6aa5cSAndroid Build Coastguard Worker #else 368*dfc6aa5cSAndroid Build Coastguard Worker #define MULTIPLIER short /* prefer 16-bit with SIMD for parellelism */ 369*dfc6aa5cSAndroid Build Coastguard Worker #endif 370*dfc6aa5cSAndroid Build Coastguard Worker #endif 371*dfc6aa5cSAndroid Build Coastguard Worker 372*dfc6aa5cSAndroid Build Coastguard Worker 373*dfc6aa5cSAndroid Build Coastguard Worker /* FAST_FLOAT should be either float or double, whichever is done faster 374*dfc6aa5cSAndroid Build Coastguard Worker * by your compiler. (Note that this type is only used in the floating point 375*dfc6aa5cSAndroid Build Coastguard Worker * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.) 376*dfc6aa5cSAndroid Build Coastguard Worker */ 377*dfc6aa5cSAndroid Build Coastguard Worker 378*dfc6aa5cSAndroid Build Coastguard Worker #ifndef FAST_FLOAT 379*dfc6aa5cSAndroid Build Coastguard Worker #define FAST_FLOAT float 380*dfc6aa5cSAndroid Build Coastguard Worker #endif 381*dfc6aa5cSAndroid Build Coastguard Worker 382*dfc6aa5cSAndroid Build Coastguard Worker #endif /* JPEG_INTERNAL_OPTIONS */ 383