Clean up compile warnings.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8439 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
162895ad57
commit
30fd2c5bdf
@ -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 mainp = (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 */
|
mainp->cur_iMCU_row = 0; /* initialize counters */
|
||||||
main->rowgroup_ctr = 0;
|
mainp->rowgroup_ctr = 0;
|
||||||
main->suspended = FALSE;
|
mainp->suspended = FALSE;
|
||||||
main->pass_mode = pass_mode; /* save mode for use by process_data */
|
mainp->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 (mainp->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;
|
mainp->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 (mainp->whole_image[0] == NULL)
|
||||||
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
||||||
main->pub.process_data = process_data_buffer_main;
|
mainp->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 mainp = (my_main_ptr) cinfo->main;
|
||||||
|
|
||||||
while (main->cur_iMCU_row < cinfo->total_iMCU_rows) {
|
while (mainp->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 < (JDIMENSION) cinfo->min_DCT_v_scaled_size)
|
if (mainp->rowgroup_ctr < (JDIMENSION) cinfo->min_DCT_v_scaled_size)
|
||||||
(*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,
|
mainp->buffer, &mainp->rowgroup_ctr,
|
||||||
(JDIMENSION) cinfo->min_DCT_v_scaled_size);
|
(JDIMENSION) cinfo->min_DCT_v_scaled_size);
|
||||||
|
|
||||||
/* 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 != (JDIMENSION) cinfo->min_DCT_v_scaled_size)
|
if (mainp->rowgroup_ctr != (JDIMENSION) cinfo->min_DCT_v_scaled_size)
|
||||||
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, mainp->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 (! mainp->suspended) {
|
||||||
(*in_row_ctr)--;
|
(*in_row_ctr)--;
|
||||||
main->suspended = TRUE;
|
mainp->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 (mainp->suspended) {
|
||||||
(*in_row_ctr)++;
|
(*in_row_ctr)++;
|
||||||
main->suspended = FALSE;
|
mainp->suspended = FALSE;
|
||||||
}
|
}
|
||||||
main->rowgroup_ctr = 0;
|
mainp->rowgroup_ctr = 0;
|
||||||
main->cur_iMCU_row++;
|
mainp->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 mainp = (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 = (mainp->pass_mode != JBUF_CRANK_DEST);
|
||||||
|
|
||||||
while (main->cur_iMCU_row < cinfo->total_iMCU_rows) {
|
while (mainp->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 (mainp->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)
|
mainp->buffer[ci] = (*cinfo->mem->access_virt_sarray)
|
||||||
((j_common_ptr) cinfo, main->whole_image[ci],
|
((j_common_ptr) cinfo, mainp->whole_image[ci],
|
||||||
main->cur_iMCU_row * (compptr->v_samp_factor * DCTSIZE),
|
mainp->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;
|
mainp->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,
|
mainp->buffer, &mainp->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 (mainp->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 (mainp->pass_mode != JBUF_SAVE_SOURCE) {
|
||||||
if (! (*cinfo->coef->compress_data) (cinfo, main->buffer)) {
|
if (! (*cinfo->coef->compress_data) (cinfo, mainp->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 (! mainp->suspended) {
|
||||||
(*in_row_ctr)--;
|
(*in_row_ctr)--;
|
||||||
main->suspended = TRUE;
|
mainp->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 (mainp->suspended) {
|
||||||
(*in_row_ctr)++;
|
(*in_row_ctr)++;
|
||||||
main->suspended = FALSE;
|
mainp->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;
|
mainp->rowgroup_ctr = 0;
|
||||||
main->cur_iMCU_row++;
|
mainp->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 mainp;
|
||||||
int ci;
|
int ci;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
|
|
||||||
main = (my_main_ptr)
|
mainp = (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 *) mainp;
|
||||||
main->pub.start_pass = start_pass_main;
|
mainp->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)
|
mainp->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 * compptr->DCT_h_scaled_size,
|
compptr->width_in_blocks * compptr->DCT_h_scaled_size,
|
||||||
(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 */
|
mainp->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)
|
mainp->buffer[ci] = (*cinfo->mem->alloc_sarray)
|
||||||
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
compptr->width_in_blocks * compptr->DCT_h_scaled_size,
|
compptr->width_in_blocks * compptr->DCT_h_scaled_size,
|
||||||
(JDIMENSION) (compptr->v_samp_factor * compptr->DCT_v_scaled_size));
|
(JDIMENSION) (compptr->v_samp_factor * compptr->DCT_v_scaled_size));
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#ifdef __CHAR_UNSIGNED__
|
#ifdef __CHAR_UNSIGNED__
|
||||||
# define CHAR_IS_UNSIGNED
|
# define CHAR_IS_UNSIGNED
|
||||||
#endif /* __CHAR_UNSIGNED__ */
|
#endif /* __CHAR_UNSIGNED__ */
|
||||||
|
#define HAVE_STDLIB_H
|
||||||
/* Define this if you get warnings about undefined structures. */
|
/* Define this if you get warnings about undefined structures. */
|
||||||
#undef INCOMPLETE_TYPES_BROKEN
|
#undef INCOMPLETE_TYPES_BROKEN
|
||||||
|
|
||||||
|
124
jpeg/jdmainct.c
124
jpeg/jdmainct.c
@ -159,7 +159,7 @@ alloc_funny_pointers (j_decompress_ptr cinfo)
|
|||||||
* This is done only once, not once per pass.
|
* This is done only once, not once per pass.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
my_main_ptr mainp = (my_main_ptr) cinfo->main;
|
||||||
int ci, rgroup;
|
int ci, rgroup;
|
||||||
int M = cinfo->min_DCT_v_scaled_size;
|
int M = cinfo->min_DCT_v_scaled_size;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
@ -168,10 +168,10 @@ alloc_funny_pointers (j_decompress_ptr cinfo)
|
|||||||
/* Get top-level space for component array pointers.
|
/* Get top-level space for component array pointers.
|
||||||
* We alloc both arrays with one call to save a few cycles.
|
* We alloc both arrays with one call to save a few cycles.
|
||||||
*/
|
*/
|
||||||
main->xbuffer[0] = (JSAMPIMAGE)
|
mainp->xbuffer[0] = (JSAMPIMAGE)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
cinfo->num_components * 2 * SIZEOF(JSAMPARRAY));
|
cinfo->num_components * 2 * SIZEOF(JSAMPARRAY));
|
||||||
main->xbuffer[1] = main->xbuffer[0] + cinfo->num_components;
|
mainp->xbuffer[1] = mainp->xbuffer[0] + cinfo->num_components;
|
||||||
|
|
||||||
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++) {
|
||||||
@ -184,9 +184,9 @@ alloc_funny_pointers (j_decompress_ptr cinfo)
|
|||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
2 * (rgroup * (M + 4)) * SIZEOF(JSAMPROW));
|
2 * (rgroup * (M + 4)) * SIZEOF(JSAMPROW));
|
||||||
xbuf += rgroup; /* want one row group at negative offsets */
|
xbuf += rgroup; /* want one row group at negative offsets */
|
||||||
main->xbuffer[0][ci] = xbuf;
|
mainp->xbuffer[0][ci] = xbuf;
|
||||||
xbuf += rgroup * (M + 4);
|
xbuf += rgroup * (M + 4);
|
||||||
main->xbuffer[1][ci] = xbuf;
|
mainp->xbuffer[1][ci] = xbuf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,13 +194,13 @@ alloc_funny_pointers (j_decompress_ptr cinfo)
|
|||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
make_funny_pointers (j_decompress_ptr cinfo)
|
make_funny_pointers (j_decompress_ptr cinfo)
|
||||||
/* Create the funny pointer lists discussed in the comments above.
|
/* Create the funny pointer lists discussed in the comments above.
|
||||||
* The actual workspace is already allocated (in main->buffer),
|
* The actual workspace is already allocated (in mainp->buffer),
|
||||||
* and the space for the pointer lists is allocated too.
|
* and the space for the pointer lists is allocated too.
|
||||||
* This routine just fills in the curiously ordered lists.
|
* This routine just fills in the curiously ordered lists.
|
||||||
* This will be repeated at the beginning of each pass.
|
* This will be repeated at the beginning of each pass.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
my_main_ptr mainp = (my_main_ptr) cinfo->main;
|
||||||
int ci, i, rgroup;
|
int ci, i, rgroup;
|
||||||
int M = cinfo->min_DCT_v_scaled_size;
|
int M = cinfo->min_DCT_v_scaled_size;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
@ -210,10 +210,10 @@ make_funny_pointers (j_decompress_ptr cinfo)
|
|||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) /
|
rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) /
|
||||||
cinfo->min_DCT_v_scaled_size; /* height of a row group of component */
|
cinfo->min_DCT_v_scaled_size; /* height of a row group of component */
|
||||||
xbuf0 = main->xbuffer[0][ci];
|
xbuf0 = mainp->xbuffer[0][ci];
|
||||||
xbuf1 = main->xbuffer[1][ci];
|
xbuf1 = mainp->xbuffer[1][ci];
|
||||||
/* First copy the workspace pointers as-is */
|
/* First copy the workspace pointers as-is */
|
||||||
buf = main->buffer[ci];
|
buf = mainp->buffer[ci];
|
||||||
for (i = 0; i < rgroup * (M + 2); i++) {
|
for (i = 0; i < rgroup * (M + 2); i++) {
|
||||||
xbuf0[i] = xbuf1[i] = buf[i];
|
xbuf0[i] = xbuf1[i] = buf[i];
|
||||||
}
|
}
|
||||||
@ -240,7 +240,7 @@ set_wraparound_pointers (j_decompress_ptr cinfo)
|
|||||||
* This changes the pointer list state from top-of-image to the normal state.
|
* This changes the pointer list state from top-of-image to the normal state.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
my_main_ptr mainp = (my_main_ptr) cinfo->main;
|
||||||
int ci, i, rgroup;
|
int ci, i, rgroup;
|
||||||
int M = cinfo->min_DCT_v_scaled_size;
|
int M = cinfo->min_DCT_v_scaled_size;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
@ -250,8 +250,8 @@ set_wraparound_pointers (j_decompress_ptr cinfo)
|
|||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) /
|
rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) /
|
||||||
cinfo->min_DCT_v_scaled_size; /* height of a row group of component */
|
cinfo->min_DCT_v_scaled_size; /* height of a row group of component */
|
||||||
xbuf0 = main->xbuffer[0][ci];
|
xbuf0 = mainp->xbuffer[0][ci];
|
||||||
xbuf1 = main->xbuffer[1][ci];
|
xbuf1 = mainp->xbuffer[1][ci];
|
||||||
for (i = 0; i < rgroup; i++) {
|
for (i = 0; i < rgroup; i++) {
|
||||||
xbuf0[i - rgroup] = xbuf0[rgroup*(M+1) + i];
|
xbuf0[i - rgroup] = xbuf0[rgroup*(M+1) + i];
|
||||||
xbuf1[i - rgroup] = xbuf1[rgroup*(M+1) + i];
|
xbuf1[i - rgroup] = xbuf1[rgroup*(M+1) + i];
|
||||||
@ -269,7 +269,7 @@ set_bottom_pointers (j_decompress_ptr cinfo)
|
|||||||
* Also sets rowgroups_avail to indicate number of nondummy row groups in row.
|
* Also sets rowgroups_avail to indicate number of nondummy row groups in row.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
my_main_ptr mainp = (my_main_ptr) cinfo->main;
|
||||||
int ci, i, rgroup, iMCUheight, rows_left;
|
int ci, i, rgroup, iMCUheight, rows_left;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
JSAMPARRAY xbuf;
|
JSAMPARRAY xbuf;
|
||||||
@ -286,12 +286,12 @@ set_bottom_pointers (j_decompress_ptr cinfo)
|
|||||||
* so we need only do it once.
|
* so we need only do it once.
|
||||||
*/
|
*/
|
||||||
if (ci == 0) {
|
if (ci == 0) {
|
||||||
main->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1);
|
mainp->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1);
|
||||||
}
|
}
|
||||||
/* Duplicate the last real sample row rgroup*2 times; this pads out the
|
/* Duplicate the last real sample row rgroup*2 times; this pads out the
|
||||||
* last partial rowgroup and ensures at least one full rowgroup of context.
|
* last partial rowgroup and ensures at least one full rowgroup of context.
|
||||||
*/
|
*/
|
||||||
xbuf = main->xbuffer[main->whichptr][ci];
|
xbuf = mainp->xbuffer[mainp->whichptr][ci];
|
||||||
for (i = 0; i < rgroup * 2; i++) {
|
for (i = 0; i < rgroup * 2; i++) {
|
||||||
xbuf[rows_left + i] = xbuf[rows_left-1];
|
xbuf[rows_left + i] = xbuf[rows_left-1];
|
||||||
}
|
}
|
||||||
@ -306,27 +306,27 @@ set_bottom_pointers (j_decompress_ptr cinfo)
|
|||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
|
start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
|
||||||
{
|
{
|
||||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
my_main_ptr mainp = (my_main_ptr) cinfo->main;
|
||||||
|
|
||||||
switch (pass_mode) {
|
switch (pass_mode) {
|
||||||
case JBUF_PASS_THRU:
|
case JBUF_PASS_THRU:
|
||||||
if (cinfo->upsample->need_context_rows) {
|
if (cinfo->upsample->need_context_rows) {
|
||||||
main->pub.process_data = process_data_context_main;
|
mainp->pub.process_data = process_data_context_main;
|
||||||
make_funny_pointers(cinfo); /* Create the xbuffer[] lists */
|
make_funny_pointers(cinfo); /* Create the xbuffer[] lists */
|
||||||
main->whichptr = 0; /* Read first iMCU row into xbuffer[0] */
|
mainp->whichptr = 0; /* Read first iMCU row into xbuffer[0] */
|
||||||
main->context_state = CTX_PREPARE_FOR_IMCU;
|
mainp->context_state = CTX_PREPARE_FOR_IMCU;
|
||||||
main->iMCU_row_ctr = 0;
|
mainp->iMCU_row_ctr = 0;
|
||||||
} else {
|
} else {
|
||||||
/* Simple case with no context needed */
|
/* Simple case with no context needed */
|
||||||
main->pub.process_data = process_data_simple_main;
|
mainp->pub.process_data = process_data_simple_main;
|
||||||
}
|
}
|
||||||
main->buffer_full = FALSE; /* Mark buffer empty */
|
mainp->buffer_full = FALSE; /* Mark buffer empty */
|
||||||
main->rowgroup_ctr = 0;
|
mainp->rowgroup_ctr = 0;
|
||||||
break;
|
break;
|
||||||
#ifdef QUANT_2PASS_SUPPORTED
|
#ifdef QUANT_2PASS_SUPPORTED
|
||||||
case JBUF_CRANK_DEST:
|
case JBUF_CRANK_DEST:
|
||||||
/* For last pass of 2-pass quantization, just crank the postprocessor */
|
/* For last pass of 2-pass quantization, just crank the postprocessor */
|
||||||
main->pub.process_data = process_data_crank_post;
|
mainp->pub.process_data = process_data_crank_post;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
@ -346,14 +346,14 @@ process_data_simple_main (j_decompress_ptr cinfo,
|
|||||||
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
|
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
|
||||||
JDIMENSION out_rows_avail)
|
JDIMENSION out_rows_avail)
|
||||||
{
|
{
|
||||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
my_main_ptr mainp = (my_main_ptr) cinfo->main;
|
||||||
JDIMENSION rowgroups_avail;
|
JDIMENSION rowgroups_avail;
|
||||||
|
|
||||||
/* 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->buffer_full) {
|
if (! mainp->buffer_full) {
|
||||||
if (! (*cinfo->coef->decompress_data) (cinfo, main->buffer))
|
if (! (*cinfo->coef->decompress_data) (cinfo, mainp->buffer))
|
||||||
return; /* suspension forced, can do nothing more */
|
return; /* suspension forced, can do nothing more */
|
||||||
main->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
|
mainp->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* There are always min_DCT_scaled_size row groups in an iMCU row. */
|
/* There are always min_DCT_scaled_size row groups in an iMCU row. */
|
||||||
@ -364,14 +364,14 @@ process_data_simple_main (j_decompress_ptr cinfo,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Feed the postprocessor */
|
/* Feed the postprocessor */
|
||||||
(*cinfo->post->post_process_data) (cinfo, main->buffer,
|
(*cinfo->post->post_process_data) (cinfo, mainp->buffer,
|
||||||
&main->rowgroup_ctr, rowgroups_avail,
|
&mainp->rowgroup_ctr, rowgroups_avail,
|
||||||
output_buf, out_row_ctr, out_rows_avail);
|
output_buf, out_row_ctr, out_rows_avail);
|
||||||
|
|
||||||
/* Has postprocessor consumed all the data yet? If so, mark buffer empty */
|
/* Has postprocessor consumed all the data yet? If so, mark buffer empty */
|
||||||
if (main->rowgroup_ctr >= rowgroups_avail) {
|
if (mainp->rowgroup_ctr >= rowgroups_avail) {
|
||||||
main->buffer_full = FALSE;
|
mainp->buffer_full = FALSE;
|
||||||
main->rowgroup_ctr = 0;
|
mainp->rowgroup_ctr = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,15 +386,15 @@ process_data_context_main (j_decompress_ptr cinfo,
|
|||||||
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
|
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
|
||||||
JDIMENSION out_rows_avail)
|
JDIMENSION out_rows_avail)
|
||||||
{
|
{
|
||||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
my_main_ptr mainp = (my_main_ptr) cinfo->main;
|
||||||
|
|
||||||
/* 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->buffer_full) {
|
if (! mainp->buffer_full) {
|
||||||
if (! (*cinfo->coef->decompress_data) (cinfo,
|
if (! (*cinfo->coef->decompress_data) (cinfo,
|
||||||
main->xbuffer[main->whichptr]))
|
mainp->xbuffer[mainp->whichptr]))
|
||||||
return; /* suspension forced, can do nothing more */
|
return; /* suspension forced, can do nothing more */
|
||||||
main->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
|
mainp->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
|
||||||
main->iMCU_row_ctr++; /* count rows received */
|
mainp->iMCU_row_ctr++; /* count rows received */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Postprocessor typically will not swallow all the input data it is handed
|
/* Postprocessor typically will not swallow all the input data it is handed
|
||||||
@ -402,47 +402,47 @@ process_data_context_main (j_decompress_ptr cinfo,
|
|||||||
* to exit and restart. This switch lets us keep track of how far we got.
|
* to exit and restart. This switch lets us keep track of how far we got.
|
||||||
* Note that each case falls through to the next on successful completion.
|
* Note that each case falls through to the next on successful completion.
|
||||||
*/
|
*/
|
||||||
switch (main->context_state) {
|
switch (mainp->context_state) {
|
||||||
case CTX_POSTPONED_ROW:
|
case CTX_POSTPONED_ROW:
|
||||||
/* Call postprocessor using previously set pointers for postponed row */
|
/* Call postprocessor using previously set pointers for postponed row */
|
||||||
(*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr],
|
(*cinfo->post->post_process_data) (cinfo, mainp->xbuffer[mainp->whichptr],
|
||||||
&main->rowgroup_ctr, main->rowgroups_avail,
|
&mainp->rowgroup_ctr, mainp->rowgroups_avail,
|
||||||
output_buf, out_row_ctr, out_rows_avail);
|
output_buf, out_row_ctr, out_rows_avail);
|
||||||
if (main->rowgroup_ctr < main->rowgroups_avail)
|
if (mainp->rowgroup_ctr < mainp->rowgroups_avail)
|
||||||
return; /* Need to suspend */
|
return; /* Need to suspend */
|
||||||
main->context_state = CTX_PREPARE_FOR_IMCU;
|
mainp->context_state = CTX_PREPARE_FOR_IMCU;
|
||||||
if (*out_row_ctr >= out_rows_avail)
|
if (*out_row_ctr >= out_rows_avail)
|
||||||
return; /* Postprocessor exactly filled output buf */
|
return; /* Postprocessor exactly filled output buf */
|
||||||
/*FALLTHROUGH*/
|
/*FALLTHROUGH*/
|
||||||
case CTX_PREPARE_FOR_IMCU:
|
case CTX_PREPARE_FOR_IMCU:
|
||||||
/* Prepare to process first M-1 row groups of this iMCU row */
|
/* Prepare to process first M-1 row groups of this iMCU row */
|
||||||
main->rowgroup_ctr = 0;
|
mainp->rowgroup_ctr = 0;
|
||||||
main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_v_scaled_size - 1);
|
mainp->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_v_scaled_size - 1);
|
||||||
/* Check for bottom of image: if so, tweak pointers to "duplicate"
|
/* Check for bottom of image: if so, tweak pointers to "duplicate"
|
||||||
* the last sample row, and adjust rowgroups_avail to ignore padding rows.
|
* the last sample row, and adjust rowgroups_avail to ignore padding rows.
|
||||||
*/
|
*/
|
||||||
if (main->iMCU_row_ctr == cinfo->total_iMCU_rows)
|
if (mainp->iMCU_row_ctr == cinfo->total_iMCU_rows)
|
||||||
set_bottom_pointers(cinfo);
|
set_bottom_pointers(cinfo);
|
||||||
main->context_state = CTX_PROCESS_IMCU;
|
mainp->context_state = CTX_PROCESS_IMCU;
|
||||||
/*FALLTHROUGH*/
|
/*FALLTHROUGH*/
|
||||||
case CTX_PROCESS_IMCU:
|
case CTX_PROCESS_IMCU:
|
||||||
/* Call postprocessor using previously set pointers */
|
/* Call postprocessor using previously set pointers */
|
||||||
(*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr],
|
(*cinfo->post->post_process_data) (cinfo, mainp->xbuffer[mainp->whichptr],
|
||||||
&main->rowgroup_ctr, main->rowgroups_avail,
|
&mainp->rowgroup_ctr, mainp->rowgroups_avail,
|
||||||
output_buf, out_row_ctr, out_rows_avail);
|
output_buf, out_row_ctr, out_rows_avail);
|
||||||
if (main->rowgroup_ctr < main->rowgroups_avail)
|
if (mainp->rowgroup_ctr < mainp->rowgroups_avail)
|
||||||
return; /* Need to suspend */
|
return; /* Need to suspend */
|
||||||
/* After the first iMCU, change wraparound pointers to normal state */
|
/* After the first iMCU, change wraparound pointers to normal state */
|
||||||
if (main->iMCU_row_ctr == 1)
|
if (mainp->iMCU_row_ctr == 1)
|
||||||
set_wraparound_pointers(cinfo);
|
set_wraparound_pointers(cinfo);
|
||||||
/* Prepare to load new iMCU row using other xbuffer list */
|
/* Prepare to load new iMCU row using other xbuffer list */
|
||||||
main->whichptr ^= 1; /* 0=>1 or 1=>0 */
|
mainp->whichptr ^= 1; /* 0=>1 or 1=>0 */
|
||||||
main->buffer_full = FALSE;
|
mainp->buffer_full = FALSE;
|
||||||
/* Still need to process last row group of this iMCU row, */
|
/* Still need to process last row group of this iMCU row, */
|
||||||
/* which is saved at index M+1 of the other xbuffer */
|
/* which is saved at index M+1 of the other xbuffer */
|
||||||
main->rowgroup_ctr = (JDIMENSION) (cinfo->min_DCT_v_scaled_size + 1);
|
mainp->rowgroup_ctr = (JDIMENSION) (cinfo->min_DCT_v_scaled_size + 1);
|
||||||
main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_v_scaled_size + 2);
|
mainp->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_v_scaled_size + 2);
|
||||||
main->context_state = CTX_POSTPONED_ROW;
|
mainp->context_state = CTX_POSTPONED_ROW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -475,15 +475,15 @@ process_data_crank_post (j_decompress_ptr cinfo,
|
|||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
|
jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
|
||||||
{
|
{
|
||||||
my_main_ptr main;
|
my_main_ptr mainp;
|
||||||
int ci, rgroup, ngroups;
|
int ci, rgroup, ngroups;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
|
|
||||||
main = (my_main_ptr)
|
mainp = (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_d_main_controller *) main;
|
cinfo->main = (struct jpeg_d_main_controller *) mainp;
|
||||||
main->pub.start_pass = start_pass_main;
|
mainp->pub.start_pass = start_pass_main;
|
||||||
|
|
||||||
if (need_full_buffer) /* shouldn't happen */
|
if (need_full_buffer) /* shouldn't happen */
|
||||||
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
||||||
@ -504,7 +504,7 @@ jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
|
|||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) /
|
rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) /
|
||||||
cinfo->min_DCT_v_scaled_size; /* height of a row group of component */
|
cinfo->min_DCT_v_scaled_size; /* height of a row group of component */
|
||||||
main->buffer[ci] = (*cinfo->mem->alloc_sarray)
|
mainp->buffer[ci] = (*cinfo->mem->alloc_sarray)
|
||||||
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
compptr->width_in_blocks * compptr->DCT_h_scaled_size,
|
compptr->width_in_blocks * compptr->DCT_h_scaled_size,
|
||||||
(JDIMENSION) (rgroup * ngroups));
|
(JDIMENSION) (rgroup * ngroups));
|
||||||
|
Loading…
Reference in New Issue
Block a user