diff options
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jdapistd.c')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jdapistd.c | 550 |
1 files changed, 275 insertions, 275 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jdapistd.c b/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jdapistd.c index e81bd67..9d74537 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jdapistd.c +++ b/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jdapistd.c | |||
@@ -1,275 +1,275 @@ | |||
1 | /* | 1 | /* |
2 | * jdapistd.c | 2 | * jdapistd.c |
3 | * | 3 | * |
4 | * Copyright (C) 1994-1996, Thomas G. Lane. | 4 | * Copyright (C) 1994-1996, Thomas G. Lane. |
5 | * This file is part of the Independent JPEG Group's software. | 5 | * This file is part of the Independent JPEG Group's software. |
6 | * For conditions of distribution and use, see the accompanying README file. | 6 | * For conditions of distribution and use, see the accompanying README file. |
7 | * | 7 | * |
8 | * This file contains application interface code for the decompression half | 8 | * This file contains application interface code for the decompression half |
9 | * of the JPEG library. These are the "standard" API routines that are | 9 | * of the JPEG library. These are the "standard" API routines that are |
10 | * used in the normal full-decompression case. They are not used by a | 10 | * used in the normal full-decompression case. They are not used by a |
11 | * transcoding-only application. Note that if an application links in | 11 | * transcoding-only application. Note that if an application links in |
12 | * jpeg_start_decompress, it will end up linking in the entire decompressor. | 12 | * jpeg_start_decompress, it will end up linking in the entire decompressor. |
13 | * We thus must separate this file from jdapimin.c to avoid linking the | 13 | * We thus must separate this file from jdapimin.c to avoid linking the |
14 | * whole decompression library into a transcoder. | 14 | * whole decompression library into a transcoder. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #define JPEG_INTERNALS | 17 | #define JPEG_INTERNALS |
18 | #include "jinclude.h" | 18 | #include "jinclude.h" |
19 | #include "jpeglib.h" | 19 | #include "jpeglib.h" |
20 | 20 | ||
21 | 21 | ||
22 | /* Forward declarations */ | 22 | /* Forward declarations */ |
23 | LOCAL(boolean) output_pass_setup JPP((j_decompress_ptr cinfo)); | 23 | LOCAL(boolean) output_pass_setup JPP((j_decompress_ptr cinfo)); |
24 | 24 | ||
25 | 25 | ||
26 | /* | 26 | /* |
27 | * Decompression initialization. | 27 | * Decompression initialization. |
28 | * jpeg_read_header must be completed before calling this. | 28 | * jpeg_read_header must be completed before calling this. |
29 | * | 29 | * |
30 | * If a multipass operating mode was selected, this will do all but the | 30 | * If a multipass operating mode was selected, this will do all but the |
31 | * last pass, and thus may take a great deal of time. | 31 | * last pass, and thus may take a great deal of time. |
32 | * | 32 | * |
33 | * Returns FALSE if suspended. The return value need be inspected only if | 33 | * Returns FALSE if suspended. The return value need be inspected only if |
34 | * a suspending data source is used. | 34 | * a suspending data source is used. |
35 | */ | 35 | */ |
36 | 36 | ||
37 | GLOBAL(boolean) | 37 | GLOBAL(boolean) |
38 | jpeg_start_decompress (j_decompress_ptr cinfo) | 38 | jpeg_start_decompress (j_decompress_ptr cinfo) |
39 | { | 39 | { |
40 | if (cinfo->global_state == DSTATE_READY) { | 40 | if (cinfo->global_state == DSTATE_READY) { |
41 | /* First call: initialize master control, select active modules */ | 41 | /* First call: initialize master control, select active modules */ |
42 | jinit_master_decompress(cinfo); | 42 | jinit_master_decompress(cinfo); |
43 | if (cinfo->buffered_image) { | 43 | if (cinfo->buffered_image) { |
44 | /* No more work here; expecting jpeg_start_output next */ | 44 | /* No more work here; expecting jpeg_start_output next */ |
45 | cinfo->global_state = DSTATE_BUFIMAGE; | 45 | cinfo->global_state = DSTATE_BUFIMAGE; |
46 | return TRUE; | 46 | return TRUE; |
47 | } | 47 | } |
48 | cinfo->global_state = DSTATE_PRELOAD; | 48 | cinfo->global_state = DSTATE_PRELOAD; |
49 | } | 49 | } |
50 | if (cinfo->global_state == DSTATE_PRELOAD) { | 50 | if (cinfo->global_state == DSTATE_PRELOAD) { |
51 | /* If file has multiple scans, absorb them all into the coef buffer */ | 51 | /* If file has multiple scans, absorb them all into the coef buffer */ |
52 | if (cinfo->inputctl->has_multiple_scans) { | 52 | if (cinfo->inputctl->has_multiple_scans) { |
53 | #ifdef D_MULTISCAN_FILES_SUPPORTED | 53 | #ifdef D_MULTISCAN_FILES_SUPPORTED |
54 | for (;;) { | 54 | for (;;) { |
55 | int retcode; | 55 | int retcode; |
56 | /* Call progress monitor hook if present */ | 56 | /* Call progress monitor hook if present */ |
57 | if (cinfo->progress != NULL) | 57 | if (cinfo->progress != NULL) |
58 | (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); | 58 | (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); |
59 | /* Absorb some more input */ | 59 | /* Absorb some more input */ |
60 | retcode = (*cinfo->inputctl->consume_input) (cinfo); | 60 | retcode = (*cinfo->inputctl->consume_input) (cinfo); |
61 | if (retcode == JPEG_SUSPENDED) | 61 | if (retcode == JPEG_SUSPENDED) |
62 | return FALSE; | 62 | return FALSE; |
63 | if (retcode == JPEG_REACHED_EOI) | 63 | if (retcode == JPEG_REACHED_EOI) |
64 | break; | 64 | break; |
65 | /* Advance progress counter if appropriate */ | 65 | /* Advance progress counter if appropriate */ |
66 | if (cinfo->progress != NULL && | 66 | if (cinfo->progress != NULL && |
67 | (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) { | 67 | (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) { |
68 | if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) { | 68 | if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) { |
69 | /* jdmaster underestimated number of scans; ratchet up one scan */ | 69 | /* jdmaster underestimated number of scans; ratchet up one scan */ |
70 | cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows; | 70 | cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows; |
71 | } | 71 | } |
72 | } | 72 | } |
73 | } | 73 | } |
74 | #else | 74 | #else |
75 | ERREXIT(cinfo, JERR_NOT_COMPILED); | 75 | ERREXIT(cinfo, JERR_NOT_COMPILED); |
76 | #endif /* D_MULTISCAN_FILES_SUPPORTED */ | 76 | #endif /* D_MULTISCAN_FILES_SUPPORTED */ |
77 | } | 77 | } |
78 | cinfo->output_scan_number = cinfo->input_scan_number; | 78 | cinfo->output_scan_number = cinfo->input_scan_number; |
79 | } else if (cinfo->global_state != DSTATE_PRESCAN) | 79 | } else if (cinfo->global_state != DSTATE_PRESCAN) |
80 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); | 80 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); |
81 | /* Perform any dummy output passes, and set up for the final pass */ | 81 | /* Perform any dummy output passes, and set up for the final pass */ |
82 | return output_pass_setup(cinfo); | 82 | return output_pass_setup(cinfo); |
83 | } | 83 | } |
84 | 84 | ||
85 | 85 | ||
86 | /* | 86 | /* |
87 | * Set up for an output pass, and perform any dummy pass(es) needed. | 87 | * Set up for an output pass, and perform any dummy pass(es) needed. |
88 | * Common subroutine for jpeg_start_decompress and jpeg_start_output. | 88 | * Common subroutine for jpeg_start_decompress and jpeg_start_output. |
89 | * Entry: global_state = DSTATE_PRESCAN only if previously suspended. | 89 | * Entry: global_state = DSTATE_PRESCAN only if previously suspended. |
90 | * Exit: If done, returns TRUE and sets global_state for proper output mode. | 90 | * Exit: If done, returns TRUE and sets global_state for proper output mode. |
91 | * If suspended, returns FALSE and sets global_state = DSTATE_PRESCAN. | 91 | * If suspended, returns FALSE and sets global_state = DSTATE_PRESCAN. |
92 | */ | 92 | */ |
93 | 93 | ||
94 | LOCAL(boolean) | 94 | LOCAL(boolean) |
95 | output_pass_setup (j_decompress_ptr cinfo) | 95 | output_pass_setup (j_decompress_ptr cinfo) |
96 | { | 96 | { |
97 | if (cinfo->global_state != DSTATE_PRESCAN) { | 97 | if (cinfo->global_state != DSTATE_PRESCAN) { |
98 | /* First call: do pass setup */ | 98 | /* First call: do pass setup */ |
99 | (*cinfo->master->prepare_for_output_pass) (cinfo); | 99 | (*cinfo->master->prepare_for_output_pass) (cinfo); |
100 | cinfo->output_scanline = 0; | 100 | cinfo->output_scanline = 0; |
101 | cinfo->global_state = DSTATE_PRESCAN; | 101 | cinfo->global_state = DSTATE_PRESCAN; |
102 | } | 102 | } |
103 | /* Loop over any required dummy passes */ | 103 | /* Loop over any required dummy passes */ |
104 | while (cinfo->master->is_dummy_pass) { | 104 | while (cinfo->master->is_dummy_pass) { |
105 | #ifdef QUANT_2PASS_SUPPORTED | 105 | #ifdef QUANT_2PASS_SUPPORTED |
106 | /* Crank through the dummy pass */ | 106 | /* Crank through the dummy pass */ |
107 | while (cinfo->output_scanline < cinfo->output_height) { | 107 | while (cinfo->output_scanline < cinfo->output_height) { |
108 | JDIMENSION last_scanline; | 108 | JDIMENSION last_scanline; |
109 | /* Call progress monitor hook if present */ | 109 | /* Call progress monitor hook if present */ |
110 | if (cinfo->progress != NULL) { | 110 | if (cinfo->progress != NULL) { |
111 | cinfo->progress->pass_counter = (long) cinfo->output_scanline; | 111 | cinfo->progress->pass_counter = (long) cinfo->output_scanline; |
112 | cinfo->progress->pass_limit = (long) cinfo->output_height; | 112 | cinfo->progress->pass_limit = (long) cinfo->output_height; |
113 | (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); | 113 | (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); |
114 | } | 114 | } |
115 | /* Process some data */ | 115 | /* Process some data */ |
116 | last_scanline = cinfo->output_scanline; | 116 | last_scanline = cinfo->output_scanline; |
117 | (*cinfo->main->process_data) (cinfo, (JSAMPARRAY) NULL, | 117 | (*cinfo->main->process_data) (cinfo, (JSAMPARRAY) NULL, |
118 | &cinfo->output_scanline, (JDIMENSION) 0); | 118 | &cinfo->output_scanline, (JDIMENSION) 0); |
119 | if (cinfo->output_scanline == last_scanline) | 119 | if (cinfo->output_scanline == last_scanline) |
120 | return FALSE; /* No progress made, must suspend */ | 120 | return FALSE; /* No progress made, must suspend */ |
121 | } | 121 | } |
122 | /* Finish up dummy pass, and set up for another one */ | 122 | /* Finish up dummy pass, and set up for another one */ |
123 | (*cinfo->master->finish_output_pass) (cinfo); | 123 | (*cinfo->master->finish_output_pass) (cinfo); |
124 | (*cinfo->master->prepare_for_output_pass) (cinfo); | 124 | (*cinfo->master->prepare_for_output_pass) (cinfo); |
125 | cinfo->output_scanline = 0; | 125 | cinfo->output_scanline = 0; |
126 | #else | 126 | #else |
127 | ERREXIT(cinfo, JERR_NOT_COMPILED); | 127 | ERREXIT(cinfo, JERR_NOT_COMPILED); |
128 | #endif /* QUANT_2PASS_SUPPORTED */ | 128 | #endif /* QUANT_2PASS_SUPPORTED */ |
129 | } | 129 | } |
130 | /* Ready for application to drive output pass through | 130 | /* Ready for application to drive output pass through |
131 | * jpeg_read_scanlines or jpeg_read_raw_data. | 131 | * jpeg_read_scanlines or jpeg_read_raw_data. |
132 | */ | 132 | */ |
133 | cinfo->global_state = cinfo->raw_data_out ? DSTATE_RAW_OK : DSTATE_SCANNING; | 133 | cinfo->global_state = cinfo->raw_data_out ? DSTATE_RAW_OK : DSTATE_SCANNING; |
134 | return TRUE; | 134 | return TRUE; |
135 | } | 135 | } |
136 | 136 | ||
137 | 137 | ||
138 | /* | 138 | /* |
139 | * Read some scanlines of data from the JPEG decompressor. | 139 | * Read some scanlines of data from the JPEG decompressor. |
140 | * | 140 | * |
141 | * The return value will be the number of lines actually read. | 141 | * The return value will be the number of lines actually read. |
142 | * This may be less than the number requested in several cases, | 142 | * This may be less than the number requested in several cases, |
143 | * including bottom of image, data source suspension, and operating | 143 | * including bottom of image, data source suspension, and operating |
144 | * modes that emit multiple scanlines at a time. | 144 | * modes that emit multiple scanlines at a time. |
145 | * | 145 | * |
146 | * Note: we warn about excess calls to jpeg_read_scanlines() since | 146 | * Note: we warn about excess calls to jpeg_read_scanlines() since |
147 | * this likely signals an application programmer error. However, | 147 | * this likely signals an application programmer error. However, |
148 | * an oversize buffer (max_lines > scanlines remaining) is not an error. | 148 | * an oversize buffer (max_lines > scanlines remaining) is not an error. |
149 | */ | 149 | */ |
150 | 150 | ||
151 | GLOBAL(JDIMENSION) | 151 | GLOBAL(JDIMENSION) |
152 | jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines, | 152 | jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines, |
153 | JDIMENSION max_lines) | 153 | JDIMENSION max_lines) |
154 | { | 154 | { |
155 | JDIMENSION row_ctr; | 155 | JDIMENSION row_ctr; |
156 | 156 | ||
157 | if (cinfo->global_state != DSTATE_SCANNING) | 157 | if (cinfo->global_state != DSTATE_SCANNING) |
158 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); | 158 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); |
159 | if (cinfo->output_scanline >= cinfo->output_height) { | 159 | if (cinfo->output_scanline >= cinfo->output_height) { |
160 | WARNMS(cinfo, JWRN_TOO_MUCH_DATA); | 160 | WARNMS(cinfo, JWRN_TOO_MUCH_DATA); |
161 | return 0; | 161 | return 0; |
162 | } | 162 | } |
163 | 163 | ||
164 | /* Call progress monitor hook if present */ | 164 | /* Call progress monitor hook if present */ |
165 | if (cinfo->progress != NULL) { | 165 | if (cinfo->progress != NULL) { |
166 | cinfo->progress->pass_counter = (long) cinfo->output_scanline; | 166 | cinfo->progress->pass_counter = (long) cinfo->output_scanline; |
167 | cinfo->progress->pass_limit = (long) cinfo->output_height; | 167 | cinfo->progress->pass_limit = (long) cinfo->output_height; |
168 | (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); | 168 | (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); |
169 | } | 169 | } |
170 | 170 | ||
171 | /* Process some data */ | 171 | /* Process some data */ |
172 | row_ctr = 0; | 172 | row_ctr = 0; |
173 | (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, max_lines); | 173 | (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, max_lines); |
174 | cinfo->output_scanline += row_ctr; | 174 | cinfo->output_scanline += row_ctr; |
175 | return row_ctr; | 175 | return row_ctr; |
176 | } | 176 | } |
177 | 177 | ||
178 | 178 | ||
179 | /* | 179 | /* |
180 | * Alternate entry point to read raw data. | 180 | * Alternate entry point to read raw data. |
181 | * Processes exactly one iMCU row per call, unless suspended. | 181 | * Processes exactly one iMCU row per call, unless suspended. |
182 | */ | 182 | */ |
183 | 183 | ||
184 | GLOBAL(JDIMENSION) | 184 | GLOBAL(JDIMENSION) |
185 | jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data, | 185 | jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data, |
186 | JDIMENSION max_lines) | 186 | JDIMENSION max_lines) |
187 | { | 187 | { |
188 | JDIMENSION lines_per_iMCU_row; | 188 | JDIMENSION lines_per_iMCU_row; |
189 | 189 | ||
190 | if (cinfo->global_state != DSTATE_RAW_OK) | 190 | if (cinfo->global_state != DSTATE_RAW_OK) |
191 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); | 191 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); |
192 | if (cinfo->output_scanline >= cinfo->output_height) { | 192 | if (cinfo->output_scanline >= cinfo->output_height) { |
193 | WARNMS(cinfo, JWRN_TOO_MUCH_DATA); | 193 | WARNMS(cinfo, JWRN_TOO_MUCH_DATA); |
194 | return 0; | 194 | return 0; |
195 | } | 195 | } |
196 | 196 | ||
197 | /* Call progress monitor hook if present */ | 197 | /* Call progress monitor hook if present */ |
198 | if (cinfo->progress != NULL) { | 198 | if (cinfo->progress != NULL) { |
199 | cinfo->progress->pass_counter = (long) cinfo->output_scanline; | 199 | cinfo->progress->pass_counter = (long) cinfo->output_scanline; |
200 | cinfo->progress->pass_limit = (long) cinfo->output_height; | 200 | cinfo->progress->pass_limit = (long) cinfo->output_height; |
201 | (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); | 201 | (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); |
202 | } | 202 | } |
203 | 203 | ||
204 | /* Verify that at least one iMCU row can be returned. */ | 204 | /* Verify that at least one iMCU row can be returned. */ |
205 | lines_per_iMCU_row = cinfo->max_v_samp_factor * cinfo->min_DCT_v_scaled_size; | 205 | lines_per_iMCU_row = cinfo->max_v_samp_factor * cinfo->min_DCT_v_scaled_size; |
206 | if (max_lines < lines_per_iMCU_row) | 206 | if (max_lines < lines_per_iMCU_row) |
207 | ERREXIT(cinfo, JERR_BUFFER_SIZE); | 207 | ERREXIT(cinfo, JERR_BUFFER_SIZE); |
208 | 208 | ||
209 | /* Decompress directly into user's buffer. */ | 209 | /* Decompress directly into user's buffer. */ |
210 | if (! (*cinfo->coef->decompress_data) (cinfo, data)) | 210 | if (! (*cinfo->coef->decompress_data) (cinfo, data)) |
211 | return 0; /* suspension forced, can do nothing more */ | 211 | return 0; /* suspension forced, can do nothing more */ |
212 | 212 | ||
213 | /* OK, we processed one iMCU row. */ | 213 | /* OK, we processed one iMCU row. */ |
214 | cinfo->output_scanline += lines_per_iMCU_row; | 214 | cinfo->output_scanline += lines_per_iMCU_row; |
215 | return lines_per_iMCU_row; | 215 | return lines_per_iMCU_row; |
216 | } | 216 | } |
217 | 217 | ||
218 | 218 | ||
219 | /* Additional entry points for buffered-image mode. */ | 219 | /* Additional entry points for buffered-image mode. */ |
220 | 220 | ||
221 | #ifdef D_MULTISCAN_FILES_SUPPORTED | 221 | #ifdef D_MULTISCAN_FILES_SUPPORTED |
222 | 222 | ||
223 | /* | 223 | /* |
224 | * Initialize for an output pass in buffered-image mode. | 224 | * Initialize for an output pass in buffered-image mode. |
225 | */ | 225 | */ |
226 | 226 | ||
227 | GLOBAL(boolean) | 227 | GLOBAL(boolean) |
228 | jpeg_start_output (j_decompress_ptr cinfo, int scan_number) | 228 | jpeg_start_output (j_decompress_ptr cinfo, int scan_number) |
229 | { | 229 | { |
230 | if (cinfo->global_state != DSTATE_BUFIMAGE && | 230 | if (cinfo->global_state != DSTATE_BUFIMAGE && |
231 | cinfo->global_state != DSTATE_PRESCAN) | 231 | cinfo->global_state != DSTATE_PRESCAN) |
232 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); | 232 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); |
233 | /* Limit scan number to valid range */ | 233 | /* Limit scan number to valid range */ |
234 | if (scan_number <= 0) | 234 | if (scan_number <= 0) |
235 | scan_number = 1; | 235 | scan_number = 1; |
236 | if (cinfo->inputctl->eoi_reached && | 236 | if (cinfo->inputctl->eoi_reached && |
237 | scan_number > cinfo->input_scan_number) | 237 | scan_number > cinfo->input_scan_number) |
238 | scan_number = cinfo->input_scan_number; | 238 | scan_number = cinfo->input_scan_number; |
239 | cinfo->output_scan_number = scan_number; | 239 | cinfo->output_scan_number = scan_number; |
240 | /* Perform any dummy output passes, and set up for the real pass */ | 240 | /* Perform any dummy output passes, and set up for the real pass */ |
241 | return output_pass_setup(cinfo); | 241 | return output_pass_setup(cinfo); |
242 | } | 242 | } |
243 | 243 | ||
244 | 244 | ||
245 | /* | 245 | /* |
246 | * Finish up after an output pass in buffered-image mode. | 246 | * Finish up after an output pass in buffered-image mode. |
247 | * | 247 | * |
248 | * Returns FALSE if suspended. The return value need be inspected only if | 248 | * Returns FALSE if suspended. The return value need be inspected only if |
249 | * a suspending data source is used. | 249 | * a suspending data source is used. |
250 | */ | 250 | */ |
251 | 251 | ||
252 | GLOBAL(boolean) | 252 | GLOBAL(boolean) |
253 | jpeg_finish_output (j_decompress_ptr cinfo) | 253 | jpeg_finish_output (j_decompress_ptr cinfo) |
254 | { | 254 | { |
255 | if ((cinfo->global_state == DSTATE_SCANNING || | 255 | if ((cinfo->global_state == DSTATE_SCANNING || |
256 | cinfo->global_state == DSTATE_RAW_OK) && cinfo->buffered_image) { | 256 | cinfo->global_state == DSTATE_RAW_OK) && cinfo->buffered_image) { |
257 | /* Terminate this pass. */ | 257 | /* Terminate this pass. */ |
258 | /* We do not require the whole pass to have been completed. */ | 258 | /* We do not require the whole pass to have been completed. */ |
259 | (*cinfo->master->finish_output_pass) (cinfo); | 259 | (*cinfo->master->finish_output_pass) (cinfo); |
260 | cinfo->global_state = DSTATE_BUFPOST; | 260 | cinfo->global_state = DSTATE_BUFPOST; |
261 | } else if (cinfo->global_state != DSTATE_BUFPOST) { | 261 | } else if (cinfo->global_state != DSTATE_BUFPOST) { |
262 | /* BUFPOST = repeat call after a suspension, anything else is error */ | 262 | /* BUFPOST = repeat call after a suspension, anything else is error */ |
263 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); | 263 | ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); |
264 | } | 264 | } |
265 | /* Read markers looking for SOS or EOI */ | 265 | /* Read markers looking for SOS or EOI */ |
266 | while (cinfo->input_scan_number <= cinfo->output_scan_number && | 266 | while (cinfo->input_scan_number <= cinfo->output_scan_number && |
267 | ! cinfo->inputctl->eoi_reached) { | 267 | ! cinfo->inputctl->eoi_reached) { |
268 | if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED) | 268 | if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED) |
269 | return FALSE; /* Suspend, come back later */ | 269 | return FALSE; /* Suspend, come back later */ |
270 | } | 270 | } |
271 | cinfo->global_state = DSTATE_BUFIMAGE; | 271 | cinfo->global_state = DSTATE_BUFIMAGE; |
272 | return TRUE; | 272 | return TRUE; |
273 | } | 273 | } |
274 | 274 | ||
275 | #endif /* D_MULTISCAN_FILES_SUPPORTED */ | 275 | #endif /* D_MULTISCAN_FILES_SUPPORTED */ |