mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-30 21:55:31 +00:00
2d0b90011e
--HG-- rename : jpeg/MOZCHANGES => media/libjpeg/MOZCHANGES rename : jpeg/Makefile.in => media/libjpeg/Makefile.in rename : jpeg/README => media/libjpeg/README rename : jpeg/README-turbo.txt => media/libjpeg/README-turbo.txt rename : jpeg/cderror.h => media/libjpeg/cderror.h rename : jpeg/cdjpeg.h => media/libjpeg/cdjpeg.h rename : jpeg/jaricom.c => media/libjpeg/jaricom.c rename : jpeg/jcapimin.c => media/libjpeg/jcapimin.c rename : jpeg/jcapistd.c => media/libjpeg/jcapistd.c rename : jpeg/jcarith.c => media/libjpeg/jcarith.c rename : jpeg/jccoefct.c => media/libjpeg/jccoefct.c rename : jpeg/jccolor.c => media/libjpeg/jccolor.c rename : jpeg/jcdctmgr.c => media/libjpeg/jcdctmgr.c rename : jpeg/jchuff.c => media/libjpeg/jchuff.c rename : jpeg/jchuff.h => media/libjpeg/jchuff.h rename : jpeg/jcinit.c => media/libjpeg/jcinit.c rename : jpeg/jcmainct.c => media/libjpeg/jcmainct.c rename : jpeg/jcmarker.c => media/libjpeg/jcmarker.c rename : jpeg/jcmaster.c => media/libjpeg/jcmaster.c rename : jpeg/jcomapi.c => media/libjpeg/jcomapi.c rename : jpeg/jconfig.h => media/libjpeg/jconfig.h rename : jpeg/jconfig.h.in => media/libjpeg/jconfig.h.in rename : jpeg/jcparam.c => media/libjpeg/jcparam.c rename : jpeg/jcphuff.c => media/libjpeg/jcphuff.c rename : jpeg/jcprepct.c => media/libjpeg/jcprepct.c rename : jpeg/jcsample.c => media/libjpeg/jcsample.c rename : jpeg/jdapimin.c => media/libjpeg/jdapimin.c rename : jpeg/jdapistd.c => media/libjpeg/jdapistd.c rename : jpeg/jdarith.c => media/libjpeg/jdarith.c rename : jpeg/jdatadst.c => media/libjpeg/jdatadst.c rename : jpeg/jdatasrc.c => media/libjpeg/jdatasrc.c rename : jpeg/jdcoefct.c => media/libjpeg/jdcoefct.c rename : jpeg/jdcolor.c => media/libjpeg/jdcolor.c rename : jpeg/jdct.h => media/libjpeg/jdct.h rename : jpeg/jddctmgr.c => media/libjpeg/jddctmgr.c rename : jpeg/jdhuff.c => media/libjpeg/jdhuff.c rename : jpeg/jdhuff.h => media/libjpeg/jdhuff.h rename : jpeg/jdinput.c => media/libjpeg/jdinput.c rename : jpeg/jdmainct.c => media/libjpeg/jdmainct.c rename : jpeg/jdmarker.c => media/libjpeg/jdmarker.c rename : jpeg/jdmaster.c => media/libjpeg/jdmaster.c rename : jpeg/jdmerge.c => media/libjpeg/jdmerge.c rename : jpeg/jdphuff.c => media/libjpeg/jdphuff.c rename : jpeg/jdpostct.c => media/libjpeg/jdpostct.c rename : jpeg/jdsample.c => media/libjpeg/jdsample.c rename : jpeg/jdtrans.c => media/libjpeg/jdtrans.c rename : jpeg/jerror.c => media/libjpeg/jerror.c rename : jpeg/jerror.h => media/libjpeg/jerror.h rename : jpeg/jfdctflt.c => media/libjpeg/jfdctflt.c rename : jpeg/jfdctfst.c => media/libjpeg/jfdctfst.c rename : jpeg/jfdctint.c => media/libjpeg/jfdctint.c rename : jpeg/jidctflt.c => media/libjpeg/jidctflt.c rename : jpeg/jidctfst.c => media/libjpeg/jidctfst.c rename : jpeg/jidctint.c => media/libjpeg/jidctint.c rename : jpeg/jidctred.c => media/libjpeg/jidctred.c rename : jpeg/jinclude.h => media/libjpeg/jinclude.h rename : jpeg/jmemmgr.c => media/libjpeg/jmemmgr.c rename : jpeg/jmemnobs.c => media/libjpeg/jmemnobs.c rename : jpeg/jmemsys.h => media/libjpeg/jmemsys.h rename : jpeg/jmorecfg.h => media/libjpeg/jmorecfg.h rename : jpeg/jpegcomp.h => media/libjpeg/jpegcomp.h rename : jpeg/jpegint.h => media/libjpeg/jpegint.h rename : jpeg/jpeglib.h => media/libjpeg/jpeglib.h rename : jpeg/jquant1.c => media/libjpeg/jquant1.c rename : jpeg/jquant2.c => media/libjpeg/jquant2.c rename : jpeg/jsimd.h => media/libjpeg/jsimd.h rename : jpeg/jsimd_none.c => media/libjpeg/jsimd_none.c rename : jpeg/jsimddct.h => media/libjpeg/jsimddct.h rename : jpeg/jutils.c => media/libjpeg/jutils.c rename : jpeg/jversion.h => media/libjpeg/jversion.h rename : jpeg/simd/Makefile.in => media/libjpeg/simd/Makefile.in rename : jpeg/simd/jcclrmmx.asm => media/libjpeg/simd/jcclrmmx.asm rename : jpeg/simd/jcclrss2-64.asm => media/libjpeg/simd/jcclrss2-64.asm rename : jpeg/simd/jcclrss2.asm => media/libjpeg/simd/jcclrss2.asm rename : jpeg/simd/jccolmmx.asm => media/libjpeg/simd/jccolmmx.asm rename : jpeg/simd/jccolss2-64.asm => media/libjpeg/simd/jccolss2-64.asm rename : jpeg/simd/jccolss2.asm => media/libjpeg/simd/jccolss2.asm rename : jpeg/simd/jcolsamp.inc => media/libjpeg/simd/jcolsamp.inc rename : jpeg/simd/jcqnt3dn.asm => media/libjpeg/simd/jcqnt3dn.asm rename : jpeg/simd/jcqntmmx.asm => media/libjpeg/simd/jcqntmmx.asm rename : jpeg/simd/jcqnts2f-64.asm => media/libjpeg/simd/jcqnts2f-64.asm rename : jpeg/simd/jcqnts2f.asm => media/libjpeg/simd/jcqnts2f.asm rename : jpeg/simd/jcqnts2i-64.asm => media/libjpeg/simd/jcqnts2i-64.asm rename : jpeg/simd/jcqnts2i.asm => media/libjpeg/simd/jcqnts2i.asm rename : jpeg/simd/jcqntsse.asm => media/libjpeg/simd/jcqntsse.asm rename : jpeg/simd/jcsammmx.asm => media/libjpeg/simd/jcsammmx.asm rename : jpeg/simd/jcsamss2-64.asm => media/libjpeg/simd/jcsamss2-64.asm rename : jpeg/simd/jcsamss2.asm => media/libjpeg/simd/jcsamss2.asm rename : jpeg/simd/jdclrmmx.asm => media/libjpeg/simd/jdclrmmx.asm rename : jpeg/simd/jdclrss2-64.asm => media/libjpeg/simd/jdclrss2-64.asm rename : jpeg/simd/jdclrss2.asm => media/libjpeg/simd/jdclrss2.asm rename : jpeg/simd/jdcolmmx.asm => media/libjpeg/simd/jdcolmmx.asm rename : jpeg/simd/jdcolss2-64.asm => media/libjpeg/simd/jdcolss2-64.asm rename : jpeg/simd/jdcolss2.asm => media/libjpeg/simd/jdcolss2.asm rename : jpeg/simd/jdct.inc => media/libjpeg/simd/jdct.inc rename : jpeg/simd/jdmermmx.asm => media/libjpeg/simd/jdmermmx.asm rename : jpeg/simd/jdmerss2-64.asm => media/libjpeg/simd/jdmerss2-64.asm rename : jpeg/simd/jdmerss2.asm => media/libjpeg/simd/jdmerss2.asm rename : jpeg/simd/jdmrgmmx.asm => media/libjpeg/simd/jdmrgmmx.asm rename : jpeg/simd/jdmrgss2-64.asm => media/libjpeg/simd/jdmrgss2-64.asm rename : jpeg/simd/jdmrgss2.asm => media/libjpeg/simd/jdmrgss2.asm rename : jpeg/simd/jdsammmx.asm => media/libjpeg/simd/jdsammmx.asm rename : jpeg/simd/jdsamss2-64.asm => media/libjpeg/simd/jdsamss2-64.asm rename : jpeg/simd/jdsamss2.asm => media/libjpeg/simd/jdsamss2.asm rename : jpeg/simd/jf3dnflt.asm => media/libjpeg/simd/jf3dnflt.asm rename : jpeg/simd/jfmmxfst.asm => media/libjpeg/simd/jfmmxfst.asm rename : jpeg/simd/jfmmxint.asm => media/libjpeg/simd/jfmmxint.asm rename : jpeg/simd/jfss2fst-64.asm => media/libjpeg/simd/jfss2fst-64.asm rename : jpeg/simd/jfss2fst.asm => media/libjpeg/simd/jfss2fst.asm rename : jpeg/simd/jfss2int-64.asm => media/libjpeg/simd/jfss2int-64.asm rename : jpeg/simd/jfss2int.asm => media/libjpeg/simd/jfss2int.asm rename : jpeg/simd/jfsseflt-64.asm => media/libjpeg/simd/jfsseflt-64.asm rename : jpeg/simd/jfsseflt.asm => media/libjpeg/simd/jfsseflt.asm rename : jpeg/simd/ji3dnflt.asm => media/libjpeg/simd/ji3dnflt.asm rename : jpeg/simd/jimmxfst.asm => media/libjpeg/simd/jimmxfst.asm rename : jpeg/simd/jimmxint.asm => media/libjpeg/simd/jimmxint.asm rename : jpeg/simd/jimmxred.asm => media/libjpeg/simd/jimmxred.asm rename : jpeg/simd/jiss2flt-64.asm => media/libjpeg/simd/jiss2flt-64.asm rename : jpeg/simd/jiss2flt.asm => media/libjpeg/simd/jiss2flt.asm rename : jpeg/simd/jiss2fst-64.asm => media/libjpeg/simd/jiss2fst-64.asm rename : jpeg/simd/jiss2fst.asm => media/libjpeg/simd/jiss2fst.asm rename : jpeg/simd/jiss2int-64.asm => media/libjpeg/simd/jiss2int-64.asm rename : jpeg/simd/jiss2int.asm => media/libjpeg/simd/jiss2int.asm rename : jpeg/simd/jiss2red-64.asm => media/libjpeg/simd/jiss2red-64.asm rename : jpeg/simd/jiss2red.asm => media/libjpeg/simd/jiss2red.asm rename : jpeg/simd/jisseflt.asm => media/libjpeg/simd/jisseflt.asm rename : jpeg/simd/jsimd.h => media/libjpeg/simd/jsimd.h rename : jpeg/simd/jsimd_i386.c => media/libjpeg/simd/jsimd_i386.c rename : jpeg/simd/jsimd_x86_64.c => media/libjpeg/simd/jsimd_x86_64.c rename : jpeg/simd/jsimdcfg.inc => media/libjpeg/simd/jsimdcfg.inc rename : jpeg/simd/jsimdcfg.inc.h => media/libjpeg/simd/jsimdcfg.inc.h rename : jpeg/simd/jsimdcpu.asm => media/libjpeg/simd/jsimdcpu.asm rename : jpeg/simd/jsimdext.inc => media/libjpeg/simd/jsimdext.inc rename : jpeg/transupp.h => media/libjpeg/transupp.h
402 lines
16 KiB
C
402 lines
16 KiB
C
/*
|
|
* jpegint.h
|
|
*
|
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
|
* Modified 1997-2009 by Guido Vollbeding.
|
|
* This file is part of the Independent JPEG Group's software.
|
|
* For conditions of distribution and use, see the accompanying README file.
|
|
*
|
|
* This file provides common declarations for the various JPEG modules.
|
|
* These declarations are considered internal to the JPEG library; most
|
|
* applications using the library shouldn't need to include this file.
|
|
*/
|
|
|
|
|
|
/* Declarations for both compression & decompression */
|
|
|
|
typedef enum { /* Operating modes for buffer controllers */
|
|
JBUF_PASS_THRU, /* Plain stripwise operation */
|
|
/* Remaining modes require a full-image buffer to have been created */
|
|
JBUF_SAVE_SOURCE, /* Run source subobject only, save output */
|
|
JBUF_CRANK_DEST, /* Run dest subobject only, using saved data */
|
|
JBUF_SAVE_AND_PASS /* Run both subobjects, save output */
|
|
} J_BUF_MODE;
|
|
|
|
/* Values of global_state field (jdapi.c has some dependencies on ordering!) */
|
|
#define CSTATE_START 100 /* after create_compress */
|
|
#define CSTATE_SCANNING 101 /* start_compress done, write_scanlines OK */
|
|
#define CSTATE_RAW_OK 102 /* start_compress done, write_raw_data OK */
|
|
#define CSTATE_WRCOEFS 103 /* jpeg_write_coefficients done */
|
|
#define DSTATE_START 200 /* after create_decompress */
|
|
#define DSTATE_INHEADER 201 /* reading header markers, no SOS yet */
|
|
#define DSTATE_READY 202 /* found SOS, ready for start_decompress */
|
|
#define DSTATE_PRELOAD 203 /* reading multiscan file in start_decompress*/
|
|
#define DSTATE_PRESCAN 204 /* performing dummy pass for 2-pass quant */
|
|
#define DSTATE_SCANNING 205 /* start_decompress done, read_scanlines OK */
|
|
#define DSTATE_RAW_OK 206 /* start_decompress done, read_raw_data OK */
|
|
#define DSTATE_BUFIMAGE 207 /* expecting jpeg_start_output */
|
|
#define DSTATE_BUFPOST 208 /* looking for SOS/EOI in jpeg_finish_output */
|
|
#define DSTATE_RDCOEFS 209 /* reading file in jpeg_read_coefficients */
|
|
#define DSTATE_STOPPING 210 /* looking for EOI in jpeg_finish_decompress */
|
|
|
|
|
|
/* Declarations for compression modules */
|
|
|
|
/* Master control module */
|
|
struct jpeg_comp_master {
|
|
JMETHOD(void, prepare_for_pass, (j_compress_ptr cinfo));
|
|
JMETHOD(void, pass_startup, (j_compress_ptr cinfo));
|
|
JMETHOD(void, finish_pass, (j_compress_ptr cinfo));
|
|
|
|
/* State variables made visible to other modules */
|
|
boolean call_pass_startup; /* True if pass_startup must be called */
|
|
boolean is_last_pass; /* True during last pass */
|
|
};
|
|
|
|
/* Main buffer control (downsampled-data buffer) */
|
|
struct jpeg_c_main_controller {
|
|
JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
|
|
JMETHOD(void, process_data, (j_compress_ptr cinfo,
|
|
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
|
|
JDIMENSION in_rows_avail));
|
|
};
|
|
|
|
/* Compression preprocessing (downsampling input buffer control) */
|
|
struct jpeg_c_prep_controller {
|
|
JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
|
|
JMETHOD(void, pre_process_data, (j_compress_ptr cinfo,
|
|
JSAMPARRAY input_buf,
|
|
JDIMENSION *in_row_ctr,
|
|
JDIMENSION in_rows_avail,
|
|
JSAMPIMAGE output_buf,
|
|
JDIMENSION *out_row_group_ctr,
|
|
JDIMENSION out_row_groups_avail));
|
|
};
|
|
|
|
/* Coefficient buffer control */
|
|
struct jpeg_c_coef_controller {
|
|
JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
|
|
JMETHOD(boolean, compress_data, (j_compress_ptr cinfo,
|
|
JSAMPIMAGE input_buf));
|
|
};
|
|
|
|
/* Colorspace conversion */
|
|
struct jpeg_color_converter {
|
|
JMETHOD(void, start_pass, (j_compress_ptr cinfo));
|
|
JMETHOD(void, color_convert, (j_compress_ptr cinfo,
|
|
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
|
JDIMENSION output_row, int num_rows));
|
|
};
|
|
|
|
/* Downsampling */
|
|
struct jpeg_downsampler {
|
|
JMETHOD(void, start_pass, (j_compress_ptr cinfo));
|
|
JMETHOD(void, downsample, (j_compress_ptr cinfo,
|
|
JSAMPIMAGE input_buf, JDIMENSION in_row_index,
|
|
JSAMPIMAGE output_buf,
|
|
JDIMENSION out_row_group_index));
|
|
|
|
boolean need_context_rows; /* TRUE if need rows above & below */
|
|
};
|
|
|
|
/* Forward DCT (also controls coefficient quantization) */
|
|
struct jpeg_forward_dct {
|
|
JMETHOD(void, start_pass, (j_compress_ptr cinfo));
|
|
/* perhaps this should be an array??? */
|
|
JMETHOD(void, forward_DCT, (j_compress_ptr cinfo,
|
|
jpeg_component_info * compptr,
|
|
JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
|
|
JDIMENSION start_row, JDIMENSION start_col,
|
|
JDIMENSION num_blocks));
|
|
};
|
|
|
|
/* Entropy encoding */
|
|
struct jpeg_entropy_encoder {
|
|
JMETHOD(void, start_pass, (j_compress_ptr cinfo, boolean gather_statistics));
|
|
JMETHOD(boolean, encode_mcu, (j_compress_ptr cinfo, JBLOCKROW *MCU_data));
|
|
JMETHOD(void, finish_pass, (j_compress_ptr cinfo));
|
|
};
|
|
|
|
/* Marker writing */
|
|
struct jpeg_marker_writer {
|
|
JMETHOD(void, write_file_header, (j_compress_ptr cinfo));
|
|
JMETHOD(void, write_frame_header, (j_compress_ptr cinfo));
|
|
JMETHOD(void, write_scan_header, (j_compress_ptr cinfo));
|
|
JMETHOD(void, write_file_trailer, (j_compress_ptr cinfo));
|
|
JMETHOD(void, write_tables_only, (j_compress_ptr cinfo));
|
|
/* These routines are exported to allow insertion of extra markers */
|
|
/* Probably only COM and APPn markers should be written this way */
|
|
JMETHOD(void, write_marker_header, (j_compress_ptr cinfo, int marker,
|
|
unsigned int datalen));
|
|
JMETHOD(void, write_marker_byte, (j_compress_ptr cinfo, int val));
|
|
};
|
|
|
|
|
|
/* Declarations for decompression modules */
|
|
|
|
/* Master control module */
|
|
struct jpeg_decomp_master {
|
|
JMETHOD(void, prepare_for_output_pass, (j_decompress_ptr cinfo));
|
|
JMETHOD(void, finish_output_pass, (j_decompress_ptr cinfo));
|
|
|
|
/* State variables made visible to other modules */
|
|
boolean is_dummy_pass; /* True during 1st pass for 2-pass quant */
|
|
};
|
|
|
|
/* Input control module */
|
|
struct jpeg_input_controller {
|
|
JMETHOD(int, consume_input, (j_decompress_ptr cinfo));
|
|
JMETHOD(void, reset_input_controller, (j_decompress_ptr cinfo));
|
|
JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo));
|
|
JMETHOD(void, finish_input_pass, (j_decompress_ptr cinfo));
|
|
|
|
/* State variables made visible to other modules */
|
|
boolean has_multiple_scans; /* True if file has multiple scans */
|
|
boolean eoi_reached; /* True when EOI has been consumed */
|
|
};
|
|
|
|
/* Main buffer control (downsampled-data buffer) */
|
|
struct jpeg_d_main_controller {
|
|
JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode));
|
|
JMETHOD(void, process_data, (j_decompress_ptr cinfo,
|
|
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
|
|
JDIMENSION out_rows_avail));
|
|
};
|
|
|
|
/* Coefficient buffer control */
|
|
struct jpeg_d_coef_controller {
|
|
JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo));
|
|
JMETHOD(int, consume_data, (j_decompress_ptr cinfo));
|
|
JMETHOD(void, start_output_pass, (j_decompress_ptr cinfo));
|
|
JMETHOD(int, decompress_data, (j_decompress_ptr cinfo,
|
|
JSAMPIMAGE output_buf));
|
|
/* Pointer to array of coefficient virtual arrays, or NULL if none */
|
|
jvirt_barray_ptr *coef_arrays;
|
|
};
|
|
|
|
/* Decompression postprocessing (color quantization buffer control) */
|
|
struct jpeg_d_post_controller {
|
|
JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode));
|
|
JMETHOD(void, post_process_data, (j_decompress_ptr cinfo,
|
|
JSAMPIMAGE input_buf,
|
|
JDIMENSION *in_row_group_ctr,
|
|
JDIMENSION in_row_groups_avail,
|
|
JSAMPARRAY output_buf,
|
|
JDIMENSION *out_row_ctr,
|
|
JDIMENSION out_rows_avail));
|
|
};
|
|
|
|
/* Marker reading & parsing */
|
|
struct jpeg_marker_reader {
|
|
JMETHOD(void, reset_marker_reader, (j_decompress_ptr cinfo));
|
|
/* Read markers until SOS or EOI.
|
|
* Returns same codes as are defined for jpeg_consume_input:
|
|
* JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI.
|
|
*/
|
|
JMETHOD(int, read_markers, (j_decompress_ptr cinfo));
|
|
/* Read a restart marker --- exported for use by entropy decoder only */
|
|
jpeg_marker_parser_method read_restart_marker;
|
|
|
|
/* State of marker reader --- nominally internal, but applications
|
|
* supplying COM or APPn handlers might like to know the state.
|
|
*/
|
|
boolean saw_SOI; /* found SOI? */
|
|
boolean saw_SOF; /* found SOF? */
|
|
int next_restart_num; /* next restart number expected (0-7) */
|
|
unsigned int discarded_bytes; /* # of bytes skipped looking for a marker */
|
|
};
|
|
|
|
/* Entropy decoding */
|
|
struct jpeg_entropy_decoder {
|
|
JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
|
|
JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo,
|
|
JBLOCKROW *MCU_data));
|
|
|
|
/* This is here to share code between baseline and progressive decoders; */
|
|
/* other modules probably should not use it */
|
|
boolean insufficient_data; /* set TRUE after emitting warning */
|
|
};
|
|
|
|
/* Inverse DCT (also performs dequantization) */
|
|
typedef JMETHOD(void, inverse_DCT_method_ptr,
|
|
(j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
|
JCOEFPTR coef_block,
|
|
JSAMPARRAY output_buf, JDIMENSION output_col));
|
|
|
|
struct jpeg_inverse_dct {
|
|
JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
|
|
/* It is useful to allow each component to have a separate IDCT method. */
|
|
inverse_DCT_method_ptr inverse_DCT[MAX_COMPONENTS];
|
|
};
|
|
|
|
/* Upsampling (note that upsampler must also call color converter) */
|
|
struct jpeg_upsampler {
|
|
JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
|
|
JMETHOD(void, upsample, (j_decompress_ptr cinfo,
|
|
JSAMPIMAGE input_buf,
|
|
JDIMENSION *in_row_group_ctr,
|
|
JDIMENSION in_row_groups_avail,
|
|
JSAMPARRAY output_buf,
|
|
JDIMENSION *out_row_ctr,
|
|
JDIMENSION out_rows_avail));
|
|
|
|
boolean need_context_rows; /* TRUE if need rows above & below */
|
|
};
|
|
|
|
/* Colorspace conversion */
|
|
struct jpeg_color_deconverter {
|
|
JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
|
|
JMETHOD(void, color_convert, (j_decompress_ptr cinfo,
|
|
JSAMPIMAGE input_buf, JDIMENSION input_row,
|
|
JSAMPARRAY output_buf, int num_rows));
|
|
};
|
|
|
|
/* Color quantization or color precision reduction */
|
|
struct jpeg_color_quantizer {
|
|
JMETHOD(void, start_pass, (j_decompress_ptr cinfo, boolean is_pre_scan));
|
|
JMETHOD(void, color_quantize, (j_decompress_ptr cinfo,
|
|
JSAMPARRAY input_buf, JSAMPARRAY output_buf,
|
|
int num_rows));
|
|
JMETHOD(void, finish_pass, (j_decompress_ptr cinfo));
|
|
JMETHOD(void, new_color_map, (j_decompress_ptr cinfo));
|
|
};
|
|
|
|
|
|
/* Miscellaneous useful macros */
|
|
|
|
#undef MAX
|
|
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
|
#undef MIN
|
|
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
|
|
|
|
|
/* We assume that right shift corresponds to signed division by 2 with
|
|
* rounding towards minus infinity. This is correct for typical "arithmetic
|
|
* shift" instructions that shift in copies of the sign bit. But some
|
|
* C compilers implement >> with an unsigned shift. For these machines you
|
|
* must define RIGHT_SHIFT_IS_UNSIGNED.
|
|
* RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity.
|
|
* It is only applied with constant shift counts. SHIFT_TEMPS must be
|
|
* included in the variables of any routine using RIGHT_SHIFT.
|
|
*/
|
|
|
|
#ifdef RIGHT_SHIFT_IS_UNSIGNED
|
|
#define SHIFT_TEMPS INT32 shift_temp;
|
|
#define RIGHT_SHIFT(x,shft) \
|
|
((shift_temp = (x)) < 0 ? \
|
|
(shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \
|
|
(shift_temp >> (shft)))
|
|
#else
|
|
#define SHIFT_TEMPS
|
|
#define RIGHT_SHIFT(x,shft) ((x) >> (shft))
|
|
#endif
|
|
|
|
|
|
/* Short forms of external names for systems with brain-damaged linkers. */
|
|
|
|
#ifdef NEED_SHORT_EXTERNAL_NAMES
|
|
#define jinit_compress_master jICompress
|
|
#define jinit_c_master_control jICMaster
|
|
#define jinit_c_main_controller jICMainC
|
|
#define jinit_c_prep_controller jICPrepC
|
|
#define jinit_c_coef_controller jICCoefC
|
|
#define jinit_color_converter jICColor
|
|
#define jinit_downsampler jIDownsampler
|
|
#define jinit_forward_dct jIFDCT
|
|
#define jinit_huff_encoder jIHEncoder
|
|
#define jinit_phuff_encoder jIPHEncoder
|
|
#define jinit_arith_encoder jIAEncoder
|
|
#define jinit_marker_writer jIMWriter
|
|
#define jinit_master_decompress jIDMaster
|
|
#define jinit_d_main_controller jIDMainC
|
|
#define jinit_d_coef_controller jIDCoefC
|
|
#define jinit_d_post_controller jIDPostC
|
|
#define jinit_input_controller jIInCtlr
|
|
#define jinit_marker_reader jIMReader
|
|
#define jinit_huff_decoder jIHDecoder
|
|
#define jinit_phuff_decoder jIPHDecoder
|
|
#define jinit_arith_decoder jIADecoder
|
|
#define jinit_inverse_dct jIIDCT
|
|
#define jinit_upsampler jIUpsampler
|
|
#define jinit_color_deconverter jIDColor
|
|
#define jinit_1pass_quantizer jI1Quant
|
|
#define jinit_2pass_quantizer jI2Quant
|
|
#define jinit_merged_upsampler jIMUpsampler
|
|
#define jinit_memory_mgr jIMemMgr
|
|
#define jdiv_round_up jDivRound
|
|
#define jround_up jRound
|
|
#define jcopy_sample_rows jCopySamples
|
|
#define jcopy_block_row jCopyBlocks
|
|
#define jzero_far jZeroFar
|
|
#define jpeg_zigzag_order jZIGTable
|
|
#define jpeg_natural_order jZAGTable
|
|
#define jpeg_aritab jAriTab
|
|
#endif /* NEED_SHORT_EXTERNAL_NAMES */
|
|
|
|
|
|
/* Compression module initialization routines */
|
|
EXTERN(void) jinit_compress_master JPP((j_compress_ptr cinfo));
|
|
EXTERN(void) jinit_c_master_control JPP((j_compress_ptr cinfo,
|
|
boolean transcode_only));
|
|
EXTERN(void) jinit_c_main_controller JPP((j_compress_ptr cinfo,
|
|
boolean need_full_buffer));
|
|
EXTERN(void) jinit_c_prep_controller JPP((j_compress_ptr cinfo,
|
|
boolean need_full_buffer));
|
|
EXTERN(void) jinit_c_coef_controller JPP((j_compress_ptr cinfo,
|
|
boolean need_full_buffer));
|
|
EXTERN(void) jinit_color_converter JPP((j_compress_ptr cinfo));
|
|
EXTERN(void) jinit_downsampler JPP((j_compress_ptr cinfo));
|
|
EXTERN(void) jinit_forward_dct JPP((j_compress_ptr cinfo));
|
|
EXTERN(void) jinit_huff_encoder JPP((j_compress_ptr cinfo));
|
|
EXTERN(void) jinit_phuff_encoder JPP((j_compress_ptr cinfo));
|
|
EXTERN(void) jinit_arith_encoder JPP((j_compress_ptr cinfo));
|
|
EXTERN(void) jinit_marker_writer JPP((j_compress_ptr cinfo));
|
|
/* Decompression module initialization routines */
|
|
EXTERN(void) jinit_master_decompress JPP((j_decompress_ptr cinfo));
|
|
EXTERN(void) jinit_d_main_controller JPP((j_decompress_ptr cinfo,
|
|
boolean need_full_buffer));
|
|
EXTERN(void) jinit_d_coef_controller JPP((j_decompress_ptr cinfo,
|
|
boolean need_full_buffer));
|
|
EXTERN(void) jinit_d_post_controller JPP((j_decompress_ptr cinfo,
|
|
boolean need_full_buffer));
|
|
EXTERN(void) jinit_input_controller JPP((j_decompress_ptr cinfo));
|
|
EXTERN(void) jinit_marker_reader JPP((j_decompress_ptr cinfo));
|
|
EXTERN(void) jinit_huff_decoder JPP((j_decompress_ptr cinfo));
|
|
EXTERN(void) jinit_phuff_decoder JPP((j_decompress_ptr cinfo));
|
|
EXTERN(void) jinit_arith_decoder JPP((j_decompress_ptr cinfo));
|
|
EXTERN(void) jinit_inverse_dct JPP((j_decompress_ptr cinfo));
|
|
EXTERN(void) jinit_upsampler JPP((j_decompress_ptr cinfo));
|
|
EXTERN(void) jinit_color_deconverter JPP((j_decompress_ptr cinfo));
|
|
EXTERN(void) jinit_1pass_quantizer JPP((j_decompress_ptr cinfo));
|
|
EXTERN(void) jinit_2pass_quantizer JPP((j_decompress_ptr cinfo));
|
|
EXTERN(void) jinit_merged_upsampler JPP((j_decompress_ptr cinfo));
|
|
/* Memory manager initialization */
|
|
EXTERN(void) jinit_memory_mgr JPP((j_common_ptr cinfo));
|
|
|
|
/* Utility routines in jutils.c */
|
|
EXTERN(long) jdiv_round_up JPP((long a, long b));
|
|
EXTERN(size_t) jround_up JPP((size_t a, size_t b));
|
|
EXTERN(void) jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row,
|
|
JSAMPARRAY output_array, int dest_row,
|
|
int num_rows, JDIMENSION num_cols));
|
|
EXTERN(void) jcopy_block_row JPP((JBLOCKROW input_row, JBLOCKROW output_row,
|
|
JDIMENSION num_blocks));
|
|
EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero));
|
|
/* Constant tables in jutils.c */
|
|
#if 0 /* This table is not actually needed in v6a */
|
|
extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */
|
|
#endif
|
|
extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */
|
|
|
|
/* Arithmetic coding probability estimation tables in jaricom.c */
|
|
extern const INT32 jpeg_aritab[];
|
|
|
|
/* Suppress undefined-structure complaints if necessary. */
|
|
|
|
#ifdef INCOMPLETE_TYPES_BROKEN
|
|
#ifndef AM_MEMORY_MANAGER /* only jmemmgr.c defines these */
|
|
struct jvirt_sarray_control { long dummy; };
|
|
struct jvirt_barray_control { long dummy; };
|
|
#endif
|
|
#endif /* INCOMPLETE_TYPES_BROKEN */
|