Add wasm tacle-bench targets

This commit is contained in:
2026-06-12 20:06:22 +02:00
parent 30daa8a00c
commit 08c2e9c13d
1122 changed files with 520422 additions and 0 deletions

View File

@ -0,0 +1,377 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: cderror.h
Author: Thomas G. Lane.
This file is part of the Independent JPEG Group's software.
For conditions of distribution and use, see the accompanying README file.
This file defines the error and message codes for the cjpeg/djpeg
applications. These strings are not needed as part of the JPEG library
proper.
Edit this file to add new codes, or to translate the message strings to
some other language.
Source: Independent JPEG Group's software
Changes: no major functional changes
License: See the accompanying README file
*/
#ifndef CJPEG_WRBMP_JMESSAGE
#ifndef CDERROR_H
#define CDERROR_H
/*First time through, define the enum list*/
#define CJPEG_WRBMP_JMAKE_ENUM_LIST
#else
/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined*/
#define CJPEG_WRBMP_JMESSAGE(code, string)
#endif
#endif
#ifdef CJPEG_WRBMP_JMAKE_ENUM_LIST
typedef enum {
#define CJPEG_WRBMP_JMESSAGE(code, string) code,
#endif
CJPEG_WRBMP_JMESSAGE(JMSG_FIRSTADDONCODE = 1000,
NULL) // Must be first entry!
#ifdef CJPEG_WRBMP_BMP_SUPPORTED
CJPEG_WRBMP_JMESSAGE(
JERR_BMP_BADCMAP,
"Unsupported BMP colormap format") CJPEG_WRBMP_JMESSAGE(JERR_BMP_BADDEPTH,
"Only 8- and "
"24-bit BMP "
"files are "
"supported")
CJPEG_WRBMP_JMESSAGE(
JERR_BMP_BADHEADER,
"Inv"
"ali"
"d "
"BMP"
" fi"
"le:"
" ba"
"d "
"hea"
"der"
" le"
"ngt"
"h") CJPEG_WRBMP_JMESSAGE(JERR_BMP_BADPLANES,
"Invalid BMP file: biPlanes not equal to "
"1") CJPEG_WRBMP_JMESSAGE(JERR_BMP_COLORSPACE,
"BMP output "
"must be "
"grayscale or "
"RGB")
CJPEG_WRBMP_JMESSAGE(JERR_BMP_COMPRESSED, "Sorry, compressed BMPs "
"not yet supported") CJPEG_WRBMP_JMESSAGE(
JERR_BMP_NOT, "N"
"o"
"t"
" "
"a"
" "
"B"
"M"
"P"
" "
"f"
"i"
"l"
"e"
" "
"-"
" "
"d"
"o"
"e"
"s"
" "
"n"
"o"
"t"
" "
"s"
"t"
"a"
"r"
"t"
" "
"w"
"i"
"t"
"h"
" "
"B"
"M") CJPEG_WRBMP_JMESSAGE(JTRC_BMP,
"%ux%u 24-bit BMP "
"image") CJPEG_WRBMP_JMESSAGE(JTRC_BMP_MAPPED,
"%ux%u 8-bit colormapped BMP "
"image")
CJPEG_WRBMP_JMESSAGE(
JTRC_BMP_OS2,
"%ux%u 24-bit OS2 BMP image") CJPEG_WRBMP_JMESSAGE(JTRC_BMP_OS2_MAPPED,
"%ux%u "
"8-bit "
"colorma"
"pped"
" OS2 "
"BMP "
"image")
#endif
#ifdef CJPEG_WRBMP_GIF_SUPPORTED
CJPEG_WRBMP_JMESSAGE(JERR_GIF_BUG, "GIF output got "
"confused") CJPEG_WRBMP_JMESSAGE(JERR_GIF_CODESIZE, "Bogus GIF codesize %d") CJPEG_WRBMP_JMESSAGE(
JERR_GIF_COLORSPACE,
"GIF output "
"must be "
"grayscale "
"or RGB") CJPEG_WRBMP_JMESSAGE(JERR_GIF_IMAGENOTFOUND,
"Too few images in GIF "
"file") CJPEG_WRBMP_JMESSAGE(JERR_GIF_NOT,
"Not a GIF file")
CJPEG_WRBMP_JMESSAGE(JTRC_GIF, "%ux%ux%d GIF image") CJPEG_WRBMP_JMESSAGE(
JTRC_GIF_BADVERSION,
"Warning: "
"unexpected "
"GIF "
"version "
"number "
"'%c%c%c'") CJPEG_WRBMP_JMESSAGE(JTRC_GIF_EXTENSION,
"Ignoring GIF "
"extension "
"block of "
"type 0x%02x") CJPEG_WRBMP_JMESSAGE(JTRC_GIF_NONSQUARE,
"Caution: nonsquare pixels in "
"input")
CJPEG_WRBMP_JMESSAGE(JWRN_GIF_BADDATA, "Corrupt "
"data in "
"GIF file") CJPEG_WRBMP_JMESSAGE(
JWRN_GIF_CHAR,
"Bogus char "
"0x%02x in GIF "
"file, "
"ignoring") CJPEG_WRBMP_JMESSAGE(JWRN_GIF_ENDCODE,
"Premature "
"end of GIF "
"image") CJPEG_WRBMP_JMESSAGE(JWRN_GIF_NOMOREDATA,
"Ran out of GIF bits")
#endif
#ifdef CJPEG_WRBMP_PPM_SUPPORTED
CJPEG_WRBMP_JMESSAGE(
JERR_PPM_COLORSPACE,
"PPM "
"outp"
"ut "
"must"
" be "
"gray"
"scal"
"e "
"or "
"RGB") CJPEG_WRBMP_JMESSAGE(JERR_PPM_NONNUMERIC,
"Nonnumeric "
"data in PPM "
"file")
CJPEG_WRBMP_JMESSAGE(
JERR_PPM_NOT,
"Not a "
"PPM/"
"PGM "
"file") CJPEG_WRBMP_JMESSAGE(JTRC_PGM,
"%ux%u "
"PGM "
"image")
CJPEG_WRBMP_JMESSAGE(JTRC_PGM_TEXT, "%u"
"x%"
"u "
"te"
"xt"
" P"
"GM"
" i"
"ma"
"g"
"e") CJPEG_WRBMP_JMESSAGE(
JTRC_PPM,
"%ux%u "
"PPM "
"image") CJPEG_WRBMP_JMESSAGE(JTRC_PPM_TEXT,
"%ux%"
"u "
"text"
" PPM"
" ima"
"ge")
#endif
#ifdef RLE_SUPPORTED
CJPEG_WRBMP_JMESSAGE(
JERR_RLE_BADERROR,
"Bogus error code from RLE "
"library") CJPEG_WRBMP_JMESSAGE(JERR_RLE_COLORSPACE, "RLE output must be grayscale or RGB")
CJPEG_WRBMP_JMESSAGE(
JERR_RLE_DIMENSIONS,
"Image dimensions (%ux%u) "
"too large for RLE")
CJPEG_WRBMP_JMESSAGE(
JERR_RLE_EMPTY,
"Empty RLE file")
CJPEG_WRBMP_JMESSAGE(JERR_RLE_EOF,
"P"
"r"
"e"
"m"
"a"
"t"
"u"
"r"
"e"
" "
"E"
"O"
"F"
" "
"i"
"n"
" "
"R"
"L"
"E"
" "
"h"
"e"
"a"
"d"
"e"
"r") CJPEG_WRBMP_JMESSAGE(JERR_RLE_MEM,
"Insufficient memory for RLE header") CJPEG_WRBMP_JMESSAGE(JERR_RLE_NOT, "Not an RLE file") CJPEG_WRBMP_JMESSAGE(JERR_RLE_TOOMANYCHANNELS, "Cannot handle %d output channels for RLE") CJPEG_WRBMP_JMESSAGE(JERR_RLE_UNSUPPORTED, "Cannot handle this RLE setup") CJPEG_WRBMP_JMESSAGE(JTRC_RLE,
"%ux%u full-color RLE file") CJPEG_WRBMP_JMESSAGE(JTRC_RLE_FULLMAP, "%ux%u full-color RLE file with map of length %d") CJPEG_WRBMP_JMESSAGE(JTRC_RLE_GRAY,
"%ux%u grayscale RLE file") CJPEG_WRBMP_JMESSAGE(JTRC_RLE_MAPGRAY, "%ux%u grayscale RLE "
"file with map of "
"length %d") CJPEG_WRBMP_JMESSAGE(JTRC_RLE_MAPPED,
"%ux%u colormapped RLE file with map of length %d")
#endif
#ifdef CJPEG_WRBMP_TARGA_SUPPORTED
CJPEG_WRBMP_JMESSAGE(
JERR_TGA_BADCMAP,
"Unsupported "
"Targa "
"colormap "
"format") CJPEG_WRBMP_JMESSAGE(JERR_TGA_BADPARMS, "Invalid or unsupported Targa file")
CJPEG_WRBMP_JMESSAGE(
JERR_TGA_COLORSPACE,
"Targa "
"output "
"must be "
"grayscale "
"or "
"RGB") CJPEG_WRBMP_JMESSAGE(JTRC_TGA, "%ux%u RGB Targa image")
CJPEG_WRBMP_JMESSAGE(
JTRC_TGA_GRAY, "%ux%u "
"grayscale "
"Targa "
"image")
CJPEG_WRBMP_JMESSAGE(
JTRC_TGA_MAPPED,
"%u"
"x%"
"u "
"co"
"lo"
"rm"
"ap"
"pe"
"d "
"Ta"
"rg"
"a "
"im"
"ag"
"e")
#else
CJPEG_WRBMP_JMESSAGE(JERR_TGA_NOTCOMP, "Targa support was not compiled")
#endif
CJPEG_WRBMP_JMESSAGE(
JERR_BAD_CMAP_FILE,
"Color "
"map "
"file "
"is "
"invali"
"d or "
"of "
"unsupp"
"orted "
"forma"
"t")
CJPEG_WRBMP_JMESSAGE(
JERR_TOO_MANY_COLORS,
"Ou"
"tp"
"ut"
" f"
"il"
"e "
"fo"
"rm"
"at"
" c"
"an"
"no"
"t "
"ha"
"nd"
"le"
" %"
"d "
"co"
"lo"
"rm"
"ap"
" e"
"nt"
"ri"
"e"
"s")
CJPEG_WRBMP_JMESSAGE(
JERR_UNGETC_FAILED,
"ungetc failed")
#ifdef CJPEG_WRBMP_TARGA_SUPPORTED
CJPEG_WRBMP_JMESSAGE(
JERR_UNKNOWN_FORMAT,
"Unrecognized input file format --- perhaps you need -targa")
#else
CJPEG_WRBMP_JMESSAGE(JERR_UNKNOWN_FORMAT, "Unrecognized input file format")
#endif
CJPEG_WRBMP_JMESSAGE(
JERR_UNSUPPORTED_FORMAT,
"Unsupported output file format")
#ifdef CJPEG_WRBMP_JMAKE_ENUM_LIST
JMSG_LASTADDONCODE
} CJPEG_WRBMP_ADDON_MESSAGE_CODE;
#undef CJPEG_WRBMP_JMAKE_ENUM_LIST
#endif
/* Zap JMESSAGE macro so that future re-inclusions do nothing by default*/
#undef CJPEG_WRBMP_JMESSAGE

