13 #define JPEG_INTERNALS 23 #ifdef ENTROPY_OPT_SUPPORTED 24 #define FULL_COEF_BUFFER_SUPPORTED 26 #ifdef C_MULTISCAN_FILES_SUPPORTED 27 #define FULL_COEF_BUFFER_SUPPORTED 40 int MCU_rows_per_iMCU_row;
63 #ifdef FULL_COEF_BUFFER_SUPPORTED 82 coef->MCU_rows_per_iMCU_row = 1;
91 coef->MCU_vert_offset = 0;
104 coef->iMCU_row_num = 0;
109 if (coef->whole_image[0] !=
NULL)
110 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
113 #ifdef FULL_COEF_BUFFER_SUPPORTED 115 if (coef->whole_image[0] ==
NULL)
116 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
120 if (coef->whole_image[0] ==
NULL)
121 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
126 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
147 JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
148 JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
149 int blkn, bi, ci, yindex,
yoffset, blockcnt;
156 for (MCU_col_num = coef->mcu_ctr; MCU_col_num <= last_MCU_col;
168 for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
169 compptr = cinfo->cur_comp_info[ci];
175 if (coef->iMCU_row_num < last_iMCU_row ||
176 yoffset+yindex < compptr->last_row_height) {
177 (*cinfo->fdct->forward_DCT) (cinfo,
compptr,
179 coef->MCU_buffer[blkn],
181 if (blockcnt < compptr->MCU_width) {
183 jzero_far((
void FAR *) coef->MCU_buffer[blkn + blockcnt],
186 coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn+bi-1][0][0];
194 coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn-1][0][0];
204 if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
206 coef->MCU_vert_offset =
yoffset;
207 coef->mcu_ctr = MCU_col_num;
215 coef->iMCU_row_num++;
221 #ifdef FULL_COEF_BUFFER_SUPPORTED 248 JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
249 JDIMENSION blocks_across, MCUs_across, MCUindex;
250 int bi, ci, h_samp_factor, block_row, block_rows, ndummy;
256 for (ci = 0,
compptr = cinfo->comp_info; ci < cinfo->num_components;
259 buffer = (*cinfo->mem->access_virt_barray)
264 if (coef->iMCU_row_num < last_iMCU_row)
274 ndummy = (
int) (blocks_across % h_samp_factor);
276 ndummy = h_samp_factor - ndummy;
280 for (block_row = 0; block_row < block_rows; block_row++) {
281 thisblockrow =
buffer[block_row];
282 (*cinfo->fdct->forward_DCT) (cinfo,
compptr,
283 input_buf[ci], thisblockrow,
288 thisblockrow += blocks_across;
290 lastDC = thisblockrow[-1][0];
291 for (bi = 0; bi < ndummy; bi++) {
292 thisblockrow[bi][0] = lastDC;
301 if (coef->iMCU_row_num == last_iMCU_row) {
302 blocks_across += ndummy;
303 MCUs_across = blocks_across / h_samp_factor;
306 thisblockrow =
buffer[block_row];
307 lastblockrow =
buffer[block_row-1];
310 for (MCUindex = 0; MCUindex < MCUs_across; MCUindex++) {
311 lastDC = lastblockrow[h_samp_factor-1][0];
312 for (bi = 0; bi < h_samp_factor; bi++) {
313 thisblockrow[bi][0] = lastDC;
315 thisblockrow += h_samp_factor;
316 lastblockrow += h_samp_factor;
345 int blkn, ci, xindex, yindex,
yoffset;
355 for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
356 compptr = cinfo->cur_comp_info[ci];
357 buffer[ci] = (*cinfo->mem->access_virt_barray)
366 for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row;
370 for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
371 compptr = cinfo->cur_comp_info[ci];
376 coef->MCU_buffer[blkn++] = buffer_ptr++;
381 if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
383 coef->MCU_vert_offset =
yoffset;
384 coef->mcu_ctr = MCU_col_num;
392 coef->iMCU_row_num++;
411 SIZEOF(my_coef_controller));
416 if (need_full_buffer) {
417 #ifdef FULL_COEF_BUFFER_SUPPORTED 423 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
425 coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
434 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
445 coef->MCU_buffer[
i] = buffer +
i;
447 coef->whole_image[0] =
NULL;
for(n=1;n< outline->n_points;n++)
struct jpeg_common_struct * j_common_ptr
compress_data(j_compress_ptr cinfo, JSAMPIMAGE input_buf)
#define ERREXIT(cinfo, code)
jpeg_component_info * compptr
JDIMENSION width_in_blocks
jround_up(long a, long b)
compress_output(j_compress_ptr cinfo, JSAMPIMAGE input_buf)
JDIMENSION height_in_blocks
compress_first_pass(j_compress_ptr cinfo, JSAMPIMAGE input_buf)
struct jpeg_c_coef_controller * coef
my_coef_controller * my_coef_ptr
JDIMENSION total_iMCU_rows
#define C_MAX_BLOCKS_IN_MCU
typedef long(ZCALLBACK *tell_file_func) OF((voidpf opaque
GLint GLint GLint yoffset
jzero_far(void FAR *target, size_t bytestozero)
struct jvirt_barray_control * jvirt_barray_ptr
if(!abbox) return FT_THROW(Invalid_Argument)
start_pass_coef(j_compress_ptr cinfo, J_BUF_MODE pass_mode)
start_iMCU_row(j_compress_ptr cinfo)
jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]
jinit_c_coef_controller(j_compress_ptr cinfo, boolean need_full_buffer)
#define MAX_COMPS_IN_SCAN