00001
00002
00003
00004
00005
00006
00007 #include "jpgermgr.h"
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef JMESSAGE
00030 #ifndef JERROR_H
00031
00032 #define JMAKE_ENUM_LIST
00033 #else
00034
00035 #define JMESSAGE(code,string,errorclass)
00036 #endif
00037 #endif
00038
00039 #ifdef JMAKE_ENUM_LIST
00040
00041
00042 typedef enum {
00043
00044 #define JMESSAGE(code,string,errorclass) code ,
00045
00046 #endif
00047
00048 JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d", JPEGErrorManager::ERR_INTERNAL)
00049
00050
00051 JMESSAGE(JERR_ARITH_NOTIMPL, "Sorry, there are legal restrictions on arithmetic coding", JPEGErrorManager::ERR_UNSUPPORTED)
00052 JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix", JPEGErrorManager::ERR_STRUCTURE)
00053 JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix", JPEGErrorManager::ERR_STRUCTURE)
00054 JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode", JPEGErrorManager::ERR_INTERNAL)
00055 JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS", JPEGErrorManager::ERR_STRUCTURE)
00056 JMESSAGE(JERR_BAD_DCTSIZE, "IDCT output block size %d not supported", JPEGErrorManager::ERR_UNSUPPORTED)
00057 JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace", JPEGErrorManager::ERR_STRUCTURE)
00058 JMESSAGE(JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace", JPEGErrorManager::ERR_STRUCTURE)
00059 JMESSAGE(JERR_BAD_LENGTH, "Bogus marker length", JPEGErrorManager::ERR_STRUCTURE)
00060 JMESSAGE(JERR_BAD_LIB_VERSION, "Wrong JPEG library version: library is %d, caller expects %d", JPEGErrorManager::ERR_INTERNAL)
00061 JMESSAGE(JERR_BAD_MCU_SIZE, "Sampling factors too large for interleaved scan", JPEGErrorManager::ERR_LIMITS)
00062 JMESSAGE(JERR_BAD_POOL_ID, "Invalid memory pool code %d", JPEGErrorManager::ERR_INTERNAL)
00063 JMESSAGE(JERR_BAD_PRECISION, "Unsupported JPEG data precision %d", JPEGErrorManager::ERR_INTERNAL)
00064 JMESSAGE(JERR_BAD_PROGRESSION, "Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d", JPEGErrorManager::ERR_INTERNAL)
00065 JMESSAGE(JERR_BAD_PROG_SCRIPT, "Invalid progressive parameters at scan script entry %d", JPEGErrorManager::ERR_INTERNAL)
00066 JMESSAGE(JERR_BAD_SAMPLING, "Bogus sampling factors", JPEGErrorManager::ERR_STRUCTURE)
00067 JMESSAGE(JERR_BAD_SCAN_SCRIPT, "Invalid scan script at entry %d", JPEGErrorManager::ERR_INTERNAL)
00068 JMESSAGE(JERR_BAD_STATE, "Improper call to JPEG library in state %d", JPEGErrorManager::ERR_INTERNAL)
00069 JMESSAGE(JERR_BAD_STRUCT_SIZE, "JPEG parameter struct mismatch: library thinks size is %u, caller expects %u", JPEGErrorManager::ERR_INTERNAL)
00070 JMESSAGE(JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access", JPEGErrorManager::ERR_INTERNAL)
00071 JMESSAGE(JERR_BUFFER_SIZE, "Buffer passed to JPEG library is too small", JPEGErrorManager::ERR_INTERNAL)
00072 JMESSAGE(JERR_CANT_SUSPEND, "Suspension not allowed here", JPEGErrorManager::ERR_INTERNAL)
00073 JMESSAGE(JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet", JPEGErrorManager::ERR_UNSUPPORTED)
00074 JMESSAGE(JERR_COMPONENT_COUNT, "Too many color components: %d, max %d", JPEGErrorManager::ERR_LIMITS)
00075 JMESSAGE(JERR_CONVERSION_NOTIMPL, "Unsupported color conversion request", JPEGErrorManager::ERR_UNSUPPORTED)
00076 JMESSAGE(JERR_DAC_INDEX, "Bogus DAC index %d", JPEGErrorManager::ERR_STRUCTURE)
00077 JMESSAGE(JERR_DAC_VALUE, "Bogus DAC value 0x%x", JPEGErrorManager::ERR_STRUCTURE)
00078 JMESSAGE(JERR_DHT_COUNTS, "Bogus DHT counts", JPEGErrorManager::ERR_STRUCTURE)
00079 JMESSAGE(JERR_DHT_INDEX, "Bogus DHT index %d", JPEGErrorManager::ERR_STRUCTURE)
00080 JMESSAGE(JERR_DQT_INDEX, "Bogus DQT index %d", JPEGErrorManager::ERR_STRUCTURE)
00081 JMESSAGE(JERR_EMPTY_IMAGE, "Empty JPEG image (DNL not supported)", JPEGErrorManager::ERR_UNSUPPORTED)
00082
00083
00084 JMESSAGE(JERR_EOI_EXPECTED, "Didn't expect more than one scan", JPEGErrorManager::ERR_INTERNAL)
00085
00086
00087 JMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL, "Fractional sampling not implemented yet", JPEGErrorManager::ERR_UNSUPPORTED)
00088 JMESSAGE(JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow", JPEGErrorManager::ERR_LIMITS)
00089 JMESSAGE(JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry", JPEGErrorManager::ERR_STRUCTURE)
00090 JMESSAGE(JERR_IMAGE_TOO_BIG, "Maximum supported image dimension is %u pixels", JPEGErrorManager::ERR_LIMITS)
00091 JMESSAGE(JERR_INPUT_EMPTY, "Empty input file", JPEGErrorManager::ERR_FORMAT)
00092 JMESSAGE(JERR_INPUT_EOF, "Premature end of input file", JPEGErrorManager::ERR_STRUCTURE)
00093 JMESSAGE(JERR_MISMATCHED_QUANT_TABLE, "Cannot transcode due to multiple use of quantization table %d", JPEGErrorManager::ERR_INTERNAL)
00094 JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data", JPEGErrorManager::ERR_INTERNAL)
00095 JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change", JPEGErrorManager::ERR_INTERNAL)
00096 JMESSAGE(JERR_NOTIMPL, "Not implemented yet", JPEGErrorManager::ERR_UNSUPPORTED)
00097 JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time", JPEGErrorManager::ERR_INTERNAL)
00098 JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported", JPEGErrorManager::ERR_INTERNAL)
00099 JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined", JPEGErrorManager::ERR_STRUCTURE)
00100 JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image", JPEGErrorManager::ERR_STRUCTURE)
00101 JMESSAGE(JERR_NO_QUANT_TABLE, "Quantization table 0x%02x was not defined", JPEGErrorManager::ERR_STRUCTURE)
00102 JMESSAGE(JERR_NO_SOI, "Not a JPEG file: starts with 0x%02x 0x%02x", JPEGErrorManager::ERR_FORMAT)
00103 JMESSAGE(JERR_OUT_OF_MEMORY, "Insufficient memory (case %d)", JPEGErrorManager::ERR_LIMITS)
00104 JMESSAGE(JERR_QUANT_COMPONENTS, "Cannot quantize more than %d color components", JPEGErrorManager::ERR_LIMITS)
00105 JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors", JPEGErrorManager::ERR_LIMITS)
00106 JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors", JPEGErrorManager::ERR_LIMITS)
00107 JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers", JPEGErrorManager::ERR_STRUCTURE)
00108 JMESSAGE(JERR_SOF_NO_SOS, "Invalid JPEG file structure: missing SOS marker", JPEGErrorManager::ERR_STRUCTURE)
00109 JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x", JPEGErrorManager::ERR_UNSUPPORTED)
00110 JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers", JPEGErrorManager::ERR_STRUCTURE)
00111 JMESSAGE(JERR_SOS_NO_SOF, "Invalid JPEG file structure: SOS before SOF", JPEGErrorManager::ERR_STRUCTURE)
00112
00113
00114
00115
00116 JMESSAGE(JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines", JPEGErrorManager::ERR_INTERNAL)
00117 JMESSAGE(JERR_UNKNOWN_MARKER, "Unsupported marker type 0x%02x", JPEGErrorManager::ERR_UNSUPPORTED)
00118 JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up", JPEGErrorManager::ERR_INTERNAL)
00119 JMESSAGE(JERR_WIDTH_OVERFLOW, "Image too wide for this implementation", JPEGErrorManager::ERR_LIMITS)
00120
00121
00122
00123
00124 JMESSAGE(JTRC_16BIT_TABLES, "Caution: quantization tables are too coarse for baseline JPEG", JPEGErrorManager::ERR_TRACE)
00125 JMESSAGE(JTRC_ADOBE, "Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d", JPEGErrorManager::ERR_TRACE)
00126 JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u", JPEGErrorManager::ERR_TRACE)
00127 JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u", JPEGErrorManager::ERR_TRACE)
00128 JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x", JPEGErrorManager::ERR_TRACE)
00129 JMESSAGE(JTRC_DHT, "Define Huffman Table 0x%02x", JPEGErrorManager::ERR_TRACE)
00130 JMESSAGE(JTRC_DQT, "Define Quantization Table %d precision %d", JPEGErrorManager::ERR_TRACE)
00131 JMESSAGE(JTRC_DRI, "Define Restart Interval %u", JPEGErrorManager::ERR_TRACE)
00132
00133
00134 JMESSAGE(JTRC_EOI, "End Of Image", JPEGErrorManager::ERR_TRACE)
00135 JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d", JPEGErrorManager::ERR_TRACE)
00136 JMESSAGE(JTRC_JFIF, "JFIF APP0 marker, density %dx%d %d", JPEGErrorManager::ERR_TRACE)
00137 JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE, "Warning: thumbnail image size does not match data length %u", JPEGErrorManager::ERR_TRACE)
00138 JMESSAGE(JTRC_JFIF_MINOR, "Unknown JFIF minor revision number %d.%02d", JPEGErrorManager::ERR_TRACE)
00139 JMESSAGE(JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image", JPEGErrorManager::ERR_TRACE)
00140 JMESSAGE(JTRC_MISC_MARKER, "Skipping marker 0x%02x, length %u", JPEGErrorManager::ERR_TRACE)
00141 JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x", JPEGErrorManager::ERR_TRACE)
00142 JMESSAGE(JTRC_QUANTVALS, " %4u %4u %4u %4u %4u %4u %4u %4u", JPEGErrorManager::ERR_TRACE)
00143 JMESSAGE(JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors", JPEGErrorManager::ERR_TRACE)
00144 JMESSAGE(JTRC_QUANT_NCOLORS, "Quantizing to %d colors", JPEGErrorManager::ERR_TRACE)
00145 JMESSAGE(JTRC_QUANT_SELECTED, "Selected %d colors for quantization", JPEGErrorManager::ERR_TRACE)
00146 JMESSAGE(JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d", JPEGErrorManager::ERR_TRACE)
00147 JMESSAGE(JTRC_RST, "RST%d", JPEGErrorManager::ERR_TRACE)
00148 JMESSAGE(JTRC_SMOOTH_NOTIMPL, "Smoothing not supported with nonstandard sampling ratios", JPEGErrorManager::ERR_TRACE)
00149 JMESSAGE(JTRC_SOF, "Start Of Frame 0x%02x: width=%u, height=%u, components=%d", JPEGErrorManager::ERR_TRACE)
00150 JMESSAGE(JTRC_SOF_COMPONENT, " Component %d: %dhx%dv q=%d", JPEGErrorManager::ERR_TRACE)
00151 JMESSAGE(JTRC_SOI, "Start of Image", JPEGErrorManager::ERR_TRACE)
00152 JMESSAGE(JTRC_SOS, "Start Of Scan: %d components", JPEGErrorManager::ERR_TRACE)
00153 JMESSAGE(JTRC_SOS_COMPONENT, " Component %d: dc=%d ac=%d", JPEGErrorManager::ERR_TRACE)
00154 JMESSAGE(JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d", JPEGErrorManager::ERR_TRACE)
00155
00156
00157 JMESSAGE(JTRC_UNKNOWN_IDS, "Unrecognized component IDs %d %d %d, assuming YCbCr", JPEGErrorManager::ERR_TRACE)
00158
00159
00160 JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d", JPEGErrorManager::ERR_STRUCTURE)
00161 JMESSAGE(JWRN_BOGUS_PROGRESSION, "Inconsistent progression sequence for component %d coefficient %d", JPEGErrorManager::ERR_STRUCTURE)
00162 JMESSAGE(JWRN_EXTRANEOUS_DATA, "Corrupt JPEG data: %u extraneous bytes before marker 0x%02x", JPEGErrorManager::ERR_STRUCTURE)
00163 JMESSAGE(JWRN_HIT_MARKER, "Corrupt JPEG data: premature end of data segment", JPEGErrorManager::ERR_STRUCTURE)
00164 JMESSAGE(JWRN_HUFF_BAD_CODE, "Corrupt JPEG data: bad Huffman code", JPEGErrorManager::ERR_STRUCTURE)
00165 JMESSAGE(JWRN_JFIF_MAJOR, "Warning: unknown JFIF revision number %d.%02d", JPEGErrorManager::ERR_STRUCTURE)
00166 JMESSAGE(JWRN_JPEG_EOF, "Premature end of JPEG file", JPEGErrorManager::ERR_STRUCTURE)
00167 JMESSAGE(JWRN_MUST_RESYNC, "Corrupt JPEG data: found marker 0x%02x instead of RST%d", JPEGErrorManager::ERR_STRUCTURE)
00168 JMESSAGE(JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG", JPEGErrorManager::ERR_STRUCTURE)
00169 JMESSAGE(JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines", JPEGErrorManager::ERR_INTERNAL)
00170
00171 #ifdef JMAKE_ENUM_LIST
00172
00173 JMSG_LASTMSGCODE
00174 } J_MESSAGE_CODE;
00175
00176 #undef JMAKE_ENUM_LIST
00177 #endif
00178
00179
00180 #undef JMESSAGE
00181
00182
00183 #ifndef JERROR_H
00184 #define JERROR_H
00185
00186
00187
00188
00189
00190 #define ERREXIT(cinfo,code) \
00191 ((cinfo)->err->msg_code = (code), \
00192 (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
00193 #define ERREXIT1(cinfo,code,p1) \
00194 ((cinfo)->err->msg_code = (code), \
00195 (cinfo)->err->msg_parm.i[0] = (p1), \
00196 (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
00197 #define ERREXIT2(cinfo,code,p1,p2) \
00198 ((cinfo)->err->msg_code = (code), \
00199 (cinfo)->err->msg_parm.i[0] = (p1), \
00200 (cinfo)->err->msg_parm.i[1] = (p2), \
00201 (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
00202 #define ERREXIT3(cinfo,code,p1,p2,p3) \
00203 ((cinfo)->err->msg_code = (code), \
00204 (cinfo)->err->msg_parm.i[0] = (p1), \
00205 (cinfo)->err->msg_parm.i[1] = (p2), \
00206 (cinfo)->err->msg_parm.i[2] = (p3), \
00207 (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
00208 #define ERREXIT4(cinfo,code,p1,p2,p3,p4) \
00209 ((cinfo)->err->msg_code = (code), \
00210 (cinfo)->err->msg_parm.i[0] = (p1), \
00211 (cinfo)->err->msg_parm.i[1] = (p2), \
00212 (cinfo)->err->msg_parm.i[2] = (p3), \
00213 (cinfo)->err->msg_parm.i[3] = (p4), \
00214 (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
00215 #define ERREXITS(cinfo,code,str) \
00216 ((cinfo)->err->msg_code = (code), \
00217 strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
00218 (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
00219
00220 #define MAKESTMT(stuff) do { stuff } while (0)
00221
00222 #ifdef _DEBUG
00223
00224 #define WARNMS(cinfo,code) \
00225 ((cinfo)->err->msg_code = (code), \
00226 (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
00227 #define WARNMS1(cinfo,code,p1) \
00228 ((cinfo)->err->msg_code = (code), \
00229 (cinfo)->err->msg_parm.i[0] = (p1), \
00230 (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
00231 #define WARNMS2(cinfo,code,p1,p2) \
00232 ((cinfo)->err->msg_code = (code), \
00233 (cinfo)->err->msg_parm.i[0] = (p1), \
00234 (cinfo)->err->msg_parm.i[1] = (p2), \
00235 (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
00236
00237
00238 #define TRACEMS(cinfo,lvl,code) \
00239 ((cinfo)->err->msg_code = (code), \
00240 (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
00241 #define TRACEMS1(cinfo,lvl,code,p1) \
00242 ((cinfo)->err->msg_code = (code), \
00243 (cinfo)->err->msg_parm.i[0] = (p1), \
00244 (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
00245 #define TRACEMS2(cinfo,lvl,code,p1,p2) \
00246 ((cinfo)->err->msg_code = (code), \
00247 (cinfo)->err->msg_parm.i[0] = (p1), \
00248 (cinfo)->err->msg_parm.i[1] = (p2), \
00249 (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
00250 #define TRACEMS3(cinfo,lvl,code,p1,p2,p3) \
00251 MAKESTMT(INT32 * _mp = (cinfo)->err->msg_parm.i; \
00252 _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \
00253 (cinfo)->err->msg_code = (code); \
00254 (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
00255 #define TRACEMS4(cinfo,lvl,code,p1,p2,p3,p4) \
00256 MAKESTMT(INT32 * _mp = (cinfo)->err->msg_parm.i; \
00257 _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
00258 (cinfo)->err->msg_code = (code); \
00259 (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
00260 #define TRACEMS8(cinfo,lvl,code,p1,p2,p3,p4,p5,p6,p7,p8) \
00261 MAKESTMT(INT32 * _mp = (cinfo)->err->msg_parm.i; \
00262 _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
00263 _mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \
00264 (cinfo)->err->msg_code = (code); \
00265 (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
00266 #define TRACEMSS(cinfo,lvl,code,str) \
00267 ((cinfo)->err->msg_code = (code), \
00268 strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
00269 (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
00270 #else
00271 #define WARNMS(cinfo,code)
00272 #define WARNMS1(cinfo,code,p1)
00273 #define WARNMS2(cinfo,code,p1,p2)
00274 #define TRACEMS(cinfo,lvl,code)
00275 #define TRACEMS1(cinfo,lvl,code,p1)
00276 #define TRACEMS2(cinfo,lvl,code,p1,p2)
00277 #define TRACEMS3(cinfo,lvl,code,p1,p2,p3)
00278 #define TRACEMS4(cinfo,lvl,code,p1,p2,p3,p4)
00279 #define TRACEMS8(cinfo,lvl,code,p1,p2,p3,p4,p5,p6,p7,p8)
00280 #define TRACEMSS(cinfo,lvl,code,str)
00281 #endif // _DEBUG
00282 #endif