/*
* jcmainct.c
*
- * Copyright (C) 1994-1996, Thomas G. Lane.
+ * Copyright (C) 1994-1998, Thomas G. Lane.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
JDIMENSION in_rows_avail)
{
my_main_ptr mainPtr = (my_main_ptr) cinfo->main;
+ JDIMENSION data_unit = (JDIMENSION)(cinfo->data_unit);
while (mainPtr->cur_iMCU_row < cinfo->total_iMCU_rows) {
/* Read input data if we haven't filled the main buffer yet */
- if (mainPtr->rowgroup_ctr < DCTSIZE)
+ if (mainPtr->rowgroup_ctr < data_unit)
(*cinfo->prep->pre_process_data) (cinfo,
input_buf, in_row_ctr, in_rows_avail,
mainPtr->buffer, &mainPtr->rowgroup_ctr,
- (JDIMENSION) DCTSIZE);
+ (JDIMENSION) data_unit);
/* If we don't have a full iMCU row buffered, return to application for
* more data. Note that preprocessor will always pad to fill the iMCU row
* at the bottom of the image.
*/
- if (mainPtr->rowgroup_ctr != DCTSIZE)
+ if (mainPtr->rowgroup_ctr != data_unit)
return;
/* Send the completed row to the compressor */
- if (! (*cinfo->coef->compress_data) (cinfo, mainPtr->buffer)) {
+ if (! (*cinfo->codec->compress_data) (cinfo, mainPtr->buffer)) {
/* If compressor did not consume the whole row, then we must need to
* suspend processing and return to the application. In this situation
* we pretend we didn't yet consume the last input row; otherwise, if
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
JDIMENSION in_rows_avail)
{
- my_main_ptr mainPtr = (my_main_ptr) cinfo->main;
+ my_main_ptr main = (my_main_ptr) cinfo->main;
int ci;
jpeg_component_info *compptr;
boolean writing = (mainPtr->pass_mode != JBUF_CRANK_DEST);
+ JDIMENSION data_unit = (JDIMENSION)(cinfo->data_unit);
while (mainPtr->cur_iMCU_row < cinfo->total_iMCU_rows) {
/* Realign the virtual buffers if at the start of an iMCU row. */
ci++, compptr++) {
mainPtr->buffer[ci] = (*cinfo->mem->access_virt_sarray)
((j_common_ptr) cinfo, mainPtr->whole_image[ci],
- mainPtr->cur_iMCU_row * (compptr->v_samp_factor * DCTSIZE),
- (JDIMENSION) (compptr->v_samp_factor * DCTSIZE), writing);
+ mainPtr->cur_iMCU_row * (compptr->v_samp_factor * data_unit),
+ (JDIMENSION) (compptr->v_samp_factor * data_unit), writing);
}
/* In a read pass, pretend we just read some source data. */
if (! writing) {
- *in_row_ctr += cinfo->max_v_samp_factor * DCTSIZE;
- mainPtr->rowgroup_ctr = DCTSIZE;
+ *in_row_ctr += cinfo->max_v_samp_factor * data_unit;
+ mainPtr->rowgroup_ctr = data_unit;
}
}
(*cinfo->prep->pre_process_data) (cinfo,
input_buf, in_row_ctr, in_rows_avail,
mainPtr->buffer, &mainPtr->rowgroup_ctr,
- (JDIMENSION) DCTSIZE);
+ (JDIMENSION) data_unit);
/* Return to application if we need more data to fill the iMCU row. */
- if (mainPtr->rowgroup_ctr < DCTSIZE)
+ if (mainPtr->rowgroup_ctr < data_unit)
return;
}
/* Emit data, unless this is a sink-only pass. */
if (mainPtr->pass_mode != JBUF_SAVE_SOURCE) {
- if (! (*cinfo->coef->compress_data) (cinfo, mainPtr->buffer)) {
+ if (! (*cinfo->codec->compress_data) (cinfo, mainPtr->buffer)) {
/* If compressor did not consume the whole row, then we must need to
* suspend processing and return to the application. In this situation
* we pretend we didn't yet consume the last input row; otherwise, if
my_main_ptr mainPtr;
int ci;
jpeg_component_info *compptr;
+ int data_unit = cinfo->data_unit;
mainPtr = (my_main_ptr)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
ci++, compptr++) {
mainPtr->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
- compptr->width_in_blocks * DCTSIZE,
- (JDIMENSION) jround_up((long) compptr->height_in_blocks,
- (long) compptr->v_samp_factor) * DCTSIZE,
- (JDIMENSION) (compptr->v_samp_factor * DCTSIZE));
+ compptr->width_in_data_units * data_unit,
+ (JDIMENSION) jround_up((long) compptr->height_in_data_units,
+ (long) compptr->v_samp_factor) * data_unit,
+ (JDIMENSION) (compptr->v_samp_factor * data_unit));
}
#else
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
ci++, compptr++) {
mainPtr->buffer[ci] = (*cinfo->mem->alloc_sarray)
((j_common_ptr) cinfo, JPOOL_IMAGE,
- compptr->width_in_blocks * DCTSIZE,
- (JDIMENSION) (compptr->v_samp_factor * DCTSIZE));
+ compptr->width_in_data_units * data_unit,
+ (JDIMENSION) (compptr->v_samp_factor * data_unit));
}
}
}