View File

@ -0,0 +1,99 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: cdjpeg.h
Author: Thomas G. Lane.
This file is part of the Independent JPEG Group's software.
For conditions of distribution and use, see the accompanying README file.
This file contains common declarations for the sample applications
cjpeg and djpeg. It is NOT used by the core JPEG library.
Source: Independent JPEG Group's software
Changes: no major functional changes
License: See the accompanying README file
*/
#ifndef CDJPEG_H
#define CDJPEG_H
#define CJPEG_WRBMP_JPEG_CJPEG_DJPEG /* define proper options in jconfig.h */
#define CJPEG_WRBMP_JPEG_INTERNAL_OPTIONS /* cjpeg.c,djpeg.c need to see \
xxx_SUPPORTED */
#include "cderror.h" /* get application-specific error codes */
#include "jerror.h" /* get library error codes too */
#include "jpeglib.h"
typedef struct cjpeg_wrbmp_cjpeg_source_struct *cjpeg_wrbmp_cjpeg_source_ptr;
struct cjpeg_wrbmp_cjpeg_source_struct {
CJPEG_WRBMP_JMETHOD(void, start_input,
(cjpeg_wrbmp_j_compress_ptr cinfo,
cjpeg_wrbmp_cjpeg_source_ptr sinfo));
CJPEG_WRBMP_JMETHOD(CJPEG_WRBMP_JDIMENSION, get_pixel_rows,
(cjpeg_wrbmp_j_compress_ptr cinfo,
cjpeg_wrbmp_cjpeg_source_ptr sinfo));
CJPEG_WRBMP_JMETHOD(void, finish_input,
(cjpeg_wrbmp_j_compress_ptr cinfo,
cjpeg_wrbmp_cjpeg_source_ptr sinfo));
CJPEG_WRBMP_FILE *input_file;
CJPEG_WRBMP_JSAMPARRAY buffer;
CJPEG_WRBMP_JDIMENSION buffer_height;
};
typedef struct cjpeg_wrbmp_djpeg_dest_struct *cjpeg_wrbmp_djpeg_dest_ptr;
struct cjpeg_wrbmp_djpeg_dest_struct {
CJPEG_WRBMP_JMETHOD(void, start_output,
(cjpeg_wrbmp_j_decompress_ptr cinfo,
cjpeg_wrbmp_djpeg_dest_ptr dinfo));
/* Emit the specified number of pixel rows from the buffer. */
CJPEG_WRBMP_JMETHOD(void, put_pixel_rows,
(cjpeg_wrbmp_j_decompress_ptr cinfo,
cjpeg_wrbmp_djpeg_dest_ptr dinfo,
CJPEG_WRBMP_JDIMENSION rows_supplied));
/* Finish up at the end of the image. */
CJPEG_WRBMP_JMETHOD(void, finish_output,
(cjpeg_wrbmp_j_decompress_ptr cinfo,
cjpeg_wrbmp_djpeg_dest_ptr dinfo));
/* Target file spec; filled in by djpeg.c after object is created. */
CJPEG_WRBMP_FILE *output_file;
/* Output pixel-row buffer. Created by module init or start_output.
Width is cinfo->output_width * cinfo->output_components;
height is buffer_height.
*/
CJPEG_WRBMP_JSAMPARRAY buffer;
CJPEG_WRBMP_JDIMENSION buffer_height;
};
/*
cjpeg/djpeg may need to perform extra passes to convert to or from
the source/destination file format. The JPEG library does not know
about these passes, but we'd like them to be counted by the progress
monitor. We use an expanded progress monitor object to hold the
additional pass count.
*/
struct cjpeg_wrbmp_cdjpeg_progress_mgr {
struct cjpeg_wrbmp_jpeg_progress_mgr pub; /* fields known to JPEG library */
int completed_extra_passes; /* extra passes completed */
int total_extra_passes; /* total extra */
/* last printed percentage stored here to avoid multiple printouts */
int percent_done;
};
typedef struct cjpeg_wrbmp_cdjpeg_progress_mgr *cjpeg_wrbmp_cd_progress_ptr;
#endif

View File

@ -0,0 +1,216 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: cjpeg_jpeg6b_wrbmp.c
Author: Thomas G. Lane.
Function: This file contains routines to write output images in Microsoft
"BMP" format (MS Windows 3.x and OS/2 1.x flavors). Either 8-bit colormapped
or 24-bit full-color format can be written. No compression is supported.
These routines may need modification for non-Unix environments or
specialized applications. As they stand, they assume output to
an ordinary stdio stream.
Source: Independent JPEG Group's software
Changes: a brief summary of major functional changes (not formatting)
License: See the accompanying README file
*/
#include "cdjpeg.h"
// Wasm loop bounds
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
#ifdef CJPEG_WRBMP_BMP_SUPPORTED
/*
Declaration of global variables
*/
typedef struct {
struct cjpeg_wrbmp_djpeg_dest_struct pub; /* public fields */
cjpeg_wrbmp_boolean is_os2; /* saves the OS2 format request flag */
cjpeg_wrbmp_jvirt_sarray_ptr whole_image; /* needed to reverse row order */
CJPEG_WRBMP_JDIMENSION data_width; /* JSAMPLEs per row */
CJPEG_WRBMP_JDIMENSION
row_width; /* physical width of one row in the BMP file */
int pad_bytes; /* number of padding bytes needed per row */
CJPEG_WRBMP_JDIMENSION
cur_output_row; /* next row# to write to virtual array */
} cjpeg_wrbmp_bmp_dest_struct;
typedef cjpeg_wrbmp_bmp_dest_struct *cjpeg_wrbmp_bmp_dest_ptr;
extern unsigned char cjpeg_wrbmp_colormap[3][256];
unsigned char cjpeg_wrbmp_output_array[6144];
unsigned char *cjpeg_wrbmp_jpeg_stream /*= cjpeg_jpeg6b_wrbmp_output_array*/;
int cjpeg_wrbmp_checksum;
struct cjpeg_wrbmp_jpeg_decompress_struct cjpeg_wrbmp_jpeg_dec_1;
struct cjpeg_wrbmp_jpeg_decompress_struct cjpeg_wrbmp_jpeg_dec_2;
struct cjpeg_wrbmp_djpeg_dest_struct cjpeg_wrbmp_djpeg_dest;
cjpeg_wrbmp_bmp_dest_struct cjpeg_wrbmp_bmp_dest;
/*
Forward declaration of functions
*/
void cjpeg_wrbmp_initInput(void);
void cjpeg_wrbmp_finish_output_bmp(cjpeg_wrbmp_j_decompress_ptr cinfo);
void cjpeg_wrbmp_write_colormap(cjpeg_wrbmp_j_decompress_ptr cinfo,
int map_colors, int map_entry_size, int cMap);
int cjpeg_wrbmp_putc_modified(int character);
void cjpeg_wrbmp_init();
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
cjpeg_wrbmp_main();
int cjpeg_wrbmp_return();
__attribute__((noinline)) __attribute__((export_name("main"))) int main();
/*
Initialization functions
*/
void
cjpeg_wrbmp_init() {
cjpeg_wrbmp_initInput();
cjpeg_wrbmp_jpeg_dec_1.progress = 0;
cjpeg_wrbmp_jpeg_dec_1.output_height = 30;
cjpeg_wrbmp_jpeg_dec_1.actual_number_of_colors = 256;
cjpeg_wrbmp_jpeg_dec_1.out_color_components = 2;
cjpeg_wrbmp_jpeg_dec_2.progress = 0;
cjpeg_wrbmp_jpeg_dec_2.output_height = 30;
cjpeg_wrbmp_jpeg_dec_2.actual_number_of_colors = 256;
cjpeg_wrbmp_jpeg_dec_2.out_color_components = 3;
cjpeg_wrbmp_jpeg_stream = cjpeg_wrbmp_output_array;
cjpeg_wrbmp_checksum = 0;
}
/*
Calculation functions
*/
int
cjpeg_wrbmp_putc_modified(int character) {
*(cjpeg_wrbmp_jpeg_stream) = character;
++cjpeg_wrbmp_jpeg_stream;
cjpeg_wrbmp_checksum += character;
return character;
}
void
cjpeg_wrbmp_finish_output_bmp(cjpeg_wrbmp_j_decompress_ptr cinfo) {
CJPEG_WRBMP_JDIMENSION row;
cjpeg_wrbmp_cd_progress_ptr progress =
(cjpeg_wrbmp_cd_progress_ptr) cinfo->progress;
// Write the file body from our virtual array
__pragma_loopbound(30, 30);
for (row = cinfo->output_height; row > 0; --row) {
if (progress != 0) {
progress->pub.pass_counter = (long) (cinfo->output_height - row);
progress->pub.pass_limit = (long) cinfo->output_height;
}
}
if (progress != 0)
progress->completed_extra_passes++;
}
void
cjpeg_wrbmp_write_colormap(cjpeg_wrbmp_j_decompress_ptr cinfo, int map_colors,
int map_entry_size, int cMap) {
int num_colors = cinfo->actual_number_of_colors;
int i;
if (cMap != 0) {
if (cinfo->out_color_components == 3) {
// Normal case with RGB colormap
__pragma_loopbound(256, 256);
for (i = 0; i < num_colors; i++) {
cjpeg_wrbmp_putc_modified(
CJPEG_WRBMP_GETJSAMPLE(cjpeg_wrbmp_colormap[2][i]));
cjpeg_wrbmp_putc_modified(
CJPEG_WRBMP_GETJSAMPLE(cjpeg_wrbmp_colormap[1][i]));
cjpeg_wrbmp_putc_modified(
CJPEG_WRBMP_GETJSAMPLE(cjpeg_wrbmp_colormap[0][i]));
if (map_entry_size == 4)
cjpeg_wrbmp_putc_modified(0);
}
} else {
// Grayscale colormap (only happens with grayscale quantization)
__pragma_loopbound(256, 256);
for (i = 0; i < num_colors; i++) {
cjpeg_wrbmp_putc_modified(
CJPEG_WRBMP_GETJSAMPLE(cjpeg_wrbmp_colormap[2][i]));
cjpeg_wrbmp_putc_modified(
CJPEG_WRBMP_GETJSAMPLE(cjpeg_wrbmp_colormap[1][i]));
cjpeg_wrbmp_putc_modified(
CJPEG_WRBMP_GETJSAMPLE(cjpeg_wrbmp_colormap[0][i]));
if (map_entry_size == 4)
cjpeg_wrbmp_putc_modified(0);
}
}
} else {
// If no colormap, must be grayscale data. Generate a linear "map".
__pragma_loopbound(256, 256);
for (i = 0; i < 256; i++) {
cjpeg_wrbmp_putc_modified(i);
cjpeg_wrbmp_putc_modified(i);
cjpeg_wrbmp_putc_modified(i);
if (map_entry_size == 4)
cjpeg_wrbmp_putc_modified(0);
}
}
// Pad colormap with zeros to ensure specified number of colormap entries.
__pragma_loopbound(512, 512);
for (; i < map_colors; i++) {
cjpeg_wrbmp_putc_modified(0);
cjpeg_wrbmp_putc_modified(0);
cjpeg_wrbmp_putc_modified(0);
if (map_entry_size == 4)
cjpeg_wrbmp_putc_modified(0);
}
}
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
cjpeg_wrbmp_main() {
cjpeg_wrbmp_finish_output_bmp(&cjpeg_wrbmp_jpeg_dec_1);
cjpeg_wrbmp_write_colormap(&cjpeg_wrbmp_jpeg_dec_1, 768, 4, 1);
cjpeg_wrbmp_finish_output_bmp(&cjpeg_wrbmp_jpeg_dec_2);
cjpeg_wrbmp_write_colormap(&cjpeg_wrbmp_jpeg_dec_2, 768, 4, 1);
}
int
cjpeg_wrbmp_return() {
return (cjpeg_wrbmp_checksum + (-209330)) != 0;
}
__attribute__((noinline)) __attribute__((export_name("main"))) int
main(void) {
cjpeg_wrbmp_init();
cjpeg_wrbmp_main();
return (cjpeg_wrbmp_return());
}
#endif /* BMP_SUPPORTED */

