jpegint.h revision 5996a25e2f50d20d6a8f09830724035b49c3927b
136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/*
236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * jpegint.h
336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane *
45ead57a34a398aa798f35bd7a6abad19b2e453e2Thomas G. Lane * Copyright (C) 1991-1997, Thomas G. Lane.
55996a25e2f50d20d6a8f09830724035b49c3927bGuido Vollbeding * Modified 1997-2009 by Guido Vollbeding.
636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * This file is part of the Independent JPEG Group's software.
736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * For conditions of distribution and use, see the accompanying README file.
836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane *
936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * This file provides common declarations for the various JPEG modules.
1036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * These declarations are considered internal to the JPEG library; most
1136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * applications using the library shouldn't need to include this file.
1236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */
1336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
1436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
1536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Declarations for both compression & decompression */
1636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
1736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanetypedef enum {			/* Operating modes for buffer controllers */
1836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane	JBUF_PASS_THRU,		/* Plain stripwise operation */
1936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane	/* Remaining modes require a full-image buffer to have been created */
2036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane	JBUF_SAVE_SOURCE,	/* Run source subobject only, save output */
2136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane	JBUF_CRANK_DEST,	/* Run dest subobject only, using saved data */
2236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane	JBUF_SAVE_AND_PASS	/* Run both subobjects, save output */
2336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane} J_BUF_MODE;
2436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
25bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane/* Values of global_state field (jdapi.c has some dependencies on ordering!) */
2636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define CSTATE_START	100	/* after create_compress */
2736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define CSTATE_SCANNING	101	/* start_compress done, write_scanlines OK */
2836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define CSTATE_RAW_OK	102	/* start_compress done, write_raw_data OK */
29bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane#define CSTATE_WRCOEFS	103	/* jpeg_write_coefficients done */
3036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define DSTATE_START	200	/* after create_decompress */
31bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane#define DSTATE_INHEADER	201	/* reading header markers, no SOS yet */
32bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane#define DSTATE_READY	202	/* found SOS, ready for start_decompress */
33bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane#define DSTATE_PRELOAD	203	/* reading multiscan file in start_decompress*/
34bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane#define DSTATE_PRESCAN	204	/* performing dummy pass for 2-pass quant */
35bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane#define DSTATE_SCANNING	205	/* start_decompress done, read_scanlines OK */
36bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane#define DSTATE_RAW_OK	206	/* start_decompress done, read_raw_data OK */
37bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane#define DSTATE_BUFIMAGE	207	/* expecting jpeg_start_output */
38bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane#define DSTATE_BUFPOST	208	/* looking for SOS/EOI in jpeg_finish_output */
39bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane#define DSTATE_RDCOEFS	209	/* reading file in jpeg_read_coefficients */
40bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane#define DSTATE_STOPPING	210	/* looking for EOI in jpeg_finish_decompress */
4136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
4236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
4336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Declarations for compression modules */
4436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
4536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Master control module */
4636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanestruct jpeg_comp_master {
4736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, prepare_for_pass, (j_compress_ptr cinfo));
4836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, pass_startup, (j_compress_ptr cinfo));
4936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, finish_pass, (j_compress_ptr cinfo));
5036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
5136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  /* State variables made visible to other modules */
5236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  boolean call_pass_startup;	/* True if pass_startup must be called */
5336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  boolean is_last_pass;		/* True during last pass */
5436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane};
5536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
5636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Main buffer control (downsampled-data buffer) */
5736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanestruct jpeg_c_main_controller {
5836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
5936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, process_data, (j_compress_ptr cinfo,
6036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane			       JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
6136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane			       JDIMENSION in_rows_avail));
6236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane};
6336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
6436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Compression preprocessing (downsampling input buffer control) */
6536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanestruct jpeg_c_prep_controller {
6636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
6736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, pre_process_data, (j_compress_ptr cinfo,
6836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane				   JSAMPARRAY input_buf,
6936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane				   JDIMENSION *in_row_ctr,
7036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane				   JDIMENSION in_rows_avail,
7136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane				   JSAMPIMAGE output_buf,
7236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane				   JDIMENSION *out_row_group_ctr,
7336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane				   JDIMENSION out_row_groups_avail));
7436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane};
7536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
7636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Coefficient buffer control */
7736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanestruct jpeg_c_coef_controller {
7836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
79a8b67c4fbbfde9b4b4e03f2dea8f4f0b1900fc33Thomas G. Lane  JMETHOD(boolean, compress_data, (j_compress_ptr cinfo,
80a8b67c4fbbfde9b4b4e03f2dea8f4f0b1900fc33Thomas G. Lane				   JSAMPIMAGE input_buf));
8136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane};
8236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
8336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Colorspace conversion */
8436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanestruct jpeg_color_converter {
8536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, start_pass, (j_compress_ptr cinfo));
8636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, color_convert, (j_compress_ptr cinfo,
8736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane				JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
8836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane				JDIMENSION output_row, int num_rows));
8936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane};
9036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
9136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Downsampling */
9236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanestruct jpeg_downsampler {
9336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, start_pass, (j_compress_ptr cinfo));
9436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, downsample, (j_compress_ptr cinfo,
9536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane			     JSAMPIMAGE input_buf, JDIMENSION in_row_index,
9636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane			     JSAMPIMAGE output_buf,
9736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane			     JDIMENSION out_row_group_index));
9836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
9936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  boolean need_context_rows;	/* TRUE if need rows above & below */
10036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane};
10136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
10236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Forward DCT (also controls coefficient quantization) */
1035996a25e2f50d20d6a8f09830724035b49c3927bGuido Vollbedingtypedef JMETHOD(void, forward_DCT_ptr,
1045996a25e2f50d20d6a8f09830724035b49c3927bGuido Vollbeding		(j_compress_ptr cinfo, jpeg_component_info * compptr,
1055996a25e2f50d20d6a8f09830724035b49c3927bGuido Vollbeding		 JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
1065996a25e2f50d20d6a8f09830724035b49c3927bGuido Vollbeding		 JDIMENSION start_row, JDIMENSION start_col,
1075996a25e2f50d20d6a8f09830724035b49c3927bGuido Vollbeding		 JDIMENSION num_blocks));
1085996a25e2f50d20d6a8f09830724035b49c3927bGuido Vollbeding
10936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanestruct jpeg_forward_dct {
11036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, start_pass, (j_compress_ptr cinfo));
1115996a25e2f50d20d6a8f09830724035b49c3927bGuido Vollbeding  /* It is useful to allow each component to have a separate FDCT method. */
1125996a25e2f50d20d6a8f09830724035b49c3927bGuido Vollbeding  forward_DCT_ptr forward_DCT[MAX_COMPONENTS];
11336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane};
11436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
11536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Entropy encoding */
11636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanestruct jpeg_entropy_encoder {
11736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, start_pass, (j_compress_ptr cinfo, boolean gather_statistics));
11836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(boolean, encode_mcu, (j_compress_ptr cinfo, JBLOCKROW *MCU_data));
11936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, finish_pass, (j_compress_ptr cinfo));
12036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane};
12136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
12236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Marker writing */
12336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanestruct jpeg_marker_writer {
12436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, write_file_header, (j_compress_ptr cinfo));
12536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, write_frame_header, (j_compress_ptr cinfo));
12636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, write_scan_header, (j_compress_ptr cinfo));
12736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, write_file_trailer, (j_compress_ptr cinfo));
12836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, write_tables_only, (j_compress_ptr cinfo));
1295ead57a34a398aa798f35bd7a6abad19b2e453e2Thomas G. Lane  /* These routines are exported to allow insertion of extra markers */
1305ead57a34a398aa798f35bd7a6abad19b2e453e2Thomas G. Lane  /* Probably only COM and APPn markers should be written this way */
1315ead57a34a398aa798f35bd7a6abad19b2e453e2Thomas G. Lane  JMETHOD(void, write_marker_header, (j_compress_ptr cinfo, int marker,
1325ead57a34a398aa798f35bd7a6abad19b2e453e2Thomas G. Lane				      unsigned int datalen));
1335ead57a34a398aa798f35bd7a6abad19b2e453e2Thomas G. Lane  JMETHOD(void, write_marker_byte, (j_compress_ptr cinfo, int val));
13436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane};
13536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
13636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
13736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Declarations for decompression modules */
13836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
13936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Master control module */
14036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanestruct jpeg_decomp_master {
141bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane  JMETHOD(void, prepare_for_output_pass, (j_decompress_ptr cinfo));
142bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane  JMETHOD(void, finish_output_pass, (j_decompress_ptr cinfo));
14336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
14436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  /* State variables made visible to other modules */
145bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane  boolean is_dummy_pass;	/* True during 1st pass for 2-pass quant */
146bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane};
147bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane
148bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane/* Input control module */
149bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lanestruct jpeg_input_controller {
150bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane  JMETHOD(int, consume_input, (j_decompress_ptr cinfo));
151bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane  JMETHOD(void, reset_input_controller, (j_decompress_ptr cinfo));
152bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane  JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo));
153bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane  JMETHOD(void, finish_input_pass, (j_decompress_ptr cinfo));
154bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane
155bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane  /* State variables made visible to other modules */
156bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane  boolean has_multiple_scans;	/* True if file has multiple scans */
157bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane  boolean eoi_reached;		/* True when EOI has been consumed */
15836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane};
15936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
16036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Main buffer control (downsampled-data buffer) */
16136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanestruct jpeg_d_main_controller {
16236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode));
16336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, process_data, (j_decompress_ptr cinfo,
16436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane			       JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
16536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane			       JDIMENSION out_rows_avail));
16636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane};
16736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
16836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Coefficient buffer control */
16936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanestruct jpeg_d_coef_controller {
170bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane  JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo));
171bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane  JMETHOD(int, consume_data, (j_decompress_ptr cinfo));
172bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane  JMETHOD(void, start_output_pass, (j_decompress_ptr cinfo));
173bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane  JMETHOD(int, decompress_data, (j_decompress_ptr cinfo,
174bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane				 JSAMPIMAGE output_buf));
175bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane  /* Pointer to array of coefficient virtual arrays, or NULL if none */
176bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane  jvirt_barray_ptr *coef_arrays;
17736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane};
17836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
17936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Decompression postprocessing (color quantization buffer control) */
18036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanestruct jpeg_d_post_controller {
18136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode));
18236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, post_process_data, (j_decompress_ptr cinfo,
18336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane				    JSAMPIMAGE input_buf,
18436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane				    JDIMENSION *in_row_group_ctr,
18536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane				    JDIMENSION in_row_groups_avail,
18636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane				    JSAMPARRAY output_buf,
18736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane				    JDIMENSION *out_row_ctr,
18836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane				    JDIMENSION out_rows_avail));
18936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane};
19036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
19136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Marker reading & parsing */
19236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanestruct jpeg_marker_reader {
19336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, reset_marker_reader, (j_decompress_ptr cinfo));
19436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  /* Read markers until SOS or EOI.
195bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane   * Returns same codes as are defined for jpeg_consume_input:
196bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane   * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI.
19736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane   */
19836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(int, read_markers, (j_decompress_ptr cinfo));
19936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  /* Read a restart marker --- exported for use by entropy decoder only */
20036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  jpeg_marker_parser_method read_restart_marker;
20136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
20236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  /* State of marker reader --- nominally internal, but applications
20336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane   * supplying COM or APPn handlers might like to know the state.
20436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane   */
20536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  boolean saw_SOI;		/* found SOI? */
20636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  boolean saw_SOF;		/* found SOF? */
20736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  int next_restart_num;		/* next restart number expected (0-7) */
20836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  unsigned int discarded_bytes;	/* # of bytes skipped looking for a marker */
20936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane};
21036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
21136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Entropy decoding */
21236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanestruct jpeg_entropy_decoder {
21336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
21436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo,
21536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane				JBLOCKROW *MCU_data));
2165ead57a34a398aa798f35bd7a6abad19b2e453e2Thomas G. Lane
2175ead57a34a398aa798f35bd7a6abad19b2e453e2Thomas G. Lane  /* This is here to share code between baseline and progressive decoders; */
2185ead57a34a398aa798f35bd7a6abad19b2e453e2Thomas G. Lane  /* other modules probably should not use it */
2195ead57a34a398aa798f35bd7a6abad19b2e453e2Thomas G. Lane  boolean insufficient_data;	/* set TRUE after emitting warning */
22036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane};
22136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
22236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Inverse DCT (also performs dequantization) */
22336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanetypedef JMETHOD(void, inverse_DCT_method_ptr,
22436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane		(j_decompress_ptr cinfo, jpeg_component_info * compptr,
22536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane		 JCOEFPTR coef_block,
22636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane		 JSAMPARRAY output_buf, JDIMENSION output_col));
22736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
22836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanestruct jpeg_inverse_dct {
229bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane  JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
23036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  /* It is useful to allow each component to have a separate IDCT method. */
23136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  inverse_DCT_method_ptr inverse_DCT[MAX_COMPONENTS];
23236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane};
23336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
23436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Upsampling (note that upsampler must also call color converter) */
23536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanestruct jpeg_upsampler {
23636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
23736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, upsample, (j_decompress_ptr cinfo,
23836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane			   JSAMPIMAGE input_buf,
23936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane			   JDIMENSION *in_row_group_ctr,
24036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane			   JDIMENSION in_row_groups_avail,
24136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane			   JSAMPARRAY output_buf,
24236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane			   JDIMENSION *out_row_ctr,
24336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane			   JDIMENSION out_rows_avail));
24436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
24536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  boolean need_context_rows;	/* TRUE if need rows above & below */
24636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane};
24736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
24836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Colorspace conversion */
24936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanestruct jpeg_color_deconverter {
25036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
25136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, color_convert, (j_decompress_ptr cinfo,
25236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane				JSAMPIMAGE input_buf, JDIMENSION input_row,
25336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane				JSAMPARRAY output_buf, int num_rows));
25436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane};
25536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
25636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Color quantization or color precision reduction */
25736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanestruct jpeg_color_quantizer {
25836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, start_pass, (j_decompress_ptr cinfo, boolean is_pre_scan));
25936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, color_quantize, (j_decompress_ptr cinfo,
26036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane				 JSAMPARRAY input_buf, JSAMPARRAY output_buf,
26136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane				 int num_rows));
26236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane  JMETHOD(void, finish_pass, (j_decompress_ptr cinfo));
263bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane  JMETHOD(void, new_color_map, (j_decompress_ptr cinfo));
26436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane};
26536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
26636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
26736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Miscellaneous useful macros */
26836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
26936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#undef MAX
27036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define MAX(a,b)	((a) > (b) ? (a) : (b))
27136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#undef MIN
27236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define MIN(a,b)	((a) < (b) ? (a) : (b))
27336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
27436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
27536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* We assume that right shift corresponds to signed division by 2 with
27636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * rounding towards minus infinity.  This is correct for typical "arithmetic
27736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * shift" instructions that shift in copies of the sign bit.  But some
27836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * C compilers implement >> with an unsigned shift.  For these machines you
27936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * must define RIGHT_SHIFT_IS_UNSIGNED.
28036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity.
28136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * It is only applied with constant shift counts.  SHIFT_TEMPS must be
28236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane * included in the variables of any routine using RIGHT_SHIFT.
28336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane */
28436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
28536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifdef RIGHT_SHIFT_IS_UNSIGNED
28636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define SHIFT_TEMPS	INT32 shift_temp;
28736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define RIGHT_SHIFT(x,shft)  \
28836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane	((shift_temp = (x)) < 0 ? \
28936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane	 (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \
29036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane	 (shift_temp >> (shft)))
29136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#else
29236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define SHIFT_TEMPS
29336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define RIGHT_SHIFT(x,shft)	((x) >> (shft))
29436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif
29536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
29636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
29736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Short forms of external names for systems with brain-damaged linkers. */
29836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
29936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifdef NEED_SHORT_EXTERNAL_NAMES
300bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane#define jinit_compress_master	jICompress
301bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane#define jinit_c_master_control	jICMaster
30236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jinit_c_main_controller	jICMainC
30336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jinit_c_prep_controller	jICPrepC
30436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jinit_c_coef_controller	jICCoefC
30536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jinit_color_converter	jICColor
30636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jinit_downsampler	jIDownsampler
30736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jinit_forward_dct	jIFDCT
30836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jinit_huff_encoder	jIHEncoder
3095996a25e2f50d20d6a8f09830724035b49c3927bGuido Vollbeding#define jinit_arith_encoder	jIAEncoder
31036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jinit_marker_writer	jIMWriter
31136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jinit_master_decompress	jIDMaster
31236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jinit_d_main_controller	jIDMainC
31336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jinit_d_coef_controller	jIDCoefC
31436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jinit_d_post_controller	jIDPostC
315bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane#define jinit_input_controller	jIInCtlr
31636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jinit_marker_reader	jIMReader
31736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jinit_huff_decoder	jIHDecoder
3185996a25e2f50d20d6a8f09830724035b49c3927bGuido Vollbeding#define jinit_arith_decoder	jIADecoder
31936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jinit_inverse_dct	jIIDCT
32036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jinit_upsampler		jIUpsampler
32136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jinit_color_deconverter	jIDColor
32236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jinit_1pass_quantizer	jI1Quant
32336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jinit_2pass_quantizer	jI2Quant
32436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jinit_merged_upsampler	jIMUpsampler
32536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jinit_memory_mgr	jIMemMgr
32636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jdiv_round_up		jDivRound
32736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jround_up		jRound
32836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jcopy_sample_rows	jCopySamples
32936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jcopy_block_row		jCopyBlocks
33036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#define jzero_far		jZeroFar
331bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane#define jpeg_zigzag_order	jZIGTable
332bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane#define jpeg_natural_order	jZAGTable
33336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif /* NEED_SHORT_EXTERNAL_NAMES */
33436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
33536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
33636a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Compression module initialization routines */
337489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_compress_master JPP((j_compress_ptr cinfo));
338489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_c_master_control JPP((j_compress_ptr cinfo,
339489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane					 boolean transcode_only));
340489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_c_main_controller JPP((j_compress_ptr cinfo,
341489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane					  boolean need_full_buffer));
342489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_c_prep_controller JPP((j_compress_ptr cinfo,
343489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane					  boolean need_full_buffer));
344489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_c_coef_controller JPP((j_compress_ptr cinfo,
345489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane					  boolean need_full_buffer));
346489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_color_converter JPP((j_compress_ptr cinfo));
347489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_downsampler JPP((j_compress_ptr cinfo));
348489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_forward_dct JPP((j_compress_ptr cinfo));
349489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_huff_encoder JPP((j_compress_ptr cinfo));
3501e247ac854f8e33682bcfea475f6bccc42377208Guido VollbedingEXTERN(void) jinit_arith_encoder JPP((j_compress_ptr cinfo));
351489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_marker_writer JPP((j_compress_ptr cinfo));
35236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Decompression module initialization routines */
353489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_master_decompress JPP((j_decompress_ptr cinfo));
354489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_d_main_controller JPP((j_decompress_ptr cinfo,
355489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane					  boolean need_full_buffer));
356489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_d_coef_controller JPP((j_decompress_ptr cinfo,
357489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane					  boolean need_full_buffer));
358489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_d_post_controller JPP((j_decompress_ptr cinfo,
359489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane					  boolean need_full_buffer));
360489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_input_controller JPP((j_decompress_ptr cinfo));
361489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_marker_reader JPP((j_decompress_ptr cinfo));
362489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_huff_decoder JPP((j_decompress_ptr cinfo));
3631e247ac854f8e33682bcfea475f6bccc42377208Guido VollbedingEXTERN(void) jinit_arith_decoder JPP((j_decompress_ptr cinfo));
364489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_inverse_dct JPP((j_decompress_ptr cinfo));
365489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_upsampler JPP((j_decompress_ptr cinfo));
366489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_color_deconverter JPP((j_decompress_ptr cinfo));
367489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_1pass_quantizer JPP((j_decompress_ptr cinfo));
368489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_2pass_quantizer JPP((j_decompress_ptr cinfo));
369489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_merged_upsampler JPP((j_decompress_ptr cinfo));
37036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Memory manager initialization */
371489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jinit_memory_mgr JPP((j_common_ptr cinfo));
37236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
37336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Utility routines in jutils.c */
374489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(long) jdiv_round_up JPP((long a, long b));
375489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(long) jround_up JPP((long a, long b));
376489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row,
377489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane				    JSAMPARRAY output_array, int dest_row,
378489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane				    int num_rows, JDIMENSION num_cols));
379489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jcopy_block_row JPP((JBLOCKROW input_row, JBLOCKROW output_row,
380489583f5165e05d37302e8eeec58104ea0109127Thomas G. Lane				  JDIMENSION num_blocks));
381489583f5165e05d37302e8eeec58104ea0109127Thomas G. LaneEXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero));
382bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Lane/* Constant tables in jutils.c */
3835ead57a34a398aa798f35bd7a6abad19b2e453e2Thomas G. Lane#if 0				/* This table is not actually needed in v6a */
384bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Laneextern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */
3855ead57a34a398aa798f35bd7a6abad19b2e453e2Thomas G. Lane#endif
386bc79e0680a45d1ca330d690dae0340c8e17ab5e3Thomas G. Laneextern const int jpeg_natural_order[]; /* zigzag coef order to natural order */
38736a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
38836a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane/* Suppress undefined-structure complaints if necessary. */
38936a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane
39036a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifdef INCOMPLETE_TYPES_BROKEN
39136a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#ifndef AM_MEMORY_MANAGER	/* only jmemmgr.c defines these */
39236a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanestruct jvirt_sarray_control { long dummy; };
39336a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lanestruct jvirt_barray_control { long dummy; };
39436a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif
39536a4ccccd33f5cc9df62949554af87129ced7f84Thomas G. Lane#endif /* INCOMPLETE_TYPES_BROKEN */
396