~ubuntu-branches/ubuntu/precise/gwenview/precise-proposed

« back to all changes in this revision

Viewing changes to lib/libjpeg-80/jpegint.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2011-12-15 14:17:54 UTC
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: package-import@ubuntu.com-20111215141754-z043hyx69dulbggf
Tags: upstream-4.7.90
ImportĀ upstreamĀ versionĀ 4.7.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 * applications using the library shouldn't need to include this file.
12
12
 */
13
13
 
14
 
 
15
14
/* Declarations for both compression & decompression */
16
15
 
17
 
typedef enum {                  /* Operating modes for buffer controllers */
18
 
        JBUF_PASS_THRU,         /* Plain stripwise operation */
19
 
        /* Remaining modes require a full-image buffer to have been created */
20
 
        JBUF_SAVE_SOURCE,       /* Run source subobject only, save output */
21
 
        JBUF_CRANK_DEST,        /* Run dest subobject only, using saved data */
22
 
        JBUF_SAVE_AND_PASS      /* Run both subobjects, save output */
 
16
typedef enum {          /* Operating modes for buffer controllers */
 
17
    JBUF_PASS_THRU,     /* Plain stripwise operation */
 
18
    /* Remaining modes require a full-image buffer to have been created */
 
19
    JBUF_SAVE_SOURCE,   /* Run source subobject only, save output */
 
20
    JBUF_CRANK_DEST,    /* Run dest subobject only, using saved data */
 
21
    JBUF_SAVE_AND_PASS  /* Run both subobjects, save output */
23
22
} J_BUF_MODE;
24
23
 
25
24
/* Values of global_state field (jdapi.c has some dependencies on ordering!) */
26
 
#define CSTATE_START    100     /* after create_compress */
27
 
#define CSTATE_SCANNING 101     /* start_compress done, write_scanlines OK */
28
 
#define CSTATE_RAW_OK   102     /* start_compress done, write_raw_data OK */
29
 
#define CSTATE_WRCOEFS  103     /* jpeg_write_coefficients done */
30
 
#define DSTATE_START    200     /* after create_decompress */
31
 
#define DSTATE_INHEADER 201     /* reading header markers, no SOS yet */
32
 
#define DSTATE_READY    202     /* found SOS, ready for start_decompress */
33
 
#define DSTATE_PRELOAD  203     /* reading multiscan file in start_decompress*/
34
 
#define DSTATE_PRESCAN  204     /* performing dummy pass for 2-pass quant */
35
 
#define DSTATE_SCANNING 205     /* start_decompress done, read_scanlines OK */
36
 
#define DSTATE_RAW_OK   206     /* start_decompress done, read_raw_data OK */
37
 
#define DSTATE_BUFIMAGE 207     /* expecting jpeg_start_output */
38
 
#define DSTATE_BUFPOST  208     /* looking for SOS/EOI in jpeg_finish_output */
39
 
#define DSTATE_RDCOEFS  209     /* reading file in jpeg_read_coefficients */
40
 
#define DSTATE_STOPPING 210     /* looking for EOI in jpeg_finish_decompress */
41
 
 
 
25
#define CSTATE_START    100 /* after create_compress */
 
26
#define CSTATE_SCANNING 101 /* start_compress done, write_scanlines OK */
 
27
#define CSTATE_RAW_OK   102 /* start_compress done, write_raw_data OK */
 
28
#define CSTATE_WRCOEFS  103 /* jpeg_write_coefficients done */
 
29
#define DSTATE_START    200 /* after create_decompress */
 
30
#define DSTATE_INHEADER 201 /* reading header markers, no SOS yet */
 
31
#define DSTATE_READY    202 /* found SOS, ready for start_decompress */
 
32
#define DSTATE_PRELOAD  203 /* reading multiscan file in start_decompress*/
 
33
#define DSTATE_PRESCAN  204 /* performing dummy pass for 2-pass quant */
 
34
#define DSTATE_SCANNING 205 /* start_decompress done, read_scanlines OK */
 
35
#define DSTATE_RAW_OK   206 /* start_decompress done, read_raw_data OK */
 
36
#define DSTATE_BUFIMAGE 207 /* expecting jpeg_start_output */
 
37
#define DSTATE_BUFPOST  208 /* looking for SOS/EOI in jpeg_finish_output */
 
38
#define DSTATE_RDCOEFS  209 /* reading file in jpeg_read_coefficients */
 
39
#define DSTATE_STOPPING 210 /* looking for EOI in jpeg_finish_decompress */
42
40
 
43
41
/* Declarations for compression modules */
44
42
 
45
43
/* Master control module */
46
44
struct jpeg_comp_master {
47
 
  JMETHOD(void, prepare_for_pass, (j_compress_ptr cinfo));
48
 
  JMETHOD(void, pass_startup, (j_compress_ptr cinfo));
49
 
  JMETHOD(void, finish_pass, (j_compress_ptr cinfo));
 
45
    JMETHOD(void, prepare_for_pass, (j_compress_ptr cinfo));
 
46
    JMETHOD(void, pass_startup, (j_compress_ptr cinfo));
 
47
    JMETHOD(void, finish_pass, (j_compress_ptr cinfo));
50
48
 
51
 
  /* State variables made visible to other modules */
52
 
  boolean call_pass_startup;    /* True if pass_startup must be called */
53
 
  boolean is_last_pass;         /* True during last pass */
 
49
    /* State variables made visible to other modules */
 
50
    boolean call_pass_startup;    /* True if pass_startup must be called */
 
51
    boolean is_last_pass;     /* True during last pass */
54
52
};
55
53
 
56
54
/* Main buffer control (downsampled-data buffer) */
57
55
struct jpeg_c_main_controller {
58
 
  JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
59
 
  JMETHOD(void, process_data, (j_compress_ptr cinfo,
60
 
                               JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
61
 
                               JDIMENSION in_rows_avail));
 
56
    JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
 
57
    JMETHOD(void, process_data, (j_compress_ptr cinfo,
 
58
                                 JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
 
59
                                 JDIMENSION in_rows_avail));
62
60
};
63
61
 
64
62
/* Compression preprocessing (downsampling input buffer control) */
65
63
struct jpeg_c_prep_controller {
66
 
  JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
67
 
  JMETHOD(void, pre_process_data, (j_compress_ptr cinfo,
68
 
                                   JSAMPARRAY input_buf,
69
 
                                   JDIMENSION *in_row_ctr,
70
 
                                   JDIMENSION in_rows_avail,
71
 
                                   JSAMPIMAGE output_buf,
72
 
                                   JDIMENSION *out_row_group_ctr,
73
 
                                   JDIMENSION out_row_groups_avail));
 
64
    JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
 
65
    JMETHOD(void, pre_process_data, (j_compress_ptr cinfo,
 
66
                                     JSAMPARRAY input_buf,
 
67
                                     JDIMENSION *in_row_ctr,
 
68
                                     JDIMENSION in_rows_avail,
 
69
                                     JSAMPIMAGE output_buf,
 
70
                                     JDIMENSION *out_row_group_ctr,
 
71
                                     JDIMENSION out_row_groups_avail));
74
72
};
75
73
 
76
74
/* Coefficient buffer control */
77
75
struct jpeg_c_coef_controller {
78
 
  JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
79
 
  JMETHOD(boolean, compress_data, (j_compress_ptr cinfo,
80
 
                                   JSAMPIMAGE input_buf));
 
76
    JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
 
77
    JMETHOD(boolean, compress_data, (j_compress_ptr cinfo,
 
78
                                     JSAMPIMAGE input_buf));
81
79
};
82
80
 
83
81
/* Colorspace conversion */
84
82
struct jpeg_color_converter {
85
 
  JMETHOD(void, start_pass, (j_compress_ptr cinfo));
86
 
  JMETHOD(void, color_convert, (j_compress_ptr cinfo,
87
 
                                JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
88
 
                                JDIMENSION output_row, int num_rows));
 
83
    JMETHOD(void, start_pass, (j_compress_ptr cinfo));
 
84
    JMETHOD(void, color_convert, (j_compress_ptr cinfo,
 
85
                                  JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
 
86
                                  JDIMENSION output_row, int num_rows));
89
87
};
90
88
 
91
89
/* Downsampling */
92
90
struct jpeg_downsampler {
93
 
  JMETHOD(void, start_pass, (j_compress_ptr cinfo));
94
 
  JMETHOD(void, downsample, (j_compress_ptr cinfo,
95
 
                             JSAMPIMAGE input_buf, JDIMENSION in_row_index,
96
 
                             JSAMPIMAGE output_buf,
97
 
                             JDIMENSION out_row_group_index));
 
91
    JMETHOD(void, start_pass, (j_compress_ptr cinfo));
 
92
    JMETHOD(void, downsample, (j_compress_ptr cinfo,
 
93
                               JSAMPIMAGE input_buf, JDIMENSION in_row_index,
 
94
                               JSAMPIMAGE output_buf,
 
95
                               JDIMENSION out_row_group_index));
98
96
 
99
 
  boolean need_context_rows;    /* TRUE if need rows above & below */
 
97
    boolean need_context_rows;    /* TRUE if need rows above & below */
100
98
};
101
99
 
102
100
/* Forward DCT (also controls coefficient quantization) */
103
101
typedef JMETHOD(void, forward_DCT_ptr,
104
 
                (j_compress_ptr cinfo, jpeg_component_info * compptr,
105
 
                 JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
106
 
                 JDIMENSION start_row, JDIMENSION start_col,
107
 
                 JDIMENSION num_blocks));
 
102
                (j_compress_ptr cinfo, jpeg_component_info * compptr,
 
103
                 JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
 
104
                 JDIMENSION start_row, JDIMENSION start_col,
 
105
                 JDIMENSION num_blocks));