View File

@ -0,0 +1,95 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: input.c
Author: Thomas G. Lane.
Function: Input variables for the cjpeg_jpeg6b_wrbmp.c
Source: Independent JPEG Group's software
Changes: no major functional changes
License: See the accompanying README file
*/
// Wasm loop bounds
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
unsigned char cjpeg_wrbmp_colormap[3][256];
void
cjpeg_wrbmp_initInput(void) {
int i, j;
volatile unsigned char tmp[3][256] = {
{44, 105, 153, 71, 151, 160, 188, 90, 209, 131, 221, 114, 93, 124,
208, 207, 218, 54, 145, 113, 153, 239, 226, 83, 243, 151, 98, 67,
114, 153, 83, 186, 116, 72, 188, 190, 109, 162, 218, 133, 208, 209,
115, 251, 135, 89, 143, 226, 230, 246, 152, 243, 152, 115, 180, 78,
246, 164, 250, 117, 76, 150, 152, 188, 251, 195, 127, 111, 225, 208,
94, 93, 143, 131, 201, 211, 99, 93, 190, 157, 121, 240, 117, 185,
167, 137, 152, 188, 250, 59, 248, 245, 115, 240, 192, 209, 143, 136,
98, 224, 167, 135, 132, 189, 72, 249, 205, 44, 106, 96, 147, 247,
249, 228, 224, 249, 190, 112, 135, 168, 95, 205, 171, 58, 112, 79,
206, 75, 242, 188, 189, 225, 185, 81, 221, 153, 244, 198, 171, 163,
159, 209, 240, 138, 148, 207, 166, 192, 188, 151, 98, 190, 209, 154,
225, 72, 96, 249, 191, 223, 207, 163, 207, 133, 251, 183, 135, 137,
159, 247, 167, 83, 123, 199, 203, 144, 142, 237, 77, 128, 117, 169,
202, 136, 128, 188, 168, 55, 222, 169, 116, 60, 75, 175, 102, 217,
168, 185, 189, 225, 125, 192, 112, 111, 168, 239, 225, 168, 97, 129,
190, 175, 169, 225, 170, 226, 225, 226, 224, 134, 106, 250, 222, 148,
241, 168, 166, 160, 95, 190, 102, 180, 193, 111, 151, 165, 171, 200,
52, 134, 169, 223, 166, 225, 169, 111, 185, 109, 56, 244, 157, 250,
226, 231, 119, 188},
{42, 143, 46, 91, 84, 201, 140, 91, 82, 140, 31, 88, 44, 171,
57, 115, 206, 59, 145, 117, 116, 53, 232, 117, 80, 60, 66, 64,
117, 174, 89, 178, 147, 63, 83, 59, 103, 139, 211, 64, 68, 98,
118, 53, 119, 90, 161, 232, 171, 98, 176, 236, 118, 157, 180, 77,
114, 88, 28, 119, 40, 97, 69, 189, 252, 225, 119, 96, 219, 84,
82, 105, 158, 49, 200, 61, 117, 78, 63, 147, 140, 69, 108, 90,
161, 105, 190, 114, 84, 76, 70, 43, 156, 222, 96, 72, 143, 90,
105, 56, 144, 78, 129, 35, 66, 101, 100, 49, 105, 130, 160, 239,
129, 141, 83, 43, 68, 106, 132, 83, 92, 130, 175, 63, 131, 79,
192, 105, 57, 160, 118, 162, 141, 78, 192, 128, 206, 201, 203, 162,
159, 163, 221, 183, 157, 177, 189, 192, 129, 130, 54, 104, 45, 101,
252, 52, 91, 177, 49, 221, 116, 111, 143, 92, 142, 159, 131, 173,
61, 159, 173, 81, 129, 214, 213, 145, 143, 232, 67, 145, 130, 99,
237, 110, 160, 131, 67, 50, 129, 131, 127, 76, 92, 203, 96, 206,
176, 180, 85, 99, 162, 118, 64, 78, 190, 191, 45, 101, 129, 58,
72, 211, 49, 115, 115, 85, 61, 100, 116, 107, 143, 117, 219, 154,
225, 174, 160, 163, 119, 190, 106, 186, 49, 45, 177, 147, 85, 138,
42, 174, 59, 68, 120, 71, 129, 56, 149, 97, 68, 88, 148, 60,
239, 179, 149, 104},
{44, 76, 37, 56, 76, 152, 122, 153, 77, 191, 41, 76, 39, 97,
46, 109, 172, 43, 116, 91, 102, 49, 201, 68, 88, 45, 53, 95,
160, 175, 102, 164, 116, 50, 76, 45, 86, 189, 216, 50, 61, 93,
196, 91, 100, 58, 116, 223, 166, 102, 126, 221, 158, 86, 235, 55,
113, 120, 52, 115, 42, 86, 55, 165, 247, 194, 160, 108, 170, 108,
98, 77, 168, 42, 179, 70, 96, 62, 71, 216, 100, 71, 155, 121,
146, 86, 134, 105, 114, 49, 100, 50, 119, 218, 95, 81, 220, 78,
102, 50, 125, 68, 170, 36, 62, 119, 129, 44, 151, 72, 143, 241,
131, 137, 79, 73, 55, 122, 204, 73, 74, 131, 221, 53, 89, 72,
178, 60, 64, 145, 157, 156, 177, 101, 180, 112, 194, 206, 178, 168,
221, 153, 201, 119, 222, 165, 188, 212, 117, 180, 45, 134, 42, 130,
229, 47, 107, 172, 40, 221, 146, 132, 138, 110, 144, 188, 112, 132,
64, 162, 145, 140, 200, 181, 215, 139, 197, 183, 106, 126, 116, 89,
204, 152, 123, 161, 52, 46, 131, 167, 173, 62, 70, 151, 151, 197,
177, 184, 96, 97, 101, 130, 54, 63, 141, 185, 45, 126, 96, 46,
71, 172, 38, 114, 100, 106, 69, 118, 138, 127, 99, 127, 198, 204,
242, 248, 197, 241, 74, 189, 178, 252, 65, 45, 148, 145, 97, 168,
45, 111, 43, 64, 164, 80, 113, 47, 136, 83, 42, 91, 197, 95,
222, 167, 92, 98}};
__pragma_loopbound(3, 3);
for (i = 0; i < 3; i++) {
__pragma_loopbound(256, 256);
for (j = 0; j < 256; j++)
cjpeg_wrbmp_colormap[i][j] = tmp[i][j];
}
}

View File

@ -0,0 +1,65 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: cderror.h
Author: Thomas G. Lane.
This file is part of the Independent JPEG Group's software.
For conditions of distribution and use, see the accompanying README file.
Source: Independent JPEG Group's software
Changes: no major functional changes
License: See the accompanying README files
*/
#ifndef JCONFIG_H
#define JCONFIG_H
#define CJPEG_WRBMP_HAVE_PROTOTYPES
#define CJPEG_WRBMP_HAVE_UNSIGNED_CHAR
#define CJPEG_WRBMP_HAVE_UNSIGNED_SHORT
#undef void
#undef const
#undef CHAR_IS_UNSIGNED
#define CJPEG_WRBMP_HAVE_STDDEF_H
#define CJPEG_WRBMP_HAVE_STDLIB_H
#undef NEED_BSD_STRINGS
#undef NEED_SYS_TYPES_H
#undef CJPEG_JPEG6B_WRBMP_NEED_FAR_POINTERS
#undef NEED_SHORT_EXTERNAL_NAMES
/* Define this if you get warnings about undefined structures. */
#undef INCOMPLETE_TYPES_BROKEN
#ifdef CJPEG_JPEG6B_WRBMP_JPEG_INTERNALS
#undef RIGHT_SHIFT_IS_UNSIGNED
#define INLINE __inline__
/* These are for configuring the JPEG memory manager. */
#undef DEFAULT_MAX_MEM
#undef NO_MKTEMP
#endif /* JPEG_INTERNALS */
#ifdef CJPEG_WRBMP_JPEG_CJPEG_DJPEG
#define CJPEG_WRBMP_BMP_SUPPORTED /* BMP image file format */
#define CJPEG_WRBMP_GIF_SUPPORTED /* GIF image file format */
#define CJPEG_WRBMP_PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
#undef RLE_SUPPORTED /* Utah RLE image file format */
#define CJPEG_WRBMP_TARGA_SUPPORTED /* Targa image file format */
#undef TWO_FILE_COMMANDLINE
#undef NEED_SIGNAL_CATCHER
#undef DONT_USE_B_MODE
/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
#undef PROGRESS_REPORT
#endif /* JPEG_CJPEG_DJPEG */
#endif

