/* Representation of a single sample (pixel element value). *Wefrequentlyallocatelargearraysofthese,soit'simportanttokeep *themsmall.Butifyouhavememorytoburnandaccesstocharorshort *arraysisveryslowonyourhardware,youmightwanttochangethese.
*/
/* JSAMPLE should be the smallest type that will hold the values 0..255. */
/* Representation of a DCT frequency coefficient. *Thisshouldbeasignedvalueofatleast16bits;"short"isusuallyOK. *Again,weallocatelargearraysofthese,butyoucanchangetoint *ifyouhavememorytoburnand"short"isreallyslow.
*/
typedefshort JCOEF;
/* Compressed datastreams are represented as arrays of JOCTET. *ThesemustbeEXACTLY8bitswide,atleastoncetheyarewrittento *externalstorage.Notethatwhenusingthestdiodatasource/destination *managers,thisisalsothedatatypepassedtofread/fwrite.
*/
/* These typedefs are used for various table entries and so forth. *Theymustbeatleastaswideasspecified;butmakingthemtoobig *won'tcostahugeamountofmemory,sowedon'tprovidespecial *extractioncodelikewedidforJSAMPLE.(Inotherwords,these *typedefsliveatadifferentpointonthespeed/spacetradeoffcurve.)
*/
/* UINT8 must hold at least the values 0..255. */
typedef uint8_t UINT8;
/* UINT16 must hold at least the values 0..65535. */
typedef uint16_t UINT16;
/* INT16 must hold at least the values -32768..32767. */
typedef int16_t INT16;
/* INT32 must hold at least signed 32-bit values. * *NOTE:TheINT32typedefdatesbacktolibjpegv5(1994.)Integerswere *sometimes16-bitbackthen(MS-DOS),whichiswhyINT32istypedef'dto *long.Italsowasn'tcommon(oratleastascommon)in1994forINT32tobe *definedbyplatformheaders.Sincethen,however,INT32isdefinedin *severalothercommonplaces: * *Xmd.h(X11header)typedefsINT32tointon64-bitplatformsandlongon *32-bitplatforms(i.ealwaysa32-bitsignedtype.) * *basetsd.h(Win32header)typedefsINT32toint(alwaysa32-bitsignedtype *onmodernplatforms.) * *qglobal.h(Qtheader)typedefsINT32toint(alwaysa32-bitsignedtypeon *modernplatforms.) * *Thisisarecipeforconflict,since"long"and"int"aren'talways *compatibletypes.SincethedefinitionofINT32hastechnicallybeenpart *ofthelibjpegAPIformorethan20years,wecan'tremoveit,butwedonot *useitinternallyanylonger.Weinsteaddefineaseparatetype(JLONG) *forinternaluse,whichensuresthatinternalbehaviorwillalwaysbethe *sameregardlessofanyexternalheadersthatmaybeincluded.
*/
typedef int32_t INT32;
/* Datatype used for image dimensions. The JPEG standard only supports *imagesupto64K*64Kdueto16-bitfieldsinSOFmarkers.Therefore *"unsignedint"issufficientonallmachines.However,ifyouneedto *handlelargerimagesandyoudon'tminddeviatingfromthespec,you *canchangethisdatatype.(Notethatchangingthisdatatypewill *potentiallyrequiremodifyingtheSIMDcode.Thex86-64SIMDextensions, *inparticular,assumea32-bitJDIMENSION.)
*/
typedefunsignedint JDIMENSION;
#define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */
/* These macros are used in all function definitions and extern declarations. *Youcouldmodifythemifyouneedtochangefunctionlinkageconventions; *inparticular,you'llneedtodothattomakethelibraryaWindowsDLL. *Anotherapplicationistomakeallfunctionsglobalforusewithdebuggers *orcodeprofilersthatrequireit.
*/
/* a function called through method pointers: */ #define METHODDEF(type) static type /* a function used only in its module: */ #define LOCAL(type) static type /* a function referenced thru EXTERNs: */ #define GLOBAL(type) type /* a reference to a GLOBAL function: */ #defineEXTERN(type) extern type
/* Originally, this macro was used as a way of defining function prototypes *forbothmoderncompilersaswellasoldercompilersthatdidnotsupport *prototypeparameters.libjpeg-turbohasneversupportedtheseolder, *non-ANSIcompilers,butthemacroisstillincludedbecausethereissome *softwareouttherethatusesit.
*/
#define JMETHOD(type, methodname, arglist) type (*methodname) arglist
/* libjpeg-turbo no longer supports platforms that have far symbols (MS-DOS), *butagain,somesoftwarereliesonthismacro.
*/
#define RGB_RED 0/* Offset of Red in an RGB scanline element */ #define RGB_GREEN 1/* Offset of Green */ #define RGB_BLUE 2/* Offset of Blue */ #define RGB_PIXELSIZE 3/* JSAMPLEs per RGB scanline element */
/* Definitions for speed-related optimizations. */
/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying *two16-bitshortsisfasterthanmultiplyingtwoints.DefineMULTIPLIER *asshortonsuchamachine.MULTIPLIERmustbeatleast16bitswide.
*/
#ifndef MULTIPLIER #ifndef WITH_SIMD #define MULTIPLIER int/* type for fastest integer multiply */ #else #define MULTIPLIER short/* prefer 16-bit with SIMD for parellelism */ #endif #endif
/* FAST_FLOAT should be either float or double, whichever is done faster *byyourcompiler.(Notethatthistypeisonlyusedinthefloatingpoint *DCTroutines,soitonlymattersifyou'vedefinedDCT_FLOAT_SUPPORTED.)
*/