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

« back to all changes in this revision

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