Doxygen Source Code Documentation
jdapistd.c File Reference
#include "jinclude.h"
#include "jpeglib.h"
Go to the source code of this file.
Defines | |
#define | JPEG_INTERNALS |
Functions | |
LOCAL (boolean) output_pass_setup JPP((j_decompress_ptr cinfo)) | |
jpeg_start_decompress (j_decompress_ptr cinfo) | |
output_pass_setup (j_decompress_ptr cinfo) | |
jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION max_lines) | |
jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data, JDIMENSION max_lines) | |
jpeg_start_output (j_decompress_ptr cinfo, int scan_number) | |
jpeg_finish_output (j_decompress_ptr cinfo) |
Define Documentation
|
Definition at line 17 of file jdapistd.c. |
Function Documentation
|
Definition at line 253 of file jdapistd.c. References jpeg_decompress_struct::buffered_image, DSTATE_BUFIMAGE, DSTATE_BUFPOST, DSTATE_RAW_OK, DSTATE_SCANNING, jpeg_input_controller::eoi_reached, ERREXIT1, jpeg_decompress_struct::input_scan_number, jpeg_decompress_struct::inputctl, JPEG_SUSPENDED, jpeg_decompress_struct::master, and jpeg_decompress_struct::output_scan_number.
00254 { 00255 if ((cinfo->global_state == DSTATE_SCANNING || 00256 cinfo->global_state == DSTATE_RAW_OK) && cinfo->buffered_image) { 00257 /* Terminate this pass. */ 00258 /* We do not require the whole pass to have been completed. */ 00259 (*cinfo->master->finish_output_pass) (cinfo); 00260 cinfo->global_state = DSTATE_BUFPOST; 00261 } else if (cinfo->global_state != DSTATE_BUFPOST) { 00262 /* BUFPOST = repeat call after a suspension, anything else is error */ 00263 ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); 00264 } 00265 /* Read markers looking for SOS or EOI */ 00266 while (cinfo->input_scan_number <= cinfo->output_scan_number && 00267 ! cinfo->inputctl->eoi_reached) { 00268 if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED) 00269 return FALSE; /* Suspend, come back later */ 00270 } 00271 cinfo->global_state = DSTATE_BUFIMAGE; 00272 return TRUE; 00273 } |
|
Definition at line 185 of file jdapistd.c. References jpeg_decompress_struct::coef, DSTATE_RAW_OK, ERREXIT, ERREXIT1, JDIMENSION, JSAMPIMAGE, max_lines, jpeg_decompress_struct::max_v_samp_factor, jpeg_decompress_struct::min_DCT_scaled_size, jpeg_decompress_struct::output_height, jpeg_decompress_struct::output_scanline, and WARNMS.
00187 { 00188 JDIMENSION lines_per_iMCU_row; 00189 00190 if (cinfo->global_state != DSTATE_RAW_OK) 00191 ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); 00192 if (cinfo->output_scanline >= cinfo->output_height) { 00193 WARNMS(cinfo, JWRN_TOO_MUCH_DATA); 00194 return 0; 00195 } 00196 00197 /* Call progress monitor hook if present */ 00198 if (cinfo->progress != NULL) { 00199 cinfo->progress->pass_counter = (long) cinfo->output_scanline; 00200 cinfo->progress->pass_limit = (long) cinfo->output_height; 00201 (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); 00202 } 00203 00204 /* Verify that at least one iMCU row can be returned. */ 00205 lines_per_iMCU_row = cinfo->max_v_samp_factor * cinfo->min_DCT_scaled_size; 00206 if (max_lines < lines_per_iMCU_row) 00207 ERREXIT(cinfo, JERR_BUFFER_SIZE); 00208 00209 /* Decompress directly into user's buffer. */ 00210 if (! (*cinfo->coef->decompress_data) (cinfo, data)) 00211 return 0; /* suspension forced, can do nothing more */ 00212 00213 /* OK, we processed one iMCU row. */ 00214 cinfo->output_scanline += lines_per_iMCU_row; 00215 return lines_per_iMCU_row; 00216 } |
|
Definition at line 152 of file jdapistd.c. References DSTATE_SCANNING, ERREXIT1, JDIMENSION, JSAMPARRAY, jpeg_decompress_struct::main, max_lines, jpeg_decompress_struct::output_height, jpeg_decompress_struct::output_scanline, scanlines, and WARNMS. Referenced by read_JPEG_file().
00154 { 00155 JDIMENSION row_ctr; 00156 00157 if (cinfo->global_state != DSTATE_SCANNING) 00158 ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); 00159 if (cinfo->output_scanline >= cinfo->output_height) { 00160 WARNMS(cinfo, JWRN_TOO_MUCH_DATA); 00161 return 0; 00162 } 00163 00164 /* Call progress monitor hook if present */ 00165 if (cinfo->progress != NULL) { 00166 cinfo->progress->pass_counter = (long) cinfo->output_scanline; 00167 cinfo->progress->pass_limit = (long) cinfo->output_height; 00168 (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); 00169 } 00170 00171 /* Process some data */ 00172 row_ctr = 0; 00173 (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, max_lines); 00174 cinfo->output_scanline += row_ctr; 00175 return row_ctr; 00176 } |
|
Definition at line 38 of file jdapistd.c. References jpeg_decompress_struct::buffered_image, DSTATE_BUFIMAGE, DSTATE_PRELOAD, DSTATE_PRESCAN, DSTATE_READY, ERREXIT, ERREXIT1, jpeg_input_controller::has_multiple_scans, jpeg_decompress_struct::input_scan_number, jpeg_decompress_struct::inputctl, jinit_master_decompress(), JPEG_REACHED_EOI, JPEG_REACHED_SOS, JPEG_ROW_COMPLETED, JPEG_SUSPENDED, output_pass_setup(), jpeg_decompress_struct::output_scan_number, retcode, and jpeg_decompress_struct::total_iMCU_rows. Referenced by read_JPEG_file().
00039 { 00040 if (cinfo->global_state == DSTATE_READY) { 00041 /* First call: initialize master control, select active modules */ 00042 jinit_master_decompress(cinfo); 00043 if (cinfo->buffered_image) { 00044 /* No more work here; expecting jpeg_start_output next */ 00045 cinfo->global_state = DSTATE_BUFIMAGE; 00046 return TRUE; 00047 } 00048 cinfo->global_state = DSTATE_PRELOAD; 00049 } 00050 if (cinfo->global_state == DSTATE_PRELOAD) { 00051 /* If file has multiple scans, absorb them all into the coef buffer */ 00052 if (cinfo->inputctl->has_multiple_scans) { 00053 #ifdef D_MULTISCAN_FILES_SUPPORTED 00054 for (;;) { 00055 int retcode; 00056 /* Call progress monitor hook if present */ 00057 if (cinfo->progress != NULL) 00058 (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); 00059 /* Absorb some more input */ 00060 retcode = (*cinfo->inputctl->consume_input) (cinfo); 00061 if (retcode == JPEG_SUSPENDED) 00062 return FALSE; 00063 if (retcode == JPEG_REACHED_EOI) 00064 break; 00065 /* Advance progress counter if appropriate */ 00066 if (cinfo->progress != NULL && 00067 (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) { 00068 if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) { 00069 /* jdmaster underestimated number of scans; ratchet up one scan */ 00070 cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows; 00071 } 00072 } 00073 } 00074 #else 00075 ERREXIT(cinfo, JERR_NOT_COMPILED); 00076 #endif /* D_MULTISCAN_FILES_SUPPORTED */ 00077 } 00078 cinfo->output_scan_number = cinfo->input_scan_number; 00079 } else if (cinfo->global_state != DSTATE_PRESCAN) 00080 ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); 00081 /* Perform any dummy output passes, and set up for the final pass */ 00082 return output_pass_setup(cinfo); 00083 } |
|
Definition at line 228 of file jdapistd.c. References DSTATE_BUFIMAGE, DSTATE_PRESCAN, jpeg_input_controller::eoi_reached, ERREXIT1, jpeg_decompress_struct::input_scan_number, jpeg_decompress_struct::inputctl, output_pass_setup(), jpeg_decompress_struct::output_scan_number, and scan_number.
00229 { 00230 if (cinfo->global_state != DSTATE_BUFIMAGE && 00231 cinfo->global_state != DSTATE_PRESCAN) 00232 ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); 00233 /* Limit scan number to valid range */ 00234 if (scan_number <= 0) 00235 scan_number = 1; 00236 if (cinfo->inputctl->eoi_reached && 00237 scan_number > cinfo->input_scan_number) 00238 scan_number = cinfo->input_scan_number; 00239 cinfo->output_scan_number = scan_number; 00240 /* Perform any dummy output passes, and set up for the real pass */ 00241 return output_pass_setup(cinfo); 00242 } |
|
|
|
Definition at line 95 of file jdapistd.c. References DSTATE_PRESCAN, DSTATE_RAW_OK, DSTATE_SCANNING, ERREXIT, jpeg_decomp_master::is_dummy_pass, JDIMENSION, jpeg_decompress_struct::main, jpeg_decompress_struct::master, jpeg_decompress_struct::output_height, jpeg_decompress_struct::output_scanline, and jpeg_decompress_struct::raw_data_out. Referenced by jpeg_start_decompress(), and jpeg_start_output().
00096 { 00097 if (cinfo->global_state != DSTATE_PRESCAN) { 00098 /* First call: do pass setup */ 00099 (*cinfo->master->prepare_for_output_pass) (cinfo); 00100 cinfo->output_scanline = 0; 00101 cinfo->global_state = DSTATE_PRESCAN; 00102 } 00103 /* Loop over any required dummy passes */ 00104 while (cinfo->master->is_dummy_pass) { 00105 #ifdef QUANT_2PASS_SUPPORTED 00106 /* Crank through the dummy pass */ 00107 while (cinfo->output_scanline < cinfo->output_height) { 00108 JDIMENSION last_scanline; 00109 /* Call progress monitor hook if present */ 00110 if (cinfo->progress != NULL) { 00111 cinfo->progress->pass_counter = (long) cinfo->output_scanline; 00112 cinfo->progress->pass_limit = (long) cinfo->output_height; 00113 (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo); 00114 } 00115 /* Process some data */ 00116 last_scanline = cinfo->output_scanline; 00117 (*cinfo->main->process_data) (cinfo, (JSAMPARRAY) NULL, 00118 &cinfo->output_scanline, (JDIMENSION) 0); 00119 if (cinfo->output_scanline == last_scanline) 00120 return FALSE; /* No progress made, must suspend */ 00121 } 00122 /* Finish up dummy pass, and set up for another one */ 00123 (*cinfo->master->finish_output_pass) (cinfo); 00124 (*cinfo->master->prepare_for_output_pass) (cinfo); 00125 cinfo->output_scanline = 0; 00126 #else 00127 ERREXIT(cinfo, JERR_NOT_COMPILED); 00128 #endif /* QUANT_2PASS_SUPPORTED */ 00129 } 00130 /* Ready for application to drive output pass through 00131 * jpeg_read_scanlines or jpeg_read_raw_data. 00132 */ 00133 cinfo->global_state = cinfo->raw_data_out ? DSTATE_RAW_OK : DSTATE_SCANNING; 00134 return TRUE; 00135 } |