ReactOS 0.4.15-dev-7924-g5949c20
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 63 of file jdcoefct.c.

Function Documentation

◆ decompress_onepass()

decompress_onepass ( j_decompress_ptr  cinfo,
JSAMPIMAGE  output_buf 
)

Definition at line 148 of file jdcoefct.c.

149{
150 my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
151 JDIMENSION MCU_col_num; /* index of current MCU within row */
152 JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
153 JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
154 int blkn, ci, xindex, yindex, yoffset, useful_width;
155 JSAMPARRAY output_ptr;
158 inverse_DCT_method_ptr inverse_DCT;
159
160 /* Loop to process as much as one whole iMCU row */
161 for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
162 yoffset++) {
163 for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
164 MCU_col_num++) {
165 /* Try to fetch an MCU. Entropy decoder expects buffer to be zeroed. */
166 if (cinfo->lim_Se) /* can bypass in DC only case */
167 FMEMZERO((void FAR *) coef->MCU_buffer[0],
168 (size_t) (cinfo->blocks_in_MCU * SIZEOF(JBLOCK)));
169 if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
170 /* Suspension forced; update state counters and exit */
171 coef->MCU_vert_offset = yoffset;
172 coef->MCU_ctr = MCU_col_num;
173 return JPEG_SUSPENDED;
174 }
175 /* Determine where data should go in output_buf and do the IDCT thing.
176 * We skip dummy blocks at the right and bottom edges (but blkn gets
177 * incremented past them!). Note the inner loop relies on having
178 * allocated the MCU_buffer[] blocks sequentially.
179 */
180 blkn = 0; /* index of current DCT block within MCU */
181 for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
182 compptr = cinfo->cur_comp_info[ci];
183 /* Don't bother to IDCT an uninteresting component. */
184 if (! compptr->component_needed) {
185 blkn += compptr->MCU_blocks;
186 continue;
187 }
188 inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index];
189 useful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
191 output_ptr = output_buf[compptr->component_index] +
193 start_col = MCU_col_num * compptr->MCU_sample_width;
194 for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
195 if (cinfo->input_iMCU_row < last_iMCU_row ||
196 yoffset+yindex < compptr->last_row_height) {
198 for (xindex = 0; xindex < useful_width; xindex++) {
199 (*inverse_DCT) (cinfo, compptr,
200 (JCOEFPTR) coef->MCU_buffer[blkn+xindex],
201 output_ptr, output_col);
203 }
204 }
205 blkn += compptr->MCU_width;
206 output_ptr += compptr->DCT_v_scaled_size;
207 }
208 }
209 }
210 /* Completed an MCU row, but perhaps not an iMCU row */
211 coef->MCU_ctr = 0;
212 }
213 /* Completed the iMCU row, advance counters for next one */
214 cinfo->output_iMCU_row++;
215 if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
216 start_iMCU_row(cinfo);
217 return JPEG_ROW_COMPLETED;
218 }
219 /* Completed the scan */
220 (*cinfo->inputctl->finish_input_pass) (cinfo);
221 return JPEG_SCAN_COMPLETED;
222}
#define SIZEOF(_ar)
Definition: calc.h:97
#define FAR
Definition: zlib.h:34
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:63
jpeg_component_info JCOEFPTR JSAMPARRAY JDIMENSION output_col
Definition: jdct.h:239
JSAMPARRAY JDIMENSION start_col
Definition: jdct.h:169
jpeg_component_info * compptr
Definition: jdct.h:238
jpeg_component_info JCOEFPTR JSAMPARRAY output_buf
Definition: jdct.h:239
unsigned int JDIMENSION
Definition: jmorecfg.h:229
#define FMEMZERO(target, size)
Definition: jpegint.h:368
#define JPEG_SCAN_COMPLETED
Definition: jpeglib.h:1079
JCOEF FAR * JCOEFPTR
Definition: jpeglib.h:84
JCOEF JBLOCK[DCTSIZE2]
Definition: jpeglib.h:79
#define JPEG_ROW_COMPLETED
Definition: jpeglib.h:1078
JSAMPROW * JSAMPARRAY
Definition: jpeglib.h:76
#define JPEG_SUSPENDED
Definition: jpeglib.h:1045
#define for
Definition: utility.h:88
boolean component_needed
Definition: jpeglib.h:174
struct jpeg_d_coef_controller * coef
Definition: jpeglib.h:680
struct jpeg_inverse_dct * idct
Definition: jpeglib.h:685
JDIMENSION input_iMCU_row
Definition: jpeglib.h:543
JDIMENSION output_iMCU_row
Definition: jpeglib.h:550
JDIMENSION MCUs_per_row
Definition: jpeglib.h:653
JDIMENSION total_iMCU_rows
Definition: jpeglib.h:633
jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]
Definition: jpeglib.h:650
struct jpeg_input_controller * inputctl
Definition: jpeglib.h:682
struct jpeg_entropy_decoder * entropy
Definition: jpeglib.h:684
JDIMENSION MCU_ctr
Definition: jdcoefct.c:34
JBLOCKROW MCU_buffer[C_MAX_BLOCKS_IN_MCU]
Definition: jccoefct.c:52

