Implement 12-bit-specific error/warn/trace macros
The macros in jerror.h refer to j_common_ptr, so it is unfortunately necessary to introduce a 12-bit-specific version of that header file (j12error.h) with 12-bit specific ERREXIT*(), WARNMS*(), and TRACEMS*() macros. (The message table is still shared between 8-bit and 12-bit implementations.) Fixes #607
This commit is contained in:
@@ -1653,6 +1653,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/jconfig.h
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
if(WITH_12BIT)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/jpeg12lib.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/j12error.h
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
endif()
|
||||
|
||||
|
||||
2
cdjpeg.h
2
cdjpeg.h
@@ -17,7 +17,7 @@
|
||||
#define JPEG_INTERNAL_OPTIONS /* cjpeg.c,djpeg.c need to see xxx_SUPPORTED */
|
||||
#include "jinclude.h"
|
||||
#include "jpeglibint.h"
|
||||
#include "jerror.h" /* get library error codes too */
|
||||
#include "jerrorint.h" /* get library error codes too */
|
||||
#include "cderror.h" /* get application-specific error codes */
|
||||
|
||||
|
||||
|
||||
14
example.c
14
example.c
@@ -46,7 +46,9 @@
|
||||
*/
|
||||
|
||||
#include "jpeglib.h"
|
||||
#include "jerror.h"
|
||||
#include "jpeg12lib.h"
|
||||
#include "j12error.h"
|
||||
|
||||
/*
|
||||
* <setjmp.h> is used for the optional error recovery mechanism shown in
|
||||
@@ -135,10 +137,8 @@ write_JPEG_file(char *filename, int quality)
|
||||
* VERY IMPORTANT: use "b" option to fopen() if you are on a machine that
|
||||
* requires it in order to write binary files.
|
||||
*/
|
||||
if ((outfile = fopen(filename, "wb")) == NULL) {
|
||||
fprintf(stderr, "can't open %s\n", filename);
|
||||
exit(1);
|
||||
}
|
||||
if ((outfile = fopen(filename, "wb")) == NULL)
|
||||
ERREXIT(&cinfo, JERR_FILE_WRITE);
|
||||
jpeg_stdio_dest(&cinfo, outfile);
|
||||
|
||||
/* Step 3: set parameters for compression */
|
||||
@@ -275,10 +275,8 @@ write_JPEG12_file(char *filename, int quality)
|
||||
cinfo.err = jpeg12_std_error(&jerr);
|
||||
jpeg12_create_compress(&cinfo);
|
||||
|
||||
if ((outfile = fopen(filename, "wb")) == NULL) {
|
||||
fprintf(stderr, "can't open %s\n", filename);
|
||||
exit(1);
|
||||
}
|
||||
if ((outfile = fopen(filename, "wb")) == NULL)
|
||||
J12ERREXIT(&cinfo, JERR_FILE_WRITE);
|
||||
jpeg12_stdio_dest(&cinfo, outfile);
|
||||
|
||||
cinfo.image_width = WIDTH;
|
||||
|
||||
331
j12error.h
Normal file
331
j12error.h
Normal file
@@ -0,0 +1,331 @@
|
||||
/*
|
||||
* j12error.h
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1997, Thomas G. Lane.
|
||||
* Modified 1997-2009 by Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2014, 2017, 2021-2022, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
* This file defines the error and message codes for the JPEG library.
|
||||
* Edit this file to add new codes, or to translate the message strings to
|
||||
* some other language.
|
||||
* A set of error-reporting macros are defined too. Some applications using
|
||||
* the JPEG library may wish to include this file to get the error codes
|
||||
* and/or the macros.
|
||||
*/
|
||||
|
||||
/*
|
||||
* To define the enum list of message codes, include this file without
|
||||
* defining macro JMESSAGE. To create a message string table, include it
|
||||
* again with a suitable JMESSAGE definition (see jerror.c for an example).
|
||||
*/
|
||||
#ifndef JMESSAGE
|
||||
#if !defined(JERROR_H) && !defined(J12ERROR_H)
|
||||
/* First time through, define the enum list */
|
||||
#define JMAKE_ENUM_LIST
|
||||
#else
|
||||
/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */
|
||||
#define JMESSAGE(code, string)
|
||||
#endif /* JERROR_H */
|
||||
#endif /* JMESSAGE */
|
||||
|
||||
#ifdef JMAKE_ENUM_LIST
|
||||
|
||||
typedef enum {
|
||||
|
||||
#define JMESSAGE(code, string) code,
|
||||
|
||||
#endif /* JMAKE_ENUM_LIST */
|
||||
|
||||
JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */
|
||||
|
||||
/* For maintenance convenience, list is alphabetical by message code name */
|
||||
#if JPEG_LIB_VERSION < 70
|
||||
JMESSAGE(JERR_ARITH_NOTIMPL, "Sorry, arithmetic coding is not implemented")
|
||||
#endif
|
||||
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")
|
||||
#if JPEG_LIB_VERSION >= 70
|
||||
JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request")
|
||||
#endif
|
||||
JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range")
|
||||
JMESSAGE(JERR_BAD_DCTSIZE, "IDCT output block size %d not supported")
|
||||
#if JPEG_LIB_VERSION >= 70
|
||||
JMESSAGE(JERR_BAD_DROP_SAMPLING,
|
||||
"Component index %d: mismatching sampling ratio %d:%d, %d:%d, %c")
|
||||
#endif
|
||||
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_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")
|
||||
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_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")
|
||||
JMESSAGE(JERR_BAD_STRUCT_SIZE,
|
||||
"JPEG parameter struct mismatch: library thinks size is %u, caller expects %u")
|
||||
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_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")
|
||||
JMESSAGE(JERR_DAC_INDEX, "Bogus DAC index %d")
|
||||
JMESSAGE(JERR_DAC_VALUE, "Bogus DAC value 0x%x")
|
||||
JMESSAGE(JERR_DHT_INDEX, "Bogus DHT index %d")
|
||||
JMESSAGE(JERR_DQT_INDEX, "Bogus DQT index %d")
|
||||
JMESSAGE(JERR_EMPTY_IMAGE, "Empty JPEG image (DNL not supported)")
|
||||
JMESSAGE(JERR_EMS_READ, "Read from EMS failed")
|
||||
JMESSAGE(JERR_EMS_WRITE, "Write to EMS failed")
|
||||
JMESSAGE(JERR_EOI_EXPECTED, "Didn't expect more than one scan")
|
||||
JMESSAGE(JERR_FILE_READ, "Input file read error")
|
||||
JMESSAGE(JERR_FILE_WRITE, "Output file write error --- out of disk space?")
|
||||
JMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL, "Fractional sampling not implemented yet")
|
||||
JMESSAGE(JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow")
|
||||
JMESSAGE(JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry")
|
||||
JMESSAGE(JERR_IMAGE_TOO_BIG, "Maximum supported image dimension is %u pixels")
|
||||
JMESSAGE(JERR_INPUT_EMPTY, "Empty input file")
|
||||
JMESSAGE(JERR_INPUT_EOF, "Premature end of input file")
|
||||
JMESSAGE(JERR_MISMATCHED_QUANT_TABLE,
|
||||
"Cannot transcode due to multiple use of quantization table %d")
|
||||
JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data")
|
||||
JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change")
|
||||
JMESSAGE(JERR_NOTIMPL, "Requested features are incompatible")
|
||||
JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time")
|
||||
#if JPEG_LIB_VERSION >= 70
|
||||
JMESSAGE(JERR_NO_ARITH_TABLE, "Arithmetic table 0x%02x was not defined")
|
||||
#endif
|
||||
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_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)")
|
||||
JMESSAGE(JERR_QUANT_COMPONENTS,
|
||||
"Cannot quantize more than %d color components")
|
||||
JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors")
|
||||
JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors")
|
||||
JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers")
|
||||
JMESSAGE(JERR_SOF_NO_SOS, "Invalid JPEG file structure: missing SOS marker")
|
||||
JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x")
|
||||
JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers")
|
||||
JMESSAGE(JERR_SOS_NO_SOF, "Invalid JPEG file structure: SOS before SOF")
|
||||
JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s")
|
||||
JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file")
|
||||
JMESSAGE(JERR_TFILE_SEEK, "Seek failed on temporary file")
|
||||
JMESSAGE(JERR_TFILE_WRITE,
|
||||
"Write failed on temporary file --- out of disk space?")
|
||||
JMESSAGE(JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines")
|
||||
JMESSAGE(JERR_UNKNOWN_MARKER, "Unsupported marker type 0x%02x")
|
||||
JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up")
|
||||
JMESSAGE(JERR_WIDTH_OVERFLOW, "Image too wide for this implementation")
|
||||
JMESSAGE(JERR_XMS_READ, "Read from XMS failed")
|
||||
JMESSAGE(JERR_XMS_WRITE, "Write to XMS failed")
|
||||
JMESSAGE(JMSG_COPYRIGHT, JCOPYRIGHT_SHORT)
|
||||
JMESSAGE(JMSG_VERSION, JVERSION)
|
||||
JMESSAGE(JTRC_16BIT_TABLES,
|
||||
"Caution: quantization tables are too coarse for baseline JPEG")
|
||||
JMESSAGE(JTRC_ADOBE,
|
||||
"Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d")
|
||||
JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u")
|
||||
JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u")
|
||||
JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x")
|
||||
JMESSAGE(JTRC_DHT, "Define Huffman Table 0x%02x")
|
||||
JMESSAGE(JTRC_DQT, "Define Quantization Table %d precision %d")
|
||||
JMESSAGE(JTRC_DRI, "Define Restart Interval %u")
|
||||
JMESSAGE(JTRC_EMS_CLOSE, "Freed EMS handle %u")
|
||||
JMESSAGE(JTRC_EMS_OPEN, "Obtained EMS handle %u")
|
||||
JMESSAGE(JTRC_EOI, "End Of Image")
|
||||
JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d")
|
||||
JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d")
|
||||
JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE,
|
||||
"Warning: thumbnail image size does not match data length %u")
|
||||
JMESSAGE(JTRC_JFIF_EXTENSION, "JFIF extension marker: type 0x%02x, length %u")
|
||||
JMESSAGE(JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image")
|
||||
JMESSAGE(JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u")
|
||||
JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x")
|
||||
JMESSAGE(JTRC_QUANTVALS, " %4u %4u %4u %4u %4u %4u %4u %4u")
|
||||
JMESSAGE(JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors")
|
||||
JMESSAGE(JTRC_QUANT_NCOLORS, "Quantizing to %d colors")
|
||||
JMESSAGE(JTRC_QUANT_SELECTED, "Selected %d colors for quantization")
|
||||
JMESSAGE(JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d")
|
||||
JMESSAGE(JTRC_RST, "RST%d")
|
||||
JMESSAGE(JTRC_SMOOTH_NOTIMPL,
|
||||
"Smoothing not supported with nonstandard sampling ratios")
|
||||
JMESSAGE(JTRC_SOF, "Start Of Frame 0x%02x: width=%u, height=%u, components=%d")
|
||||
JMESSAGE(JTRC_SOF_COMPONENT, " Component %d: %dhx%dv q=%d")
|
||||
JMESSAGE(JTRC_SOI, "Start of Image")
|
||||
JMESSAGE(JTRC_SOS, "Start Of Scan: %d components")
|
||||
JMESSAGE(JTRC_SOS_COMPONENT, " Component %d: dc=%d ac=%d")
|
||||
JMESSAGE(JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d")
|
||||
JMESSAGE(JTRC_TFILE_CLOSE, "Closed temporary file %s")
|
||||
JMESSAGE(JTRC_TFILE_OPEN, "Opened temporary file %s")
|
||||
JMESSAGE(JTRC_THUMB_JPEG,
|
||||
"JFIF extension marker: JPEG-compressed thumbnail image, length %u")
|
||||
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_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")
|
||||
#if JPEG_LIB_VERSION >= 70
|
||||
JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code")
|
||||
#endif
|
||||
JMESSAGE(JWRN_BOGUS_PROGRESSION,
|
||||
"Inconsistent progression sequence for component %d coefficient %d")
|
||||
JMESSAGE(JWRN_EXTRANEOUS_DATA,
|
||||
"Corrupt JPEG data: %u extraneous bytes before marker 0x%02x")
|
||||
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_RESYNC,
|
||||
"Corrupt JPEG data: found marker 0x%02x instead of RST%d")
|
||||
JMESSAGE(JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG")
|
||||
JMESSAGE(JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines")
|
||||
#if JPEG_LIB_VERSION < 70
|
||||
JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request")
|
||||
#if defined(C_ARITH_CODING_SUPPORTED) || defined(D_ARITH_CODING_SUPPORTED)
|
||||
JMESSAGE(JERR_NO_ARITH_TABLE, "Arithmetic table 0x%02x was not defined")
|
||||
JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code")
|
||||
#endif
|
||||
#endif
|
||||
JMESSAGE(JWRN_BOGUS_ICC, "Corrupt JPEG data: bad ICC marker")
|
||||
#if JPEG_LIB_VERSION < 70
|
||||
JMESSAGE(JERR_BAD_DROP_SAMPLING,
|
||||
"Component index %d: mismatching sampling ratio %d:%d, %d:%d, %c")
|
||||
#endif
|
||||
|
||||
#ifdef JMAKE_ENUM_LIST
|
||||
|
||||
JMSG_LASTMSGCODE
|
||||
} J_MESSAGE_CODE;
|
||||
|
||||
#undef JMAKE_ENUM_LIST
|
||||
#endif /* JMAKE_ENUM_LIST */
|
||||
|
||||
/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */
|
||||
#undef JMESSAGE
|
||||
|
||||
|
||||
#ifndef J12ERROR_H
|
||||
#define J12ERROR_H
|
||||
|
||||
/* Macros to simplify using the error and trace message stuff */
|
||||
/* The first parameter is either type of cinfo pointer */
|
||||
|
||||
/* Fatal errors (print message and exit) */
|
||||
#define J12ERREXIT(cinfo, code) \
|
||||
((cinfo)->err->msg_code = (code), \
|
||||
(*(cinfo)->err->error_exit) ((j12_common_ptr)(cinfo)))
|
||||
#define J12ERREXIT1(cinfo, code, p1) \
|
||||
((cinfo)->err->msg_code = (code), \
|
||||
(cinfo)->err->msg_parm.i[0] = (p1), \
|
||||
(*(cinfo)->err->error_exit) ((j12_common_ptr)(cinfo)))
|
||||
#define J12ERREXIT2(cinfo, code, p1, p2) \
|
||||
((cinfo)->err->msg_code = (code), \
|
||||
(cinfo)->err->msg_parm.i[0] = (p1), \
|
||||
(cinfo)->err->msg_parm.i[1] = (p2), \
|
||||
(*(cinfo)->err->error_exit) ((j12_common_ptr)(cinfo)))
|
||||
#define J12ERREXIT3(cinfo, code, p1, p2, p3) \
|
||||
((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->error_exit) ((j12_common_ptr)(cinfo)))
|
||||
#define J12ERREXIT4(cinfo, code, p1, p2, p3, p4) \
|
||||
((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->error_exit) ((j12_common_ptr)(cinfo)))
|
||||
#define J12ERREXIT6(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) ((j12_common_ptr)(cinfo)))
|
||||
#define J12ERREXITS(cinfo, code, str) \
|
||||
((cinfo)->err->msg_code = (code), \
|
||||
strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
|
||||
(cinfo)->err->msg_parm.s[JMSG_STR_PARM_MAX - 1] = '\0', \
|
||||
(*(cinfo)->err->error_exit) ((j12_common_ptr)(cinfo)))
|
||||
|
||||
#define MAKESTMT(stuff) do { stuff } while (0)
|
||||
|
||||
/* Nonfatal errors (we can keep going, but the data is probably corrupt) */
|
||||
#define J12WARNMS(cinfo, code) \
|
||||
((cinfo)->err->msg_code = (code), \
|
||||
(*(cinfo)->err->emit_message) ((j12_common_ptr)(cinfo), -1))
|
||||
#define J12WARNMS1(cinfo, code, p1) \
|
||||
((cinfo)->err->msg_code = (code), \
|
||||
(cinfo)->err->msg_parm.i[0] = (p1), \
|
||||
(*(cinfo)->err->emit_message) ((j12_common_ptr)(cinfo), -1))
|
||||
#define J12WARNMS2(cinfo, code, p1, p2) \
|
||||
((cinfo)->err->msg_code = (code), \
|
||||
(cinfo)->err->msg_parm.i[0] = (p1), \
|
||||
(cinfo)->err->msg_parm.i[1] = (p2), \
|
||||
(*(cinfo)->err->emit_message) ((j12_common_ptr)(cinfo), -1))
|
||||
|
||||
/* Informational/debugging messages */
|
||||
#define J12TRACEMS(cinfo, lvl, code) \
|
||||
((cinfo)->err->msg_code = (code), \
|
||||
(*(cinfo)->err->emit_message) ((j12_common_ptr)(cinfo), (lvl)))
|
||||
#define J12TRACEMS1(cinfo, lvl, code, p1) \
|
||||
((cinfo)->err->msg_code = (code), \
|
||||
(cinfo)->err->msg_parm.i[0] = (p1), \
|
||||
(*(cinfo)->err->emit_message) ((j12_common_ptr)(cinfo), (lvl)))
|
||||
#define J12TRACEMS2(cinfo, lvl, code, p1, p2) \
|
||||
((cinfo)->err->msg_code = (code), \
|
||||
(cinfo)->err->msg_parm.i[0] = (p1), \
|
||||
(cinfo)->err->msg_parm.i[1] = (p2), \
|
||||
(*(cinfo)->err->emit_message) ((j12_common_ptr)(cinfo), (lvl)))
|
||||
#define J12TRACEMS3(cinfo, lvl, code, p1, p2, p3) \
|
||||
MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
|
||||
_mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \
|
||||
(cinfo)->err->msg_code = (code); \
|
||||
(*(cinfo)->err->emit_message) ((j12_common_ptr)(cinfo), (lvl)); )
|
||||
#define J12TRACEMS4(cinfo, lvl, code, p1, p2, p3, p4) \
|
||||
MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
|
||||
_mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
|
||||
(cinfo)->err->msg_code = (code); \
|
||||
(*(cinfo)->err->emit_message) ((j12_common_ptr)(cinfo), (lvl)); )
|
||||
#define J12TRACEMS5(cinfo, lvl, code, p1, p2, p3, p4, p5) \
|
||||
MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
|
||||
_mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
|
||||
_mp[4] = (p5); \
|
||||
(cinfo)->err->msg_code = (code); \
|
||||
(*(cinfo)->err->emit_message) ((j12_common_ptr)(cinfo), (lvl)); )
|
||||
#define J12TRACEMS8(cinfo, lvl, code, p1, p2, p3, p4, p5, p6, p7, p8) \
|
||||
MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
|
||||
_mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
|
||||
_mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \
|
||||
(cinfo)->err->msg_code = (code); \
|
||||
(*(cinfo)->err->emit_message) ((j12_common_ptr)(cinfo), (lvl)); )
|
||||
#define J12TRACEMSS(cinfo, lvl, code, str) \
|
||||
((cinfo)->err->msg_code = (code), \
|
||||
strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
|
||||
(cinfo)->err->msg_parm.s[JMSG_STR_PARM_MAX - 1] = '\0', \
|
||||
(*(cinfo)->err->emit_message) ((j12_common_ptr)(cinfo), (lvl)))
|
||||
|
||||
#endif /* JERROR_H */
|
||||
2
jcicc.c
2
jcicc.c
@@ -16,7 +16,7 @@
|
||||
#define JPEG_INTERNALS
|
||||
#include "jinclude.h"
|
||||
#include "jpeglibint.h"
|
||||
#include "jerror.h"
|
||||
#include "jerrorint.h"
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
/* this is not a core library module, so it doesn't define JPEG_INTERNALS */
|
||||
#include "jinclude.h"
|
||||
#include "jpeglibint.h"
|
||||
#include "jerror.h"
|
||||
#include "jerrorint.h"
|
||||
|
||||
|
||||
/* Expanded data destination object for stdio output */
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
/* this is not a core library module, so it doesn't define JPEG_INTERNALS */
|
||||
#include "jinclude.h"
|
||||
#include "jpeglibint.h"
|
||||
#include "jerror.h"
|
||||
#include "jerrorint.h"
|
||||
|
||||
|
||||
/* Expanded data source object for stdio input */
|
||||
|
||||
2
jdicc.c
2
jdicc.c
@@ -16,7 +16,7 @@
|
||||
#define JPEG_INTERNALS
|
||||
#include "jinclude.h"
|
||||
#include "jpeglibint.h"
|
||||
#include "jerror.h"
|
||||
#include "jerrorint.h"
|
||||
|
||||
|
||||
#define ICC_MARKER (JPEG_APP0 + 2) /* JPEG marker code for ICC */
|
||||
|
||||
4
jerror.c
4
jerror.c
@@ -26,7 +26,7 @@
|
||||
#include "jinclude.h"
|
||||
#include "jpeglibint.h"
|
||||
#include "jversion.h"
|
||||
#include "jerror.h"
|
||||
#include "jerrorint.h"
|
||||
|
||||
#ifdef USE_WINDOWS_MESSAGEBOX
|
||||
#include <windows.h>
|
||||
@@ -48,7 +48,7 @@
|
||||
#define JMESSAGE(code, string) string,
|
||||
|
||||
const char * const jpeg_std_message_table[] = {
|
||||
#include "jerror.h"
|
||||
#include "jerrorint.h"
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
2
jerror.h
2
jerror.h
@@ -23,7 +23,7 @@
|
||||
* again with a suitable JMESSAGE definition (see jerror.c for an example).
|
||||
*/
|
||||
#ifndef JMESSAGE
|
||||
#ifndef JERROR_H
|
||||
#if !defined(JERROR_H) && !defined(J12ERROR_H)
|
||||
/* First time through, define the enum list */
|
||||
#define JMAKE_ENUM_LIST
|
||||
#else
|
||||
|
||||
13
jerrorint.h
Normal file
13
jerrorint.h
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* jerrorint.h
|
||||
*
|
||||
* Copyright (C) 2022, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*/
|
||||
|
||||
#if BITS_IN_JSAMPLE == 12
|
||||
#include "j12error.h"
|
||||
#else
|
||||
#include "jerror.h"
|
||||
#endif
|
||||
@@ -12,7 +12,7 @@
|
||||
*
|
||||
* This file defines the application interface for the JPEG library.
|
||||
* Most applications using the library need only include this file,
|
||||
* and perhaps jerror.h if they want to know the exact error codes.
|
||||
* and perhaps j12error.h if they want to know the exact error codes.
|
||||
*/
|
||||
|
||||
#ifndef JPEG12LIB_H
|
||||
@@ -1136,12 +1136,12 @@ struct jpeg12_color_quantizer { long dummy; };
|
||||
* The JPEG library modules define JPEG_INTERNALS before including this file.
|
||||
* The internal structure declarations are read only when that is true.
|
||||
* Applications using the library should not include jpeg12int.h, but may wish
|
||||
* to include jerror.h.
|
||||
* to include j12error.h.
|
||||
*/
|
||||
|
||||
#ifdef JPEG_INTERNALS
|
||||
#include "jpeg12int.h" /* fetch private declarations */
|
||||
#include "jerror.h" /* fetch error codes too */
|
||||
#include "j12error.h" /* fetch error codes too */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
22
jpeglibint.h
22
jpeglibint.h
@@ -15,7 +15,8 @@
|
||||
#include "jpeg12lib.h"
|
||||
|
||||
|
||||
/* Rename all external types and functions that are affected by JSAMPLE. */
|
||||
/* Rename all external types, functions, and macros that are affected by
|
||||
JSAMPLE. */
|
||||
|
||||
#define JSAMPLE J12SAMPLE
|
||||
|
||||
@@ -28,6 +29,25 @@
|
||||
#define JSAMPARRAY J12SAMPARRAY
|
||||
#define JSAMPIMAGE J12SAMPIMAGE
|
||||
|
||||
#define ERREXIT J12ERREXIT
|
||||
#define ERREXIT1 J12ERREXIT1
|
||||
#define ERREXIT2 J12ERREXIT2
|
||||
#define ERREXIT3 J12ERREXIT3
|
||||
#define ERREXIT4 J12ERREXIT4
|
||||
#define ERREXIT6 J12ERREXIT6
|
||||
#define ERREXITS J12ERREXITS
|
||||
#define WARNMS J12WARNMS
|
||||
#define WARNMS1 J12WARNMS1
|
||||
#define WARNMS2 J12WARNMS2
|
||||
#define TRACEMS J12TRACEMS
|
||||
#define TRACEMS1 J12TRACEMS1
|
||||
#define TRACEMS2 J12TRACEMS2
|
||||
#define TRACEMS3 J12TRACEMS3
|
||||
#define TRACEMS4 J12TRACEMS4
|
||||
#define TRACEMS5 J12TRACEMS5
|
||||
#define TRACEMS8 J12TRACEMS8
|
||||
#define TRACEMSS J12TRACEMSS
|
||||
|
||||
#define jpeg_common_struct jpeg12_common_struct
|
||||
|
||||
#define j_common_ptr j12_common_ptr
|
||||
|
||||
@@ -115,8 +115,9 @@ used by the free LIBTIFF library to support JPEG compression in TIFF.)
|
||||
|
||||
Support for JPEG images with 12-bit, rather than 8-bit, samples is provided
|
||||
through a separate library, API, and header file (jpeg12lib.h instead of
|
||||
jpeglib.h). Functions supporting 12-bit samples have a prefix of "jpeg12_"
|
||||
instead of "jpeg_" and use the following data types, structures, and macros:
|
||||
jpeglib.h and j12error.h instead of jerror.h). Functions supporting 12-bit
|
||||
samples have a prefix of "jpeg12_" instead of "jpeg_" and use the following
|
||||
data types, structures, and macros:
|
||||
|
||||
* J12SAMPLE instead of JSAMPLE
|
||||
* J12SAMPROW instead of JSAMPROW
|
||||
@@ -124,6 +125,9 @@ instead of "jpeg_" and use the following data types, structures, and macros:
|
||||
* J12SAMPIMAGE instead of JSAMPIMAGE
|
||||
* MAXJ12SAMPLE instead of MAXJSAMPLE
|
||||
* CENTERJ12SAMPLE instead of CENTERJSAMPLE
|
||||
* J12ERREXIT*() instead of ERREXIT*()
|
||||
* J12WARNMS*() instead of WARNMS*()
|
||||
* J12TRACEMS*() instead of TRACEMS*()
|
||||
* jpeg12_common_struct instead of jpeg_common_struct
|
||||
* j12_common_ptr instead of j_common_ptr
|
||||
* jpeg12_compress_struct instead of jpeg_compress_struct
|
||||
|
||||
@@ -109,6 +109,7 @@ Section "@CMAKE_PROJECT_NAME@ SDK for @INST_PLATFORM@ (required)"
|
||||
File "@CMAKE_CURRENT_SOURCE_DIR@\jpeglib.h"
|
||||
!ifdef 12BIT
|
||||
File "@CMAKE_CURRENT_SOURCE_DIR@\jpeg12lib.h"
|
||||
File "@CMAKE_CURRENT_SOURCE_DIR@\j12error.h"
|
||||
!endif
|
||||
File "@CMAKE_CURRENT_SOURCE_DIR@\turbojpeg.h"
|
||||
SetOutPath $INSTDIR\doc
|
||||
|
||||
@@ -230,6 +230,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_includedir}/jpeglib.h
|
||||
%if "%{_with_12bit}" == "1"
|
||||
%{_includedir}/jpeg12lib.h
|
||||
%{_includedir}/j12error.h
|
||||
%endif
|
||||
%if "%{_with_turbojpeg}" == "1"
|
||||
%{_includedir}/turbojpeg.h
|
||||
|
||||
Reference in New Issue
Block a user