10 #define JPEG_INTERNALS 16 typedef JMETHOD(
void, downsample1_ptr,
56 int numcols = (int) (output_cols - input_cols);
60 ptr = image_data[
row] + input_cols;
85 for (ci = 0,
compptr = cinfo->comp_info; ci < cinfo->num_components;
105 int inrow, outrow, h_expand, v_expand, numpix, numpix2, h,
v;
113 numpix = h_expand * v_expand;
121 cinfo->image_width, output_cols * h_expand);
125 outptr = output_data[outrow];
126 for (outcol = 0, outcol_h = 0; outcol < output_cols;
127 outcol++, outcol_h += h_expand) {
129 for (
v = 0;
v < v_expand;
v++) {
130 inptr = input_data[inrow+
v] + outcol_h;
131 for (h = 0; h < h_expand; h++) {
135 *outptr++ = (
JSAMPLE) ((outvalue + numpix2) / numpix);
154 cinfo->max_v_samp_factor, cinfo->image_width);
188 cinfo->image_width, output_cols * 2);
191 outptr = output_data[outrow];
192 inptr = input_data[outrow];
194 for (outcol = 0; outcol < output_cols; outcol++) {
225 cinfo->image_width, output_cols * 2);
229 outptr = output_data[outrow];
230 inptr0 = input_data[inrow];
231 inptr1 = input_data[inrow+1];
233 for (outcol = 0; outcol < output_cols; outcol++) {
238 inptr0 += 2; inptr1 += 2;
245 #ifdef INPUT_SMOOTHING_SUPPORTED 260 JSAMPROW inptr0, inptr1, above_ptr, below_ptr, outptr;
261 INT32 membersum, neighsum, memberscale, neighscale;
268 cinfo->image_width, output_cols * 2);
283 memberscale = 16384 - cinfo->smoothing_factor * 80;
284 neighscale = cinfo->smoothing_factor * 16;
288 outptr = output_data[outrow];
289 inptr0 = input_data[inrow];
290 inptr1 = input_data[inrow+1];
291 above_ptr = input_data[inrow-1];
292 below_ptr = input_data[inrow+2];
301 neighsum += neighsum;
304 membersum = membersum * memberscale + neighsum * neighscale;
305 *outptr++ = (
JSAMPLE) ((membersum + 32768) >> 16);
306 inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
308 for (colctr = output_cols - 2; colctr > 0; colctr--) {
318 neighsum += neighsum;
323 membersum = membersum * memberscale + neighsum * neighscale;
325 *outptr++ = (
JSAMPLE) ((membersum + 32768) >> 16);
326 inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
336 neighsum += neighsum;
339 membersum = membersum * memberscale + neighsum * neighscale;
340 *outptr = (
JSAMPLE) ((membersum + 32768) >> 16);
360 JSAMPROW inptr, above_ptr, below_ptr, outptr;
361 INT32 membersum, neighsum, memberscale, neighscale;
362 int colsum, lastcolsum, nextcolsum;
369 cinfo->image_width, output_cols);
377 memberscale = 65536L - cinfo->smoothing_factor * 512L;
378 neighscale = cinfo->smoothing_factor * 64;
381 outptr = output_data[outrow];
382 inptr = input_data[outrow];
383 above_ptr = input_data[outrow-1];
384 below_ptr = input_data[outrow+1];
392 neighsum = colsum + (colsum - membersum) + nextcolsum;
393 membersum = membersum * memberscale + neighsum * neighscale;
394 *outptr++ = (
JSAMPLE) ((membersum + 32768) >> 16);
395 lastcolsum = colsum; colsum = nextcolsum;
397 for (colctr = output_cols - 2; colctr > 0; colctr--) {
399 above_ptr++; below_ptr++;
402 neighsum = lastcolsum + (colsum - membersum) + nextcolsum;
403 membersum = membersum * memberscale + neighsum * neighscale;
404 *outptr++ = (
JSAMPLE) ((membersum + 32768) >> 16);
405 lastcolsum = colsum; colsum = nextcolsum;
410 neighsum = lastcolsum + (colsum - membersum) + colsum;
411 membersum = membersum * memberscale + neighsum * neighscale;
412 *outptr = (
JSAMPLE) ((membersum + 32768) >> 16);
431 boolean smoothok =
TRUE;
441 if (cinfo->CCIR601_sampling)
442 ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
445 for (ci = 0,
compptr = cinfo->comp_info; ci < cinfo->num_components;
449 #ifdef INPUT_SMOOTHING_SUPPORTED 450 if (cinfo->smoothing_factor) {
462 #ifdef INPUT_SMOOTHING_SUPPORTED 463 if (cinfo->smoothing_factor) {
474 ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
477 #ifdef INPUT_SMOOTHING_SUPPORTED 478 if (cinfo->smoothing_factor && !smoothok)
479 TRACEMS(cinfo, 0, JTRC_SMOOTH_NOTIMPL);
jinit_downsampler(j_compress_ptr cinfo)
start_pass_downsample(j_compress_ptr)
GLuint GLuint GLsizei count
my_downsampler * my_downsample_ptr
h2v2_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)
struct jpeg_common_struct * j_common_ptr
int_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)
#define GETJSAMPLE(value)
#define ERREXIT(cinfo, code)
jpeg_component_info * compptr
JDIMENSION width_in_blocks
#define TRACEMS(cinfo, lvl, code)
jcopy_sample_rows(JSAMPARRAY input_array, int source_row, JSAMPARRAY output_array, int dest_row, int num_rows, JDIMENSION num_cols)
h2v1_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)
expand_right_edge(JSAMPARRAY image_data, int num_rows, JDIMENSION input_cols, JDIMENSION output_cols)
int JSAMPARRAY int int num_rows
sep_downsample(j_compress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_index, JSAMPIMAGE output_buf, JDIMENSION out_row_group_index)
struct jpeg_downsampler pub
GLenum GLenum GLvoid * row
downsample1_ptr methods[MAX_COMPONENTS]
fullsize_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)
fullsize_smooth_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)
boolean need_context_rows
typedef JMETHOD(void, downsample1_ptr,(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data))
h2v2_smooth_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)