Doxygen Source Code Documentation
jdpostct.c File Reference
#include "jinclude.h"
#include "jpeglib.h"
Go to the source code of this file.
Define Documentation
|
Definition at line 19 of file jdpostct.c. |
Typedef Documentation
|
Definition at line 42 of file jdpostct.c. |
Function Documentation
|
Definition at line 250 of file jdpostct.c. References ERREXIT, JPOOL_IMAGE, jround_up(), need_full_buffer, SIZEOF, and start_pass_dpost(). Referenced by master_selection().
00251 { 00252 my_post_ptr post; 00253 00254 post = (my_post_ptr) 00255 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, 00256 SIZEOF(my_post_controller)); 00257 cinfo->post = (struct jpeg_d_post_controller *) post; 00258 post->pub.start_pass = start_pass_dpost; 00259 post->whole_image = NULL; /* flag for no virtual arrays */ 00260 post->buffer = NULL; /* flag for no strip buffer */ 00261 00262 /* Create the quantization buffer, if needed */ 00263 if (cinfo->quantize_colors) { 00264 /* The buffer strip height is max_v_samp_factor, which is typically 00265 * an efficient number of rows for upsampling to return. 00266 * (In the presence of output rescaling, we might want to be smarter?) 00267 */ 00268 post->strip_height = (JDIMENSION) cinfo->max_v_samp_factor; 00269 if (need_full_buffer) { 00270 /* Two-pass color quantization: need full-image storage. */ 00271 /* We round up the number of rows to a multiple of the strip height. */ 00272 #ifdef QUANT_2PASS_SUPPORTED 00273 post->whole_image = (*cinfo->mem->request_virt_sarray) 00274 ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, 00275 cinfo->output_width * cinfo->out_color_components, 00276 (JDIMENSION) jround_up((long) cinfo->output_height, 00277 (long) post->strip_height), 00278 post->strip_height); 00279 #else 00280 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); 00281 #endif /* QUANT_2PASS_SUPPORTED */ 00282 } else { 00283 /* One-pass color quantization: just make a strip buffer. */ 00284 post->buffer = (*cinfo->mem->alloc_sarray) 00285 ((j_common_ptr) cinfo, JPOOL_IMAGE, 00286 cinfo->output_width * cinfo->out_color_components, 00287 post->strip_height); 00288 } 00289 } 00290 } |
|
|
|
Definition at line 126 of file jdpostct.c. References my_post_controller::buffer, jpeg_decompress_struct::cquantize, in_row_group_ctr, in_row_groups_avail, input_buf, JDIMENSION, JSAMPARRAY, JSAMPIMAGE, num_rows, out_row_ctr, out_rows_avail, output_buf, jpeg_decompress_struct::post, my_post_controller::strip_height, and jpeg_decompress_struct::upsample. Referenced by start_pass_dpost().
00131 { 00132 my_post_ptr post = (my_post_ptr) cinfo->post; 00133 JDIMENSION num_rows, max_rows; 00134 00135 /* Fill the buffer, but not more than what we can dump out in one go. */ 00136 /* Note we rely on the upsampler to detect bottom of image. */ 00137 max_rows = out_rows_avail - *out_row_ctr; 00138 if (max_rows > post->strip_height) 00139 max_rows = post->strip_height; 00140 num_rows = 0; 00141 (*cinfo->upsample->upsample) (cinfo, 00142 input_buf, in_row_group_ctr, in_row_groups_avail, 00143 post->buffer, &num_rows, max_rows); 00144 /* Quantize and emit data. */ 00145 (*cinfo->cquantize->color_quantize) (cinfo, 00146 post->buffer, output_buf + *out_row_ctr, (int) num_rows); 00147 *out_row_ctr += num_rows; 00148 } |
|
Definition at line 202 of file jdpostct.c. References my_post_controller::buffer, jpeg_decompress_struct::cquantize, in_row_group_ctr, in_row_groups_avail, input_buf, JDIMENSION, JSAMPARRAY, JSAMPIMAGE, my_post_controller::next_row, num_rows, out_row_ctr, out_rows_avail, output_buf, jpeg_decompress_struct::output_height, jpeg_decompress_struct::post, my_post_controller::starting_row, my_post_controller::strip_height, and my_post_controller::whole_image. Referenced by start_pass_dpost().
00207 { 00208 my_post_ptr post = (my_post_ptr) cinfo->post; 00209 JDIMENSION num_rows, max_rows; 00210 00211 /* Reposition virtual buffer if at start of strip. */ 00212 if (post->next_row == 0) { 00213 post->buffer = (*cinfo->mem->access_virt_sarray) 00214 ((j_common_ptr) cinfo, post->whole_image, 00215 post->starting_row, post->strip_height, FALSE); 00216 } 00217 00218 /* Determine number of rows to emit. */ 00219 num_rows = post->strip_height - post->next_row; /* available in strip */ 00220 max_rows = out_rows_avail - *out_row_ctr; /* available in output area */ 00221 if (num_rows > max_rows) 00222 num_rows = max_rows; 00223 /* We have to check bottom of image here, can't depend on upsampler. */ 00224 max_rows = cinfo->output_height - post->starting_row; 00225 if (num_rows > max_rows) 00226 num_rows = max_rows; 00227 00228 /* Quantize and emit data. */ 00229 (*cinfo->cquantize->color_quantize) (cinfo, 00230 post->buffer + post->next_row, output_buf + *out_row_ctr, 00231 (int) num_rows); 00232 *out_row_ctr += num_rows; 00233 00234 /* Advance if we filled the strip. */ 00235 post->next_row += num_rows; 00236 if (post->next_row >= post->strip_height) { 00237 post->starting_row += post->strip_height; 00238 post->next_row = 0; 00239 } 00240 } |
|
Definition at line 158 of file jdpostct.c. References my_post_controller::buffer, jpeg_decompress_struct::cquantize, in_row_group_ctr, in_row_groups_avail, input_buf, JDIMENSION, JSAMPARRAY, JSAMPIMAGE, my_post_controller::next_row, num_rows, out_row_ctr, out_rows_avail, output_buf, jpeg_decompress_struct::post, my_post_controller::starting_row, my_post_controller::strip_height, jpeg_decompress_struct::upsample, and my_post_controller::whole_image. Referenced by start_pass_dpost().
00163 { 00164 my_post_ptr post = (my_post_ptr) cinfo->post; 00165 JDIMENSION old_next_row, num_rows; 00166 00167 /* Reposition virtual buffer if at start of strip. */ 00168 if (post->next_row == 0) { 00169 post->buffer = (*cinfo->mem->access_virt_sarray) 00170 ((j_common_ptr) cinfo, post->whole_image, 00171 post->starting_row, post->strip_height, TRUE); 00172 } 00173 00174 /* Upsample some data (up to a strip height's worth). */ 00175 old_next_row = post->next_row; 00176 (*cinfo->upsample->upsample) (cinfo, 00177 input_buf, in_row_group_ctr, in_row_groups_avail, 00178 post->buffer, &post->next_row, post->strip_height); 00179 00180 /* Allow quantizer to scan new data. No data is emitted, */ 00181 /* but we advance out_row_ctr so outer loop can tell when we're done. */ 00182 if (post->next_row > old_next_row) { 00183 num_rows = post->next_row - old_next_row; 00184 (*cinfo->cquantize->color_quantize) (cinfo, post->buffer + old_next_row, 00185 (JSAMPARRAY) NULL, (int) num_rows); 00186 *out_row_ctr += num_rows; 00187 } 00188 00189 /* Advance if we filled the strip. */ 00190 if (post->next_row >= post->strip_height) { 00191 post->starting_row += post->strip_height; 00192 post->next_row = 0; 00193 } 00194 } |
|
Definition at line 73 of file jdpostct.c. References my_post_controller::buffer, ERREXIT, J_BUF_MODE, JBUF_CRANK_DEST, JBUF_PASS_THRU, JBUF_SAVE_AND_PASS, my_post_controller::next_row, jpeg_decompress_struct::post, post_process_1pass(), post_process_2pass(), post_process_prepass(), my_post_controller::pub, jpeg_decompress_struct::quantize_colors, my_post_controller::starting_row, my_post_controller::strip_height, jpeg_decompress_struct::upsample, and my_post_controller::whole_image. Referenced by jinit_d_post_controller().
00074 { 00075 my_post_ptr post = (my_post_ptr) cinfo->post; 00076 00077 switch (pass_mode) { 00078 case JBUF_PASS_THRU: 00079 if (cinfo->quantize_colors) { 00080 /* Single-pass processing with color quantization. */ 00081 post->pub.post_process_data = post_process_1pass; 00082 /* We could be doing buffered-image output before starting a 2-pass 00083 * color quantization; in that case, jinit_d_post_controller did not 00084 * allocate a strip buffer. Use the virtual-array buffer as workspace. 00085 */ 00086 if (post->buffer == NULL) { 00087 post->buffer = (*cinfo->mem->access_virt_sarray) 00088 ((j_common_ptr) cinfo, post->whole_image, 00089 (JDIMENSION) 0, post->strip_height, TRUE); 00090 } 00091 } else { 00092 /* For single-pass processing without color quantization, 00093 * I have no work to do; just call the upsampler directly. 00094 */ 00095 post->pub.post_process_data = cinfo->upsample->upsample; 00096 } 00097 break; 00098 #ifdef QUANT_2PASS_SUPPORTED 00099 case JBUF_SAVE_AND_PASS: 00100 /* First pass of 2-pass quantization */ 00101 if (post->whole_image == NULL) 00102 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); 00103 post->pub.post_process_data = post_process_prepass; 00104 break; 00105 case JBUF_CRANK_DEST: 00106 /* Second pass of 2-pass quantization */ 00107 if (post->whole_image == NULL) 00108 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); 00109 post->pub.post_process_data = post_process_2pass; 00110 break; 00111 #endif /* QUANT_2PASS_SUPPORTED */ 00112 default: 00113 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); 00114 break; 00115 } 00116 post->starting_row = post->next_row = 0; 00117 } |
Variable Documentation
|
Definition at line 61 of file jdpostct.c. Referenced by h2v1_merged_upsample(), h2v2_merged_upsample(), merged_1v_upsample(), merged_2v_upsample(), post_process_1pass(), post_process_2pass(), post_process_prepass(), and sep_upsample(). |
|
Definition at line 61 of file jdpostct.c. Referenced by merged_1v_upsample(), merged_2v_upsample(), post_process_1pass(), post_process_2pass(), post_process_prepass(), and sep_upsample(). |
|
Definition at line 61 of file jdpostct.c. |
|
Definition at line 61 of file jdpostct.c. |
|
Definition at line 61 of file jdpostct.c. |
|
Definition at line 61 of file jdpostct.c. |