0N/A * reserved comment block 0N/A * DO NOT REMOVE OR ALTER! 0N/A * Copyright (C) 1994-1996, Thomas G. Lane. 0N/A * This file is part of the Independent JPEG Group's software. 0N/A * For conditions of distribution and use, see the accompanying README file. 0N/A * This file contains the decompression postprocessing controller. 0N/A * This controller manages the upsampling, color conversion, and color 0N/A/* Private buffer controller object */ 0N/A /* Color quantization source buffer: this holds output data from 0N/A * For two-pass color quantization, we need a full-image buffer; 0N/A * for one-pass operation, a strip buffer is sufficient. 0N/A /* for two-pass mode only: */ 0N/A/* Forward declarations */ 0N/A * Initialize for a processing pass. 0N/A /* Single-pass processing with color quantization. */ 0N/A /* We could be doing buffered-image output before starting a 2-pass 0N/A * color quantization; in that case, jinit_d_post_controller did not 0N/A * allocate a strip buffer. Use the virtual-array buffer as workspace. 0N/A /* For single-pass processing without color quantization, 0N/A * I have no work to do; just call the upsampler directly. 0N/A /* First pass of 2-pass quantization */ 0N/A /* Second pass of 2-pass quantization */ 0N/A#
endif /* QUANT_2PASS_SUPPORTED */ 0N/A * Process some data in the one-pass (strip buffer) case. 0N/A * This is used for color precision reduction as well as one-pass quantization. 0N/A /* Fill the buffer, but not more than what we can dump out in one go. */ 0N/A /* Note we rely on the upsampler to detect bottom of image. */ 0N/A /* Quantize and emit data. */ 0N/A * Process some data in the first pass of 2-pass quantization. 0N/A /* Reposition virtual buffer if at start of strip. */ 0N/A /* Upsample some data (up to a strip height's worth). */ 0N/A /* Allow quantizer to scan new data. No data is emitted, */ 0N/A /* but we advance out_row_ctr so outer loop can tell when we're done. */ 0N/A /* Advance if we filled the strip. */ 0N/A * Process some data in the second pass of 2-pass quantization. 0N/A /* Reposition virtual buffer if at start of strip. */ 0N/A /* Determine number of rows to emit. */ 0N/A /* We have to check bottom of image here, can't depend on upsampler. */ 0N/A /* Quantize and emit data. */ 0N/A /* Advance if we filled the strip. */ 0N/A#
endif /* QUANT_2PASS_SUPPORTED */ 0N/A * Initialize postprocessing controller. 0N/A /* Create the quantization buffer, if needed */ 0N/A /* The buffer strip height is max_v_samp_factor, which is typically 0N/A * an efficient number of rows for upsampling to return. 0N/A * (In the presence of output rescaling, we might want to be smarter?) 0N/A /* Two-pass color quantization: need full-image storage. */ 0N/A /* We round up the number of rows to a multiple of the strip height. */ 0N/A#
endif /* QUANT_2PASS_SUPPORTED */ 0N/A /* One-pass color quantization: just make a strip buffer. */