17 #define JPEG_INTERNALS 27 #ifdef INPUT_SMOOTHING_SUPPORTED 28 #define CONTEXT_ROWS_SUPPORTED 64 #ifdef CONTEXT_ROWS_SUPPORTED 83 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
86 prep->rows_to_go = cinfo->image_height;
88 prep->next_buf_row = 0;
89 #ifdef CONTEXT_ROWS_SUPPORTED 93 prep->this_row_group = 0;
95 prep->next_buf_stop = 2 * cinfo->max_v_samp_factor;
107 int input_rows,
int output_rows)
111 for (
row = input_rows;
row < output_rows;
row++) {
139 while (*in_row_ctr < in_rows_avail &&
140 *out_row_group_ctr < out_row_groups_avail) {
142 inrows = in_rows_avail - *in_row_ctr;
143 numrows = cinfo->max_v_samp_factor - prep->next_buf_row;
145 (*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr,
149 *in_row_ctr += numrows;
150 prep->next_buf_row += numrows;
151 prep->rows_to_go -= numrows;
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++) {
157 prep->next_buf_row, cinfo->max_v_samp_factor);
159 prep->next_buf_row = cinfo->max_v_samp_factor;
162 if (prep->next_buf_row == cinfo->max_v_samp_factor) {
163 (*cinfo->downsample->downsample) (cinfo,
166 prep->next_buf_row = 0;
167 (*out_row_group_ctr)++;
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;
181 *out_row_group_ctr = out_row_groups_avail;
188 #ifdef CONTEXT_ROWS_SUPPORTED 203 int buf_height = cinfo->max_v_samp_factor * 3;
206 while (*out_row_group_ctr < out_row_groups_avail) {
207 if (*in_row_ctr < in_rows_avail) {
209 inrows = in_rows_avail - *in_row_ctr;
210 numrows = prep->next_buf_stop - prep->next_buf_row;
212 (*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr,
217 if (prep->rows_to_go == cinfo->image_height) {
218 for (ci = 0; ci < cinfo->num_components; ci++) {
220 for (row = 1; row <= cinfo->max_v_samp_factor; row++) {
222 prep->color_buf[ci], -row,
223 1, cinfo->image_width);
227 *in_row_ctr += numrows;
228 prep->next_buf_row += numrows;
229 prep->rows_to_go -= numrows;
232 if (prep->rows_to_go != 0)
235 if (prep->next_buf_row < prep->next_buf_stop) {
236 for (ci = 0; ci < cinfo->num_components; ci++) {
238 prep->next_buf_row, prep->next_buf_stop);
240 prep->next_buf_row = prep->next_buf_stop;
244 if (prep->next_buf_row == prep->next_buf_stop) {
245 (*cinfo->downsample->downsample) (cinfo,
249 (*out_row_group_ctr)++;
251 prep->this_row_group += cinfo->max_v_samp_factor;
252 if (prep->this_row_group >= buf_height)
253 prep->this_row_group = 0;
254 if (prep->next_buf_row >= buf_height)
255 prep->next_buf_row = 0;
256 prep->next_buf_stop = prep->next_buf_row + cinfo->max_v_samp_factor;
270 int rgroup_height = cinfo->max_v_samp_factor;
280 (cinfo->num_components * 5 * rgroup_height) *
283 for (ci = 0,
compptr = cinfo->comp_info; ci < cinfo->num_components;
289 true_buffer = (*cinfo->mem->alloc_sarray)
295 MEMCOPY(fake_buffer + rgroup_height, true_buffer,
298 for (
i = 0;
i < rgroup_height;
i++) {
299 fake_buffer[
i] = true_buffer[2 * rgroup_height +
i];
300 fake_buffer[4 * rgroup_height +
i] = true_buffer[
i];
302 prep->color_buf[ci] = fake_buffer + rgroup_height;
303 fake_buffer += 5 * rgroup_height;
322 ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
326 SIZEOF(my_prep_controller));
334 if (cinfo->downsample->need_context_rows) {
336 #ifdef CONTEXT_ROWS_SUPPORTED 340 ERREXIT(cinfo, JERR_NOT_COMPILED);
345 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
347 prep->color_buf[ci] = (*cinfo->mem->alloc_sarray)
struct jpeg_common_struct * j_common_ptr
pre_process_context(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)
#define ERREXIT(cinfo, code)
jpeg_component_info * compptr
JDIMENSION width_in_blocks
my_prep_controller * my_prep_ptr
GLenum GLenum GLvoid * row
start_pass_prep(j_compress_ptr cinfo, J_BUF_MODE pass_mode)
#define MEMCOPY(dest, src, size)
int JSAMPARRAY int int JDIMENSION num_cols
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)
if(!abbox) return FT_THROW(Invalid_Argument)
jpeg_component_info JCOEFPTR JSAMPARRAY output_buf
jcopy_sample_rows(JSAMPARRAY input_array, int source_row, JSAMPARRAY output_array, int dest_row, int num_rows, JDIMENSION num_cols)
create_context_buffer(j_compress_ptr cinfo)
jinit_c_prep_controller(j_compress_ptr cinfo, boolean need_full_buffer)