Changeset 846 for trunk/src/3rdparty/libjpeg/jcsample.c
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/3rdparty/libjpeg/jcsample.c
r2 r846 63 63 /* Downsampling method pointers, one per component */ 64 64 downsample1_ptr methods[MAX_COMPONENTS]; 65 66 /* Height of an output row group for each component. */ 67 int rowgroup_height[MAX_COMPONENTS]; 68 69 /* These arrays save pixel expansion factors so that int_downsample need not 70 * recompute them each time. They are unused for other downsampling methods. 71 */ 72 UINT8 h_expand[MAX_COMPONENTS]; 73 UINT8 v_expand[MAX_COMPONENTS]; 65 74 } my_downsampler; 66 75 … … 124 133 ci++, compptr++) { 125 134 in_ptr = input_buf[ci] + in_row_index; 126 out_ptr = output_buf[ci] + (out_row_group_index * compptr->v_samp_factor); 135 out_ptr = output_buf[ci] + 136 (out_row_group_index * downsample->rowgroup_height[ci]); 127 137 (*downsample->methods[ci]) (cinfo, compptr, in_ptr, out_ptr); 128 138 } … … 141 151 JSAMPARRAY input_data, JSAMPARRAY output_data) 142 152 { 153 my_downsample_ptr downsample = (my_downsample_ptr) cinfo->downsample; 143 154 int inrow, outrow, h_expand, v_expand, numpix, numpix2, h, v; 144 155 JDIMENSION outcol, outcol_h; /* outcol_h == outcol*h_expand */ 145 JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;156 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size; 146 157 JSAMPROW inptr, outptr; 147 158 INT32 outvalue; 148 159 149 h_expand = cinfo->max_h_samp_factor / compptr->h_samp_factor;150 v_expand = cinfo->max_v_samp_factor / compptr->v_samp_factor;160 h_expand = downsample->h_expand[compptr->component_index]; 161 v_expand = downsample->v_expand[compptr->component_index]; 151 162 numpix = h_expand * v_expand; 152 163 numpix2 = numpix/2; … … 159 170 cinfo->image_width, output_cols * h_expand); 160 171 161 inrow = 0;162 for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {172 inrow = outrow = 0; 173 while (inrow < cinfo->max_v_samp_factor) { 163 174 outptr = output_data[outrow]; 164 175 for (outcol = 0, outcol_h = 0; outcol < output_cols; … … 174 185 } 175 186 inrow += v_expand; 187 outrow++; 176 188 } 177 189 } … … 192 204 cinfo->max_v_samp_factor, cinfo->image_width); 193 205 /* Edge-expand */ 194 expand_right_edge(output_data, cinfo->max_v_samp_factor, 195 c info->image_width, compptr->width_in_blocks * DCTSIZE);206 expand_right_edge(output_data, cinfo->max_v_samp_factor, cinfo->image_width, 207 compptr->width_in_blocks * compptr->DCT_h_scaled_size); 196 208 } 197 209 … … 213 225 JSAMPARRAY input_data, JSAMPARRAY output_data) 214 226 { 215 int outrow;227 int inrow; 216 228 JDIMENSION outcol; 217 JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;229 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size; 218 230 register JSAMPROW inptr, outptr; 219 231 register int bias; … … 226 238 cinfo->image_width, output_cols * 2); 227 239 228 for ( outrow = 0; outrow < compptr->v_samp_factor; outrow++) {229 outptr = output_data[ outrow];230 inptr = input_data[ outrow];240 for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) { 241 outptr = output_data[inrow]; 242 inptr = input_data[inrow]; 231 243 bias = 0; /* bias = 0,1,0,1,... for successive samples */ 232 244 for (outcol = 0; outcol < output_cols; outcol++) { … … 252 264 int inrow, outrow; 253 265 JDIMENSION outcol; 254 JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;266 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size; 255 267 register JSAMPROW inptr0, inptr1, outptr; 256 268 register int bias; … … 263 275 cinfo->image_width, output_cols * 2); 264 276 265 inrow = 0;266 for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {277 inrow = outrow = 0; 278 while (inrow < cinfo->max_v_samp_factor) { 267 279 outptr = output_data[outrow]; 268 280 inptr0 = input_data[inrow]; … … 277 289 } 278 290 inrow += 2; 291 outrow++; 279 292 } 280 293 } … … 295 308 int inrow, outrow; 296 309 JDIMENSION colctr; 297 JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;310 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size; 298 311 register JSAMPROW inptr0, inptr1, above_ptr, below_ptr, outptr; 299 312 INT32 membersum, neighsum, memberscale, neighscale; … … 322 335 neighscale = cinfo->smoothing_factor * 16; /* scaled SF/4 */ 323 336 324 inrow = 0;325 for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {337 inrow = outrow = 0; 338 while (inrow < cinfo->max_v_samp_factor) { 326 339 outptr = output_data[outrow]; 327 340 inptr0 = input_data[inrow]; … … 379 392 380 393 inrow += 2; 394 outrow++; 381 395 } 382 396 } … … 393 407 JSAMPARRAY input_data, JSAMPARRAY output_data) 394 408 { 395 int outrow;409 int inrow; 396 410 JDIMENSION colctr; 397 JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;411 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size; 398 412 register JSAMPROW inptr, above_ptr, below_ptr, outptr; 399 413 INT32 membersum, neighsum, memberscale, neighscale; … … 416 430 neighscale = cinfo->smoothing_factor * 64; /* scaled SF */ 417 431 418 for ( outrow = 0; outrow < compptr->v_samp_factor; outrow++) {419 outptr = output_data[ outrow];420 inptr = input_data[ outrow];421 above_ptr = input_data[ outrow-1];422 below_ptr = input_data[ outrow+1];432 for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) { 433 outptr = output_data[inrow]; 434 inptr = input_data[inrow]; 435 above_ptr = input_data[inrow-1]; 436 below_ptr = input_data[inrow+1]; 423 437 424 438 /* Special case for first column */ … … 468 482 jpeg_component_info * compptr; 469 483 boolean smoothok = TRUE; 484 int h_in_group, v_in_group, h_out_group, v_out_group; 470 485 471 486 downsample = (my_downsample_ptr) … … 483 498 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 484 499 ci++, compptr++) { 485 if (compptr->h_samp_factor == cinfo->max_h_samp_factor && 486 compptr->v_samp_factor == cinfo->max_v_samp_factor) { 500 /* Compute size of an "output group" for DCT scaling. This many samples 501 * are to be converted from max_h_samp_factor * max_v_samp_factor pixels. 502 */ 503 h_out_group = (compptr->h_samp_factor * compptr->DCT_h_scaled_size) / 504 cinfo->min_DCT_h_scaled_size; 505 v_out_group = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) / 506 cinfo->min_DCT_v_scaled_size; 507 h_in_group = cinfo->max_h_samp_factor; 508 v_in_group = cinfo->max_v_samp_factor; 509 downsample->rowgroup_height[ci] = v_out_group; /* save for use later */ 510 if (h_in_group == h_out_group && v_in_group == v_out_group) { 487 511 #ifdef INPUT_SMOOTHING_SUPPORTED 488 512 if (cinfo->smoothing_factor) { … … 492 516 #endif 493 517 downsample->methods[ci] = fullsize_downsample; 494 } else if ( compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor&&495 compptr->v_samp_factor == cinfo->max_v_samp_factor) {518 } else if (h_in_group == h_out_group * 2 && 519 v_in_group == v_out_group) { 496 520 smoothok = FALSE; 497 521 downsample->methods[ci] = h2v1_downsample; 498 } else if ( compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor&&499 compptr->v_samp_factor * 2 == cinfo->max_v_samp_factor) {522 } else if (h_in_group == h_out_group * 2 && 523 v_in_group == v_out_group * 2) { 500 524 #ifdef INPUT_SMOOTHING_SUPPORTED 501 525 if (cinfo->smoothing_factor) { … … 505 529 #endif 506 530 downsample->methods[ci] = h2v2_downsample; 507 } else if (( cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 &&508 ( cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) {531 } else if ((h_in_group % h_out_group) == 0 && 532 (v_in_group % v_out_group) == 0) { 509 533 smoothok = FALSE; 510 534 downsample->methods[ci] = int_downsample; 535 downsample->h_expand[ci] = (UINT8) (h_in_group / h_out_group); 536 downsample->v_expand[ci] = (UINT8) (v_in_group / v_out_group); 511 537 } else 512 538 ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
Note:
See TracChangeset
for help on using the changeset viewer.