/src/libjpeg-turbo.2.0.x/jdapimin.c
| Line | Count | Source (jump to first uncovered line) | 
| 1 |  | /* | 
| 2 |  |  * jdapimin.c | 
| 3 |  |  * | 
| 4 |  |  * This file was part of the Independent JPEG Group's software: | 
| 5 |  |  * Copyright (C) 1994-1998, Thomas G. Lane. | 
| 6 |  |  * libjpeg-turbo Modifications: | 
| 7 |  |  * Copyright (C) 2016, D. R. Commander. | 
| 8 |  |  * For conditions of distribution and use, see the accompanying README.ijg | 
| 9 |  |  * file. | 
| 10 |  |  * | 
| 11 |  |  * This file contains application interface code for the decompression half | 
| 12 |  |  * of the JPEG library.  These are the "minimum" API routines that may be | 
| 13 |  |  * needed in either the normal full-decompression case or the | 
| 14 |  |  * transcoding-only case. | 
| 15 |  |  * | 
| 16 |  |  * Most of the routines intended to be called directly by an application | 
| 17 |  |  * are in this file or in jdapistd.c.  But also see jcomapi.c for routines | 
| 18 |  |  * shared by compression and decompression, and jdtrans.c for the transcoding | 
| 19 |  |  * case. | 
| 20 |  |  */ | 
| 21 |  |  | 
| 22 |  | #define JPEG_INTERNALS | 
| 23 |  | #include "jinclude.h" | 
| 24 |  | #include "jpeglib.h" | 
| 25 |  | #include "jdmaster.h" | 
| 26 |  | #include "jconfigint.h" | 
| 27 |  |  | 
| 28 |  |  | 
| 29 |  | /* | 
| 30 |  |  * Initialization of a JPEG decompression object. | 
| 31 |  |  * The error manager must already be set up (in case memory manager fails). | 
| 32 |  |  */ | 
| 33 |  |  | 
| 34 |  | GLOBAL(void) | 
| 35 |  | jpeg_CreateDecompress(j_decompress_ptr cinfo, int version, size_t structsize) | 
| 36 | 0 | { | 
| 37 | 0 |   int i; | 
| 38 |  |  | 
| 39 |  |   /* Guard against version mismatches between library and caller. */ | 
| 40 | 0 |   cinfo->mem = NULL;            /* so jpeg_destroy knows mem mgr not called */ | 
| 41 | 0 |   if (version != JPEG_LIB_VERSION) | 
| 42 | 0 |     ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version); | 
| 43 | 0 |   if (structsize != sizeof(struct jpeg_decompress_struct)) | 
| 44 | 0 |     ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, | 
| 45 | 0 |              (int)sizeof(struct jpeg_decompress_struct), (int)structsize); | 
| 46 |  |  | 
| 47 |  |   /* For debugging purposes, we zero the whole master structure. | 
| 48 |  |    * But the application has already set the err pointer, and may have set | 
| 49 |  |    * client_data, so we have to save and restore those fields. | 
| 50 |  |    * Note: if application hasn't set client_data, tools like Purify may | 
| 51 |  |    * complain here. | 
| 52 |  |    */ | 
| 53 | 0 |   { | 
| 54 | 0 |     struct jpeg_error_mgr *err = cinfo->err; | 
| 55 | 0 |     void *client_data = cinfo->client_data; /* ignore Purify complaint here */ | 
| 56 | 0 |     MEMZERO(cinfo, sizeof(struct jpeg_decompress_struct)); | 
| 57 | 0 |     cinfo->err = err; | 
| 58 | 0 |     cinfo->client_data = client_data; | 
| 59 | 0 |   } | 
| 60 | 0 |   cinfo->is_decompressor = TRUE; | 
| 61 |  |  | 
| 62 |  |   /* Initialize a memory manager instance for this object */ | 
| 63 | 0 |   jinit_memory_mgr((j_common_ptr)cinfo); | 
| 64 |  |  | 
| 65 |  |   /* Zero out pointers to permanent structures. */ | 
| 66 | 0 |   cinfo->progress = NULL; | 
| 67 | 0 |   cinfo->src = NULL; | 
| 68 |  | 
 | 
