ReactOS 0.4.16-dev-2613-g9533ad7
jdcoefct.c File Reference
#include "jinclude.h"
#include "jpeglib.h"
Include dependency graph for jdcoefct.c:

Go to the source code of this file.

Classes

struct  my_coef_controller
 

Macros

#define JPEG_INTERNALS
 

Typedefs

typedef my_coef_controllermy_coef_ptr
 

Functions

 METHODDEF (int)
 
 start_input_pass (j_decompress_ptr cinfo)
 
 start_output_pass (j_decompress_ptr cinfo)
 
 decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
 
 dummy_consume_data (j_decompress_ptr cinfo)
 
 jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
 

Macro Definition Documentation

◆ JPEG_INTERNALS

#define JPEG_INTERNALS

Definition at line 18 of file jdcoefct.c.

Typedef Documentation

◆ my_coef_ptr

Definition at line 65 of file jdcoefct.c.

Function Documentation

◆ decompress_onepass()

decompress_onepass ( j_decompress_ptr  cinfo,
JSAMPIMAGE  output_buf 
)

Definition at line 151 of file jdcoefct.c.

152{
153 my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
154 JDIMENSION MCU_col_num; /* index of current MCU within row */
155 JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
156 JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
157 int ci, xindex, yindex, yoffset, useful_width;
158 JBLOCKROW blkp;
159 JSAMPARRAY output_ptr;
162 inverse_DCT_method_ptr inverse_DCT;
163
164 /* Loop to process as much as one whole iMCU row */
165 for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
166 yoffset++) {
167 for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
168 MCU_col_num++) {
169 blkp = coef->blk_buffer; /* pointer to current DCT block within MCU */
170 /* Try to fetch an MCU. Entropy decoder expects buffer to be zeroed. */
171 if (cinfo->lim_Se) /* can bypass in DC only case */
172 MEMZERO(blkp, cinfo->blocks_in_MCU * SIZEOF(JBLOCK));
173 if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
174 /* Suspension forced; update state counters and exit */
175 coef->MCU_vert_offset = yoffset;
176 coef->MCU_ctr = MCU_col_num;
177 return JPEG_SUSPENDED;
178 }
179 /* Determine where data should go in output_buf and do the IDCT thing.
180 * We skip dummy blocks at the right and bottom edges (but blkp gets
181 * incremented past them!).
182 */
183 for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
184 compptr = cinfo->cur_comp_info[ci];
185 /* Don't bother to IDCT an uninteresting component. */
186 if (! compptr->component_needed) {
187 blkp += compptr->MCU_blocks;
188 continue;
189 }
190 inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index];
191 output_ptr = output_buf[compptr->component_index] +
193 useful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
195 start_col = MCU_col_num * compptr->MCU_sample_width;
196 for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
197 if (cinfo->input_iMCU_row < last_iMCU_row ||
198 yoffset + yindex < compptr->last_row_height) {
200 for (xindex = 0; xindex < useful_width; xindex++) {
201 (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) (blkp + xindex),
202 output_ptr, output_col);
204 }
205 output_ptr += compptr->DCT_v_scaled_size;
206 }
207 blkp += compptr->MCU_width;
208 }
209 }
210 }
211 /* Completed an MCU row, but perhaps not an iMCU row */
212 coef->MCU_ctr = 0;
213 }
214 /* Completed the iMCU row, advance counters for next one */
215 cinfo->output_iMCU_row++;
216 if (++(cinfo->input_iMCU_row) <= last_iMCU_row) {
217 start_iMCU_row(cinfo);
218 return JPEG_ROW_COMPLETED;
219 }
220 /* Completed the scan */
221 (*cinfo->inputctl->finish_input_pass) (cinfo);
222 return JPEG_SCAN_COMPLETED;
223}
#define SIZEOF(_ar)
Definition: calc.h:97
for(i=0;i< ARRAY_SIZE(offsets);i++)
GLint GLint GLint yoffset
Definition: gl.h:1547
start_iMCU_row(j_compress_ptr cinfo)
Definition: jctrans.c:242
my_coef_controller * my_coef_ptr
Definition: jdcoefct.c:65
jpeg_component_info JCOEFPTR JSAMPARRAY JDIMENSION output_col
Definition: jdct.h:253
JSAMPARRAY JDIMENSION start_col
Definition: jdct.h:183
jpeg_component_info * compptr
Definition: jdct.h:252
jpeg_component_info JCOEFPTR JSAMPARRAY output_buf
Definition: jdct.h:253
unsigned int JDIMENSION
Definition: jmorecfg.h:265
JBLOCK FAR * JBLOCKROW
Definition: jpeglib.h:80
#define JPEG_SCAN_COMPLETED
Definition: jpeglib.h:1081
JCOEF FAR * JCOEFPTR
Definition: jpeglib.h:84
JCOEF JBLOCK[DCTSIZE2]
Definition: jpeglib.h:79
#define JPEG_ROW_COMPLETED
Definition: jpeglib.h:1080
JSAMPROW * JSAMPARRAY
Definition: jpeglib.h:76
#define JPEG_SUSPENDED
Definition: jpeglib.h:1047
boolean component_needed
Definition: jpeglib.h:174
struct jpeg_d_coef_controller * coef
Definition: jpeglib.h:682
struct jpeg_inverse_dct * idct
Definition: jpeglib.h:687
JDIMENSION input_iMCU_row
Definition: jpeglib.h:544
JDIMENSION output_iMCU_row
Definition: jpeglib.h:551
JDIMENSION MCUs_per_row
Definition: jpeglib.h:655
JDIMENSION total_iMCU_rows
Definition: jpeglib.h:635
jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]
Definition: jpeglib.h:652
struct jpeg_input_controller * inputctl
Definition: jpeglib.h:684
struct jpeg_entropy_decoder * entropy
Definition: jpeglib.h:686
JDIMENSION MCU_ctr
Definition: jccoefct.c:39
JBLOCK blk_buffer[C_MAX_BLOCKS_IN_MCU]
Definition: jccoefct.c:56
JBLOCKROW MCU_buffer[C_MAX_BLOCKS_IN_MCU]
Definition: jccoefct.c:50
#define MEMZERO(addr, type, size)
Definition: svc_dg.c:324