108
106
 
109
107
struct jpeg_forward_dct {
110
 
  JMETHOD(void, start_pass, (j_compress_ptr cinfo));
111
 
  /* It is useful to allow each component to have a separate FDCT method. */
112
 
  forward_DCT_ptr forward_DCT[MAX_COMPONENTS];
 
108
    JMETHOD(void, start_pass, (j_compress_ptr cinfo));
 
109
    /* It is useful to allow each component to have a separate FDCT method. */
 
110
    forward_DCT_ptr forward_DCT[MAX_COMPONENTS];
113
111
};
114
112
 
115
113
/* Entropy encoding */
116
114
struct jpeg_entropy_encoder {
117
 
  JMETHOD(void, start_pass, (j_compress_ptr cinfo, boolean gather_statistics));
118
 
  JMETHOD(boolean, encode_mcu, (j_compress_ptr cinfo, JBLOCKROW *MCU_data));
119
 
  JMETHOD(void, finish_pass, (j_compress_ptr cinfo));
 
115
    JMETHOD(void, start_pass, (j_compress_ptr cinfo, boolean gather_statistics));
 
116
    JMETHOD(boolean, encode_mcu, (j_compress_ptr cinfo, JBLOCKROW *MCU_data));
 
117
    JMETHOD(void, finish_pass, (j_compress_ptr cinfo));
120
118
};
121
119
 
