48 #define JPEG_INTERNALS 54 typedef JMETHOD(
void, downsample1_ptr,
94 int numcols = (
int) (output_cols - input_cols);
97 for (row = 0; row <
num_rows; row++) {
98 ptr = image_data[
row] + input_cols;
100 for (count = numcols; count > 0; count--)
123 for (ci = 0,
compptr = cinfo->comp_info; ci < cinfo->num_components;
125 in_ptr = input_buf[ci] + in_row_index;
143 int inrow, outrow, h_expand, v_expand, numpix, numpix2, h, v;
151 numpix = h_expand * v_expand;
159 cinfo->image_width, output_cols * h_expand);
163 outptr = output_data[outrow];
164 for (outcol = 0, outcol_h = 0; outcol < output_cols;
165 outcol++, outcol_h += h_expand) {
167 for (v = 0; v < v_expand; v++) {
168 inptr = input_data[inrow+v] + outcol_h;
169 for (h = 0; h < h_expand; h++) {
173 *outptr++ = (
JSAMPLE) ((outvalue + numpix2) / numpix);
192 cinfo->max_v_samp_factor, cinfo->image_width);
226 cinfo->image_width, output_cols * 2);
229 outptr = output_data[outrow];
230 inptr = input_data[outrow];
232 for (outcol = 0; outcol < output_cols; outcol++) {
255 register JSAMPROW inptr0, inptr1, outptr;
263 cinfo->image_width, output_cols * 2);
267 outptr = output_data[outrow];
268 inptr0 = input_data[inrow];
269 inptr1 = input_data[inrow+1];
271 for (outcol = 0; outcol < output_cols; outcol++) {
276 inptr0 += 2; inptr1 += 2;
283 #ifdef INPUT_SMOOTHING_SUPPORTED 298 register JSAMPROW inptr0, inptr1, above_ptr, below_ptr, outptr;
299 INT32 membersum, neighsum, memberscale, neighscale;
306 cinfo->image_width, output_cols * 2);
321 memberscale = 16384 - cinfo->smoothing_factor * 80;
322 neighscale = cinfo->smoothing_factor * 16;
326 outptr = output_data[outrow];
327 inptr0 = input_data[inrow];
328 inptr1 = input_data[inrow+1];
329 above_ptr = input_data[inrow-1];
330 below_ptr = input_data[inrow+2];
339 neighsum += neighsum;
342 membersum = membersum * memberscale + neighsum * neighscale;
343 *outptr++ = (
JSAMPLE) ((membersum + 32768) >> 16);
344 inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
346 for (colctr = output_cols - 2; colctr > 0; colctr--) {
356 neighsum += neighsum;
361 membersum = membersum * memberscale + neighsum * neighscale;
363 *outptr++ = (
JSAMPLE) ((membersum + 32768) >> 16);
364 inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
374 neighsum += neighsum;
377 membersum = membersum * memberscale + neighsum * neighscale;
378 *outptr = (
JSAMPLE) ((membersum + 32768) >> 16);
398 register JSAMPROW inptr, above_ptr, below_ptr, outptr;
399 INT32 membersum, neighsum, memberscale, neighscale;
400 int colsum, lastcolsum, nextcolsum;
407 cinfo->image_width, output_cols);
415 memberscale = 65536L - cinfo->smoothing_factor * 512L;
416 neighscale = cinfo->smoothing_factor * 64;
419 outptr = output_data[outrow];
420 inptr = input_data[outrow];
421 above_ptr = input_data[outrow-1];
422 below_ptr = input_data[outrow+1];
430 neighsum = colsum + (colsum - membersum) + nextcolsum;
431 membersum = membersum * memberscale + neighsum * neighscale;
432 *outptr++ = (
JSAMPLE) ((membersum + 32768) >> 16);
433 lastcolsum = colsum; colsum = nextcolsum;
435 for (colctr = output_cols - 2; colctr > 0; colctr--) {
437 above_ptr++; below_ptr++;
440 neighsum = lastcolsum + (colsum - membersum) + nextcolsum;
441 membersum = membersum * memberscale + neighsum * neighscale;
442 *outptr++ = (
JSAMPLE) ((membersum + 32768) >> 16);
443 lastcolsum = colsum; colsum = nextcolsum;
448 neighsum = lastcolsum + (colsum - membersum) + colsum;
449 membersum = membersum * memberscale + neighsum * neighscale;
450 *outptr = (
JSAMPLE) ((membersum + 32768) >> 16);
469 boolean smoothok =
TRUE;
479 if (cinfo->CCIR601_sampling)
480 ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
483 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
487 #ifdef INPUT_SMOOTHING_SUPPORTED 488 if (cinfo->smoothing_factor) {
494 }
else if (compptr->
h_samp_factor * 2 == cinfo->max_h_samp_factor &&
498 }
else if (compptr->
h_samp_factor * 2 == cinfo->max_h_samp_factor &&
500 #ifdef INPUT_SMOOTHING_SUPPORTED 501 if (cinfo->smoothing_factor) {
507 }
else if ((cinfo->max_h_samp_factor % compptr->
h_samp_factor) == 0 &&
512 ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
515 #ifdef INPUT_SMOOTHING_SUPPORTED 516 if (cinfo->smoothing_factor && !smoothok)
517 TRACEMS(cinfo, 0, JTRC_SMOOTH_NOTIMPL);
typedef JMETHOD(void, downsample1_ptr,(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data))
h2v1_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)
fullsize_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)
struct jpeg_common_struct * j_common_ptr
#define GETJSAMPLE(value)
#define ERREXIT(cinfo, code)
expand_right_edge(JSAMPARRAY image_data, int num_rows, JDIMENSION input_cols, JDIMENSION output_cols)
jpeg_component_info * compptr
JDIMENSION width_in_blocks
#define TRACEMS(cinfo, lvl, code)
h2v2_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
int JSAMPARRAY int int num_rows
jinit_downsampler(j_compress_ptr cinfo)
struct jpeg_downsampler pub
h2v2_smooth_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)
sep_downsample(j_compress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_index, JSAMPIMAGE output_buf, JDIMENSION out_row_group_index)
start_pass_downsample(j_compress_ptr cinfo)
downsample1_ptr methods[MAX_COMPONENTS]
jpeg_component_info JCOEFPTR JSAMPARRAY output_buf
fullsize_smooth_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)
jcopy_sample_rows(JSAMPARRAY input_array, int source_row, JSAMPARRAY output_array, int dest_row, int num_rows, JDIMENSION num_cols)
boolean need_context_rows