View File

@ -0,0 +1,333 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: jerror.h
Author: Thomas G. Lane.
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
sand/or the macros.
Source: Independent JPEG Group's software
Changes: no major functional changes
License: See the accompanying README file
*/
/*
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 CJPEG_WRBMP_JMESSAGE
#ifndef JERROR_H
/* First time through, define the enum list */
#define CJPEG_WRBMP_JMAKE_ENUM_LIST
#else
/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */
#define CJPEG_WRBMP_JMESSAGE(code, string)
#endif /* JERROR_H */
#endif /* JMESSAGE */
#ifdef CJPEG_WRBMP_JMAKE_ENUM_LIST
typedef enum {
#define CJPEG_WRBMP_JMESSAGE(code, string) code,
#endif /* JMAKE_ENUM_LIST */
CJPEG_WRBMP_JMESSAGE(JMSG_NOMESSAGE,
"Bogus message code %d") /* Must be first entry! */
/* For maintenance convenience, list is alphabetical by message code name */
CJPEG_WRBMP_JMESSAGE(
JERR_ARITH_NOTIMPL,
"Sorry, there are legal "
"restrictions on arithmetic "
"coding") CJPEG_WRBMP_JMESSAGE(JERR_BAD_ALIGN_TYPE,
"ALIGN_TYPE is wrong, please fix")
CJPEG_WRBMP_JMESSAGE(
JERR_BAD_ALLOC_CHUNK,
"MAX_ALLOC_"
"CHUNK is "
"wrong, please "
"fix") CJPEG_WRBMP_JMESSAGE(JERR_BAD_BUFFER_MODE,
"Bogus buffer control mode")
CJPEG_WRBMP_JMESSAGE(
JERR_BAD_COMPONENT_ID,
"Invalid "
"component ID %d "
"in SOS") CJPEG_WRBMP_JMESSAGE(JERR_BAD_DCT_COEF,
"DCT coefficient out of "
"range")
CJPEG_WRBMP_JMESSAGE(JERR_BAD_DCTSIZE,
"IDCT output block size %d not supported")
CJPEG_WRBMP_JMESSAGE(JERR_BAD_HUFF_TABLE,
"Bogus Huffman table "
"definition")
CJPEG_WRBMP_JMESSAGE(JERR_BAD_IN_COLORSPACE,
"Bogus input colorspace")
CJPEG_WRBMP_JMESSAGE(JERR_BAD_J_COLORSPACE,
"Bogus JPEG colorspace")
CJPEG_WRBMP_JMESSAGE(JERR_BAD_LENGTH, "Bogus "
"marker "
"length")
CJPEG_WRBMP_JMESSAGE(
JERR_BAD_LIB_VERSION,
"Wrong JPEG library version: "
"library is %d, caller expects %d")
CJPEG_WRBMP_JMESSAGE(JERR_BAD_MCU_SIZE, "Sampling factors too large "
"for interleaved scan") CJPEG_WRBMP_JMESSAGE(JERR_BAD_POOL_ID, "Invalid memory pool code "
"%d") CJPEG_WRBMP_JMESSAGE(JERR_BAD_PRECISION,
"Unsupported JPEG data precision %d") CJPEG_WRBMP_JMESSAGE(JERR_BAD_PROGRESSION, "Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d") CJPEG_WRBMP_JMESSAGE(JERR_BAD_PROG_SCRIPT, "Invalid progressive parameters at scan script entry %d") CJPEG_WRBMP_JMESSAGE(JERR_BAD_SAMPLING,
"Bogus sampling factors") CJPEG_WRBMP_JMESSAGE(JERR_BAD_SCAN_SCRIPT,
"Invalid scan script at entry %d") CJPEG_WRBMP_JMESSAGE(JERR_BAD_STATE,
"Improper call to JPEG library in state %d") CJPEG_WRBMP_JMESSAGE(JERR_BAD_STRUCT_SIZE,
"JPEG parameter struct mismatch: library thinks size is %u, caller expects %u") CJPEG_WRBMP_JMESSAGE(JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access") CJPEG_WRBMP_JMESSAGE(JERR_BUFFER_SIZE,
"Buffer passed to JPEG library is too small") CJPEG_WRBMP_JMESSAGE(JERR_CANT_SUSPEND,
"Suspension not allowed here") CJPEG_WRBMP_JMESSAGE(JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet") CJPEG_WRBMP_JMESSAGE(JERR_COMPONENT_COUNT, "Too many color components: %d, max %d") CJPEG_WRBMP_JMESSAGE(JERR_CONVERSION_NOTIMPL,
"Unsupported color conversion request") CJPEG_WRBMP_JMESSAGE(JERR_DAC_INDEX, "Bogus DAC index %d") CJPEG_WRBMP_JMESSAGE(JERR_DAC_VALUE, "Bogus DAC value 0x%x") CJPEG_WRBMP_JMESSAGE(JERR_DHT_INDEX, "Bogus DHT index %d") CJPEG_WRBMP_JMESSAGE(JERR_DQT_INDEX,
"Bogus DQT index %d") CJPEG_WRBMP_JMESSAGE(JERR_EMPTY_IMAGE,
"Empty JPEG image (DNL not supported)") CJPEG_WRBMP_JMESSAGE(JERR_EMS_READ, "Read from EMS failed") CJPEG_WRBMP_JMESSAGE(JERR_EMS_WRITE, "Write to EMS failed") CJPEG_WRBMP_JMESSAGE(JERR_EOI_EXPECTED,
"Didn't expect more than one scan") CJPEG_WRBMP_JMESSAGE(JERR_FILE_READ, "Input file read error") CJPEG_WRBMP_JMESSAGE(JERR_FILE_WRITE,
"Output file write error --- out of disk space?") CJPEG_WRBMP_JMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL,
"Fractional sampling not implemented yet") CJPEG_WRBMP_JMESSAGE(JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow") CJPEG_WRBMP_JMESSAGE(JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry") CJPEG_WRBMP_JMESSAGE(JERR_IMAGE_TOO_BIG,
"Maximum supported image dimension is %u pixels") CJPEG_WRBMP_JMESSAGE(JERR_INPUT_EMPTY,
"Empty input file") CJPEG_WRBMP_JMESSAGE(JERR_INPUT_EOF, "Premature end of input file") CJPEG_WRBMP_JMESSAGE(JERR_MISMATCHED_QUANT_TABLE, "Cannot transcode due to multiple use of quantization table %d") CJPEG_WRBMP_JMESSAGE(JERR_MISSING_DATA,
"Scan script does not transmit all data") CJPEG_WRBMP_JMESSAGE(JERR_MODE_CHANGE,
"Invalid color quantization mode change") CJPEG_WRBMP_JMESSAGE(JERR_NOTIMPL, "Not implemented yet") CJPEG_WRBMP_JMESSAGE(JERR_NOT_COMPILED,
"Requested feature was omitted at compile time") CJPEG_WRBMP_JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported") CJPEG_WRBMP_JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined") CJPEG_WRBMP_JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image") CJPEG_WRBMP_JMESSAGE(JERR_NO_QUANT_TABLE,
"Quantization table 0x%02x was not defined") CJPEG_WRBMP_JMESSAGE(JERR_NO_SOI,
"Not a JPEG file: starts with 0x%02x 0x%02x") CJPEG_WRBMP_JMESSAGE(JERR_OUT_OF_MEMORY,
"Insufficient memory (case %d)") CJPEG_WRBMP_JMESSAGE(JERR_QUANT_COMPONENTS,
"Cannot quantize more than %d color components") CJPEG_WRBMP_JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors") CJPEG_WRBMP_JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors")
CJPEG_WRBMP_JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers") CJPEG_WRBMP_JMESSAGE(
JERR_SOF_NO_SOS, "Invalid JPEG "
"file "
"structure: "
"missing SOS "
"marker") CJPEG_WRBMP_JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x")
CJPEG_WRBMP_JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers") CJPEG_WRBMP_JMESSAGE(
JERR_SOS_NO_SOF, "Invalid "
"JPEG "
"file "
"structure"
": SOS "
"before "
"SOF") CJPEG_WRBMP_JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s")
CJPEG_WRBMP_JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file") CJPEG_WRBMP_JMESSAGE(JERR_TFILE_SEEK,
"Seek failed on temporary file") CJPEG_WRBMP_JMESSAGE(JERR_TFILE_WRITE, "Write failed on temporary file --- out of disk space?") CJPEG_WRBMP_JMESSAGE(JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines") CJPEG_WRBMP_JMESSAGE(JERR_UNKNOWN_MARKER,
"Unsupported marker type 0x%02x") CJPEG_WRBMP_JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up") CJPEG_WRBMP_JMESSAGE(JERR_WIDTH_OVERFLOW,
"Image too wide for this implementation") CJPEG_WRBMP_JMESSAGE(JERR_XMS_READ,
"Read from XMS failed") CJPEG_WRBMP_JMESSAGE(JERR_XMS_WRITE,
"Write to XMS failed") CJPEG_WRBMP_JMESSAGE(JMSG_COPYRIGHT,
JCOPYRIGHT) CJPEG_WRBMP_JMESSAGE(JMSG_VERSION, JVERSION) CJPEG_WRBMP_JMESSAGE(JTRC_16BIT_TABLES, "Caution: quantization tables are too coarse for baseline JPEG") CJPEG_WRBMP_JMESSAGE(JTRC_ADOBE,
"Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d") CJPEG_WRBMP_JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u") CJPEG_WRBMP_JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u") CJPEG_WRBMP_JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x") CJPEG_WRBMP_JMESSAGE(JTRC_DHT, "Define Huffman Table 0x%02x") CJPEG_WRBMP_JMESSAGE(JTRC_DQT,
"Define Quantization Table %d precision %d") CJPEG_WRBMP_JMESSAGE(JTRC_DRI,
"Define Restart Interval %u") CJPEG_WRBMP_JMESSAGE(JTRC_EMS_CLOSE, "Freed EMS handle %u") CJPEG_WRBMP_JMESSAGE(JTRC_EMS_OPEN, "Obtained EMS handle %u") CJPEG_WRBMP_JMESSAGE(JTRC_EOI,
"End Of Image") CJPEG_WRBMP_JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d") CJPEG_WRBMP_JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d") CJPEG_WRBMP_JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE, "Warning: thumbnail image size does not match data length %u") CJPEG_WRBMP_JMESSAGE(JTRC_JFIF_EXTENSION,
"JFIF extension marker: type 0x%02x, length %u") CJPEG_WRBMP_JMESSAGE(JTRC_JFIF_THUMBNAIL,
" with %d x %d thumbnail image") CJPEG_WRBMP_JMESSAGE(JTRC_MISC_MARKER,
"Miscellaneous marker 0x%02x, length %u") CJPEG_WRBMP_JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x") CJPEG_WRBMP_JMESSAGE(JTRC_QUANTVALS,
" %4u %4u %4u %4u %4u %4u %4u %4u") CJPEG_WRBMP_JMESSAGE(JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors") CJPEG_WRBMP_JMESSAGE(JTRC_QUANT_NCOLORS, "Quantizing to %d colors") CJPEG_WRBMP_JMESSAGE(JTRC_QUANT_SELECTED, "Selected %d colors for quantization") CJPEG_WRBMP_JMESSAGE(JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d") CJPEG_WRBMP_JMESSAGE(JTRC_RST, "RST%d") CJPEG_WRBMP_JMESSAGE(JTRC_SMOOTH_NOTIMPL,
"Smoothing not supported with nonstandard sampling ratios") CJPEG_WRBMP_JMESSAGE(JTRC_SOF,
"Start Of Frame 0x%02x: width=%u, height=%u, components=%d") CJPEG_WRBMP_JMESSAGE(JTRC_SOF_COMPONENT,
" Component %d: %dhx%dv q=%d") CJPEG_WRBMP_JMESSAGE(JTRC_SOI, "Start of Image") CJPEG_WRBMP_JMESSAGE(JTRC_SOS,
"Start Of Scan: %d components") CJPEG_WRBMP_JMESSAGE(JTRC_SOS_COMPONENT,
" Component %d: dc=%d ac=%d") CJPEG_WRBMP_JMESSAGE(JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d") CJPEG_WRBMP_JMESSAGE(JTRC_TFILE_CLOSE, "Closed temporary file %s") CJPEG_WRBMP_JMESSAGE(JTRC_TFILE_OPEN,
"Opened temporary file %s") CJPEG_WRBMP_JMESSAGE(JTRC_THUMB_JPEG,
"JFIF extension marker: JPEG-compressed thumbnail image, length %u") CJPEG_WRBMP_JMESSAGE(JTRC_THUMB_PALETTE,
"JFIF extension marker: palette thumbnail image, length %u") CJPEG_WRBMP_JMESSAGE(JTRC_THUMB_RGB,
"JFIF extension marker: RGB thumbnail image, length %u") CJPEG_WRBMP_JMESSAGE(JTRC_UNKNOWN_IDS,
"Unrecognized"
" component "
"IDs %d %d "
"%d, "
"assuming "
"YCbCr") CJPEG_WRBMP_JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u") CJPEG_WRBMP_JMESSAGE(JTRC_XMS_OPEN,
"Obtained XMS handle %u") CJPEG_WRBMP_JMESSAGE(JWRN_ADOBE_XFORM,
"Unknown Adobe color "
"transform code %d")
CJPEG_WRBMP_JMESSAGE(JWRN_BOGUS_PROGRESSION,
"I"
"n"
"c"
"o"
"n"
"s"
"i"
"s"
"t"
"e"
"n"
"t"
" "
"p"
"r"
"o"
"g"
"r"
"e"
"s"
"s"
"i"
"o"
"n"
" "
"s"
"e"
"q"
"u"
"e"
"n"
"c"
"e"
" "
"f"
"o"
"r"
" "
"c"
"o"
"m"
"p"
"o"
"n"
"e"
"n"
"t"
" "
"%"
"d"
" "
"c"
"o"
"e"
"f"
"f"
"i"
"c"
"i"
"e"
"n"
"t"
" "
"%"
"d") CJPEG_WRBMP_JMESSAGE(JWRN_EXTRANEOUS_DATA,
"Corrupt JPEG data: %u "
"extraneous bytes "
"before marker 0x%02x")
CJPEG_WRBMP_JMESSAGE(
JWRN_HIT_MARKER,
"Corrupt JPEG "
"data: "
"premature end "
"of data "
"segment")
CJPEG_WRBMP_JMESSAGE(
JWRN_HUFF_BAD_CODE,
"Corrupt "
"JPEG "
"data: bad "
"Huffman "
"code")
CJPEG_WRBMP_JMESSAGE(
JWRN_JFIF_MAJOR,
"Warnin"
"g: "
"unknow"
"n "
"JFIF "
"revisi"
"on "
"number"
" "
"%d.%"
"02d") CJPEG_WRBMP_JMESSAGE(JWRN_JPEG_EOF,
"Premature end of JPEG file")
CJPEG_WRBMP_JMESSAGE(
JWRN_MUST_RESYNC,
"Co"
"rr"
"up"
"t "
"JP"
"EG"
" "
"da"
"ta"
": "
"fo"
"un"
"d "
"ma"
"rk"
"er"
" "
"0x"
"%0"
"2x"
" "
"in"
"st"
"ea"
"d "
"of"
" R"
"ST"
"%"
"d")
CJPEG_WRBMP_JMESSAGE(
JWRN_NOT_SEQUENTIAL,
"Invali"
"d SOS "
"parame"
"ters "
"for "
"sequen"
"tial "
"JPEG")
CJPEG_WRBMP_JMESSAGE(
JWRN_TOO_MUCH_DATA,
"Ap"
"pl"
"ic"
"at"
"io"
"n "
"tr"
"an"
"sf"
"er"
"re"
"d "
"to"
"o "
"ma"
"ny"
" s"
"ca"
"nl"
"in"
"e"
"s")
#ifdef CJPEG_WRBMP_JMAKE_ENUM_LIST
JMSG_LASTMSGCODE
} CJPEG_WRBMP_J_MESSAGE_CODE;
#undef CJPEG_WRBMP_JMAKE_ENUM_LIST
#endif /* JMAKE_ENUM_LIST */
/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */
#undef CJPEG_WRBMP_JMESSAGE

