10 #define JPEG_INTERNALS 15 #ifndef D_PROGRESSIVE_SUPPORTED 16 #undef BLOCK_SMOOTHING_SUPPORTED 28 int MCU_rows_per_iMCU_row;
43 #ifdef D_MULTISCAN_FILES_SUPPORTED 48 #ifdef BLOCK_SMOOTHING_SUPPORTED 60 #ifdef D_MULTISCAN_FILES_SUPPORTED 64 #ifdef BLOCK_SMOOTHING_SUPPORTED 81 if (cinfo->comps_in_scan > 1) {
84 if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
102 cinfo->input_iMCU_row = 0;
114 #ifdef BLOCK_SMOOTHING_SUPPORTED 118 if (coef->
pub.coef_arrays != NULL) {
125 cinfo->output_iMCU_row = 0;
144 JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
145 JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
146 int blkn, ci, xindex, yindex,
yoffset, useful_width;
150 inverse_DCT_method_ptr inverse_DCT;
155 for (MCU_col_num = coef->
MCU_ctr; MCU_col_num <= last_MCU_col;
160 if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->
MCU_buffer)) {
172 for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
173 compptr = cinfo->cur_comp_info[ci];
186 if (cinfo->input_iMCU_row < last_iMCU_row ||
187 yoffset+yindex < compptr->last_row_height) {
189 for (xindex = 0; xindex < useful_width; xindex++) {
190 (*inverse_DCT) (cinfo,
compptr,
205 cinfo->output_iMCU_row++;
206 if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
211 (*cinfo->inputctl->finish_input_pass) (cinfo);
227 #ifdef D_MULTISCAN_FILES_SUPPORTED 241 int blkn, ci, xindex, yindex,
yoffset;
248 for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
249 compptr = cinfo->cur_comp_info[ci];
250 buffer[ci] = (*cinfo->mem->access_virt_barray)
263 for (MCU_col_num = coef->
MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
267 for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
268 compptr = cinfo->cur_comp_info[ci];
278 if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->
MCU_buffer)) {
289 if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
294 (*cinfo->inputctl->finish_input_pass) (cinfo);
311 JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
313 int ci, block_row, block_rows;
319 inverse_DCT_method_ptr inverse_DCT;
322 while (cinfo->input_scan_number < cinfo->output_scan_number ||
323 (cinfo->input_scan_number == cinfo->output_scan_number &&
324 cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
330 for (ci = 0,
compptr = cinfo->comp_info; ci < cinfo->num_components;
336 buffer = (*cinfo->mem->access_virt_barray)
341 if (cinfo->output_iMCU_row < last_iMCU_row)
348 inverse_DCT = cinfo->idct->inverse_DCT[ci];
351 for (block_row = 0; block_row < block_rows; block_row++) {
352 buffer_ptr =
buffer[block_row];
364 if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
372 #ifdef BLOCK_SMOOTHING_SUPPORTED 401 boolean smoothing_useful =
FALSE;
406 int * coef_bits_latch;
408 if (! cinfo->progressive_mode || cinfo->coef_bits == NULL)
415 cinfo->num_components *
419 for (ci = 0,
compptr = cinfo->comp_info; ci < cinfo->num_components;
425 if (qtable->quantval[0] == 0 ||
426 qtable->quantval[
Q01_POS] == 0 ||
427 qtable->quantval[
Q10_POS] == 0 ||
428 qtable->quantval[
Q20_POS] == 0 ||
429 qtable->quantval[
Q11_POS] == 0 ||
430 qtable->quantval[
Q02_POS] == 0)
433 coef_bits = cinfo->coef_bits[ci];
434 if (coef_bits[0] < 0)
437 for (coefi = 1; coefi <= 5; coefi++) {
438 coef_bits_latch[coefi] = coef_bits[coefi];
439 if (coef_bits[coefi] != 0)
440 smoothing_useful =
TRUE;
445 return smoothing_useful;
457 JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
459 int ci, block_row, block_rows, access_rows;
461 JBLOCKROW buffer_ptr, prev_block_row, next_block_row;
465 inverse_DCT_method_ptr inverse_DCT;
466 boolean first_row, last_row;
471 int DC1,DC2,DC3,DC4,DC5,DC6,DC7,DC8,DC9;
475 while (cinfo->input_scan_number <= cinfo->output_scan_number &&
476 ! cinfo->inputctl->eoi_reached) {
477 if (cinfo->input_scan_number == cinfo->output_scan_number) {
484 if (cinfo->input_iMCU_row > cinfo->output_iMCU_row+delta)
492 for (ci = 0,
compptr = cinfo->comp_info; ci < cinfo->num_components;
498 if (cinfo->output_iMCU_row < last_iMCU_row) {
500 access_rows = block_rows * 2;
506 access_rows = block_rows;
510 if (cinfo->output_iMCU_row > 0) {
512 buffer = (*cinfo->mem->access_virt_barray)
519 buffer = (*cinfo->mem->access_virt_barray)
528 Q01 = quanttbl->quantval[
Q01_POS];
529 Q10 = quanttbl->quantval[
Q10_POS];
530 Q20 = quanttbl->quantval[
Q20_POS];
531 Q11 = quanttbl->quantval[
Q11_POS];
532 Q02 = quanttbl->quantval[
Q02_POS];
533 inverse_DCT = cinfo->idct->inverse_DCT[ci];
536 for (block_row = 0; block_row < block_rows; block_row++) {
537 buffer_ptr =
buffer[block_row];
538 if (first_row && block_row == 0)
539 prev_block_row = buffer_ptr;
541 prev_block_row =
buffer[block_row-1];
542 if (last_row && block_row == block_rows-1)
543 next_block_row = buffer_ptr;
545 next_block_row =
buffer[block_row+1];
549 DC1 = DC2 = DC3 = (int) prev_block_row[0][0];
550 DC4 = DC5 = DC6 = (int) buffer_ptr[0][0];
551 DC7 = DC8 = DC9 = (int) next_block_row[0][0];
554 for (block_num = 0; block_num <= last_block_column; block_num++) {
558 if (block_num < last_block_column) {
559 DC3 = (int) prev_block_row[1][0];
560 DC6 = (int) buffer_ptr[1][0];
561 DC9 = (int) next_block_row[1][0];
568 if ((Al=coef_bits[1]) != 0 && workspace[1] == 0) {
569 num = 36 * Q00 * (DC4 - DC6);
571 pred = (int) (((Q01<<7) +
num) / (Q01<<8));
572 if (Al > 0 && pred >= (1<<Al))
575 pred = (int) (((Q01<<7) -
num) / (Q01<<8));
576 if (Al > 0 && pred >= (1<<Al))
580 workspace[1] = (
JCOEF) pred;
583 if ((Al=coef_bits[2]) != 0 && workspace[8] == 0) {
584 num = 36 * Q00 * (DC2 - DC8);
586 pred = (int) (((Q10<<7) +
num) / (Q10<<8));
587 if (Al > 0 && pred >= (1<<Al))
590 pred = (int) (((Q10<<7) -
num) / (Q10<<8));
591 if (Al > 0 && pred >= (1<<Al))
595 workspace[8] = (
JCOEF) pred;
598 if ((Al=coef_bits[3]) != 0 && workspace[16] == 0) {
599 num = 9 * Q00 * (DC2 + DC8 - 2*DC5);
601 pred = (int) (((Q20<<7) +
num) / (Q20<<8));
602 if (Al > 0 && pred >= (1<<Al))
605 pred = (int) (((Q20<<7) -
num) / (Q20<<8));
606 if (Al > 0 && pred >= (1<<Al))
610 workspace[16] = (
JCOEF) pred;
613 if ((Al=coef_bits[4]) != 0 && workspace[9] == 0) {
614 num = 5 * Q00 * (DC1 - DC3 - DC7 + DC9);
616 pred = (int) (((Q11<<7) +
num) / (Q11<<8));
617 if (Al > 0 && pred >= (1<<Al))
620 pred = (int) (((Q11<<7) -
num) / (Q11<<8));
621 if (Al > 0 && pred >= (1<<Al))
625 workspace[9] = (
JCOEF) pred;
628 if ((Al=coef_bits[5]) != 0 && workspace[2] == 0) {
629 num = 9 * Q00 * (DC4 + DC6 - 2*DC5);
631 pred = (int) (((Q02<<7) +
num) / (Q02<<8));
632 if (Al > 0 && pred >= (1<<Al))
635 pred = (int) (((Q02<<7) -
num) / (Q02<<8));
636 if (Al > 0 && pred >= (1<<Al))
640 workspace[2] = (
JCOEF) pred;
646 DC1 = DC2; DC2 = DC3;
647 DC4 = DC5; DC5 = DC6;
648 DC7 = DC8; DC8 = DC9;
649 buffer_ptr++, prev_block_row++, next_block_row++;
656 if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
679 #ifdef BLOCK_SMOOTHING_SUPPORTED 685 #ifdef D_MULTISCAN_FILES_SUPPORTED 692 for (ci = 0,
compptr = cinfo->comp_info; ci < cinfo->num_components;
695 #ifdef BLOCK_SMOOTHING_SUPPORTED 697 if (cinfo->progressive_mode)
700 coef->
whole_image[ci] = (*cinfo->mem->request_virt_barray)
712 ERREXIT(cinfo, JERR_NOT_COMPILED);
727 coef->
pub.coef_arrays = NULL;
decompress_smooth_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
#define JPEG_ROW_COMPLETED
start_iMCU_row(j_decompress_ptr cinfo)
jzero_far(void FAR *target, size_t bytestozero)
consume_data(j_decompress_ptr cinfo)
LOCAL(boolean) smoothing_ok JPP((j_decompress_ptr cinfo))
dummy_consume_data(j_decompress_ptr)
UINT16 quantval[DCTSIZE2]
jcopy_block_row(JBLOCKROW input_row, JBLOCKROW output_row, JDIMENSION num_blocks)
#define MAX_COMPS_IN_SCAN
#define D_MAX_BLOCKS_IN_MCU
jround_up(long a, long b)
struct jpeg_common_struct * j_common_ptr
#define ERREXIT(cinfo, code)
smoothing_ok(j_decompress_ptr cinfo)
jpeg_component_info * compptr
JDIMENSION width_in_blocks
jinit_d_coef_controller(j_decompress_ptr cinfo, boolean need_full_buffer)
struct jpeg_c_coef_controller pub
jpeg_component_info JCOEFPTR JSAMPARRAY JDIMENSION output_col
JDIMENSION height_in_blocks
GLint GLint GLint yoffset
decompress_onepass(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
start_output_pass(j_decompress_ptr cinfo)
METHODDEF(int) decompress_onepass JPP((j_decompress_ptr cinfo
start_input_pass(j_decompress_ptr cinfo)
decompress_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
my_coef_controller * my_coef_ptr
#define JPEG_SCAN_COMPLETED
JBLOCKROW MCU_buffer[C_MAX_BLOCKS_IN_MCU]
int MCU_rows_per_iMCU_row
jvirt_barray_ptr whole_image[MAX_COMPONENTS]