vrshoot

annotate libs/libjpeg/jcinit.c @ 2:334d17aed7de

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