Doxygen Source Code Documentation
jdmainct.c File Reference
#include "jinclude.h"
#include "jpeglib.h"
Go to the source code of this file.
Define Documentation
|
Definition at line 139 of file jdmainct.c. Referenced by process_data_context_main(). |
|
Definition at line 137 of file jdmainct.c. Referenced by process_data_context_main(), and start_pass_main(). |
|
Definition at line 138 of file jdmainct.c. Referenced by process_data_context_main(). |
|
Definition at line 16 of file jdmainct.c. |
Typedef Documentation
|
Definition at line 134 of file jdmainct.c. |
Function Documentation
|
Definition at line 157 of file jdmainct.c. References compptr, jpeg_component_info::DCT_scaled_size, JPOOL_IMAGE, JSAMPARRAY, JSAMPROW, jpeg_decompress_struct::main, jpeg_decompress_struct::min_DCT_scaled_size, SIZEOF, jpeg_component_info::v_samp_factor, and my_main_controller::xbuffer. Referenced by jinit_d_main_controller().
00161 { 00162 my_main_ptr main = (my_main_ptr) cinfo->main; 00163 int ci, rgroup; 00164 int M = cinfo->min_DCT_scaled_size; 00165 jpeg_component_info *compptr; 00166 JSAMPARRAY xbuf; 00167 00168 /* Get top-level space for component array pointers. 00169 * We alloc both arrays with one call to save a few cycles. 00170 */ 00171 main->xbuffer[0] = (JSAMPIMAGE) 00172 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, 00173 cinfo->num_components * 2 * SIZEOF(JSAMPARRAY)); 00174 main->xbuffer[1] = main->xbuffer[0] + cinfo->num_components; 00175 00176 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 00177 ci++, compptr++) { 00178 rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) / 00179 cinfo->min_DCT_scaled_size; /* height of a row group of component */ 00180 /* Get space for pointer lists --- M+4 row groups in each list. 00181 * We alloc both pointer lists with one call to save a few cycles. 00182 */ 00183 xbuf = (JSAMPARRAY) 00184 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, 00185 2 * (rgroup * (M + 4)) * SIZEOF(JSAMPROW)); 00186 xbuf += rgroup; /* want one row group at negative offsets */ 00187 main->xbuffer[0][ci] = xbuf; 00188 xbuf += rgroup * (M + 4); 00189 main->xbuffer[1][ci] = xbuf; 00190 } 00191 } |
|
Definition at line 476 of file jdmainct.c. References alloc_funny_pointers(), compptr, jpeg_component_info::DCT_scaled_size, ERREXIT, JPOOL_IMAGE, need_full_buffer, SIZEOF, start_pass_main(), jpeg_component_info::v_samp_factor, and jpeg_component_info::width_in_blocks. Referenced by master_selection().
00477 { 00478 my_main_ptr main; 00479 int ci, rgroup, ngroups; 00480 jpeg_component_info *compptr; 00481 00482 main = (my_main_ptr) 00483 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, 00484 SIZEOF(my_main_controller)); 00485 cinfo->main = (struct jpeg_d_main_controller *) main; 00486 main->pub.start_pass = start_pass_main; 00487 00488 if (need_full_buffer) /* shouldn't happen */ 00489 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); 00490 00491 /* Allocate the workspace. 00492 * ngroups is the number of row groups we need. 00493 */ 00494 if (cinfo->upsample->need_context_rows) { 00495 if (cinfo->min_DCT_scaled_size < 2) /* unsupported, see comments above */ 00496 ERREXIT(cinfo, JERR_NOTIMPL); 00497 alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */ 00498 ngroups = cinfo->min_DCT_scaled_size + 2; 00499 } else { 00500 ngroups = cinfo->min_DCT_scaled_size; 00501 } 00502 00503 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 00504 ci++, compptr++) { 00505 rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) / 00506 cinfo->min_DCT_scaled_size; /* height of a row group of component */ 00507 main->buffer[ci] = (*cinfo->mem->alloc_sarray) 00508 ((j_common_ptr) cinfo, JPOOL_IMAGE, 00509 compptr->width_in_blocks * compptr->DCT_scaled_size, 00510 (JDIMENSION) (rgroup * ngroups)); 00511 } 00512 } |
|
Definition at line 195 of file jdmainct.c. References my_main_controller::buffer, jpeg_decompress_struct::comp_info, compptr, jpeg_component_info::DCT_scaled_size, i, JSAMPARRAY, jpeg_decompress_struct::main, jpeg_decompress_struct::min_DCT_scaled_size, jpeg_decompress_struct::num_components, jpeg_component_info::v_samp_factor, and my_main_controller::xbuffer. Referenced by start_pass_main().
00202 { 00203 my_main_ptr main = (my_main_ptr) cinfo->main; 00204 int ci, i, rgroup; 00205 int M = cinfo->min_DCT_scaled_size; 00206 jpeg_component_info *compptr; 00207 JSAMPARRAY buf, xbuf0, xbuf1; 00208 00209 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 00210 ci++, compptr++) { 00211 rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) / 00212 cinfo->min_DCT_scaled_size; /* height of a row group of component */ 00213 xbuf0 = main->xbuffer[0][ci]; 00214 xbuf1 = main->xbuffer[1][ci]; 00215 /* First copy the workspace pointers as-is */ 00216 buf = main->buffer[ci]; 00217 for (i = 0; i < rgroup * (M + 2); i++) { 00218 xbuf0[i] = xbuf1[i] = buf[i]; 00219 } 00220 /* In the second list, put the last four row groups in swapped order */ 00221 for (i = 0; i < rgroup * 2; i++) { 00222 xbuf1[rgroup*(M-2) + i] = buf[rgroup*M + i]; 00223 xbuf1[rgroup*M + i] = buf[rgroup*(M-2) + i]; 00224 } 00225 /* The wraparound pointers at top and bottom will be filled later 00226 * (see set_wraparound_pointers, below). Initially we want the "above" 00227 * pointers to duplicate the first actual data line. This only needs 00228 * to happen in xbuffer[0]. 00229 */ 00230 for (i = 0; i < rgroup; i++) { 00231 xbuf0[i - rgroup] = xbuf0[0]; 00232 } 00233 } 00234 } |
|
|
|
Definition at line 385 of file jdmainct.c. References my_main_controller::buffer_full, jpeg_decompress_struct::coef, my_main_controller::context_state, CTX_POSTPONED_ROW, CTX_PREPARE_FOR_IMCU, CTX_PROCESS_IMCU, my_main_controller::iMCU_row_ctr, JDIMENSION, JSAMPARRAY, jpeg_decompress_struct::main, jpeg_decompress_struct::min_DCT_scaled_size, output_buf, jpeg_decompress_struct::post, my_main_controller::rowgroup_ctr, my_main_controller::rowgroups_avail, set_bottom_pointers(), set_wraparound_pointers(), jpeg_decompress_struct::total_iMCU_rows, my_main_controller::whichptr, and my_main_controller::xbuffer. Referenced by start_pass_main().
00388 { 00389 my_main_ptr main = (my_main_ptr) cinfo->main; 00390 00391 /* Read input data if we haven't filled the main buffer yet */ 00392 if (! main->buffer_full) { 00393 if (! (*cinfo->coef->decompress_data) (cinfo, 00394 main->xbuffer[main->whichptr])) 00395 return; /* suspension forced, can do nothing more */ 00396 main->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ 00397 main->iMCU_row_ctr++; /* count rows received */ 00398 } 00399 00400 /* Postprocessor typically will not swallow all the input data it is handed 00401 * in one call (due to filling the output buffer first). Must be prepared 00402 * to exit and restart. This switch lets us keep track of how far we got. 00403 * Note that each case falls through to the next on successful completion. 00404 */ 00405 switch (main->context_state) { 00406 case CTX_POSTPONED_ROW: 00407 /* Call postprocessor using previously set pointers for postponed row */ 00408 (*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr], 00409 &main->rowgroup_ctr, main->rowgroups_avail, 00410 output_buf, out_row_ctr, out_rows_avail); 00411 if (main->rowgroup_ctr < main->rowgroups_avail) 00412 return; /* Need to suspend */ 00413 main->context_state = CTX_PREPARE_FOR_IMCU; 00414 if (*out_row_ctr >= out_rows_avail) 00415 return; /* Postprocessor exactly filled output buf */ 00416 /*FALLTHROUGH*/ 00417 case CTX_PREPARE_FOR_IMCU: 00418 /* Prepare to process first M-1 row groups of this iMCU row */ 00419 main->rowgroup_ctr = 0; 00420 main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_scaled_size - 1); 00421 /* Check for bottom of image: if so, tweak pointers to "duplicate" 00422 * the last sample row, and adjust rowgroups_avail to ignore padding rows. 00423 */ 00424 if (main->iMCU_row_ctr == cinfo->total_iMCU_rows) 00425 set_bottom_pointers(cinfo); 00426 main->context_state = CTX_PROCESS_IMCU; 00427 /*FALLTHROUGH*/ 00428 case CTX_PROCESS_IMCU: 00429 /* Call postprocessor using previously set pointers */ 00430 (*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr], 00431 &main->rowgroup_ctr, main->rowgroups_avail, 00432 output_buf, out_row_ctr, out_rows_avail); 00433 if (main->rowgroup_ctr < main->rowgroups_avail) 00434 return; /* Need to suspend */ 00435 /* After the first iMCU, change wraparound pointers to normal state */ 00436 if (main->iMCU_row_ctr == 1) 00437 set_wraparound_pointers(cinfo); 00438 /* Prepare to load new iMCU row using other xbuffer list */ 00439 main->whichptr ^= 1; /* 0=>1 or 1=>0 */ 00440 main->buffer_full = FALSE; 00441 /* Still need to process last row group of this iMCU row, */ 00442 /* which is saved at index M+1 of the other xbuffer */ 00443 main->rowgroup_ctr = (JDIMENSION) (cinfo->min_DCT_scaled_size + 1); 00444 main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_scaled_size + 2); 00445 main->context_state = CTX_POSTPONED_ROW; 00446 } 00447 } |
|
Definition at line 459 of file jdmainct.c. References JDIMENSION, JSAMPARRAY, output_buf, and jpeg_decompress_struct::post. Referenced by start_pass_main().
00462 { 00463 (*cinfo->post->post_process_data) (cinfo, (JSAMPIMAGE) NULL, 00464 (JDIMENSION *) NULL, (JDIMENSION) 0, 00465 output_buf, out_row_ctr, out_rows_avail); 00466 } |
|
Definition at line 345 of file jdmainct.c. References my_main_controller::buffer, my_main_controller::buffer_full, jpeg_decompress_struct::coef, JDIMENSION, JSAMPARRAY, jpeg_decompress_struct::main, jpeg_decompress_struct::min_DCT_scaled_size, output_buf, jpeg_decompress_struct::post, and my_main_controller::rowgroup_ctr. Referenced by start_pass_main().
00348 { 00349 my_main_ptr main = (my_main_ptr) cinfo->main; 00350 JDIMENSION rowgroups_avail; 00351 00352 /* Read input data if we haven't filled the main buffer yet */ 00353 if (! main->buffer_full) { 00354 if (! (*cinfo->coef->decompress_data) (cinfo, main->buffer)) 00355 return; /* suspension forced, can do nothing more */ 00356 main->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ 00357 } 00358 00359 /* There are always min_DCT_scaled_size row groups in an iMCU row. */ 00360 rowgroups_avail = (JDIMENSION) cinfo->min_DCT_scaled_size; 00361 /* Note: at the bottom of the image, we may pass extra garbage row groups 00362 * to the postprocessor. The postprocessor has to check for bottom 00363 * of image anyway (at row resolution), so no point in us doing it too. 00364 */ 00365 00366 /* Feed the postprocessor */ 00367 (*cinfo->post->post_process_data) (cinfo, main->buffer, 00368 &main->rowgroup_ctr, rowgroups_avail, 00369 output_buf, out_row_ctr, out_rows_avail); 00370 00371 /* Has postprocessor consumed all the data yet? If so, mark buffer empty */ 00372 if (main->rowgroup_ctr >= rowgroups_avail) { 00373 main->buffer_full = FALSE; 00374 main->rowgroup_ctr = 0; 00375 } 00376 } |
|
Definition at line 266 of file jdmainct.c. References jpeg_decompress_struct::comp_info, compptr, jpeg_component_info::DCT_scaled_size, jpeg_component_info::downsampled_height, i, JSAMPARRAY, jpeg_decompress_struct::main, jpeg_decompress_struct::min_DCT_scaled_size, jpeg_decompress_struct::num_components, my_main_controller::rowgroups_avail, jpeg_component_info::v_samp_factor, my_main_controller::whichptr, and my_main_controller::xbuffer. Referenced by process_data_context_main().
00271 { 00272 my_main_ptr main = (my_main_ptr) cinfo->main; 00273 int ci, i, rgroup, iMCUheight, rows_left; 00274 jpeg_component_info *compptr; 00275 JSAMPARRAY xbuf; 00276 00277 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 00278 ci++, compptr++) { 00279 /* Count sample rows in one iMCU row and in one row group */ 00280 iMCUheight = compptr->v_samp_factor * compptr->DCT_scaled_size; 00281 rgroup = iMCUheight / cinfo->min_DCT_scaled_size; 00282 /* Count nondummy sample rows remaining for this component */ 00283 rows_left = (int) (compptr->downsampled_height % (JDIMENSION) iMCUheight); 00284 if (rows_left == 0) rows_left = iMCUheight; 00285 /* Count nondummy row groups. Should get same answer for each component, 00286 * so we need only do it once. 00287 */ 00288 if (ci == 0) { 00289 main->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1); 00290 } 00291 /* Duplicate the last real sample row rgroup*2 times; this pads out the 00292 * last partial rowgroup and ensures at least one full rowgroup of context. 00293 */ 00294 xbuf = main->xbuffer[main->whichptr][ci]; 00295 for (i = 0; i < rgroup * 2; i++) { 00296 xbuf[rows_left + i] = xbuf[rows_left-1]; 00297 } 00298 } 00299 } |
|
Definition at line 238 of file jdmainct.c. References jpeg_decompress_struct::comp_info, compptr, jpeg_component_info::DCT_scaled_size, i, JSAMPARRAY, jpeg_decompress_struct::main, jpeg_decompress_struct::min_DCT_scaled_size, jpeg_decompress_struct::num_components, jpeg_component_info::v_samp_factor, and my_main_controller::xbuffer. Referenced by process_data_context_main().
00242 { 00243 my_main_ptr main = (my_main_ptr) cinfo->main; 00244 int ci, i, rgroup; 00245 int M = cinfo->min_DCT_scaled_size; 00246 jpeg_component_info *compptr; 00247 JSAMPARRAY xbuf0, xbuf1; 00248 00249 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 00250 ci++, compptr++) { 00251 rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) / 00252 cinfo->min_DCT_scaled_size; /* height of a row group of component */ 00253 xbuf0 = main->xbuffer[0][ci]; 00254 xbuf1 = main->xbuffer[1][ci]; 00255 for (i = 0; i < rgroup; i++) { 00256 xbuf0[i - rgroup] = xbuf0[rgroup*(M+1) + i]; 00257 xbuf1[i - rgroup] = xbuf1[rgroup*(M+1) + i]; 00258 xbuf0[rgroup*(M+2) + i] = xbuf0[i]; 00259 xbuf1[rgroup*(M+2) + i] = xbuf1[i]; 00260 } 00261 } 00262 } |
|
Definition at line 307 of file jdmainct.c. References my_main_controller::buffer_full, my_main_controller::context_state, CTX_PREPARE_FOR_IMCU, ERREXIT, my_main_controller::iMCU_row_ctr, J_BUF_MODE, JBUF_CRANK_DEST, JBUF_PASS_THRU, jpeg_decompress_struct::main, make_funny_pointers(), jpeg_upsampler::need_context_rows, process_data_context_main(), process_data_crank_post(), process_data_simple_main(), my_main_controller::pub, my_main_controller::rowgroup_ctr, jpeg_decompress_struct::upsample, and my_main_controller::whichptr. Referenced by jinit_d_main_controller().
00308 { 00309 my_main_ptr main = (my_main_ptr) cinfo->main; 00310 00311 switch (pass_mode) { 00312 case JBUF_PASS_THRU: 00313 if (cinfo->upsample->need_context_rows) { 00314 main->pub.process_data = process_data_context_main; 00315 make_funny_pointers(cinfo); /* Create the xbuffer[] lists */ 00316 main->whichptr = 0; /* Read first iMCU row into xbuffer[0] */ 00317 main->context_state = CTX_PREPARE_FOR_IMCU; 00318 main->iMCU_row_ctr = 0; 00319 } else { 00320 /* Simple case with no context needed */ 00321 main->pub.process_data = process_data_simple_main; 00322 } 00323 main->buffer_full = FALSE; /* Mark buffer empty */ 00324 main->rowgroup_ctr = 0; 00325 break; 00326 #ifdef QUANT_2PASS_SUPPORTED 00327 case JBUF_CRANK_DEST: 00328 /* For last pass of 2-pass quantization, just crank the postprocessor */ 00329 main->pub.process_data = process_data_crank_post; 00330 break; 00331 #endif 00332 default: 00333 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); 00334 break; 00335 } 00336 } |
Variable Documentation
|
Definition at line 61 of file jdpostct.c. Referenced by post_process_1pass(), post_process_2pass(), and post_process_prepass(). |
|
Definition at line 61 of file jdpostct.c. Referenced by post_process_1pass(), post_process_2pass(), and post_process_prepass(). |
|
Definition at line 151 of file jdmainct.c. Referenced by process_data_context_main(), process_data_crank_post(), and process_data_simple_main(). |