aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jcsample.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2013-01-13 18:54:10 +1000
committerDavid Walter Seikel2013-01-13 18:54:10 +1000
commit959831f4ef5a3e797f576c3de08cd65032c997ad (patch)
treee7351908be5995f0b325b2ebeaa02d5a34b82583 /libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jcsample.c
parentAdd info about changes to Irrlicht. (diff)
downloadSledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.zip
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.gz
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.bz2
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.xz
Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard.
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jcsample.c')
-rw-r--r--libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jcsample.c1090
1 files changed, 545 insertions, 545 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jcsample.c b/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jcsample.c
index 1aef8a6..4d36f85 100644
--- a/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jcsample.c
+++ b/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/jcsample.c
@@ -1,545 +1,545 @@
1/* 1/*
2 * jcsample.c 2 * jcsample.c
3 * 3 *
4 * Copyright (C) 1991-1996, Thomas G. Lane. 4 * Copyright (C) 1991-1996, Thomas G. Lane.
5 * This file is part of the Independent JPEG Group's software. 5 * This file is part of the Independent JPEG Group's software.
6 * For conditions of distribution and use, see the accompanying README file. 6 * For conditions of distribution and use, see the accompanying README file.
7 * 7 *
8 * This file contains downsampling routines. 8 * This file contains downsampling routines.
9 * 9 *
10 * Downsampling input data is counted in "row groups". A row group 10 * Downsampling input data is counted in "row groups". A row group
11 * is defined to be max_v_samp_factor pixel rows of each component, 11 * is defined to be max_v_samp_factor pixel rows of each component,
12 * from which the downsampler produces v_samp_factor sample rows. 12 * from which the downsampler produces v_samp_factor sample rows.
13 * A single row group is processed in each call to the downsampler module. 13 * A single row group is processed in each call to the downsampler module.
14 * 14 *
15 * The downsampler is responsible for edge-expansion of its output data 15 * The downsampler is responsible for edge-expansion of its output data
16 * to fill an integral number of DCT blocks horizontally. The source buffer 16 * to fill an integral number of DCT blocks horizontally. The source buffer
17 * may be modified if it is helpful for this purpose (the source buffer is 17 * may be modified if it is helpful for this purpose (the source buffer is
18 * allocated wide enough to correspond to the desired output width). 18 * allocated wide enough to correspond to the desired output width).
19 * The caller (the prep controller) is responsible for vertical padding. 19 * The caller (the prep controller) is responsible for vertical padding.
20 * 20 *
21 * The downsampler may request "context rows" by setting need_context_rows 21 * The downsampler may request "context rows" by setting need_context_rows
22 * during startup. In this case, the input arrays will contain at least 22 * during startup. In this case, the input arrays will contain at least
23 * one row group's worth of pixels above and below the passed-in data; 23 * one row group's worth of pixels above and below the passed-in data;
24 * the caller will create dummy rows at image top and bottom by replicating 24 * the caller will create dummy rows at image top and bottom by replicating
25 * the first or last real pixel row. 25 * the first or last real pixel row.
26 * 26 *
27 * An excellent reference for image resampling is 27 * An excellent reference for image resampling is
28 * Digital Image Warping, George Wolberg, 1990. 28 * Digital Image Warping, George Wolberg, 1990.
29 * Pub. by IEEE Computer Society Press, Los Alamitos, CA. ISBN 0-8186-8944-7. 29 * Pub. by IEEE Computer Society Press, Los Alamitos, CA. ISBN 0-8186-8944-7.
30 * 30 *
31 * The downsampling algorithm used here is a simple average of the source 31 * The downsampling algorithm used here is a simple average of the source
32 * pixels covered by the output pixel. The hi-falutin sampling literature 32 * pixels covered by the output pixel. The hi-falutin sampling literature
33 * refers to this as a "box filter". In general the characteristics of a box 33 * refers to this as a "box filter". In general the characteristics of a box
34 * filter are not very good, but for the specific cases we normally use (1:1 34 * filter are not very good, but for the specific cases we normally use (1:1
35 * and 2:1 ratios) the box is equivalent to a "triangle filter" which is not 35 * and 2:1 ratios) the box is equivalent to a "triangle filter" which is not
36 * nearly so bad. If you intend to use other sampling ratios, you'd be well 36 * nearly so bad. If you intend to use other sampling ratios, you'd be well
37 * advised to improve this code. 37 * advised to improve this code.
38 * 38 *
39 * A simple input-smoothing capability is provided. This is mainly intended 39 * A simple input-smoothing capability is provided. This is mainly intended
40 * for cleaning up color-dithered GIF input files (if you find it inadequate, 40 * for cleaning up color-dithered GIF input files (if you find it inadequate,
41 * we suggest using an external filtering program such as pnmconvol). When 41 * we suggest using an external filtering program such as pnmconvol). When
42 * enabled, each input pixel P is replaced by a weighted sum of itself and its 42 * enabled, each input pixel P is replaced by a weighted sum of itself and its
43 * eight neighbors. P's weight is 1-8*SF and each neighbor's weight is SF, 43 * eight neighbors. P's weight is 1-8*SF and each neighbor's weight is SF,
44 * where SF = (smoothing_factor / 1024). 44 * where SF = (smoothing_factor / 1024).
45 * Currently, smoothing is only supported for 2h2v sampling factors. 45 * Currently, smoothing is only supported for 2h2v sampling factors.
46 */ 46 */
47 47
48#define JPEG_INTERNALS 48#define JPEG_INTERNALS
49#include "jinclude.h" 49#include "jinclude.h"
50#include "jpeglib.h" 50#include "jpeglib.h"
51 51
52 52
53/* Pointer to routine to downsample a single component */ 53/* Pointer to routine to downsample a single component */
54typedef JMETHOD(void, downsample1_ptr, 54typedef JMETHOD(void, downsample1_ptr,
55 (j_compress_ptr cinfo, jpeg_component_info * compptr, 55 (j_compress_ptr cinfo, jpeg_component_info * compptr,
56 JSAMPARRAY input_data, JSAMPARRAY output_data)); 56 JSAMPARRAY input_data, JSAMPARRAY output_data));
57 57
58/* Private subobject */ 58/* Private subobject */
59 59
60typedef struct { 60typedef struct {
61 struct jpeg_downsampler pub; /* public fields */ 61 struct jpeg_downsampler pub; /* public fields */
62 62
63 /* Downsampling method pointers, one per component */ 63 /* Downsampling method pointers, one per component */
64 downsample1_ptr methods[MAX_COMPONENTS]; 64 downsample1_ptr methods[MAX_COMPONENTS];
65 65
66 /* Height of an output row group for each component. */ 66 /* Height of an output row group for each component. */
67 int rowgroup_height[MAX_COMPONENTS]; 67 int rowgroup_height[MAX_COMPONENTS];
68 68
69 /* These arrays save pixel expansion factors so that int_downsample need not 69 /* These arrays save pixel expansion factors so that int_downsample need not
70 * recompute them each time. They are unused for other downsampling methods. 70 * recompute them each time. They are unused for other downsampling methods.
71 */ 71 */
72 UINT8 h_expand[MAX_COMPONENTS]; 72 UINT8 h_expand[MAX_COMPONENTS];
73 UINT8 v_expand[MAX_COMPONENTS]; 73 UINT8 v_expand[MAX_COMPONENTS];
74} my_downsampler; 74} my_downsampler;
75 75
76typedef my_downsampler * my_downsample_ptr; 76typedef my_downsampler * my_downsample_ptr;
77 77
78 78
79/* 79/*
80 * Initialize for a downsampling pass. 80 * Initialize for a downsampling pass.
81 */ 81 */
82 82
83METHODDEF(void) 83METHODDEF(void)
84start_pass_downsample (j_compress_ptr cinfo) 84start_pass_downsample (j_compress_ptr cinfo)
85{ 85{
86 /* no work for now */ 86 /* no work for now */
87} 87}
88 88
89 89
90/* 90/*
91 * Expand a component horizontally from width input_cols to width output_cols, 91 * Expand a component horizontally from width input_cols to width output_cols,
92 * by duplicating the rightmost samples. 92 * by duplicating the rightmost samples.
93 */ 93 */
94 94
95LOCAL(void) 95LOCAL(void)
96expand_right_edge (JSAMPARRAY image_data, int num_rows, 96expand_right_edge (JSAMPARRAY image_data, int num_rows,
97 JDIMENSION input_cols, JDIMENSION output_cols) 97 JDIMENSION input_cols, JDIMENSION output_cols)
98{ 98{
99 register JSAMPROW ptr; 99 register JSAMPROW ptr;
100 register JSAMPLE pixval; 100 register JSAMPLE pixval;
101 register int count; 101 register int count;
102 int row; 102 int row;
103 int numcols = (int) (output_cols - input_cols); 103 int numcols = (int) (output_cols - input_cols);
104 104
105 if (numcols > 0) { 105 if (numcols > 0) {
106 for (row = 0; row < num_rows; row++) { 106 for (row = 0; row < num_rows; row++) {
107 ptr = image_data[row] + input_cols; 107 ptr = image_data[row] + input_cols;
108 pixval = ptr[-1]; /* don't need GETJSAMPLE() here */ 108 pixval = ptr[-1]; /* don't need GETJSAMPLE() here */
109 for (count = numcols; count > 0; count--) 109 for (count = numcols; count > 0; count--)
110 *ptr++ = pixval; 110 *ptr++ = pixval;
111 } 111 }
112 } 112 }
113} 113}
114 114
115 115
116/* 116/*
117 * Do downsampling for a whole row group (all components). 117 * Do downsampling for a whole row group (all components).
118 * 118 *
119 * In this version we simply downsample each component independently. 119 * In this version we simply downsample each component independently.
120 */ 120 */
121 121
122METHODDEF(void) 122METHODDEF(void)
123sep_downsample (j_compress_ptr cinfo, 123sep_downsample (j_compress_ptr cinfo,
124 JSAMPIMAGE input_buf, JDIMENSION in_row_index, 124 JSAMPIMAGE input_buf, JDIMENSION in_row_index,
125 JSAMPIMAGE output_buf, JDIMENSION out_row_group_index) 125 JSAMPIMAGE output_buf, JDIMENSION out_row_group_index)
126{ 126{
127 my_downsample_ptr downsample = (my_downsample_ptr) cinfo->downsample; 127 my_downsample_ptr downsample = (my_downsample_ptr) cinfo->downsample;
128 int ci; 128 int ci;
129 jpeg_component_info * compptr; 129 jpeg_component_info * compptr;
130 JSAMPARRAY in_ptr, out_ptr; 130 JSAMPARRAY in_ptr, out_ptr;
131 131
132 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 132 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
133 ci++, compptr++) { 133 ci++, compptr++) {
134 in_ptr = input_buf[ci] + in_row_index; 134 in_ptr = input_buf[ci] + in_row_index;
135 out_ptr = output_buf[ci] + 135 out_ptr = output_buf[ci] +
136 (out_row_group_index * downsample->rowgroup_height[ci]); 136 (out_row_group_index * downsample->rowgroup_height[ci]);
137 (*downsample->methods[ci]) (cinfo, compptr, in_ptr, out_ptr); 137 (*downsample->methods[ci]) (cinfo, compptr, in_ptr, out_ptr);
138 } 138 }
139} 139}
140 140
141 141
142/* 142/*
143 * Downsample pixel values of a single component. 143 * Downsample pixel values of a single component.
144 * One row group is processed per call. 144 * One row group is processed per call.
145 * This version handles arbitrary integral sampling ratios, without smoothing. 145 * This version handles arbitrary integral sampling ratios, without smoothing.
146 * Note that this version is not actually used for customary sampling ratios. 146 * Note that this version is not actually used for customary sampling ratios.
147 */ 147 */
148 148
149METHODDEF(void) 149METHODDEF(void)
150int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, 150int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
151 JSAMPARRAY input_data, JSAMPARRAY output_data) 151 JSAMPARRAY input_data, JSAMPARRAY output_data)
152{ 152{
153 my_downsample_ptr downsample = (my_downsample_ptr) cinfo->downsample; 153 my_downsample_ptr downsample = (my_downsample_ptr) cinfo->downsample;
154 int inrow, outrow, h_expand, v_expand, numpix, numpix2, h, v; 154 int inrow, outrow, h_expand, v_expand, numpix, numpix2, h, v;
155 JDIMENSION outcol, outcol_h; /* outcol_h == outcol*h_expand */ 155 JDIMENSION outcol, outcol_h; /* outcol_h == outcol*h_expand */
156 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size; 156 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size;
157 JSAMPROW inptr, outptr; 157 JSAMPROW inptr, outptr;
158 INT32 outvalue; 158 INT32 outvalue;
159 159
160 h_expand = downsample->h_expand[compptr->component_index]; 160 h_expand = downsample->h_expand[compptr->component_index];
161 v_expand = downsample->v_expand[compptr->component_index]; 161 v_expand = downsample->v_expand[compptr->component_index];
162 numpix = h_expand * v_expand; 162 numpix = h_expand * v_expand;
163 numpix2 = numpix/2; 163 numpix2 = numpix/2;
164 164
165 /* Expand input data enough to let all the output samples be generated 165 /* Expand input data enough to let all the output samples be generated
166 * by the standard loop. Special-casing padded output would be more 166 * by the standard loop. Special-casing padded output would be more
167 * efficient. 167 * efficient.
168 */ 168 */
169 expand_right_edge(input_data, cinfo->max_v_samp_factor, 169 expand_right_edge(input_data, cinfo->max_v_samp_factor,
170 cinfo->image_width, output_cols * h_expand); 170 cinfo->image_width, output_cols * h_expand);
171 171
172 inrow = outrow = 0; 172 inrow = outrow = 0;
173 while (inrow < cinfo->max_v_samp_factor) { 173 while (inrow < cinfo->max_v_samp_factor) {
174 outptr = output_data[outrow]; 174 outptr = output_data[outrow];
175 for (outcol = 0, outcol_h = 0; outcol < output_cols; 175 for (outcol = 0, outcol_h = 0; outcol < output_cols;
176 outcol++, outcol_h += h_expand) { 176 outcol++, outcol_h += h_expand) {
177 outvalue = 0; 177 outvalue = 0;
178 for (v = 0; v < v_expand; v++) { 178 for (v = 0; v < v_expand; v++) {
179 inptr = input_data[inrow+v] + outcol_h; 179 inptr = input_data[inrow+v] + outcol_h;
180 for (h = 0; h < h_expand; h++) { 180 for (h = 0; h < h_expand; h++) {
181 outvalue += (INT32) GETJSAMPLE(*inptr++); 181 outvalue += (INT32) GETJSAMPLE(*inptr++);
182 } 182 }
183 } 183 }
184 *outptr++ = (JSAMPLE) ((outvalue + numpix2) / numpix); 184 *outptr++ = (JSAMPLE) ((outvalue + numpix2) / numpix);
185 } 185 }
186 inrow += v_expand; 186 inrow += v_expand;
187 outrow++; 187 outrow++;
188 } 188 }
189} 189}
190 190
191 191
192/* 192/*
193 * Downsample pixel values of a single component. 193 * Downsample pixel values of a single component.
194 * This version handles the special case of a full-size component, 194 * This version handles the special case of a full-size component,
195 * without smoothing. 195 * without smoothing.
196 */ 196 */
197 197
198METHODDEF(void) 198METHODDEF(void)
199fullsize_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, 199fullsize_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
200 JSAMPARRAY input_data, JSAMPARRAY output_data) 200 JSAMPARRAY input_data, JSAMPARRAY output_data)
201{ 201{
202 /* Copy the data */ 202 /* Copy the data */
203 jcopy_sample_rows(input_data, 0, output_data, 0, 203 jcopy_sample_rows(input_data, 0, output_data, 0,
204 cinfo->max_v_samp_factor, cinfo->image_width); 204 cinfo->max_v_samp_factor, cinfo->image_width);
205 /* Edge-expand */ 205 /* Edge-expand */
206 expand_right_edge(output_data, cinfo->max_v_samp_factor, cinfo->image_width, 206 expand_right_edge(output_data, cinfo->max_v_samp_factor, cinfo->image_width,
207 compptr->width_in_blocks * compptr->DCT_h_scaled_size); 207 compptr->width_in_blocks * compptr->DCT_h_scaled_size);
208} 208}
209 209
210 210
211/* 211/*
212 * Downsample pixel values of a single component. 212 * Downsample pixel values of a single component.
213 * This version handles the common case of 2:1 horizontal and 1:1 vertical, 213 * This version handles the common case of 2:1 horizontal and 1:1 vertical,
214 * without smoothing. 214 * without smoothing.
215 * 215 *
216 * A note about the "bias" calculations: when rounding fractional values to 216 * A note about the "bias" calculations: when rounding fractional values to
217 * integer, we do not want to always round 0.5 up to the next integer. 217 * integer, we do not want to always round 0.5 up to the next integer.
218 * If we did that, we'd introduce a noticeable bias towards larger values. 218 * If we did that, we'd introduce a noticeable bias towards larger values.
219 * Instead, this code is arranged so that 0.5 will be rounded up or down at 219 * Instead, this code is arranged so that 0.5 will be rounded up or down at
220 * alternate pixel locations (a simple ordered dither pattern). 220 * alternate pixel locations (a simple ordered dither pattern).
221 */ 221 */
222 222
223METHODDEF(void) 223METHODDEF(void)
224h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, 224h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
225 JSAMPARRAY input_data, JSAMPARRAY output_data) 225 JSAMPARRAY input_data, JSAMPARRAY output_data)
226{ 226{
227 int inrow; 227 int inrow;
228 JDIMENSION outcol; 228 JDIMENSION outcol;
229 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size; 229 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size;
230 register JSAMPROW inptr, outptr; 230 register JSAMPROW inptr, outptr;
231 register int bias; 231 register int bias;
232 232
233 /* Expand input data enough to let all the output samples be generated 233 /* Expand input data enough to let all the output samples be generated
234 * by the standard loop. Special-casing padded output would be more 234 * by the standard loop. Special-casing padded output would be more
235 * efficient. 235 * efficient.
236 */ 236 */
237 expand_right_edge(input_data, cinfo->max_v_samp_factor, 237 expand_right_edge(input_data, cinfo->max_v_samp_factor,
238 cinfo->image_width, output_cols * 2); 238 cinfo->image_width, output_cols * 2);
239 239
240 for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) { 240 for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) {
241 outptr = output_data[inrow]; 241 outptr = output_data[inrow];
242 inptr = input_data[inrow]; 242 inptr = input_data[inrow];
243 bias = 0; /* bias = 0,1,0,1,... for successive samples */ 243 bias = 0; /* bias = 0,1,0,1,... for successive samples */
244 for (outcol = 0; outcol < output_cols; outcol++) { 244 for (outcol = 0; outcol < output_cols; outcol++) {
245 *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1]) 245 *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1])
246 + bias) >> 1); 246 + bias) >> 1);
247 bias ^= 1; /* 0=>1, 1=>0 */ 247 bias ^= 1; /* 0=>1, 1=>0 */
248 inptr += 2; 248 inptr += 2;
249 } 249 }
250 } 250 }
251} 251}
252 252
253 253
254/* 254/*
255 * Downsample pixel values of a single component. 255 * Downsample pixel values of a single component.
256 * This version handles the standard case of 2:1 horizontal and 2:1 vertical, 256 * This version handles the standard case of 2:1 horizontal and 2:1 vertical,
257 * without smoothing. 257 * without smoothing.
258 */ 258 */
259 259
260METHODDEF(void) 260METHODDEF(void)
261h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, 261h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
262 JSAMPARRAY input_data, JSAMPARRAY output_data) 262 JSAMPARRAY input_data, JSAMPARRAY output_data)
263{ 263{
264 int inrow, outrow; 264 int inrow, outrow;
265 JDIMENSION outcol; 265 JDIMENSION outcol;
266 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size; 266 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size;
267 register JSAMPROW inptr0, inptr1, outptr; 267 register JSAMPROW inptr0, inptr1, outptr;
268 register int bias; 268 register int bias;
269 269
270 /* Expand input data enough to let all the output samples be generated 270 /* Expand input data enough to let all the output samples be generated
271 * by the standard loop. Special-casing padded output would be more 271 * by the standard loop. Special-casing padded output would be more
272 * efficient. 272 * efficient.
273 */ 273 */
274 expand_right_edge(input_data, cinfo->max_v_samp_factor, 274 expand_right_edge(input_data, cinfo->max_v_samp_factor,
275 cinfo->image_width, output_cols * 2); 275 cinfo->image_width, output_cols * 2);
276 276
277 inrow = outrow = 0; 277 inrow = outrow = 0;
278 while (inrow < cinfo->max_v_samp_factor) { 278 while (inrow < cinfo->max_v_samp_factor) {
279 outptr = output_data[outrow]; 279 outptr = output_data[outrow];
280 inptr0 = input_data[inrow]; 280 inptr0 = input_data[inrow];
281 inptr1 = input_data[inrow+1]; 281 inptr1 = input_data[inrow+1];
282 bias = 1; /* bias = 1,2,1,2,... for successive samples */ 282 bias = 1; /* bias = 1,2,1,2,... for successive samples */
283 for (outcol = 0; outcol < output_cols; outcol++) { 283 for (outcol = 0; outcol < output_cols; outcol++) {
284 *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + 284 *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
285 GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]) 285 GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1])
286 + bias) >> 2); 286 + bias) >> 2);
287 bias ^= 3; /* 1=>2, 2=>1 */ 287 bias ^= 3; /* 1=>2, 2=>1 */
288 inptr0 += 2; inptr1 += 2; 288 inptr0 += 2; inptr1 += 2;
289 } 289 }
290 inrow += 2; 290 inrow += 2;
291 outrow++; 291 outrow++;
292 } 292 }
293} 293}
294 294
295 295
296#ifdef INPUT_SMOOTHING_SUPPORTED 296#ifdef INPUT_SMOOTHING_SUPPORTED
297 297
298/* 298/*
299 * Downsample pixel values of a single component. 299 * Downsample pixel values of a single component.
300 * This version handles the standard case of 2:1 horizontal and 2:1 vertical, 300 * This version handles the standard case of 2:1 horizontal and 2:1 vertical,
301 * with smoothing. One row of context is required. 301 * with smoothing. One row of context is required.
302 */ 302 */
303 303
304METHODDEF(void) 304METHODDEF(void)
305h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, 305h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
306 JSAMPARRAY input_data, JSAMPARRAY output_data) 306 JSAMPARRAY input_data, JSAMPARRAY output_data)
307{ 307{
308 int inrow, outrow; 308 int inrow, outrow;
309 JDIMENSION colctr; 309 JDIMENSION colctr;
310 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size; 310 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size;
311 register JSAMPROW inptr0, inptr1, above_ptr, below_ptr, outptr; 311 register JSAMPROW inptr0, inptr1, above_ptr, below_ptr, outptr;
312 INT32 membersum, neighsum, memberscale, neighscale; 312 INT32 membersum, neighsum, memberscale, neighscale;
313 313
314 /* Expand input data enough to let all the output samples be generated 314 /* Expand input data enough to let all the output samples be generated
315 * by the standard loop. Special-casing padded output would be more 315 * by the standard loop. Special-casing padded output would be more
316 * efficient. 316 * efficient.
317 */ 317 */
318 expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2, 318 expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2,
319 cinfo->image_width, output_cols * 2); 319 cinfo->image_width, output_cols * 2);
320 320
321 /* We don't bother to form the individual "smoothed" input pixel values; 321 /* We don't bother to form the individual "smoothed" input pixel values;
322 * we can directly compute the output which is the average of the four 322 * we can directly compute the output which is the average of the four
323 * smoothed values. Each of the four member pixels contributes a fraction 323 * smoothed values. Each of the four member pixels contributes a fraction
324 * (1-8*SF) to its own smoothed image and a fraction SF to each of the three 324 * (1-8*SF) to its own smoothed image and a fraction SF to each of the three
325 * other smoothed pixels, therefore a total fraction (1-5*SF)/4 to the final 325 * other smoothed pixels, therefore a total fraction (1-5*SF)/4 to the final
326 * output. The four corner-adjacent neighbor pixels contribute a fraction 326 * output. The four corner-adjacent neighbor pixels contribute a fraction
327 * SF to just one smoothed pixel, or SF/4 to the final output; while the 327 * SF to just one smoothed pixel, or SF/4 to the final output; while the
328 * eight edge-adjacent neighbors contribute SF to each of two smoothed 328 * eight edge-adjacent neighbors contribute SF to each of two smoothed
329 * pixels, or SF/2 overall. In order to use integer arithmetic, these 329 * pixels, or SF/2 overall. In order to use integer arithmetic, these
330 * factors are scaled by 2^16 = 65536. 330 * factors are scaled by 2^16 = 65536.
331 * Also recall that SF = smoothing_factor / 1024. 331 * Also recall that SF = smoothing_factor / 1024.
332 */ 332 */
333 333
334 memberscale = 16384 - cinfo->smoothing_factor * 80; /* scaled (1-5*SF)/4 */ 334 memberscale = 16384 - cinfo->smoothing_factor * 80; /* scaled (1-5*SF)/4 */
335 neighscale = cinfo->smoothing_factor * 16; /* scaled SF/4 */ 335 neighscale = cinfo->smoothing_factor * 16; /* scaled SF/4 */
336 336
337 inrow = outrow = 0; 337 inrow = outrow = 0;
338 while (inrow < cinfo->max_v_samp_factor) { 338 while (inrow < cinfo->max_v_samp_factor) {
339 outptr = output_data[outrow]; 339 outptr = output_data[outrow];
340 inptr0 = input_data[inrow]; 340 inptr0 = input_data[inrow];
341 inptr1 = input_data[inrow+1]; 341 inptr1 = input_data[inrow+1];
342 above_ptr = input_data[inrow-1]; 342 above_ptr = input_data[inrow-1];
343 below_ptr = input_data[inrow+2]; 343 below_ptr = input_data[inrow+2];
344 344
345 /* Special case for first column: pretend column -1 is same as column 0 */ 345 /* Special case for first column: pretend column -1 is same as column 0 */
346 membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + 346 membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
347 GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); 347 GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
348 neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) + 348 neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
349 GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + 349 GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
350 GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[2]) + 350 GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[2]) +
351 GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[2]); 351 GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[2]);
352 neighsum += neighsum; 352 neighsum += neighsum;
353 neighsum += GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[2]) + 353 neighsum += GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[2]) +
354 GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[2]); 354 GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[2]);
355 membersum = membersum * memberscale + neighsum * neighscale; 355 membersum = membersum * memberscale + neighsum * neighscale;
356 *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); 356 *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
357 inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2; 357 inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
358 358
359 for (colctr = output_cols - 2; colctr > 0; colctr--) { 359 for (colctr = output_cols - 2; colctr > 0; colctr--) {
360 /* sum of pixels directly mapped to this output element */ 360 /* sum of pixels directly mapped to this output element */
361 membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + 361 membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
362 GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); 362 GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
363 /* sum of edge-neighbor pixels */ 363 /* sum of edge-neighbor pixels */
364 neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) + 364 neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
365 GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + 365 GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
366 GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[2]) + 366 GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[2]) +
367 GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[2]); 367 GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[2]);
368 /* The edge-neighbors count twice as much as corner-neighbors */ 368 /* The edge-neighbors count twice as much as corner-neighbors */
369 neighsum += neighsum; 369 neighsum += neighsum;
370 /* Add in the corner-neighbors */ 370 /* Add in the corner-neighbors */
371 neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[2]) + 371 neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[2]) +
372 GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[2]); 372 GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[2]);
373 /* form final output scaled up by 2^16 */ 373 /* form final output scaled up by 2^16 */
374 membersum = membersum * memberscale + neighsum * neighscale; 374 membersum = membersum * memberscale + neighsum * neighscale;
375 /* round, descale and output it */ 375 /* round, descale and output it */
376 *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); 376 *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
377 inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2; 377 inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
378 } 378 }
379 379
380 /* Special case for last column */ 380 /* Special case for last column */
381 membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + 381 membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
382 GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); 382 GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
383 neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) + 383 neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
384 GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + 384 GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
385 GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[1]) + 385 GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[1]) +
386 GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[1]); 386 GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[1]);
387 neighsum += neighsum; 387 neighsum += neighsum;
388 neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[1]) + 388 neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[1]) +
389 GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[1]); 389 GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[1]);
390 membersum = membersum * memberscale + neighsum * neighscale; 390 membersum = membersum * memberscale + neighsum * neighscale;
391 *outptr = (JSAMPLE) ((membersum + 32768) >> 16); 391 *outptr = (JSAMPLE) ((membersum + 32768) >> 16);
392 392
393 inrow += 2; 393 inrow += 2;
394 outrow++; 394 outrow++;
395 } 395 }
396} 396}
397 397
398 398
399/* 399/*
400 * Downsample pixel values of a single component. 400 * Downsample pixel values of a single component.
401 * This version handles the special case of a full-size component, 401 * This version handles the special case of a full-size component,
402 * with smoothing. One row of context is required. 402 * with smoothing. One row of context is required.
403 */ 403 */
404 404
405METHODDEF(void) 405METHODDEF(void)
406fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr, 406fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
407 JSAMPARRAY input_data, JSAMPARRAY output_data) 407 JSAMPARRAY input_data, JSAMPARRAY output_data)
408{ 408{
409 int inrow; 409 int inrow;
410 JDIMENSION colctr; 410 JDIMENSION colctr;
411 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size; 411 JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size;
412 register JSAMPROW inptr, above_ptr, below_ptr, outptr; 412 register JSAMPROW inptr, above_ptr, below_ptr, outptr;
413 INT32 membersum, neighsum, memberscale, neighscale; 413 INT32 membersum, neighsum, memberscale, neighscale;
414 int colsum, lastcolsum, nextcolsum; 414 int colsum, lastcolsum, nextcolsum;
415 415
416 /* Expand input data enough to let all the output samples be generated 416 /* Expand input data enough to let all the output samples be generated
417 * by the standard loop. Special-casing padded output would be more 417 * by the standard loop. Special-casing padded output would be more
418 * efficient. 418 * efficient.
419 */ 419 */
420 expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2, 420 expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2,
421 cinfo->image_width, output_cols); 421 cinfo->image_width, output_cols);
422 422
423 /* Each of the eight neighbor pixels contributes a fraction SF to the 423 /* Each of the eight neighbor pixels contributes a fraction SF to the
424 * smoothed pixel, while the main pixel contributes (1-8*SF). In order 424 * smoothed pixel, while the main pixel contributes (1-8*SF). In order
425 * to use integer arithmetic, these factors are multiplied by 2^16 = 65536. 425 * to use integer arithmetic, these factors are multiplied by 2^16 = 65536.
426 * Also recall that SF = smoothing_factor / 1024. 426 * Also recall that SF = smoothing_factor / 1024.
427 */ 427 */
428 428
429 memberscale = 65536L - cinfo->smoothing_factor * 512L; /* scaled 1-8*SF */ 429 memberscale = 65536L - cinfo->smoothing_factor * 512L; /* scaled 1-8*SF */
430 neighscale = cinfo->smoothing_factor * 64; /* scaled SF */ 430 neighscale = cinfo->smoothing_factor * 64; /* scaled SF */
431 431
432 for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) { 432 for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) {
433 outptr = output_data[inrow]; 433 outptr = output_data[inrow];
434 inptr = input_data[inrow]; 434 inptr = input_data[inrow];
435 above_ptr = input_data[inrow-1]; 435 above_ptr = input_data[inrow-1];
436 below_ptr = input_data[inrow+1]; 436 below_ptr = input_data[inrow+1];
437 437
438 /* Special case for first column */ 438 /* Special case for first column */
439 colsum = GETJSAMPLE(*above_ptr++) + GETJSAMPLE(*below_ptr++) + 439 colsum = GETJSAMPLE(*above_ptr++) + GETJSAMPLE(*below_ptr++) +
440 GETJSAMPLE(*inptr); 440 GETJSAMPLE(*inptr);
441 membersum = GETJSAMPLE(*inptr++); 441 membersum = GETJSAMPLE(*inptr++);
442 nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) + 442 nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) +
443 GETJSAMPLE(*inptr); 443 GETJSAMPLE(*inptr);
444 neighsum = colsum + (colsum - membersum) + nextcolsum; 444 neighsum = colsum + (colsum - membersum) + nextcolsum;
445 membersum = membersum * memberscale + neighsum * neighscale; 445 membersum = membersum * memberscale + neighsum * neighscale;
446 *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); 446 *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
447 lastcolsum = colsum; colsum = nextcolsum; 447 lastcolsum = colsum; colsum = nextcolsum;
448 448
449 for (colctr = output_cols - 2; colctr > 0; colctr--) { 449 for (colctr = output_cols - 2; colctr > 0; colctr--) {
450 membersum = GETJSAMPLE(*inptr++); 450 membersum = GETJSAMPLE(*inptr++);
451 above_ptr++; below_ptr++; 451 above_ptr++; below_ptr++;
452 nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) + 452 nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) +
453 GETJSAMPLE(*inptr); 453 GETJSAMPLE(*inptr);
454 neighsum = lastcolsum + (colsum - membersum) + nextcolsum; 454 neighsum = lastcolsum + (colsum - membersum) + nextcolsum;
455 membersum = membersum * memberscale + neighsum * neighscale; 455 membersum = membersum * memberscale + neighsum * neighscale;
456 *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); 456 *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
457 lastcolsum = colsum; colsum = nextcolsum; 457 lastcolsum = colsum; colsum = nextcolsum;
458 } 458 }
459 459
460 /* Special case for last column */ 460 /* Special case for last column */
461 membersum = GETJSAMPLE(*inptr); 461 membersum = GETJSAMPLE(*inptr);
462 neighsum = lastcolsum + (colsum - membersum) + colsum; 462 neighsum = lastcolsum + (colsum - membersum) + colsum;
463 membersum = membersum * memberscale + neighsum * neighscale; 463 membersum = membersum * memberscale + neighsum * neighscale;
464 *outptr = (JSAMPLE) ((membersum + 32768) >> 16); 464 *outptr = (JSAMPLE) ((membersum + 32768) >> 16);
465 465
466 } 466 }
467} 467}
468 468
469#endif /* INPUT_SMOOTHING_SUPPORTED */ 469#endif /* INPUT_SMOOTHING_SUPPORTED */
470 470
471 471
472/* 472/*
473 * Module initialization routine for downsampling. 473 * Module initialization routine for downsampling.
474 * Note that we must select a routine for each component. 474 * Note that we must select a routine for each component.
475 */ 475 */
476 476
477GLOBAL(void) 477GLOBAL(void)
478jinit_downsampler (j_compress_ptr cinfo) 478jinit_downsampler (j_compress_ptr cinfo)
479{ 479{
480 my_downsample_ptr downsample; 480 my_downsample_ptr downsample;
481 int ci; 481 int ci;
482 jpeg_component_info * compptr; 482 jpeg_component_info * compptr;
483 boolean smoothok = TRUE; 483 boolean smoothok = TRUE;
484 int h_in_group, v_in_group, h_out_group, v_out_group; 484 int h_in_group, v_in_group, h_out_group, v_out_group;
485 485
486 downsample = (my_downsample_ptr) 486 downsample = (my_downsample_ptr)
487 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, 487 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
488 SIZEOF(my_downsampler)); 488 SIZEOF(my_downsampler));
489 cinfo->downsample = (struct jpeg_downsampler *) downsample; 489 cinfo->downsample = (struct jpeg_downsampler *) downsample;
490 downsample->pub.start_pass = start_pass_downsample; 490 downsample->pub.start_pass = start_pass_downsample;
491 downsample->pub.downsample = sep_downsample; 491 downsample->pub.downsample = sep_downsample;
492 downsample->pub.need_context_rows = FALSE; 492 downsample->pub.need_context_rows = FALSE;
493 493
494 if (cinfo->CCIR601_sampling) 494 if (cinfo->CCIR601_sampling)
495 ERREXIT(cinfo, JERR_CCIR601_NOTIMPL); 495 ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
496 496
497 /* Verify we can handle the sampling factors, and set up method pointers */ 497 /* Verify we can handle the sampling factors, and set up method pointers */
498 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; 498 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
499 ci++, compptr++) { 499 ci++, compptr++) {
500 /* Compute size of an "output group" for DCT scaling. This many samples 500 /* Compute size of an "output group" for DCT scaling. This many samples
501 * are to be converted from max_h_samp_factor * max_v_samp_factor pixels. 501 * are to be converted from max_h_samp_factor * max_v_samp_factor pixels.
502 */ 502 */
503 h_out_group = (compptr->h_samp_factor * compptr->DCT_h_scaled_size) / 503 h_out_group = (compptr->h_samp_factor * compptr->DCT_h_scaled_size) /
504 cinfo->min_DCT_h_scaled_size; 504 cinfo->min_DCT_h_scaled_size;
505 v_out_group = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) / 505 v_out_group = (compptr->v_samp_factor * compptr->DCT_v_scaled_size) /
506 cinfo->min_DCT_v_scaled_size; 506 cinfo->min_DCT_v_scaled_size;
507 h_in_group = cinfo->max_h_samp_factor; 507 h_in_group = cinfo->max_h_samp_factor;
508 v_in_group = cinfo->max_v_samp_factor; 508 v_in_group = cinfo->max_v_samp_factor;
509 downsample->rowgroup_height[ci] = v_out_group; /* save for use later */ 509 downsample->rowgroup_height[ci] = v_out_group; /* save for use later */
510 if (h_in_group == h_out_group && v_in_group == v_out_group) { 510 if (h_in_group == h_out_group && v_in_group == v_out_group) {
511#ifdef INPUT_SMOOTHING_SUPPORTED 511#ifdef INPUT_SMOOTHING_SUPPORTED
512 if (cinfo->smoothing_factor) { 512 if (cinfo->smoothing_factor) {
513 downsample->methods[ci] = fullsize_smooth_downsample; 513 downsample->methods[ci] = fullsize_smooth_downsample;
514 downsample->pub.need_context_rows = TRUE; 514 downsample->pub.need_context_rows = TRUE;
515 } else 515 } else
516#endif 516#endif
517 downsample->methods[ci] = fullsize_downsample; 517 downsample->methods[ci] = fullsize_downsample;
518 } else if (h_in_group == h_out_group * 2 && 518 } else if (h_in_group == h_out_group * 2 &&
519 v_in_group == v_out_group) { 519 v_in_group == v_out_group) {
520 smoothok = FALSE; 520 smoothok = FALSE;
521 downsample->methods[ci] = h2v1_downsample; 521 downsample->methods[ci] = h2v1_downsample;
522 } else if (h_in_group == h_out_group * 2 && 522 } else if (h_in_group == h_out_group * 2 &&
523 v_in_group == v_out_group * 2) { 523 v_in_group == v_out_group * 2) {
524#ifdef INPUT_SMOOTHING_SUPPORTED 524#ifdef INPUT_SMOOTHING_SUPPORTED
525 if (cinfo->smoothing_factor) { 525 if (cinfo->smoothing_factor) {
526 downsample->methods[ci] = h2v2_smooth_downsample; 526 downsample->methods[ci] = h2v2_smooth_downsample;
527 downsample->pub.need_context_rows = TRUE; 527 downsample->pub.need_context_rows = TRUE;
528 } else 528 } else
529#endif 529#endif
530 downsample->methods[ci] = h2v2_downsample; 530 downsample->methods[ci] = h2v2_downsample;
531 } else if ((h_in_group % h_out_group) == 0 && 531 } else if ((h_in_group % h_out_group) == 0 &&
532 (v_in_group % v_out_group) == 0) { 532 (v_in_group % v_out_group) == 0) {
533 smoothok = FALSE; 533 smoothok = FALSE;
534 downsample->methods[ci] = int_downsample; 534 downsample->methods[ci] = int_downsample;
535 downsample->h_expand[ci] = (UINT8) (h_in_group / h_out_group); 535 downsample->h_expand[ci] = (UINT8) (h_in_group / h_out_group);
536 downsample->v_expand[ci] = (UINT8) (v_in_group / v_out_group); 536 downsample->v_expand[ci] = (UINT8) (v_in_group / v_out_group);
537 } else 537 } else
538 ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL); 538 ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
539 } 539 }
540 540
541#ifdef INPUT_SMOOTHING_SUPPORTED 541#ifdef INPUT_SMOOTHING_SUPPORTED
542 if (cinfo->smoothing_factor && !smoothok) 542 if (cinfo->smoothing_factor && !smoothok)
543 TRACEMS(cinfo, 0, JTRC_SMOOTH_NOTIMPL); 543 TRACEMS(cinfo, 0, JTRC_SMOOTH_NOTIMPL);
544#endif 544#endif
545} 545}