diff --git a/jdapistd.c b/jdapistd.c index d8ea7add4..2343da5c3 100644 --- a/jdapistd.c +++ b/jdapistd.c @@ -204,7 +204,7 @@ jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data, } /* Verify that at least one iMCU row can be returned. */ - lines_per_iMCU_row = cinfo->max_v_samp_factor * _min_DCT_scaled_size; + lines_per_iMCU_row = cinfo->max_v_samp_factor * cinfo->_min_DCT_scaled_size; if (max_lines < lines_per_iMCU_row) ERREXIT(cinfo, JERR_BUFFER_SIZE); diff --git a/jdcoefct.c b/jdcoefct.c index 80fc89d13..48a9fc6f8 100644 --- a/jdcoefct.c +++ b/jdcoefct.c @@ -192,7 +192,7 @@ decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) useful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width : compptr->last_col_width; output_ptr = output_buf[compptr->component_index] + - yoffset * _DCT_scaled_size; + yoffset * compptr->_DCT_scaled_size; start_col = MCU_col_num * compptr->MCU_sample_width; for (yindex = 0; yindex < compptr->MCU_height; yindex++) { if (cinfo->input_iMCU_row < last_iMCU_row || @@ -202,11 +202,11 @@ decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) coef->MCU_buffer[blkn+xindex], output_ptr, output_col); - output_col += _DCT_scaled_size; + output_col += compptr->_DCT_scaled_size; } } blkn += compptr->MCU_width; - output_ptr += _DCT_scaled_size; + output_ptr += compptr->_DCT_scaled_size; } } } @@ -367,9 +367,9 @@ decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) buffer_ptr, output_ptr, output_col); buffer_ptr++; - output_col += _DCT_scaled_size; + output_col += compptr->_DCT_scaled_size; } - output_ptr += _DCT_scaled_size; + output_ptr += compptr->_DCT_scaled_size; } } @@ -662,9 +662,9 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) DC4 = DC5; DC5 = DC6; DC7 = DC8; DC8 = DC9; buffer_ptr++, prev_block_row++, next_block_row++; - output_col += _DCT_scaled_size; + output_col += compptr->_DCT_scaled_size; } - output_ptr += _DCT_scaled_size; + output_ptr += compptr->_DCT_scaled_size; } } diff --git a/jddctmgr.c b/jddctmgr.c index 70f4f01df..044e46947 100644 --- a/jddctmgr.c +++ b/jddctmgr.c @@ -102,7 +102,7 @@ start_pass (j_decompress_ptr cinfo) for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { /* Select the proper IDCT routine for this component's scaling */ - switch (_DCT_scaled_size) { + switch (compptr->_DCT_scaled_size) { #ifdef IDCT_SCALING_SUPPORTED case 1: method_ptr = jpeg_idct_1x1; @@ -158,7 +158,7 @@ start_pass (j_decompress_ptr cinfo) } break; default: - ERREXIT1(cinfo, JERR_BAD_DCTSIZE, _DCT_scaled_size); + ERREXIT1(cinfo, JERR_BAD_DCTSIZE, compptr->_DCT_scaled_size); break; } idct->pub.inverse_DCT[ci] = method_ptr; diff --git a/jdhuff.c b/jdhuff.c index 3aa8dad74..ab8e25444 100644 --- a/jdhuff.c +++ b/jdhuff.c @@ -139,7 +139,7 @@ start_pass_huff_decoder (j_decompress_ptr cinfo) if (compptr->component_needed) { entropy->dc_needed[blkn] = TRUE; /* we don't need the ACs if producing a 1/8th-size image */ - entropy->ac_needed[blkn] = (_DCT_scaled_size > 1); + entropy->ac_needed[blkn] = (compptr->_DCT_scaled_size > 1); } else { entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE; } diff --git a/jdinput.c b/jdinput.c index c75fd5c11..9fcd089d3 100644 --- a/jdinput.c +++ b/jdinput.c @@ -228,7 +228,7 @@ per_scan_setup (j_decompress_ptr cinfo) compptr->MCU_width = 1; compptr->MCU_height = 1; compptr->MCU_blocks = 1; - compptr->MCU_sample_width = _DCT_scaled_size; + compptr->MCU_sample_width = compptr->_DCT_scaled_size; compptr->last_col_width = 1; /* For noninterleaved scans, it is convenient to define last_row_height * as the number of block rows present in the last iMCU row. @@ -264,7 +264,7 @@ per_scan_setup (j_decompress_ptr cinfo) compptr->MCU_width = compptr->h_samp_factor; compptr->MCU_height = compptr->v_samp_factor; compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height; - compptr->MCU_sample_width = compptr->MCU_width * _DCT_scaled_size; + compptr->MCU_sample_width = compptr->MCU_width * compptr->_DCT_scaled_size; /* Figure number of non-dummy blocks in last MCU column & row */ tmp = (int) (compptr->width_in_blocks % compptr->MCU_width); if (tmp == 0) tmp = compptr->MCU_width; diff --git a/jdmainct.c b/jdmainct.c index 8d298e1b5..67f62153e 100644 --- a/jdmainct.c +++ b/jdmainct.c @@ -163,7 +163,7 @@ alloc_funny_pointers (j_decompress_ptr cinfo) { my_main_ptr main = (my_main_ptr) cinfo->main; int ci, rgroup; - int M = _min_DCT_scaled_size; + int M = cinfo->_min_DCT_scaled_size; jpeg_component_info *compptr; JSAMPARRAY xbuf; @@ -177,8 +177,8 @@ alloc_funny_pointers (j_decompress_ptr cinfo) for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { - rgroup = (compptr->v_samp_factor * _DCT_scaled_size) / - _min_DCT_scaled_size; /* height of a row group of component */ + rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) / + cinfo->_min_DCT_scaled_size; /* height of a row group of component */ /* Get space for pointer lists --- M+4 row groups in each list. * We alloc both pointer lists with one call to save a few cycles. */ @@ -204,14 +204,14 @@ make_funny_pointers (j_decompress_ptr cinfo) { my_main_ptr main = (my_main_ptr) cinfo->main; int ci, i, rgroup; - int M = _min_DCT_scaled_size; + int M = cinfo->_min_DCT_scaled_size; jpeg_component_info *compptr; JSAMPARRAY buf, xbuf0, xbuf1; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { - rgroup = (compptr->v_samp_factor * _DCT_scaled_size) / - _min_DCT_scaled_size; /* height of a row group of component */ + rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) / + cinfo->_min_DCT_scaled_size; /* height of a row group of component */ xbuf0 = main->xbuffer[0][ci]; xbuf1 = main->xbuffer[1][ci]; /* First copy the workspace pointers as-is */ @@ -244,14 +244,14 @@ set_wraparound_pointers (j_decompress_ptr cinfo) { my_main_ptr main = (my_main_ptr) cinfo->main; int ci, i, rgroup; - int M = _min_DCT_scaled_size; + int M = cinfo->_min_DCT_scaled_size; jpeg_component_info *compptr; JSAMPARRAY xbuf0, xbuf1; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { - rgroup = (compptr->v_samp_factor * _DCT_scaled_size) / - _min_DCT_scaled_size; /* height of a row group of component */ + rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) / + cinfo->_min_DCT_scaled_size; /* height of a row group of component */ xbuf0 = main->xbuffer[0][ci]; xbuf1 = main->xbuffer[1][ci]; for (i = 0; i < rgroup; i++) { @@ -279,8 +279,8 @@ set_bottom_pointers (j_decompress_ptr cinfo) for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { /* Count sample rows in one iMCU row and in one row group */ - iMCUheight = compptr->v_samp_factor * _DCT_scaled_size; - rgroup = iMCUheight / _min_DCT_scaled_size; + iMCUheight = compptr->v_samp_factor * compptr->_DCT_scaled_size; + rgroup = iMCUheight / cinfo->_min_DCT_scaled_size; /* Count nondummy sample rows remaining for this component */ rows_left = (int) (compptr->downsampled_height % (JDIMENSION) iMCUheight); if (rows_left == 0) rows_left = iMCUheight; @@ -359,7 +359,7 @@ process_data_simple_main (j_decompress_ptr cinfo, } /* There are always min_DCT_scaled_size row groups in an iMCU row. */ - rowgroups_avail = (JDIMENSION) _min_DCT_scaled_size; + rowgroups_avail = (JDIMENSION) cinfo->_min_DCT_scaled_size; /* Note: at the bottom of the image, we may pass extra garbage row groups * to the postprocessor. The postprocessor has to check for bottom * of image anyway (at row resolution), so no point in us doing it too. @@ -419,7 +419,7 @@ process_data_context_main (j_decompress_ptr cinfo, 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) (_min_DCT_scaled_size - 1); + main->rowgroups_avail = (JDIMENSION) (cinfo->_min_DCT_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. */ @@ -442,8 +442,8 @@ process_data_context_main (j_decompress_ptr cinfo, main->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) (_min_DCT_scaled_size + 1); - main->rowgroups_avail = (JDIMENSION) (_min_DCT_scaled_size + 2); + main->rowgroup_ctr = (JDIMENSION) (cinfo->_min_DCT_scaled_size + 1); + main->rowgroups_avail = (JDIMENSION) (cinfo->_min_DCT_scaled_size + 2); main->context_state = CTX_POSTPONED_ROW; } } @@ -494,21 +494,21 @@ jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer) * ngroups is the number of row groups we need. */ if (cinfo->upsample->need_context_rows) { - if (_min_DCT_scaled_size < 2) /* unsupported, see comments above */ + if (cinfo->_min_DCT_scaled_size < 2) /* unsupported, see comments above */ ERREXIT(cinfo, JERR_NOTIMPL); alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */ - ngroups = _min_DCT_scaled_size + 2; + ngroups = cinfo->_min_DCT_scaled_size + 2; } else { - ngroups = _min_DCT_scaled_size; + ngroups = cinfo->_min_DCT_scaled_size; } for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { - rgroup = (compptr->v_samp_factor * _DCT_scaled_size) / - _min_DCT_scaled_size; /* height of a row group of component */ + rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) / + cinfo->_min_DCT_scaled_size; /* height of a row group of component */ main->buffer[ci] = (*cinfo->mem->alloc_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, - compptr->width_in_blocks * _DCT_scaled_size, + compptr->width_in_blocks * compptr->_DCT_scaled_size, (JDIMENSION) (rgroup * ngroups)); } } diff --git a/jdmaster.c b/jdmaster.c index 3985c73cf..38b7dd0cb 100644 --- a/jdmaster.c +++ b/jdmaster.c @@ -69,17 +69,10 @@ use_merged_upsample (j_decompress_ptr cinfo) cinfo->comp_info[2].v_samp_factor != 1) return FALSE; /* furthermore, it doesn't work if we've scaled the IDCTs differently */ -#if JPEG_LIB_VERSION >= 70 - if (cinfo->comp_info[0].DCT_h_scaled_size != cinfo->min_DCT_h_scaled_size || - cinfo->comp_info[1].DCT_h_scaled_size != cinfo->min_DCT_h_scaled_size || - cinfo->comp_info[2].DCT_h_scaled_size != cinfo->min_DCT_h_scaled_size) - return FALSE; -#else - if (cinfo->comp_info[0].DCT_scaled_size != cinfo->min_DCT_scaled_size || - cinfo->comp_info[1].DCT_scaled_size != cinfo->min_DCT_scaled_size || - cinfo->comp_info[2].DCT_scaled_size != cinfo->min_DCT_scaled_size) + if (cinfo->comp_info[0]._DCT_scaled_size != cinfo->_min_DCT_scaled_size || + cinfo->comp_info[1]._DCT_scaled_size != cinfo->_min_DCT_scaled_size || + cinfo->comp_info[2]._DCT_scaled_size != cinfo->_min_DCT_scaled_size) return FALSE; -#endif /* ??? also need to test for upsample-time rescaling, when & if supported */ return TRUE; /* by golly, it'll work... */ #else @@ -161,12 +154,12 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo) */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { - int ssize = _min_DCT_scaled_size; + int ssize = cinfo->_min_DCT_scaled_size; while (ssize < DCTSIZE && (compptr->h_samp_factor * ssize * 2 <= - cinfo->max_h_samp_factor * _min_DCT_scaled_size) && + cinfo->max_h_samp_factor * cinfo->_min_DCT_scaled_size) && (compptr->v_samp_factor * ssize * 2 <= - cinfo->max_v_samp_factor * _min_DCT_scaled_size)) { + cinfo->max_v_samp_factor * cinfo->_min_DCT_scaled_size)) { ssize = ssize * 2; } #if JPEG_LIB_VERSION >= 70 @@ -184,11 +177,11 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo) /* Size in samples, after IDCT scaling */ compptr->downsampled_width = (JDIMENSION) jdiv_round_up((long) cinfo->image_width * - (long) (compptr->h_samp_factor * _DCT_scaled_size), + (long) (compptr->h_samp_factor * compptr->_DCT_scaled_size), (long) (cinfo->max_h_samp_factor * DCTSIZE)); compptr->downsampled_height = (JDIMENSION) jdiv_round_up((long) cinfo->image_height * - (long) (compptr->v_samp_factor * _DCT_scaled_size), + (long) (compptr->v_samp_factor * compptr->_DCT_scaled_size), (long) (cinfo->max_v_samp_factor * DCTSIZE)); } diff --git a/jdsample.c b/jdsample.c index 5f6ffbec4..1864dd6b8 100644 --- a/jdsample.c +++ b/jdsample.c @@ -422,7 +422,7 @@ jinit_upsampler (j_decompress_ptr cinfo) /* jdmainct.c doesn't support context rows when min_DCT_scaled_size = 1, * so don't ask for it. */ - do_fancy = cinfo->do_fancy_upsampling && _min_DCT_scaled_size > 1; + do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1; /* Verify we can handle the sampling factors, select per-component methods, * and create storage as needed. @@ -432,10 +432,10 @@ jinit_upsampler (j_decompress_ptr cinfo) /* Compute size of an "input group" after IDCT scaling. This many samples * are to be converted to max_h_samp_factor * max_v_samp_factor pixels. */ - h_in_group = (compptr->h_samp_factor * _DCT_scaled_size) / - _min_DCT_scaled_size; - v_in_group = (compptr->v_samp_factor * _DCT_scaled_size) / - _min_DCT_scaled_size; + h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) / + cinfo->_min_DCT_scaled_size; + v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) / + cinfo->_min_DCT_scaled_size; h_out_group = cinfo->max_h_samp_factor; v_out_group = cinfo->max_v_samp_factor; upsample->rowgroup_height[ci] = v_in_group; /* save for use later */ diff --git a/jpegcomp.h b/jpegcomp.h index 8891fb578..be5eb34a7 100644 --- a/jpegcomp.h +++ b/jpegcomp.h @@ -10,9 +10,9 @@ */ #if JPEG_LIB_VERSION >= 70 -#define _DCT_scaled_size compptr->DCT_h_scaled_size -#define _min_DCT_scaled_size cinfo->min_DCT_h_scaled_size +#define _DCT_scaled_size DCT_h_scaled_size +#define _min_DCT_scaled_size min_DCT_h_scaled_size #else -#define _DCT_scaled_size compptr->DCT_scaled_size -#define _min_DCT_scaled_size cinfo->min_DCT_scaled_size +#define _DCT_scaled_size DCT_scaled_size +#define _min_DCT_scaled_size min_DCT_scaled_size #endif