21 #define JPEG_INTERNALS 27 typedef JMETHOD(
void, upsample1_ptr,
74 upsample->next_row_out = cinfo->max_v_samp_factor;
76 upsample->rows_to_go = cinfo->output_height;
101 if (upsample->next_row_out >= cinfo->max_v_samp_factor) {
102 for (ci = 0,
compptr = cinfo->comp_info; ci < cinfo->num_components;
107 (*upsample->methods[ci]) (cinfo,
compptr,
108 input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]),
109 upsample->color_buf + ci);
111 upsample->next_row_out = 0;
121 if (
num_rows > upsample->rows_to_go)
124 out_rows_avail -= *out_row_ctr;
128 (*cinfo->cconvert->color_convert) (cinfo, upsample->color_buf,
130 output_buf + *out_row_ctr,
138 if (upsample->next_row_out >= cinfo->max_v_samp_factor)
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;
413 upsample->pub.need_context_rows =
FALSE;
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;
437 upsample->rowgroup_height[ci] = v_in_group;
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) {
459 upsample->pub.need_context_rows =
TRUE;
462 }
else if ((h_out_group % h_in_group) == 0 &&
463 (v_out_group % v_in_group) == 0) {
466 upsample->h_expand[ci] = (
UINT8) (h_out_group / h_in_group);
467 upsample->v_expand[ci] = (
UINT8) (v_out_group / v_in_group);
469 ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
471 upsample->color_buf[ci] = (*cinfo->mem->alloc_sarray)
474 (
long) cinfo->max_h_samp_factor),
start_pass_upsample(j_decompress_ptr cinfo)
noop_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
JDIMENSION downsampled_width
struct jpeg_common_struct * j_common_ptr
GLfloat GLfloat GLfloat GLfloat h
h2v1_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
#define GETJSAMPLE(value)
#define ERREXIT(cinfo, code)
jinit_upsampler(j_decompress_ptr cinfo)
my_upsampler * my_upsample_ptr
jpeg_component_info * compptr
jround_up(long a, long b)
int_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
int JSAMPARRAY int int num_rows
typedef long(ZCALLBACK *tell_file_func) OF((voidpf opaque
if(!abbox) return FT_THROW(Invalid_Argument)
my_upsampler * my_upsample_ptr
h2v2_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
sep_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
jpeg_component_info JCOEFPTR JSAMPARRAY output_buf
h2v2_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
h2v1_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
fullsize_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
jcopy_sample_rows(JSAMPARRAY input_array, int source_row, JSAMPARRAY output_array, int dest_row, int num_rows, JDIMENSION num_cols)
typedef JMETHOD(void, upsample1_ptr,(j_decompress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr))