private int m_next_row; /* index of next row to fill/empty in strip */
/// <summary>
/// Initialize postprocessing controller.
/// </summary>
public jpeg_d_post_controller(jpeg_decompress_struct cinfo, bool need_full_buffer)
{
m_cinfo = cinfo;
/* Create the quantization buffer, if needed */
if (cinfo.m_quantize_colors)
{
/* The buffer strip height is max_v_samp_factor, which is typically
* an efficient number of rows for upsampling to return.
* (In the presence of output rescaling, we might want to be smarter?)
*/
m_strip_height = cinfo.m_max_v_samp_factor;
if (need_full_buffer)
{
/* Two-pass color quantization: need full-image storage. */
/* We round up the number of rows to a multiple of the strip height. */
m_whole_image = jpeg_common_struct.CreateSamplesArray(
cinfo.m_output_width * cinfo.m_out_color_components,
JpegUtils.jround_up(cinfo.m_output_height, m_strip_height));
m_whole_image.ErrorProcessor = cinfo;
}
else
{
/* One-pass color quantization: just make a strip buffer. */
m_buffer = jpeg_common_struct.AllocJpegSamples(
cinfo.m_output_width * cinfo.m_out_color_components, m_strip_height);
}
}
}