ReactOS 0.4.16-dev-117-g38f21f9
jcprepct.c File Reference
#include "jinclude.h"
#include "jpeglib.h"
Include dependency graph for jcprepct.c:

Go to the source code of this file.

Classes

struct  my_prep_controller
 

Macros

#define JPEG_INTERNALS
 

Typedefs

typedef my_prep_controllermy_prep_ptr
 

Functions

 start_pass_prep (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
 
 expand_bottom_edge (JSAMPARRAY image_data, JDIMENSION num_cols, int input_rows, int output_rows)
 
 pre_process_data (j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail, JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr, JDIMENSION out_row_groups_avail)
 
 jinit_c_prep_controller (j_compress_ptr cinfo, boolean need_full_buffer)
 

Macro Definition Documentation

◆ JPEG_INTERNALS

#define JPEG_INTERNALS

Definition at line 17 of file jcprepct.c.

Typedef Documentation

◆ my_prep_ptr

Definition at line 70 of file jcprepct.c.

Function Documentation

◆ expand_bottom_edge()

expand_bottom_edge ( JSAMPARRAY  image_data,
JDIMENSION  num_cols,
int  input_rows,
int  output_rows 
)

Definition at line 106 of file jcprepct.c.

108{
109 register int row;
110
111 for (row = input_rows; row < output_rows; row++) {
112 jcopy_sample_rows(image_data, input_rows-1, image_data, row,
113 1, num_cols);
114 }
115}
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
int JSAMPARRAY int int JDIMENSION num_cols
Definition: jpegint.h:421
jcopy_sample_rows(JSAMPARRAY input_array, int source_row, JSAMPARRAY output_array, int dest_row, int num_rows, JDIMENSION num_cols)
Definition: jutils.c:177

Referenced by pre_process_data().

◆ jinit_c_prep_controller()

jinit_c_prep_controller ( j_compress_ptr  cinfo,
boolean  need_full_buffer 
)

Definition at line 318 of file jcprepct.c.

319{
320 my_prep_ptr prep;
321 int ci;
323
324 if (need_full_buffer) /* safety check */
325 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
326
327 prep = (my_prep_ptr)
328 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
330 cinfo->prep = (struct jpeg_c_prep_controller *) prep;
331 prep->pub.start_pass = start_pass_prep;
332
333 /* Allocate the color conversion buffer.
334 * We make the buffer wide enough to allow the downsampler to edge-expand
335 * horizontally within the buffer, if it so chooses.
336 */
337 if (cinfo->downsample->need_context_rows) {
338 /* Set up to provide context rows */
339#ifdef CONTEXT_ROWS_SUPPORTED
340 prep->pub.pre_process_data = pre_process_context;
341 create_context_buffer(cinfo);
342#else
343 ERREXIT(cinfo, JERR_NOT_COMPILED);
344#endif
345 } else {
346 /* No context, just make it tall enough for one row group */
347 prep->pub.pre_process_data = pre_process_data;
348 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
349 ci++, compptr++) {
350 prep->color_buf[ci] = (*cinfo->mem->alloc_sarray)
351 ((j_common_ptr) cinfo, JPOOL_IMAGE,
353 cinfo->min_DCT_h_scaled_size *
356 }
357 }
358}
#define SIZEOF(_ar)
Definition: calc.h:97
start_pass_prep(j_compress_ptr cinfo, J_BUF_MODE pass_mode)
Definition: jcprepct.c:78
my_prep_controller * my_prep_ptr
Definition: jcprepct.c:70
pre_process_data(j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail, JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr, JDIMENSION out_row_groups_avail)
Definition: jcprepct.c:128
jpeg_component_info * compptr
Definition: jdct.h:238
unsigned int JDIMENSION
Definition: jmorecfg.h:229
boolean need_full_buffer
Definition: jpegint.h:384
struct jpeg_common_struct * j_common_ptr
Definition: jpeglib.h:284
#define JPOOL_IMAGE
Definition: jpeglib.h:808
#define ERREXIT(msg)
Definition: rdjpgcom.c:72
JDIMENSION width_in_blocks
Definition: jpeglib.h:148
jpeg_component_info * comp_info
Definition: jpeglib.h:333
struct jpeg_downsampler * downsample
Definition: jpeglib.h:449
struct jpeg_c_prep_controller * prep
Definition: jpeglib.h:445
struct jpeg_c_prep_controller pub
Definition: jcprepct.c:54
JSAMPARRAY color_buf[MAX_COMPONENTS]
Definition: jcprepct.c:59

Referenced by jinit_compress_master().

◆ pre_process_data()

pre_process_data ( j_compress_ptr  cinfo,
JSAMPARRAY  input_buf,
JDIMENSION in_row_ctr,
JDIMENSION  in_rows_avail,
JSAMPIMAGE  output_buf,
JDIMENSION out_row_group_ctr,
JDIMENSION  out_row_groups_avail 
)

Definition at line 128 of file jcprepct.c.

133{
134 my_prep_ptr prep = (my_prep_ptr) cinfo->prep;
135 int numrows, ci;
136 JDIMENSION inrows;
138
139 while (*in_row_ctr < in_rows_avail &&
140 *out_row_group_ctr < out_row_groups_avail) {
141 /* Do color conversion to fill the conversion buffer. */
142 inrows = in_rows_avail - *in_row_ctr;
143 numrows = cinfo->max_v_samp_factor - prep->next_buf_row;
144 numrows = (int) MIN((JDIMENSION) numrows, inrows);
145 (*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr,
146 prep->color_buf,
147 (JDIMENSION) prep->next_buf_row,
148 numrows);
149 *in_row_ctr += numrows;
150 prep->next_buf_row += numrows;
151 prep->rows_to_go -= numrows;
152 /* If at bottom of image, pad to fill the conversion buffer. */
153 if (prep->rows_to_go == 0 &&
154 prep->next_buf_row < cinfo->max_v_samp_factor) {
155 for (ci = 0; ci < cinfo->num_components; ci++) {
156 expand_bottom_edge(prep->color_buf[ci], cinfo->image_width,
157 prep->next_buf_row, cinfo->max_v_samp_factor);
158 }
159 prep->next_buf_row = cinfo->max_v_samp_factor;
160 }
161 /* If we've filled the conversion buffer, empty it. */
162 if (prep->next_buf_row == cinfo->max_v_samp_factor) {
163 (*cinfo->downsample->downsample) (cinfo,
164 prep->color_buf, (JDIMENSION) 0,
165 output_buf, *out_row_group_ctr);
166 prep->next_buf_row = 0;
167 (*out_row_group_ctr)++;
168 }
169 /* If at bottom of image, pad the output to a full iMCU height.
170 * Note we assume the caller is providing a one-iMCU-height output buffer!
171 */
172 if (prep->rows_to_go == 0 &&
173 *out_row_group_ctr < out_row_groups_avail) {
174 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
175 ci++, compptr++) {
180 (int) (*out_row_group_ctr * numrows),
181 (int) (out_row_groups_avail * numrows));
182 }
183 *out_row_group_ctr = out_row_groups_avail;
184 break; /* can exit outer loop without test */
185 }
186 }
187}
#define MIN(x, y)
Definition: rdesktop.h:171
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
expand_bottom_edge(JSAMPARRAY image_data, JDIMENSION num_cols, int input_rows, int output_rows)
Definition: jcprepct.c:106
jpeg_component_info JCOEFPTR JSAMPARRAY output_buf
Definition: jdct.h:239
struct jpeg_color_converter * cconvert
Definition: jpeglib.h:448
JDIMENSION image_width
Definition: jpeglib.h:302
JDIMENSION rows_to_go
Definition: jcprepct.c:61

Referenced by jinit_c_prep_controller().

◆ start_pass_prep()

start_pass_prep ( j_compress_ptr  cinfo,
J_BUF_MODE  pass_mode 
)

Definition at line 78 of file jcprepct.c.

79{
80 my_prep_ptr prep = (my_prep_ptr) cinfo->prep;
81
82 if (pass_mode != JBUF_PASS_THRU)
83 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
84
85 /* Initialize total-height counter for detecting bottom of image */
86 prep->rows_to_go = cinfo->image_height;
87 /* Mark the conversion buffer empty */
88 prep->next_buf_row = 0;
89#ifdef CONTEXT_ROWS_SUPPORTED
90 /* Preset additional state variables for context mode.
91 * These aren't used in non-context mode, so we needn't test which mode.
92 */
93 prep->this_row_group = 0;
94 /* Set next_buf_stop to stop after two row groups have been read in. */
95 prep->next_buf_stop = 2 * cinfo->max_v_samp_factor;
96#endif
97}
@ JBUF_PASS_THRU
Definition: jpegint.h:18
if(dx< 0)
Definition: linetemp.h:194
JDIMENSION image_height
Definition: jpeglib.h:303

Referenced by jinit_c_prep_controller().