renamed main to mymain to suppress the warnings
This is partial cherry-pick of 5f4bffab216491346753a5211c494417708b4802 from the main repository.
This commit is contained in:
parent
4b165e3d6e
commit
13d8529046
92
jcmainct.c
92
jcmainct.c
@ -68,32 +68,32 @@ METHODDEF(void) process_data_buffer_main
|
|||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
|
start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
|
||||||
{
|
{
|
||||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
my_main_ptr mymain = (my_main_ptr) cinfo->main;
|
||||||
|
|
||||||
/* Do nothing in raw-data mode. */
|
/* Do nothing in raw-data mode. */
|
||||||
if (cinfo->raw_data_in)
|
if (cinfo->raw_data_in)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
main->cur_iMCU_row = 0; /* initialize counters */
|
mymain->cur_iMCU_row = 0; /* initialize counters */
|
||||||
main->rowgroup_ctr = 0;
|
mymain->rowgroup_ctr = 0;
|
||||||
main->suspended = FALSE;
|
mymain->suspended = FALSE;
|
||||||
main->pass_mode = pass_mode; /* save mode for use by process_data */
|
mymain->pass_mode = pass_mode; /* save mode for use by process_data */
|
||||||
|
|
||||||
switch (pass_mode) {
|
switch (pass_mode) {
|
||||||
case JBUF_PASS_THRU:
|
case JBUF_PASS_THRU:
|
||||||
#ifdef FULL_MAIN_BUFFER_SUPPORTED
|
#ifdef FULL_MAIN_BUFFER_SUPPORTED
|
||||||
if (main->whole_image[0] != NULL)
|
if (mymain->whole_image[0] != NULL)
|
||||||
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
||||||
#endif
|
#endif
|
||||||
main->pub.process_data = process_data_simple_main;
|
mymain->pub.process_data = process_data_simple_main;
|
||||||
break;
|
break;
|
||||||
#ifdef FULL_MAIN_BUFFER_SUPPORTED
|
#ifdef FULL_MAIN_BUFFER_SUPPORTED
|
||||||
case JBUF_SAVE_SOURCE:
|
case JBUF_SAVE_SOURCE:
|
||||||
case JBUF_CRANK_DEST:
|
case JBUF_CRANK_DEST:
|
||||||
case JBUF_SAVE_AND_PASS:
|
case JBUF_SAVE_AND_PASS:
|
||||||
if (main->whole_image[0] == NULL)
|
if (mymain->whole_image[0] == NULL)
|
||||||
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
||||||
main->pub.process_data = process_data_buffer_main;
|
mymain->pub.process_data = process_data_buffer_main;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
@ -114,46 +114,46 @@ process_data_simple_main (j_compress_ptr cinfo,
|
|||||||
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
|
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
|
||||||
JDIMENSION in_rows_avail)
|
JDIMENSION in_rows_avail)
|
||||||
{
|
{
|
||||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
my_main_ptr mymain = (my_main_ptr) cinfo->main;
|
||||||
|
|
||||||
while (main->cur_iMCU_row < cinfo->total_iMCU_rows) {
|
while (mymain->cur_iMCU_row < cinfo->total_iMCU_rows) {
|
||||||
/* Read input data if we haven't filled the main buffer yet */
|
/* Read input data if we haven't filled the main buffer yet */
|
||||||
if (main->rowgroup_ctr < DCTSIZE)
|
if (mymain->rowgroup_ctr < DCTSIZE)
|
||||||
(*cinfo->prep->pre_process_data) (cinfo,
|
(*cinfo->prep->pre_process_data) (cinfo,
|
||||||
input_buf, in_row_ctr, in_rows_avail,
|
input_buf, in_row_ctr, in_rows_avail,
|
||||||
main->buffer, &main->rowgroup_ctr,
|
mymain->buffer, &mymain->rowgroup_ctr,
|
||||||
(JDIMENSION) DCTSIZE);
|
(JDIMENSION) DCTSIZE);
|
||||||
|
|
||||||
/* If we don't have a full iMCU row buffered, return to application for
|
/* 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
|
* more data. Note that preprocessor will always pad to fill the iMCU row
|
||||||
* at the bottom of the image.
|
* at the bottom of the image.
|
||||||
*/
|
*/
|
||||||
if (main->rowgroup_ctr != DCTSIZE)
|
if (mymain->rowgroup_ctr != DCTSIZE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Send the completed row to the compressor */
|
/* Send the completed row to the compressor */
|
||||||
if (! (*cinfo->coef->compress_data) (cinfo, main->buffer)) {
|
if (! (*cinfo->coef->compress_data) (cinfo, mymain->buffer)) {
|
||||||
/* If compressor did not consume the whole row, then we must need to
|
/* If compressor did not consume the whole row, then we must need to
|
||||||
* suspend processing and return to the application. In this situation
|
* suspend processing and return to the application. In this situation
|
||||||
* we pretend we didn't yet consume the last input row; otherwise, if
|
* we pretend we didn't yet consume the last input row; otherwise, if
|
||||||
* it happened to be the last row of the image, the application would
|
* it happened to be the last row of the image, the application would
|
||||||
* think we were done.
|
* think we were done.
|
||||||
*/
|
*/
|
||||||
if (! main->suspended) {
|
if (! mymain->suspended) {
|
||||||
(*in_row_ctr)--;
|
(*in_row_ctr)--;
|
||||||
main->suspended = TRUE;
|
mymain->suspended = TRUE;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* We did finish the row. Undo our little suspension hack if a previous
|
/* We did finish the row. Undo our little suspension hack if a previous
|
||||||
* call suspended; then mark the main buffer empty.
|
* call suspended; then mark the main buffer empty.
|
||||||
*/
|
*/
|
||||||
if (main->suspended) {
|
if (mymain->suspended) {
|
||||||
(*in_row_ctr)++;
|
(*in_row_ctr)++;
|
||||||
main->suspended = FALSE;
|
mymain->suspended = FALSE;
|
||||||
}
|
}
|
||||||
main->rowgroup_ctr = 0;
|
mymain->rowgroup_ctr = 0;
|
||||||
main->cur_iMCU_row++;
|
mymain->cur_iMCU_row++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,25 +170,25 @@ process_data_buffer_main (j_compress_ptr cinfo,
|
|||||||
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
|
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
|
||||||
JDIMENSION in_rows_avail)
|
JDIMENSION in_rows_avail)
|
||||||
{
|
{
|
||||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
my_main_ptr mymain = (my_main_ptr) cinfo->main;
|
||||||
int ci;
|
int ci;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
boolean writing = (main->pass_mode != JBUF_CRANK_DEST);
|
boolean writing = (mymain->pass_mode != JBUF_CRANK_DEST);
|
||||||
|
|
||||||
while (main->cur_iMCU_row < cinfo->total_iMCU_rows) {
|
while (mymain->cur_iMCU_row < cinfo->total_iMCU_rows) {
|
||||||
/* Realign the virtual buffers if at the start of an iMCU row. */
|
/* Realign the virtual buffers if at the start of an iMCU row. */
|
||||||
if (main->rowgroup_ctr == 0) {
|
if (mymain->rowgroup_ctr == 0) {
|
||||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
main->buffer[ci] = (*cinfo->mem->access_virt_sarray)
|
mymain->buffer[ci] = (*cinfo->mem->access_virt_sarray)
|
||||||
((j_common_ptr) cinfo, main->whole_image[ci],
|
((j_common_ptr) cinfo, mymain->whole_image[ci],
|
||||||
main->cur_iMCU_row * (compptr->v_samp_factor * DCTSIZE),
|
mymain->cur_iMCU_row * (compptr->v_samp_factor * DCTSIZE),
|
||||||
(JDIMENSION) (compptr->v_samp_factor * DCTSIZE), writing);
|
(JDIMENSION) (compptr->v_samp_factor * DCTSIZE), writing);
|
||||||
}
|
}
|
||||||
/* In a read pass, pretend we just read some source data. */
|
/* In a read pass, pretend we just read some source data. */
|
||||||
if (! writing) {
|
if (! writing) {
|
||||||
*in_row_ctr += cinfo->max_v_samp_factor * DCTSIZE;
|
*in_row_ctr += cinfo->max_v_samp_factor * DCTSIZE;
|
||||||
main->rowgroup_ctr = DCTSIZE;
|
mymain->rowgroup_ctr = DCTSIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,40 +197,40 @@ process_data_buffer_main (j_compress_ptr cinfo,
|
|||||||
if (writing) {
|
if (writing) {
|
||||||
(*cinfo->prep->pre_process_data) (cinfo,
|
(*cinfo->prep->pre_process_data) (cinfo,
|
||||||
input_buf, in_row_ctr, in_rows_avail,
|
input_buf, in_row_ctr, in_rows_avail,
|
||||||
main->buffer, &main->rowgroup_ctr,
|
mymain->buffer, &mymain->rowgroup_ctr,
|
||||||
(JDIMENSION) DCTSIZE);
|
(JDIMENSION) DCTSIZE);
|
||||||
/* Return to application if we need more data to fill the iMCU row. */
|
/* Return to application if we need more data to fill the iMCU row. */
|
||||||
if (main->rowgroup_ctr < DCTSIZE)
|
if (mymain->rowgroup_ctr < DCTSIZE)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Emit data, unless this is a sink-only pass. */
|
/* Emit data, unless this is a sink-only pass. */
|
||||||
if (main->pass_mode != JBUF_SAVE_SOURCE) {
|
if (mymain->pass_mode != JBUF_SAVE_SOURCE) {
|
||||||
if (! (*cinfo->coef->compress_data) (cinfo, main->buffer)) {
|
if (! (*cinfo->coef->compress_data) (cinfo, mymain->buffer)) {
|
||||||
/* If compressor did not consume the whole row, then we must need to
|
/* If compressor did not consume the whole row, then we must need to
|
||||||
* suspend processing and return to the application. In this situation
|
* suspend processing and return to the application. In this situation
|
||||||
* we pretend we didn't yet consume the last input row; otherwise, if
|
* we pretend we didn't yet consume the last input row; otherwise, if
|
||||||
* it happened to be the last row of the image, the application would
|
* it happened to be the last row of the image, the application would
|
||||||
* think we were done.
|
* think we were done.
|
||||||
*/
|
*/
|
||||||
if (! main->suspended) {
|
if (! mymain->suspended) {
|
||||||
(*in_row_ctr)--;
|
(*in_row_ctr)--;
|
||||||
main->suspended = TRUE;
|
mymain->suspended = TRUE;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* We did finish the row. Undo our little suspension hack if a previous
|
/* We did finish the row. Undo our little suspension hack if a previous
|
||||||
* call suspended; then mark the main buffer empty.
|
* call suspended; then mark the main buffer empty.
|
||||||
*/
|
*/
|
||||||
if (main->suspended) {
|
if (mymain->suspended) {
|
||||||
(*in_row_ctr)++;
|
(*in_row_ctr)++;
|
||||||
main->suspended = FALSE;
|
mymain->suspended = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If get here, we are done with this iMCU row. Mark buffer empty. */
|
/* If get here, we are done with this iMCU row. Mark buffer empty. */
|
||||||
main->rowgroup_ctr = 0;
|
mymain->rowgroup_ctr = 0;
|
||||||
main->cur_iMCU_row++;
|
mymain->cur_iMCU_row++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,15 +244,15 @@ process_data_buffer_main (j_compress_ptr cinfo,
|
|||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
||||||
{
|
{
|
||||||
my_main_ptr main;
|
my_main_ptr mymain;
|
||||||
int ci;
|
int ci;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
|
|
||||||
main = (my_main_ptr)
|
mymain = (my_main_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
SIZEOF(my_main_controller));
|
SIZEOF(my_main_controller));
|
||||||
cinfo->main = (struct jpeg_c_main_controller *) main;
|
cinfo->main = (struct jpeg_c_main_controller *) mymain;
|
||||||
main->pub.start_pass = start_pass_main;
|
mymain->pub.start_pass = start_pass_main;
|
||||||
|
|
||||||
/* We don't need to create a buffer in raw-data mode. */
|
/* We don't need to create a buffer in raw-data mode. */
|
||||||
if (cinfo->raw_data_in)
|
if (cinfo->raw_data_in)
|
||||||
@ -267,7 +267,7 @@ jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
|||||||
/* Note we pad the bottom to a multiple of the iMCU height */
|
/* Note we pad the bottom to a multiple of the iMCU height */
|
||||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
main->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
|
mymain->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
|
||||||
((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
|
((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
|
||||||
compptr->width_in_blocks * DCTSIZE,
|
compptr->width_in_blocks * DCTSIZE,
|
||||||
(JDIMENSION) jround_up((long) compptr->height_in_blocks,
|
(JDIMENSION) jround_up((long) compptr->height_in_blocks,
|
||||||
@ -279,12 +279,12 @@ jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
|||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
#ifdef FULL_MAIN_BUFFER_SUPPORTED
|
#ifdef FULL_MAIN_BUFFER_SUPPORTED
|
||||||
main->whole_image[0] = NULL; /* flag for no virtual arrays */
|
mymain->whole_image[0] = NULL; /* flag for no virtual arrays */
|
||||||
#endif
|
#endif
|
||||||
/* Allocate a strip buffer for each component */
|
/* Allocate a strip buffer for each component */
|
||||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
main->buffer[ci] = (*cinfo->mem->alloc_sarray)
|
mymain->buffer[ci] = (*cinfo->mem->alloc_sarray)
|
||||||
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
compptr->width_in_blocks * DCTSIZE,
|
compptr->width_in_blocks * DCTSIZE,
|
||||||
(JDIMENSION) (compptr->v_samp_factor * DCTSIZE));
|
(JDIMENSION) (compptr->v_samp_factor * DCTSIZE));
|
||||||
|
Loading…
Reference in New Issue
Block a user