122
120
/* Marker writing */
123
121
struct jpeg_marker_writer {
124
 
  JMETHOD(void, write_file_header, (j_compress_ptr cinfo));
125
 
  JMETHOD(void, write_frame_header, (j_compress_ptr cinfo));
126
 
  JMETHOD(void, write_scan_header, (j_compress_ptr cinfo));
127
 
  JMETHOD(void, write_file_trailer, (j_compress_ptr cinfo));
128
 
  JMETHOD(void, write_tables_only, (j_compress_ptr cinfo));
129
 
  /* These routines are exported to allow insertion of extra markers */
130
 
  /* Probably only COM and APPn markers should be written this way */
131
 
  JMETHOD(void, write_marker_header, (j_compress_ptr cinfo, int marker,
132
 
                                      unsigned int datalen));
133
 
  JMETHOD(void, write_marker_byte, (j_compress_ptr cinfo, int val));
 
122
    JMETHOD(void, write_file_header, (j_compress_ptr cinfo));
 
123
    JMETHOD(void, write_frame_header, (j_compress_ptr cinfo));
 
124
    JMETHOD(void, write_scan_header, (j_compress_ptr cinfo));
 
125
    JMETHOD(void, write_file_trailer, (j_compress_ptr cinfo));
 
126
    JMETHOD(void, write_tables_only, (j_compress_ptr cinfo));
 
127
    /* These routines are exported to allow insertion of extra markers */
 
128
    /* Probably only COM and APPn markers should be written this way */
 
129
    JMETHOD(void, write_marker_header, (j_compress_ptr cinfo, int marker,
 
130
                                        unsigned int datalen));
 
131
    JMETHOD(void, write_marker_byte, (j_compress_ptr cinfo, int val));
134
132
};
135
133
 
