istereo2

annotate libs/libjpeg/jcinit.c @ 9:64e15874f3bd

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