3dphotoshoot

annotate libs/libjpeg/jcinit.c @ 27:3d082c566b53

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