View File

@ -0,0 +1,91 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: jmorecfg.h
Author: Thomas G. Lane.
This file is part of the Independent JPEG Group's software.
For conditions of distribution and use, see the accompanying README file.
This file contains additional configuration options that customize the
JPEG software for special applications or support machine-dependent
optimizations. Most users will not need to touch this file.
Source: Independent JPEG Group's software
Changes: no major functional changes
License: See the accompanying README file
*/
#ifndef JMORECFG_H
#define JMORECFG_H
#define CJPEG_WRBMP_GETJSAMPLE(value) ((int) (value))
typedef unsigned char CJPEG_WRBMP_JSAMPLE;
typedef short CJPEG_WRBMP_JCOEF;
typedef unsigned char CJPEG_WRBMP_JOCTET;
/* These typedefs are used for various table entries and so forth.
They must be at least as wide as specified; but making them too big
won't cost a huge amount of memory, so we don't provide special
extraction code like we did for JSAMPLE. (In other words, these
typedefs live at a different point on the speed/space tradeoff curve.)
*/
/* UINT8 must hold at least the values 0..255. */
typedef unsigned char CJPEG_WRBMP_UINT8;
/* UINT16 must hold at least the values 0..65535. */
typedef unsigned short CJPEG_WRBMP_UINT16;
/* INT16 must hold at least the values -32768..32767. */
#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */
typedef short INT16;
#endif
/* INT32 must hold at least signed 32-bit values. */
#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
typedef long INT32;
#endif
typedef unsigned int CJPEG_WRBMP_JDIMENSION;
/* This macro is used to declare a "method", that is, a function pointer.
We want to supply prototype parameters if the compiler can cope.
Note that the arglist parameter must be parenthesized!
Again, you can customize this if you need special linkage keywords.
*/
#define EXTERN(type) extern type
#ifdef CJPEG_WRBMP_HAVE_PROTOTYPES
#define CJPEG_WRBMP_JMETHOD(type, methodname, arglist) type(*methodname) arglist
#else
#define CJPEG_WRBMP_JMETHOD(type, methodname, arglist) type (*methodname)()
#endif
/* Here is the pseudo-keyword for declaring pointers that must be "far"
on 80x86 machines. Most of the specialized coding for 80x86 is handled
by just saying "FAR *" where such a pointer is needed. In a few places
explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
*/
#ifdef CJPEG_JPEG6B_WRBMP_NEED_FAR_POINTERS
#define CJPEG_WRBMP_FAR far
#else
#define CJPEG_WRBMP_FAR
#endif
#ifndef CJPEG_JPEG6B_WRBMP_HAVE_BOOLEAN
typedef int cjpeg_wrbmp_boolean;
#endif
#endif

View File