136
 
 
137
134
/* Declarations for decompression modules */
138
135
 
139
136
/* Master control module */
140
137
struct jpeg_decomp_master {
141
 
  JMETHOD(void, prepare_for_output_pass, (j_decompress_ptr cinfo));
142
 
  JMETHOD(void, finish_output_pass, (j_decompress_ptr cinfo));
 
138
    JMETHOD(void, prepare_for_output_pass, (j_decompress_ptr cinfo));
 
139
    JMETHOD(void, finish_output_pass, (j_decompress_ptr cinfo));
143
140
 
144
 
  /* State variables made visible to other modules */
145
 
  boolean is_dummy_pass;        /* True during 1st pass for 2-pass quant */
 
141
    /* State variables made visible to other modules */
 
142
    boolean is_dummy_pass;    /* True during 1st pass for 2-pass quant */
146
143
};
147
144
 
148
145
/* Input control module */
149
146
struct jpeg_input_controller {
150
 
  JMETHOD(int, consume_input, (j_decompress_ptr cinfo));
151
 
  JMETHOD(void, reset_input_controller, (j_decompress_ptr cinfo));
152
 
  JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo));
153
 
  JMETHOD(void, finish_input_pass, (j_decompress_ptr cinfo));
 
147
    JMETHOD(int, consume_input, (j_decompress_ptr cinfo));
 
148
    JMETHOD(void, reset_input_controller, (j_decompress_ptr cinfo));
 
149
    JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo));
 
150
    JMETHOD(void, finish_input_pass, (j_decompress_ptr cinfo));
154
151
 
155
 
  /* State variables made visible to other modules */
156
 
  boolean has_multiple_scans;   /* True if file has multiple scans */
157
 
  boolean eoi_reached;          /* True when EOI has been consumed */
 
152
    /* State variables made visible to other modules */
 
153
    boolean has_multiple_scans;   /* True if file has multiple scans */
 
154
    boolean eoi_reached;      /* True when EOI has been consumed */
158
155
};
159
156
 
160
157
/* Main buffer control (downsampled-data buffer) */
161
158
struct jpeg_d_main_controller {
162
 
  JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode));
163
 
  JMETHOD(void, process_data, (j_decompress_ptr cinfo,
164
 
                               JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
165
 
                               JDIMENSION out_rows_avail));
 
159
    JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode));
 
160
    JMETHOD(void, process_data, (j_decompress_ptr cinfo,
 
161
                                 JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
 
162
                                 JDIMENSION out_rows_avail));
166
163
};
167
164
 
168
165
/* Coefficient buffer control */
169
166
struct jpeg_d_coef_controller {
170
 
  JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo));
171
 
  JMETHOD(int, consume_data, (j_decompress_ptr cinfo));
172
 
  JMETHOD(void, start_output_pass, (j_decompress_ptr cinfo));
173
 
  JMETHOD(int, decompress_data, (j_decompress_ptr cinfo,
174
 
                                 JSAMPIMAGE output_buf));
175
 
  /* Pointer to array of coefficient virtual arrays, or NULL if none */
176
 
  jvirt_barray_ptr *coef_arrays;
 
167
    JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo));
 
168
    JMETHOD(int, consume_data, (j_decompress_ptr cinfo));
 
169
    JMETHOD(void, start_output_pass, (j_decompress_ptr cinfo));
 
170
    JMETHOD(int, decompress_data, (j_decompress_ptr cinfo,
 
171
                                   JSAMPIMAGE output_buf));
 
172
    /* Pointer to array of coefficient virtual arrays, or NULL if none */
 
173
    jvirt_barray_ptr *coef_arrays;
177
174
};
178
175
 
179
176
/* Decompression postprocessing (color quantization buffer control) */
180
177
struct jpeg_d_post_controller {
181
 
  JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode));
182
 
  JMETHOD(void, post_process_data, (j_decompress_ptr cinfo,
183
 
                                    JSAMPIMAGE input_buf,
184
 
                                    JDIMENSION *in_row_group_ctr,
185
 
                                    JDIMENSION in_row_groups_avail,
186
 
                                    JSAMPARRAY output_buf,
187
 
                                    JDIMENSION *out_row_ctr,
188
 
                                    JDIMENSION out_rows_avail));
 