Referenced by jinit_d_coef_controller().

◆ dummy_consume_data()

dummy_consume_data ( j_decompress_ptr  cinfo)

Definition at line 231 of file jdcoefct.c.

232{
233 return JPEG_SUSPENDED; /* Always indicate nothing was done */
234}

Referenced by jinit_d_coef_controller().

◆ jinit_d_coef_controller()

jinit_d_coef_controller ( j_decompress_ptr  cinfo,
boolean  need_full_buffer 
)

Definition at line 680 of file jdcoefct.c.

681{
682 my_coef_ptr coef;
683
684 if (need_full_buffer) {
685#ifdef D_MULTISCAN_FILES_SUPPORTED
686 /* Allocate a full-image virtual array for each component, */
687 /* padded to a multiple of samp_factor DCT blocks in each direction. */
688 /* Note we ask for a pre-zeroed array. */
689 int ci, access_rows;
691
692 coef = (my_coef_ptr) (*cinfo->mem->alloc_small)
693 ((j_common_ptr) cinfo, JPOOL_IMAGE,
695 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
696 ci++, compptr++) {
697 access_rows = compptr->v_samp_factor;
698#ifdef BLOCK_SMOOTHING_SUPPORTED
699 /* If block smoothing could be used, need a bigger window */
700 if (cinfo->progressive_mode)
701 access_rows *= 3;
702#endif
703 coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
704 ((j_common_ptr) cinfo, JPOOL_IMAGE, TRUE,
709 (JDIMENSION) access_rows);
710 }
711 coef->pub.consume_data = consume_data;
712 coef->pub.decompress_data = decompress_data;
713 coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
714#else
715 ERREXIT(cinfo, JERR_NOT_COMPILED);
716#endif
717 } else {
718 /* We only need a single-MCU buffer. */
719 JBLOCKARRAY blkp;
720 JBLOCKROW buffer_ptr;
721 int bi;
722
723 coef = (my_coef_ptr) (*cinfo->mem->alloc_small)
725 buffer_ptr = coef->blk_buffer;
726 if (cinfo->lim_Se == 0) /* DC only case: want to bypass later */
727 MEMZERO(buffer_ptr, SIZEOF(coef->blk_buffer));
728 blkp = coef->MCU_buffer;
730 do {
731 *blkp++ = buffer_ptr++;
732 } while (--bi);
733 coef->pub.consume_data = dummy_consume_data;
734 coef->pub.decompress_data = decompress_onepass;
735 coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
736 }
737
738 coef->pub.start_input_pass = start_input_pass;
739 coef->pub.start_output_pass = start_output_pass;
740#ifdef BLOCK_SMOOTHING_SUPPORTED
741 coef->coef_bits_latch = NULL;
742#endif
743 cinfo->coef = &coef->pub;
744}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
dummy_consume_data(j_decompress_ptr cinfo)
Definition: jdcoefct.c:231
start_input_pass(j_decompress_ptr cinfo)
Definition: jdcoefct.c:111
decompress_onepass(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
Definition: jdcoefct.c:151
start_output_pass(j_decompress_ptr cinfo)
Definition: jdcoefct.c:123
boolean need_full_buffer
Definition: jpegint.h:383
struct jpeg_common_struct * j_common_ptr
Definition: jpeglib.h:284
JBLOCKROW * JBLOCKARRAY
Definition: jpeglib.h:81
#define JPOOL_IMAGE
Definition: jpeglib.h:810
#define D_MAX_BLOCKS_IN_MCU
Definition: jpeglib.h:66
jround_up(long a, long b)
Definition: jutils.c:133
#define long
Definition: qsort.c:33
#define ERREXIT(msg)
Definition: rdjpgcom.c:72
JDIMENSION width_in_blocks
Definition: jpeglib.h:148
JDIMENSION height_in_blocks
Definition: jpeglib.h:149
boolean progressive_mode
Definition: jpeglib.h:588
jpeg_component_info * comp_info
Definition: jpeglib.h:584
struct jpeg_c_coef_controller pub
Definition: jccoefct.c:36
jvirt_barray_ptr whole_image[MAX_COMPONENTS]
Definition: jccoefct.c:53

Referenced by master_selection(), and transdecode_master_selection().

◆ METHODDEF()

METHODDEF ( int  )

Definition at line 69 of file jdcoefct.c.

85{
86 my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
87
88 /* In an interleaved scan, an MCU row is the same as an iMCU row.
89 * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
90 * But at the bottom of the image, process only what's left.
91 */
92 if (cinfo->comps_in_scan > 1) {
93 coef->MCU_rows_per_iMCU_row = 1;
94 } else {
95 if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
96 coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
97 else
98 coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
99 }
100
101 coef->MCU_ctr = 0;
102 coef->MCU_vert_offset = 0;
103}
if(dx< 0)
Definition: linetemp.h:194
int MCU_rows_per_iMCU_row
Definition: jccoefct.c:41

◆ start_input_pass()

start_input_pass ( j_decompress_ptr  cinfo)

Definition at line 111 of file jdcoefct.c.

112{
113 cinfo->input_iMCU_row = 0;
114 start_iMCU_row(cinfo);
115}

Referenced by jinit_d_coef_controller().

◆ start_output_pass()

start_output_pass ( j_decompress_ptr  cinfo)

Definition at line 123 of file jdcoefct.c.

124{
125#ifdef BLOCK_SMOOTHING_SUPPORTED
126 my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
127
128 /* If multipass, check to see whether to use block smoothing on this pass */
129 if (coef->pub.coef_arrays != NULL) {
130 if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
131 coef->pub.decompress_data = decompress_smooth_data;
132 else
133 coef->pub.decompress_data = decompress_data;
134 }
135#endif
136 cinfo->output_iMCU_row = 0;
137}
boolean do_block_smoothing
Definition: jpeglib.h:490

Referenced by jinit_d_coef_controller().