diff options
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jdcoefct.c')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jdcoefct.c | 1482 |
1 files changed, 741 insertions, 741 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jdcoefct.c b/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jdcoefct.c index 75ee51f..ed02fc3 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jdcoefct.c +++ b/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jdcoefct.c | |||
@@ -1,741 +1,741 @@ | |||
1 | /* | 1 | /* |
2 | * jdcoefct.c | 2 | * jdcoefct.c |
3 | * | 3 | * |
4 | * Copyright (C) 1994-1997, Thomas G. Lane. | 4 | * Copyright (C) 1994-1997, Thomas G. Lane. |
5 | * Modified 2002-2011 by Guido Vollbeding. | 5 | * Modified 2002-2011 by Guido Vollbeding. |
6 | * This file is part of the Independent JPEG Group's software. | 6 | * This file is part of the Independent JPEG Group's software. |
7 | * For conditions of distribution and use, see the accompanying README file. | 7 | * For conditions of distribution and use, see the accompanying README file. |
8 | * | 8 | * |
9 | * This file contains the coefficient buffer controller for decompression. | 9 | * This file contains the coefficient buffer controller for decompression. |
10 | * This controller is the top level of the JPEG decompressor proper. | 10 | * This controller is the top level of the JPEG decompressor proper. |
11 | * The coefficient buffer lies between entropy decoding and inverse-DCT steps. | 11 | * The coefficient buffer lies between entropy decoding and inverse-DCT steps. |
12 | * | 12 | * |
13 | * In buffered-image mode, this controller is the interface between | 13 | * In buffered-image mode, this controller is the interface between |
14 | * input-oriented processing and output-oriented processing. | 14 | * input-oriented processing and output-oriented processing. |
15 | * Also, the input side (only) is used when reading a file for transcoding. | 15 | * Also, the input side (only) is used when reading a file for transcoding. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #define JPEG_INTERNALS | 18 | #define JPEG_INTERNALS |
19 | #include "jinclude.h" | 19 | #include "jinclude.h" |
20 | #include "jpeglib.h" | 20 | #include "jpeglib.h" |
21 | 21 | ||
22 | /* Block smoothing is only applicable for progressive JPEG, so: */ | 22 | /* Block smoothing is only applicable for progressive JPEG, so: */ |
23 | #ifndef D_PROGRESSIVE_SUPPORTED | 23 | #ifndef D_PROGRESSIVE_SUPPORTED |
24 | #undef BLOCK_SMOOTHING_SUPPORTED | 24 | #undef BLOCK_SMOOTHING_SUPPORTED |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | /* Private buffer controller object */ | 27 | /* Private buffer controller object */ |
28 | 28 | ||
29 | typedef struct { | 29 | typedef struct { |
30 | struct jpeg_d_coef_controller pub; /* public fields */ | 30 | struct jpeg_d_coef_controller pub; /* public fields */ |
31 | 31 | ||
32 | /* These variables keep track of the current location of the input side. */ | 32 | /* These variables keep track of the current location of the input side. */ |
33 | /* cinfo->input_iMCU_row is also used for this. */ | 33 | /* cinfo->input_iMCU_row is also used for this. */ |
34 | JDIMENSION MCU_ctr; /* counts MCUs processed in current row */ | 34 | JDIMENSION MCU_ctr; /* counts MCUs processed in current row */ |
35 | int MCU_vert_offset; /* counts MCU rows within iMCU row */ | 35 | int MCU_vert_offset; /* counts MCU rows within iMCU row */ |
36 | int MCU_rows_per_iMCU_row; /* number of such rows needed */ | 36 | int MCU_rows_per_iMCU_row; /* number of such rows needed */ |
37 | 37 | ||
38 | /* The output side's location is represented by cinfo->output_iMCU_row. */ | 38 | /* The output side's location is represented by cinfo->output_iMCU_row. */ |
39 | 39 | ||
40 | /* In single-pass modes, it's sufficient to buffer just one MCU. | 40 | /* In single-pass modes, it's sufficient to buffer just one MCU. |
41 | * We allocate a workspace of D_MAX_BLOCKS_IN_MCU coefficient blocks, | 41 | * We allocate a workspace of D_MAX_BLOCKS_IN_MCU coefficient blocks, |
42 | * and let the entropy decoder write into that workspace each time. | 42 | * and let the entropy decoder write into that workspace each time. |
43 | * (On 80x86, the workspace is FAR even though it's not really very big; | 43 | * (On 80x86, the workspace is FAR even though it's not really very big; |
44 | * this is to keep the module interfaces unchanged when a large coefficient | 44 | * this is to keep the module interfaces unchanged when a large coefficient |
45 | * buffer is necessary.) | 45 | * buffer is necessary.) |
46 | * In multi-pass modes, this array points to the current MCU's blocks | 46 | * In multi-pass modes, this array points to the current MCU's blocks |
47 | * within the virtual arrays; it is used only by the input side. | 47 | * within the virtual arrays; it is used only by the input side. |
48 | */ | 48 | */ |
49 | JBLOCKROW MCU_buffer[D_MAX_BLOCKS_IN_MCU]; | 49 | JBLOCKROW MCU_buffer[D_MAX_BLOCKS_IN_MCU]; |
50 | 50 | ||
51 | #ifdef D_MULTISCAN_FILES_SUPPORTED | 51 | #ifdef D_MULTISCAN_FILES_SUPPORTED |
52 | /* In multi-pass modes, we need a virtual block array for each component. */ | 52 | /* In multi-pass modes, we need a virtual block array for each component. */ |
53 | jvirt_barray_ptr whole_image[MAX_COMPONENTS]; | 53 | jvirt_barray_ptr whole_image[MAX_COMPONENTS]; |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | #ifdef BLOCK_SMOOTHING_SUPPORTED | 56 | #ifdef BLOCK_SMOOTHING_SUPPORTED |
57 | /* When doing block smoothing, we latch coefficient Al values here */ | 57 | /* When doing block smoothing, we latch coefficient Al values here */ |
58 | int * coef_bits_latch; | 58 | int * coef_bits_latch; |
59 | #define SAVED_COEFS 6 /* we save coef_bits[0..5] */ | 59 | #define SAVED_COEFS 6 /* we save coef_bits[0..5] */ |
60 | #endif | 60 | #endif |
61 | } my_coef_controller; | 61 | } my_coef_controller; |
62 | 62 | ||
63 | typedef my_coef_controller * my_coef_ptr; | 63 | typedef my_coef_controller * my_coef_ptr; |
64 | 64 | ||
65 | /* Forward declarations */ | 65 | /* Forward declarations */ |
66 | METHODDEF(int) decompress_onepass | 66 | METHODDEF(int) decompress_onepass |
67 | JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); | 67 | JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); |
68 | #ifdef D_MULTISCAN_FILES_SUPPORTED | 68 | #ifdef D_MULTISCAN_FILES_SUPPORTED |
69 | METHODDEF(int) decompress_data | 69 | METHODDEF(int) decompress_data |
70 | JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); | 70 | JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); |
71 | #endif | 71 | #endif |
72 | #ifdef BLOCK_SMOOTHING_SUPPORTED | 72 | #ifdef BLOCK_SMOOTHING_SUPPORTED |
73 | LOCAL(boolean) smoothing_ok JPP((j_decompress_ptr cinfo)); | 73 | LOCAL(boolean) smoothing_ok JPP((j_decompress_ptr cinfo)); |
74 | METHODDEF(int) decompress_smooth_data | 74 | METHODDEF(int) decompress_smooth_data |
75 | JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); | 75 | JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); |
76 | #endif | 76 | #endif |
77 | 77 | ||
78 | 78 | ||
79 | LOCAL(void) | 79 | LOCAL(void) |
80 | start_iMCU_row (j_decompress_ptr cinfo) | 80 | start_iMCU_row (j_decompress_ptr cinfo) |
81 | /* Reset within-iMCU-row counters for a new row (input side) */ | 81 | /* Reset within-iMCU-row counters for a new row (input side) */ |
82 | { | 82 | { |
83 | my_coef_ptr coef = (my_coef_ptr) cinfo->coef; | 83 | my_coef_ptr coef = (my_coef_ptr) cinfo->coef; |
84 | 84 | ||
85 | /* In an interleaved scan, an MCU row is the same as an iMCU row. | 85 | /* In an interleaved scan, an MCU row is the same as an iMCU row. |
86 | * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows. | 86 | * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows. |
87 | * But at the bottom of the image, process only what's left. | 87 | * But at the bottom of the image, process only what's left. |
88 | */ | 88 | */ |
89 | if (cinfo->comps_in_scan > 1) { | 89 | if (cinfo->comps_in_scan > 1) { |
90 | coef->MCU_rows_per_iMCU_row = 1; | 90 | coef->MCU_rows_per_iMCU_row = 1; |
91 | } else { | 91 | } else { |
92 | if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1)) | 92 | if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1)) |
93 | coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor; | 93 | coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor; |
94 | else | 94 | else |
95 | coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height; | 95 | coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height; |
96 | } | 96 | } |
97 | 97 | ||
98 | coef->MCU_ctr = 0; | 98 | coef->MCU_ctr = 0; |
99 | coef->MCU_vert_offset = 0; | 99 | coef->MCU_vert_offset = 0; |
100 | } | 100 | } |
101 | 101 | ||
102 | 102 | ||
103 | /* | 103 | /* |
104 | * Initialize for an input processing pass. | 104 | * Initialize for an input processing pass. |
105 | */ | 105 | */ |
106 | 106 | ||
107 | METHODDEF(void) | 107 | METHODDEF(void) |
108 | start_input_pass (j_decompress_ptr cinfo) | 108 | start_input_pass (j_decompress_ptr cinfo) |
109 | { | 109 | { |
110 | cinfo->input_iMCU_row = 0; | 110 | cinfo->input_iMCU_row = 0; |
111 | start_iMCU_row(cinfo); | 111 | start_iMCU_row(cinfo); |
112 | } | 112 | } |
113 | 113 | ||
114 | 114 | ||
115 | /* | 115 | /* |
116 | * Initialize for an output processing pass. | 116 | * Initialize for an output processing pass. |
117 | */ | 117 | */ |
118 | 118 | ||
119 | METHODDEF(void) | 119 | METHODDEF(void) |
120 | start_output_pass (j_decompress_ptr cinfo) | 120 | start_output_pass (j_decompress_ptr cinfo) |
121 | { | 121 | { |
122 | #ifdef BLOCK_SMOOTHING_SUPPORTED | 122 | #ifdef BLOCK_SMOOTHING_SUPPORTED |
123 | my_coef_ptr coef = (my_coef_ptr) cinfo->coef; | 123 | my_coef_ptr coef = (my_coef_ptr) cinfo->coef; |
124 | 124 | ||
125 | /* If multipass, check to see whether to use block smoothing on this pass */ | 125 | /* If multipass, check to see whether to use block smoothing on this pass */ |
126 | if (coef->pub.coef_arrays != NULL) { | 126 | if (coef->pub.coef_arrays != NULL) { |
127 | if (cinfo->do_block_smoothing && smoothing_ok(cinfo)) | 127 | if (cinfo->do_block_smoothing && smoothing_ok(cinfo)) |
128 | coef->pub.decompress_data = decompress_smooth_data; | 128 | coef->pub.decompress_data = decompress_smooth_data; |
129 | else | 129 | else |
130 | coef->pub.decompress_data = decompress_data; | 130 | coef->pub.decompress_data = decompress_data; |
131 | } | 131 | } |
132 | #endif | 132 | #endif |
133 | cinfo->output_iMCU_row = 0; | 133 | cinfo->output_iMCU_row = 0; |
134 | } | 134 | } |
135 | 135 | ||
136 | 136 | ||
137 | /* | 137 | /* |
138 | * Decompress and return some data in the single-pass case. | 138 | * Decompress and return some data in the single-pass case. |
139 | * Always attempts to emit one fully interleaved MCU row ("iMCU" row). | 139 | * Always attempts to emit one fully interleaved MCU row ("iMCU" row). |
140 | * Input and output must run in lockstep since we have only a one-MCU buffer. | 140 | * Input and output must run in lockstep since we have only a one-MCU buffer. |
141 | * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED. | 141 | * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED. |
142 | * | 142 | * |
143 | * NB: output_buf contains a plane for each component in image, | 143 | * NB: output_buf contains a plane for each component in image, |
144 | * which we index according to the component's SOF position. | 144 | * which we index according to the component's SOF position. |
145 | */ | 145 | */ |
146 | 146 | ||
147 | METHODDEF(int) | 147 | METHODDEF(int) |
148 | decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) | 148 | decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) |
149 | { | 149 | { |
150 | my_coef_ptr coef = (my_coef_ptr) cinfo->coef; | 150 | my_coef_ptr coef = (my_coef_ptr) cinfo->coef; |
151 | JDIMENSION MCU_col_num; /* index of current MCU within row */ | 151 | JDIMENSION MCU_col_num; /* index of current MCU within row */ |
152 | JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1; | 152 | JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1; |
153 | JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; | 153 | JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; |
154 | int blkn, ci, xindex, yindex, yoffset, useful_width; | 154 | int blkn, ci, xindex, yindex, yoffset, useful_width; |
155 | JSAMPARRAY output_ptr; | 155 | JSAMPARRAY output_ptr; |
156 | JDIMENSION start_col, output_col; | 156 | JDIMENSION start_col, output_col; |
157 | jpeg_component_info *compptr; | 157 | jpeg_component_info *compptr; |
158 | inverse_DCT_method_ptr inverse_DCT; | 158 | inverse_DCT_method_ptr inverse_DCT; |
159 | 159 | ||
160 | /* Loop to process as much as one whole iMCU row */ | 160 | /* Loop to process as much as one whole iMCU row */ |
161 | for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; | 161 | for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; |
162 | yoffset++) { | 162 | yoffset++) { |
163 | for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col; | 163 | for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col; |
164 | MCU_col_num++) { | 164 | MCU_col_num++) { |
165 | /* Try to fetch an MCU. Entropy decoder expects buffer to be zeroed. */ | 165 | /* Try to fetch an MCU. Entropy decoder expects buffer to be zeroed. */ |
166 | if (cinfo->lim_Se) /* can bypass in DC only case */ | 166 | if (cinfo->lim_Se) /* can bypass in DC only case */ |
167 | FMEMZERO((void FAR *) coef->MCU_buffer[0], | 167 | FMEMZERO((void FAR *) coef->MCU_buffer[0], |
168 | (size_t) (cinfo->blocks_in_MCU * SIZEOF(JBLOCK))); | 168 | (size_t) (cinfo->blocks_in_MCU * SIZEOF(JBLOCK))); |
169 | if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) { | 169 | if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) { |
170 | /* Suspension forced; update state counters and exit */ | 170 | /* Suspension forced; update state counters and exit */ |
171 | coef->MCU_vert_offset = yoffset; | 171 | coef->MCU_vert_offset = yoffset; |
172 | coef->MCU_ctr = MCU_col_num; | 172 | coef->MCU_ctr = MCU_col_num; |
173 | return JPEG_SUSPENDED; | 173 | return JPEG_SUSPENDED; |
174 | } | 174 | } |
175 | /* Determine where data should go in output_buf and do the IDCT thing. | 175 | /* Determine where data should go in output_buf and do the IDCT thing. |
176 | * We skip dummy blocks at the right and bottom edges (but blkn gets | 176 | * We skip dummy blocks at the right and bottom edges (but blkn gets |
177 | * incremented past them!). Note the inner loop relies on having | 177 | * incremented past them!). Note the inner loop relies on having |
178 | * allocated the MCU_buffer[] blocks sequentially. | 178 | * allocated the MCU_buffer[] blocks sequentially. |
179 | */ | 179 | */ |
180 | blkn = 0; /* index of current DCT block within MCU */ | 180 | blkn = 0; /* index of current DCT block within MCU */ |
181 | for (ci = 0; ci < cinfo->comps_in_scan; ci++) { | 181 | for (ci = 0; ci < cinfo->comps_in_scan; ci++) { |
182 | compptr = cinfo->cur_comp_info[ci]; | 182 | compptr = cinfo->cur_comp_info[ci]; |
183 | /* Don't bother to IDCT an uninteresting component. */ | 183 | /* Don't bother to IDCT an uninteresting component. */ |
184 | if (! compptr->component_needed) { | 184 | if (! compptr->component_needed) { |
185 | blkn += compptr->MCU_blocks; | 185 | blkn += compptr->MCU_blocks; |
186 | continue; | 186 | continue; |
187 | } | 187 | } |
188 | inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index]; | 188 | inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index]; |
189 | useful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width | 189 | useful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width |
190 | : compptr->last_col_width; | 190 | : compptr->last_col_width; |
191 | output_ptr = output_buf[compptr->component_index] + | 191 | output_ptr = output_buf[compptr->component_index] + |
192 | yoffset * compptr->DCT_v_scaled_size; | 192 | yoffset * compptr->DCT_v_scaled_size; |
193 | start_col = MCU_col_num * compptr->MCU_sample_width; | 193 | start_col = MCU_col_num * compptr->MCU_sample_width; |
194 | for (yindex = 0; yindex < compptr->MCU_height; yindex++) { | 194 | for (yindex = 0; yindex < compptr->MCU_height; yindex++) { |
195 | if (cinfo->input_iMCU_row < last_iMCU_row || | 195 | if (cinfo->input_iMCU_row < last_iMCU_row || |
196 | yoffset+yindex < compptr->last_row_height) { | 196 | yoffset+yindex < compptr->last_row_height) { |
197 | output_col = start_col; | 197 | output_col = start_col; |
198 | for (xindex = 0; xindex < useful_width; xindex++) { | 198 | for (xindex = 0; xindex < useful_width; xindex++) { |
199 | (*inverse_DCT) (cinfo, compptr, | 199 | (*inverse_DCT) (cinfo, compptr, |
200 | (JCOEFPTR) coef->MCU_buffer[blkn+xindex], | 200 | (JCOEFPTR) coef->MCU_buffer[blkn+xindex], |
201 | output_ptr, output_col); | 201 | output_ptr, output_col); |
202 | output_col += compptr->DCT_h_scaled_size; | 202 | output_col += compptr->DCT_h_scaled_size; |
203 | } | 203 | } |
204 | } | 204 | } |
205 | blkn += compptr->MCU_width; | 205 | blkn += compptr->MCU_width; |
206 | output_ptr += compptr->DCT_v_scaled_size; | 206 | output_ptr += compptr->DCT_v_scaled_size; |
207 | } | 207 | } |
208 | } | 208 | } |
209 | } | 209 | } |
210 | /* Completed an MCU row, but perhaps not an iMCU row */ | 210 | /* Completed an MCU row, but perhaps not an iMCU row */ |
211 | coef->MCU_ctr = 0; | 211 | coef->MCU_ctr = 0; |
212 | } | 212 | } |
213 | /* Completed the iMCU row, advance counters for next one */ | 213 | /* Completed the iMCU row, advance counters for next one */ |
214 | cinfo->output_iMCU_row++; | 214 | cinfo->output_iMCU_row++; |
215 | if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) { | 215 | if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) { |
216 | start_iMCU_row(cinfo); | 216 | start_iMCU_row(cinfo); |
217 | return JPEG_ROW_COMPLETED; | 217 | return JPEG_ROW_COMPLETED; |
218 | } | 218 | } |
219 | /* Completed the scan */ | 219 | /* Completed the scan */ |
220 | (*cinfo->inputctl->finish_input_pass) (cinfo); | 220 | (*cinfo->inputctl->finish_input_pass) (cinfo); |
221 | return JPEG_SCAN_COMPLETED; | 221 | return JPEG_SCAN_COMPLETED; |
222 | } | 222 | } |
223 | 223 | ||
224 | 224 | ||
225 | /* | 225 | /* |
226 | * Dummy consume-input routine for single-pass operation. | 226 | * Dummy consume-input routine for single-pass operation. |
227 | */ | 227 | */ |
228 | 228 | ||
229 | METHODDEF(int) | 229 | METHODDEF(int) |
230 | dummy_consume_data (j_decompress_ptr cinfo) | 230 | dummy_consume_data (j_decompress_ptr cinfo) |
231 | { | 231 | { |
232 | return JPEG_SUSPENDED; /* Always indicate nothing was done */ | 232 | return JPEG_SUSPENDED; /* Always indicate nothing was done */ |
233 | } | 233 | } |
234 | 234 | ||
235 | 235 | ||
236 | #ifdef D_MULTISCAN_FILES_SUPPORTED | 236 | #ifdef D_MULTISCAN_FILES_SUPPORTED |
237 | 237 | ||
238 | /* | 238 | /* |
239 | * Consume input data and store it in the full-image coefficient buffer. | 239 | * Consume input data and store it in the full-image coefficient buffer. |
240 | * We read as much as one fully interleaved MCU row ("iMCU" row) per call, | 240 | * We read as much as one fully interleaved MCU row ("iMCU" row) per call, |
241 | * ie, v_samp_factor block rows for each component in the scan. | 241 | * ie, v_samp_factor block rows for each component in the scan. |
242 | * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED. | 242 | * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED. |
243 | */ | 243 | */ |
244 | 244 | ||
245 | METHODDEF(int) | 245 | METHODDEF(int) |
246 | consume_data (j_decompress_ptr cinfo) | 246 | consume_data (j_decompress_ptr cinfo) |
247 | { | 247 | { |
248 | my_coef_ptr coef = (my_coef_ptr) cinfo->coef; | 248 | my_coef_ptr coef = (my_coef_ptr) cinfo->coef; |
249 | JDIMENSION MCU_col_num; /* index of current MCU within row */ | 249 | JDIMENSION MCU_col_num; /* index of current MCU within row */ |
250 | int blkn, ci, xindex, yindex, yoffset; | 250 | int blkn, ci, xindex, yindex, yoffset; |
251 | JDIMENSION start_col; | 251 | JDIMENSION start_col; |
252 | JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN]; | 252 | JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN]; |
253 | JBLOCKROW buffer_ptr; | 253 | JBLOCKROW buffer_ptr; |
254 | jpeg_component_info *compptr; | 254 | jpeg_component_info *compptr; |
255 | 255 | ||
256 | /* Align the virtual buffers for the components used in this scan. */ | 256 | /* Align the virtual buffers for the components used in this scan. */ |
257 | for (ci = 0; ci < cinfo->comps_in_scan; ci++) { | 257 | for (ci = 0; ci < cinfo->comps_in_scan; ci++) { |
258 | compptr = cinfo->cur_comp_info[ci]; | 258 | compptr = cinfo->cur_comp_info[ci]; |
259 | buffer[ci] = (*cinfo->mem->access_virt_barray) | 259 | buffer[ci] = (*cinfo->mem->access_virt_barray) |
260 | ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index], | 260 | ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index], |
261 | cinfo->input_iMCU_row * compptr->v_samp_factor, | 261 | cinfo->input_iMCU_row * compptr->v_samp_factor, |
262 | (JDIMENSION) compptr->v_samp_factor, TRUE); | 262 | (JDIMENSION) compptr->v_samp_factor, TRUE); |
263 | /* Note: entropy decoder expects buffer to be zeroed, | 263 | /* Note: entropy decoder expects buffer to be zeroed, |
264 | * but this is handled automatically by the memory manager | 264 | * but this is handled automatically by the memory manager |
265 | * because we requested a pre-zeroed array. | 265 | * because we requested a pre-zeroed array. |
266 | */ | 266 | */ |
267 | } | 267 | } |
268 | 268 | ||
269 | /* Loop to process one whole iMCU row */ | 269 | /* Loop to process one whole iMCU row */ |
270 | for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; | 270 | for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; |
271 | yoffset++) { | 271 | yoffset++) { |
272 | for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row; | 272 | for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row; |
273 | MCU_col_num++) { | 273 | MCU_col_num++) { |
274 | /* Construct list of pointers to DCT blocks belonging to this MCU */ | 274 | /* Construct list of pointers to DCT blocks belonging to this MCU */ |
275 | blkn = 0; /* index of current DCT block within MCU */ | 275 | blkn = 0; /* index of current DCT block within MCU */ |
276 | for (ci = 0; ci < cinfo->comps_in_scan; ci++) { | 276 | for (ci = 0; ci < cinfo->comps_in_scan; ci++) { |
277 | compptr = cinfo->cur_comp_info[ci]; | 277 | compptr = cinfo->cur_comp_info[ci]; |
278 | start_col = MCU_col_num * compptr->MCU_width; | 278 | start_col = MCU_col_num * compptr->MCU_width; |
279 | for (yindex = 0; yindex < compptr->MCU_height; yindex++) { | 279 | for (yindex = 0; yindex < compptr->MCU_height; yindex++) { |
280 | buffer_ptr = buffer[ci][yindex+yoffset] + start_col; | 280 | buffer_ptr = buffer[ci][yindex+yoffset] + start_col; |
281 | for (xindex = 0; xindex < compptr->MCU_width; xindex++) { | 281 | for (xindex = 0; xindex < compptr->MCU_width; xindex++) { |
282 | coef->MCU_buffer[blkn++] = buffer_ptr++; | 282 | coef->MCU_buffer[blkn++] = buffer_ptr++; |
283 | } | 283 | } |
284 | } | 284 | } |
285 | } | 285 | } |
286 | /* Try to fetch the MCU. */ | 286 | /* Try to fetch the MCU. */ |
287 | if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) { | 287 | if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) { |
288 | /* Suspension forced; update state counters and exit */ | 288 | /* Suspension forced; update state counters and exit */ |
289 | coef->MCU_vert_offset = yoffset; | 289 | coef->MCU_vert_offset = yoffset; |
290 | coef->MCU_ctr = MCU_col_num; | 290 | coef->MCU_ctr = MCU_col_num; |
291 | return JPEG_SUSPENDED; | 291 | return JPEG_SUSPENDED; |
292 | } | 292 | } |
293 | } | 293 | } |
294 | /* Completed an MCU row, but perhaps not an iMCU row */ | 294 | /* Completed an MCU row, but perhaps not an iMCU row */ |
295 | coef->MCU_ctr = 0; | 295 | coef->MCU_ctr = 0; |
296 | } | 296 | } |
297 | /* Completed the iMCU row, advance counters for next one */ | 297 | /* Completed the iMCU row, advance counters for next one */ |
298 | if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) { | 298 | if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) { |
299 | start_iMCU_row(cinfo); | 299 | start_iMCU_row(cinfo); |
300 | return JPEG_ROW_COMPLETED; | 300 | return JPEG_ROW_COMPLETED; |
301 | } | 301 | } |
302 | /* Completed the scan */ | 302 | /* Completed the scan */ |
303 | (*cinfo->inputctl->finish_input_pass) (cinfo); | 303 | (*cinfo->inputctl->finish_input_pass) (cinfo); |
304 | return JPEG_SCAN_COMPLETED; | 304 | return JPEG_SCAN_COMPLETED; |
305 | } | 305 | } |
306 | 306 | ||
307 | 307 | ||
308 | /* | 308 | /* |
309 | * Decompress and return some data in the multi-pass case. | 309 | * Decompress and return some data in the multi-pass case. |
310 | * Always attempts to emit one fully interleaved MCU row ("iMCU" row). | 310 | * Always attempts to emit one fully interleaved MCU row ("iMCU" row). |
311 | * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED. | 311 | * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED. |
312 | * | 312 | * |
313 | * NB: output_buf contains a plane for each component in image. | 313 | * NB: output_buf contains a plane for each component in image. |
314 | */ | 314 | */ |
315 | 315 | ||
316 | METHODDEF(int) | 316 | METHODDEF(int) |
317 | decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) | 317 | decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) |
318 | { | 318 | { |
319 | my_coef_ptr coef = (my_coef_ptr) cinfo->coef; | 319 | my_coef_ptr coef = (my_coef_ptr) cinfo->coef; |
320 | JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; | 320 | JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; |
321 | JDIMENSION block_num; | 321 | JDIMENSION block_num; |
322 | int ci, block_row, block_rows; | 322 | int ci, block_row, block_rows; |
323 | JBLOCKARRAY buffer; | 323 | JBLOCKARRAY buffer; |
324 | JBLOCKROW buffer_ptr; | 324 | JBLOCKROW buffer_ptr; |
325 | JSAMPARRAY output_ptr; | 325 | JSAMPARRAY output_ptr; |
326 | JDIMENSION output_col; | 326 | JDIMENSION output_col; |
327 | jpeg_component_info *compptr; | 327 | jpeg_component_info *compptr; |
328 | inverse_DCT_method_ptr inverse_DCT; | 328 | inverse_DCT_method_ptr inverse_DCT; |
329 | 329 | ||
330 | /* Force some input to be done if we are getting ahead of the input. */ | 330 | /* Force some input to be done if we are getting ahead of the input. */ |
331 | while (cinfo->input_scan_number < cinfo->output_scan_number || | 331 | while (cinfo->input_scan_number < cinfo->output_scan_number || |
332 | (cinfo->input_scan_number == cinfo->output_scan_number && | 332 | (cinfo->input_scan_number == cinfo->output_scan_number && |
333 | cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) { | 333 | cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) { |
334 | if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED) | 334 | if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED) |
335 | return JPEG_SUSPENDED; | 335 | return JPEG_SUSPENDED; |
336 | } | 336 | } |
337 | 337 | ||
338 | /* OK, output from the virtual arrays. */ | 338 | /* OK, output from the virtual arrays. */ |
339 | for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; | 339 | for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; |
340 | ci++, compptr++) { | 340 | ci++, compptr++) { |
341 | /* Don't bother to IDCT an uninteresting component. */ | 341 | /* Don't bother to IDCT an uninteresting component. */ |
342 | if (! compptr->component_needed) | 342 | if (! compptr->component_needed) |
343 | continue; | 343 | continue; |
344 | /* Align the virtual buffer for this component. */ | 344 | /* Align the virtual buffer for this component. */ |
345 | buffer = (*cinfo->mem->access_virt_barray) | 345 | buffer = (*cinfo->mem->access_virt_barray) |
346 | ((j_common_ptr) cinfo, coef->whole_image[ci], | 346 | ((j_common_ptr) cinfo, coef->whole_image[ci], |
347 | cinfo->output_iMCU_row * compptr->v_samp_factor, | 347 | cinfo->output_iMCU_row * compptr->v_samp_factor, |
348 | (JDIMENSION) compptr->v_samp_factor, FALSE); | 348 | (JDIMENSION) compptr->v_samp_factor, FALSE); |
349 | /* Count non-dummy DCT block rows in this iMCU row. */ | 349 | /* Count non-dummy DCT block rows in this iMCU row. */ |
350 | if (cinfo->output_iMCU_row < last_iMCU_row) | 350 | if (cinfo->output_iMCU_row < last_iMCU_row) |
351 | block_rows = compptr->v_samp_factor; | 351 | block_rows = compptr->v_samp_factor; |
352 | else { | 352 | else { |
353 | /* NB: can't use last_row_height here; it is input-side-dependent! */ | 353 | /* NB: can't use last_row_height here; it is input-side-dependent! */ |
354 | block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor); | 354 | block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor); |
355 | if (block_rows == 0) block_rows = compptr->v_samp_factor; | 355 | if (block_rows == 0) block_rows = compptr->v_samp_factor; |
356 | } | 356 | } |
357 | inverse_DCT = cinfo->idct->inverse_DCT[ci]; | 357 | inverse_DCT = cinfo->idct->inverse_DCT[ci]; |
358 | output_ptr = output_buf[ci]; | 358 | output_ptr = output_buf[ci]; |
359 | /* Loop over all DCT blocks to be processed. */ | 359 | /* Loop over all DCT blocks to be processed. */ |
360 | for (block_row = 0; block_row < block_rows; block_row++) { | 360 | for (block_row = 0; block_row < block_rows; block_row++) { |
361 | buffer_ptr = buffer[block_row]; | 361 | buffer_ptr = buffer[block_row]; |
362 | output_col = 0; | 362 | output_col = 0; |
363 | for (block_num = 0; block_num < compptr->width_in_blocks; block_num++) { | 363 | for (block_num = 0; block_num < compptr->width_in_blocks; block_num++) { |
364 | (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) buffer_ptr, | 364 | (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) buffer_ptr, |
365 | output_ptr, output_col); | 365 | output_ptr, output_col); |
366 | buffer_ptr++; | 366 | buffer_ptr++; |
367 | output_col += compptr->DCT_h_scaled_size; | 367 | output_col += compptr->DCT_h_scaled_size; |
368 | } | 368 | } |
369 | output_ptr += compptr->DCT_v_scaled_size; | 369 | output_ptr += compptr->DCT_v_scaled_size; |
370 | } | 370 | } |
371 | } | 371 | } |
372 | 372 | ||
373 | if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows) | 373 | if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows) |
374 | return JPEG_ROW_COMPLETED; | 374 | return JPEG_ROW_COMPLETED; |
375 | return JPEG_SCAN_COMPLETED; | 375 | return JPEG_SCAN_COMPLETED; |
376 | } | 376 | } |
377 | 377 | ||
378 | #endif /* D_MULTISCAN_FILES_SUPPORTED */ | 378 | #endif /* D_MULTISCAN_FILES_SUPPORTED */ |
379 | 379 | ||
380 | 380 | ||
381 | #ifdef BLOCK_SMOOTHING_SUPPORTED | 381 | #ifdef BLOCK_SMOOTHING_SUPPORTED |
382 | 382 | ||
383 | /* | 383 | /* |
384 | * This code applies interblock smoothing as described by section K.8 | 384 | * This code applies interblock smoothing as described by section K.8 |
385 | * of the JPEG standard: the first 5 AC coefficients are estimated from | 385 | * of the JPEG standard: the first 5 AC coefficients are estimated from |
386 | * the DC values of a DCT block and its 8 neighboring blocks. | 386 | * the DC values of a DCT block and its 8 neighboring blocks. |
387 | * We apply smoothing only for progressive JPEG decoding, and only if | 387 | * We apply smoothing only for progressive JPEG decoding, and only if |
388 | * the coefficients it can estimate are not yet known to full precision. | 388 | * the coefficients it can estimate are not yet known to full precision. |
389 | */ | 389 | */ |
390 | 390 | ||
391 | /* Natural-order array positions of the first 5 zigzag-order coefficients */ | 391 | /* Natural-order array positions of the first 5 zigzag-order coefficients */ |
392 | #define Q01_POS 1 | 392 | #define Q01_POS 1 |
393 | #define Q10_POS 8 | 393 | #define Q10_POS 8 |
394 | #define Q20_POS 16 | 394 | #define Q20_POS 16 |
395 | #define Q11_POS 9 | 395 | #define Q11_POS 9 |
396 | #define Q02_POS 2 | 396 | #define Q02_POS 2 |
397 | 397 | ||
398 | /* | 398 | /* |
399 | * Determine whether block smoothing is applicable and safe. | 399 | * Determine whether block smoothing is applicable and safe. |
400 | * We also latch the current states of the coef_bits[] entries for the | 400 | * We also latch the current states of the coef_bits[] entries for the |
401 | * AC coefficients; otherwise, if the input side of the decompressor | 401 | * AC coefficients; otherwise, if the input side of the decompressor |
402 | * advances into a new scan, we might think the coefficients are known | 402 | * advances into a new scan, we might think the coefficients are known |
403 | * more accurately than they really are. | 403 | * more accurately than they really are. |
404 | */ | 404 | */ |
405 | 405 | ||
406 | LOCAL(boolean) | 406 | LOCAL(boolean) |
407 | smoothing_ok (j_decompress_ptr cinfo) | 407 | smoothing_ok (j_decompress_ptr cinfo) |
408 | { | 408 | { |
409 | my_coef_ptr coef = (my_coef_ptr) cinfo->coef; | 409 | my_coef_ptr coef = (my_coef_ptr) cinfo->coef; |
410 | boolean smoothing_useful = FALSE; | 410 | boolean smoothing_useful = FALSE; |
411 | int ci, coefi; | 411 | int ci, coefi; |
412 | jpeg_component_info *compptr; | 412 | jpeg_component_info *compptr; |
413 | JQUANT_TBL * qtable; | 413 | JQUANT_TBL * qtable; |
414 | int * coef_bits; | 414 | int * coef_bits; |
415 | int * coef_bits_latch; | 415 | int * coef_bits_latch; |
416 | 416 | ||
417 | if (! cinfo->progressive_mode || cinfo->coef_bits == NULL) | 417 | if (! cinfo->progressive_mode || cinfo->coef_bits == NULL) |
418 | return FALSE; | 418 | return FALSE; |
419 | 419 | ||
420 | /* Allocate latch area if not already done */ | 420 | /* Allocate latch area if not already done */ |
421 | if (coef->coef_bits_latch == NULL) | 421 | if (coef->coef_bits_latch == NULL) |
422 | coef->coef_bits_latch = (int *) | 422 | coef->coef_bits_latch = (int *) |
423 | (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, | 423 | (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, |
424 | cinfo->num_components * | 424 | cinfo->num_components * |
425 | (SAVED_COEFS * SIZEOF(int))); | 425 | (SAVED_COEFS * SIZEOF(int))); |
426 | coef_bits_latch = coef->coef_bits_latch; | 426 | coef_bits_latch = coef->coef_bits_latch; |
427 | 427 | ||
428 | for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; | 428 | for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; |
429 | ci++, compptr++) { | 429 | ci++, compptr++) { |
430 | /* All components' quantization values must already be latched. */ | 430 | /* All components' quantization values must already be latched. */ |
431 | if ((qtable = compptr->quant_table) == NULL) | 431 | if ((qtable = compptr->quant_table) == NULL) |
432 | return FALSE; | 432 | return FALSE; |
433 | /* Verify DC & first 5 AC quantizers are nonzero to avoid zero-divide. */ | 433 | /* Verify DC & first 5 AC quantizers are nonzero to avoid zero-divide. */ |
434 | if (qtable->quantval[0] == 0 || | 434 | if (qtable->quantval[0] == 0 || |
435 | qtable->quantval[Q01_POS] == 0 || | 435 | qtable->quantval[Q01_POS] == 0 || |
436 | qtable->quantval[Q10_POS] == 0 || | 436 | qtable->quantval[Q10_POS] == 0 || |
437 | qtable->quantval[Q20_POS] == 0 || | 437 | qtable->quantval[Q20_POS] == 0 || |
438 | qtable->quantval[Q11_POS] == 0 || | 438 | qtable->quantval[Q11_POS] == 0 || |
439 | qtable->quantval[Q02_POS] == 0) | 439 | qtable->quantval[Q02_POS] == 0) |
440 | return FALSE; | 440 | return FALSE; |
441 | /* DC values must be at least partly known for all components. */ | 441 | /* DC values must be at least partly known for all components. */ |
442 | coef_bits = cinfo->coef_bits[ci]; | 442 | coef_bits = cinfo->coef_bits[ci]; |
443 | if (coef_bits[0] < 0) | 443 | if (coef_bits[0] < 0) |
444 | return FALSE; | 444 | return FALSE; |
445 | /* Block smoothing is helpful if some AC coefficients remain inaccurate. */ | 445 | /* Block smoothing is helpful if some AC coefficients remain inaccurate. */ |
446 | for (coefi = 1; coefi <= 5; coefi++) { | 446 | for (coefi = 1; coefi <= 5; coefi++) { |
447 | coef_bits_latch[coefi] = coef_bits[coefi]; | 447 | coef_bits_latch[coefi] = coef_bits[coefi]; |
448 | if (coef_bits[coefi] != 0) | 448 | if (coef_bits[coefi] != 0) |
449 | smoothing_useful = TRUE; | 449 | smoothing_useful = TRUE; |
450 | } | 450 | } |
451 | coef_bits_latch += SAVED_COEFS; | 451 | coef_bits_latch += SAVED_COEFS; |
452 | } | 452 | } |
453 | 453 | ||
454 | return smoothing_useful; | 454 | return smoothing_useful; |
455 | } | 455 | } |
456 | 456 | ||
457 | 457 | ||
458 | /* | 458 | /* |
459 | * Variant of decompress_data for use when doing block smoothing. | 459 | * Variant of decompress_data for use when doing block smoothing. |
460 | */ | 460 | */ |
461 | 461 | ||
462 | METHODDEF(int) | 462 | METHODDEF(int) |
463 | decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) | 463 | decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) |
464 | { | 464 | { |
465 | my_coef_ptr coef = (my_coef_ptr) cinfo->coef; | 465 | my_coef_ptr coef = (my_coef_ptr) cinfo->coef; |
466 | JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; | 466 | JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; |
467 | JDIMENSION block_num, last_block_column; | 467 | JDIMENSION block_num, last_block_column; |
468 | int ci, block_row, block_rows, access_rows; | 468 | int ci, block_row, block_rows, access_rows; |
469 | JBLOCKARRAY buffer; | 469 | JBLOCKARRAY buffer; |
470 | JBLOCKROW buffer_ptr, prev_block_row, next_block_row; | 470 | JBLOCKROW buffer_ptr, prev_block_row, next_block_row; |
471 | JSAMPARRAY output_ptr; | 471 | JSAMPARRAY output_ptr; |
472 | JDIMENSION output_col; | 472 | JDIMENSION output_col; |
473 | jpeg_component_info *compptr; | 473 | jpeg_component_info *compptr; |
474 | inverse_DCT_method_ptr inverse_DCT; | 474 | inverse_DCT_method_ptr inverse_DCT; |
475 | boolean first_row, last_row; | 475 | boolean first_row, last_row; |
476 | JBLOCK workspace; | 476 | JBLOCK workspace; |
477 | int *coef_bits; | 477 | int *coef_bits; |
478 | JQUANT_TBL *quanttbl; | 478 | JQUANT_TBL *quanttbl; |
479 | INT32 Q00,Q01,Q02,Q10,Q11,Q20, num; | 479 | INT32 Q00,Q01,Q02,Q10,Q11,Q20, num; |
480 | int DC1,DC2,DC3,DC4,DC5,DC6,DC7,DC8,DC9; | 480 | int DC1,DC2,DC3,DC4,DC5,DC6,DC7,DC8,DC9; |
481 | int Al, pred; | 481 | int Al, pred; |
482 | 482 | ||
483 | /* Force some input to be done if we are getting ahead of the input. */ | 483 | /* Force some input to be done if we are getting ahead of the input. */ |
484 | while (cinfo->input_scan_number <= cinfo->output_scan_number && | 484 | while (cinfo->input_scan_number <= cinfo->output_scan_number && |
485 | ! cinfo->inputctl->eoi_reached) { | 485 | ! cinfo->inputctl->eoi_reached) { |
486 | if (cinfo->input_scan_number == cinfo->output_scan_number) { | 486 | if (cinfo->input_scan_number == cinfo->output_scan_number) { |
487 | /* If input is working on current scan, we ordinarily want it to | 487 | /* If input is working on current scan, we ordinarily want it to |
488 | * have completed the current row. But if input scan is DC, | 488 | * have completed the current row. But if input scan is DC, |
489 | * we want it to keep one row ahead so that next block row's DC | 489 | * we want it to keep one row ahead so that next block row's DC |
490 | * values are up to date. | 490 | * values are up to date. |
491 | */ | 491 | */ |
492 | JDIMENSION delta = (cinfo->Ss == 0) ? 1 : 0; | 492 | JDIMENSION delta = (cinfo->Ss == 0) ? 1 : 0; |
493 | if (cinfo->input_iMCU_row > cinfo->output_iMCU_row+delta) | 493 | if (cinfo->input_iMCU_row > cinfo->output_iMCU_row+delta) |
494 | break; | 494 | break; |
495 | } | 495 | } |
496 | if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED) | 496 | if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED) |
497 | return JPEG_SUSPENDED; | 497 | return JPEG_SUSPENDED; |
498 | } | 498 | } |
499 | 499 | ||
500 | /* OK, output from the virtual arrays. */ | 500 | /* OK, output from the virtual arrays. */ |
501 | for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; | 501 | for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; |
502 | ci++, compptr++) { | 502 | ci++, compptr++) { |
503 | /* Don't bother to IDCT an uninteresting component. */ | 503 | /* Don't bother to IDCT an uninteresting component. */ |
504 | if (! compptr->component_needed) | 504 | if (! compptr->component_needed) |
505 | continue; | 505 | continue; |
506 | /* Count non-dummy DCT block rows in this iMCU row. */ | 506 | /* Count non-dummy DCT block rows in this iMCU row. */ |
507 | if (cinfo->output_iMCU_row < last_iMCU_row) { | 507 | if (cinfo->output_iMCU_row < last_iMCU_row) { |
508 | block_rows = compptr->v_samp_factor; | 508 | block_rows = compptr->v_samp_factor; |
509 | access_rows = block_rows * 2; /* this and next iMCU row */ | 509 | access_rows = block_rows * 2; /* this and next iMCU row */ |
510 | last_row = FALSE; | 510 | last_row = FALSE; |
511 | } else { | 511 | } else { |
512 | /* NB: can't use last_row_height here; it is input-side-dependent! */ | 512 | /* NB: can't use last_row_height here; it is input-side-dependent! */ |
513 | block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor); | 513 | block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor); |
514 | if (block_rows == 0) block_rows = compptr->v_samp_factor; | 514 | if (block_rows == 0) block_rows = compptr->v_samp_factor; |
515 | access_rows = block_rows; /* this iMCU row only */ | 515 | access_rows = block_rows; /* this iMCU row only */ |
516 | last_row = TRUE; | 516 | last_row = TRUE; |
517 | } | 517 | } |
518 | /* Align the virtual buffer for this component. */ | 518 | /* Align the virtual buffer for this component. */ |
519 | if (cinfo->output_iMCU_row > 0) { | 519 | if (cinfo->output_iMCU_row > 0) { |
520 | access_rows += compptr->v_samp_factor; /* prior iMCU row too */ | 520 | access_rows += compptr->v_samp_factor; /* prior iMCU row too */ |
521 | buffer = (*cinfo->mem->access_virt_barray) | 521 | buffer = (*cinfo->mem->access_virt_barray) |
522 | ((j_common_ptr) cinfo, coef->whole_image[ci], | 522 | ((j_common_ptr) cinfo, coef->whole_image[ci], |
523 | (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor, | 523 | (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor, |
524 | (JDIMENSION) access_rows, FALSE); | 524 | (JDIMENSION) access_rows, FALSE); |
525 | buffer += compptr->v_samp_factor; /* point to current iMCU row */ | 525 | buffer += compptr->v_samp_factor; /* point to current iMCU row */ |
526 | first_row = FALSE; | 526 | first_row = FALSE; |
527 | } else { | 527 | } else { |
528 | buffer = (*cinfo->mem->access_virt_barray) | 528 | buffer = (*cinfo->mem->access_virt_barray) |
529 | ((j_common_ptr) cinfo, coef->whole_image[ci], | 529 | ((j_common_ptr) cinfo, coef->whole_image[ci], |
530 | (JDIMENSION) 0, (JDIMENSION) access_rows, FALSE); | 530 | (JDIMENSION) 0, (JDIMENSION) access_rows, FALSE); |
531 | first_row = TRUE; | 531 | first_row = TRUE; |
532 | } | 532 | } |
533 | /* Fetch component-dependent info */ | 533 | /* Fetch component-dependent info */ |
534 | coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS); | 534 | coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS); |
535 | quanttbl = compptr->quant_table; | 535 | quanttbl = compptr->quant_table; |
536 | Q00 = quanttbl->quantval[0]; | 536 | Q00 = quanttbl->quantval[0]; |
537 | Q01 = quanttbl->quantval[Q01_POS]; | 537 | Q01 = quanttbl->quantval[Q01_POS]; |
538 | Q10 = quanttbl->quantval[Q10_POS]; | 538 | Q10 = quanttbl->quantval[Q10_POS]; |
539 | Q20 = quanttbl->quantval[Q20_POS]; | 539 | Q20 = quanttbl->quantval[Q20_POS]; |
540 | Q11 = quanttbl->quantval[Q11_POS]; | 540 | Q11 = quanttbl->quantval[Q11_POS]; |
541 | Q02 = quanttbl->quantval[Q02_POS]; | 541 | Q02 = quanttbl->quantval[Q02_POS]; |
542 | inverse_DCT = cinfo->idct->inverse_DCT[ci]; | 542 | inverse_DCT = cinfo->idct->inverse_DCT[ci]; |
543 | output_ptr = output_buf[ci]; | 543 | output_ptr = output_buf[ci]; |
544 | /* Loop over all DCT blocks to be processed. */ | 544 | /* Loop over all DCT blocks to be processed. */ |
545 | for (block_row = 0; block_row < block_rows; block_row++) { | 545 | for (block_row = 0; block_row < block_rows; block_row++) { |
546 | buffer_ptr = buffer[block_row]; | 546 | buffer_ptr = buffer[block_row]; |
547 | if (first_row && block_row == 0) | 547 | if (first_row && block_row == 0) |
548 | prev_block_row = buffer_ptr; | 548 | prev_block_row = buffer_ptr; |
549 | else | 549 | else |
550 | prev_block_row = buffer[block_row-1]; | 550 | prev_block_row = buffer[block_row-1]; |
551 | if (last_row && block_row == block_rows-1) | 551 | if (last_row && block_row == block_rows-1) |
552 | next_block_row = buffer_ptr; | 552 | next_block_row = buffer_ptr; |
553 | else | 553 | else |
554 | next_block_row = buffer[block_row+1]; | 554 | next_block_row = buffer[block_row+1]; |
555 | /* We fetch the surrounding DC values using a sliding-register approach. | 555 | /* We fetch the surrounding DC values using a sliding-register approach. |
556 | * Initialize all nine here so as to do the right thing on narrow pics. | 556 | * Initialize all nine here so as to do the right thing on narrow pics. |
557 | */ | 557 | */ |
558 | DC1 = DC2 = DC3 = (int) prev_block_row[0][0]; | 558 | DC1 = DC2 = DC3 = (int) prev_block_row[0][0]; |
559 | DC4 = DC5 = DC6 = (int) buffer_ptr[0][0]; | 559 | DC4 = DC5 = DC6 = (int) buffer_ptr[0][0]; |
560 | DC7 = DC8 = DC9 = (int) next_block_row[0][0]; | 560 | DC7 = DC8 = DC9 = (int) next_block_row[0][0]; |
561 | output_col = 0; | 561 | output_col = 0; |
562 | last_block_column = compptr->width_in_blocks - 1; | 562 | last_block_column = compptr->width_in_blocks - 1; |
563 | for (block_num = 0; block_num <= last_block_column; block_num++) { | 563 | for (block_num = 0; block_num <= last_block_column; block_num++) { |
564 | /* Fetch current DCT block into workspace so we can modify it. */ | 564 | /* Fetch current DCT block into workspace so we can modify it. */ |
565 | jcopy_block_row(buffer_ptr, (JBLOCKROW) workspace, (JDIMENSION) 1); | 565 | jcopy_block_row(buffer_ptr, (JBLOCKROW) workspace, (JDIMENSION) 1); |
566 | /* Update DC values */ | 566 | /* Update DC values */ |
567 | if (block_num < last_block_column) { | 567 | if (block_num < last_block_column) { |
568 | DC3 = (int) prev_block_row[1][0]; | 568 | DC3 = (int) prev_block_row[1][0]; |
569 | DC6 = (int) buffer_ptr[1][0]; | 569 | DC6 = (int) buffer_ptr[1][0]; |
570 | DC9 = (int) next_block_row[1][0]; | 570 | DC9 = (int) next_block_row[1][0]; |
571 | } | 571 | } |
572 | /* Compute coefficient estimates per K.8. | 572 | /* Compute coefficient estimates per K.8. |
573 | * An estimate is applied only if coefficient is still zero, | 573 | * An estimate is applied only if coefficient is still zero, |
574 | * and is not known to be fully accurate. | 574 | * and is not known to be fully accurate. |
575 | */ | 575 | */ |
576 | /* AC01 */ | 576 | /* AC01 */ |
577 | if ((Al=coef_bits[1]) != 0 && workspace[1] == 0) { | 577 | if ((Al=coef_bits[1]) != 0 && workspace[1] == 0) { |
578 | num = 36 * Q00 * (DC4 - DC6); | 578 | num = 36 * Q00 * (DC4 - DC6); |
579 | if (num >= 0) { | 579 | if (num >= 0) { |
580 | pred = (int) (((Q01<<7) + num) / (Q01<<8)); | 580 | pred = (int) (((Q01<<7) + num) / (Q01<<8)); |
581 | if (Al > 0 && pred >= (1<<Al)) | 581 | if (Al > 0 && pred >= (1<<Al)) |
582 | pred = (1<<Al)-1; | 582 | pred = (1<<Al)-1; |
583 | } else { | 583 | } else { |
584 | pred = (int) (((Q01<<7) - num) / (Q01<<8)); | 584 | pred = (int) (((Q01<<7) - num) / (Q01<<8)); |
585 | if (Al > 0 && pred >= (1<<Al)) | 585 | if (Al > 0 && pred >= (1<<Al)) |
586 | pred = (1<<Al)-1; | 586 | pred = (1<<Al)-1; |
587 | pred = -pred; | 587 | pred = -pred; |
588 | } | 588 | } |
589 | workspace[1] = (JCOEF) pred; | 589 | workspace[1] = (JCOEF) pred; |
590 | } | 590 | } |
591 | /* AC10 */ | 591 | /* AC10 */ |
592 | if ((Al=coef_bits[2]) != 0 && workspace[8] == 0) { | 592 | if ((Al=coef_bits[2]) != 0 && workspace[8] == 0) { |
593 | num = 36 * Q00 * (DC2 - DC8); | 593 | num = 36 * Q00 * (DC2 - DC8); |
594 | if (num >= 0) { | 594 | if (num >= 0) { |
595 | pred = (int) (((Q10<<7) + num) / (Q10<<8)); | 595 | pred = (int) (((Q10<<7) + num) / (Q10<<8)); |
596 | if (Al > 0 && pred >= (1<<Al)) | 596 | if (Al > 0 && pred >= (1<<Al)) |
597 | pred = (1<<Al)-1; | 597 | pred = (1<<Al)-1; |
598 | } else { | 598 | } else { |
599 | pred = (int) (((Q10<<7) - num) / (Q10<<8)); | 599 | pred = (int) (((Q10<<7) - num) / (Q10<<8)); |
600 | if (Al > 0 && pred >= (1<<Al)) | 600 | if (Al > 0 && pred >= (1<<Al)) |
601 | pred = (1<<Al)-1; | 601 | pred = (1<<Al)-1; |
602 | pred = -pred; | 602 | pred = -pred; |
603 | } | 603 | } |
604 | workspace[8] = (JCOEF) pred; | 604 | workspace[8] = (JCOEF) pred; |
605 | } | 605 | } |
606 | /* AC20 */ | 606 | /* AC20 */ |
607 | if ((Al=coef_bits[3]) != 0 && workspace[16] == 0) { | 607 | if ((Al=coef_bits[3]) != 0 && workspace[16] == 0) { |
608 | num = 9 * Q00 * (DC2 + DC8 - 2*DC5); | 608 | num = 9 * Q00 * (DC2 + DC8 - 2*DC5); |
609 | if (num >= 0) { | 609 | if (num >= 0) { |
610 | pred = (int) (((Q20<<7) + num) / (Q20<<8)); | 610 | pred = (int) (((Q20<<7) + num) / (Q20<<8)); |
611 | if (Al > 0 && pred >= (1<<Al)) | 611 | if (Al > 0 && pred >= (1<<Al)) |
612 | pred = (1<<Al)-1; | 612 | pred = (1<<Al)-1; |
613 | } else { | 613 | } else { |
614 | pred = (int) (((Q20<<7) - num) / (Q20<<8)); | 614 | pred = (int) (((Q20<<7) - num) / (Q20<<8)); |
615 | if (Al > 0 && pred >= (1<<Al)) | 615 | if (Al > 0 && pred >= (1<<Al)) |
616 | pred = (1<<Al)-1; | 616 | pred = (1<<Al)-1; |
617 | pred = -pred; | 617 | pred = -pred; |
618 | } | 618 | } |
619 | workspace[16] = (JCOEF) pred; | 619 | workspace[16] = (JCOEF) pred; |
620 | } | 620 | } |
621 | /* AC11 */ | 621 | /* AC11 */ |
622 | if ((Al=coef_bits[4]) != 0 && workspace[9] == 0) { | 622 | if ((Al=coef_bits[4]) != 0 && workspace[9] == 0) { |
623 | num = 5 * Q00 * (DC1 - DC3 - DC7 + DC9); | 623 | num = 5 * Q00 * (DC1 - DC3 - DC7 + DC9); |
624 | if (num >= 0) { | 624 | if (num >= 0) { |
625 | pred = (int) (((Q11<<7) + num) / (Q11<<8)); | 625 | pred = (int) (((Q11<<7) + num) / (Q11<<8)); |
626 | if (Al > 0 && pred >= (1<<Al)) | 626 | if (Al > 0 && pred >= (1<<Al)) |
627 | pred = (1<<Al)-1; | 627 | pred = (1<<Al)-1; |
628 | } else { | 628 | } else { |
629 | pred = (int) (((Q11<<7) - num) / (Q11<<8)); | 629 | pred = (int) (((Q11<<7) - num) / (Q11<<8)); |
630 | if (Al > 0 && pred >= (1<<Al)) | 630 | if (Al > 0 && pred >= (1<<Al)) |
631 | pred = (1<<Al)-1; | 631 | pred = (1<<Al)-1; |
632 | pred = -pred; | 632 | pred = -pred; |
633 | } | 633 | } |
634 | workspace[9] = (JCOEF) pred; | 634 | workspace[9] = (JCOEF) pred; |
635 | } | 635 | } |
636 | /* AC02 */ | 636 | /* AC02 */ |
637 | if ((Al=coef_bits[5]) != 0 && workspace[2] == 0) { | 637 | if ((Al=coef_bits[5]) != 0 && workspace[2] == 0) { |
638 | num = 9 * Q00 * (DC4 + DC6 - 2*DC5); | 638 | num = 9 * Q00 * (DC4 + DC6 - 2*DC5); |
639 | if (num >= 0) { | 639 | if (num >= 0) { |
640 | pred = (int) (((Q02<<7) + num) / (Q02<<8)); | 640 | pred = (int) (((Q02<<7) + num) / (Q02<<8)); |
641 | if (Al > 0 && pred >= (1<<Al)) | 641 | if (Al > 0 && pred >= (1<<Al)) |
642 | pred = (1<<Al)-1; | 642 | pred = (1<<Al)-1; |
643 | } else { | 643 | } else { |
644 | pred = (int) (((Q02<<7) - num) / (Q02<<8)); | 644 | pred = (int) (((Q02<<7) - num) / (Q02<<8)); |
645 | if (Al > 0 && pred >= (1<<Al)) | 645 | if (Al > 0 && pred >= (1<<Al)) |
646 | pred = (1<<Al)-1; | 646 | pred = (1<<Al)-1; |
647 | pred = -pred; | 647 | pred = -pred; |
648 | } | 648 | } |
649 | workspace[2] = (JCOEF) pred; | 649 | workspace[2] = (JCOEF) pred; |
650 | } | 650 | } |
651 | /* OK, do the IDCT */ | 651 | /* OK, do the IDCT */ |
652 | (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) workspace, | 652 | (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) workspace, |
653 | output_ptr, output_col); | 653 | output_ptr, output_col); |
654 | /* Advance for next column */ | 654 | /* Advance for next column */ |
655 | DC1 = DC2; DC2 = DC3; | 655 | DC1 = DC2; DC2 = DC3; |
656 | DC4 = DC5; DC5 = DC6; | 656 | DC4 = DC5; DC5 = DC6; |
657 | DC7 = DC8; DC8 = DC9; | 657 | DC7 = DC8; DC8 = DC9; |
658 | buffer_ptr++, prev_block_row++, next_block_row++; | 658 | buffer_ptr++, prev_block_row++, next_block_row++; |
659 | output_col += compptr->DCT_h_scaled_size; | 659 | output_col += compptr->DCT_h_scaled_size; |
660 | } | 660 | } |
661 | output_ptr += compptr->DCT_v_scaled_size; | 661 | output_ptr += compptr->DCT_v_scaled_size; |
662 | } | 662 | } |
663 | } | 663 | } |
664 | 664 | ||
665 | if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows) | 665 | if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows) |
666 | return JPEG_ROW_COMPLETED; | 666 | return JPEG_ROW_COMPLETED; |
667 | return JPEG_SCAN_COMPLETED; | 667 | return JPEG_SCAN_COMPLETED; |
668 | } | 668 | } |
669 | 669 | ||
670 | #endif /* BLOCK_SMOOTHING_SUPPORTED */ | 670 | #endif /* BLOCK_SMOOTHING_SUPPORTED */ |
671 | 671 | ||
672 | 672 | ||
673 | /* | 673 | /* |
674 | * Initialize coefficient buffer controller. | 674 | * Initialize coefficient buffer controller. |
675 | */ | 675 | */ |
676 | 676 | ||
677 | GLOBAL(void) | 677 | GLOBAL(void) |
678 | jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer) | 678 | jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer) |
679 | { | 679 | { |
680 | my_coef_ptr coef; | 680 | my_coef_ptr coef; |
681 | 681 | ||
682 | coef = (my_coef_ptr) | 682 | coef = (my_coef_ptr) |
683 | (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, | 683 | (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, |
684 | SIZEOF(my_coef_controller)); | 684 | SIZEOF(my_coef_controller)); |
685 | cinfo->coef = (struct jpeg_d_coef_controller *) coef; | 685 | cinfo->coef = (struct jpeg_d_coef_controller *) coef; |
686 | coef->pub.start_input_pass = start_input_pass; | 686 | coef->pub.start_input_pass = start_input_pass; |
687 | coef->pub.start_output_pass = start_output_pass; | 687 | coef->pub.start_output_pass = start_output_pass; |
688 | #ifdef BLOCK_SMOOTHING_SUPPORTED | 688 | #ifdef BLOCK_SMOOTHING_SUPPORTED |
689 | coef->coef_bits_latch = NULL; | 689 | coef->coef_bits_latch = NULL; |
690 | #endif | 690 | #endif |
691 | 691 | ||
692 | /* Create the coefficient buffer. */ | 692 | /* Create the coefficient buffer. */ |
693 | if (need_full_buffer) { | 693 | if (need_full_buffer) { |
694 | #ifdef D_MULTISCAN_FILES_SUPPORTED | 694 | #ifdef D_MULTISCAN_FILES_SUPPORTED |
695 | /* Allocate a full-image virtual array for each component, */ | 695 | /* Allocate a full-image virtual array for each component, */ |
696 | /* padded to a multiple of samp_factor DCT blocks in each direction. */ | 696 | /* padded to a multiple of samp_factor DCT blocks in each direction. */ |
697 | /* Note we ask for a pre-zeroed array. */ | 697 | /* Note we ask for a pre-zeroed array. */ |
698 | int ci, access_rows; | 698 | int ci, access_rows; |
699 | jpeg_component_info *compptr; | 699 | jpeg_component_info *compptr; |
700 | 700 | ||
701 | for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; | 701 | for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; |
702 | ci++, compptr++) { | 702 | ci++, compptr++) { |
703 | access_rows = compptr->v_samp_factor; | 703 | access_rows = compptr->v_samp_factor; |
704 | #ifdef BLOCK_SMOOTHING_SUPPORTED | 704 | #ifdef BLOCK_SMOOTHING_SUPPORTED |
705 | /* If block smoothing could be used, need a bigger window */ | 705 | /* If block smoothing could be used, need a bigger window */ |
706 | if (cinfo->progressive_mode) | 706 | if (cinfo->progressive_mode) |
707 | access_rows *= 3; | 707 | access_rows *= 3; |
708 | #endif | 708 | #endif |
709 | coef->whole_image[ci] = (*cinfo->mem->request_virt_barray) | 709 | coef->whole_image[ci] = (*cinfo->mem->request_virt_barray) |
710 | ((j_common_ptr) cinfo, JPOOL_IMAGE, TRUE, | 710 | ((j_common_ptr) cinfo, JPOOL_IMAGE, TRUE, |
711 | (JDIMENSION) jround_up((long) compptr->width_in_blocks, | 711 | (JDIMENSION) jround_up((long) compptr->width_in_blocks, |
712 | (long) compptr->h_samp_factor), | 712 | (long) compptr->h_samp_factor), |
713 | (JDIMENSION) jround_up((long) compptr->height_in_blocks, | 713 | (JDIMENSION) jround_up((long) compptr->height_in_blocks, |
714 | (long) compptr->v_samp_factor), | 714 | (long) compptr->v_samp_factor), |
715 | (JDIMENSION) access_rows); | 715 | (JDIMENSION) access_rows); |
716 | } | 716 | } |
717 | coef->pub.consume_data = consume_data; | 717 | coef->pub.consume_data = consume_data; |
718 | coef->pub.decompress_data = decompress_data; | 718 | coef->pub.decompress_data = decompress_data; |
719 | coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */ | 719 | coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */ |
720 | #else | 720 | #else |
721 | ERREXIT(cinfo, JERR_NOT_COMPILED); | 721 | ERREXIT(cinfo, JERR_NOT_COMPILED); |
722 | #endif | 722 | #endif |
723 | } else { | 723 | } else { |
724 | /* We only need a single-MCU buffer. */ | 724 | /* We only need a single-MCU buffer. */ |
725 | JBLOCKROW buffer; | 725 | JBLOCKROW buffer; |
726 | int i; | 726 | int i; |
727 | 727 | ||
728 | buffer = (JBLOCKROW) | 728 | buffer = (JBLOCKROW) |
729 | (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, | 729 | (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, |
730 | D_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); | 730 | D_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); |
731 | for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) { | 731 | for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) { |
732 | coef->MCU_buffer[i] = buffer + i; | 732 | coef->MCU_buffer[i] = buffer + i; |
733 | } | 733 | } |
734 | if (cinfo->lim_Se == 0) /* DC only case: want to bypass later */ | 734 | if (cinfo->lim_Se == 0) /* DC only case: want to bypass later */ |
735 | FMEMZERO((void FAR *) buffer, | 735 | FMEMZERO((void FAR *) buffer, |
736 | (size_t) (D_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK))); | 736 | (size_t) (D_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK))); |
737 | coef->pub.consume_data = dummy_consume_data; | 737 | coef->pub.consume_data = dummy_consume_data; |
738 | coef->pub.decompress_data = decompress_onepass; | 738 | coef->pub.decompress_data = decompress_onepass; |
739 | coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */ | 739 | coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */ |
740 | } | 740 | } |
741 | } | 741 | } |