178
    JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode));
 
179
    JMETHOD(void, post_process_data, (j_decompress_ptr cinfo,
 
180
                                      JSAMPIMAGE input_buf,
 
181
                                      JDIMENSION *in_row_group_ctr,
 
182
                                      JDIMENSION in_row_groups_avail,
 
183
                                      JSAMPARRAY output_buf,
 
184
                                      JDIMENSION *out_row_ctr,
 
185
                                      JDIMENSION out_rows_avail));
189
186
};
190
187
 
191
188
/* Marker reading & parsing */
192
189
struct jpeg_marker_reader {
193
 
  JMETHOD(void, reset_marker_reader, (j_decompress_ptr cinfo));
194
 
  /* Read markers until SOS or EOI.
195
 
   * Returns same codes as are defined for jpeg_consume_input:
196
 
   * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI.
197
 
   */
198
 
  JMETHOD(int, read_markers, (j_decompress_ptr cinfo));
199
 
  /* Read a restart marker --- exported for use by entropy decoder only */
200
 
  jpeg_marker_parser_method read_restart_marker;
 
190
    JMETHOD(void, reset_marker_reader, (j_decompress_ptr cinfo));
 
191
    /* Read markers until SOS or EOI.
 
192
     * Returns same codes as are defined for jpeg_consume_input:
 
193
     * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI.
 
194
     */
 
195
    JMETHOD(int, read_markers, (j_decompress_ptr cinfo));
 
196
    /* Read a restart marker --- exported for use by entropy decoder only */
 
197
    jpeg_marker_parser_method read_restart_marker;
201
198
 
202
 
  /* State of marker reader --- nominally internal, but applications
203
 
   * supplying COM or APPn handlers might like to know the state.
204
 
   */
205
 
  boolean saw_SOI;              /* found SOI? */
206
 
  boolean saw_SOF;              /* found SOF? */
207
 
  int next_restart_num;         /* next restart number expected (0-7) */
208
 
  unsigned int discarded_bytes; /* # of bytes skipped looking for a marker */
 
199
    /* State of marker reader --- nominally internal, but applications
 
200
     * supplying COM or APPn handlers might like to know the state.
 
201
     */
 
202
    boolean saw_SOI;      /* found SOI? */
 
203
    boolean saw_SOF;      /* found SOF? */
 
204
    int next_restart_num;     /* next restart number expected (0-7) */
 
205
    unsigned int discarded_bytes; /* # of bytes skipped looking for a marker */
209
206
};
210
207
 
211
208
/* Entropy decoding */
212
209
struct jpeg_entropy_decoder {
213
 
  JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
214
 
  JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo,
215
 
                                JBLOCKROW *MCU_data));
 
210
    JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
 
211
    JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo,
 
212
                                  JBLOCKROW *MCU_data));
216
213
};
217
214
 
218
215
/* Inverse DCT (also performs dequantization) */
219
216
typedef JMETHOD(void, inverse_DCT_method_ptr,
220
 
                (j_decompress_ptr cinfo, jpeg_component_info * compptr,
221
 
                 JCOEFPTR coef_block,
222
 
                 JSAMPARRAY output_buf, JDIMENSION output_col));
 
217
                (j_decompress_ptr cinfo, jpeg_component_info * compptr,
 
218
                 JCOEFPTR coef_block,
 
219
                 JSAMPARRAY output_buf, JDIMENSION output_col));
223
220
 
224
221
struct jpeg_inverse_dct {
225
 
  JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
226
 
  /* It is useful to allow each component to have a separate IDCT method. */
227
 
  inverse_DCT_method_ptr inverse_DCT[MAX_COMPONENTS];
 
222
    JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
 
223
    /* It is useful to allow each component to have a separate IDCT method. */
 
224
    inverse_DCT_method_ptr inverse_DCT[MAX_COMPONENTS];
228
225
};
229
226
 
230
227
/* Upsampling (note that upsampler must also call color converter) */
231
228
struct jpeg_upsampler {
232
 
  JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
233
 
