istereo

annotate libs/libjpeg/jcinit.c @ 26:862a3329a8f0

wohooo, added a shitload of code from zlib/libpng/libjpeg. When the good lord was raining shared libraries the iphone held a fucking umbrella...
author John Tsiombikas <nuclear@mutantstargoat.com>
date Thu, 08 Sep 2011 06:28:38 +0300
parents
children
rev   line source
nuclear@26 1 /*
nuclear@26 2 * jcinit.c
nuclear@26 3 *
nuclear@26 4 * Copyright (C) 1991-1997, Thomas G. Lane.
nuclear@26 5 * This file is part of the Independent JPEG Group's software.
nuclear@26 6 * For conditions of distribution and use, see the accompanying README file.
nuclear@26 7 *
nuclear@26 8 * This file contains initialization logic for the JPEG compressor.
nuclear@26 9 * This routine is in charge of selecting the modules to be executed and
nuclear@26 10 * making an initialization call to each one.
nuclear@26 11 *
nuclear@26 12 * Logically, this code belongs in jcmaster.c. It's split out because
nuclear@26 13 * linking this routine implies linking the entire compression library.
nuclear@26 14 * For a transcoding-only application, we want to be able to use jcmaster.c
nuclear@26 15 * without linking in the whole library.
nuclear@26 16 */
nuclear@26 17
nuclear@26 18 #define JPEG_INTERNALS
nuclear@26 19 #include "jinclude.h"
nuclear@26 20 #include "jpeglib.h"
nuclear@26 21
nuclear@26 22
nuclear@26 23 /*
nuclear@26 24 * Master selection of compression modules.
nuclear@26 25 * This is done once at the start of processing an image. We determine
nuclear@26 26 * which modules will be used and give them appropriate initialization calls.
nuclear@26 27 */
nuclear@26 28
nuclear@26 29 GLOBAL(void)
nuclear@26 30 jinit_compress_master (j_compress_ptr cinfo)
nuclear@26 31 {
nuclear@26 32 /* Initialize master control (includes parameter checking/processing) */
nuclear@26 33 jinit_c_master_control(cinfo, FALSE /* full compression */);
nuclear@26 34
nuclear@26 35 /* Preprocessing */
nuclear@26 36 if (! cinfo->raw_data_in) {
nuclear@26 37 jinit_color_converter(cinfo);
nuclear@26 38 jinit_downsampler(cinfo);
nuclear@26 39 jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */);
nuclear@26 40 }
nuclear@26 41 /* Forward DCT */
nuclear@26 42 jinit_forward_dct(cinfo);
nuclear@26 43 /* Entropy encoding: either Huffman or arithmetic coding. */
nuclear@26 44 if (cinfo->arith_code) {
nuclear@26 45 ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
nuclear@26 46 } else {
nuclear@26 47 if (cinfo->progressive_mode) {
nuclear@26 48 #ifdef C_PROGRESSIVE_SUPPORTED
nuclear@26 49 jinit_phuff_encoder(cinfo);
nuclear@26 50 #else
nuclear@26 51 ERREXIT(cinfo, JERR_NOT_COMPILED);
nuclear@26 52 #endif
nuclear@26 53 } else
nuclear@26 54 jinit_huff_encoder(cinfo);
nuclear@26 55 }
nuclear@26 56
nuclear@26 57 /* Need a full-image coefficient buffer in any multi-pass mode. */
nuclear@26 58 jinit_c_coef_controller(cinfo,
nuclear@26 59 (boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding));
nuclear@26 60 jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);
nuclear@26 61
nuclear@26 62 jinit_marker_writer(cinfo);
nuclear@26 63
nuclear@26 64 /* We can now tell the memory manager to allocate virtual arrays. */
nuclear@26 65 (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
nuclear@26 66
nuclear@26 67 /* Write the datastream header (SOI) immediately.
nuclear@26 68 * Frame and scan headers are postponed till later.
nuclear@26 69 * This lets application insert special markers after the SOI.
nuclear@26 70 */
nuclear@26 71 (*cinfo->marker->write_file_header) (cinfo);
nuclear@26 72 }