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;
126 out_ptr = output_buf[ci] + (out_row_group_index * compptr->v_samp_factor);
127 (*downsample->
methods[ci]) (cinfo, compptr, in_ptr, out_ptr);
143 int inrow, outrow, h_expand, v_expand, numpix, numpix2, h,
v;
151 numpix = h_expand * v_expand;
162 for (outrow = 0; outrow < compptr->
v_samp_factor; outrow++) {
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);
228 for (outrow = 0; outrow < compptr->
v_samp_factor; outrow++) {
229 outptr = output_data[outrow];
230 inptr = input_data[outrow];
232 for (outcol = 0; outcol < output_cols; outcol++) {
255 register JSAMPROW inptr0, inptr1, outptr;
266 for (outrow = 0; outrow < compptr->
v_samp_factor; outrow++) {
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;
325 for (outrow = 0; outrow < compptr->
v_samp_factor; outrow++) {
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;
418 for (outrow = 0; outrow < compptr->
v_samp_factor; outrow++) {
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);
466 my_downsample_ptr downsample;
469 boolean smoothok =
TRUE;
480 ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
483 for (ci = 0, compptr = cinfo->
comp_info; ci < cinfo->num_components;
487 #ifdef INPUT_SMOOTHING_SUPPORTED
500 #ifdef INPUT_SMOOTHING_SUPPORTED
512 ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
515 #ifdef INPUT_SMOOTHING_SUPPORTED
517 TRACEMS(cinfo, 0, JTRC_SMOOTH_NOTIMPL);
METHODDEF void int_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)
LOCAL void expand_right_edge(JSAMPARRAY image_data, int num_rows, JDIMENSION input_cols, JDIMENSION output_cols)
typedef JMETHOD(void, downsample1_ptr,(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data))
METHODDEF void sep_downsample(j_compress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_index, JSAMPIMAGE output_buf, JDIMENSION out_row_group_index)
GLOBAL void jcopy_sample_rows(JSAMPARRAY input_array, int source_row, JSAMPARRAY output_array, int dest_row, int num_rows, JDIMENSION num_cols)
struct jpeg_common_struct * j_common_ptr
#define GETJSAMPLE(value)
#define ERREXIT(cinfo, code)
JDIMENSION width_in_blocks
#define TRACEMS(cinfo, lvl, code)
METHODDEF void h2v2_smooth_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)
GLuint GLuint GLsizei count
my_downsampler * my_downsample_ptr
METHODDEF void fullsize_smooth_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)
struct jpeg_downsampler * downsample
GLOBAL void jinit_downsampler(j_compress_ptr cinfo)
struct jpeg_downsampler pub
METHODDEF void fullsize_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)
GLenum GLenum GLvoid * row
downsample1_ptr methods[MAX_COMPONENTS]
METHODDEF void start_pass_downsample(j_compress_ptr cinfo)
METHODDEF void h2v2_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)
METHODDEF void h2v1_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)
jpeg_component_info * comp_info
boolean need_context_rows