/* A note about the "bias" calculations: when rounding fractional values to integer, we do not want to always round 0.5 up to the next integer. If we did that, we'd introduce a noticeable bias towards larger values. Instead, this code is arranged so that 0.5 will be rounded up or down at alternate pixel locations (a simple ordered dither pattern).  */
h2v1_downsample_orig(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)
/* A note about the "bias" calculations: when rounding fractional values to integer, we do not want to always round 0.5 up to the next integer. If we did that, we'd introduce a noticeable bias towards larger values. Instead, this code is arranged so that 0.5 will be rounded up or down at alternate pixel locations (a simple ordered dither pattern).  */
h2v1_downsample_orig(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data)
{
    int outrow;
    JDIMENSION outcol;
    JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;
    register JSAMPROW inptr, outptr;
    register int bias;
    expand_right_edge(input_data, cinfo->max_v_samp_factor,
        cinfo->image_width, output_cols * 2);
    for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
        outptr = output_data[outrow];
        inptr = input_data[outrow];
        bias = 0;
        for (outcol = 0; outcol < output_cols; outcol++) {
            *outptr++ = (JSAMPLE)((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1])
                + bias) >> 1);
            bias ^= 1;
            inptr += 2;
        }
    }
}