103 int numcols = (
int) (output_cols - input_cols);
107 ptr = image_data[
row] + input_cols;
132 for (ci = 0,
compptr = cinfo->comp_info; ci < cinfo->num_components;
134 in_ptr = input_buf[ci] + in_row_index;
154 int inrow, outrow, h_expand, v_expand, numpix, numpix2,
h,
v;
162 numpix = h_expand * v_expand;
170 cinfo->image_width, output_cols * h_expand);
173 while (inrow < cinfo->max_v_samp_factor) {
174 outptr = output_data[outrow];
175 for (outcol = 0, outcol_h = 0; outcol < output_cols;
176 outcol++, outcol_h += h_expand) {
178 for (
v = 0;
v < v_expand;
v++) {
179 inptr = input_data[inrow+
v] + outcol_h;
180 for (
h = 0;
h < h_expand;
h++) {
184 *outptr++ = (
JSAMPLE) ((outvalue + numpix2) / numpix);
204 cinfo->max_v_samp_factor, cinfo->image_width);
238 cinfo->image_width, output_cols * 2);
240 for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) {
241 outptr = output_data[inrow];
242 inptr = input_data[inrow];
244 for (outcol = 0; outcol < output_cols; outcol++) {
267 register JSAMPROW inptr0, inptr1, outptr;
275 cinfo->image_width, output_cols * 2);
278 while (inrow < cinfo->max_v_samp_factor) {
279 outptr = output_data[outrow];
280 inptr0 = input_data[inrow];
281 inptr1 = input_data[inrow+1];
283 for (outcol = 0; outcol < output_cols; outcol++) {
288 inptr0 += 2; inptr1 += 2;
296#ifdef INPUT_SMOOTHING_SUPPORTED
311 register JSAMPROW inptr0, inptr1, above_ptr, below_ptr, outptr;
312 INT32 membersum, neighsum, memberscale, neighscale;
338 while (inrow < cinfo->max_v_samp_factor) {
339 outptr = output_data[outrow];
340 inptr0 = input_data[inrow];
341 inptr1 = input_data[inrow+1];
342 above_ptr = input_data[inrow-1];
343 below_ptr = input_data[inrow+2];
352 neighsum += neighsum;
355 membersum = membersum * memberscale + neighsum * neighscale;
356 *outptr++ = (
JSAMPLE) ((membersum + 32768) >> 16);
357 inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
359 for (colctr = output_cols - 2; colctr > 0; colctr--) {
369 neighsum += neighsum;
374 membersum = membersum * memberscale + neighsum * neighscale;
376 *outptr++ = (
JSAMPLE) ((membersum + 32768) >> 16);
377 inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
387 neighsum += neighsum;
390 membersum = membersum * memberscale + neighsum * neighscale;
391 *outptr = (
JSAMPLE) ((membersum + 32768) >> 16);
412 register JSAMPROW inptr, above_ptr, below_ptr, outptr;
413 INT32 membersum, neighsum, memberscale, neighscale;
414 int colsum, lastcolsum, nextcolsum;
433 outptr = output_data[inrow];
434 inptr = input_data[inrow];
435 above_ptr = input_data[inrow-1];
436 below_ptr = input_data[inrow+1];
444 neighsum = colsum + (colsum - membersum) + nextcolsum;
445 membersum = membersum * memberscale + neighsum * neighscale;
446 *outptr++ = (
JSAMPLE) ((membersum + 32768) >> 16);
447 lastcolsum = colsum; colsum = nextcolsum;
449 for (colctr = output_cols - 2; colctr > 0; colctr--) {
451 above_ptr++; below_ptr++;
454 neighsum = lastcolsum + (colsum - membersum) + nextcolsum;
455 membersum = membersum * memberscale + neighsum * neighscale;
456 *outptr++ = (
JSAMPLE) ((membersum + 32768) >> 16);
457 lastcolsum = colsum; colsum = nextcolsum;
462 neighsum = lastcolsum + (colsum - membersum) + colsum;
463 membersum = membersum * memberscale + neighsum * neighscale;
464 *outptr = (
JSAMPLE) ((membersum + 32768) >> 16);
483 boolean smoothok =
TRUE;
484 int h_in_group, v_in_group, h_out_group, v_out_group;
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 *
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)
int JSAMPARRAY int int num_rows
struct jpeg_common_struct * j_common_ptr
jcopy_sample_rows(JSAMPARRAY input_array, int source_row, JSAMPARRAY output_array, int dest_row, 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]