| 259 | */ |
| 260 | |
| 261 | METHODDEF(void) |
| 262 | h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, |
| 263 | JSAMPARRAY input_data, JSAMPARRAY output_data) |
| 264 | { |
| 265 | int inrow, outrow; |
| 266 | JDIMENSION outcol; |
| 267 | JDIMENSION output_cols = compptr->width_in_blocks * compptr->DCT_h_scaled_size; |
| 268 | register JSAMPROW inptr0, inptr1, outptr; |
| 269 | register int bias; |
| 270 | |
| 271 | /* Expand input data enough to let all the output samples be generated |
| 272 | * by the standard loop. Special-casing padded output would be more |
| 273 | * efficient. |
| 274 | */ |
| 275 | expand_right_edge(input_data, cinfo->max_v_samp_factor, |
| 276 | cinfo->image_width, output_cols * 2); |
| 277 | |
| 278 | inrow = outrow = 0; |
| 279 | while (inrow < cinfo->max_v_samp_factor) { |
| 280 | outptr = output_data[outrow]; |
| 281 | inptr0 = input_data[inrow]; |
| 282 | inptr1 = input_data[inrow+1]; |
| 283 | bias = 1; /* bias = 1,2,1,2,... for successive samples */ |
| 284 | for (outcol = 0; outcol < output_cols; outcol++) { |
| 285 | *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + |
| 286 | GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]) |
| 287 | + bias) >> 2); |
| 288 | bias ^= 3; /* 1=>2, 2=>1 */ |
| 289 | inptr0 += 2; inptr1 += 2; |
| 290 | } |
| 291 | inrow += 2; |
| 292 | outrow++; |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | |
| 297 | #ifdef INPUT_SMOOTHING_SUPPORTED |
nothing calls this directly
no test coverage detected