104 int numcols = (
int) (output_cols - input_cols);
108 ptr = image_data[
row] + input_cols;
133 for (ci = 0,
compptr = cinfo->comp_info; ci < cinfo->num_components;
135 in_ptr = input_buf[ci] + in_row_index;
155 int inrow, outrow, h_expand, v_expand, numpix, numpix2,
h,
v;
163 numpix = h_expand * v_expand;
171 cinfo->image_width, output_cols * h_expand);
174 while (inrow < cinfo->max_v_samp_factor) {
175 outptr = output_data[outrow];
176 for (outcol = 0, outcol_h = 0; outcol < output_cols;
177 outcol++, outcol_h += h_expand) {
179 for (
v = 0;
v < v_expand;
v++) {
180 inptr = input_data[inrow+
v] + outcol_h;
181 for (
h = 0;
h < h_expand;
h++) {
185 *outptr++ = (
JSAMPLE) ((outvalue + numpix2) / numpix);
205 cinfo->max_v_samp_factor, cinfo->image_width);
239 cinfo->image_width, output_cols * 2);
241 for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) {
242 outptr = output_data[inrow];
243 inptr = input_data[inrow];
245 for (outcol = 0; outcol < output_cols; outcol++) {
268 register JSAMPROW inptr0, inptr1, outptr;
276 cinfo->image_width, output_cols * 2);
279 while (inrow < cinfo->max_v_samp_factor) {
280 outptr = output_data[outrow];
281 inptr0 = input_data[inrow];
282 inptr1 = input_data[inrow+1];
284 for (outcol = 0; outcol < output_cols; outcol++) {
289 inptr0 += 2; inptr1 += 2;
297#ifdef INPUT_SMOOTHING_SUPPORTED
312 register JSAMPROW inptr0, inptr1, above_ptr, below_ptr, outptr;
313 INT32 membersum, neighsum, memberscale, neighscale;
339 while (inrow < cinfo->max_v_samp_factor) {
340 outptr = output_data[outrow];
341 inptr0 = input_data[inrow];
342 inptr1 = input_data[inrow+1];
343 above_ptr = input_data[inrow-1];
344 below_ptr = input_data[inrow+2];
353 neighsum += neighsum;
356 membersum = membersum * memberscale + neighsum * neighscale;
357 *outptr++ = (
JSAMPLE) ((membersum + 32768) >> 16);
358 inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
360 for (colctr = output_cols - 2; colctr > 0; colctr--) {
370 neighsum += neighsum;
375 membersum = membersum * memberscale + neighsum * neighscale;
377 *outptr++ = (
JSAMPLE) ((membersum + 32768) >> 16);
378 inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
388 neighsum += neighsum;
391 membersum = membersum * memberscale + neighsum * neighscale;
392 *outptr = (
JSAMPLE) ((membersum + 32768) >> 16);
413 register JSAMPROW inptr, above_ptr, below_ptr, outptr;
414 INT32 membersum, neighsum, memberscale, neighscale;
415 int colsum, lastcolsum, nextcolsum;
434 outptr = output_data[inrow];
435 inptr = input_data[inrow];
436 above_ptr = input_data[inrow-1];
437 below_ptr = input_data[inrow+1];
445 neighsum = colsum + (colsum - membersum) + nextcolsum;
446 membersum = membersum * memberscale + neighsum * neighscale;
447 *outptr++ = (
JSAMPLE) ((membersum + 32768) >> 16);
448 lastcolsum = colsum; colsum = nextcolsum;
450 for (colctr = output_cols - 2; colctr > 0; colctr--) {
452 above_ptr++; below_ptr++;
455 neighsum = lastcolsum + (colsum - membersum) + nextcolsum;
456 membersum = membersum * memberscale + neighsum * neighscale;
457 *outptr++ = (
JSAMPLE) ((membersum + 32768) >> 16);
458 lastcolsum = colsum; colsum = nextcolsum;
463 neighsum = lastcolsum + (colsum - membersum) + colsum;
464 membersum = membersum * memberscale + neighsum * neighscale;
465 *outptr = (
JSAMPLE) ((membersum + 32768) >> 16);
484 boolean smoothok =
TRUE;
485 int h_in_group, v_in_group, h_out_group, v_out_group;
489 cinfo->downsample = &downsample->
pub;
492 downsample->
pub.need_context_rows =
FALSE;
494 if (cinfo->CCIR601_sampling)
495 ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
498 for (ci = 0,
compptr = cinfo->comp_info; ci < cinfo->num_components;
504 cinfo->min_DCT_h_scaled_size;
506 cinfo->min_DCT_v_scaled_size;
507 h_in_group = cinfo->max_h_samp_factor;
508 v_in_group = cinfo->max_v_samp_factor;
510 if (h_in_group == h_out_group && v_in_group == v_out_group) {
511#ifdef INPUT_SMOOTHING_SUPPORTED
512 if (cinfo->smoothing_factor) {
513 downsample->
methods[ci] = fullsize_smooth_downsample;
514 downsample->
pub.need_context_rows =
TRUE;
518 }
else if (h_in_group == h_out_group * 2 &&
519 v_in_group == v_out_group) {
522 }
else if (h_in_group == h_out_group * 2 &&
523 v_in_group == v_out_group * 2) {
524#ifdef INPUT_SMOOTHING_SUPPORTED
525 if (cinfo->smoothing_factor) {
526 downsample->
methods[ci] = h2v2_smooth_downsample;
527 downsample->
pub.need_context_rows =
TRUE;
531 }
else if ((h_in_group % h_out_group) == 0 &&
532 (v_in_group % v_out_group) == 0) {
535 downsample->
h_expand[ci] = (
UINT8) (h_in_group / h_out_group);
536 downsample->
v_expand[ci] = (
UINT8) (v_in_group / v_out_group);
538 ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
541#ifdef INPUT_SMOOTHING_SUPPORTED
542 if (cinfo->smoothing_factor && !smoothok)
543 TRACEMS(cinfo, 0, JTRC_SMOOTH_NOTIMPL);
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
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
for(i=0;i< ARRAY_SIZE(offsets);i++)
GLuint GLuint GLsizei count
GLfloat GLfloat GLfloat GLfloat h
fullsize_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)
start_pass_downsample(j_compress_ptr cinfo)
h2v2_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)
jinit_downsampler(j_compress_ptr cinfo)
expand_right_edge(JSAMPARRAY image_data, int num_rows, JDIMENSION input_cols, JDIMENSION output_cols)
h2v1_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)
int_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)
my_downsampler * my_downsample_ptr
sep_downsample(j_compress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_index, JSAMPIMAGE output_buf, JDIMENSION out_row_group_index)
jpeg_component_info * compptr
jpeg_component_info JCOEFPTR JSAMPARRAY output_buf
#define TRACEMS(cinfo, lvl, code)
#define JMETHOD(type, methodname, arglist)
#define GETJSAMPLE(value)
struct jpeg_common_struct * j_common_ptr
jcopy_sample_rows(JSAMPARRAY input_array, JSAMPARRAY output_array, int num_rows, JDIMENSION num_cols)
JDIMENSION width_in_blocks
UINT8 h_expand[MAX_COMPONENTS]
struct jpeg_downsampler pub
int rowgroup_height[MAX_COMPONENTS]
downsample1_ptr methods[MAX_COMPONENTS]
UINT8 v_expand[MAX_COMPONENTS]