00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #define JPEG_INTERNALS
00016 #include "jinclude.h"
00017 #include "jpeglib.h"
00018
00019
00020
00021
00022 typedef struct {
00023 struct jpeg_input_controller pub;
00024
00025 int inheaders;
00026 } my_input_controller;
00027
00028 typedef my_input_controller * my_inputctl_ptr;
00029
00030
00031
00032 METHODDEF(int) consume_markers JPP((j_decompress_ptr cinfo));
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 GLOBAL(void)
00047 jpeg_core_output_dimensions (j_decompress_ptr cinfo)
00048
00049
00050
00051 {
00052 #ifdef IDCT_SCALING_SUPPORTED
00053 int ci;
00054 jpeg_component_info *compptr;
00055
00056
00057 if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom) {
00058
00059 cinfo->output_width = (JDIMENSION)
00060 jdiv_round_up((long) cinfo->image_width, (long) cinfo->block_size);
00061 cinfo->output_height = (JDIMENSION)
00062 jdiv_round_up((long) cinfo->image_height, (long) cinfo->block_size);
00063 cinfo->min_DCT_h_scaled_size = 1;
00064 cinfo->min_DCT_v_scaled_size = 1;
00065 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 2) {
00066
00067 cinfo->output_width = (JDIMENSION)
00068 jdiv_round_up((long) cinfo->image_width * 2L, (long) cinfo->block_size);
00069 cinfo->output_height = (JDIMENSION)
00070 jdiv_round_up((long) cinfo->image_height * 2L, (long) cinfo->block_size);
00071 cinfo->min_DCT_h_scaled_size = 2;
00072 cinfo->min_DCT_v_scaled_size = 2;
00073 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 3) {
00074
00075 cinfo->output_width = (JDIMENSION)
00076 jdiv_round_up((long) cinfo->image_width * 3L, (long) cinfo->block_size);
00077 cinfo->output_height = (JDIMENSION)
00078 jdiv_round_up((long) cinfo->image_height * 3L, (long) cinfo->block_size);
00079 cinfo->min_DCT_h_scaled_size = 3;
00080 cinfo->min_DCT_v_scaled_size = 3;
00081 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 4) {
00082
00083 cinfo->output_width = (JDIMENSION)
00084 jdiv_round_up((long) cinfo->image_width * 4L, (long) cinfo->block_size);
00085 cinfo->output_height = (JDIMENSION)
00086 jdiv_round_up((long) cinfo->image_height * 4L, (long) cinfo->block_size);
00087 cinfo->min_DCT_h_scaled_size = 4;
00088 cinfo->min_DCT_v_scaled_size = 4;
00089 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 5) {
00090
00091 cinfo->output_width = (JDIMENSION)
00092 jdiv_round_up((long) cinfo->image_width * 5L, (long) cinfo->block_size);
00093 cinfo->output_height = (JDIMENSION)
00094 jdiv_round_up((long) cinfo->image_height * 5L, (long) cinfo->block_size);
00095 cinfo->min_DCT_h_scaled_size = 5;
00096 cinfo->min_DCT_v_scaled_size = 5;
00097 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 6) {
00098
00099 cinfo->output_width = (JDIMENSION)
00100 jdiv_round_up((long) cinfo->image_width * 6L, (long) cinfo->block_size);
00101 cinfo->output_height = (JDIMENSION)
00102 jdiv_round_up((long) cinfo->image_height * 6L, (long) cinfo->block_size);
00103 cinfo->min_DCT_h_scaled_size = 6;
00104 cinfo->min_DCT_v_scaled_size = 6;
00105 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 7) {
00106
00107 cinfo->output_width = (JDIMENSION)
00108 jdiv_round_up((long) cinfo->image_width * 7L, (long) cinfo->block_size);
00109 cinfo->output_height = (JDIMENSION)
00110 jdiv_round_up((long) cinfo->image_height * 7L, (long) cinfo->block_size);
00111 cinfo->min_DCT_h_scaled_size = 7;
00112 cinfo->min_DCT_v_scaled_size = 7;
00113 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 8) {
00114
00115 cinfo->output_width = (JDIMENSION)
00116 jdiv_round_up((long) cinfo->image_width * 8L, (long) cinfo->block_size);
00117 cinfo->output_height = (JDIMENSION)
00118 jdiv_round_up((long) cinfo->image_height * 8L, (long) cinfo->block_size);
00119 cinfo->min_DCT_h_scaled_size = 8;
00120 cinfo->min_DCT_v_scaled_size = 8;
00121 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 9) {
00122
00123 cinfo->output_width = (JDIMENSION)
00124 jdiv_round_up((long) cinfo->image_width * 9L, (long) cinfo->block_size);
00125 cinfo->output_height = (JDIMENSION)
00126 jdiv_round_up((long) cinfo->image_height * 9L, (long) cinfo->block_size);
00127 cinfo->min_DCT_h_scaled_size = 9;
00128 cinfo->min_DCT_v_scaled_size = 9;
00129 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 10) {
00130
00131 cinfo->output_width = (JDIMENSION)
00132 jdiv_round_up((long) cinfo->image_width * 10L, (long) cinfo->block_size);
00133 cinfo->output_height = (JDIMENSION)
00134 jdiv_round_up((long) cinfo->image_height * 10L, (long) cinfo->block_size);
00135 cinfo->min_DCT_h_scaled_size = 10;
00136 cinfo->min_DCT_v_scaled_size = 10;
00137 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 11) {
00138
00139 cinfo->output_width = (JDIMENSION)
00140 jdiv_round_up((long) cinfo->image_width * 11L, (long) cinfo->block_size);
00141 cinfo->output_height = (JDIMENSION)
00142 jdiv_round_up((long) cinfo->image_height * 11L, (long) cinfo->block_size);
00143 cinfo->min_DCT_h_scaled_size = 11;
00144 cinfo->min_DCT_v_scaled_size = 11;
00145 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 12) {
00146
00147 cinfo->output_width = (JDIMENSION)
00148 jdiv_round_up((long) cinfo->image_width * 12L, (long) cinfo->block_size);
00149 cinfo->output_height = (JDIMENSION)
00150 jdiv_round_up((long) cinfo->image_height * 12L, (long) cinfo->block_size);
00151 cinfo->min_DCT_h_scaled_size = 12;
00152 cinfo->min_DCT_v_scaled_size = 12;
00153 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 13) {
00154
00155 cinfo->output_width = (JDIMENSION)
00156 jdiv_round_up((long) cinfo->image_width * 13L, (long) cinfo->block_size);
00157 cinfo->output_height = (JDIMENSION)
00158 jdiv_round_up((long) cinfo->image_height * 13L, (long) cinfo->block_size);
00159 cinfo->min_DCT_h_scaled_size = 13;
00160 cinfo->min_DCT_v_scaled_size = 13;
00161 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 14) {
00162
00163 cinfo->output_width = (JDIMENSION)
00164 jdiv_round_up((long) cinfo->image_width * 14L, (long) cinfo->block_size);
00165 cinfo->output_height = (JDIMENSION)
00166 jdiv_round_up((long) cinfo->image_height * 14L, (long) cinfo->block_size);
00167 cinfo->min_DCT_h_scaled_size = 14;
00168 cinfo->min_DCT_v_scaled_size = 14;
00169 } else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 15) {
00170
00171 cinfo->output_width = (JDIMENSION)
00172 jdiv_round_up((long) cinfo->image_width * 15L, (long) cinfo->block_size);
00173 cinfo->output_height = (JDIMENSION)
00174 jdiv_round_up((long) cinfo->image_height * 15L, (long) cinfo->block_size);
00175 cinfo->min_DCT_h_scaled_size = 15;
00176 cinfo->min_DCT_v_scaled_size = 15;
00177 } else {
00178
00179 cinfo->output_width = (JDIMENSION)
00180 jdiv_round_up((long) cinfo->image_width * 16L, (long) cinfo->block_size);
00181 cinfo->output_height = (JDIMENSION)
00182 jdiv_round_up((long) cinfo->image_height * 16L, (long) cinfo->block_size);
00183 cinfo->min_DCT_h_scaled_size = 16;
00184 cinfo->min_DCT_v_scaled_size = 16;
00185 }
00186
00187
00188 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
00189 ci++, compptr++) {
00190 compptr->DCT_h_scaled_size = cinfo->min_DCT_h_scaled_size;
00191 compptr->DCT_v_scaled_size = cinfo->min_DCT_v_scaled_size;
00192 }
00193
00194 #else
00195
00196
00197 cinfo->output_width = cinfo->image_width;
00198 cinfo->output_height = cinfo->image_height;
00199
00200
00201
00202
00203 #endif
00204 }
00205
00206
00207 LOCAL(void)
00208 initial_setup (j_decompress_ptr cinfo)
00209
00210 {
00211 int ci;
00212 jpeg_component_info *compptr;
00213
00214
00215 if ((long) cinfo->image_height > (long) JPEG_MAX_DIMENSION ||
00216 (long) cinfo->image_width > (long) JPEG_MAX_DIMENSION)
00217 ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);
00218
00219
00220 if (cinfo->data_precision != BITS_IN_JSAMPLE)
00221 ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
00222
00223
00224 if (cinfo->num_components > MAX_COMPONENTS)
00225 ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
00226 MAX_COMPONENTS);
00227
00228
00229 cinfo->max_h_samp_factor = 1;
00230 cinfo->max_v_samp_factor = 1;
00231 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
00232 ci++, compptr++) {
00233 if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR ||
00234 compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR)
00235 ERREXIT(cinfo, JERR_BAD_SAMPLING);
00236 cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
00237 compptr->h_samp_factor);
00238 cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
00239 compptr->v_samp_factor);
00240 }
00241
00242
00243 if (cinfo->is_baseline || (cinfo->progressive_mode &&
00244 cinfo->comps_in_scan)) {
00245 cinfo->block_size = DCTSIZE;
00246 cinfo->natural_order = jpeg_natural_order;
00247 cinfo->lim_Se = DCTSIZE2-1;
00248 } else
00249 switch (cinfo->Se) {
00250 case (1*1-1):
00251 cinfo->block_size = 1;
00252 cinfo->natural_order = jpeg_natural_order;
00253 cinfo->lim_Se = cinfo->Se;
00254 break;
00255 case (2*2-1):
00256 cinfo->block_size = 2;
00257 cinfo->natural_order = jpeg_natural_order2;
00258 cinfo->lim_Se = cinfo->Se;
00259 break;
00260 case (3*3-1):
00261 cinfo->block_size = 3;
00262 cinfo->natural_order = jpeg_natural_order3;
00263 cinfo->lim_Se = cinfo->Se;
00264 break;
00265 case (4*4-1):
00266 cinfo->block_size = 4;
00267 cinfo->natural_order = jpeg_natural_order4;
00268 cinfo->lim_Se = cinfo->Se;
00269 break;
00270 case (5*5-1):
00271 cinfo->block_size = 5;
00272 cinfo->natural_order = jpeg_natural_order5;
00273 cinfo->lim_Se = cinfo->Se;
00274 break;
00275 case (6*6-1):
00276 cinfo->block_size = 6;
00277 cinfo->natural_order = jpeg_natural_order6;
00278 cinfo->lim_Se = cinfo->Se;
00279 break;
00280 case (7*7-1):
00281 cinfo->block_size = 7;
00282 cinfo->natural_order = jpeg_natural_order7;
00283 cinfo->lim_Se = cinfo->Se;
00284 break;
00285 case (8*8-1):
00286 cinfo->block_size = 8;
00287 cinfo->natural_order = jpeg_natural_order;
00288 cinfo->lim_Se = DCTSIZE2-1;
00289 break;
00290 case (9*9-1):
00291 cinfo->block_size = 9;
00292 cinfo->natural_order = jpeg_natural_order;
00293 cinfo->lim_Se = DCTSIZE2-1;
00294 break;
00295 case (10*10-1):
00296 cinfo->block_size = 10;
00297 cinfo->natural_order = jpeg_natural_order;
00298 cinfo->lim_Se = DCTSIZE2-1;
00299 break;
00300 case (11*11-1):
00301 cinfo->block_size = 11;
00302 cinfo->natural_order = jpeg_natural_order;
00303 cinfo->lim_Se = DCTSIZE2-1;
00304 break;
00305 case (12*12-1):
00306 cinfo->block_size = 12;
00307 cinfo->natural_order = jpeg_natural_order;
00308 cinfo->lim_Se = DCTSIZE2-1;
00309 break;
00310 case (13*13-1):
00311 cinfo->block_size = 13;
00312 cinfo->natural_order = jpeg_natural_order;
00313 cinfo->lim_Se = DCTSIZE2-1;
00314 break;
00315 case (14*14-1):
00316 cinfo->block_size = 14;
00317 cinfo->natural_order = jpeg_natural_order;
00318 cinfo->lim_Se = DCTSIZE2-1;
00319 break;
00320 case (15*15-1):
00321 cinfo->block_size = 15;
00322 cinfo->natural_order = jpeg_natural_order;
00323 cinfo->lim_Se = DCTSIZE2-1;
00324 break;
00325 case (16*16-1):
00326 cinfo->block_size = 16;
00327 cinfo->natural_order = jpeg_natural_order;
00328 cinfo->lim_Se = DCTSIZE2-1;
00329 break;
00330 default:
00331 ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
00332 cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
00333 break;
00334 }
00335
00336
00337
00338
00339
00340
00341
00342 cinfo->min_DCT_h_scaled_size = cinfo->block_size;
00343 cinfo->min_DCT_v_scaled_size = cinfo->block_size;
00344
00345
00346 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
00347 ci++, compptr++) {
00348 compptr->DCT_h_scaled_size = cinfo->block_size;
00349 compptr->DCT_v_scaled_size = cinfo->block_size;
00350
00351 compptr->width_in_blocks = (JDIMENSION)
00352 jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
00353 (long) (cinfo->max_h_samp_factor * cinfo->block_size));
00354 compptr->height_in_blocks = (JDIMENSION)
00355 jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
00356 (long) (cinfo->max_v_samp_factor * cinfo->block_size));
00357
00358
00359
00360
00361
00362 compptr->downsampled_width = (JDIMENSION)
00363 jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
00364 (long) cinfo->max_h_samp_factor);
00365 compptr->downsampled_height = (JDIMENSION)
00366 jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
00367 (long) cinfo->max_v_samp_factor);
00368
00369 compptr->component_needed = TRUE;
00370
00371 compptr->quant_table = NULL;
00372 }
00373
00374
00375 cinfo->total_iMCU_rows = (JDIMENSION)
00376 jdiv_round_up((long) cinfo->image_height,
00377 (long) (cinfo->max_v_samp_factor * cinfo->block_size));
00378
00379
00380 if (cinfo->comps_in_scan < cinfo->num_components || cinfo->progressive_mode)
00381 cinfo->inputctl->has_multiple_scans = TRUE;
00382 else
00383 cinfo->inputctl->has_multiple_scans = FALSE;
00384 }
00385
00386
00387 LOCAL(void)
00388 per_scan_setup (j_decompress_ptr cinfo)
00389
00390
00391 {
00392 int ci, mcublks, tmp;
00393 jpeg_component_info *compptr;
00394
00395 if (cinfo->comps_in_scan == 1) {
00396
00397
00398 compptr = cinfo->cur_comp_info[0];
00399
00400
00401 cinfo->MCUs_per_row = compptr->width_in_blocks;
00402 cinfo->MCU_rows_in_scan = compptr->height_in_blocks;
00403
00404
00405 compptr->MCU_width = 1;
00406 compptr->MCU_height = 1;
00407 compptr->MCU_blocks = 1;
00408 compptr->MCU_sample_width = compptr->DCT_h_scaled_size;
00409 compptr->last_col_width = 1;
00410
00411
00412
00413 tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
00414 if (tmp == 0) tmp = compptr->v_samp_factor;
00415 compptr->last_row_height = tmp;
00416
00417
00418 cinfo->blocks_in_MCU = 1;
00419 cinfo->MCU_membership[0] = 0;
00420
00421 } else {
00422
00423
00424 if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
00425 ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan,
00426 MAX_COMPS_IN_SCAN);
00427
00428
00429 cinfo->MCUs_per_row = (JDIMENSION)
00430 jdiv_round_up((long) cinfo->image_width,
00431 (long) (cinfo->max_h_samp_factor * cinfo->block_size));
00432 cinfo->MCU_rows_in_scan = (JDIMENSION)
00433 jdiv_round_up((long) cinfo->image_height,
00434 (long) (cinfo->max_v_samp_factor * cinfo->block_size));
00435
00436 cinfo->blocks_in_MCU = 0;
00437
00438 for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
00439 compptr = cinfo->cur_comp_info[ci];
00440
00441 compptr->MCU_width = compptr->h_samp_factor;
00442 compptr->MCU_height = compptr->v_samp_factor;
00443 compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
00444 compptr->MCU_sample_width = compptr->MCU_width * compptr->DCT_h_scaled_size;
00445
00446 tmp = (int) (compptr->width_in_blocks % compptr->MCU_width);
00447 if (tmp == 0) tmp = compptr->MCU_width;
00448 compptr->last_col_width = tmp;
00449 tmp = (int) (compptr->height_in_blocks % compptr->MCU_height);
00450 if (tmp == 0) tmp = compptr->MCU_height;
00451 compptr->last_row_height = tmp;
00452
00453 mcublks = compptr->MCU_blocks;
00454 if (cinfo->blocks_in_MCU + mcublks > D_MAX_BLOCKS_IN_MCU)
00455 ERREXIT(cinfo, JERR_BAD_MCU_SIZE);
00456 while (mcublks-- > 0) {
00457 cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
00458 }
00459 }
00460
00461 }
00462 }
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486 LOCAL(void)
00487 latch_quant_tables (j_decompress_ptr cinfo)
00488 {
00489 int ci, qtblno;
00490 jpeg_component_info *compptr;
00491 JQUANT_TBL * qtbl;
00492
00493 for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
00494 compptr = cinfo->cur_comp_info[ci];
00495
00496 if (compptr->quant_table != NULL)
00497 continue;
00498
00499 qtblno = compptr->quant_tbl_no;
00500 if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
00501 cinfo->quant_tbl_ptrs[qtblno] == NULL)
00502 ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
00503
00504 qtbl = (JQUANT_TBL *)
00505 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
00506 SIZEOF(JQUANT_TBL));
00507 MEMCOPY(qtbl, cinfo->quant_tbl_ptrs[qtblno], SIZEOF(JQUANT_TBL));
00508 compptr->quant_table = qtbl;
00509 }
00510 }
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520 METHODDEF(void)
00521 start_input_pass (j_decompress_ptr cinfo)
00522 {
00523 per_scan_setup(cinfo);
00524 latch_quant_tables(cinfo);
00525 (*cinfo->entropy->start_pass) (cinfo);
00526 (*cinfo->coef->start_input_pass) (cinfo);
00527 cinfo->inputctl->consume_input = cinfo->coef->consume_data;
00528 }
00529
00530
00531
00532
00533
00534
00535
00536
00537 METHODDEF(void)
00538 finish_input_pass (j_decompress_ptr cinfo)
00539 {
00540 cinfo->inputctl->consume_input = consume_markers;
00541 }
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558 METHODDEF(int)
00559 consume_markers (j_decompress_ptr cinfo)
00560 {
00561 my_inputctl_ptr inputctl = (my_inputctl_ptr) cinfo->inputctl;
00562 int val;
00563
00564 if (inputctl->pub.eoi_reached)
00565 return JPEG_REACHED_EOI;
00566
00567 for (;;) {
00568 val = (*cinfo->marker->read_markers) (cinfo);
00569
00570 switch (val) {
00571 case JPEG_REACHED_SOS:
00572 if (inputctl->inheaders) {
00573 if (inputctl->inheaders == 1)
00574 initial_setup(cinfo);
00575 if (cinfo->comps_in_scan == 0) {
00576 inputctl->inheaders = 2;
00577 break;
00578 }
00579 inputctl->inheaders = 0;
00580
00581
00582
00583
00584 } else {
00585 if (! inputctl->pub.has_multiple_scans)
00586 ERREXIT(cinfo, JERR_EOI_EXPECTED);
00587 if (cinfo->comps_in_scan == 0)
00588 break;
00589 start_input_pass(cinfo);
00590 }
00591 return val;
00592 case JPEG_REACHED_EOI:
00593 inputctl->pub.eoi_reached = TRUE;
00594 if (inputctl->inheaders) {
00595 if (cinfo->marker->saw_SOF)
00596 ERREXIT(cinfo, JERR_SOF_NO_SOS);
00597 } else {
00598
00599
00600
00601 if (cinfo->output_scan_number > cinfo->input_scan_number)
00602 cinfo->output_scan_number = cinfo->input_scan_number;
00603 }
00604 return val;
00605 case JPEG_SUSPENDED:
00606 return val;
00607 default:
00608 return val;
00609 }
00610 }
00611 }
00612
00613
00614
00615
00616
00617
00618 METHODDEF(void)
00619 reset_input_controller (j_decompress_ptr cinfo)
00620 {
00621 my_inputctl_ptr inputctl = (my_inputctl_ptr) cinfo->inputctl;
00622
00623 inputctl->pub.consume_input = consume_markers;
00624 inputctl->pub.has_multiple_scans = FALSE;
00625 inputctl->pub.eoi_reached = FALSE;
00626 inputctl->inheaders = 1;
00627
00628 (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
00629 (*cinfo->marker->reset_marker_reader) (cinfo);
00630
00631 cinfo->coef_bits = NULL;
00632 }
00633
00634
00635
00636
00637
00638
00639
00640 GLOBAL(void)
00641 jinit_input_controller (j_decompress_ptr cinfo)
00642 {
00643 my_inputctl_ptr inputctl;
00644
00645
00646 inputctl = (my_inputctl_ptr)
00647 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
00648 SIZEOF(my_input_controller));
00649 cinfo->inputctl = (struct jpeg_input_controller *) inputctl;
00650
00651 inputctl->pub.consume_input = consume_markers;
00652 inputctl->pub.reset_input_controller = reset_input_controller;
00653 inputctl->pub.start_input_pass = start_input_pass;
00654 inputctl->pub.finish_input_pass = finish_input_pass;
00655
00656
00657
00658 inputctl->pub.has_multiple_scans = FALSE;
00659 inputctl->pub.eoi_reached = FALSE;
00660 inputctl->inheaders = 1;
00661 }