  JMETHOD(void, upsample, (j_decompress_ptr cinfo,
234
 
                           JSAMPIMAGE input_buf,
235
 
                           JDIMENSION *in_row_group_ctr,
236
 
                           JDIMENSION in_row_groups_avail,
237
 
                           JSAMPARRAY output_buf,
238
 
                           JDIMENSION *out_row_ctr,
239
 
                           JDIMENSION out_rows_avail));
 
229
    JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
 
230
    JMETHOD(void, upsample, (j_decompress_ptr cinfo,
 
231
                             JSAMPIMAGE input_buf,
 
232
                             JDIMENSION *in_row_group_ctr,
 
233
                             JDIMENSION in_row_groups_avail,
 
234
                             JSAMPARRAY output_buf,
 
235
                             JDIMENSION *out_row_ctr,
 
236
                             JDIMENSION out_rows_avail));
240
237
 
241
 
  boolean need_context_rows;    /* TRUE if need rows above & below */
 
238
    boolean need_context_rows;    /* TRUE if need rows above & below */
242
239
};
243
240
 
244
241
/* Colorspace conversion */
245
242
struct jpeg_color_deconverter {
246
 
  JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
247
 
  JMETHOD(void, color_convert, (j_decompress_ptr cinfo,
248
 
                                JSAMPIMAGE input_buf, JDIMENSION input_row,
249
 
                                JSAMPARRAY output_buf, int num_rows));
 
243
    JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
 
244
    JMETHOD(void, color_convert, (j_decompress_ptr cinfo,
 
245
                                  JSAMPIMAGE input_buf, JDIMENSION input_row,
 
246
                                  JSAMPARRAY output_buf, int num_rows));
250
247
};
251
248
 
252
249
/* Color quantization or color precision reduction */
253
250
struct jpeg_color_quantizer {
254
 
  JMETHOD(void, start_pass, (j_decompress_ptr cinfo, boolean is_pre_scan));
255
 
  JMETHOD(void, color_quantize, (j_decompress_ptr cinfo,
256
 
                                 JSAMPARRAY input_buf, JSAMPARRAY output_buf,
257
 
                                 int num_rows));
258
 
  JMETHOD(void, finish_pass, (j_decompress_ptr cinfo));
259
 
  JMETHOD(void, new_color_map, (j_decompress_ptr cinfo));
 
251
    JMETHOD(void, start_pass, (j_decompress_ptr cinfo, boolean is_pre_scan));
 
252
    JMETHOD(void, color_quantize, (j_decompress_ptr cinfo,
 
253
                                   JSAMPARRAY input_buf, JSAMPARRAY output_buf,
 
254
                                   int num_rows));
 
255
    JMETHOD(void, finish_pass, (j_decompress_ptr cinfo));
 
256
    JMETHOD(void, new_color_map, (j_decompress_ptr cinfo));
260
257
};
261
258
 
262
 
 
263
259
/* Miscellaneous useful macros */
264
260
 
265
261
#undef MAX
266
 
#define MAX(a,b)        ((a) > (b) ? (a) : (b))
 
262
#define MAX(a,b)    ((a) > (b) ? (a) : (b))
267
263
#undef MIN
268
 
#define MIN(a,b)        ((a) < (b) ? (a) : (b))
269
 
 
 
264
#define MIN(a,b)    ((a) < (b) ? (a) : (b))
270
265
 
271
266
/* We assume that right shift corresponds to signed division by 2 with
272
267
 * rounding towards minus infinity.  This is correct for typical "arithmetic
279
274
 */
280
275
 
281
276
#ifdef RIGHT_SHIFT_IS_UNSIGNED
282
 
#define SHIFT_TEMPS     INT32 shift_temp;
 