@ -0,0 +1,844 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 1.x
Name: jpeglib.h
Author: Thomas G. Lane.
This file is part of the Independent JPEG Group's software.
For conditions of distribution and use, see the accompanying README file.
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.
Source: Independent JPEG Group's software
Changes: no major functional changes
License: See the accompanying README file
*/
#ifndef JPEGLIB_H
#define JPEGLIB_H
typedef int CJPEG_WRBMP_FILE;
typedef unsigned int cjpeg_wrbmp_size_t;
/*
First we include the configuration files that record how this
installation of the JPEG library is set up. jconfig.h can be
generated automatically for many systems. jmorecfg.h contains
manual configuration options that most people need not worry about.
*/
#ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */
#include "jconfig.h" /* widely used configuration options */
#endif
#include "jmorecfg.h" /* seldom changed options */
/* Data structures for images (arrays of samples and of DCT coefficients).
On 80x86 machines, the image arrays are too big for near pointers,
but the pointer arrays can fit in near memory.
*/
typedef CJPEG_WRBMP_JSAMPLE CJPEG_WRBMP_FAR
*CJPEG_WRBMP_JSAMPROW; /* ptr to one image row of pixel samples. */
typedef CJPEG_WRBMP_JSAMPROW
*CJPEG_WRBMP_JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */
typedef CJPEG_WRBMP_JSAMPARRAY
*CJPEG_WRBMP_JSAMPIMAGE; /* a 3-D sample array: top index is color */
typedef CJPEG_WRBMP_JCOEF
CJPEG_WRBMP_JBLOCK[64]; /* one block of coefficients */
typedef CJPEG_WRBMP_JBLOCK CJPEG_WRBMP_FAR
*CJPEG_WRBMP_JBLOCKROW; /* pointer to one row of coefficient blocks */
typedef CJPEG_WRBMP_JBLOCKROW
*CJPEG_WRBMP_JBLOCKARRAY; /* a 2-D array of coefficient blocks */
typedef CJPEG_WRBMP_JBLOCKARRAY
*CJPEG_WRBMP_JBLOCKIMAGE; /* a 3-D array of coefficient blocks */
typedef CJPEG_WRBMP_JCOEF CJPEG_WRBMP_FAR
*JCOEFPTR; /* useful in a couple of places */
/* Types for JPEG compression parameters and working tables. */
/* DCT coefficient quantization tables. */
typedef struct {
/* This array gives the coefficient quantizers in natural array order
(not the zigzag order in which they are stored in a JPEG DQT marker).
CAUTION: IJG versions prior to v6a kept this array in zigzag order.
*/
CJPEG_WRBMP_UINT16
quantval[64]; /* quantization step for each coefficient */
/* This field is used only during compression. It's initialized FALSE when
the table is created, and set TRUE when it's been output to the file.
You could suppress output of a table by setting this to TRUE.
(See jpeg_suppress_tables for an example.)
*/
cjpeg_wrbmp_boolean sent_table; /* TRUE when table has been output */
} CJPEG_WRBMP_JQUANT_TBL;
/* Huffman coding tables. */
typedef struct {
/* These two fields directly represent the contents of a JPEG DHT marker */
CJPEG_WRBMP_UINT8 bits[17]; /* bits[ k ] = # of symbols with codes of */
/* length k bits; bits[ 0 ] is unused */
CJPEG_WRBMP_UINT8
huffval[256]; /* The symbols, in order of incr code length */
/* This field is used only during compression. It's initialized FALSE when
the table is created, and set TRUE when it's been output to the file.
You could suppress output of a table by setting this to TRUE.
(See jpeg_suppress_tables for an example.)
*/
cjpeg_wrbmp_boolean sent_table; /* TRUE when table has been output */
} CJPEG_WRBMP_JHUFF_TBL;
/* Basic info about one component (color channel). */
typedef struct {
/* These values are fixed over the whole image. */
/* For compression, they must be supplied by parameter setup; */
/* for decompression, they are read from the SOF marker. */
int component_id; /* identifier for this component (0..255) */
int component_index; /* its index in SOF or cinfo->comp_info[ ] */
int h_samp_factor; /* horizontal sampling factor (1..4) */
int v_samp_factor; /* vertical sampling factor (1..4) */
int quant_tbl_no; /* quantization table selector (0..3) */
/* These values may vary between scans. */
/* For compression, they must be supplied by parameter setup; */
/* for decompression, they are read from the SOS marker. */
/* The decompressor output side may not use these variables. */
int dc_tbl_no; /* DC entropy table selector (0..3) */
int ac_tbl_no; /* AC entropy table selector (0..3) */
/* Remaining fields should be treated as private by applications. */
/* These values are computed during compression or decompression startup: */
/* 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.
*/
CJPEG_WRBMP_JDIMENSION width_in_blocks;
CJPEG_WRBMP_JDIMENSION height_in_blocks;
/* Size of a DCT block in samples. Always DCTSIZE for compression.
For decompression this is the size of the output from one DCT block,
reflecting any scaling we choose to apply during the IDCT step.
Values of 1,2,4,8 are likely to be supported. Note that different
components may receive different IDCT scalings.
*/
int DCT_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, IDCT scaling is included,
so downsampled_width = ceil(image_width * Hi/Hmax *
DCT_scaled_size/DCTSIZE)
*/
CJPEG_WRBMP_JDIMENSION downsampled_width; /* actual width in samples */
CJPEG_WRBMP_JDIMENSION downsampled_height; /* actual height in samples */
/* This flag is used only for decompression. In cases where some of the
components will be ignored (eg grayscale output from YCbCr image),
we can skip most computations for the unused components.
*/
cjpeg_wrbmp_boolean
component_needed; /* do we need the value of this component? */
/* 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 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_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.
This field is currently used only for decompression.
*/
CJPEG_WRBMP_JQUANT_TBL *quant_table;
/* Private per-component storage for DCT or IDCT subsystem. */
void *dct_table;
} cjpeg_wrbmp_jpeg_component_info;
/* The script for encoding a multiple-scan file is an array of these: */
typedef struct {
int comps_in_scan; /* number of components encoded in this scan */
int component_index[4]; /* their SOF/comp_info[ ] indexes */
int Ss, Se; /* progressive JPEG spectral selection parms */
int Ah, Al; /* progressive JPEG successive approx. parms */
} cjpeg_wrbmp_jpeg_scan_info;
/* The decompressor can save APPn and COM markers in a list of these: */
typedef struct cjpeg_wrbmp_jpeg_marker_struct CJPEG_WRBMP_FAR
*jpeg_saved_marker_ptr;
struct cjpeg_wrbmp_jpeg_marker_struct {
jpeg_saved_marker_ptr next; /* next in list, or NULL */
CJPEG_WRBMP_UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */
unsigned int original_length; /* # bytes of data in the file */
unsigned int data_length; /* # bytes of data saved at data[ ] */
CJPEG_WRBMP_JOCTET CJPEG_WRBMP_FAR
*data; /* the data contained in the marker */
/* the marker length word is not counted in data_length or original_length
*/
};
/* Known color spaces. */
typedef enum {
JCS_UNKNOWN, /* error/unspecified */
JCS_GRAYSCALE, /* monochrome */
JCS_RGB, /* red/green/blue */
JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */
JCS_CMYK, /* C/M/Y/K */
JCS_YCCK /* Y/Cb/Cr/K */
} CJPEG_WRBMP_J_COLOR_SPACE;
/* DCT/IDCT algorithm options. */
typedef enum {
JDCT_ISLOW, /* slow but accurate integer algorithm */
JDCT_IFAST, /* faster, less accurate integer method */
JDCT_FLOAT /* floating-point: accurate, fast on fast HW */
} CJPEG_WRBMP_J_DCT_METHOD;
/* Dithering options for decompression. */
typedef enum {
JDITHER_NONE, /* no dithering */
JDITHER_ORDERED, /* simple ordered dither */
JDITHER_FS /* Floyd-Steinberg error diffusion dither */
} CJPEG_WRBMP_J_DITHER_MODE;
/* Common fields between JPEG compression and decompression master structs. */
#define cjpeg_wrbmp_jpeg_common_fields \
struct cjpeg_wrbmp_jpeg_error_mgr *err; /* Error handler module */ \
struct cjpeg_wrbmp_jpeg_memory_mgr *mem; /* Memory manager module */ \
struct cjpeg_wrbmp_jpeg_progress_mgr \
*progress; /* Progress monitor, or NULL if none */ \
void *client_data; /* Available for use by application */ \
cjpeg_wrbmp_boolean \
is_decompressor; /* So common code can tell which is which */ \
int global_state /* For checking call sequence validity */
/* Routines that are to be used by both halves of the library are declared
to receive a pointer to this structure. There are no actual instances of
jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct.
*/
struct cjpeg_wrbmp_jpeg_common_struct {
cjpeg_wrbmp_jpeg_common_fields; /* Fields common to both master struct types
*/
/* Additional fields follow in an actual jpeg_compress_struct or
jpeg_decompress_struct. All three structs must agree on these
initial fields! (This would be a lot cleaner in C++.)
*/
};
typedef struct cjpeg_wrbmp_jpeg_common_struct *cjpeg_wrbmp_j_common_ptr;
typedef struct cjpeg_wrbmp_jpeg_compress_struct *cjpeg_wrbmp_j_compress_ptr;
typedef struct cjpeg_wrbmp_jpeg_decompress_struct *cjpeg_wrbmp_j_decompress_ptr;
/* Master record for a compression instance */
struct cjpeg_wrbmp_jpeg_compress_struct {
cjpeg_wrbmp_jpeg_common_fields; /* Fields shared with jpeg_decompress_struct
*/
/* Destination for compressed data */
struct cjpeg_wrbmp_jpeg_destination_mgr *dest;
/* Description of source image --- these fields must be filled in by
outer application before starting compression. in_color_space must
be correct before you can even call jpeg_set_defaults().
*/
CJPEG_WRBMP_JDIMENSION image_width; /* input image width */
CJPEG_WRBMP_JDIMENSION image_height; /* input image height */
int input_components; /* # of color components in input image */
CJPEG_WRBMP_J_COLOR_SPACE in_color_space; /* colorspace of input image */
float input_gamma; /* image gamma of input image */
/* Compression parameters --- these fields must be set before calling
jpeg_start_compress(). We recommend calling jpeg_set_defaults() to
initialize everything to reasonable defaults, then changing anything
the application specifically wants to change. That way you won't get
burnt when new parameters are added. Also note that there are several
helper routines to simplify changing parameters.
*/
int data_precision; /* bits of precision in image data */
int num_components; /* # of color components in JPEG image */
CJPEG_WRBMP_J_COLOR_SPACE
jpeg_color_space; /* colorspace of JPEG image */
cjpeg_wrbmp_jpeg_component_info *comp_info;
/* comp_info[ i ] describes component that appears i'th in SOF */
CJPEG_WRBMP_JQUANT_TBL *quant_tbl_ptrs[4];
/* ptrs to coefficient quantization tables, or NULL if not defined */
CJPEG_WRBMP_JHUFF_TBL *dc_huff_tbl_ptrs[4];
CJPEG_WRBMP_JHUFF_TBL *ac_huff_tbl_ptrs[4];
/* ptrs to Huffman coding tables, or NULL if not defined */
CJPEG_WRBMP_UINT8
arith_dc_L[16]; /* L values for DC arith-coding tables */
CJPEG_WRBMP_UINT8
arith_dc_U[16]; /* U values for DC arith-coding tables */
CJPEG_WRBMP_UINT8
arith_ac_K[16]; /* Kx values for AC arith-coding tables */
int num_scans; /* # of entries in scan_info array */
const cjpeg_wrbmp_jpeg_scan_info
*scan_info; /* script for multi-scan file, or NULL */
/* The default value of scan_info is NULL, which causes a single-scan
sequential JPEG file to be emitted. To create a multi-scan file,
set num_scans and scan_info to point to an array of scan definitions.
*/
cjpeg_wrbmp_boolean raw_data_in; /* TRUE=caller supplies downsampled data */
cjpeg_wrbmp_boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
cjpeg_wrbmp_boolean
optimize_coding; /* TRUE=optimize entropy encoding parms */
cjpeg_wrbmp_boolean CCIR601_sampling; /* TRUE=first samples are cosited */
int smoothing_factor; /* 1..100, or 0 for no input smoothing */
CJPEG_WRBMP_J_DCT_METHOD dct_method; /* DCT algorithm selector */
/* The restart interval can be specified in absolute MCUs by setting
restart_interval, or in MCU rows by setting restart_in_rows
(in which case the correct restart_interval will be figured
for each scan).
*/
unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */
int restart_in_rows; /* if > 0, MCU rows per restart interval */
/* Parameters controlling emission of special markers. */
cjpeg_wrbmp_boolean
write_JFIF_header; /* should a JFIF marker be written? */
CJPEG_WRBMP_UINT8
JFIF_major_version; /* What to write for the JFIF version number */
CJPEG_WRBMP_UINT8 JFIF_minor_version;
/* These three values are not used by the JPEG code, merely copied */
/* into the JFIF APP0 marker. density_unit can be 0 for unknown, */
/* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */
/* ratio is defined by X_density/Y_density even when density_unit=0. */
CJPEG_WRBMP_UINT8 density_unit; /* JFIF code for pixel size units */
CJPEG_WRBMP_UINT16 X_density; /* Horizontal pixel density */
CJPEG_WRBMP_UINT16 Y_density; /* Vertical pixel density */
cjpeg_wrbmp_boolean
write_Adobe_marker; /* should an Adobe marker be written? */
/* State variable: index of next scanline to be written to
jpeg_write_scanlines(). Application may use this to control its
processing loop, e.g., "while (next_scanline < image_height)".
*/
CJPEG_WRBMP_JDIMENSION next_scanline; /* 0 .. image_height-1 */
/* Remaining fields are known throughout compressor, but generally
should not be touched by a surrounding application.
*/
/*
These fields are computed during compression startup
*/
cjpeg_wrbmp_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 */
CJPEG_WRBMP_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.
*/
/*
These fields are valid during any one scan.
They describe the components and MCUs actually appearing in the scan.
*/
int comps_in_scan; /* # of JPEG components in this scan */
cjpeg_wrbmp_jpeg_component_info *cur_comp_info[4];
/* *cur_comp_info[ i ] describes component that appears i'th in SOS */
CJPEG_WRBMP_JDIMENSION MCUs_per_row; /* # of MCUs across the image */
CJPEG_WRBMP_JDIMENSION
MCU_rows_in_scan; /* # of MCU rows in the image */
int blocks_in_MCU; /* # of DCT blocks per MCU */
int MCU_membership[10];
/* MCU_membership[ i ] is index in cur_comp_info of component owning */
/* i'th block in an MCU */
int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
cjpeg_wrbmp_jpeg_scan_info
*script_space; /* workspace for jpeg_simple_progression */
int script_space_size;
};
/* Master record for a decompression instance */
struct cjpeg_wrbmp_jpeg_decompress_struct {
cjpeg_wrbmp_jpeg_common_fields; /* Fields shared with jpeg_compress_struct
*/
/* Source of compressed data */
struct cjpeg_wrbmp_jpeg_source_mgr *src;
/* Basic description of image --- filled in by jpeg_read_header(). */
/* Application may inspect these values to decide how to process image. */
CJPEG_WRBMP_JDIMENSION
image_width; /* nominal image width (from SOF marker) */
CJPEG_WRBMP_JDIMENSION image_height; /* nominal image height */
int num_components; /* # of color components in JPEG image */
CJPEG_WRBMP_J_COLOR_SPACE
jpeg_color_space; /* colorspace of JPEG image */
/* Decompression processing parameters --- these fields must be set before
calling jpeg_start_decompress(). Note that jpeg_read_header()
initializes them to default values.
*/
CJPEG_WRBMP_J_COLOR_SPACE out_color_space; /* colorspace for output */
unsigned int scale_num, scale_denom; /* fraction by which to scale image */
float output_gamma; /* image gamma wanted in output */
cjpeg_wrbmp_boolean buffered_image; /* TRUE=multiple output passes */
cjpeg_wrbmp_boolean raw_data_out; /* TRUE=downsampled data wanted */
CJPEG_WRBMP_J_DCT_METHOD dct_method; /* IDCT algorithm selector */
cjpeg_wrbmp_boolean do_fancy_upsampling; /* TRUE=apply fancy upsampling */
cjpeg_wrbmp_boolean
do_block_smoothing; /* TRUE=apply interblock smoothing */
cjpeg_wrbmp_boolean quantize_colors; /* TRUE=colormapped output wanted */
/* the following are ignored if not quantize_colors: */
CJPEG_WRBMP_J_DITHER_MODE
dither_mode; /* type of color dithering to use */
cjpeg_wrbmp_boolean
two_pass_quantize; /* TRUE=use two-pass color quantization */
int desired_number_of_colors; /* max # colors to use in created colormap */
/* these are significant only in buffered-image mode: */
cjpeg_wrbmp_boolean
enable_1pass_quant; /* enable future use of 1-pass quantizer */
cjpeg_wrbmp_boolean
enable_EXTERNal_quant; /* enable future use of EXTERNal colormap */
cjpeg_wrbmp_boolean
enable_2pass_quant; /* enable future use of 2-pass quantizer */
/* Description of actual output image that will be returned to application.
These fields are computed by jpeg_start_decompress().
You can also use jpeg_calc_output_dimensions() to determine these values
in advance of calling jpeg_start_decompress().
*/
CJPEG_WRBMP_JDIMENSION output_width; /* scaled image width */
CJPEG_WRBMP_JDIMENSION output_height; /* scaled image height */
int out_color_components; /* # of color components in out_color_space */
int output_components; /* # of color components returned */
/* output_components is 1 (a colormap index) when quantizing colors;
otherwise it equals out_color_components.
*/
int rec_outbuf_height; /* min recommended height of scanline buffer */
/* If the buffer passed to jpeg_read_scanlines() is less than this many rows
high, space and time will be wasted due to unnecessary data copying.
Usually rec_outbuf_height will be 1 or 2, at most 4.
*/
/* When quantizing colors, the output colormap is described by these fields.
The application can supply a colormap by setting colormap non-NULL before
calling jpeg_start_decompress; otherwise a colormap is created during
jpeg_start_decompress or jpeg_start_output.
The map has out_color_components rows and actual_number_of_colors
columns.
*/
int actual_number_of_colors; /* number of entries in use */
CJPEG_WRBMP_JSAMPARRAY
colormap; /* The color map as a 2-D pixel array */
/* State variables: these variables indicate the progress of decompression.
The application may examine these but must not modify them.
*/
/* Row index of next scanline to be read from jpeg_read_scanlines().
Application may use this to control its processing loop, e.g.,
"while (output_scanline < output_height)".
*/
CJPEG_WRBMP_JDIMENSION output_scanline; /* 0 .. output_height-1 */
/* Current input scan number and number of iMCU rows completed in scan.
These indicate the progress of the decompressor input side.
*/
int input_scan_number; /* Number of SOS markers seen so far */
CJPEG_WRBMP_JDIMENSION
input_iMCU_row; /* Number of iMCU rows completed */
/* The "output scan number" is the notional scan being displayed by the
output side. The decompressor will not allow output scan/row number
to get ahead of input scan/row, but it can fall arbitrarily far behind.
*/
int output_scan_number; /* Nominal scan number being displayed */
CJPEG_WRBMP_JDIMENSION output_iMCU_row; /* Number of iMCU rows read */
/* Current progression status. coef_bits[ c ][ i ] indicates the precision
with which component c's DCT coefficient i (in zigzag order) is known.
It is -1 when no data has yet been received, otherwise it is the point
transform (shift) value for the most recent scan of the coefficient
(thus, 0 at completion of the progression).
This pointer is NULL when reading a non-progressive file.
*/
int (*coef_bits)[64]; /* -1 or current Al value for each coef */
/* Internal JPEG parameters --- the application usually need not look at
these fields. Note that the decompressor output side may not use
any parameters that can change between scans.
*/
/* Quantization and Huffman tables are carried forward across input
datastreams when processing abbreviated JPEG datastreams.
*/
CJPEG_WRBMP_JQUANT_TBL *quant_tbl_ptrs[4];
/* ptrs to coefficient quantization tables, or NULL if not defined */
CJPEG_WRBMP_JHUFF_TBL *dc_huff_tbl_ptrs[4];
CJPEG_WRBMP_JHUFF_TBL *ac_huff_tbl_ptrs[4];
/* ptrs to Huffman coding tables, or NULL if not defined */
/* These parameters are never carried across datastreams, since they
are given in SOF/SOS markers or defined to be reset by SOI.
*/
int data_precision; /* bits of precision in image data */
cjpeg_wrbmp_jpeg_component_info *comp_info;
/* comp_info[ i ] describes component that appears i'th in SOF */
cjpeg_wrbmp_boolean
progressive_mode; /* TRUE if SOFn specifies progressive mode */
cjpeg_wrbmp_boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
CJPEG_WRBMP_UINT8
arith_dc_L[16]; /* L values for DC arith-coding tables */
CJPEG_WRBMP_UINT8
arith_dc_U[16]; /* U values for DC arith-coding tables */
CJPEG_WRBMP_UINT8
arith_ac_K[16]; /* Kx values for AC arith-coding tables */
unsigned int
restart_interval; /* MCUs per restart interval, or 0 for no restart */
/* These fields record data obtained from optional markers recognized by
the JPEG library.
*/
cjpeg_wrbmp_boolean
saw_JFIF_marker; /* TRUE iff a JFIF APP0 marker was found */
/* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */
CJPEG_WRBMP_UINT8 JFIF_major_version; /* JFIF version number */
CJPEG_WRBMP_UINT8 JFIF_minor_version;
CJPEG_WRBMP_UINT8 density_unit; /* JFIF code for pixel size units */
CJPEG_WRBMP_UINT16 X_density; /* Horizontal pixel density */
CJPEG_WRBMP_UINT16 Y_density; /* Vertical pixel density */
cjpeg_wrbmp_boolean
saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */
CJPEG_WRBMP_UINT8
Adobe_transform; /* Color transform code from Adobe marker */
cjpeg_wrbmp_boolean CCIR601_sampling; /* TRUE=first samples are cosited */
/* Aside from the specific data retained from APPn markers known to the
library, the uninterpreted contents of any or all APPn and COM markers
can be saved in a list for examination by the application.
*/
jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */
/* Remaining fields are known throughout decompressor, but generally
should not be touched by a surrounding application.
*/
/*
These fields are computed during decompression startup
*/
int max_h_samp_factor; /* largest h_samp_factor */
int max_v_samp_factor; /* largest v_samp_factor */
int min_DCT_scaled_size; /* smallest DCT_scaled_size of any component */
CJPEG_WRBMP_JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */
/* 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_scaled_size sample rows of a component per iMCU row.
*/
CJPEG_WRBMP_JSAMPLE
*sample_range_limit; /* table for fast range-limiting */
/*
These fields are valid during any one scan.
They describe the components and MCUs actually appearing in the scan.
Note that the decompressor output side must not use these fields.
*/
int comps_in_scan; /* # of JPEG components in this scan */
cjpeg_wrbmp_jpeg_component_info *cur_comp_info[4];
/* *cur_comp_info[ i ] describes component that appears i'th in SOS */
CJPEG_WRBMP_JDIMENSION MCUs_per_row; /* # of MCUs across the image */
CJPEG_WRBMP_JDIMENSION
MCU_rows_in_scan; /* # of MCU rows in the image */
int blocks_in_MCU; /* # of DCT blocks per MCU */
int MCU_membership[10];
/* MCU_membership[ i ] is index in cur_comp_info of component owning */
/* i'th block in an MCU */
int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
/* This field is shared between entropy decoder and marker parser.
It is either zero or the code of a JPEG marker that has been
read from the data source, but has not yet been processed.
*/
int unread_marker;
/*
Links to decompression subobjects (methods, private variables of modules)
*/
struct jpeg_decomp_master *master;
struct jpeg_d_main_controller *main;
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;
};
/* "Object" declarations for JPEG modules that may be supplied or called
directly by the surrounding application.
As with all objects in the JPEG library, these structs only define the
publicly visible methods and state variables of a module. Additional
private fields may exist after the public ones.
*/
/* Error handler object */
struct cjpeg_wrbmp_jpeg_error_mgr {
/* Error exit handler: does not return to caller */
CJPEG_WRBMP_JMETHOD(void, error_exit, (cjpeg_wrbmp_j_common_ptr cinfo));
/* Conditionally emit a trace or warning message */
CJPEG_WRBMP_JMETHOD(void, emit_message,
(cjpeg_wrbmp_j_common_ptr cinfo, int msg_level));
/* Routine that actually outputs a trace or error message */
CJPEG_WRBMP_JMETHOD(void, output_message, (cjpeg_wrbmp_j_common_ptr cinfo));
/* Format a message string for the most recent JPEG error or message */
CJPEG_WRBMP_JMETHOD(void, format_message,
(cjpeg_wrbmp_j_common_ptr cinfo, char *buffer));
#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */
/* Reset error state variables at start of a new image */
CJPEG_WRBMP_JMETHOD(void, reset_error_mgr,
(cjpeg_wrbmp_j_common_ptr cinfo));
/* The message ID code and any parameters are saved here.
A message can have one string parameter or up to 8 int parameters.
*/
int msg_code;
#define JMSG_STR_PARM_MAX 80
/*
union {
int i[ 8 ];
char s[ JMSG_STR_PARM_MAX ];
} msg_parm;
*/
/* Standard state variables for error facility */
int trace_level; /* max msg_level that will be displayed */
/* For recoverable corrupt-data errors, we emit a warning message,
but keep going unless emit_message chooses to abort. emit_message
should count warnings in num_warnings. The surrounding application
can check for bad data by seeing if num_warnings is nonzero at the
end of processing.
*/
long num_warnings; /* number of corrupt-data warnings */
/* These fields point to the table(s) of error message strings.
An application can change the table pointer to switch to a different
message list (typically, to change the language in which errors are
reported). Some applications may wish to add additional error codes
that will be handled by the JPEG library error mechanism; the second
table pointer is used for this purpose.
First table includes all errors generated by JPEG library itself.
Error code 0 is reserved for a "no such error string" message.
*/
const char *const *jpeg_message_table; /* Library errors */
int last_jpeg_message; /* Table contains strings 0..last_jpeg_message */
/* Second table can be added by application (see cjpeg/djpeg for example).
It contains strings numbered first_addon_message..last_addon_message.
*/
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 */
};
/* Progress monitor object */
struct cjpeg_wrbmp_jpeg_progress_mgr {
CJPEG_WRBMP_JMETHOD(void, progress_monitor,
(cjpeg_wrbmp_j_common_ptr cinfo));
long pass_counter; /* work units completed in this pass */
long pass_limit; /* total number of work units in this pass */
int completed_passes; /* passes completed so far */
int total_passes; /* total number of passes expected */
};
/* Data destination object for compression */
struct cjpeg_wrbmp_jpeg_destination_mgr {
CJPEG_WRBMP_JOCTET
*next_output_byte; /* => next byte to write in buffer */
cjpeg_wrbmp_size_t
free_in_buffer; /* # of byte spaces remaining in buffer */
CJPEG_WRBMP_JMETHOD(void, init_destination,
(cjpeg_wrbmp_j_compress_ptr cinfo));
CJPEG_WRBMP_JMETHOD(cjpeg_wrbmp_boolean, empty_output_buffer,
(cjpeg_wrbmp_j_compress_ptr cinfo));
CJPEG_WRBMP_JMETHOD(void, term_destination,
(cjpeg_wrbmp_j_compress_ptr cinfo));
};
/* Data source object for decompression */
struct cjpeg_wrbmp_jpeg_source_mgr {
const CJPEG_WRBMP_JOCTET
*next_input_byte; /* => next byte to read from buffer */
cjpeg_wrbmp_size_t bytes_in_buffer; /* # of bytes remaining in buffer */
CJPEG_WRBMP_JMETHOD(void, init_source,
(cjpeg_wrbmp_j_decompress_ptr cinfo));
CJPEG_WRBMP_JMETHOD(cjpeg_wrbmp_boolean, fill_input_buffer,
(cjpeg_wrbmp_j_decompress_ptr cinfo));
CJPEG_WRBMP_JMETHOD(void, skip_input_data,
(cjpeg_wrbmp_j_decompress_ptr cinfo, long num_bytes));
CJPEG_WRBMP_JMETHOD(cjpeg_wrbmp_boolean, resync_to_restart,
(cjpeg_wrbmp_j_decompress_ptr cinfo, int desired));
CJPEG_WRBMP_JMETHOD(void, term_source,
(cjpeg_wrbmp_j_decompress_ptr cinfo));
};
/* Memory manager object.
Allocates "small" objects (a few K total), "large" objects (tens of K),
and "really big" objects (virtual arrays with backing store if needed).
The memory manager does not allow individual objects to be freed; rather,
each created object is assigned to a pool, and whole pools can be freed
at once. This is faster and more convenient than remembering exactly what
to free, especially where malloc()/free() are not too speedy.
NB: alloc routines never return NULL. They exit to error_exit if not
successful.
*/
typedef struct jvirt_sarray_control *cjpeg_wrbmp_jvirt_sarray_ptr;
typedef struct jvirt_barray_control *cjpeg_wrbmp_jvirt_barray_ptr;
struct cjpeg_wrbmp_jpeg_memory_mgr {
/* Method pointers */
CJPEG_WRBMP_JMETHOD(void *, alloc_small,
(cjpeg_wrbmp_j_common_ptr cinfo, int pool_id,
cjpeg_wrbmp_size_t sizeofobject));
CJPEG_WRBMP_JMETHOD(void CJPEG_WRBMP_FAR *, alloc_large,
(cjpeg_wrbmp_j_common_ptr cinfo, int pool_id,
cjpeg_wrbmp_size_t sizeofobject));
CJPEG_WRBMP_JMETHOD(CJPEG_WRBMP_JSAMPARRAY, alloc_sarray,
(cjpeg_wrbmp_j_common_ptr cinfo, int pool_id,
CJPEG_WRBMP_JDIMENSION samplesperrow,
CJPEG_WRBMP_JDIMENSION numrows));
CJPEG_WRBMP_JMETHOD(CJPEG_WRBMP_JBLOCKARRAY, alloc_barray,
(cjpeg_wrbmp_j_common_ptr cinfo, int pool_id,
CJPEG_WRBMP_JDIMENSION blocksperrow,
CJPEG_WRBMP_JDIMENSION numrows));
CJPEG_WRBMP_JMETHOD(cjpeg_wrbmp_jvirt_sarray_ptr, request_virt_sarray,
(cjpeg_wrbmp_j_common_ptr cinfo, int pool_id,
cjpeg_wrbmp_boolean pre_zero,
CJPEG_WRBMP_JDIMENSION samplesperrow,
CJPEG_WRBMP_JDIMENSION numrows,
CJPEG_WRBMP_JDIMENSION maxaccess));
CJPEG_WRBMP_JMETHOD(cjpeg_wrbmp_jvirt_barray_ptr, request_virt_barray,
(cjpeg_wrbmp_j_common_ptr cinfo, int pool_id,
cjpeg_wrbmp_boolean pre_zero,
CJPEG_WRBMP_JDIMENSION blocksperrow,
CJPEG_WRBMP_JDIMENSION numrows,
CJPEG_WRBMP_JDIMENSION maxaccess));
CJPEG_WRBMP_JMETHOD(void, realize_virt_arrays,
(cjpeg_wrbmp_j_common_ptr cinfo));
CJPEG_WRBMP_JMETHOD(CJPEG_WRBMP_JSAMPARRAY, access_virt_sarray,
(cjpeg_wrbmp_j_common_ptr cinfo,
cjpeg_wrbmp_jvirt_sarray_ptr ptr,
CJPEG_WRBMP_JDIMENSION start_row,
CJPEG_WRBMP_JDIMENSION num_rows,
cjpeg_wrbmp_boolean writable));
CJPEG_WRBMP_JMETHOD(CJPEG_WRBMP_JBLOCKARRAY, access_virt_barray,
(cjpeg_wrbmp_j_common_ptr cinfo,
cjpeg_wrbmp_jvirt_barray_ptr ptr,
CJPEG_WRBMP_JDIMENSION start_row,
CJPEG_WRBMP_JDIMENSION num_rows,
cjpeg_wrbmp_boolean writable));
CJPEG_WRBMP_JMETHOD(void, free_pool,
(cjpeg_wrbmp_j_common_ptr cinfo, int pool_id));
CJPEG_WRBMP_JMETHOD(void, self_destruct, (cjpeg_wrbmp_j_common_ptr cinfo));
/* Limit on memory allocation for this JPEG object. (Note that this is
merely advisory, not a guaranteed maximum; it only affects the space
used for virtual-array buffers.) May be changed by outer application
after creating the JPEG object.
*/
long max_memory_to_use;
/* Maximum allocation request accepted by alloc_large. */
long max_alloc_chunk;
};
/* Routine signature for application-supplied marker processing methods.
Need not pass marker code since it is stored in cinfo->unread_marker.
*/
typedef CJPEG_WRBMP_JMETHOD(cjpeg_wrbmp_boolean, jpeg_marker_parser_method,
(cjpeg_wrbmp_j_decompress_ptr cinfo));
/*
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 jpegint.h, but may wish
to include jerror.h.
*/
#ifdef CJPEG_JPEG6B_WRBMP_JPEG_INTERNALS
#include "jerror.h" /* fetch error codes too */
#include "jpegint.h" /* fetch private declarations */
#endif
#endif /* JPEGLIB_H */