typedefstruct { struct jpeg_d_coef_controller pub; /* public fields */
/* These variables keep track of the current location of the input side. */ /* cinfo->input_iMCU_row is also used for this. */
JDIMENSION MCU_ctr; /* counts MCUs processed in current row */ unsignedint restart_rows_to_go; /* MCU rows left in this restart
interval */ unsignedint MCU_vert_offset; /* counts MCU rows within iMCU row */ unsignedint MCU_rows_per_iMCU_row; /* number of such rows needed */
/* The output side's location is represented by cinfo->output_iMCU_row. */
JDIFFARRAY diff_buf[MAX_COMPONENTS]; /* iMCU row of differences */
JDIFFARRAY undiff_buf[MAX_COMPONENTS]; /* iMCU row of undiff'd samples */
#ifdef D_MULTISCAN_FILES_SUPPORTED /* In multi-pass modes, we need a virtual sample array for each component. */
jvirt_sarray_ptr whole_image[MAX_COMPONENTS]; #endif
} my_diff_controller;
LOCAL(void)
start_iMCU_row(j_decompress_ptr cinfo) /* Reset within-iMCU-row counters for a new row (input side) */
{
my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
/* In an interleaved scan, an MCU row is the same as an iMCU row. *Inanoninterleavedscan,aniMCUrowhasv_samp_factorMCUrows. *Butatthebottomoftheimage,processonlywhat'sleft.
*/ if (cinfo->comps_in_scan > 1) {
diff->MCU_rows_per_iMCU_row = 1;
} else { if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor; else
diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
}
/* Because it is hitching a ride on the jpeg_inverse_dct struct, *start_pass_lossless()willbecalledatthestartoftheoutputpass. *Thisensuresthatitwillbecalledatthestartoftheinputpassas *well.
*/
(*cinfo->idct->start_pass) (cinfo);
/* Check that the restart interval is an integer multiple of the number *ofMCUsinanMCUrow.
*/ if (cinfo->restart_interval % cinfo->MCUs_per_row != 0)
ERREXIT2(cinfo, JERR_BAD_RESTART,
cinfo->restart_interval, cinfo->MCUs_per_row);
METHODDEF(int)
decompress_data(j_decompress_ptr cinfo, _JSAMPIMAGE output_buf)
{
my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
JDIMENSION MCU_col_num; /* index of current MCU within row */
JDIMENSION MCU_count; /* number of MCUs decoded */
JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; int ci, compi, row, prev_row; unsignedint yoffset;
jpeg_component_info *compptr;
/* Loop to process as much as one whole iMCU row */ for (yoffset = diff->MCU_vert_offset; yoffset < diff->MCU_rows_per_iMCU_row;
yoffset++) {
/* Process restart marker if needed; may have to suspend */ if (cinfo->restart_interval) { if (diff->restart_rows_to_go == 0) if (!process_restart(cinfo)) return JPEG_SUSPENDED;
}
MCU_col_num = diff->MCU_ctr; /* Try to fetch an MCU row (or remaining portion of suspended MCU row). */
MCU_count =
(*cinfo->entropy->decode_mcus) (cinfo,
diff->diff_buf, yoffset, MCU_col_num,
cinfo->MCUs_per_row - MCU_col_num); if (MCU_count != cinfo->MCUs_per_row - MCU_col_num) { /* Suspension forced; update state counters and exit */
diff->MCU_vert_offset = yoffset;
diff->MCU_ctr += MCU_count; return JPEG_SUSPENDED;
}
/* Account for restart interval (no-op if not using restarts) */ if (cinfo->restart_interval)
diff->restart_rows_to_go--;
/* Completed an MCU row, but perhaps not an iMCU row */
diff->MCU_ctr = 0;
}
/* Align the virtual buffers for the components used in this scan. */ for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
compptr = cinfo->cur_comp_info[ci];
compi = compptr->component_index;
buffer[compi] = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
((j_common_ptr)cinfo, diff->whole_image[compi],
cinfo->input_iMCU_row * compptr->v_samp_factor,
(JDIMENSION)compptr->v_samp_factor, TRUE);
}
/* Force some input to be done if we are getting ahead of the input. */ while (cinfo->input_scan_number < cinfo->output_scan_number ||
(cinfo->input_scan_number == cinfo->output_scan_number &&
cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) { if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED) return JPEG_SUSPENDED;
}
/* OK, output from the virtual arrays. */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) { /* Align the virtual buffer for this component. */
buffer = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
((j_common_ptr)cinfo, diff->whole_image[ci],
cinfo->output_iMCU_row * compptr->v_samp_factor,
(JDIMENSION)compptr->v_samp_factor, FALSE);
if (cinfo->output_iMCU_row < last_iMCU_row)
samp_rows = compptr->v_samp_factor; else { /* NB: can't use last_row_height here; it is input-side-dependent! */
samp_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor); if (samp_rows == 0) samp_rows = compptr->v_samp_factor;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.