116 { |
116 { |
117 my_main_ptr main = (my_main_ptr) cinfo->main; |
117 my_main_ptr main = (my_main_ptr) cinfo->main; |
118 |
118 |
119 while (main->cur_iMCU_row < cinfo->total_iMCU_rows) { |
119 while (main->cur_iMCU_row < cinfo->total_iMCU_rows) { |
120 /* Read input data if we haven't filled the main buffer yet */ |
120 /* Read input data if we haven't filled the main buffer yet */ |
121 if (main->rowgroup_ctr < DCTSIZE) |
121 if (main->rowgroup_ctr < (JDIMENSION) cinfo->min_DCT_v_scaled_size) |
122 (*cinfo->prep->pre_process_data) (cinfo, |
122 (*cinfo->prep->pre_process_data) (cinfo, |
123 input_buf, in_row_ctr, in_rows_avail, |
123 input_buf, in_row_ctr, in_rows_avail, |
124 main->buffer, &main->rowgroup_ctr, |
124 main->buffer, &main->rowgroup_ctr, |
125 (JDIMENSION) DCTSIZE); |
125 (JDIMENSION) cinfo->min_DCT_v_scaled_size); |
126 |
126 |
127 /* If we don't have a full iMCU row buffered, return to application for |
127 /* If we don't have a full iMCU row buffered, return to application for |
128 * more data. Note that preprocessor will always pad to fill the iMCU row |
128 * more data. Note that preprocessor will always pad to fill the iMCU row |
129 * at the bottom of the image. |
129 * at the bottom of the image. |
130 */ |
130 */ |
131 if (main->rowgroup_ctr != DCTSIZE) |
131 if (main->rowgroup_ctr != (JDIMENSION) cinfo->min_DCT_v_scaled_size) |
132 return; |
132 return; |
133 |
133 |
134 /* Send the completed row to the compressor */ |
134 /* Send the completed row to the compressor */ |
135 if (! (*cinfo->coef->compress_data) (cinfo, main->buffer)) { |
135 if (! (*cinfo->coef->compress_data) (cinfo, main->buffer)) { |
136 /* If compressor did not consume the whole row, then we must need to |
136 /* If compressor did not consume the whole row, then we must need to |
267 /* Note we pad the bottom to a multiple of the iMCU height */ |
267 /* Note we pad the bottom to a multiple of the iMCU height */ |
268 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; |
268 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; |
269 ci++, compptr++) { |
269 ci++, compptr++) { |
270 main->whole_image[ci] = (*cinfo->mem->request_virt_sarray) |
270 main->whole_image[ci] = (*cinfo->mem->request_virt_sarray) |
271 ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, |
271 ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, |
272 compptr->width_in_blocks * DCTSIZE, |
272 compptr->width_in_blocks * compptr->DCT_h_scaled_size, |
273 (JDIMENSION) jround_up((long) compptr->height_in_blocks, |
273 (JDIMENSION) jround_up((long) compptr->height_in_blocks, |
274 (long) compptr->v_samp_factor) * DCTSIZE, |
274 (long) compptr->v_samp_factor) * DCTSIZE, |
275 (JDIMENSION) (compptr->v_samp_factor * DCTSIZE)); |
275 (JDIMENSION) (compptr->v_samp_factor * compptr->DCT_v_scaled_size)); |
276 } |
276 } |
277 #else |
277 #else |
278 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); |
278 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); |
279 #endif |
279 #endif |
280 } else { |
280 } else { |
284 /* Allocate a strip buffer for each component */ |
284 /* Allocate a strip buffer for each component */ |
285 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; |
285 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; |
286 ci++, compptr++) { |
286 ci++, compptr++) { |
287 main->buffer[ci] = (*cinfo->mem->alloc_sarray) |
287 main->buffer[ci] = (*cinfo->mem->alloc_sarray) |
288 ((j_common_ptr) cinfo, JPOOL_IMAGE, |
288 ((j_common_ptr) cinfo, JPOOL_IMAGE, |
289 compptr->width_in_blocks * DCTSIZE, |
289 compptr->width_in_blocks * compptr->DCT_h_scaled_size, |
290 (JDIMENSION) (compptr->v_samp_factor * DCTSIZE)); |
290 (JDIMENSION) (compptr->v_samp_factor * compptr->DCT_v_scaled_size)); |
291 } |
291 } |
292 } |
292 } |
293 } |
293 } |