jcapistd.c revision 0
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 application interface code for the compression half 0N/A * of the JPEG library. These are the "standard" API routines that are 0N/A * used in the normal full-compression case. They are not used by a 0N/A * transcoding-only application. Note that if an application links in 0N/A * jpeg_start_compress, it will end up linking in the entire compressor. 0N/A * We thus must separate this file from jcapimin.c to avoid linking the 0N/A * whole compression library into a transcoder. 0N/A * Compression initialization. 0N/A * Before calling this, all parameters and a data destination must be set up. 0N/A * We require a write_all_tables parameter as a failsafe check when writing 0N/A * multiple datastreams from the same compression object. Since prior runs 0N/A * will have left all the tables marked sent_table=TRUE, a subsequent run 0N/A * would emit an abbreviated stream (no tables) by default. This may be what 0N/A * is wanted, but for safety's sake it should not be the default behavior: 0N/A * programmers should have to make a deliberate choice to emit abbreviated 0N/A * images. Therefore the documentation and examples should encourage people 0N/A * to pass write_all_tables=TRUE; then it will take active thought to do the 0N/A /* (Re)initialize error mgr and destination modules */ 0N/A /* Perform master selection of active modules */ 0N/A /* Set up for the first pass */ 0N/A /* Ready for application to drive first pass through jpeg_write_scanlines 0N/A * or jpeg_write_raw_data. 0N/A * Write some scanlines of data to the JPEG compressor. 0N/A * The return value will be the number of lines actually written. 0N/A * This should be less than the supplied num_lines only in case that 0N/A * the data destination module has requested suspension of the compressor, 0N/A * or if more than image_height scanlines are passed in. 0N/A * Note: we warn about excess calls to jpeg_write_scanlines() since 0N/A * this likely signals an application programmer error. However, 0N/A * excess scanlines passed in the last valid call are *silently* ignored, 0N/A * so that the application need not adjust num_lines for end-of-image 0N/A * when using a multiple-scanline buffer. 0N/A /* Call progress monitor hook if present */ 0N/A /* Give master control module another chance if this is first call to 0N/A * jpeg_write_scanlines. This lets output of the frame/scan headers be 0N/A * delayed so that application can write COM, etc, markers between 0N/A * jpeg_start_compress and jpeg_write_scanlines. 0N/A /* Ignore any extra scanlines at bottom of image. */ 0N/A * Alternate entry point to write raw data. 0N/A * Processes exactly one iMCU row per call, unless suspended. 0N/A /* Call progress monitor hook if present */ 0N/A /* Give master control module another chance if this is first call to 0N/A * jpeg_write_raw_data. This lets output of the frame/scan headers be 0N/A * delayed so that application can write COM, etc, markers between 0N/A * jpeg_start_compress and jpeg_write_raw_data. 0N/A /* Verify that at least one iMCU row has been passed. */ 0N/A /* Directly compress the row. */ 0N/A /* If compressor did not consume the whole row, suspend processing. */ 0N/A /* OK, we processed one iMCU row. */