Referenced by jinit_d_coef_controller().

◆ dummy_consume_data()

dummy_consume_data ( j_decompress_ptr  cinfo)

Definition at line 230 of file jdcoefct.c.

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

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 678 of file jdcoefct.c.

679{
680 my_coef_ptr coef;
681
682 coef = (my_coef_ptr)
683 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
685 cinfo->coef = (struct jpeg_d_coef_controller *) coef;
686 coef->pub.start_input_pass = start_input_pass;
687 coef->pub.start_output_pass = start_output_pass;
688#ifdef BLOCK_SMOOTHING_SUPPORTED
689 coef->coef_bits_latch = NULL;
690#endif
691
692 /* Create the coefficient buffer. */
693 if (need_full_buffer) {
694#ifdef D_MULTISCAN_FILES_SUPPORTED
695 /* Allocate a full-image virtual array for each component, */
696 /* padded to a multiple of samp_factor DCT blocks in each direction. */
697 /* Note we ask for a pre-zeroed array. */
698 int ci, access_rows;
700
701 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
702 ci++, compptr++) {
703 access_rows = compptr->v_samp_factor;
704#ifdef BLOCK_SMOOTHING_SUPPORTED
705 /* If block smoothing could be used, need a bigger window */
706 if (cinfo->progressive_mode)
707 access_rows *= 3;
708#endif
709 coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
710 ((j_common_ptr) cinfo, JPOOL_IMAGE, TRUE,
715 (JDIMENSION) access_rows);
716 }
717 coef->pub.consume_data = consume_data;
718 coef->pub.decompress_data = decompress_data;
719 coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
720#else
721 ERREXIT(cinfo, JERR_NOT_COMPILED);
722#endif
723 } else {
724 /* We only need a single-MCU buffer. */
726 int i;
727
728 buffer = (JBLOCKROW)
729 (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
731 for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
732 coef->MCU_buffer[i] = buffer + i;
733 }
734 if (cinfo->lim_Se == 0) /* DC only case: want to bypass later */
735 FMEMZERO((void FAR *) buffer,
736 (size_t) (D_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)));
737 coef->pub.consume_data = dummy_consume_data;
738 coef->pub.decompress_data = decompress_onepass;
739 coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
740 }
741}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
GLuint buffer
Definition: glext.h:5915
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
dummy_consume_data(j_decompress_ptr cinfo)
Definition: jdcoefct.c:230
start_input_pass(j_decompress_ptr cinfo)
Definition: jdcoefct.c:108
decompress_onepass(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
Definition: jdcoefct.c:148
start_output_pass(j_decompress_ptr cinfo)
Definition: jdcoefct.c:120
boolean need_full_buffer
Definition: jpegint.h:384
JBLOCK FAR * JBLOCKROW
Definition: jpeglib.h:80
struct jpeg_common_struct * j_common_ptr
Definition: jpeglib.h:284
#define JPOOL_IMAGE
Definition: jpeglib.h:808
#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:587
jpeg_component_info * comp_info
Definition: jpeglib.h:583
struct jpeg_c_coef_controller pub
Definition: jccoefct.c:36
jvirt_barray_ptr whole_image[MAX_COMPONENTS]
Definition: jccoefct.c:55

Referenced by master_selection(), and transdecode_master_selection().

◆ METHODDEF()

METHODDEF ( int  )

Definition at line 66 of file jdcoefct.c.

82{
83 my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
84
85 /* In an interleaved scan, an MCU row is the same as an iMCU row.
86 * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
87 * But at the bottom of the image, process only what's left.
88 */
89 if (cinfo->comps_in_scan > 1) {
90 coef->MCU_rows_per_iMCU_row = 1;
91 } else {
92 if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
93 coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
94 else
95 coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
96 }
97
98 coef->MCU_ctr = 0;
99 coef->MCU_vert_offset = 0;
100}
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 108 of file jdcoefct.c.

109{
110 cinfo->input_iMCU_row = 0;
111 start_iMCU_row(cinfo);
112}

Referenced by jinit_d_coef_controller().

◆ start_output_pass()

start_output_pass ( j_decompress_ptr  cinfo)

Definition at line 120 of file jdcoefct.c.

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

Referenced by jinit_d_coef_controller().