private void h2v1_downsample(int componentIndex, byte[][] input_data, int startInputRow, byte[][] output_data, int startOutRow)
{
/* Expand input data enough to let all the output samples be generated
* by the standard loop. Special-casing padded output would be more
* efficient.
*/
jpeg_component_info compptr = m_cinfo.Component_info[componentIndex];
int output_cols = compptr.Width_in_blocks * compptr.DCT_h_scaled_size;
expand_right_edge(input_data, startInputRow, m_cinfo.m_max_v_samp_factor, m_cinfo.m_image_width, output_cols * 2);
for (int outrow = 0; outrow < m_cinfo.m_max_v_samp_factor; outrow++)
{
/* bias = 0,1,0,1,... for successive samples */
int bias = 0;
int inputColumn = 0;
for (int outcol = 0; outcol < output_cols; outcol++)
{
output_data[startOutRow + outrow][outcol] = (byte)(
((int)input_data[startInputRow + outrow][inputColumn] +
(int)input_data[startInputRow + outrow][inputColumn + 1] + bias) >> 1);
bias ^= 1; /* 0=>1, 1=>0 */
inputColumn += 2;
}
}
}