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 main buffer controller for compression. 0N/A * The main buffer lies between the pre-processor and the JPEG 0N/A * compressor proper; it holds downsampled data in the JPEG colorspace. 0N/A/* Note: currently, there is no operating mode in which a full-image buffer 0N/A * is needed at this step. If there were, that mode could not be used with 0N/A * "raw data" input, since this module is bypassed in that case. However, 0N/A * we've left the code here for possible use in special applications. 0N/A/* Private buffer controller object */ 0N/A /* If using just a strip buffer, this points to the entire set of buffers 0N/A * (we allocate one for each component). In the full-image case, this 0N/A * points to the currently accessible strips of the virtual arrays. 0N/A /* If using full-image storage, this array holds pointers to virtual-array 0N/A * control blocks for each component. Unused if not full-image storage. 0N/A/* Forward declarations */ 0N/A * Initialize for a processing pass. 0N/A /* Do nothing in raw-data mode. */ 0N/A * Process some data. 0N/A * This routine handles the simple pass-through mode, 0N/A * where we have only a strip buffer. 0N/A /* Read input data if we haven't filled the main buffer yet */ 0N/A /* If we don't have a full iMCU row buffered, return to application for 0N/A * more data. Note that preprocessor will always pad to fill the iMCU row 0N/A * at the bottom of the image. 0N/A /* Send the completed row to the compressor */ 0N/A /* If compressor did not consume the whole row, then we must need to 0N/A * suspend processing and return to the application. In this situation 0N/A * we pretend we didn't yet consume the last input row; otherwise, if 0N/A * it happened to be the last row of the image, the application would 0N/A * think we were done. 0N/A /* We did finish the row. Undo our little suspension hack if a previous 0N/A * call suspended; then mark the main buffer empty. 0N/A * Process some data. 0N/A * This routine handles all of the modes that use a full-size buffer. 0N/A /* Realign the virtual buffers if at the start of an iMCU row. */ 0N/A /* In a read pass, pretend we just read some source data. */ 0N/A /* If a write pass, read input data until the current iMCU row is full. */ 0N/A /* Note: preprocessor will pad if necessary to fill the last iMCU row. */ 0N/A /* Return to application if we need more data to fill the iMCU row. */ 0N/A /* Emit data, unless this is a sink-only pass. */ 0N/A /* If compressor did not consume the whole row, then we must need to 0N/A * suspend processing and return to the application. In this situation 0N/A * we pretend we didn't yet consume the last input row; otherwise, if 0N/A * it happened to be the last row of the image, the application would 0N/A * think we were done. 0N/A /* We did finish the row. Undo our little suspension hack if a previous 0N/A * call suspended; then mark the main buffer empty. 0N/A /* If get here, we are done with this iMCU row. Mark buffer empty. */ 0N/A#
endif /* FULL_MAIN_BUFFER_SUPPORTED */ 0N/A * Initialize main buffer controller. 0N/A /* We don't need to create a buffer in raw-data mode. */ 0N/A /* Create the buffer. It holds downsampled data, so each component 0N/A * may be of a different size. 0N/A /* Allocate a full-image virtual array for each component */ 0N/A /* Note we pad the bottom to a multiple of the iMCU height */ 0N/A /* Allocate a strip buffer for each component */