| 69 | 0 |   for (i = 0; i < NUM_QUANT_TBLS; i++) | 
| 70 | 0 |     cinfo->quant_tbl_ptrs[i] = NULL; | 
| 71 |  | 
 | 
| 72 | 0 |   for (i = 0; i < NUM_HUFF_TBLS; i++) { | 
| 73 | 0 |     cinfo->dc_huff_tbl_ptrs[i] = NULL; | 
| 74 | 0 |     cinfo->ac_huff_tbl_ptrs[i] = NULL; | 
| 75 | 0 |   } | 
| 76 |  |  | 
| 77 |  |   /* Initialize marker processor so application can override methods | 
| 78 |  |    * for COM, APPn markers before calling jpeg_read_header. | 
| 79 |  |    */ | 
| 80 | 0 |   cinfo->marker_list = NULL; | 
| 81 | 0 |   jinit_marker_reader(cinfo); | 
| 82 |  |  | 
| 83 |  |   /* And initialize the overall input controller. */ | 
| 84 | 0 |   jinit_input_controller(cinfo); | 
| 85 |  |  | 
| 86 |  |   /* OK, I'm ready */ | 
| 87 | 0 |   cinfo->global_state = DSTATE_START; | 
| 88 |  |  | 
| 89 |  |   /* The master struct is used to store extension parameters, so we allocate it | 
| 90 |  |    * here. | 
| 91 |  |    */ | 
| 92 | 0 |   cinfo->master = (struct jpeg_decomp_master *) | 
| 93 | 0 |     (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT, | 
| 94 | 0 |                                 sizeof(my_decomp_master)); | 
| 95 | 0 |   MEMZERO(cinfo->master, sizeof(my_decomp_master)); | 
| 96 | 0 | } | 
| 97 |  |  | 
| 98 |  |  | 
| 99 |  | /* | 
| 100 |  |  * Destruction of a JPEG decompression object | 
| 101 |  |  */ | 
| 102 |  |  | 
| 103 |  | GLOBAL(void) | 
| 104 |  | jpeg_destroy_decompress(j_decompress_ptr cinfo) | 
| 105 | 0 | { | 
| 106 | 0 |   jpeg_destroy((j_common_ptr)cinfo); /* use common routine */ | 
| 107 | 0 | } | 
| 108 |  |  | 
| 109 |  |  | 
| 110 |  | /* | 
| 111 |  |  * Abort processing of a JPEG decompression operation, | 
| 112 |  |  * but don't destroy the object itself. | 
| 113 |  |  */ | 
| 114 |  |  | 
| 115 |  | GLOBAL(void) | 
| 116 |  | jpeg_abort_decompress(j_decompress_ptr cinfo) | 
| 117 | 0 | { | 
| 118 | 0 |   jpeg_abort((j_common_ptr)cinfo); /* use common routine */ | 
| 119 | 0 | } | 
| 120 |  |  | 
| 121 |  |  | 
| 122 |  | /* | 
| 123 |  |  * Set default decompression parameters. | 
| 124 |  |  */ | 
| 125 |  |  | 
| 126 |  | LOCAL(void) | 
| 127 |  | default_decompress_parms(j_decompress_ptr cinfo) | 
| 128 | 0 | { | 
| 129 |  |   /* Guess the input colorspace, and set output colorspace accordingly. */ | 
| 130 |  |   /* (Wish JPEG committee had provided a real way to specify this...) */ | 
| 131 |  |   /* Note application may override our guesses. */ | 
| 132 | 0 |   switch (cinfo->num_components) { | 
| 133 | 0 |   case 1: | 
| 134 | 0 |     cinfo->jpeg_color_space = JCS_GRAYSCALE; | 
| 135 | 0 |     cinfo->out_color_space = JCS_GRAYSCALE; | 
| 136 | 0 |     break; | 
| 137 |  |  | 
| 138 | 0 |   case 3: | 
| 139 | 0 |     if (cinfo->saw_JFIF_marker) { | 
| 140 | 0 |       cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */ | 
| 141 | 0 |     } else if (cinfo->saw_Adobe_marker) { | 
| 142 | 0 |       switch (cinfo->Adobe_transform) { | 
| 143 | 0 |       case 0: | 
| 144 | 0 |         cinfo->jpeg_color_space = JCS_RGB; | 
| 145 | 0 |         break; | 
| 146 | 0 |       case 1: | 
| 147 | 0 |         cinfo->jpeg_color_space = JCS_YCbCr; | 
| 148 | 0 |         break; | 
| 149 | 0 |       default: | 
| 150 | 0 |         WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform); | 
| 151 | 0 |         cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */ | 
| 152 | 0 |         break; | 
| 153 | 0 |       } | 
| 154 | 0 |     } else { | 
| 155 |  |       /* Saw no special markers, try to guess from the component IDs */ | 
| 156 | 0 |       int cid0 = cinfo->comp_info[0].component_id; | 
| 157 | 0 |       int cid1 = cinfo->comp_info[1].component_id; | 
| 158 | 0 |       int cid2 = cinfo->comp_info[2].component_id; | 
| 159 |  | 
 | 
| 160 | 0 |       if (cid0 == 1 && cid1 == 2 && cid2 == 3) | 
| 161 | 0 |         cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */ | 
| 162 | 0 |       else if (cid0 == 82 && cid1 == 71 && cid2 == 66) | 
| 163 | 0 |         cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */ | 
| 164 | 0 |       else { | 
| 165 | 0 |         TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2); | 
| 166 | 0 |         cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */ | 
| 167 | 0 |       } | 
| 168 | 0 |     } | 
| 169 |  |     /* Always guess RGB is proper output colorspace. */ | 
| 170 | 0 |     cinfo->out_color_space = JCS_RGB; | 
| 171 | 0 |     break; | 
| 172 |  |  | 
| 173 | 0 |   case 4: | 
| 174 | 0 |     if (cinfo->saw_Adobe_marker) { | 
| 175 | 0 |       switch (cinfo->Adobe_transform) { | 
| 176 | 0 |       case 0: | 
| 177 | 0 |         cinfo->jpeg_color_space = JCS_CMYK; | 
| 178 | 0 |         break; | 
| 179 | 0 |       case 2: | 
| 180 | 0 |         cinfo->jpeg_color_space = JCS_YCCK; | 
| 181 | 0 |         break; | 
| 182 | 0 |       default: | 
| 183 | 0 |         WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform); | 
| 184 | 0 |         cinfo->jpeg_color_space = JCS_YCCK; /* assume it's YCCK */ | 
| 185 | 0 |         break; | 
| 186 | 0 |       } | 
| 187 | 0 |     } else { | 
| 188 |  |       /* No special markers, assume straight CMYK. */ | 
| 189 | 0 |       cinfo->jpeg_color_space = JCS_CMYK; | 
| 190 | 0 |     } | 
| 191 | 0 |     cinfo->out_color_space = JCS_CMYK; | 
| 192 | 0 |     break; | 
| 193 |  |  | 
| 194 | 0 |   default: | 
| 195 | 0 |     cinfo->jpeg_color_space = JCS_UNKNOWN; | 
| 196 | 0 |     cinfo->out_color_space = JCS_UNKNOWN; | 
| 197 | 0 |     break; | 
| 198 | 0 |   } | 
| 199 |  |  | 
| 200 |  |   /* Set defaults for other decompression parameters. */ | 
| 201 | 0 |   cinfo->scale_num = 1;         /* 1:1 scaling */ | 
| 202 | 0 |   cinfo->scale_denom = 1; | 
| 203 | 0 |   cinfo->output_gamma = 1.0; | 
| 204 | 0 |   cinfo->buffered_image = FALSE; | 
| 205 | 0 |   cinfo->raw_data_out = FALSE; | 
| 206 | 0 |   cinfo->dct_method = JDCT_DEFAULT; | 
| 207 | 0 |   cinfo->do_fancy_upsampling = TRUE; | 
| 208 | 0 |   cinfo->do_block_smoothing = TRUE; | 
| 209 | 0 |   cinfo->quantize_colors = FALSE; | 
| 210 |  |   /* We set these in case application only sets quantize_colors. */ | 
| 211 | 0 |   cinfo->dither_mode = JDITHER_FS; | 
| 212 | 0 | #ifdef QUANT_2PASS_SUPPORTED | 
| 213 | 0 |   cinfo->two_pass_quantize = TRUE; | 
| 214 |  | #else | 
| 215 |  |   cinfo->two_pass_quantize = FALSE; | 
| 216 |  | #endif | 
| 217 | 0 |   cinfo->desired_number_of_colors = 256; | 
| 218 | 0 |   cinfo->colormap = NULL; | 
| 219 |  |   /* Initialize for no mode change in buffered-image mode. */ | 
| 220 | 0 |   cinfo->enable_1pass_quant = FALSE; | 
| 221 | 0 |   cinfo->enable_external_quant = FALSE; | 
| 222 | 0 |   cinfo->enable_2pass_quant = FALSE; | 
| 223 | 0 | } | 
| 224 |  |  | 
| 225 |  |  | 
| 226 |  | /* | 
| 227 |  |  * Decompression startup: read start of JPEG datastream to see what's there. | 
| 228 |  |  * Need only initialize JPEG object and supply a data source before calling. | 
| 229 |  |  * | 
| 230 |  |  * This routine will read as far as the first SOS marker (ie, actual start of | 
| 231 |  |  * compressed data), and will save all tables and parameters in the JPEG | 
| 232 |  |  * object.  It will also initialize the decompression parameters to default | 
| 233 |  |  * values, and finally return JPEG_HEADER_OK.  On return, the application may | 
| 234 |  |  * adjust the decompression parameters and then call jpeg_start_decompress. | 
| 235 |  |  * (Or, if the application only wanted to determine the image parameters, | 
| 236 |  |  * the data need not be decompressed.  In that case, call jpeg_abort or | 
| 237 |  |  * jpeg_destroy to release any temporary space.) | 
| 238 |  |  * If an abbreviated (tables only) datastream is presented, the routine will | 
| 239 |  |  * return JPEG_HEADER_TABLES_ONLY upon reaching EOI.  The application may then | 
| 240 |  |  * re-use the JPEG object to read the abbreviated image datastream(s). | 
| 241 |  |  * It is unnecessary (but OK) to call jpeg_abort in this case. | 
| 242 |  |  * The JPEG_SUSPENDED return code only occurs if the data source module | 
| 243 |  |  * requests suspension of the decompressor.  In this case the application | 
| 244 |  |  * should load more source data and then re-call jpeg_read_header to resume | 
| 245 |  |  * processing. | 
| 246 |  |  * If a non-suspending data source is used and require_image is TRUE, then the | 
| 247 |  |  * return code need not be inspected since only JPEG_HEADER_OK is possible. | 
| 248 |  |  * | 
| 249 |  |  * This routine is now just a front end to jpeg_consume_input, with some | 
| 250 |  |  * extra error checking. | 
| 251 |  |  */ | 
| 252 |  |  | 
| 253 |  | GLOBAL(int) | 
| 254 |  | jpeg_read_header(j_decompress_ptr cinfo, boolean require_image) | 
| 255 | 0 | { | 
| 256 | 0 |   int retcode; | 
| 257 |  | 
 | 
| 258 | 0 |   if (cinfo->global_state != DSTATE_START && | 
| 259 | 0 |       cinfo->global_state != DSTATE_INHEADER) | 
| 260 | 0 |     ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); | 
| 261 |  | 
 | 
