dbf-halloween2015

annotate libs/libjpeg/jcinit.c @ 1:c3f5c32cb210

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