Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: core/src/fxcodec/libjpeg/fpdfapi_jcmainct.c

Issue 818363006: fix a few linux compilation warnings (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Restore origina cmslut.c Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #if !defined(_FX_JPEG_TURBO_) 1 #if !defined(_FX_JPEG_TURBO_)
2 /* 2 /*
3 * jcmainct.c 3 * jcmainct.c
4 * 4 *
5 * Copyright (C) 1994-1996, Thomas G. Lane. 5 * Copyright (C) 1994-1996, Thomas G. Lane.
6 * This file is part of the Independent JPEG Group's software. 6 * This file is part of the Independent JPEG Group's software.
7 * For conditions of distribution and use, see the accompanying README file. 7 * For conditions of distribution and use, see the accompanying README file.
8 * 8 *
9 * This file contains the main buffer controller for compression. 9 * This file contains the main buffer controller for compression.
10 * The main buffer lies between the pre-processor and the JPEG 10 * The main buffer lies between the pre-processor and the JPEG
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 #endif 62 #endif
63 63
64 64
65 /* 65 /*
66 * Initialize for a processing pass. 66 * Initialize for a processing pass.
67 */ 67 */
68 68
69 METHODDEF(void) 69 METHODDEF(void)
70 start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode) 70 start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
71 { 71 {
72 my_main_ptr main = (my_main_ptr) cinfo->main; 72 my_main_ptr my_main = (my_main_ptr) cinfo->main;
73 73
74 /* Do nothing in raw-data mode. */ 74 /* Do nothing in raw-data mode. */
75 if (cinfo->raw_data_in) 75 if (cinfo->raw_data_in)
76 return; 76 return;
77 77
78 main->cur_iMCU_row = 0;» /* initialize counters */ 78 my_main->cur_iMCU_row = 0;» /* initialize counters */
79 main->rowgroup_ctr = 0; 79 my_main->rowgroup_ctr = 0;
80 main->suspended = FALSE; 80 my_main->suspended = FALSE;
81 main->pass_mode = pass_mode;» /* save mode for use by process_data */ 81 my_main->pass_mode = pass_mode;» /* save mode for use by process_data */
82 82
83 switch (pass_mode) { 83 switch (pass_mode) {
84 case JBUF_PASS_THRU: 84 case JBUF_PASS_THRU:
85 #ifdef FULL_MAIN_BUFFER_SUPPORTED 85 #ifdef FULL_MAIN_BUFFER_SUPPORTED
86 if (main->whole_image[0] != NULL) 86 if (my_main->whole_image[0] != NULL)
87 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); 87 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
88 #endif 88 #endif
89 main->pub.process_data = process_data_simple_main; 89 my_main->pub.process_data = process_data_simple_main;
90 break; 90 break;
91 #ifdef FULL_MAIN_BUFFER_SUPPORTED 91 #ifdef FULL_MAIN_BUFFER_SUPPORTED
92 case JBUF_SAVE_SOURCE: 92 case JBUF_SAVE_SOURCE:
93 case JBUF_CRANK_DEST: 93 case JBUF_CRANK_DEST:
94 case JBUF_SAVE_AND_PASS: 94 case JBUF_SAVE_AND_PASS:
95 if (main->whole_image[0] == NULL) 95 if (my_main->whole_image[0] == NULL)
96 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); 96 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
97 main->pub.process_data = process_data_buffer_main; 97 my_main->pub.process_data = process_data_buffer_main;
98 break; 98 break;
99 #endif 99 #endif
100 default: 100 default:
101 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); 101 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
102 break; 102 break;
103 } 103 }
104 } 104 }
105 105
106 106
107 /* 107 /*
108 * Process some data. 108 * Process some data.
109 * This routine handles the simple pass-through mode, 109 * This routine handles the simple pass-through mode,
110 * where we have only a strip buffer. 110 * where we have only a strip buffer.
111 */ 111 */
112 112
113 METHODDEF(void) 113 METHODDEF(void)
114 process_data_simple_main (j_compress_ptr cinfo, 114 process_data_simple_main (j_compress_ptr cinfo,
115 JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, 115 JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
116 JDIMENSION in_rows_avail) 116 JDIMENSION in_rows_avail)
117 { 117 {
118 my_main_ptr main = (my_main_ptr) cinfo->main; 118 my_main_ptr my_main = (my_main_ptr) cinfo->main;
119 119
120 while (main->cur_iMCU_row < cinfo->total_iMCU_rows) { 120 while (my_main->cur_iMCU_row < cinfo->total_iMCU_rows) {
121 /* Read input data if we haven't filled the main buffer yet */ 121 /* Read input data if we haven't filled the main buffer yet */
122 if (main->rowgroup_ctr < DCTSIZE) 122 if (my_main->rowgroup_ctr < DCTSIZE)
123 (*cinfo->prep->pre_process_data) (cinfo, 123 (*cinfo->prep->pre_process_data) (cinfo,
124 input_buf, in_row_ctr, in_rows_avail, 124 input_buf, in_row_ctr, in_rows_avail,
125 » » » » » main->buffer, &main->rowgroup_ctr, 125 » » » » » my_main->buffer, &my_main->rowgroup_ctr,
126 (JDIMENSION) DCTSIZE); 126 (JDIMENSION) DCTSIZE);
127 127
128 /* If we don't have a full iMCU row buffered, return to application for 128 /* If we don't have a full iMCU row buffered, return to application for
129 * more data. Note that preprocessor will always pad to fill the iMCU row 129 * more data. Note that preprocessor will always pad to fill the iMCU row
130 * at the bottom of the image. 130 * at the bottom of the image.
131 */ 131 */
132 if (main->rowgroup_ctr != DCTSIZE) 132 if (my_main->rowgroup_ctr != DCTSIZE)
133 return; 133 return;
134 134
135 /* Send the completed row to the compressor */ 135 /* Send the completed row to the compressor */
136 if (! (*cinfo->coef->compress_data) (cinfo, main->buffer)) { 136 if (! (*cinfo->coef->compress_data) (cinfo, my_main->buffer)) {
137 /* If compressor did not consume the whole row, then we must need to 137 /* If compressor did not consume the whole row, then we must need to
138 * suspend processing and return to the application. In this situation 138 * suspend processing and return to the application. In this situation
139 * we pretend we didn't yet consume the last input row; otherwise, if 139 * we pretend we didn't yet consume the last input row; otherwise, if
140 * it happened to be the last row of the image, the application would 140 * it happened to be the last row of the image, the application would
141 * think we were done. 141 * think we were done.
142 */ 142 */
143 if (! main->suspended) { 143 if (! my_main->suspended) {
144 (*in_row_ctr)--; 144 (*in_row_ctr)--;
145 » main->suspended = TRUE; 145 » my_main->suspended = TRUE;
146 } 146 }
147 return; 147 return;
148 } 148 }
149 /* We did finish the row. Undo our little suspension hack if a previous 149 /* We did finish the row. Undo our little suspension hack if a previous
150 * call suspended; then mark the main buffer empty. 150 * call suspended; then mark the main buffer empty.
151 */ 151 */
152 if (main->suspended) { 152 if (my_main->suspended) {
153 (*in_row_ctr)++; 153 (*in_row_ctr)++;
154 main->suspended = FALSE; 154 my_main->suspended = FALSE;
155 } 155 }
156 main->rowgroup_ctr = 0; 156 my_main->rowgroup_ctr = 0;
157 main->cur_iMCU_row++; 157 my_main->cur_iMCU_row++;
158 } 158 }
159 } 159 }
160 160
161 161
162 #ifdef FULL_MAIN_BUFFER_SUPPORTED 162 #ifdef FULL_MAIN_BUFFER_SUPPORTED
163 163
164 /* 164 /*
165 * Process some data. 165 * Process some data.
166 * This routine handles all of the modes that use a full-size buffer. 166 * This routine handles all of the modes that use a full-size buffer.
167 */ 167 */
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 #endif /* FULL_MAIN_BUFFER_SUPPORTED */ 238 #endif /* FULL_MAIN_BUFFER_SUPPORTED */
239 239
240 240
241 /* 241 /*
242 * Initialize main buffer controller. 242 * Initialize main buffer controller.
243 */ 243 */
244 244
245 GLOBAL(void) 245 GLOBAL(void)
246 jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer) 246 jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
247 { 247 {
248 my_main_ptr main; 248 my_main_ptr my_main;
249 int ci; 249 int ci;
250 jpeg_component_info *compptr; 250 jpeg_component_info *compptr;
251 251
252 main = (my_main_ptr) 252 my_main = (my_main_ptr)
253 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, 253 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
254 SIZEOF(my_main_controller)); 254 SIZEOF(my_main_controller));
255 cinfo->main = (struct jpeg_c_main_controller *) main; 255 cinfo->main = (struct jpeg_c_main_controller *) my_main;
256 main->pub.start_pass = start_pass_main; 256 my_main->pub.start_pass = start_pass_main;
257 257
258 /* We don't need to create a buffer in raw-data mode. */ 258 /* We don't need to create a buffer in raw-data mode. */
259 if (cinfo->raw_data_in) 259 if (cinfo->raw_data_in)
260 return; 260 return;
261 261
262 /* Create the buffer. It holds downsampled data, so each component 262 /* Create the buffer. It holds downsampled data, so each component
263 * may be of a different size. 263 * may be of a different size.
264 */ 264 */
265 if (need_full_buffer) { 265 if (need_full_buffer) {
266 #ifdef FULL_MAIN_BUFFER_SUPPORTED 266 #ifdef FULL_MAIN_BUFFER_SUPPORTED
267 /* Allocate a full-image virtual array for each component */ 267 /* Allocate a full-image virtual array for each component */
268 /* Note we pad the bottom to a multiple of the iMCU height */ 268 /* Note we pad the bottom to a multiple of the iMCU height */
269 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 269 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
270 ci++, compptr++) { 270 ci++, compptr++) {
271 main->whole_image[ci] = (*cinfo->mem->request_virt_sarray) 271 my_main->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
272 ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, 272 ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
273 compptr->width_in_blocks * DCTSIZE, 273 compptr->width_in_blocks * DCTSIZE,
274 (JDIMENSION) jround_up((long) compptr->height_in_blocks, 274 (JDIMENSION) jround_up((long) compptr->height_in_blocks,
275 (long) compptr->v_samp_factor) * DCTSIZE, 275 (long) compptr->v_samp_factor) * DCTSIZE,
276 (JDIMENSION) (compptr->v_samp_factor * DCTSIZE)); 276 (JDIMENSION) (compptr->v_samp_factor * DCTSIZE));
277 } 277 }
278 #else 278 #else
279 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); 279 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
280 #endif 280 #endif
281 } else { 281 } else {
282 #ifdef FULL_MAIN_BUFFER_SUPPORTED 282 #ifdef FULL_MAIN_BUFFER_SUPPORTED
283 main->whole_image[0] = NULL; /* flag for no virtual arrays */ 283 my_main->whole_image[0] = NULL; /* flag for no virtual arrays */
284 #endif 284 #endif
285 /* Allocate a strip buffer for each component */ 285 /* Allocate a strip buffer for each component */
286 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 286 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
287 ci++, compptr++) { 287 ci++, compptr++) {
288 main->buffer[ci] = (*cinfo->mem->alloc_sarray) 288 my_main->buffer[ci] = (*cinfo->mem->alloc_sarray)
289 ((j_common_ptr) cinfo, JPOOL_IMAGE, 289 ((j_common_ptr) cinfo, JPOOL_IMAGE,
290 compptr->width_in_blocks * DCTSIZE, 290 compptr->width_in_blocks * DCTSIZE,
291 (JDIMENSION) (compptr->v_samp_factor * DCTSIZE)); 291 (JDIMENSION) (compptr->v_samp_factor * DCTSIZE));
292 } 292 }
293 } 293 }
294 } 294 }
295 295
296 #endif //_FX_JPEG_TURBO_ 296 #endif //_FX_JPEG_TURBO_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698