| OLD | NEW |
| 1 /* | 1 /* |
| 2 * jcsample.c | 2 * jcsample.c |
| 3 * | 3 * |
| 4 * This file was part of the Independent JPEG Group's software: |
| 4 * Copyright (C) 1991-1996, Thomas G. Lane. | 5 * Copyright (C) 1991-1996, Thomas G. Lane. |
| 6 * libjpeg-turbo Modifications: |
| 5 * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB | 7 * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB |
| 6 * This file is part of the Independent JPEG Group's software. | 8 * Copyright (C) 2014, MIPS Technologies, Inc., California |
| 7 * For conditions of distribution and use, see the accompanying README file. | 9 * Copyright (C) 2015, D. R. Commander. |
| 10 * For conditions of distribution and use, see the accompanying README.ijg |
| 11 * file. |
| 8 * | 12 * |
| 9 * This file contains downsampling routines. | 13 * This file contains downsampling routines. |
| 10 * | 14 * |
| 11 * Downsampling input data is counted in "row groups". A row group | 15 * Downsampling input data is counted in "row groups". A row group |
| 12 * is defined to be max_v_samp_factor pixel rows of each component, | 16 * is defined to be max_v_samp_factor pixel rows of each component, |
| 13 * from which the downsampler produces v_samp_factor sample rows. | 17 * from which the downsampler produces v_samp_factor sample rows. |
| 14 * A single row group is processed in each call to the downsampler module. | 18 * A single row group is processed in each call to the downsampler module. |
| 15 * | 19 * |
| 16 * The downsampler is responsible for edge-expansion of its output data | 20 * The downsampler is responsible for edge-expansion of its output data |
| 17 * to fill an integral number of DCT blocks horizontally. The source buffer | 21 * to fill an integral number of DCT blocks horizontally. The source buffer |
| (...skipping 28 matching lines...) Expand all Loading... |
| 46 * Currently, smoothing is only supported for 2h2v sampling factors. | 50 * Currently, smoothing is only supported for 2h2v sampling factors. |
| 47 */ | 51 */ |
| 48 | 52 |
| 49 #define JPEG_INTERNALS | 53 #define JPEG_INTERNALS |
| 50 #include "jinclude.h" | 54 #include "jinclude.h" |
| 51 #include "jpeglib.h" | 55 #include "jpeglib.h" |
| 52 #include "jsimd.h" | 56 #include "jsimd.h" |
| 53 | 57 |
| 54 | 58 |
| 55 /* Pointer to routine to downsample a single component */ | 59 /* Pointer to routine to downsample a single component */ |
| 56 typedef JMETHOD(void, downsample1_ptr, | 60 typedef void (*downsample1_ptr) (j_compress_ptr cinfo, |
| 57 » » (j_compress_ptr cinfo, jpeg_component_info * compptr, | 61 jpeg_component_info *compptr, |
| 58 » » JSAMPARRAY input_data, JSAMPARRAY output_data)); | 62 JSAMPARRAY input_data, |
| 63 JSAMPARRAY output_data); |
| 59 | 64 |
| 60 /* Private subobject */ | 65 /* Private subobject */ |
| 61 | 66 |
| 62 typedef struct { | 67 typedef struct { |
| 63 struct jpeg_downsampler pub;» /* public fields */ | 68 struct jpeg_downsampler pub; /* public fields */ |
| 64 | 69 |
| 65 /* Downsampling method pointers, one per component */ | 70 /* Downsampling method pointers, one per component */ |
| 66 downsample1_ptr methods[MAX_COMPONENTS]; | 71 downsample1_ptr methods[MAX_COMPONENTS]; |
| 67 } my_downsampler; | 72 } my_downsampler; |
| 68 | 73 |
| 69 typedef my_downsampler * my_downsample_ptr; | 74 typedef my_downsampler *my_downsample_ptr; |
| 70 | 75 |
| 71 | 76 |
| 72 /* | 77 /* |
| 73 * Initialize for a downsampling pass. | 78 * Initialize for a downsampling pass. |
| 74 */ | 79 */ |
| 75 | 80 |
| 76 METHODDEF(void) | 81 METHODDEF(void) |
| 77 start_pass_downsample (j_compress_ptr cinfo) | 82 start_pass_downsample (j_compress_ptr cinfo) |
| 78 { | 83 { |
| 79 /* no work for now */ | 84 /* no work for now */ |
| 80 } | 85 } |
| 81 | 86 |
| 82 | 87 |
| 83 /* | 88 /* |
| 84 * Expand a component horizontally from width input_cols to width output_cols, | 89 * Expand a component horizontally from width input_cols to width output_cols, |
| 85 * by duplicating the rightmost samples. | 90 * by duplicating the rightmost samples. |
| 86 */ | 91 */ |
| 87 | 92 |
| 88 LOCAL(void) | 93 LOCAL(void) |
| 89 expand_right_edge (JSAMPARRAY image_data, int num_rows, | 94 expand_right_edge (JSAMPARRAY image_data, int num_rows, |
| 90 » » JDIMENSION input_cols, JDIMENSION output_cols) | 95 JDIMENSION input_cols, JDIMENSION output_cols) |
| 91 { | 96 { |
| 92 register JSAMPROW ptr; | 97 register JSAMPROW ptr; |
| 93 register JSAMPLE pixval; | 98 register JSAMPLE pixval; |
| 94 register int count; | 99 register int count; |
| 95 int row; | 100 int row; |
| 96 int numcols = (int) (output_cols - input_cols); | 101 int numcols = (int) (output_cols - input_cols); |
| 97 | 102 |
| 98 if (numcols > 0) { | 103 if (numcols > 0) { |
| 99 for (row = 0; row < num_rows; row++) { | 104 for (row = 0; row < num_rows; row++) { |
| 100 ptr = image_data[row] + input_cols; | 105 ptr = image_data[row] + input_cols; |
| 101 pixval = ptr[-1];»» /* don't need GETJSAMPLE() here */ | 106 pixval = ptr[-1]; /* don't need GETJSAMPLE() here */ |
| 102 for (count = numcols; count > 0; count--) | 107 for (count = numcols; count > 0; count--) |
| 103 » *ptr++ = pixval; | 108 *ptr++ = pixval; |
| 104 } | 109 } |
| 105 } | 110 } |
| 106 } | 111 } |
| 107 | 112 |
| 108 | 113 |
| 109 /* | 114 /* |
| 110 * Do downsampling for a whole row group (all components). | 115 * Do downsampling for a whole row group (all components). |
| 111 * | 116 * |
| 112 * In this version we simply downsample each component independently. | 117 * In this version we simply downsample each component independently. |
| 113 */ | 118 */ |
| 114 | 119 |
| 115 METHODDEF(void) | 120 METHODDEF(void) |
| 116 sep_downsample (j_compress_ptr cinfo, | 121 sep_downsample (j_compress_ptr cinfo, |
| 117 » » JSAMPIMAGE input_buf, JDIMENSION in_row_index, | 122 JSAMPIMAGE input_buf, JDIMENSION in_row_index, |
| 118 » » JSAMPIMAGE output_buf, JDIMENSION out_row_group_index) | 123 JSAMPIMAGE output_buf, JDIMENSION out_row_group_index) |
| 119 { | 124 { |
| 120 my_downsample_ptr downsample = (my_downsample_ptr) cinfo->downsample; | 125 my_downsample_ptr downsample = (my_downsample_ptr) cinfo->downsample; |
| 121 int ci; | 126 int ci; |
| 122 jpeg_component_info * compptr; | 127 jpeg_component_info *compptr; |
| 123 JSAMPARRAY in_ptr, out_ptr; | 128 JSAMPARRAY in_ptr, out_ptr; |
| 124 | 129 |
| 125 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; | 130 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; |
| 126 ci++, compptr++) { | 131 ci++, compptr++) { |
| 127 in_ptr = input_buf[ci] + in_row_index; | 132 in_ptr = input_buf[ci] + in_row_index; |
| 128 out_ptr = output_buf[ci] + (out_row_group_index * compptr->v_samp_factor); | 133 out_ptr = output_buf[ci] + (out_row_group_index * compptr->v_samp_factor); |
| 129 (*downsample->methods[ci]) (cinfo, compptr, in_ptr, out_ptr); | 134 (*downsample->methods[ci]) (cinfo, compptr, in_ptr, out_ptr); |
| 130 } | 135 } |
| 131 } | 136 } |
| 132 | 137 |
| 133 | 138 |
| 134 /* | 139 /* |
| 135 * Downsample pixel values of a single component. | 140 * Downsample pixel values of a single component. |
| 136 * One row group is processed per call. | 141 * One row group is processed per call. |
| 137 * This version handles arbitrary integral sampling ratios, without smoothing. | 142 * This version handles arbitrary integral sampling ratios, without smoothing. |
| 138 * Note that this version is not actually used for customary sampling ratios. | 143 * Note that this version is not actually used for customary sampling ratios. |
| 139 */ | 144 */ |
| 140 | 145 |
| 141 METHODDEF(void) | 146 METHODDEF(void) |
| 142 int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, | 147 int_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr, |
| 143 » » JSAMPARRAY input_data, JSAMPARRAY output_data) | 148 JSAMPARRAY input_data, JSAMPARRAY output_data) |
| 144 { | 149 { |
| 145 int inrow, outrow, h_expand, v_expand, numpix, numpix2, h, v; | 150 int inrow, outrow, h_expand, v_expand, numpix, numpix2, h, v; |
| 146 JDIMENSION outcol, outcol_h;» /* outcol_h == outcol*h_expand */ | 151 JDIMENSION outcol, outcol_h; /* outcol_h == outcol*h_expand */ |
| 147 JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; | 152 JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; |
| 148 JSAMPROW inptr, outptr; | 153 JSAMPROW inptr, outptr; |
| 149 INT32 outvalue; | 154 JLONG outvalue; |
| 150 | 155 |
| 151 h_expand = cinfo->max_h_samp_factor / compptr->h_samp_factor; | 156 h_expand = cinfo->max_h_samp_factor / compptr->h_samp_factor; |
| 152 v_expand = cinfo->max_v_samp_factor / compptr->v_samp_factor; | 157 v_expand = cinfo->max_v_samp_factor / compptr->v_samp_factor; |
| 153 numpix = h_expand * v_expand; | 158 numpix = h_expand * v_expand; |
| 154 numpix2 = numpix/2; | 159 numpix2 = numpix/2; |
| 155 | 160 |
| 156 /* Expand input data enough to let all the output samples be generated | 161 /* Expand input data enough to let all the output samples be generated |
| 157 * by the standard loop. Special-casing padded output would be more | 162 * by the standard loop. Special-casing padded output would be more |
| 158 * efficient. | 163 * efficient. |
| 159 */ | 164 */ |
| 160 expand_right_edge(input_data, cinfo->max_v_samp_factor, | 165 expand_right_edge(input_data, cinfo->max_v_samp_factor, |
| 161 » » cinfo->image_width, output_cols * h_expand); | 166 cinfo->image_width, output_cols * h_expand); |
| 162 | 167 |
| 163 inrow = 0; | 168 inrow = 0; |
| 164 for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { | 169 for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { |
| 165 outptr = output_data[outrow]; | 170 outptr = output_data[outrow]; |
| 166 for (outcol = 0, outcol_h = 0; outcol < output_cols; | 171 for (outcol = 0, outcol_h = 0; outcol < output_cols; |
| 167 » outcol++, outcol_h += h_expand) { | 172 outcol++, outcol_h += h_expand) { |
| 168 outvalue = 0; | 173 outvalue = 0; |
| 169 for (v = 0; v < v_expand; v++) { | 174 for (v = 0; v < v_expand; v++) { |
| 170 » inptr = input_data[inrow+v] + outcol_h; | 175 inptr = input_data[inrow+v] + outcol_h; |
| 171 » for (h = 0; h < h_expand; h++) { | 176 for (h = 0; h < h_expand; h++) { |
| 172 » outvalue += (INT32) GETJSAMPLE(*inptr++); | 177 outvalue += (JLONG) GETJSAMPLE(*inptr++); |
| 173 » } | 178 } |
| 174 } | 179 } |
| 175 *outptr++ = (JSAMPLE) ((outvalue + numpix2) / numpix); | 180 *outptr++ = (JSAMPLE) ((outvalue + numpix2) / numpix); |
| 176 } | 181 } |
| 177 inrow += v_expand; | 182 inrow += v_expand; |
| 178 } | 183 } |
| 179 } | 184 } |
| 180 | 185 |
| 181 | 186 |
| 182 /* | 187 /* |
| 183 * Downsample pixel values of a single component. | 188 * Downsample pixel values of a single component. |
| 184 * This version handles the special case of a full-size component, | 189 * This version handles the special case of a full-size component, |
| 185 * without smoothing. | 190 * without smoothing. |
| 186 */ | 191 */ |
| 187 | 192 |
| 188 METHODDEF(void) | 193 METHODDEF(void) |
| 189 fullsize_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, | 194 fullsize_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr, |
| 190 » » JSAMPARRAY input_data, JSAMPARRAY output_data) | 195 JSAMPARRAY input_data, JSAMPARRAY output_data) |
| 191 { | 196 { |
| 192 /* Copy the data */ | 197 /* Copy the data */ |
| 193 jcopy_sample_rows(input_data, 0, output_data, 0, | 198 jcopy_sample_rows(input_data, 0, output_data, 0, |
| 194 » » cinfo->max_v_samp_factor, cinfo->image_width); | 199 cinfo->max_v_samp_factor, cinfo->image_width); |
| 195 /* Edge-expand */ | 200 /* Edge-expand */ |
| 196 expand_right_edge(output_data, cinfo->max_v_samp_factor, | 201 expand_right_edge(output_data, cinfo->max_v_samp_factor, |
| 197 » » cinfo->image_width, compptr->width_in_blocks * DCTSIZE); | 202 cinfo->image_width, compptr->width_in_blocks * DCTSIZE); |
| 198 } | 203 } |
| 199 | 204 |
| 200 | 205 |
| 201 /* | 206 /* |
| 202 * Downsample pixel values of a single component. | 207 * Downsample pixel values of a single component. |
| 203 * This version handles the common case of 2:1 horizontal and 1:1 vertical, | 208 * This version handles the common case of 2:1 horizontal and 1:1 vertical, |
| 204 * without smoothing. | 209 * without smoothing. |
| 205 * | 210 * |
| 206 * A note about the "bias" calculations: when rounding fractional values to | 211 * A note about the "bias" calculations: when rounding fractional values to |
| 207 * integer, we do not want to always round 0.5 up to the next integer. | 212 * integer, we do not want to always round 0.5 up to the next integer. |
| 208 * If we did that, we'd introduce a noticeable bias towards larger values. | 213 * If we did that, we'd introduce a noticeable bias towards larger values. |
| 209 * Instead, this code is arranged so that 0.5 will be rounded up or down at | 214 * Instead, this code is arranged so that 0.5 will be rounded up or down at |
| 210 * alternate pixel locations (a simple ordered dither pattern). | 215 * alternate pixel locations (a simple ordered dither pattern). |
| 211 */ | 216 */ |
| 212 | 217 |
| 213 METHODDEF(void) | 218 METHODDEF(void) |
| 214 h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, | 219 h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr, |
| 215 » » JSAMPARRAY input_data, JSAMPARRAY output_data) | 220 JSAMPARRAY input_data, JSAMPARRAY output_data) |
| 216 { | 221 { |
| 217 int outrow; | 222 int outrow; |
| 218 JDIMENSION outcol; | 223 JDIMENSION outcol; |
| 219 JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; | 224 JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; |
| 220 register JSAMPROW inptr, outptr; | 225 register JSAMPROW inptr, outptr; |
| 221 register int bias; | 226 register int bias; |
| 222 | 227 |
| 223 /* Expand input data enough to let all the output samples be generated | 228 /* Expand input data enough to let all the output samples be generated |
| 224 * by the standard loop. Special-casing padded output would be more | 229 * by the standard loop. Special-casing padded output would be more |
| 225 * efficient. | 230 * efficient. |
| 226 */ | 231 */ |
| 227 expand_right_edge(input_data, cinfo->max_v_samp_factor, | 232 expand_right_edge(input_data, cinfo->max_v_samp_factor, |
| 228 » » cinfo->image_width, output_cols * 2); | 233 cinfo->image_width, output_cols * 2); |
| 229 | 234 |
| 230 for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { | 235 for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { |
| 231 outptr = output_data[outrow]; | 236 outptr = output_data[outrow]; |
| 232 inptr = input_data[outrow]; | 237 inptr = input_data[outrow]; |
| 233 bias = 0;» » » /* bias = 0,1,0,1,... for successive samples */ | 238 bias = 0; /* bias = 0,1,0,1,... for successive samples */ |
| 234 for (outcol = 0; outcol < output_cols; outcol++) { | 239 for (outcol = 0; outcol < output_cols; outcol++) { |
| 235 *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1]) | 240 *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1]) |
| 236 » » » + bias) >> 1); | 241 + bias) >> 1); |
| 237 bias ^= 1;» » /* 0=>1, 1=>0 */ | 242 bias ^= 1; /* 0=>1, 1=>0 */ |
| 238 inptr += 2; | 243 inptr += 2; |
| 239 } | 244 } |
| 240 } | 245 } |
| 241 } | 246 } |
| 242 | 247 |
| 243 | 248 |
| 244 /* | 249 /* |
| 245 * Downsample pixel values of a single component. | 250 * Downsample pixel values of a single component. |
| 246 * This version handles the standard case of 2:1 horizontal and 2:1 vertical, | 251 * This version handles the standard case of 2:1 horizontal and 2:1 vertical, |
| 247 * without smoothing. | 252 * without smoothing. |
| 248 */ | 253 */ |
| 249 | 254 |
| 250 METHODDEF(void) | 255 METHODDEF(void) |
| 251 h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, | 256 h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr, |
| 252 » » JSAMPARRAY input_data, JSAMPARRAY output_data) | 257 JSAMPARRAY input_data, JSAMPARRAY output_data) |
| 253 { | 258 { |
| 254 int inrow, outrow; | 259 int inrow, outrow; |
| 255 JDIMENSION outcol; | 260 JDIMENSION outcol; |
| 256 JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; | 261 JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; |
| 257 register JSAMPROW inptr0, inptr1, outptr; | 262 register JSAMPROW inptr0, inptr1, outptr; |
| 258 register int bias; | 263 register int bias; |
| 259 | 264 |
| 260 /* Expand input data enough to let all the output samples be generated | 265 /* Expand input data enough to let all the output samples be generated |
| 261 * by the standard loop. Special-casing padded output would be more | 266 * by the standard loop. Special-casing padded output would be more |
| 262 * efficient. | 267 * efficient. |
| 263 */ | 268 */ |
| 264 expand_right_edge(input_data, cinfo->max_v_samp_factor, | 269 expand_right_edge(input_data, cinfo->max_v_samp_factor, |
| 265 » » cinfo->image_width, output_cols * 2); | 270 cinfo->image_width, output_cols * 2); |
| 266 | 271 |
| 267 inrow = 0; | 272 inrow = 0; |
| 268 for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { | 273 for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { |
| 269 outptr = output_data[outrow]; | 274 outptr = output_data[outrow]; |
| 270 inptr0 = input_data[inrow]; | 275 inptr0 = input_data[inrow]; |
| 271 inptr1 = input_data[inrow+1]; | 276 inptr1 = input_data[inrow+1]; |
| 272 bias = 1;» » » /* bias = 1,2,1,2,... for successive samples */ | 277 bias = 1; /* bias = 1,2,1,2,... for successive samples */ |
| 273 for (outcol = 0; outcol < output_cols; outcol++) { | 278 for (outcol = 0; outcol < output_cols; outcol++) { |
| 274 *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + | 279 *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + |
| 275 » » » GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]) | 280 GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]) |
| 276 » » » + bias) >> 2); | 281 + bias) >> 2); |
| 277 bias ^= 3;» » /* 1=>2, 2=>1 */ | 282 bias ^= 3; /* 1=>2, 2=>1 */ |
| 278 inptr0 += 2; inptr1 += 2; | 283 inptr0 += 2; inptr1 += 2; |
| 279 } | 284 } |
| 280 inrow += 2; | 285 inrow += 2; |
| 281 } | 286 } |
| 282 } | 287 } |
| 283 | 288 |
| 284 | 289 |
| 285 #ifdef INPUT_SMOOTHING_SUPPORTED | 290 #ifdef INPUT_SMOOTHING_SUPPORTED |
| 286 | 291 |
| 287 /* | 292 /* |
| 288 * Downsample pixel values of a single component. | 293 * Downsample pixel values of a single component. |
| 289 * This version handles the standard case of 2:1 horizontal and 2:1 vertical, | 294 * This version handles the standard case of 2:1 horizontal and 2:1 vertical, |
| 290 * with smoothing. One row of context is required. | 295 * with smoothing. One row of context is required. |
| 291 */ | 296 */ |
| 292 | 297 |
| 293 METHODDEF(void) | 298 METHODDEF(void) |
| 294 h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, | 299 h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr, |
| 295 » » » JSAMPARRAY input_data, JSAMPARRAY output_data) | 300 JSAMPARRAY input_data, JSAMPARRAY output_data) |
| 296 { | 301 { |
| 297 int inrow, outrow; | 302 int inrow, outrow; |
| 298 JDIMENSION colctr; | 303 JDIMENSION colctr; |
| 299 JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; | 304 JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; |
| 300 register JSAMPROW inptr0, inptr1, above_ptr, below_ptr, outptr; | 305 register JSAMPROW inptr0, inptr1, above_ptr, below_ptr, outptr; |
| 301 INT32 membersum, neighsum, memberscale, neighscale; | 306 JLONG membersum, neighsum, memberscale, neighscale; |
| 302 | 307 |
| 303 /* Expand input data enough to let all the output samples be generated | 308 /* Expand input data enough to let all the output samples be generated |
| 304 * by the standard loop. Special-casing padded output would be more | 309 * by the standard loop. Special-casing padded output would be more |
| 305 * efficient. | 310 * efficient. |
| 306 */ | 311 */ |
| 307 expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2, | 312 expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2, |
| 308 » » cinfo->image_width, output_cols * 2); | 313 cinfo->image_width, output_cols * 2); |
| 309 | 314 |
| 310 /* We don't bother to form the individual "smoothed" input pixel values; | 315 /* We don't bother to form the individual "smoothed" input pixel values; |
| 311 * we can directly compute the output which is the average of the four | 316 * we can directly compute the output which is the average of the four |
| 312 * smoothed values. Each of the four member pixels contributes a fraction | 317 * smoothed values. Each of the four member pixels contributes a fraction |
| 313 * (1-8*SF) to its own smoothed image and a fraction SF to each of the three | 318 * (1-8*SF) to its own smoothed image and a fraction SF to each of the three |
| 314 * other smoothed pixels, therefore a total fraction (1-5*SF)/4 to the final | 319 * other smoothed pixels, therefore a total fraction (1-5*SF)/4 to the final |
| 315 * output. The four corner-adjacent neighbor pixels contribute a fraction | 320 * output. The four corner-adjacent neighbor pixels contribute a fraction |
| 316 * SF to just one smoothed pixel, or SF/4 to the final output; while the | 321 * SF to just one smoothed pixel, or SF/4 to the final output; while the |
| 317 * eight edge-adjacent neighbors contribute SF to each of two smoothed | 322 * eight edge-adjacent neighbors contribute SF to each of two smoothed |
| 318 * pixels, or SF/2 overall. In order to use integer arithmetic, these | 323 * pixels, or SF/2 overall. In order to use integer arithmetic, these |
| 319 * factors are scaled by 2^16 = 65536. | 324 * factors are scaled by 2^16 = 65536. |
| 320 * Also recall that SF = smoothing_factor / 1024. | 325 * Also recall that SF = smoothing_factor / 1024. |
| 321 */ | 326 */ |
| 322 | 327 |
| 323 memberscale = 16384 - cinfo->smoothing_factor * 80; /* scaled (1-5*SF)/4 */ | 328 memberscale = 16384 - cinfo->smoothing_factor * 80; /* scaled (1-5*SF)/4 */ |
| 324 neighscale = cinfo->smoothing_factor * 16; /* scaled SF/4 */ | 329 neighscale = cinfo->smoothing_factor * 16; /* scaled SF/4 */ |
| 325 | 330 |
| 326 inrow = 0; | 331 inrow = 0; |
| 327 for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { | 332 for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { |
| 328 outptr = output_data[outrow]; | 333 outptr = output_data[outrow]; |
| 329 inptr0 = input_data[inrow]; | 334 inptr0 = input_data[inrow]; |
| 330 inptr1 = input_data[inrow+1]; | 335 inptr1 = input_data[inrow+1]; |
| 331 above_ptr = input_data[inrow-1]; | 336 above_ptr = input_data[inrow-1]; |
| 332 below_ptr = input_data[inrow+2]; | 337 below_ptr = input_data[inrow+2]; |
| 333 | 338 |
| 334 /* Special case for first column: pretend column -1 is same as column 0 */ | 339 /* Special case for first column: pretend column -1 is same as column 0 */ |
| 335 membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + | 340 membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + |
| 336 » » GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); | 341 GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); |
| 337 neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) + | 342 neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) + |
| 338 » GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + | 343 GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + |
| 339 » GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[2]) + | 344 GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[2]) + |
| 340 » GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[2]); | 345 GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[2]); |
| 341 neighsum += neighsum; | 346 neighsum += neighsum; |
| 342 neighsum += GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[2]) + | 347 neighsum += GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[2]) + |
| 343 » » GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[2]); | 348 GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[2]); |
| 344 membersum = membersum * memberscale + neighsum * neighscale; | 349 membersum = membersum * memberscale + neighsum * neighscale; |
| 345 *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); | 350 *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); |
| 346 inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2; | 351 inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2; |
| 347 | 352 |
| 348 for (colctr = output_cols - 2; colctr > 0; colctr--) { | 353 for (colctr = output_cols - 2; colctr > 0; colctr--) { |
| 349 /* sum of pixels directly mapped to this output element */ | 354 /* sum of pixels directly mapped to this output element */ |
| 350 membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + | 355 membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + |
| 351 » » GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); | 356 GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); |
| 352 /* sum of edge-neighbor pixels */ | 357 /* sum of edge-neighbor pixels */ |
| 353 neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) + | 358 neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) + |
| 354 » » GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + | 359 GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + |
| 355 » » GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[2]) + | 360 GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[2]) + |
| 356 » » GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[2]); | 361 GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[2]); |
| 357 /* The edge-neighbors count twice as much as corner-neighbors */ | 362 /* The edge-neighbors count twice as much as corner-neighbors */ |
| 358 neighsum += neighsum; | 363 neighsum += neighsum; |
| 359 /* Add in the corner-neighbors */ | 364 /* Add in the corner-neighbors */ |
| 360 neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[2]) + | 365 neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[2]) + |
| 361 » » GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[2]); | 366 GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[2]); |
| 362 /* form final output scaled up by 2^16 */ | 367 /* form final output scaled up by 2^16 */ |
| 363 membersum = membersum * memberscale + neighsum * neighscale; | 368 membersum = membersum * memberscale + neighsum * neighscale; |
| 364 /* round, descale and output it */ | 369 /* round, descale and output it */ |
| 365 *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); | 370 *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); |
| 366 inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2; | 371 inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2; |
| 367 } | 372 } |
| 368 | 373 |
| 369 /* Special case for last column */ | 374 /* Special case for last column */ |
| 370 membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + | 375 membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + |
| 371 » » GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); | 376 GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]); |
| 372 neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) + | 377 neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) + |
| 373 » GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + | 378 GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) + |
| 374 » GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[1]) + | 379 GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[1]) + |
| 375 » GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[1]); | 380 GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[1]); |
| 376 neighsum += neighsum; | 381 neighsum += neighsum; |
| 377 neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[1]) + | 382 neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[1]) + |
| 378 » » GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[1]); | 383 GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[1]); |
| 379 membersum = membersum * memberscale + neighsum * neighscale; | 384 membersum = membersum * memberscale + neighsum * neighscale; |
| 380 *outptr = (JSAMPLE) ((membersum + 32768) >> 16); | 385 *outptr = (JSAMPLE) ((membersum + 32768) >> 16); |
| 381 | 386 |
| 382 inrow += 2; | 387 inrow += 2; |
| 383 } | 388 } |
| 384 } | 389 } |
| 385 | 390 |
| 386 | 391 |
| 387 /* | 392 /* |
| 388 * Downsample pixel values of a single component. | 393 * Downsample pixel values of a single component. |
| 389 * This version handles the special case of a full-size component, | 394 * This version handles the special case of a full-size component, |
| 390 * with smoothing. One row of context is required. | 395 * with smoothing. One row of context is required. |
| 391 */ | 396 */ |
| 392 | 397 |
| 393 METHODDEF(void) | 398 METHODDEF(void) |
| 394 fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr, | 399 fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr, |
| 395 » » » JSAMPARRAY input_data, JSAMPARRAY output_data) | 400 JSAMPARRAY input_data, JSAMPARRAY output_data) |
| 396 { | 401 { |
| 397 int outrow; | 402 int outrow; |
| 398 JDIMENSION colctr; | 403 JDIMENSION colctr; |
| 399 JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; | 404 JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; |
| 400 register JSAMPROW inptr, above_ptr, below_ptr, outptr; | 405 register JSAMPROW inptr, above_ptr, below_ptr, outptr; |
| 401 INT32 membersum, neighsum, memberscale, neighscale; | 406 JLONG membersum, neighsum, memberscale, neighscale; |
| 402 int colsum, lastcolsum, nextcolsum; | 407 int colsum, lastcolsum, nextcolsum; |
| 403 | 408 |
| 404 /* Expand input data enough to let all the output samples be generated | 409 /* Expand input data enough to let all the output samples be generated |
| 405 * by the standard loop. Special-casing padded output would be more | 410 * by the standard loop. Special-casing padded output would be more |
| 406 * efficient. | 411 * efficient. |
| 407 */ | 412 */ |
| 408 expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2, | 413 expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2, |
| 409 » » cinfo->image_width, output_cols); | 414 cinfo->image_width, output_cols); |
| 410 | 415 |
| 411 /* Each of the eight neighbor pixels contributes a fraction SF to the | 416 /* Each of the eight neighbor pixels contributes a fraction SF to the |
| 412 * smoothed pixel, while the main pixel contributes (1-8*SF). In order | 417 * smoothed pixel, while the main pixel contributes (1-8*SF). In order |
| 413 * to use integer arithmetic, these factors are multiplied by 2^16 = 65536. | 418 * to use integer arithmetic, these factors are multiplied by 2^16 = 65536. |
| 414 * Also recall that SF = smoothing_factor / 1024. | 419 * Also recall that SF = smoothing_factor / 1024. |
| 415 */ | 420 */ |
| 416 | 421 |
| 417 memberscale = 65536L - cinfo->smoothing_factor * 512L; /* scaled 1-8*SF */ | 422 memberscale = 65536L - cinfo->smoothing_factor * 512L; /* scaled 1-8*SF */ |
| 418 neighscale = cinfo->smoothing_factor * 64; /* scaled SF */ | 423 neighscale = cinfo->smoothing_factor * 64; /* scaled SF */ |
| 419 | 424 |
| 420 for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { | 425 for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { |
| 421 outptr = output_data[outrow]; | 426 outptr = output_data[outrow]; |
| 422 inptr = input_data[outrow]; | 427 inptr = input_data[outrow]; |
| 423 above_ptr = input_data[outrow-1]; | 428 above_ptr = input_data[outrow-1]; |
| 424 below_ptr = input_data[outrow+1]; | 429 below_ptr = input_data[outrow+1]; |
| 425 | 430 |
| 426 /* Special case for first column */ | 431 /* Special case for first column */ |
| 427 colsum = GETJSAMPLE(*above_ptr++) + GETJSAMPLE(*below_ptr++) + | 432 colsum = GETJSAMPLE(*above_ptr++) + GETJSAMPLE(*below_ptr++) + |
| 428 » GETJSAMPLE(*inptr); | 433 GETJSAMPLE(*inptr); |
| 429 membersum = GETJSAMPLE(*inptr++); | 434 membersum = GETJSAMPLE(*inptr++); |
| 430 nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) + | 435 nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) + |
| 431 » » GETJSAMPLE(*inptr); | 436 GETJSAMPLE(*inptr); |
| 432 neighsum = colsum + (colsum - membersum) + nextcolsum; | 437 neighsum = colsum + (colsum - membersum) + nextcolsum; |
| 433 membersum = membersum * memberscale + neighsum * neighscale; | 438 membersum = membersum * memberscale + neighsum * neighscale; |
| 434 *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); | 439 *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); |
| 435 lastcolsum = colsum; colsum = nextcolsum; | 440 lastcolsum = colsum; colsum = nextcolsum; |
| 436 | 441 |
| 437 for (colctr = output_cols - 2; colctr > 0; colctr--) { | 442 for (colctr = output_cols - 2; colctr > 0; colctr--) { |
| 438 membersum = GETJSAMPLE(*inptr++); | 443 membersum = GETJSAMPLE(*inptr++); |
| 439 above_ptr++; below_ptr++; | 444 above_ptr++; below_ptr++; |
| 440 nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) + | 445 nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) + |
| 441 » » GETJSAMPLE(*inptr); | 446 GETJSAMPLE(*inptr); |
| 442 neighsum = lastcolsum + (colsum - membersum) + nextcolsum; | 447 neighsum = lastcolsum + (colsum - membersum) + nextcolsum; |
| 443 membersum = membersum * memberscale + neighsum * neighscale; | 448 membersum = membersum * memberscale + neighsum * neighscale; |
| 444 *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); | 449 *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16); |
| 445 lastcolsum = colsum; colsum = nextcolsum; | 450 lastcolsum = colsum; colsum = nextcolsum; |
| 446 } | 451 } |
| 447 | 452 |
| 448 /* Special case for last column */ | 453 /* Special case for last column */ |
| 449 membersum = GETJSAMPLE(*inptr); | 454 membersum = GETJSAMPLE(*inptr); |
| 450 neighsum = lastcolsum + (colsum - membersum) + colsum; | 455 neighsum = lastcolsum + (colsum - membersum) + colsum; |
| 451 membersum = membersum * memberscale + neighsum * neighscale; | 456 membersum = membersum * memberscale + neighsum * neighscale; |
| 452 *outptr = (JSAMPLE) ((membersum + 32768) >> 16); | 457 *outptr = (JSAMPLE) ((membersum + 32768) >> 16); |
| 453 | 458 |
| 454 } | 459 } |
| 455 } | 460 } |
| 456 | 461 |
| 457 #endif /* INPUT_SMOOTHING_SUPPORTED */ | 462 #endif /* INPUT_SMOOTHING_SUPPORTED */ |
| 458 | 463 |
| 459 | 464 |
| 460 /* | 465 /* |
| 461 * Module initialization routine for downsampling. | 466 * Module initialization routine for downsampling. |
| 462 * Note that we must select a routine for each component. | 467 * Note that we must select a routine for each component. |
| 463 */ | 468 */ |
| 464 | 469 |
| 465 GLOBAL(void) | 470 GLOBAL(void) |
| 466 jinit_downsampler (j_compress_ptr cinfo) | 471 jinit_downsampler (j_compress_ptr cinfo) |
| 467 { | 472 { |
| 468 my_downsample_ptr downsample; | 473 my_downsample_ptr downsample; |
| 469 int ci; | 474 int ci; |
| 470 jpeg_component_info * compptr; | 475 jpeg_component_info *compptr; |
| 471 boolean smoothok = TRUE; | 476 boolean smoothok = TRUE; |
| 472 | 477 |
| 473 downsample = (my_downsample_ptr) | 478 downsample = (my_downsample_ptr) |
| 474 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, | 479 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, |
| 475 » » » » SIZEOF(my_downsampler)); | 480 sizeof(my_downsampler)); |
| 476 cinfo->downsample = (struct jpeg_downsampler *) downsample; | 481 cinfo->downsample = (struct jpeg_downsampler *) downsample; |
| 477 downsample->pub.start_pass = start_pass_downsample; | 482 downsample->pub.start_pass = start_pass_downsample; |
| 478 downsample->pub.downsample = sep_downsample; | 483 downsample->pub.downsample = sep_downsample; |
| 479 downsample->pub.need_context_rows = FALSE; | 484 downsample->pub.need_context_rows = FALSE; |
| 480 | 485 |
| 481 if (cinfo->CCIR601_sampling) | 486 if (cinfo->CCIR601_sampling) |
| 482 ERREXIT(cinfo, JERR_CCIR601_NOTIMPL); | 487 ERREXIT(cinfo, JERR_CCIR601_NOTIMPL); |
| 483 | 488 |
| 484 /* Verify we can handle the sampling factors, and set up method pointers */ | 489 /* Verify we can handle the sampling factors, and set up method pointers */ |
| 485 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; | 490 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; |
| 486 ci++, compptr++) { | 491 ci++, compptr++) { |
| 487 if (compptr->h_samp_factor == cinfo->max_h_samp_factor && | 492 if (compptr->h_samp_factor == cinfo->max_h_samp_factor && |
| 488 » compptr->v_samp_factor == cinfo->max_v_samp_factor) { | 493 compptr->v_samp_factor == cinfo->max_v_samp_factor) { |
| 489 #ifdef INPUT_SMOOTHING_SUPPORTED | 494 #ifdef INPUT_SMOOTHING_SUPPORTED |
| 490 if (cinfo->smoothing_factor) { | 495 if (cinfo->smoothing_factor) { |
| 491 » downsample->methods[ci] = fullsize_smooth_downsample; | 496 downsample->methods[ci] = fullsize_smooth_downsample; |
| 492 » downsample->pub.need_context_rows = TRUE; | 497 downsample->pub.need_context_rows = TRUE; |
| 493 } else | 498 } else |
| 494 #endif | 499 #endif |
| 495 » downsample->methods[ci] = fullsize_downsample; | 500 downsample->methods[ci] = fullsize_downsample; |
| 496 } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor && | 501 } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor && |
| 497 » compptr->v_samp_factor == cinfo->max_v_samp_factor) { | 502 compptr->v_samp_factor == cinfo->max_v_samp_factor) { |
| 498 smoothok = FALSE; | 503 smoothok = FALSE; |
| 499 if (jsimd_can_h2v1_downsample()) | 504 if (jsimd_can_h2v1_downsample()) |
| 500 downsample->methods[ci] = jsimd_h2v1_downsample; | 505 downsample->methods[ci] = jsimd_h2v1_downsample; |
| 501 else | 506 else |
| 502 downsample->methods[ci] = h2v1_downsample; | 507 downsample->methods[ci] = h2v1_downsample; |
| 503 } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor && | 508 } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor && |
| 504 » compptr->v_samp_factor * 2 == cinfo->max_v_samp_factor) { | 509 compptr->v_samp_factor * 2 == cinfo->max_v_samp_factor) { |
| 505 #ifdef INPUT_SMOOTHING_SUPPORTED | 510 #ifdef INPUT_SMOOTHING_SUPPORTED |
| 506 if (cinfo->smoothing_factor) { | 511 if (cinfo->smoothing_factor) { |
| 507 » downsample->methods[ci] = h2v2_smooth_downsample; | 512 #if defined(__mips__) |
| 508 » downsample->pub.need_context_rows = TRUE; | 513 if (jsimd_can_h2v2_smooth_downsample()) |
| 514 downsample->methods[ci] = jsimd_h2v2_smooth_downsample; |
| 515 else |
| 516 #endif |
| 517 downsample->methods[ci] = h2v2_smooth_downsample; |
| 518 downsample->pub.need_context_rows = TRUE; |
| 509 } else | 519 } else |
| 510 #endif | 520 #endif |
| 511 » if (jsimd_can_h2v2_downsample()) | 521 { |
| 512 » downsample->methods[ci] = jsimd_h2v2_downsample; | 522 if (jsimd_can_h2v2_downsample()) |
| 513 » else | 523 downsample->methods[ci] = jsimd_h2v2_downsample; |
| 514 » downsample->methods[ci] = h2v2_downsample; | 524 else |
| 525 downsample->methods[ci] = h2v2_downsample; |
| 526 } |
| 515 } else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 && | 527 } else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 && |
| 516 » (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) { | 528 (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) { |
| 517 smoothok = FALSE; | 529 smoothok = FALSE; |
| 518 downsample->methods[ci] = int_downsample; | 530 downsample->methods[ci] = int_downsample; |
| 519 } else | 531 } else |
| 520 ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL); | 532 ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL); |
| 521 } | 533 } |
| 522 | 534 |
| 523 #ifdef INPUT_SMOOTHING_SUPPORTED | 535 #ifdef INPUT_SMOOTHING_SUPPORTED |
| 524 if (cinfo->smoothing_factor && !smoothok) | 536 if (cinfo->smoothing_factor && !smoothok) |
| 525 TRACEMS(cinfo, 0, JTRC_SMOOTH_NOTIMPL); | 537 TRACEMS(cinfo, 0, JTRC_SMOOTH_NOTIMPL); |
| 526 #endif | 538 #endif |
| 527 } | 539 } |
| OLD | NEW |