277
#define SHIFT_TEMPS INT32 shift_temp;
283
278
#define RIGHT_SHIFT(x,shft)  \
284
 
        ((shift_temp = (x)) < 0 ? \
285
 
         (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \
286
 
         (shift_temp >> (shft)))
 
279
    ((shift_temp = (x)) < 0 ? \
 
280
     (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \
 
281
     (shift_temp >> (shft)))
287
282
#else
288
283
#define SHIFT_TEMPS
289
 
#define RIGHT_SHIFT(x,shft)     ((x) >> (shft))
 
284
#define RIGHT_SHIFT(x,shft) ((x) >> (shft))
290
285
#endif
291
286
 
292
 
 
293
287
/* Short forms of external names for systems with brain-damaged linkers. */
294
288
 
295
289
#ifdef NEED_SHORT_EXTERNAL_NAMES
296
 
#define jinit_compress_master   jICompress
297
 
#define jinit_c_master_control  jICMaster
298
 
#define jinit_c_main_controller jICMainC
299
 
#define jinit_c_prep_controller jICPrepC
300
 
#define jinit_c_coef_controller jICCoefC
301
 
#define jinit_color_converter   jICColor
302
 
#define jinit_downsampler       jIDownsampler
303
 
#define jinit_forward_dct       jIFDCT
304
 
#define jinit_huff_encoder      jIHEncoder
305
 
#define jinit_arith_encoder     jIAEncoder
306
 
#define jinit_marker_writer     jIMWriter
307
 
#define jinit_master_decompress jIDMaster
308
 
#define jinit_d_main_controller jIDMainC
309
 
#define jinit_d_coef_controller jIDCoefC
310
 
#define jinit_d_post_controller jIDPostC
311
 
#define jinit_input_controller  jIInCtlr
312
 
#define jinit_marker_reader     jIMReader
313
 
#define jinit_huff_decoder      jIHDecoder
314
 
#define jinit_arith_decoder     jIADecoder
315
 
#define jinit_inverse_dct       jIIDCT
316
 
#define jinit_upsampler         jIUpsampler
317
 
#define jinit_color_deconverter jIDColor
318
 
#define jinit_1pass_quantizer   jI1Quant
319
 
#define jinit_2pass_quantizer   jI2Quant
320
 
#define jinit_merged_upsampler  jIMUpsampler
321
 
#define jinit_memory_mgr        jIMemMgr
322
 
#define jdiv_round_up           jDivRound
323
 
#define jround_up               jRound
324
 
#define jcopy_sample_rows       jCopySamples
325
 
#define jcopy_block_row         jCopyBlocks
326
 
#define jzero_far               jZeroFar
327
 
#define jpeg_zigzag_order       jZIGTable
328
 
#define jpeg_natural_order      jZAGTable
329
 
#define jpeg_natural_order7     jZAGTable7
330
 
#define jpeg_natural_order6     jZAGTable6
331
 
#define jpeg_natural_order5     jZAGTable5
332
 
#define jpeg_natural_order4     jZAGTable4
333
 
#define jpeg_natural_order3     jZAGTable3
334
 
#define jpeg_natural_order2     jZAGTable2
335
 
#define jpeg_aritab             jAriTab
 
290
#define jinit_compress_master   jICompress
 
291
#define jinit_c_master_control  jICMaster
 
292
#define jinit_c_main_controller jICMainC
 
293
#define jinit_c_prep_controller jICPrepC
 
294
#define jinit_c_coef_controller jICCoefC
 
295
#define jinit_color_converter   jICColor
 
296
#define jinit_downsampler   jIDownsampler
 
297
#define jinit_forward_dct   jIFDCT
 
298
#define jinit_huff_encoder  jIHEncoder
 
299
#define jinit_arith_encoder jIAEncoder
 
300
#define jinit_marker_writer jIMWriter
 
301
#define jinit_master_decompress jIDMaster
 
302
#define jinit_d_main_controller jIDMainC
 
303
#define jinit_d_coef_controller jIDCoefC
 
304
#define jinit_d_post_controller jIDPostC
 
305
#define jinit_input_controller  jIInCtlr
 
306
#define jinit_marker_reader jIMReader
 
307
#define jinit_huff_decoder  jIHDecoder
 
308
#define jinit_arith_decoder jIADecoder
 
309
#define jinit_inverse_dct   jIIDCT
 
310
#define jinit_upsampler     jIUpsampler
 
311
#define jinit_color_deconverter jIDColor
 
312
#define jinit_1pass_quantizer   jI1Quant
 
313
#define jinit_2pass_quantizer   jI2Quant
 
314
#define jinit_merged_upsampler  jIMUpsampler
 
315
#define jinit_memory_mgr    jIMemMgr
 
316
#define jdiv_round_up       jDivRound
 
317
#define jround_up       jRound
 
318
#define jcopy_sample_rows   jCopySamples
 
319
#define jcopy_block_row     jCopyBlocks
 
320
#define jzero_far       jZeroFar
 
321
#define jpeg_zigzag_order   jZIGTable
 
322
#define jpeg_natural_order  jZAGTable
 
323
#define jpeg_natural_order7 jZAGTable7
 
324
#define jpeg_natural_order6 jZAGTable6
 
325
#define jpeg_natural_order5 jZAGTable5
 
326
#define jpeg_natural_order4 jZAGTable4
 
327
#define jpeg_natural_order3 jZAGTable3
 
328
#define jpeg_natural_order2 jZAGTable2
 
329
#define jpeg_aritab     jAriTab
336
330
#endif /* NEED_SHORT_EXTERNAL_NAMES */
337
331
 
338
 
 
339
332
/* Compression module initialization routines */
340
333
EXTERN(void) jinit_compress_master JPP((j_compress_ptr cinfo));
341
334
EXTERN(void) jinit_c_master_control JPP((j_compress_ptr cinfo,
342
 
                                         boolean transcode_only));
 
335
                                        boolean transcode_only));