| 262 | 0 |   retcode = jpeg_consume_input(cinfo); | 
| 263 |  | 
 | 
| 264 | 0 |   switch (retcode) { | 
| 265 | 0 |   case JPEG_REACHED_SOS: | 
| 266 | 0 |     retcode = JPEG_HEADER_OK; | 
| 267 | 0 |     break; | 
| 268 | 0 |   case JPEG_REACHED_EOI: | 
| 269 | 0 |     if (require_image)          /* Complain if application wanted an image */ | 
| 270 | 0 |       ERREXIT(cinfo, JERR_NO_IMAGE); | 
| 271 |  |     /* Reset to start state; it would be safer to require the application to | 
| 272 |  |      * call jpeg_abort, but we can't change it now for compatibility reasons. | 
| 273 |  |      * A side effect is to free any temporary memory (there shouldn't be any). | 
| 274 |  |      */ | 
| 275 | 0 |     jpeg_abort((j_common_ptr)cinfo); /* sets state = DSTATE_START */ | 
| 276 | 0 |     retcode = JPEG_HEADER_TABLES_ONLY; | 
| 277 | 0 |     break; | 
| 278 | 0 |   case JPEG_SUSPENDED: | 
| 279 |  |     /* no work */ | 
| 280 | 0 |     break; | 
| 281 | 0 |   } | 
| 282 |  |  | 
| 283 | 0 |   return retcode; | 
| 284 | 0 | } | 
| 285 |  |  | 
| 286 |  |  | 
| 287 |  | /* | 
| 288 |  |  * Consume data in advance of what the decompressor requires. | 
| 289 |  |  * This can be called at any time once the decompressor object has | 
| 290 |  |  * been created and a data source has been set up. | 
| 291 |  |  * | 
| 292 |  |  * This routine is essentially a state machine that handles a couple | 
| 293 |  |  * of critical state-transition actions, namely initial setup and | 
| 294 |  |  * transition from header scanning to ready-for-start_decompress. | 
| 295 |  |  * All the actual input is done via the input controller's consume_input | 
| 296 |  |  * method. | 
| 297 |  |  */ | 
| 298 |  |  | 
| 299 |  | GLOBAL(int) | 
| 300 |  | jpeg_consume_input(j_decompress_ptr cinfo) | 
| 301 | 0 | { | 
| 302 | 0 |   int retcode = JPEG_SUSPENDED; | 
| 303 |  |  | 
| 304 |  |   /* NB: every possible DSTATE value should be listed in this switch */ | 
| 305 | 0 |   switch (cinfo->global_state) { | 
| 306 | 0 |   case DSTATE_START: | 
| 307 |  |     /* Start-of-datastream actions: reset appropriate modules */ | 
| 308 | 0 |     (*cinfo->inputctl->reset_input_controller) (cinfo); | 
| 309 |  |     /* Initialize application's data source module */ | 
| 310 | 0 |     (*cinfo->src->init_source) (cinfo); | 
| 311 | 0 |     cinfo->global_state = DSTATE_INHEADER; | 
| 312 |  |     FALLTHROUGH                 /*FALLTHROUGH*/ | 
| 313 | 0 |   case DSTATE_INHEADER: | 
| 314 | 0 |     retcode = (*cinfo->inputctl->consume_input) (cinfo); | 
| 315 | 0 |     if (retcode == JPEG_REACHED_SOS) { /* Found SOS, prepare to decompress */ | 
| 316 |  |       /* Set up default parameters based on header data */ | 
| 317 | 0 |       default_decompress_parms(cinfo); | 
| 318 |  |       /* Set global state: ready for start_decompress */ | 
| 319 | 0 |       cinfo->global_state = DSTATE_READY; | 
| 320 | 0 |     } | 
| 321 | 0 |     break; | 
| 322 | 0 |   case DSTATE_READY: | 
| 323 |  |     /* Can't advance past first SOS until start_decompress is called */ | 
| 324 | 0 |     retcode = JPEG_REACHED_SOS; | 
| 325 | 0 |     break; | 
| 326 | 0 |   case DSTATE_PRELOAD: | 
| 327 | 0 |   case DSTATE_PRESCAN: | 
| 328 | 0 |   case DSTATE_SCANNING: | 
| 329 | 0 |   case DSTATE_RAW_OK: | 
| 330 | 0 |   case DSTATE_BUFIMAGE: | 
| 331 | 0 |   case DSTATE_BUFPOST: | 
| 332 | 0 |   case DSTATE_STOPPING: | 
| 333 | 0 |     retcode = (*cinfo->inputctl->consume_input) (cinfo); | 
| 334 | 0 |     break; | 
| 335 | 0 |   default: | 
| 336 | 0 |     ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); | 
| 337 | 0 |   } | 
| 338 | 0 |   return retcode; | 
| 339 | 0 | } | 
| 340 |  |  | 
| 341 |  |  | 
| 342 |  | /* | 
| 343 |  |  * Have we finished reading the input file? | 
| 344 |  |  */ | 
| 345 |  |  | 
| 346 |  | GLOBAL(boolean) | 
| 347 |  | jpeg_input_complete(j_decompress_ptr cinfo) | 
| 348 | 0 | { | 
| 349 |  |   /* Check for valid jpeg object */ | 
| 350 | 0 |   if (cinfo->global_state < DSTATE_START || | 
| 351 | 0 |       cinfo->global_state > DSTATE_STOPPING) | 
| 352 | 0 |     ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); | 
| 353 | 0 |   return cinfo->inputctl->eoi_reached; | 
| 354 | 0 | } | 
| 355 |  |  | 
| 356 |  |  | 
| 357 |  | /* | 
| 358 |  |  * Is there more than one scan? | 
| 359 |  |  */ | 
| 360 |  |  | 
| 361 |  | GLOBAL(boolean) | 
| 362 |  | jpeg_has_multiple_scans(j_decompress_ptr cinfo) | 
| 363 | 0 | { | 
| 364 |  |   /* Only valid after jpeg_read_header completes */ | 
| 365 | 0 |   if (cinfo->global_state < DSTATE_READY || | 
| 366 | 0 |       cinfo->global_state > DSTATE_STOPPING) | 
| 367 | 0 |     ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); | 
| 368 | 0 |   return cinfo->inputctl->has_multiple_scans; | 
| 369 | 0 | } | 
| 370 |  |  | 
| 371 |  |  | 
| 372 |  | /* | 
| 373 |  |  * Finish JPEG decompression. | 
| 374 |  |  * | 
| 375 |  |  * This will normally just verify the file trailer and release temp storage. | 
| 376 |  |  * | 
| 377 |  |  * Returns FALSE if suspended.  The return value need be inspected only if | 
| 378 |  |  * a suspending data source is used. | 
| 379 |  |  */ | 
| 380 |  |  | 
| 381 |  | GLOBAL(boolean) | 
| 382 |  | jpeg_finish_decompress(j_decompress_ptr cinfo) | 
| 383 | 0 | { | 
| 384 | 0 |   if ((cinfo->global_state == DSTATE_SCANNING || | 
| 385 | 0 |        cinfo->global_state == DSTATE_RAW_OK) && !cinfo->buffered_image) { | 
| 386 |  |     /* Terminate final pass of non-buffered mode */ | 
| 387 | 0 |     if (cinfo->output_scanline < cinfo->output_height) | 
| 388 | 0 |       ERREXIT(cinfo, JERR_TOO_LITTLE_DATA); | 
| 389 | 0 |     (*cinfo->master->finish_output_pass) (cinfo); | 
| 390 | 0 |     cinfo->global_state = DSTATE_STOPPING; | 
| 391 | 0 |   } else if (cinfo->global_state == DSTATE_BUFIMAGE) { | 
| 392 |  |     /* Finishing after a buffered-image operation */ | 
| 393 | 0 |     cinfo->global_state = DSTATE_STOPPING; | 
| 394 | 0 |   } else if (cinfo->global_state != DSTATE_STOPPING) { | 
| 395 |  |     /* STOPPING = repeat call after a suspension, anything else is error */ | 
| 396 | 0 |     ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); | 
| 397 | 0 |   } | 
| 398 |  |   /* Read until EOI */ | 
| 399 | 0 |   while (!cinfo->inputctl->eoi_reached) { | 
| 400 | 0 |     if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED) | 
| 401 | 0 |       return FALSE;             /* Suspend, come back later */ | 
| 402 | 0 |   } | 
| 403 |  |   /* Do final cleanup */ | 
| 404 | 0 |   (*cinfo->src->term_source) (cinfo); | 
| 405 |  |   /* We can use jpeg_abort to release memory and reset global_state */ | 
| 406 | 0 |   jpeg_abort((j_common_ptr)cinfo); | 
| 407 | 0 |   return TRUE; | 
| 408 | 0 | } |