/* In this version we simply downsample each component independently.  */
sep_downsample(j_compress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_index, JSAMPIMAGE output_buf, JDIMENSION out_row_group_index)
/* In this version we simply downsample each component independently.  */
sep_downsample(j_compress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_index, JSAMPIMAGE output_buf, JDIMENSION out_row_group_index)
{
    my_downsample_ptr downsample = (my_downsample_ptr)cinfo->downsample;
    int ci;
    jpeg_component_info* compptr;
    JSAMPARRAY in_ptr, out_ptr;
    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
        ci++, compptr++) {
        in_ptr = input_buf[ci] + in_row_index;
        out_ptr = output_buf[ci] + (out_row_group_index * compptr->v_samp_factor);
        (*downsample->methods[ci]) (cinfo, compptr, in_ptr, out_ptr);
    }
}