343
336
EXTERN(void) jinit_c_main_controller JPP((j_compress_ptr cinfo,
344
 
                                          boolean need_full_buffer));
 
337
        boolean need_full_buffer));
345
338
EXTERN(void) jinit_c_prep_controller JPP((j_compress_ptr cinfo,
346
 
                                          boolean need_full_buffer));
 
339
        boolean need_full_buffer));
347
340
EXTERN(void) jinit_c_coef_controller JPP((j_compress_ptr cinfo,
348
 
                                          boolean need_full_buffer));
 
341
        boolean need_full_buffer));
349
342
EXTERN(void) jinit_color_converter JPP((j_compress_ptr cinfo));
350
343
EXTERN(void) jinit_downsampler JPP((j_compress_ptr cinfo));
351
344
EXTERN(void) jinit_forward_dct JPP((j_compress_ptr cinfo));
355
348
/* Decompression module initialization routines */
356
349
EXTERN(void) jinit_master_decompress JPP((j_decompress_ptr cinfo));
357
350
EXTERN(void) jinit_d_main_controller JPP((j_decompress_ptr cinfo,
358
 
                                          boolean need_full_buffer));
 
351
        boolean need_full_buffer));
359
352
EXTERN(void) jinit_d_coef_controller JPP((j_decompress_ptr cinfo,
360
 
                                          boolean need_full_buffer));
 
353
        boolean need_full_buffer));
361
354
EXTERN(void) jinit_d_post_controller JPP((j_decompress_ptr cinfo,
362
 
                                          boolean need_full_buffer));
 
355
        boolean need_full_buffer));
363
356
EXTERN(void) jinit_input_controller JPP((j_decompress_ptr cinfo));
364
357
EXTERN(void) jinit_marker_reader JPP((j_decompress_ptr cinfo));
365
358
EXTERN(void) jinit_huff_decoder JPP((j_decompress_ptr cinfo));
377
370
EXTERN(long) jdiv_round_up JPP((long a, long b));
378
371
EXTERN(long) jround_up JPP((long a, long b));
379
372
EXTERN(void) jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row,
380
 
                                    JSAMPARRAY output_array, int dest_row,
381
 
                                    int num_rows, JDIMENSION num_cols));
 
373
                                    JSAMPARRAY output_array, int dest_row,
 
374
                                    int num_rows, JDIMENSION num_cols));
382
375
EXTERN(void) jcopy_block_row JPP((JBLOCKROW input_row, JBLOCKROW output_row,
383
 
                                  JDIMENSION num_blocks));
 
376
                                  JDIMENSION num_blocks));
384
377
EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero));
385
378
/* Constant tables in jutils.c */
386
 
#if 0                           /* This table is not actually needed in v6a */
 
379
#if 0               /* This table is not actually needed in v6a */
387
380
extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */
388
381
#endif
389
382
extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */
400
393
/* Suppress undefined-structure complaints if necessary. */
401
394
 
402
395
#ifdef INCOMPLETE_TYPES_BROKEN
403
 
#ifndef AM_MEMORY_MANAGER       /* only jmemmgr.c defines these */
404
 
struct jvirt_sarray_control { long dummy; };
405
 
struct jvirt_barray_control { long dummy; };
 
396
#ifndef AM_MEMORY_MANAGER   /* only jmemmgr.c defines these */
 
397
struct jvirt_sarray_control {
 
398
    long dummy;
 
399
};
 
400
struct jvirt_barray_control {
 
401
    long dummy;
 
402
};
406
403
#endif
407
404
#endif /* INCOMPLETE_TYPES_BROKEN */