• Home
  • Raw
  • Download

Lines Matching +full:ci +full:- +full:pass

5  * Copyright (C) 1994-1996, Thomas G. Lane.
6 * libjpeg-turbo Modifications:
13 * post-processor; it holds downsampled data in the JPEG colorspace.
15 * Note that this code is bypassed in raw-data mode, since the application
25 * In the current system design, the main buffer need never be a full-image
26 * buffer; any full-height buffers will be found inside the coefficient or
75 * can't be processed until we have another row group for its below-context,
76 * and so we have to save the next-to-last group too for its above-context.)
84 * M+1 M-1
85 * master pointer --> 0 master pointer --> 0
88 * M-3 M-3
89 * M-2 M
90 * M-1 M+1
91 * M M-2
92 * M+1 M-1
95 * row groups of the previous iMCU row remain un-overwritten in the workspace.
97 * be adjacent to the proper places when we pass the pointer lists to the
110 * be worth providing --- if someone wants a 1/8th-size preview, they probably
111 * want it quick and dirty, so a context-free upsampler is sufficient.
135 * This is done only once, not once per pass. in alloc_funny_pointers()
138 my_main_ptr main_ptr = (my_main_ptr)cinfo->main; in alloc_funny_pointers()
139 int ci, rgroup; in alloc_funny_pointers() local
140 int M = cinfo->_min_DCT_scaled_size; in alloc_funny_pointers()
144 /* Get top-level space for component array pointers. in alloc_funny_pointers()
147 main_ptr->xbuffer[0] = (JSAMPIMAGE) in alloc_funny_pointers()
148 (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, in alloc_funny_pointers()
149 cinfo->num_components * 2 * sizeof(JSAMPARRAY)); in alloc_funny_pointers()
150 main_ptr->xbuffer[1] = main_ptr->xbuffer[0] + cinfo->num_components; in alloc_funny_pointers()
152 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; in alloc_funny_pointers()
153 ci++, compptr++) { in alloc_funny_pointers()
154 rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) / in alloc_funny_pointers()
155 cinfo->_min_DCT_scaled_size; /* height of a row group of component */ in alloc_funny_pointers()
156 /* Get space for pointer lists --- M+4 row groups in each list. in alloc_funny_pointers()
160 (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, in alloc_funny_pointers()
163 main_ptr->xbuffer[0][ci] = xbuf; in alloc_funny_pointers()
165 main_ptr->xbuffer[1][ci] = xbuf; in alloc_funny_pointers()
173 * The actual workspace is already allocated (in main_ptr->buffer), in make_funny_pointers()
176 * This will be repeated at the beginning of each pass. in make_funny_pointers()
179 my_main_ptr main_ptr = (my_main_ptr)cinfo->main; in make_funny_pointers()
180 int ci, i, rgroup; in make_funny_pointers() local
181 int M = cinfo->_min_DCT_scaled_size; in make_funny_pointers()
185 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; in make_funny_pointers()
186 ci++, compptr++) { in make_funny_pointers()
187 rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) / in make_funny_pointers()
188 cinfo->_min_DCT_scaled_size; /* height of a row group of component */ in make_funny_pointers()
189 xbuf0 = main_ptr->xbuffer[0][ci]; in make_funny_pointers()
190 xbuf1 = main_ptr->xbuffer[1][ci]; in make_funny_pointers()
191 /* First copy the workspace pointers as-is */ in make_funny_pointers()
192 buf = main_ptr->buffer[ci]; in make_funny_pointers()
198 xbuf1[rgroup * (M - 2) + i] = buf[rgroup * M + i]; in make_funny_pointers()
199 xbuf1[rgroup * M + i] = buf[rgroup * (M - 2) + i]; in make_funny_pointers()
207 xbuf0[i - rgroup] = xbuf0[0]; in make_funny_pointers()
220 my_main_ptr main_ptr = (my_main_ptr)cinfo->main; in set_bottom_pointers()
221 int ci, i, rgroup, iMCUheight, rows_left; in set_bottom_pointers() local
225 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; in set_bottom_pointers()
226 ci++, compptr++) { in set_bottom_pointers()
228 iMCUheight = compptr->v_samp_factor * compptr->_DCT_scaled_size; in set_bottom_pointers()
229 rgroup = iMCUheight / cinfo->_min_DCT_scaled_size; in set_bottom_pointers()
231 rows_left = (int)(compptr->downsampled_height % (JDIMENSION)iMCUheight); in set_bottom_pointers()
236 if (ci == 0) { in set_bottom_pointers()
237 main_ptr->rowgroups_avail = (JDIMENSION)((rows_left - 1) / rgroup + 1); in set_bottom_pointers()
242 xbuf = main_ptr->xbuffer[main_ptr->whichptr][ci]; in set_bottom_pointers()
244 xbuf[rows_left + i] = xbuf[rows_left - 1]; in set_bottom_pointers()
251 * Initialize for a processing pass.
257 my_main_ptr main_ptr = (my_main_ptr)cinfo->main; in start_pass_main()
261 if (cinfo->upsample->need_context_rows) { in start_pass_main()
262 main_ptr->pub.process_data = process_data_context_main; in start_pass_main()
264 main_ptr->whichptr = 0; /* Read first iMCU row into xbuffer[0] */ in start_pass_main()
265 main_ptr->context_state = CTX_PREPARE_FOR_IMCU; in start_pass_main()
266 main_ptr->iMCU_row_ctr = 0; in start_pass_main()
269 main_ptr->pub.process_data = process_data_simple_main; in start_pass_main()
271 main_ptr->buffer_full = FALSE; /* Mark buffer empty */ in start_pass_main()
272 main_ptr->rowgroup_ctr = 0; in start_pass_main()
276 /* For last pass of 2-pass quantization, just crank the postprocessor */ in start_pass_main()
277 main_ptr->pub.process_data = process_data_crank_post; in start_pass_main()
296 my_main_ptr main_ptr = (my_main_ptr)cinfo->main; in process_data_simple_main()
300 if (!main_ptr->buffer_full) { in process_data_simple_main()
301 if (!(*cinfo->coef->decompress_data) (cinfo, main_ptr->buffer)) in process_data_simple_main()
303 main_ptr->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ in process_data_simple_main()
307 rowgroups_avail = (JDIMENSION)cinfo->_min_DCT_scaled_size; in process_data_simple_main()
308 /* Note: at the bottom of the image, we may pass extra garbage row groups in process_data_simple_main()
314 (*cinfo->post->post_process_data) (cinfo, main_ptr->buffer, in process_data_simple_main()
315 &main_ptr->rowgroup_ctr, rowgroups_avail, in process_data_simple_main()
319 if (main_ptr->rowgroup_ctr >= rowgroups_avail) { in process_data_simple_main()
320 main_ptr->buffer_full = FALSE; in process_data_simple_main()
321 main_ptr->rowgroup_ctr = 0; in process_data_simple_main()
335 my_main_ptr main_ptr = (my_main_ptr)cinfo->main; in process_data_context_main()
338 if (!main_ptr->buffer_full) { in process_data_context_main()
339 if (!(*cinfo->coef->decompress_data) (cinfo, in process_data_context_main()
340 main_ptr->xbuffer[main_ptr->whichptr])) in process_data_context_main()
342 main_ptr->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ in process_data_context_main()
343 main_ptr->iMCU_row_ctr++; /* count rows received */ in process_data_context_main()
351 switch (main_ptr->context_state) { in process_data_context_main()
354 (*cinfo->post->post_process_data) (cinfo, in process_data_context_main()
355 main_ptr->xbuffer[main_ptr->whichptr], in process_data_context_main()
356 &main_ptr->rowgroup_ctr, in process_data_context_main()
357 main_ptr->rowgroups_avail, output_buf, in process_data_context_main()
359 if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail) in process_data_context_main()
361 main_ptr->context_state = CTX_PREPARE_FOR_IMCU; in process_data_context_main()
366 /* Prepare to process first M-1 row groups of this iMCU row */ in process_data_context_main()
367 main_ptr->rowgroup_ctr = 0; in process_data_context_main()
368 main_ptr->rowgroups_avail = (JDIMENSION)(cinfo->_min_DCT_scaled_size - 1); in process_data_context_main()
372 if (main_ptr->iMCU_row_ctr == cinfo->total_iMCU_rows) in process_data_context_main()
374 main_ptr->context_state = CTX_PROCESS_IMCU; in process_data_context_main()
378 (*cinfo->post->post_process_data) (cinfo, in process_data_context_main()
379 main_ptr->xbuffer[main_ptr->whichptr], in process_data_context_main()
380 &main_ptr->rowgroup_ctr, in process_data_context_main()
381 main_ptr->rowgroups_avail, output_buf, in process_data_context_main()
383 if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail) in process_data_context_main()
386 if (main_ptr->iMCU_row_ctr == 1) in process_data_context_main()
389 main_ptr->whichptr ^= 1; /* 0=>1 or 1=>0 */ in process_data_context_main()
390 main_ptr->buffer_full = FALSE; in process_data_context_main()
393 main_ptr->rowgroup_ctr = (JDIMENSION)(cinfo->_min_DCT_scaled_size + 1); in process_data_context_main()
394 main_ptr->rowgroups_avail = (JDIMENSION)(cinfo->_min_DCT_scaled_size + 2); in process_data_context_main()
395 main_ptr->context_state = CTX_POSTPONED_ROW; in process_data_context_main()
402 * Final pass of two-pass quantization: just call the postprocessor.
412 (*cinfo->post->post_process_data) (cinfo, (JSAMPIMAGE)NULL, in process_data_crank_post()
428 int ci, rgroup, ngroups; in jinit_d_main_controller() local
432 (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, in jinit_d_main_controller()
434 cinfo->main = (struct jpeg_d_main_controller *)main_ptr; in jinit_d_main_controller()
435 main_ptr->pub.start_pass = start_pass_main; in jinit_d_main_controller()
443 if (cinfo->upsample->need_context_rows) { in jinit_d_main_controller()
444 if (cinfo->_min_DCT_scaled_size < 2) /* unsupported, see comments above */ in jinit_d_main_controller()
447 ngroups = cinfo->_min_DCT_scaled_size + 2; in jinit_d_main_controller()
449 ngroups = cinfo->_min_DCT_scaled_size; in jinit_d_main_controller()
452 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; in jinit_d_main_controller()
453 ci++, compptr++) { in jinit_d_main_controller()
454 rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) / in jinit_d_main_controller()
455 cinfo->_min_DCT_scaled_size; /* height of a row group of component */ in jinit_d_main_controller()
456 main_ptr->buffer[ci] = (*cinfo->mem->alloc_sarray) in jinit_d_main_controller()
458 compptr->width_in_blocks * compptr->_DCT_scaled_size, in jinit_d_main_controller()