Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: uzair Camera_LS_Y201 F7_Ethernet LCD_DISCO_F746NG NetworkAPI SDFileSystem mbed
jdmainct.c
00001 /* 00002 * jdmainct.c 00003 * 00004 * Copyright (C) 1994-1996, Thomas G. Lane. 00005 * Modified 2002-2012 by Guido Vollbeding. 00006 * This file is part of the Independent JPEG Group's software. 00007 * For conditions of distribution and use, see the accompanying README file. 00008 * 00009 * This file contains the main buffer controller for decompression. 00010 * The main buffer lies between the JPEG decompressor proper and the 00011 * post-processor; it holds downsampled data in the JPEG colorspace. 00012 * 00013 * Note that this code is bypassed in raw-data mode, since the application 00014 * supplies the equivalent of the main buffer in that case. 00015 */ 00016 00017 #define JPEG_INTERNALS 00018 #include "jinclude.h" 00019 #include "jpeglib.h" 00020 00021 00022 /* 00023 * In the current system design, the main buffer need never be a full-image 00024 * buffer; any full-height buffers will be found inside the coefficient or 00025 * postprocessing controllers. Nonetheless, the main controller is not 00026 * trivial. Its responsibility is to provide context rows for upsampling/ 00027 * rescaling, and doing this in an efficient fashion is a bit tricky. 00028 * 00029 * Postprocessor input data is counted in "row groups". A row group 00030 * is defined to be (v_samp_factor * DCT_scaled_size / min_DCT_scaled_size) 00031 * sample rows of each component. (We require DCT_scaled_size values to be 00032 * chosen such that these numbers are integers. In practice DCT_scaled_size 00033 * values will likely be powers of two, so we actually have the stronger 00034 * condition that DCT_scaled_size / min_DCT_scaled_size is an integer.) 00035 * Upsampling will typically produce max_v_samp_factor pixel rows from each 00036 * row group (times any additional scale factor that the upsampler is 00037 * applying). 00038 * 00039 * The coefficient controller will deliver data to us one iMCU row at a time; 00040 * each iMCU row contains v_samp_factor * DCT_scaled_size sample rows, or 00041 * exactly min_DCT_scaled_size row groups. (This amount of data corresponds 00042 * to one row of MCUs when the image is fully interleaved.) Note that the 00043 * number of sample rows varies across components, but the number of row 00044 * groups does not. Some garbage sample rows may be included in the last iMCU 00045 * row at the bottom of the image. 00046 * 00047 * Depending on the vertical scaling algorithm used, the upsampler may need 00048 * access to the sample row(s) above and below its current input row group. 00049 * The upsampler is required to set need_context_rows TRUE at global selection 00050 * time if so. When need_context_rows is FALSE, this controller can simply 00051 * obtain one iMCU row at a time from the coefficient controller and dole it 00052 * out as row groups to the postprocessor. 00053 * 00054 * When need_context_rows is TRUE, this controller guarantees that the buffer 00055 * passed to postprocessing contains at least one row group's worth of samples 00056 * above and below the row group(s) being processed. Note that the context 00057 * rows "above" the first passed row group appear at negative row offsets in 00058 * the passed buffer. At the top and bottom of the image, the required 00059 * context rows are manufactured by duplicating the first or last real sample 00060 * row; this avoids having special cases in the upsampling inner loops. 00061 * 00062 * The amount of context is fixed at one row group just because that's a 00063 * convenient number for this controller to work with. The existing 00064 * upsamplers really only need one sample row of context. An upsampler 00065 * supporting arbitrary output rescaling might wish for more than one row 00066 * group of context when shrinking the image; tough, we don't handle that. 00067 * (This is justified by the assumption that downsizing will be handled mostly 00068 * by adjusting the DCT_scaled_size values, so that the actual scale factor at 00069 * the upsample step needn't be much less than one.) 00070 * 00071 * To provide the desired context, we have to retain the last two row groups 00072 * of one iMCU row while reading in the next iMCU row. (The last row group 00073 * can't be processed until we have another row group for its below-context, 00074 * and so we have to save the next-to-last group too for its above-context.) 00075 * We could do this most simply by copying data around in our buffer, but 00076 * that'd be very slow. We can avoid copying any data by creating a rather 00077 * strange pointer structure. Here's how it works. We allocate a workspace 00078 * consisting of M+2 row groups (where M = min_DCT_scaled_size is the number 00079 * of row groups per iMCU row). We create two sets of redundant pointers to 00080 * the workspace. Labeling the physical row groups 0 to M+1, the synthesized 00081 * pointer lists look like this: 00082 * M+1 M-1 00083 * master pointer --> 0 master pointer --> 0 00084 * 1 1 00085 * ... ... 00086 * M-3 M-3 00087 * M-2 M 00088 * M-1 M+1 00089 * M M-2 00090 * M+1 M-1 00091 * 0 0 00092 * We read alternate iMCU rows using each master pointer; thus the last two 00093 * row groups of the previous iMCU row remain un-overwritten in the workspace. 00094 * The pointer lists are set up so that the required context rows appear to 00095 * be adjacent to the proper places when we pass the pointer lists to the 00096 * upsampler. 00097 * 00098 * The above pictures describe the normal state of the pointer lists. 00099 * At top and bottom of the image, we diddle the pointer lists to duplicate 00100 * the first or last sample row as necessary (this is cheaper than copying 00101 * sample rows around). 00102 * 00103 * This scheme breaks down if M < 2, ie, min_DCT_scaled_size is 1. In that 00104 * situation each iMCU row provides only one row group so the buffering logic 00105 * must be different (eg, we must read two iMCU rows before we can emit the 00106 * first row group). For now, we simply do not support providing context 00107 * rows when min_DCT_scaled_size is 1. That combination seems unlikely to 00108 * be worth providing --- if someone wants a 1/8th-size preview, they probably 00109 * want it quick and dirty, so a context-free upsampler is sufficient. 00110 */ 00111 00112 00113 /* Private buffer controller object */ 00114 00115 typedef struct { 00116 struct jpeg_d_main_controller pub; /* public fields */ 00117 00118 /* Pointer to allocated workspace (M or M+2 row groups). */ 00119 JSAMPARRAY buffer[MAX_COMPONENTS]; 00120 00121 boolean buffer_full; /* Have we gotten an iMCU row from decoder? */ 00122 JDIMENSION rowgroup_ctr; /* counts row groups output to postprocessor */ 00123 00124 /* Remaining fields are only used in the context case. */ 00125 00126 /* These are the master pointers to the funny-order pointer lists. */ 00127 JSAMPIMAGE xbuffer[2]; /* pointers to weird pointer lists */ 00128 00129 int whichptr; /* indicates which pointer set is now in use */ 00130 int context_state; /* process_data state machine status */ 00131 JDIMENSION rowgroups_avail; /* row groups available to postprocessor */ 00132 JDIMENSION iMCU_row_ctr; /* counts iMCU rows to detect image top/bot */ 00133 } my_main_controller; 00134 00135 typedef my_main_controller * my_main_ptr; 00136 00137 /* context_state values: */ 00138 #define CTX_PREPARE_FOR_IMCU 0 /* need to prepare for MCU row */ 00139 #define CTX_PROCESS_IMCU 1 /* feeding iMCU to postprocessor */ 00140 #define CTX_POSTPONED_ROW 2 /* feeding postponed row group */ 00141 00142 00143 /* Forward declarations */ 00144 METHODDEF(void) process_data_simple_main 00145 JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, 00146 JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); 00147 METHODDEF(void) process_data_context_main 00148 JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, 00149 JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); 00150 #ifdef QUANT_2PASS_SUPPORTED 00151 METHODDEF(void) process_data_crank_post 00152 JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, 00153 JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); 00154 #endif 00155 00156 00157 LOCAL(void) 00158 alloc_funny_pointers (j_decompress_ptr cinfo) 00159 /* Allocate space for the funny pointer lists. 00160 * This is done only once, not once per pass. 00161 */ 00162 { 00163 my_main_ptr mainp = (my_main_ptr) cinfo->main; 00164 int ci, rgroup; 00165 int M = cinfo->min_DCT_v_scaled_size; 00166 jpeg_component_info *compptr; 00167 JSAMPARRAY xbuf; 00168 00169 /* Get top-level space for component array pointers. 00170 * We alloc both arrays with one call to save a few cycles. 00171 */ 00172 mainp->xbuffer[0] = (JSAMPIMAGE) 00173 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, 00174 cinfo->num_components * 2 * SIZEOF(JSAMPARRAY)); 00175 mainp->xbuffer[1] = mainp->xbuffer[0] + cinfo->num_components; 00176 00177 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 00178 ci++, compptr++) { 00179 rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) / 00180 cinfo->min_DCT_v_scaled_size; /* height of a row group of component */ 00181 /* Get space for pointer lists --- M+4 row groups in each list. 00182 * We alloc both pointer lists with one call to save a few cycles. 00183 */ 00184 xbuf = (JSAMPARRAY) 00185 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, 00186 2 * (rgroup * (M + 4)) * SIZEOF(JSAMPROW)); 00187 xbuf += rgroup; /* want one row group at negative offsets */ 00188 mainp->xbuffer[0][ci] = xbuf; 00189 xbuf += rgroup * (M + 4); 00190 mainp->xbuffer[1][ci] = xbuf; 00191 } 00192 } 00193 00194 00195 LOCAL(void) 00196 make_funny_pointers (j_decompress_ptr cinfo) 00197 /* Create the funny pointer lists discussed in the comments above. 00198 * The actual workspace is already allocated (in main->buffer), 00199 * and the space for the pointer lists is allocated too. 00200 * This routine just fills in the curiously ordered lists. 00201 * This will be repeated at the beginning of each pass. 00202 */ 00203 { 00204 my_main_ptr mainp = (my_main_ptr) cinfo->main; 00205 int ci, i, rgroup; 00206 int M = cinfo->min_DCT_v_scaled_size; 00207 jpeg_component_info *compptr; 00208 JSAMPARRAY buf, xbuf0, xbuf1; 00209 00210 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 00211 ci++, compptr++) { 00212 rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) / 00213 cinfo->min_DCT_v_scaled_size; /* height of a row group of component */ 00214 xbuf0 = mainp->xbuffer[0][ci]; 00215 xbuf1 = mainp->xbuffer[1][ci]; 00216 /* First copy the workspace pointers as-is */ 00217 buf = mainp->buffer[ci]; 00218 for (i = 0; i < rgroup * (M + 2); i++) { 00219 xbuf0[i] = xbuf1[i] = buf[i]; 00220 } 00221 /* In the second list, put the last four row groups in swapped order */ 00222 for (i = 0; i < rgroup * 2; i++) { 00223 xbuf1[rgroup*(M-2) + i] = buf[rgroup*M + i]; 00224 xbuf1[rgroup*M + i] = buf[rgroup*(M-2) + i]; 00225 } 00226 /* The wraparound pointers at top and bottom will be filled later 00227 * (see set_wraparound_pointers, below). Initially we want the "above" 00228 * pointers to duplicate the first actual data line. This only needs 00229 * to happen in xbuffer[0]. 00230 */ 00231 for (i = 0; i < rgroup; i++) { 00232 xbuf0[i - rgroup] = xbuf0[0]; 00233 } 00234 } 00235 } 00236 00237 00238 LOCAL(void) 00239 set_wraparound_pointers (j_decompress_ptr cinfo) 00240 /* Set up the "wraparound" pointers at top and bottom of the pointer lists. 00241 * This changes the pointer list state from top-of-image to the normal state. 00242 */ 00243 { 00244 my_main_ptr mainp = (my_main_ptr) cinfo->main; 00245 int ci, i, rgroup; 00246 int M = cinfo->min_DCT_v_scaled_size; 00247 jpeg_component_info *compptr; 00248 JSAMPARRAY xbuf0, xbuf1; 00249 00250 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 00251 ci++, compptr++) { 00252 rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) / 00253 cinfo->min_DCT_v_scaled_size; /* height of a row group of component */ 00254 xbuf0 = mainp->xbuffer[0][ci]; 00255 xbuf1 = mainp->xbuffer[1][ci]; 00256 for (i = 0; i < rgroup; i++) { 00257 xbuf0[i - rgroup] = xbuf0[rgroup*(M+1) + i]; 00258 xbuf1[i - rgroup] = xbuf1[rgroup*(M+1) + i]; 00259 xbuf0[rgroup*(M+2) + i] = xbuf0[i]; 00260 xbuf1[rgroup*(M+2) + i] = xbuf1[i]; 00261 } 00262 } 00263 } 00264 00265 00266 LOCAL(void) 00267 set_bottom_pointers (j_decompress_ptr cinfo) 00268 /* Change the pointer lists to duplicate the last sample row at the bottom 00269 * of the image. whichptr indicates which xbuffer holds the final iMCU row. 00270 * Also sets rowgroups_avail to indicate number of nondummy row groups in row. 00271 */ 00272 { 00273 my_main_ptr mainp = (my_main_ptr) cinfo->main; 00274 int ci, i, rgroup, iMCUheight, rows_left; 00275 jpeg_component_info *compptr; 00276 JSAMPARRAY xbuf; 00277 00278 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 00279 ci++, compptr++) { 00280 /* Count sample rows in one iMCU row and in one row group */ 00281 iMCUheight = compptr->v_samp_factor * compptr->DCT_v_scaled_size; 00282 rgroup = iMCUheight / cinfo->min_DCT_v_scaled_size; 00283 /* Count nondummy sample rows remaining for this component */ 00284 rows_left = (int) (compptr->downsampled_height % (JDIMENSION) iMCUheight); 00285 if (rows_left == 0) rows_left = iMCUheight; 00286 /* Count nondummy row groups. Should get same answer for each component, 00287 * so we need only do it once. 00288 */ 00289 if (ci == 0) { 00290 mainp->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1); 00291 } 00292 /* Duplicate the last real sample row rgroup*2 times; this pads out the 00293 * last partial rowgroup and ensures at least one full rowgroup of context. 00294 */ 00295 xbuf = mainp->xbuffer[mainp->whichptr][ci]; 00296 for (i = 0; i < rgroup * 2; i++) { 00297 xbuf[rows_left + i] = xbuf[rows_left-1]; 00298 } 00299 } 00300 } 00301 00302 00303 /* 00304 * Initialize for a processing pass. 00305 */ 00306 00307 METHODDEF(void) 00308 start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode) 00309 { 00310 my_main_ptr mainp = (my_main_ptr) cinfo->main; 00311 00312 switch (pass_mode) { 00313 case JBUF_PASS_THRU: 00314 if (cinfo->upsample->need_context_rows) { 00315 mainp->pub.process_data = process_data_context_main; 00316 make_funny_pointers(cinfo); /* Create the xbuffer[] lists */ 00317 mainp->whichptr = 0; /* Read first iMCU row into xbuffer[0] */ 00318 mainp->context_state = CTX_PREPARE_FOR_IMCU; 00319 mainp->iMCU_row_ctr = 0; 00320 } else { 00321 /* Simple case with no context needed */ 00322 mainp->pub.process_data = process_data_simple_main; 00323 } 00324 mainp->buffer_full = FALSE; /* Mark buffer empty */ 00325 mainp->rowgroup_ctr = 0; 00326 break; 00327 #ifdef QUANT_2PASS_SUPPORTED 00328 case JBUF_CRANK_DEST: 00329 /* For last pass of 2-pass quantization, just crank the postprocessor */ 00330 mainp->pub.process_data = process_data_crank_post; 00331 break; 00332 #endif 00333 default: 00334 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); 00335 break; 00336 } 00337 } 00338 00339 00340 /* 00341 * Process some data. 00342 * This handles the simple case where no context is required. 00343 */ 00344 00345 METHODDEF(void) 00346 process_data_simple_main (j_decompress_ptr cinfo, 00347 JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, 00348 JDIMENSION out_rows_avail) 00349 { 00350 my_main_ptr mainp = (my_main_ptr) cinfo->main; 00351 JDIMENSION rowgroups_avail; 00352 00353 /* Read input data if we haven't filled the main buffer yet */ 00354 if (! mainp->buffer_full) { 00355 if (! (*cinfo->coef->decompress_data) (cinfo, mainp->buffer)) 00356 return; /* suspension forced, can do nothing more */ 00357 mainp->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ 00358 } 00359 00360 /* There are always min_DCT_scaled_size row groups in an iMCU row. */ 00361 rowgroups_avail = (JDIMENSION) cinfo->min_DCT_v_scaled_size; 00362 /* Note: at the bottom of the image, we may pass extra garbage row groups 00363 * to the postprocessor. The postprocessor has to check for bottom 00364 * of image anyway (at row resolution), so no point in us doing it too. 00365 */ 00366 00367 /* Feed the postprocessor */ 00368 (*cinfo->post->post_process_data) (cinfo, mainp->buffer, 00369 &mainp->rowgroup_ctr, rowgroups_avail, 00370 output_buf, out_row_ctr, out_rows_avail); 00371 00372 /* Has postprocessor consumed all the data yet? If so, mark buffer empty */ 00373 if (mainp->rowgroup_ctr >= rowgroups_avail) { 00374 mainp->buffer_full = FALSE; 00375 mainp->rowgroup_ctr = 0; 00376 } 00377 } 00378 00379 00380 /* 00381 * Process some data. 00382 * This handles the case where context rows must be provided. 00383 */ 00384 00385 METHODDEF(void) 00386 process_data_context_main (j_decompress_ptr cinfo, 00387 JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, 00388 JDIMENSION out_rows_avail) 00389 { 00390 my_main_ptr mainp = (my_main_ptr) cinfo->main; 00391 00392 /* Read input data if we haven't filled the main buffer yet */ 00393 if (! mainp->buffer_full) { 00394 if (! (*cinfo->coef->decompress_data) (cinfo, 00395 mainp->xbuffer[mainp->whichptr])) 00396 return; /* suspension forced, can do nothing more */ 00397 mainp->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ 00398 mainp->iMCU_row_ctr++; /* count rows received */ 00399 } 00400 00401 /* Postprocessor typically will not swallow all the input data it is handed 00402 * in one call (due to filling the output buffer first). Must be prepared 00403 * to exit and restart. This switch lets us keep track of how far we got. 00404 * Note that each case falls through to the next on successful completion. 00405 */ 00406 switch (mainp->context_state) { 00407 case CTX_POSTPONED_ROW: 00408 /* Call postprocessor using previously set pointers for postponed row */ 00409 (*cinfo->post->post_process_data) (cinfo, mainp->xbuffer[mainp->whichptr], 00410 &mainp->rowgroup_ctr, mainp->rowgroups_avail, 00411 output_buf, out_row_ctr, out_rows_avail); 00412 if (mainp->rowgroup_ctr < mainp->rowgroups_avail) 00413 return; /* Need to suspend */ 00414 mainp->context_state = CTX_PREPARE_FOR_IMCU; 00415 if (*out_row_ctr >= out_rows_avail) 00416 return; /* Postprocessor exactly filled output buf */ 00417 /*FALLTHROUGH*/ 00418 case CTX_PREPARE_FOR_IMCU: 00419 /* Prepare to process first M-1 row groups of this iMCU row */ 00420 mainp->rowgroup_ctr = 0; 00421 mainp->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_v_scaled_size - 1); 00422 /* Check for bottom of image: if so, tweak pointers to "duplicate" 00423 * the last sample row, and adjust rowgroups_avail to ignore padding rows. 00424 */ 00425 if (mainp->iMCU_row_ctr == cinfo->total_iMCU_rows) 00426 set_bottom_pointers(cinfo); 00427 mainp->context_state = CTX_PROCESS_IMCU; 00428 /*FALLTHROUGH*/ 00429 case CTX_PROCESS_IMCU: 00430 /* Call postprocessor using previously set pointers */ 00431 (*cinfo->post->post_process_data) (cinfo, mainp->xbuffer[mainp->whichptr], 00432 &mainp->rowgroup_ctr, mainp->rowgroups_avail, 00433 output_buf, out_row_ctr, out_rows_avail); 00434 if (mainp->rowgroup_ctr < mainp->rowgroups_avail) 00435 return; /* Need to suspend */ 00436 /* After the first iMCU, change wraparound pointers to normal state */ 00437 if (mainp->iMCU_row_ctr == 1) 00438 set_wraparound_pointers(cinfo); 00439 /* Prepare to load new iMCU row using other xbuffer list */ 00440 mainp->whichptr ^= 1; /* 0=>1 or 1=>0 */ 00441 mainp->buffer_full = FALSE; 00442 /* Still need to process last row group of this iMCU row, */ 00443 /* which is saved at index M+1 of the other xbuffer */ 00444 mainp->rowgroup_ctr = (JDIMENSION) (cinfo->min_DCT_v_scaled_size + 1); 00445 mainp->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_v_scaled_size + 2); 00446 mainp->context_state = CTX_POSTPONED_ROW; 00447 } 00448 } 00449 00450 00451 /* 00452 * Process some data. 00453 * Final pass of two-pass quantization: just call the postprocessor. 00454 * Source data will be the postprocessor controller's internal buffer. 00455 */ 00456 00457 #ifdef QUANT_2PASS_SUPPORTED 00458 00459 METHODDEF(void) 00460 process_data_crank_post (j_decompress_ptr cinfo, 00461 JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, 00462 JDIMENSION out_rows_avail) 00463 { 00464 (*cinfo->post->post_process_data) (cinfo, (JSAMPIMAGE) NULL, 00465 (JDIMENSION *) NULL, (JDIMENSION) 0, 00466 output_buf, out_row_ctr, out_rows_avail); 00467 } 00468 00469 #endif /* QUANT_2PASS_SUPPORTED */ 00470 00471 00472 /* 00473 * Initialize main buffer controller. 00474 */ 00475 00476 GLOBAL(void) 00477 jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer) 00478 { 00479 my_main_ptr mainp; 00480 int ci, rgroup, ngroups; 00481 jpeg_component_info *compptr; 00482 00483 mainp = (my_main_ptr) 00484 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, 00485 SIZEOF(my_main_controller)); 00486 cinfo->main = &mainp->pub; 00487 mainp->pub.start_pass = start_pass_main; 00488 00489 if (need_full_buffer) /* shouldn't happen */ 00490 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); 00491 00492 /* Allocate the workspace. 00493 * ngroups is the number of row groups we need. 00494 */ 00495 if (cinfo->upsample->need_context_rows) { 00496 if (cinfo->min_DCT_v_scaled_size < 2) /* unsupported, see comments above */ 00497 ERREXIT(cinfo, JERR_NOTIMPL); 00498 alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */ 00499 ngroups = cinfo->min_DCT_v_scaled_size + 2; 00500 } else { 00501 ngroups = cinfo->min_DCT_v_scaled_size; 00502 } 00503 00504 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 00505 ci++, compptr++) { 00506 rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) / 00507 cinfo->min_DCT_v_scaled_size; /* height of a row group of component */ 00508 mainp->buffer[ci] = (*cinfo->mem->alloc_sarray) 00509 ((j_common_ptr) cinfo, JPOOL_IMAGE, 00510 compptr->width_in_blocks * ((JDIMENSION) compptr->DCT_h_scaled_size), 00511 (JDIMENSION) (rgroup * ngroups)); 00512 } 00513 }
Generated on Wed Jul 13 2022 18:56:09 by
