* updated libjpeg to version 8, as the previous version on trunk didn't look like version 7, the merge wasn't usable. I modified jpeglib.h to have the JPEGTranslator built.
* added libjpeg to AboutSystem * JPEGTranslator now uses the shared library libjpeg.so git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35312 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+18
-18
@@ -1,7 +1,8 @@
|
||||
/*
|
||||
* jerror.h
|
||||
*
|
||||
* Copyright (C) 1994-1998, Thomas G. Lane.
|
||||
* Copyright (C) 1994-1997, Thomas G. Lane.
|
||||
* Modified 1997-2009 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -39,25 +40,21 @@ typedef enum {
|
||||
JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */
|
||||
|
||||
/* For maintenance convenience, list is alphabetical by message code name */
|
||||
JMESSAGE(JERR_ARITH_NOTIMPL,
|
||||
"Sorry, there are legal restrictions on arithmetic coding")
|
||||
JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix")
|
||||
JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix")
|
||||
JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode")
|
||||
JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS")
|
||||
JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request")
|
||||
JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range")
|
||||
JMESSAGE(JERR_BAD_DCTSIZE, "IDCT output block size %d not supported")
|
||||
JMESSAGE(JERR_BAD_DIFF, "spatial difference out of range")
|
||||
JMESSAGE(JERR_BAD_DCTSIZE, "DCT scaled block size %dx%d not supported")
|
||||
JMESSAGE(JERR_BAD_DROP_SAMPLING,
|
||||
"Component index %d: mismatching sampling ratio %d:%d, %d:%d, %c")
|
||||
JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition")
|
||||
JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace")
|
||||
JMESSAGE(JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace")
|
||||
JMESSAGE(JERR_BAD_LENGTH, "Bogus marker length")
|
||||
JMESSAGE(JERR_BAD_LIB_VERSION,
|
||||
"Wrong JPEG library version: library is %d, caller expects %d")
|
||||
JMESSAGE(JERR_BAD_LOSSLESS,
|
||||
"Invalid lossless parameters Ss=%d Se=%d Ah=%d Al=%d")
|
||||
JMESSAGE(JERR_BAD_LOSSLESS_SCRIPT,
|
||||
"Invalid lossless parameters at scan script entry %d")
|
||||
JMESSAGE(JERR_BAD_MCU_SIZE, "Sampling factors too large for interleaved scan")
|
||||
JMESSAGE(JERR_BAD_POOL_ID, "Invalid memory pool code %d")
|
||||
JMESSAGE(JERR_BAD_PRECISION, "Unsupported JPEG data precision %d")
|
||||
@@ -65,7 +62,6 @@ JMESSAGE(JERR_BAD_PROGRESSION,
|
||||
"Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d")
|
||||
JMESSAGE(JERR_BAD_PROG_SCRIPT,
|
||||
"Invalid progressive parameters at scan script entry %d")
|
||||
JMESSAGE(JERR_BAD_RESTART, "Invalid restart interval: %d, must be an integer multiple of the number of MCUs in an MCU_row (%d)")
|
||||
JMESSAGE(JERR_BAD_SAMPLING, "Bogus sampling factors")
|
||||
JMESSAGE(JERR_BAD_SCAN_SCRIPT, "Invalid scan script at entry %d")
|
||||
JMESSAGE(JERR_BAD_STATE, "Improper call to JPEG library in state %d")
|
||||
@@ -74,8 +70,6 @@ JMESSAGE(JERR_BAD_STRUCT_SIZE,
|
||||
JMESSAGE(JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access")
|
||||
JMESSAGE(JERR_BUFFER_SIZE, "Buffer passed to JPEG library is too small")
|
||||
JMESSAGE(JERR_CANT_SUSPEND, "Suspension not allowed here")
|
||||
JMESSAGE(JERR_CANT_TRANSCODE,
|
||||
"Cannot transcode to/from lossless JPEG datastreams")
|
||||
JMESSAGE(JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet")
|
||||
JMESSAGE(JERR_COMPONENT_COUNT, "Too many color components: %d, max %d")
|
||||
JMESSAGE(JERR_CONVERSION_NOTIMPL, "Unsupported color conversion request")
|
||||
@@ -101,10 +95,10 @@ JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data")
|
||||
JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change")
|
||||
JMESSAGE(JERR_NOTIMPL, "Not implemented yet")
|
||||
JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time")
|
||||
JMESSAGE(JERR_NO_ARITH_TABLE, "Arithmetic table 0x%02x was not defined")
|
||||
JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported")
|
||||
JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined")
|
||||
JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image")
|
||||
JMESSAGE(JERR_NO_LOSSLESS_SCRIPT, "Lossless encoding was requested but no scan script was supplied")
|
||||
JMESSAGE(JERR_NO_QUANT_TABLE, "Quantization table 0x%02x was not defined")
|
||||
JMESSAGE(JERR_NO_SOI, "Not a JPEG file: starts with 0x%02x 0x%02x")
|
||||
JMESSAGE(JERR_OUT_OF_MEMORY, "Insufficient memory (case %d)")
|
||||
@@ -174,13 +168,12 @@ JMESSAGE(JTRC_THUMB_PALETTE,
|
||||
"JFIF extension marker: palette thumbnail image, length %u")
|
||||
JMESSAGE(JTRC_THUMB_RGB,
|
||||
"JFIF extension marker: RGB thumbnail image, length %u")
|
||||
JMESSAGE(JTRC_UNKNOWN_LOSSLESS_IDS,
|
||||
"Unrecognized component IDs %d %d %d, assuming RGB")
|
||||
JMESSAGE(JTRC_UNKNOWN_LOSSY_IDS,
|
||||
JMESSAGE(JTRC_UNKNOWN_IDS,
|
||||
"Unrecognized component IDs %d %d %d, assuming YCbCr")
|
||||
JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u")
|
||||
JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u")
|
||||
JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d")
|
||||
JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code")
|
||||
JMESSAGE(JWRN_BOGUS_PROGRESSION,
|
||||
"Inconsistent progression sequence for component %d coefficient %d")
|
||||
JMESSAGE(JWRN_EXTRANEOUS_DATA,
|
||||
@@ -189,8 +182,6 @@ JMESSAGE(JWRN_HIT_MARKER, "Corrupt JPEG data: premature end of data segment")
|
||||
JMESSAGE(JWRN_HUFF_BAD_CODE, "Corrupt JPEG data: bad Huffman code")
|
||||
JMESSAGE(JWRN_JFIF_MAJOR, "Warning: unknown JFIF revision number %d.%02d")
|
||||
JMESSAGE(JWRN_JPEG_EOF, "Premature end of JPEG file")
|
||||
JMESSAGE(JWRN_MUST_DOWNSCALE,
|
||||
"Must downscale data from %d bits to %d")
|
||||
JMESSAGE(JWRN_MUST_RESYNC,
|
||||
"Corrupt JPEG data: found marker 0x%02x instead of RST%d")
|
||||
JMESSAGE(JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG")
|
||||
@@ -240,6 +231,15 @@ JMESSAGE(JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines")
|
||||
(cinfo)->err->msg_parm.i[2] = (p3), \
|
||||
(cinfo)->err->msg_parm.i[3] = (p4), \
|
||||
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
|
||||
#define ERREXIT6(cinfo,code,p1,p2,p3,p4,p5,p6) \
|
||||
((cinfo)->err->msg_code = (code), \
|
||||
(cinfo)->err->msg_parm.i[0] = (p1), \
|
||||
(cinfo)->err->msg_parm.i[1] = (p2), \
|
||||
(cinfo)->err->msg_parm.i[2] = (p3), \
|
||||
(cinfo)->err->msg_parm.i[3] = (p4), \
|
||||
(cinfo)->err->msg_parm.i[4] = (p5), \
|
||||
(cinfo)->err->msg_parm.i[5] = (p6), \
|
||||
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
|
||||
#define ERREXITS(cinfo,code,str) \
|
||||
((cinfo)->err->msg_code = (code), \
|
||||
strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/*
|
||||
* jmorecfg.h
|
||||
*
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 1997-2009 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -90,33 +91,6 @@ typedef short JSAMPLE;
|
||||
#endif /* BITS_IN_JSAMPLE == 12 */
|
||||
|
||||
|
||||
#if BITS_IN_JSAMPLE == 16
|
||||
/* JSAMPLE should be the smallest type that will hold the values 0..65535.
|
||||
* You can use a signed short by having GETJSAMPLE mask it with 0xFFFF.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_UNSIGNED_SHORT
|
||||
|
||||
typedef unsigned short JSAMPLE;
|
||||
#define GETJSAMPLE(value) ((int) (value))
|
||||
|
||||
#else /* not HAVE_UNSIGNED_SHORT */
|
||||
|
||||
typedef short JSAMPLE;
|
||||
#ifdef SHORT_IS_UNSIGNED
|
||||
#define GETJSAMPLE(value) ((int) (value))
|
||||
#else
|
||||
#define GETJSAMPLE(value) ((int) (value) & 0xFFFF)
|
||||
#endif /* SHORT_IS_UNSIGNED */
|
||||
|
||||
#endif /* HAVE_UNSIGNED_SHORT */
|
||||
|
||||
#define MAXJSAMPLE 65535
|
||||
#define CENTERJSAMPLE 32768
|
||||
|
||||
#endif /* BITS_IN_JSAMPLE == 16 */
|
||||
|
||||
|
||||
/* Representation of a DCT frequency coefficient.
|
||||
* This should be a signed value of at least 16 bits; "short" is usually OK.
|
||||
* Again, we allocate large arrays of these, but you can change to int
|
||||
@@ -125,11 +99,6 @@ typedef short JSAMPLE;
|
||||
|
||||
typedef short JCOEF;
|
||||
|
||||
/* Representation of a spatial difference value.
|
||||
* This should be a signed value of at least 16 bits; int is usually OK.
|
||||
*/
|
||||
|
||||
typedef int JDIFF;
|
||||
|
||||
/* Compressed datastreams are represented as arrays of JOCTET.
|
||||
* These must be EXACTLY 8 bits wide, at least once they are written to
|
||||
@@ -190,8 +159,14 @@ typedef short INT16;
|
||||
/* INT32 must hold at least signed 32-bit values. */
|
||||
|
||||
#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
|
||||
#ifndef _BASETSD_H_ /* Microsoft defines it in basetsd.h */
|
||||
#ifndef _BASETSD_H /* MinGW is slightly different */
|
||||
#ifndef QGLOBAL_H /* Qt defines it in qglobal.h */
|
||||
typedef long INT32;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Datatype used for image dimensions. The JPEG standard only supports
|
||||
* images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
|
||||
@@ -241,11 +216,13 @@ typedef unsigned int JDIMENSION;
|
||||
* explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
|
||||
*/
|
||||
|
||||
#ifndef FAR
|
||||
#ifdef NEED_FAR_POINTERS
|
||||
#define FAR far
|
||||
#else
|
||||
#define FAR
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
@@ -288,8 +265,6 @@ typedef int boolean;
|
||||
* (You may HAVE to do that if your compiler doesn't like null source files.)
|
||||
*/
|
||||
|
||||
/* Arithmetic coding is unsupported for legal reasons. Complaints to IBM. */
|
||||
|
||||
/* Capability options common to encoder and decoder: */
|
||||
|
||||
#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */
|
||||
@@ -298,31 +273,29 @@ typedef int boolean;
|
||||
|
||||
/* Encoder capability options: */
|
||||
|
||||
#undef C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
|
||||
#define C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
|
||||
#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
|
||||
#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
|
||||
#define C_LOSSLESS_SUPPORTED /* Lossless JPEG? */
|
||||
#define DCT_SCALING_SUPPORTED /* Input rescaling via DCT? (Requires DCT_ISLOW)*/
|
||||
#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */
|
||||
/* Note: if you selected 12-bit data precision, it is dangerous to turn off
|
||||
* ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit
|
||||
* precision, so jcshuff.c normally uses entropy optimization to compute
|
||||
* precision, so jchuff.c normally uses entropy optimization to compute
|
||||
* usable tables for higher precision. If you don't want to do optimization,
|
||||
* you'll have to supply different default Huffman tables.
|
||||
* The exact same statements apply for progressive and lossless JPEG:
|
||||
* the default tables don't work for progressive mode or lossless mode.
|
||||
* (This may get fixed, however.)
|
||||
* The exact same statements apply for progressive JPEG: the default tables
|
||||
* don't work for progressive mode. (This may get fixed, however.)
|
||||
*/
|
||||
#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */
|
||||
|
||||
/* Decoder capability options: */
|
||||
|
||||
#undef D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
|
||||
#define D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
|
||||
#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
|
||||
#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
|
||||
#define D_LOSSLESS_SUPPORTED /* Lossless JPEG? */
|
||||
#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */
|
||||
#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */
|
||||
#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */
|
||||
#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */
|
||||
#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */
|
||||
#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */
|
||||
#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */
|
||||
|
||||
+124
-97
@@ -2,6 +2,7 @@
|
||||
* jpeglib.h
|
||||
*
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Modified 2002-2009 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -25,17 +26,21 @@
|
||||
#endif
|
||||
#include "jmorecfg.h" /* seldom changed options */
|
||||
|
||||
#ifdef __HAIKU__
|
||||
#include <setjmp.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifndef DONT_USE_EXTERN_C
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Version ID for the JPEG library.
|
||||
* Might be useful for tests like "#if JPEG_LIB_VERSION >= 60".
|
||||
* Might be useful for tests like "#if JPEG_LIB_VERSION >= 80".
|
||||
*/
|
||||
|
||||
#define JPEG_LIB_VERSION 62 /* Version 6b */
|
||||
#define JPEG_LIB_VERSION 80 /* Version 8.0 */
|
||||
|
||||
|
||||
/* Various constants determining the sizes of things.
|
||||
@@ -51,16 +56,15 @@ extern "C" {
|
||||
#define MAX_COMPS_IN_SCAN 4 /* JPEG limit on # of components in one scan */
|
||||
#define MAX_SAMP_FACTOR 4 /* JPEG limit on sampling factors */
|
||||
/* Unfortunately, some bozo at Adobe saw no reason to be bound by the standard;
|
||||
* the PostScript DCT filter can emit files with many more than 10 data units
|
||||
* per MCU.
|
||||
* If you happen to run across such a file, you can up D_MAX_DATA_UNITS_IN_MCU
|
||||
* the PostScript DCT filter can emit files with many more than 10 blocks/MCU.
|
||||
* If you happen to run across such a file, you can up D_MAX_BLOCKS_IN_MCU
|
||||
* to handle it. We even let you do this from the jconfig.h file. However,
|
||||
* we strongly discourage changing C_MAX_DATA_UNITS_IN_MCU; just because Adobe
|
||||
* we strongly discourage changing C_MAX_BLOCKS_IN_MCU; just because Adobe
|
||||
* sometimes emits noncompliant files doesn't mean you should too.
|
||||
*/
|
||||
#define C_MAX_DATA_UNITS_IN_MCU 10 /* compressor's limit on data units/MCU */
|
||||
#ifndef D_MAX_DATA_UNITS_IN_MCU
|
||||
#define D_MAX_DATA_UNITS_IN_MCU 10 /* decompressor's limit on data units/MCU */
|
||||
#define C_MAX_BLOCKS_IN_MCU 10 /* compressor's limit on blocks per MCU */
|
||||
#ifndef D_MAX_BLOCKS_IN_MCU
|
||||
#define D_MAX_BLOCKS_IN_MCU 10 /* decompressor's limit on blocks per MCU */
|
||||
#endif
|
||||
|
||||
|
||||
@@ -80,9 +84,6 @@ typedef JBLOCKARRAY *JBLOCKIMAGE; /* a 3-D array of coefficient blocks */
|
||||
|
||||
typedef JCOEF FAR *JCOEFPTR; /* useful in a couple of places */
|
||||
|
||||
typedef JDIFF FAR *JDIFFROW; /* pointer to one row of difference values */
|
||||
typedef JDIFFROW *JDIFFARRAY; /* ptr to some rows (a 2-D diff array) */
|
||||
typedef JDIFFARRAY *JDIFFIMAGE; /* a 3-D diff array: top index is color */
|
||||
|
||||
/* Types for JPEG compression parameters and working tables. */
|
||||
|
||||
@@ -141,26 +142,24 @@ typedef struct {
|
||||
/* Remaining fields should be treated as private by applications. */
|
||||
|
||||
/* These values are computed during compression or decompression startup: */
|
||||
/* Component's size in data units.
|
||||
* Any dummy data units added to complete an MCU are not counted; therefore
|
||||
/* Component's size in DCT blocks.
|
||||
* Any dummy blocks added to complete an MCU are not counted; therefore
|
||||
* these values do not depend on whether a scan is interleaved or not.
|
||||
*/
|
||||
JDIMENSION width_in_data_units;
|
||||
JDIMENSION height_in_data_units;
|
||||
/* Size of a data unit in/output by the codec (in samples). Always
|
||||
* data_unit for compression. For decompression this is the size of the
|
||||
* output from one data_unit, reflecting any processing performed by the
|
||||
* codec. For example, in the DCT-based codec, scaling may be applied
|
||||
* during the IDCT step. Values of 1,2,4,8 are likely to be supported.
|
||||
* Note that different components may have different codec_data_unit sizes.
|
||||
JDIMENSION width_in_blocks;
|
||||
JDIMENSION height_in_blocks;
|
||||
/* Size of a DCT block in samples,
|
||||
* reflecting any scaling we choose to apply during the DCT step.
|
||||
* Values from 1 to 16 are supported.
|
||||
* Note that different components may receive different DCT scalings.
|
||||
*/
|
||||
int codec_data_unit;
|
||||
int DCT_h_scaled_size;
|
||||
int DCT_v_scaled_size;
|
||||
/* The downsampled dimensions are the component's actual, unpadded number
|
||||
* of samples at the main buffer (preprocessing/compression interface), thus
|
||||
* downsampled_width = ceil(image_width * Hi/Hmax)
|
||||
* and similarly for height. For decompression, codec-based processing is
|
||||
* included (ie, IDCT scaling), so
|
||||
* downsampled_width = ceil(image_width * Hi/Hmax * codec_data_unit/data_unit)
|
||||
* of samples at the main buffer (preprocessing/compression interface);
|
||||
* DCT scaling is included, so
|
||||
* downsampled_width = ceil(image_width * Hi/Hmax * DCT_h_scaled_size/DCTSIZE)
|
||||
* and similarly for height.
|
||||
*/
|
||||
JDIMENSION downsampled_width; /* actual width in samples */
|
||||
JDIMENSION downsampled_height; /* actual height in samples */
|
||||
@@ -172,12 +171,12 @@ typedef struct {
|
||||
|
||||
/* These values are computed before starting a scan of the component. */
|
||||
/* The decompressor output side may not use these variables. */
|
||||
int MCU_width; /* number of data units per MCU, horizontally */
|
||||
int MCU_height; /* number of data units per MCU, vertically */
|
||||
int MCU_data_units; /* MCU_width * MCU_height */
|
||||
int MCU_sample_width; /* MCU width in samples, MCU_width*codec_data_unit */
|
||||
int last_col_width; /* # of non-dummy data_units across in last MCU */
|
||||
int last_row_height; /* # of non-dummy data_units down in last MCU */
|
||||
int MCU_width; /* number of blocks per MCU, horizontally */
|
||||
int MCU_height; /* number of blocks per MCU, vertically */
|
||||
int MCU_blocks; /* MCU_width * MCU_height */
|
||||
int MCU_sample_width; /* MCU width in samples: MCU_width * DCT_h_scaled_size */
|
||||
int last_col_width; /* # of non-dummy blocks across in last MCU */
|
||||
int last_row_height; /* # of non-dummy blocks down in last MCU */
|
||||
|
||||
/* Saved quantization table for component; NULL if none yet saved.
|
||||
* See jdinput.c comments about the need for this information.
|
||||
@@ -195,10 +194,8 @@ typedef struct {
|
||||
typedef struct {
|
||||
int comps_in_scan; /* number of components encoded in this scan */
|
||||
int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */
|
||||
int Ss, Se; /* progressive JPEG spectral selection parms
|
||||
lossless JPEG predictor select parm (Ss) */
|
||||
int Ah, Al; /* progressive JPEG successive approx. parms
|
||||
lossless JPEG point transform parm (Al) */
|
||||
int Ss, Se; /* progressive JPEG spectral selection parms */
|
||||
int Ah, Al; /* progressive JPEG successive approx. parms */
|
||||
} jpeg_scan_info;
|
||||
|
||||
/* The decompressor can save APPn and COM markers in a list of these: */
|
||||
@@ -214,14 +211,6 @@ struct jpeg_marker_struct {
|
||||
/* the marker length word is not counted in data_length or original_length */
|
||||
};
|
||||
|
||||
/* Known codec processes. */
|
||||
|
||||
typedef enum {
|
||||
JPROC_SEQUENTIAL, /* baseline/extended sequential DCT */
|
||||
JPROC_PROGRESSIVE, /* progressive DCT */
|
||||
JPROC_LOSSLESS /* lossless (sequential) */
|
||||
} J_CODEC_PROCESS;
|
||||
|
||||
/* Known color spaces. */
|
||||
|
||||
typedef enum {
|
||||
@@ -311,7 +300,17 @@ struct jpeg_compress_struct {
|
||||
* burnt when new parameters are added. Also note that there are several
|
||||
* helper routines to simplify changing parameters.
|
||||
*/
|
||||
boolean lossless; /* TRUE=lossless encoding, FALSE=lossy */
|
||||
|
||||
unsigned int scale_num, scale_denom; /* fraction by which to scale image */
|
||||
|
||||
JDIMENSION jpeg_width; /* scaled JPEG image width */
|
||||
JDIMENSION jpeg_height; /* scaled JPEG image height */
|
||||
/* Dimensions of actual JPEG image that will be written to file,
|
||||
* derived from input dimensions by scaling factors above.
|
||||
* These fields are computed by jpeg_start_compress().
|
||||
* You can also use jpeg_calc_jpeg_dimensions() to determine these values
|
||||
* in advance of calling jpeg_start_compress().
|
||||
*/
|
||||
|
||||
int data_precision; /* bits of precision in image data */
|
||||
|
||||
@@ -320,14 +319,17 @@ struct jpeg_compress_struct {
|
||||
|
||||
jpeg_component_info * comp_info;
|
||||
/* comp_info[i] describes component that appears i'th in SOF */
|
||||
|
||||
|
||||
JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];
|
||||
/* ptrs to coefficient quantization tables, or NULL if not defined */
|
||||
|
||||
int q_scale_factor[NUM_QUANT_TBLS];
|
||||
/* ptrs to coefficient quantization tables, or NULL if not defined,
|
||||
* and corresponding scale factors (percentage, initialized 100).
|
||||
*/
|
||||
|
||||
JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
|
||||
JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
|
||||
/* ptrs to Huffman coding tables, or NULL if not defined */
|
||||
|
||||
|
||||
UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
|
||||
UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
|
||||
UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
|
||||
@@ -343,6 +345,7 @@ struct jpeg_compress_struct {
|
||||
boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
|
||||
boolean optimize_coding; /* TRUE=optimize entropy encoding parms */
|
||||
boolean CCIR601_sampling; /* TRUE=first samples are cosited */
|
||||
boolean do_fancy_downsampling; /* TRUE=apply fancy downsampling */
|
||||
int smoothing_factor; /* 1..100, or 0 for no input smoothing */
|
||||
J_DCT_METHOD dct_method; /* DCT algorithm selector */
|
||||
|
||||
@@ -382,16 +385,17 @@ struct jpeg_compress_struct {
|
||||
/*
|
||||
* These fields are computed during compression startup
|
||||
*/
|
||||
int data_unit; /* size of data unit in samples */
|
||||
J_CODEC_PROCESS process; /* encoding process of JPEG image */
|
||||
|
||||
boolean progressive_mode; /* TRUE if scan script uses progressive mode */
|
||||
int max_h_samp_factor; /* largest h_samp_factor */
|
||||
int max_v_samp_factor; /* largest v_samp_factor */
|
||||
|
||||
JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to codec */
|
||||
/* The codec receives data in units of MCU rows as defined for fully
|
||||
* interleaved scans (whether the JPEG file is interleaved or not).
|
||||
* There are v_samp_factor * data_unit sample rows of each component in an
|
||||
int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component */
|
||||
int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component */
|
||||
|
||||
JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */
|
||||
/* The coefficient controller receives data in units of MCU rows as defined
|
||||
* for fully interleaved scans (whether the JPEG file is interleaved or not).
|
||||
* There are v_samp_factor * DCTSIZE sample rows of each component in an
|
||||
* "iMCU" (interleaved MCU) row.
|
||||
*/
|
||||
|
||||
@@ -406,12 +410,16 @@ struct jpeg_compress_struct {
|
||||
JDIMENSION MCUs_per_row; /* # of MCUs across the image */
|
||||
JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */
|
||||
|
||||
int data_units_in_MCU; /* # of data units per MCU */
|
||||
int MCU_membership[C_MAX_DATA_UNITS_IN_MCU];
|
||||
int blocks_in_MCU; /* # of DCT blocks per MCU */
|
||||
int MCU_membership[C_MAX_BLOCKS_IN_MCU];
|
||||
/* MCU_membership[i] is index in cur_comp_info of component owning */
|
||||
/* i'th block in an MCU */
|
||||
|
||||
int Ss, Se, Ah, Al; /* progressive/lossless JPEG parameters for scan */
|
||||
int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
|
||||
|
||||
int block_size; /* the basic DCT block size: 1..16 */
|
||||
const int * natural_order; /* natural-order position array */
|
||||
int lim_Se; /* min( Se, DCTSIZE2-1 ) */
|
||||
|
||||
/*
|
||||
* Links to compression subobjects (methods and private variables of modules)
|
||||
@@ -419,10 +427,12 @@ struct jpeg_compress_struct {
|
||||
struct jpeg_comp_master * master;
|
||||
struct jpeg_c_main_controller * main;
|
||||
struct jpeg_c_prep_controller * prep;
|
||||
struct jpeg_c_codec * codec;
|
||||
struct jpeg_c_coef_controller * coef;
|
||||
struct jpeg_marker_writer * marker;
|
||||
struct jpeg_color_converter * cconvert;
|
||||
struct jpeg_downsampler * downsample;
|
||||
struct jpeg_forward_dct * fdct;
|
||||
struct jpeg_entropy_encoder * entropy;
|
||||
jpeg_scan_info * script_space; /* workspace for jpeg_simple_progression */
|
||||
int script_space_size;
|
||||
};
|
||||
@@ -557,6 +567,8 @@ struct jpeg_decompress_struct {
|
||||
jpeg_component_info * comp_info;
|
||||
/* comp_info[i] describes component that appears i'th in SOF */
|
||||
|
||||
boolean is_baseline; /* TRUE if Baseline SOF0 encountered */
|
||||
boolean progressive_mode; /* TRUE if SOFn specifies progressive mode */
|
||||
boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
|
||||
|
||||
UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
|
||||
@@ -593,21 +605,19 @@ struct jpeg_decompress_struct {
|
||||
/*
|
||||
* These fields are computed during decompression startup
|
||||
*/
|
||||
int data_unit; /* size of data unit in samples */
|
||||
J_CODEC_PROCESS process; /* decoding process of JPEG image */
|
||||
|
||||
int max_h_samp_factor; /* largest h_samp_factor */
|
||||
int max_v_samp_factor; /* largest v_samp_factor */
|
||||
|
||||
int min_codec_data_unit; /* smallest codec_data_unit of any component */
|
||||
int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component */
|
||||
int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component */
|
||||
|
||||
JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */
|
||||
/* The codec's input and output progress is measured in units of "iMCU"
|
||||
* (interleaved MCU) rows. These are the same as MCU rows in fully
|
||||
* interleaved JPEG scans, but are used whether the scan is interleaved
|
||||
* or not. We define an iMCU row as v_samp_factor data_unit rows of each
|
||||
* component. Therefore, the codec output contains
|
||||
* v_samp_factor*codec_data_unit sample rows of a component per iMCU row.
|
||||
/* The coefficient controller's input and output progress is measured in
|
||||
* units of "iMCU" (interleaved MCU) rows. These are the same as MCU rows
|
||||
* in fully interleaved JPEG scans, but are used whether the scan is
|
||||
* interleaved or not. We define an iMCU row as v_samp_factor DCT block
|
||||
* rows of each component. Therefore, the IDCT output contains
|
||||
* v_samp_factor*DCT_v_scaled_size sample rows of a component per iMCU row.
|
||||
*/
|
||||
|
||||
JSAMPLE * sample_range_limit; /* table for fast range-limiting */
|
||||
@@ -624,12 +634,18 @@ struct jpeg_decompress_struct {
|
||||
JDIMENSION MCUs_per_row; /* # of MCUs across the image */
|
||||
JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */
|
||||
|
||||
int data_units_in_MCU; /* # of data _units per MCU */
|
||||
int MCU_membership[D_MAX_DATA_UNITS_IN_MCU];
|
||||
int blocks_in_MCU; /* # of DCT blocks per MCU */
|
||||
int MCU_membership[D_MAX_BLOCKS_IN_MCU];
|
||||
/* MCU_membership[i] is index in cur_comp_info of component owning */
|
||||
/* i'th data unit in an MCU */
|
||||
/* i'th block in an MCU */
|
||||
|
||||
int Ss, Se, Ah, Al; /* progressive/lossless JPEG parms for scan */
|
||||
int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
|
||||
|
||||
/* These fields are derived from Se of first SOS marker.
|
||||
*/
|
||||
int block_size; /* the basic DCT block size: 1..16 */
|
||||
const int * natural_order; /* natural-order position array for entropy decode */
|
||||
int lim_Se; /* min( Se, DCTSIZE2-1 ) for entropy decode */
|
||||
|
||||
/* This field is shared between entropy decoder and marker parser.
|
||||
* It is either zero or the code of a JPEG marker that has been
|
||||
@@ -642,10 +658,12 @@ struct jpeg_decompress_struct {
|
||||
*/
|
||||
struct jpeg_decomp_master * master;
|
||||
struct jpeg_d_main_controller * main;
|
||||
struct jpeg_d_codec * codec;
|
||||
struct jpeg_d_coef_controller * coef;
|
||||
struct jpeg_d_post_controller * post;
|
||||
struct jpeg_input_controller * inputctl;
|
||||
struct jpeg_marker_reader * marker;
|
||||
struct jpeg_entropy_decoder * entropy;
|
||||
struct jpeg_inverse_dct * idct;
|
||||
struct jpeg_upsampler * upsample;
|
||||
struct jpeg_color_deconverter * cconvert;
|
||||
struct jpeg_color_quantizer * cquantize;
|
||||
@@ -715,8 +733,10 @@ struct jpeg_error_mgr {
|
||||
const char * const * addon_message_table; /* Non-library errors */
|
||||
int first_addon_message; /* code for first string in addon table */
|
||||
int last_addon_message; /* code for last string in addon table */
|
||||
|
||||
|
||||
#ifdef __HAIKU__
|
||||
jmp_buf long_jump_buffer;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -776,13 +796,6 @@ struct jpeg_source_mgr {
|
||||
typedef struct jvirt_sarray_control * jvirt_sarray_ptr;
|
||||
typedef struct jvirt_barray_control * jvirt_barray_ptr;
|
||||
|
||||
#ifdef C_LOSSLESS_SUPPORTED
|
||||
#define NEED_DARRAY
|
||||
#else
|
||||
#ifdef D_LOSSLESS_SUPPORTED
|
||||
#define NEED_DARRAY
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct jpeg_memory_mgr {
|
||||
/* Method pointers */
|
||||
@@ -796,11 +809,6 @@ struct jpeg_memory_mgr {
|
||||
JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr cinfo, int pool_id,
|
||||
JDIMENSION blocksperrow,
|
||||
JDIMENSION numrows));
|
||||
#ifdef NEED_DARRAY
|
||||
JMETHOD(JDIFFARRAY, alloc_darray, (j_common_ptr cinfo, int pool_id,
|
||||
JDIMENSION diffsperrow,
|
||||
JDIMENSION numrows));
|
||||
#endif
|
||||
JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo,
|
||||
int pool_id,
|
||||
boolean pre_zero,
|
||||
@@ -872,14 +880,16 @@ typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo));
|
||||
#define jpeg_destroy_decompress jDestDecompress
|
||||
#define jpeg_stdio_dest jStdDest
|
||||
#define jpeg_stdio_src jStdSrc
|
||||
#define jpeg_mem_dest jMemDest
|
||||
#define jpeg_mem_src jMemSrc
|
||||
#define jpeg_set_defaults jSetDefaults
|
||||
#define jpeg_set_colorspace jSetColorspace
|
||||
#define jpeg_default_colorspace jDefColorspace
|
||||
#define jpeg_set_quality jSetQuality
|
||||
#define jpeg_set_linear_quality jSetLQuality
|
||||
#define jpeg_default_qtables jDefQTables
|
||||
#define jpeg_add_quant_table jAddQuantTable
|
||||
#define jpeg_quality_scaling jQualityScaling
|
||||
#define jpeg_simple_lossless jSimLossless
|
||||
#define jpeg_simple_progression jSimProgress
|
||||
#define jpeg_suppress_tables jSuppressTables
|
||||
#define jpeg_alloc_quant_table jAlcQTable
|
||||
@@ -887,6 +897,7 @@ typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo));
|
||||
#define jpeg_start_compress jStrtCompress
|
||||
#define jpeg_write_scanlines jWrtScanlines
|
||||
#define jpeg_finish_compress jFinCompress
|
||||
#define jpeg_calc_jpeg_dimensions jCjpegDimensions
|
||||
#define jpeg_write_raw_data jWrtRawData
|
||||
#define jpeg_write_marker jWrtMarker
|
||||
#define jpeg_write_m_header jWrtMHeader
|
||||
@@ -903,6 +914,7 @@ typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo));
|
||||
#define jpeg_input_complete jInComplete
|
||||
#define jpeg_new_colormap jNewCMap
|
||||
#define jpeg_consume_input jConsumeInput
|
||||
#define jpeg_core_output_dimensions jCoreDimensions
|
||||
#define jpeg_calc_output_dimensions jCalcDimensions
|
||||
#define jpeg_save_markers jSaveMarkers
|
||||
#define jpeg_set_marker_processor jSetMarker
|
||||
@@ -947,6 +959,14 @@ EXTERN(void) jpeg_destroy_decompress JPP((j_decompress_ptr cinfo));
|
||||
EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile));
|
||||
EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile));
|
||||
|
||||
/* Data source and destination managers: memory buffers. */
|
||||
EXTERN(void) jpeg_mem_dest JPP((j_compress_ptr cinfo,
|
||||
unsigned char ** outbuffer,
|
||||
unsigned long * outsize));
|
||||
EXTERN(void) jpeg_mem_src JPP((j_decompress_ptr cinfo,
|
||||
unsigned char * inbuffer,
|
||||
unsigned long insize));
|
||||
|
||||
/* Default parameter setup for compression */
|
||||
EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo));
|
||||
/* Compression parameter setup aids */
|
||||
@@ -958,13 +978,13 @@ EXTERN(void) jpeg_set_quality JPP((j_compress_ptr cinfo, int quality,
|
||||
EXTERN(void) jpeg_set_linear_quality JPP((j_compress_ptr cinfo,
|
||||
int scale_factor,
|
||||
boolean force_baseline));
|
||||
EXTERN(void) jpeg_default_qtables JPP((j_compress_ptr cinfo,
|
||||
boolean force_baseline));
|
||||
EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl,
|
||||
const unsigned int *basic_table,
|
||||
int scale_factor,
|
||||
boolean force_baseline));
|
||||
EXTERN(int) jpeg_quality_scaling JPP((int quality));
|
||||
EXTERN(void) jpeg_simple_lossless JPP((j_compress_ptr cinfo,
|
||||
int predictor, int point_transform));
|
||||
EXTERN(void) jpeg_simple_progression JPP((j_compress_ptr cinfo));
|
||||
EXTERN(void) jpeg_suppress_tables JPP((j_compress_ptr cinfo,
|
||||
boolean suppress));
|
||||
@@ -979,12 +999,15 @@ EXTERN(JDIMENSION) jpeg_write_scanlines JPP((j_compress_ptr cinfo,
|
||||
JDIMENSION num_lines));
|
||||
EXTERN(void) jpeg_finish_compress JPP((j_compress_ptr cinfo));
|
||||
|
||||
/* Precalculate JPEG dimensions for current compression parameters. */
|
||||
EXTERN(void) jpeg_calc_jpeg_dimensions JPP((j_compress_ptr cinfo));
|
||||
|
||||
/* Replaces jpeg_write_scanlines when writing raw downsampled data. */
|
||||
EXTERN(JDIMENSION) jpeg_write_raw_data JPP((j_compress_ptr cinfo,
|
||||
JSAMPIMAGE data,
|
||||
JDIMENSION num_lines));
|
||||
|
||||
/* Write a special marker. See libjpeg.doc concerning safe usage. */
|
||||
/* Write a special marker. See libjpeg.txt concerning safe usage. */
|
||||
EXTERN(void) jpeg_write_marker
|
||||
JPP((j_compress_ptr cinfo, int marker,
|
||||
const JOCTET * dataptr, unsigned int datalen));
|
||||
@@ -1038,6 +1061,7 @@ EXTERN(int) jpeg_consume_input JPP((j_decompress_ptr cinfo));
|
||||
#define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */
|
||||
|
||||
/* Precalculate output dimensions for current decompression parameters. */
|
||||
EXTERN(void) jpeg_core_output_dimensions JPP((j_decompress_ptr cinfo));
|
||||
EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo));
|
||||
|
||||
/* Control saving of COM and APPn markers into marker_list. */
|
||||
@@ -1119,9 +1143,6 @@ struct jpeg_color_quantizer { long dummy; };
|
||||
#endif /* JPEG_INTERNALS */
|
||||
#endif /* INCOMPLETE_TYPES_BROKEN */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The JPEG library modules define JPEG_INTERNALS before including this file.
|
||||
@@ -1135,4 +1156,10 @@ struct jpeg_color_quantizer { long dummy; };
|
||||
#include "jerror.h" /* fetch error codes too */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifndef DONT_USE_EXTERN_C
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* JPEGLIB_H */
|
||||
|
||||
Reference in New Issue
Block a user