14 #define JPEG_INTERNALS
57 ERREXIT(cinfo, JERR_EMPTY_IMAGE);
62 ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (
unsigned int) JPEG_MAX_DIMENSION);
67 if ((
long) jd_samplesperrow != samplesperrow)
68 ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
82 for (ci = 0, compptr = cinfo->
comp_info; ci < cinfo->num_components;
86 ERREXIT(cinfo, JERR_BAD_SAMPLING);
94 for (ci = 0, compptr = cinfo->
comp_info; ci < cinfo->num_components;
127 #ifdef C_MULTISCAN_FILES_SUPPORTED
136 int scanno, ncomps, ci, coefi, thisi;
139 #ifdef C_PROGRESSIVE_SUPPORTED
140 int * last_bitpos_ptr;
146 ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, 0);
153 #ifdef C_PROGRESSIVE_SUPPORTED
155 last_bitpos_ptr = & last_bitpos[0][0];
157 for (coefi = 0; coefi <
DCTSIZE2; coefi++)
158 *last_bitpos_ptr++ = -1;
160 ERREXIT(cinfo, JERR_NOT_COMPILED);
165 component_sent[ci] =
FALSE;
168 for (scanno = 1; scanno <= cinfo->
num_scans; scanptr++, scanno++) {
172 ERREXIT2(cinfo, JERR_COMPONENT_COUNT, ncomps, MAX_COMPS_IN_SCAN);
173 for (ci = 0; ci < ncomps; ci++) {
176 ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
178 if (ci > 0 && thisi <= scanptr->component_index[ci-1])
179 ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
187 #ifdef C_PROGRESSIVE_SUPPORTED
189 Ah < 0 || Ah > 13 || Al < 0 || Al > 13)
190 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
193 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
196 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
198 for (ci = 0; ci < ncomps; ci++) {
200 if (Ss != 0 && last_bitpos_ptr[0] < 0)
201 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
202 for (coefi = Ss; coefi <= Se; coefi++) {
203 if (last_bitpos_ptr[coefi] < 0) {
206 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
209 if (Ah != last_bitpos_ptr[coefi] || Al != Ah-1)
210 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
212 last_bitpos_ptr[coefi] = Al;
218 if (Ss != 0 || Se !=
DCTSIZE2-1 || Ah != 0 || Al != 0)
219 ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
221 for (ci = 0; ci < ncomps; ci++) {
223 if (component_sent[thisi])
224 ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
225 component_sent[thisi] =
TRUE;
232 #ifdef C_PROGRESSIVE_SUPPORTED
239 if (last_bitpos[ci][0] < 0)
240 ERREXIT(cinfo, JERR_MISSING_DATA);
245 if (! component_sent[ci])
246 ERREXIT(cinfo, JERR_MISSING_DATA);
260 #ifdef C_MULTISCAN_FILES_SUPPORTED
267 for (ci = 0; ci < scanptr->comps_in_scan; ci++) {
269 &cinfo->
comp_info[scanptr->component_index[ci]];
271 cinfo->
Ss = scanptr->Ss;
272 cinfo->
Se = scanptr->Se;
273 cinfo->
Ah = scanptr->Ah;
274 cinfo->
Al = scanptr->Al;
300 int ci, mcublks, tmp;
363 ERREXIT(cinfo, JERR_BAD_MCU_SIZE);
364 while (mcublks-- > 0) {
401 (*cinfo->
cconvert->start_pass) (cinfo);
405 (*cinfo->
fdct->start_pass) (cinfo);
407 (*cinfo->
coef->start_pass) (cinfo,
410 (*cinfo->
main->start_pass) (cinfo, JBUF_PASS_THRU);
419 #ifdef ENTROPY_OPT_SUPPORTED
448 (*cinfo->
marker->write_frame_header) (cinfo);
449 (*cinfo->
marker->write_scan_header) (cinfo);
453 ERREXIT(cinfo, JERR_NOT_COMPILED);
459 if (cinfo->progress !=
NULL) {
460 cinfo->progress->completed_passes = master->
pass_number;
481 (*cinfo->
marker->write_frame_header) (cinfo);
482 (*cinfo->
marker->write_scan_header) (cinfo);
498 (*cinfo->
entropy->finish_pass) (cinfo);
548 #ifdef C_MULTISCAN_FILES_SUPPORTED
551 ERREXIT(cinfo, JERR_NOT_COMPILED);
562 if (transcode_only) {
struct jpeg_c_prep_controller * prep
JDIMENSION downsampled_width
my_comp_master * my_master_ptr
struct jpeg_forward_dct * fdct
struct jpeg_common_struct * j_common_ptr
const jpeg_scan_info * scan_info
struct jpeg_color_converter * cconvert
#define ERREXIT(cinfo, code)
METHODDEF void prepare_for_pass(j_compress_ptr cinfo)
GLOBAL long jdiv_round_up(long a, long b)
LOCAL void validate_script(j_compress_ptr cinfo)
JDIMENSION MCU_rows_in_scan
struct jpeg_entropy_encoder * entropy
boolean call_pass_startup
int component_index[MAX_COMPS_IN_SCAN]
JDIMENSION width_in_blocks
struct jpeg_comp_master pub
int MCU_membership[C_MAX_BLOCKS_IN_MCU]
METHODDEF void pass_startup(j_compress_ptr cinfo)
JDIMENSION height_in_blocks
#define JPEG_MAX_DIMENSION
struct jpeg_c_coef_controller * coef
JDIMENSION total_iMCU_rows
LOCAL void select_scan_parameters(j_compress_ptr cinfo)
#define C_MAX_BLOCKS_IN_MCU
struct jpeg_marker_writer * marker
struct jpeg_downsampler * downsample
struct jpeg_c_main_controller * main
unsigned int restart_interval
#define MIN(X, Y)
standard MIN macro
#define ERREXIT1(cinfo, code, p1)
LOCAL void per_scan_setup(j_compress_ptr cinfo)
jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]
METHODDEF void finish_pass_master(j_compress_ptr cinfo)
LOCAL void initial_setup(j_compress_ptr cinfo)
GLOBAL void jinit_c_master_control(j_compress_ptr cinfo, boolean transcode_only)
#define ERREXIT2(cinfo, code, p1, p2)
#define MAX_COMPS_IN_SCAN
jpeg_component_info * comp_info
struct jpeg_comp_master * master
JDIMENSION downsampled_height