| OLD | NEW |
| 1 /* | 1 /* |
| 2 * jdcoefct.c | 2 * jdcoefct.c |
| 3 * | 3 * |
| 4 * Copyright (C) 1994-1997, Thomas G. Lane. | 4 * Copyright (C) 1994-1997, Thomas G. Lane. |
| 5 * Copyright (C) 2010, D. R. Commander. |
| 5 * This file is part of the Independent JPEG Group's software. | 6 * This file is part of the Independent JPEG Group's software. |
| 6 * For conditions of distribution and use, see the accompanying README file. | 7 * For conditions of distribution and use, see the accompanying README file. |
| 7 * | 8 * |
| 8 * This file contains the coefficient buffer controller for decompression. | 9 * This file contains the coefficient buffer controller for decompression. |
| 9 * This controller is the top level of the JPEG decompressor proper. | 10 * This controller is the top level of the JPEG decompressor proper. |
| 10 * The coefficient buffer lies between entropy decoding and inverse-DCT steps. | 11 * The coefficient buffer lies between entropy decoding and inverse-DCT steps. |
| 11 * | 12 * |
| 12 * In buffered-image mode, this controller is the interface between | 13 * In buffered-image mode, this controller is the interface between |
| 13 * input-oriented processing and output-oriented processing. | 14 * input-oriented processing and output-oriented processing. |
| 14 * Also, the input side (only) is used when reading a file for transcoding. | 15 * Also, the input side (only) is used when reading a file for transcoding. |
| 15 */ | 16 */ |
| 16 | 17 |
| 17 #define JPEG_INTERNALS | 18 #define JPEG_INTERNALS |
| 18 #include "jinclude.h" | 19 #include "jinclude.h" |
| 19 #include "jpeglib.h" | 20 #include "jpeglib.h" |
| 21 #include "jpegcomp.h" |
| 20 | 22 |
| 21 /* Block smoothing is only applicable for progressive JPEG, so: */ | 23 /* Block smoothing is only applicable for progressive JPEG, so: */ |
| 22 #ifndef D_PROGRESSIVE_SUPPORTED | 24 #ifndef D_PROGRESSIVE_SUPPORTED |
| 23 #undef BLOCK_SMOOTHING_SUPPORTED | 25 #undef BLOCK_SMOOTHING_SUPPORTED |
| 24 #endif | 26 #endif |
| 25 | 27 |
| 26 /* Private buffer controller object */ | 28 /* Private buffer controller object */ |
| 27 | 29 |
| 28 typedef struct { | 30 typedef struct { |
| 29 struct jpeg_d_coef_controller pub; /* public fields */ | 31 struct jpeg_d_coef_controller pub; /* public fields */ |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 compptr = cinfo->cur_comp_info[ci]; | 185 compptr = cinfo->cur_comp_info[ci]; |
| 184 /* Don't bother to IDCT an uninteresting component. */ | 186 /* Don't bother to IDCT an uninteresting component. */ |
| 185 if (! compptr->component_needed) { | 187 if (! compptr->component_needed) { |
| 186 blkn += compptr->MCU_blocks; | 188 blkn += compptr->MCU_blocks; |
| 187 continue; | 189 continue; |
| 188 } | 190 } |
| 189 inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index]; | 191 inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index]; |
| 190 useful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width | 192 useful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width |
| 191 : compptr->last_col_width; | 193 : compptr->last_col_width; |
| 192 output_ptr = output_buf[compptr->component_index] + | 194 output_ptr = output_buf[compptr->component_index] + |
| 193 » yoffset * compptr->DCT_scaled_size; | 195 » yoffset * compptr->_DCT_scaled_size; |
| 194 start_col = MCU_col_num * compptr->MCU_sample_width; | 196 start_col = MCU_col_num * compptr->MCU_sample_width; |
| 195 for (yindex = 0; yindex < compptr->MCU_height; yindex++) { | 197 for (yindex = 0; yindex < compptr->MCU_height; yindex++) { |
| 196 if (cinfo->input_iMCU_row < last_iMCU_row || | 198 if (cinfo->input_iMCU_row < last_iMCU_row || |
| 197 yoffset+yindex < compptr->last_row_height) { | 199 yoffset+yindex < compptr->last_row_height) { |
| 198 output_col = start_col; | 200 output_col = start_col; |
| 199 for (xindex = 0; xindex < useful_width; xindex++) { | 201 for (xindex = 0; xindex < useful_width; xindex++) { |
| 200 (*inverse_DCT) (cinfo, compptr, | 202 (*inverse_DCT) (cinfo, compptr, |
| 201 (JCOEFPTR) coef->MCU_buffer[blkn+xindex], | 203 (JCOEFPTR) coef->MCU_buffer[blkn+xindex], |
| 202 output_ptr, output_col); | 204 output_ptr, output_col); |
| 203 » output_col += compptr->DCT_scaled_size; | 205 » output_col += compptr->_DCT_scaled_size; |
| 204 } | 206 } |
| 205 } | 207 } |
| 206 blkn += compptr->MCU_width; | 208 blkn += compptr->MCU_width; |
| 207 » output_ptr += compptr->DCT_scaled_size; | 209 » output_ptr += compptr->_DCT_scaled_size; |
| 208 } | 210 } |
| 209 } | 211 } |
| 210 } | 212 } |
| 211 /* Completed an MCU row, but perhaps not an iMCU row */ | 213 /* Completed an MCU row, but perhaps not an iMCU row */ |
| 212 coef->MCU_ctr = 0; | 214 coef->MCU_ctr = 0; |
| 213 } | 215 } |
| 214 /* Completed the iMCU row, advance counters for next one */ | 216 /* Completed the iMCU row, advance counters for next one */ |
| 215 cinfo->output_iMCU_row++; | 217 cinfo->output_iMCU_row++; |
| 216 if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) { | 218 if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) { |
| 217 start_iMCU_row(cinfo); | 219 start_iMCU_row(cinfo); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 inverse_DCT = cinfo->idct->inverse_DCT[ci]; | 360 inverse_DCT = cinfo->idct->inverse_DCT[ci]; |
| 359 output_ptr = output_buf[ci]; | 361 output_ptr = output_buf[ci]; |
| 360 /* Loop over all DCT blocks to be processed. */ | 362 /* Loop over all DCT blocks to be processed. */ |
| 361 for (block_row = 0; block_row < block_rows; block_row++) { | 363 for (block_row = 0; block_row < block_rows; block_row++) { |
| 362 buffer_ptr = buffer[block_row]; | 364 buffer_ptr = buffer[block_row]; |
| 363 output_col = 0; | 365 output_col = 0; |
| 364 for (block_num = 0; block_num < compptr->width_in_blocks; block_num++) { | 366 for (block_num = 0; block_num < compptr->width_in_blocks; block_num++) { |
| 365 (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) buffer_ptr, | 367 (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) buffer_ptr, |
| 366 output_ptr, output_col); | 368 output_ptr, output_col); |
| 367 buffer_ptr++; | 369 buffer_ptr++; |
| 368 » output_col += compptr->DCT_scaled_size; | 370 » output_col += compptr->_DCT_scaled_size; |
| 369 } | 371 } |
| 370 output_ptr += compptr->DCT_scaled_size; | 372 output_ptr += compptr->_DCT_scaled_size; |
| 371 } | 373 } |
| 372 } | 374 } |
| 373 | 375 |
| 374 if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows) | 376 if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows) |
| 375 return JPEG_ROW_COMPLETED; | 377 return JPEG_ROW_COMPLETED; |
| 376 return JPEG_SCAN_COMPLETED; | 378 return JPEG_SCAN_COMPLETED; |
| 377 } | 379 } |
| 378 | 380 |
| 379 #endif /* D_MULTISCAN_FILES_SUPPORTED */ | 381 #endif /* D_MULTISCAN_FILES_SUPPORTED */ |
| 380 | 382 |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 workspace[2] = (JCOEF) pred; | 655 workspace[2] = (JCOEF) pred; |
| 654 } | 656 } |
| 655 /* OK, do the IDCT */ | 657 /* OK, do the IDCT */ |
| 656 (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) workspace, | 658 (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) workspace, |
| 657 output_ptr, output_col); | 659 output_ptr, output_col); |
| 658 /* Advance for next column */ | 660 /* Advance for next column */ |
| 659 DC1 = DC2; DC2 = DC3; | 661 DC1 = DC2; DC2 = DC3; |
| 660 DC4 = DC5; DC5 = DC6; | 662 DC4 = DC5; DC5 = DC6; |
| 661 DC7 = DC8; DC8 = DC9; | 663 DC7 = DC8; DC8 = DC9; |
| 662 buffer_ptr++, prev_block_row++, next_block_row++; | 664 buffer_ptr++, prev_block_row++, next_block_row++; |
| 663 » output_col += compptr->DCT_scaled_size; | 665 » output_col += compptr->_DCT_scaled_size; |
| 664 } | 666 } |
| 665 output_ptr += compptr->DCT_scaled_size; | 667 output_ptr += compptr->_DCT_scaled_size; |
| 666 } | 668 } |
| 667 } | 669 } |
| 668 | 670 |
| 669 if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows) | 671 if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows) |
| 670 return JPEG_ROW_COMPLETED; | 672 return JPEG_ROW_COMPLETED; |
| 671 return JPEG_SCAN_COMPLETED; | 673 return JPEG_SCAN_COMPLETED; |
| 672 } | 674 } |
| 673 | 675 |
| 674 #endif /* BLOCK_SMOOTHING_SUPPORTED */ | 676 #endif /* BLOCK_SMOOTHING_SUPPORTED */ |
| 675 | 677 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 coef->pub.consume_data = dummy_consume_data; | 740 coef->pub.consume_data = dummy_consume_data; |
| 739 coef->pub.decompress_data = decompress_onepass; | 741 coef->pub.decompress_data = decompress_onepass; |
| 740 coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */ | 742 coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */ |
| 741 } | 743 } |
| 742 | 744 |
| 743 /* Allocate the workspace buffer */ | 745 /* Allocate the workspace buffer */ |
| 744 coef->workspace = (JCOEF *) | 746 coef->workspace = (JCOEF *) |
| 745 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, | 747 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, |
| 746 SIZEOF(JCOEF) * DCTSIZE2); | 748 SIZEOF(JCOEF) * DCTSIZE2); |
| 747 } | 749 } |
| OLD | NEW |