mirror of
https://github.com/holub/mame
synced 2025-10-04 16:34:53 +03:00
Fixes for libjpeg compile (nw)
This commit is contained in:
parent
b0640c888b
commit
0404bdd34c
8
3rdparty/libjpeg/jchuff.c
vendored
8
3rdparty/libjpeg/jchuff.c
vendored
@ -302,7 +302,7 @@ dump_buffer_e (huff_entropy_ptr entropy)
|
||||
* between calls, so 24 bits are sufficient.
|
||||
*/
|
||||
|
||||
INLINE
|
||||
/*INLINE*/
|
||||
LOCAL(boolean)
|
||||
emit_bits_s (working_state * state, unsigned int code, int size)
|
||||
/* Emit some bits; return TRUE if successful, FALSE if must suspend */
|
||||
@ -341,7 +341,7 @@ emit_bits_s (working_state * state, unsigned int code, int size)
|
||||
}
|
||||
|
||||
|
||||
INLINE
|
||||
/*INLINE*/
|
||||
LOCAL(void)
|
||||
emit_bits_e (huff_entropy_ptr entropy, unsigned int code, int size)
|
||||
/* Emit some bits, unless we are in gather mode */
|
||||
@ -406,7 +406,7 @@ flush_bits_e (huff_entropy_ptr entropy)
|
||||
* Emit (or just count) a Huffman symbol.
|
||||
*/
|
||||
|
||||
INLINE
|
||||
/*INLINE*/
|
||||
LOCAL(void)
|
||||
emit_dc_symbol (huff_entropy_ptr entropy, int tbl_no, int symbol)
|
||||
{
|
||||
@ -419,7 +419,7 @@ emit_dc_symbol (huff_entropy_ptr entropy, int tbl_no, int symbol)
|
||||
}
|
||||
|
||||
|
||||
INLINE
|
||||
/*INLINE*/
|
||||
LOCAL(void)
|
||||
emit_ac_symbol (huff_entropy_ptr entropy, int tbl_no, int symbol)
|
||||
{
|
||||
|
56
3rdparty/libjpeg/jcmainct.c
vendored
56
3rdparty/libjpeg/jcmainct.c
vendored
@ -68,32 +68,32 @@ METHODDEF(void) process_data_buffer_main
|
||||
METHODDEF(void)
|
||||
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. */
|
||||
if (cinfo->raw_data_in)
|
||||
return;
|
||||
|
||||
main->cur_iMCU_row = 0; /* initialize counters */
|
||||
main->rowgroup_ctr = 0;
|
||||
main->suspended = FALSE;
|
||||
main->pass_mode = pass_mode; /* save mode for use by process_data */
|
||||
mymain->cur_iMCU_row = 0; /* initialize counters */
|
||||
mymain->rowgroup_ctr = 0;
|
||||
mymain->suspended = FALSE;
|
||||
mymain->pass_mode = pass_mode; /* save mode for use by process_data */
|
||||
|
||||
switch (pass_mode) {
|
||||
case JBUF_PASS_THRU:
|
||||
#ifdef FULL_MAIN_BUFFER_SUPPORTED
|
||||
if (main->whole_image[0] != NULL)
|
||||
if (mymain->whole_image[0] != NULL)
|
||||
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
||||
#endif
|
||||
main->pub.process_data = process_data_simple_main;
|
||||
mymain->pub.process_data = process_data_simple_main;
|
||||
break;
|
||||
#ifdef FULL_MAIN_BUFFER_SUPPORTED
|
||||
case JBUF_SAVE_SOURCE:
|
||||
case JBUF_CRANK_DEST:
|
||||
case JBUF_SAVE_AND_PASS:
|
||||
if (main->whole_image[0] == NULL)
|
||||
if (mymain->whole_image[0] == NULL)
|
||||
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
||||
main->pub.process_data = process_data_buffer_main;
|
||||
mymain->pub.process_data = process_data_buffer_main;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@ -114,46 +114,46 @@ process_data_simple_main (j_compress_ptr cinfo,
|
||||
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
|
||||
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 */
|
||||
if (main->rowgroup_ctr < (JDIMENSION) cinfo->min_DCT_v_scaled_size)
|
||||
if (mymain->rowgroup_ctr < (JDIMENSION) cinfo->min_DCT_v_scaled_size)
|
||||
(*cinfo->prep->pre_process_data) (cinfo,
|
||||
input_buf, in_row_ctr, in_rows_avail,
|
||||
main->buffer, &main->rowgroup_ctr,
|
||||
mymain->buffer, &mymain->rowgroup_ctr,
|
||||
(JDIMENSION) cinfo->min_DCT_v_scaled_size);
|
||||
|
||||
/* 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 (main->rowgroup_ctr != (JDIMENSION) cinfo->min_DCT_v_scaled_size)
|
||||
if (mymain->rowgroup_ctr != (JDIMENSION) cinfo->min_DCT_v_scaled_size)
|
||||
return;
|
||||
|
||||
/* 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
|
||||
* suspend processing and return to the application. In this situation
|
||||
* 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
|
||||
* think we were done.
|
||||
*/
|
||||
if (! main->suspended) {
|
||||
if (! mymain->suspended) {
|
||||
(*in_row_ctr)--;
|
||||
main->suspended = TRUE;
|
||||
mymain->suspended = TRUE;
|
||||
}
|
||||
return;
|
||||
}
|
||||
/* We did finish the row. Undo our little suspension hack if a previous
|
||||
* call suspended; then mark the main buffer empty.
|
||||
*/
|
||||
if (main->suspended) {
|
||||
if (mymain->suspended) {
|
||||
(*in_row_ctr)++;
|
||||
main->suspended = FALSE;
|
||||
mymain->suspended = FALSE;
|
||||
}
|
||||
main->rowgroup_ctr = 0;
|
||||
main->cur_iMCU_row++;
|
||||
mymain->rowgroup_ctr = 0;
|
||||
mymain->cur_iMCU_row++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -244,15 +244,15 @@ process_data_buffer_main (j_compress_ptr cinfo,
|
||||
GLOBAL(void)
|
||||
jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
||||
{
|
||||
my_main_ptr main;
|
||||
my_main_ptr mymain;
|
||||
int ci;
|
||||
jpeg_component_info *compptr;
|
||||
|
||||
main = (my_main_ptr)
|
||||
mymain = (my_main_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(my_main_controller));
|
||||
cinfo->main = (struct jpeg_c_main_controller *) main;
|
||||
main->pub.start_pass = start_pass_main;
|
||||
cinfo->main = (struct jpeg_c_main_controller *) mymain;
|
||||
mymain->pub.start_pass = start_pass_main;
|
||||
|
||||
/* We don't need to create a buffer in raw-data mode. */
|
||||
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 */
|
||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||
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,
|
||||
compptr->width_in_blocks * compptr->DCT_h_scaled_size,
|
||||
(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
|
||||
} else {
|
||||
#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
|
||||
/* Allocate a strip buffer for each component */
|
||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||
ci++, compptr++) {
|
||||
main->buffer[ci] = (*cinfo->mem->alloc_sarray)
|
||||
mymain->buffer[ci] = (*cinfo->mem->alloc_sarray)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
compptr->width_in_blocks * compptr->DCT_h_scaled_size,
|
||||
(JDIMENSION) (compptr->v_samp_factor * compptr->DCT_v_scaled_size));
|
||||
|
45
3rdparty/libjpeg/jconfig.h
vendored
Normal file
45
3rdparty/libjpeg/jconfig.h
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
/* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */
|
||||
/* see jconfig.txt for explanations */
|
||||
|
||||
#define HAVE_PROTOTYPES
|
||||
#define HAVE_UNSIGNED_CHAR
|
||||
#define HAVE_UNSIGNED_SHORT
|
||||
/* #define void char */
|
||||
/* #define const */
|
||||
#undef CHAR_IS_UNSIGNED
|
||||
#define HAVE_STDDEF_H
|
||||
#define HAVE_STDLIB_H
|
||||
#undef NEED_BSD_STRINGS
|
||||
#undef NEED_SYS_TYPES_H
|
||||
#undef NEED_FAR_POINTERS /* we presume a 32-bit flat memory model */
|
||||
#undef NEED_SHORT_EXTERNAL_NAMES
|
||||
#undef INCOMPLETE_TYPES_BROKEN
|
||||
|
||||
/* Define "boolean" as unsigned char, not int, per Windows custom */
|
||||
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
|
||||
typedef unsigned char boolean;
|
||||
#endif
|
||||
#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
|
||||
|
||||
|
||||
#ifdef JPEG_INTERNALS
|
||||
|
||||
#undef RIGHT_SHIFT_IS_UNSIGNED
|
||||
|
||||
#endif /* JPEG_INTERNALS */
|
||||
|
||||
#ifdef JPEG_CJPEG_DJPEG
|
||||
|
||||
#define BMP_SUPPORTED /* BMP image file format */
|
||||
#define GIF_SUPPORTED /* GIF image file format */
|
||||
#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
|
||||
#undef RLE_SUPPORTED /* Utah RLE image file format */
|
||||
#define TARGA_SUPPORTED /* Targa image file format */
|
||||
|
||||
#define TWO_FILE_COMMANDLINE /* optional */
|
||||
#define USE_SETMODE /* Microsoft has setmode() */
|
||||
#undef NEED_SIGNAL_CATCHER
|
||||
#undef DONT_USE_B_MODE
|
||||
#undef PROGRESS_REPORT /* optional */
|
||||
|
||||
#endif /* JPEG_CJPEG_DJPEG */
|
4
3rdparty/libjpeg/jdatadst.c
vendored
4
3rdparty/libjpeg/jdatadst.c
vendored
@ -128,7 +128,7 @@ empty_mem_output_buffer (j_compress_ptr cinfo)
|
||||
|
||||
/* Try to allocate new buffer with double size */
|
||||
nextsize = dest->bufsize * 2;
|
||||
nextbuffer = malloc(nextsize);
|
||||
nextbuffer = (JOCTET*)malloc(nextsize);
|
||||
|
||||
if (nextbuffer == NULL)
|
||||
ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
|
||||
@ -256,7 +256,7 @@ jpeg_mem_dest (j_compress_ptr cinfo,
|
||||
|
||||
if (*outbuffer == NULL || *outsize == 0) {
|
||||
/* Allocate initial buffer */
|
||||
dest->newbuffer = *outbuffer = malloc(OUTPUT_BUF_SIZE);
|
||||
dest->newbuffer = *outbuffer = (unsigned char*)malloc(OUTPUT_BUF_SIZE);
|
||||
if (dest->newbuffer == NULL)
|
||||
ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
|
||||
*outsize = OUTPUT_BUF_SIZE;
|
||||
|
122
3rdparty/libjpeg/jdmainct.c
vendored
122
3rdparty/libjpeg/jdmainct.c
vendored
@ -159,7 +159,7 @@ alloc_funny_pointers (j_decompress_ptr cinfo)
|
||||
* This is done only once, not once per pass.
|
||||
*/
|
||||
{
|
||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
||||
my_main_ptr mymain = (my_main_ptr) cinfo->main;
|
||||
int ci, rgroup;
|
||||
int M = cinfo->min_DCT_v_scaled_size;
|
||||
jpeg_component_info *compptr;
|
||||
@ -168,10 +168,10 @@ alloc_funny_pointers (j_decompress_ptr cinfo)
|
||||
/* Get top-level space for component array pointers.
|
||||
* We alloc both arrays with one call to save a few cycles.
|
||||
*/
|
||||
main->xbuffer[0] = (JSAMPIMAGE)
|
||||
mymain->xbuffer[0] = (JSAMPIMAGE)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
cinfo->num_components * 2 * SIZEOF(JSAMPARRAY));
|
||||
main->xbuffer[1] = main->xbuffer[0] + cinfo->num_components;
|
||||
mymain->xbuffer[1] = mymain->xbuffer[0] + cinfo->num_components;
|
||||
|
||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||
ci++, compptr++) {
|
||||
@ -184,9 +184,9 @@ alloc_funny_pointers (j_decompress_ptr cinfo)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
2 * (rgroup * (M + 4)) * SIZEOF(JSAMPROW));
|
||||
xbuf += rgroup; /* want one row group at negative offsets */
|
||||
main->xbuffer[0][ci] = xbuf;
|
||||
mymain->xbuffer[0][ci] = xbuf;
|
||||
xbuf += rgroup * (M + 4);
|
||||
main->xbuffer[1][ci] = xbuf;
|
||||
mymain->xbuffer[1][ci] = xbuf;
|
||||
}
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ make_funny_pointers (j_decompress_ptr cinfo)
|
||||
* This will be repeated at the beginning of each pass.
|
||||
*/
|
||||
{
|
||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
||||
my_main_ptr mymain = (my_main_ptr) cinfo->main;
|
||||
int ci, i, rgroup;
|
||||
int M = cinfo->min_DCT_v_scaled_size;
|
||||
jpeg_component_info *compptr;
|
||||
@ -210,10 +210,10 @@ make_funny_pointers (j_decompress_ptr cinfo)
|
||||
ci++, compptr++) {
|
||||
rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) /
|
||||
cinfo->min_DCT_v_scaled_size; /* height of a row group of component */
|
||||
xbuf0 = main->xbuffer[0][ci];
|
||||
xbuf1 = main->xbuffer[1][ci];
|
||||
xbuf0 = mymain->xbuffer[0][ci];
|
||||
xbuf1 = mymain->xbuffer[1][ci];
|
||||
/* First copy the workspace pointers as-is */
|
||||
buf = main->buffer[ci];
|
||||
buf = mymain->buffer[ci];
|
||||
for (i = 0; i < rgroup * (M + 2); 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.
|
||||
*/
|
||||
{
|
||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
||||
my_main_ptr mymain = (my_main_ptr) cinfo->main;
|
||||
int ci, i, rgroup;
|
||||
int M = cinfo->min_DCT_v_scaled_size;
|
||||
jpeg_component_info *compptr;
|
||||
@ -250,8 +250,8 @@ set_wraparound_pointers (j_decompress_ptr cinfo)
|
||||
ci++, compptr++) {
|
||||
rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) /
|
||||
cinfo->min_DCT_v_scaled_size; /* height of a row group of component */
|
||||
xbuf0 = main->xbuffer[0][ci];
|
||||
xbuf1 = main->xbuffer[1][ci];
|
||||
xbuf0 = mymain->xbuffer[0][ci];
|
||||
xbuf1 = mymain->xbuffer[1][ci];
|
||||
for (i = 0; i < rgroup; i++) {
|
||||
xbuf0[i - rgroup] = xbuf0[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.
|
||||
*/
|
||||
{
|
||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
||||
my_main_ptr mymain = (my_main_ptr) cinfo->main;
|
||||
int ci, i, rgroup, iMCUheight, rows_left;
|
||||
jpeg_component_info *compptr;
|
||||
JSAMPARRAY xbuf;
|
||||
@ -286,12 +286,12 @@ set_bottom_pointers (j_decompress_ptr cinfo)
|
||||
* so we need only do it once.
|
||||
*/
|
||||
if (ci == 0) {
|
||||
main->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1);
|
||||
mymain->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1);
|
||||
}
|
||||
/* 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.
|
||||
*/
|
||||
xbuf = main->xbuffer[main->whichptr][ci];
|
||||
xbuf = mymain->xbuffer[mymain->whichptr][ci];
|
||||
for (i = 0; i < rgroup * 2; i++) {
|
||||
xbuf[rows_left + i] = xbuf[rows_left-1];
|
||||
}
|
||||
@ -306,27 +306,27 @@ set_bottom_pointers (j_decompress_ptr cinfo)
|
||||
METHODDEF(void)
|
||||
start_pass_main (j_decompress_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;
|
||||
|
||||
switch (pass_mode) {
|
||||
case JBUF_PASS_THRU:
|
||||
if (cinfo->upsample->need_context_rows) {
|
||||
main->pub.process_data = process_data_context_main;
|
||||
mymain->pub.process_data = process_data_context_main;
|
||||
make_funny_pointers(cinfo); /* Create the xbuffer[] lists */
|
||||
main->whichptr = 0; /* Read first iMCU row into xbuffer[0] */
|
||||
main->context_state = CTX_PREPARE_FOR_IMCU;
|
||||
main->iMCU_row_ctr = 0;
|
||||
mymain->whichptr = 0; /* Read first iMCU row into xbuffer[0] */
|
||||
mymain->context_state = CTX_PREPARE_FOR_IMCU;
|
||||
mymain->iMCU_row_ctr = 0;
|
||||
} else {
|
||||
/* Simple case with no context needed */
|
||||
main->pub.process_data = process_data_simple_main;
|
||||
mymain->pub.process_data = process_data_simple_main;
|
||||
}
|
||||
main->buffer_full = FALSE; /* Mark buffer empty */
|
||||
main->rowgroup_ctr = 0;
|
||||
mymain->buffer_full = FALSE; /* Mark buffer empty */
|
||||
mymain->rowgroup_ctr = 0;
|
||||
break;
|
||||
#ifdef QUANT_2PASS_SUPPORTED
|
||||
case JBUF_CRANK_DEST:
|
||||
/* For last pass of 2-pass quantization, just crank the postprocessor */
|
||||
main->pub.process_data = process_data_crank_post;
|
||||
mymain->pub.process_data = process_data_crank_post;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@ -346,14 +346,14 @@ process_data_simple_main (j_decompress_ptr cinfo,
|
||||
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
|
||||
JDIMENSION out_rows_avail)
|
||||
{
|
||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
||||
my_main_ptr mymain = (my_main_ptr) cinfo->main;
|
||||
JDIMENSION rowgroups_avail;
|
||||
|
||||
/* Read input data if we haven't filled the main buffer yet */
|
||||
if (! main->buffer_full) {
|
||||
if (! (*cinfo->coef->decompress_data) (cinfo, main->buffer))
|
||||
if (! mymain->buffer_full) {
|
||||
if (! (*cinfo->coef->decompress_data) (cinfo, mymain->buffer))
|
||||
return; /* suspension forced, can do nothing more */
|
||||
main->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
|
||||
mymain->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. */
|
||||
@ -364,14 +364,14 @@ process_data_simple_main (j_decompress_ptr cinfo,
|
||||
*/
|
||||
|
||||
/* Feed the postprocessor */
|
||||
(*cinfo->post->post_process_data) (cinfo, main->buffer,
|
||||
&main->rowgroup_ctr, rowgroups_avail,
|
||||
(*cinfo->post->post_process_data) (cinfo, mymain->buffer,
|
||||
&mymain->rowgroup_ctr, rowgroups_avail,
|
||||
output_buf, out_row_ctr, out_rows_avail);
|
||||
|
||||
/* Has postprocessor consumed all the data yet? If so, mark buffer empty */
|
||||
if (main->rowgroup_ctr >= rowgroups_avail) {
|
||||
main->buffer_full = FALSE;
|
||||
main->rowgroup_ctr = 0;
|
||||
if (mymain->rowgroup_ctr >= rowgroups_avail) {
|
||||
mymain->buffer_full = FALSE;
|
||||
mymain->rowgroup_ctr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -386,15 +386,15 @@ process_data_context_main (j_decompress_ptr cinfo,
|
||||
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
|
||||
JDIMENSION out_rows_avail)
|
||||
{
|
||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
||||
my_main_ptr mymain = (my_main_ptr) cinfo->main;
|
||||
|
||||
/* Read input data if we haven't filled the main buffer yet */
|
||||
if (! main->buffer_full) {
|
||||
if (! mymain->buffer_full) {
|
||||
if (! (*cinfo->coef->decompress_data) (cinfo,
|
||||
main->xbuffer[main->whichptr]))
|
||||
mymain->xbuffer[mymain->whichptr]))
|
||||
return; /* suspension forced, can do nothing more */
|
||||
main->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
|
||||
main->iMCU_row_ctr++; /* count rows received */
|
||||
mymain->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
|
||||
mymain->iMCU_row_ctr++; /* count rows received */
|
||||
}
|
||||
|
||||
/* 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.
|
||||
* Note that each case falls through to the next on successful completion.
|
||||
*/
|
||||
switch (main->context_state) {
|
||||
switch (mymain->context_state) {
|
||||
case CTX_POSTPONED_ROW:
|
||||
/* Call postprocessor using previously set pointers for postponed row */
|
||||
(*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr],
|
||||
&main->rowgroup_ctr, main->rowgroups_avail,
|
||||
(*cinfo->post->post_process_data) (cinfo, mymain->xbuffer[mymain->whichptr],
|
||||
&mymain->rowgroup_ctr, mymain->rowgroups_avail,
|
||||
output_buf, out_row_ctr, out_rows_avail);
|
||||
if (main->rowgroup_ctr < main->rowgroups_avail)
|
||||
if (mymain->rowgroup_ctr < mymain->rowgroups_avail)
|
||||
return; /* Need to suspend */
|
||||
main->context_state = CTX_PREPARE_FOR_IMCU;
|
||||
mymain->context_state = CTX_PREPARE_FOR_IMCU;
|
||||
if (*out_row_ctr >= out_rows_avail)
|
||||
return; /* Postprocessor exactly filled output buf */
|
||||
/*FALLTHROUGH*/
|
||||
case CTX_PREPARE_FOR_IMCU:
|
||||
/* Prepare to process first M-1 row groups of this iMCU row */
|
||||
main->rowgroup_ctr = 0;
|
||||
main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_v_scaled_size - 1);
|
||||
mymain->rowgroup_ctr = 0;
|
||||
mymain->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_v_scaled_size - 1);
|
||||
/* Check for bottom of image: if so, tweak pointers to "duplicate"
|
||||
* the last sample row, and adjust rowgroups_avail to ignore padding rows.
|
||||
*/
|
||||
if (main->iMCU_row_ctr == cinfo->total_iMCU_rows)
|
||||
if (mymain->iMCU_row_ctr == cinfo->total_iMCU_rows)
|
||||
set_bottom_pointers(cinfo);
|
||||
main->context_state = CTX_PROCESS_IMCU;
|
||||
mymain->context_state = CTX_PROCESS_IMCU;
|
||||
/*FALLTHROUGH*/
|
||||
case CTX_PROCESS_IMCU:
|
||||
/* Call postprocessor using previously set pointers */
|
||||
(*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr],
|
||||
&main->rowgroup_ctr, main->rowgroups_avail,
|
||||
(*cinfo->post->post_process_data) (cinfo, mymain->xbuffer[mymain->whichptr],
|
||||
&mymain->rowgroup_ctr, mymain->rowgroups_avail,
|
||||
output_buf, out_row_ctr, out_rows_avail);
|
||||
if (main->rowgroup_ctr < main->rowgroups_avail)
|
||||
if (mymain->rowgroup_ctr < mymain->rowgroups_avail)
|
||||
return; /* Need to suspend */
|
||||
/* After the first iMCU, change wraparound pointers to normal state */
|
||||
if (main->iMCU_row_ctr == 1)
|
||||
if (mymain->iMCU_row_ctr == 1)
|
||||
set_wraparound_pointers(cinfo);
|
||||
/* Prepare to load new iMCU row using other xbuffer list */
|
||||
main->whichptr ^= 1; /* 0=>1 or 1=>0 */
|
||||
main->buffer_full = FALSE;
|
||||
mymain->whichptr ^= 1; /* 0=>1 or 1=>0 */
|
||||
mymain->buffer_full = FALSE;
|
||||
/* Still need to process last row group of this iMCU row, */
|
||||
/* which is saved at index M+1 of the other xbuffer */
|
||||
main->rowgroup_ctr = (JDIMENSION) (cinfo->min_DCT_v_scaled_size + 1);
|
||||
main->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_v_scaled_size + 2);
|
||||
main->context_state = CTX_POSTPONED_ROW;
|
||||
mymain->rowgroup_ctr = (JDIMENSION) (cinfo->min_DCT_v_scaled_size + 1);
|
||||
mymain->rowgroups_avail = (JDIMENSION) (cinfo->min_DCT_v_scaled_size + 2);
|
||||
mymain->context_state = CTX_POSTPONED_ROW;
|
||||
}
|
||||
}
|
||||
|
||||
@ -475,15 +475,15 @@ process_data_crank_post (j_decompress_ptr cinfo,
|
||||
GLOBAL(void)
|
||||
jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
|
||||
{
|
||||
my_main_ptr main;
|
||||
my_main_ptr mymain;
|
||||
int ci, rgroup, ngroups;
|
||||
jpeg_component_info *compptr;
|
||||
|
||||
main = (my_main_ptr)
|
||||
mymain = (my_main_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(my_main_controller));
|
||||
cinfo->main = (struct jpeg_d_main_controller *) main;
|
||||
main->pub.start_pass = start_pass_main;
|
||||
cinfo->main = (struct jpeg_d_main_controller *) mymain;
|
||||
mymain->pub.start_pass = start_pass_main;
|
||||
|
||||
if (need_full_buffer) /* shouldn't happen */
|
||||
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
||||
@ -504,7 +504,7 @@ jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
|
||||
ci++, compptr++) {
|
||||
rgroup = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) /
|
||||
cinfo->min_DCT_v_scaled_size; /* height of a row group of component */
|
||||
main->buffer[ci] = (*cinfo->mem->alloc_sarray)
|
||||
mymain->buffer[ci] = (*cinfo->mem->alloc_sarray)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
compptr->width_in_blocks * compptr->DCT_h_scaled_size,
|
||||
(JDIMENSION) (rgroup * ngroups));
|
||||
|
2
3rdparty/libjpeg/jmorecfg.h
vendored
2
3rdparty/libjpeg/jmorecfg.h
vendored
@ -162,7 +162,7 @@ typedef short INT16;
|
||||
#ifndef _BASETSD_H_ /* Microsoft defines it in basetsd.h */
|
||||
#ifndef _BASETSD_H /* MinGW is slightly different */
|
||||
#ifndef QGLOBAL_H /* Qt defines it in qglobal.h */
|
||||
typedef long INT32;
|
||||
typedef int INT32;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
8
3rdparty/libjpeg/jpeglib.h
vendored
8
3rdparty/libjpeg/jpeglib.h
vendored
@ -11,6 +11,13 @@
|
||||
* and perhaps jerror.h if they want to know the exact error codes.
|
||||
*/
|
||||
|
||||
#ifdef USE_SYSTEM_JPEGLIB
|
||||
#ifndef XMD_H
|
||||
#define XMD_H
|
||||
#endif
|
||||
#include <jpeglib.h>
|
||||
#else
|
||||
|
||||
#ifndef JPEGLIB_H
|
||||
#define JPEGLIB_H
|
||||
|
||||
@ -1158,3 +1165,4 @@ struct jpeg_color_quantizer { long dummy; };
|
||||
#endif
|
||||
|
||||
#endif /* JPEGLIB_H */
|
||||
#endif /* USE_SYSTEM_JPEGLIB */
|
||||
|
Loading…
Reference in New Issue
Block a user