21 #define JPEG_INTERNALS
27 typedef JMETHOD(
void, upsample1_ptr,
101 if (upsample->
next_row_out >= cinfo->max_v_samp_factor) {
102 for (ci = 0,
compptr = cinfo->comp_info; ci < cinfo->num_components;
124 out_rows_avail -= *out_row_ctr;
128 (*cinfo->cconvert->color_convert) (cinfo, upsample->
color_buf,
139 (*in_row_group_ctr)++;
160 *output_data_ptr = input_data;
173 *output_data_ptr = NULL;
198 int h_expand, v_expand;
205 while (outrow < cinfo->max_v_samp_factor) {
207 inptr = input_data[inrow];
208 outptr = output_data[outrow];
209 outend = outptr + cinfo->output_width;
210 while (outptr < outend) {
212 for (h = h_expand; h > 0; h--) {
219 v_expand-1, cinfo->output_width);
242 for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) {
243 inptr = input_data[inrow];
244 outptr = output_data[inrow];
245 outend = outptr + cinfo->output_width;
246 while (outptr < outend) {
271 while (outrow < cinfo->max_v_samp_factor) {
272 inptr = input_data[inrow];
273 outptr = output_data[outrow];
274 outend = outptr + cinfo->output_width;
275 while (outptr < outend) {
281 1, cinfo->output_width);
309 register int invalue;
313 for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) {
314 inptr = input_data[inrow];
315 outptr = output_data[inrow];
349 register JSAMPROW inptr0, inptr1, outptr;
350 #if BITS_IN_JSAMPLE == 8
351 register int thiscolsum, lastcolsum, nextcolsum;
353 register INT32 thiscolsum, lastcolsum, nextcolsum;
356 int inrow, outrow, v;
359 while (outrow < cinfo->max_v_samp_factor) {
360 for (v = 0; v < 2; v++) {
362 inptr0 = input_data[inrow];
364 inptr1 = input_data[inrow-1];
366 inptr1 = input_data[inrow+1];
367 outptr = output_data[outrow++];
372 *outptr++ = (
JSAMPLE) ((thiscolsum * 4 + 8) >> 4);
373 *outptr++ = (
JSAMPLE) ((thiscolsum * 3 + nextcolsum + 7) >> 4);
374 lastcolsum = thiscolsum; thiscolsum = nextcolsum;
380 *outptr++ = (
JSAMPLE) ((thiscolsum * 3 + lastcolsum + 8) >> 4);
381 *outptr++ = (
JSAMPLE) ((thiscolsum * 3 + nextcolsum + 7) >> 4);
382 lastcolsum = thiscolsum; thiscolsum = nextcolsum;
386 *outptr++ = (
JSAMPLE) ((thiscolsum * 3 + lastcolsum + 8) >> 4);
387 *outptr++ = (
JSAMPLE) ((thiscolsum * 4 + 7) >> 4);
404 boolean need_buffer, do_fancy;
405 int h_in_group, v_in_group, h_out_group, v_out_group;
415 if (cinfo->CCIR601_sampling)
416 ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
421 do_fancy = cinfo->do_fancy_upsampling && cinfo->min_DCT_scaled_size > 1;
426 for (ci = 0,
compptr = cinfo->comp_info; ci < cinfo->num_components;
432 cinfo->min_DCT_scaled_size;
434 cinfo->min_DCT_scaled_size;
435 h_out_group = cinfo->max_h_samp_factor;
436 v_out_group = cinfo->max_v_samp_factor;
443 }
else if (h_in_group == h_out_group && v_in_group == v_out_group) {
447 }
else if (h_in_group * 2 == h_out_group &&
448 v_in_group == v_out_group) {
454 }
else if (h_in_group * 2 == h_out_group &&
455 v_in_group * 2 == v_out_group) {
462 }
else if ((h_out_group % h_in_group) == 0 &&
463 (v_out_group % v_in_group) == 0) {
469 ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
471 upsample->
color_buf[ci] = (*cinfo->mem->alloc_sarray)
474 (long) cinfo->max_h_samp_factor),