3dphotoshoot

diff libs/libjpeg/jcinit.c @ 14:06dc8b9b4f89

added libimago, libjpeg and libpng
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 07 Jun 2015 17:25:49 +0300
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libs/libjpeg/jcinit.c	Sun Jun 07 17:25:49 2015 +0300
     1.3 @@ -0,0 +1,72 @@
     1.4 +/*
     1.5 + * jcinit.c
     1.6 + *
     1.7 + * Copyright (C) 1991-1997, Thomas G. Lane.
     1.8 + * This file is part of the Independent JPEG Group's software.
     1.9 + * For conditions of distribution and use, see the accompanying README file.
    1.10 + *
    1.11 + * This file contains initialization logic for the JPEG compressor.
    1.12 + * This routine is in charge of selecting the modules to be executed and
    1.13 + * making an initialization call to each one.
    1.14 + *
    1.15 + * Logically, this code belongs in jcmaster.c.  It's split out because
    1.16 + * linking this routine implies linking the entire compression library.
    1.17 + * For a transcoding-only application, we want to be able to use jcmaster.c
    1.18 + * without linking in the whole library.
    1.19 + */
    1.20 +
    1.21 +#define JPEG_INTERNALS
    1.22 +#include "jinclude.h"
    1.23 +#include "jpeglib.h"
    1.24 +
    1.25 +
    1.26 +/*
    1.27 + * Master selection of compression modules.
    1.28 + * This is done once at the start of processing an image.  We determine
    1.29 + * which modules will be used and give them appropriate initialization calls.
    1.30 + */
    1.31 +
    1.32 +GLOBAL(void)
    1.33 +jinit_compress_master (j_compress_ptr cinfo)
    1.34 +{
    1.35 +  /* Initialize master control (includes parameter checking/processing) */
    1.36 +  jinit_c_master_control(cinfo, FALSE /* full compression */);
    1.37 +
    1.38 +  /* Preprocessing */
    1.39 +  if (! cinfo->raw_data_in) {
    1.40 +    jinit_color_converter(cinfo);
    1.41 +    jinit_downsampler(cinfo);
    1.42 +    jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */);
    1.43 +  }
    1.44 +  /* Forward DCT */
    1.45 +  jinit_forward_dct(cinfo);
    1.46 +  /* Entropy encoding: either Huffman or arithmetic coding. */
    1.47 +  if (cinfo->arith_code) {
    1.48 +    ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
    1.49 +  } else {
    1.50 +    if (cinfo->progressive_mode) {
    1.51 +#ifdef C_PROGRESSIVE_SUPPORTED
    1.52 +      jinit_phuff_encoder(cinfo);
    1.53 +#else
    1.54 +      ERREXIT(cinfo, JERR_NOT_COMPILED);
    1.55 +#endif
    1.56 +    } else
    1.57 +      jinit_huff_encoder(cinfo);
    1.58 +  }
    1.59 +
    1.60 +  /* Need a full-image coefficient buffer in any multi-pass mode. */
    1.61 +  jinit_c_coef_controller(cinfo,
    1.62 +		(boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding));
    1.63 +  jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);
    1.64 +
    1.65 +  jinit_marker_writer(cinfo);
    1.66 +
    1.67 +  /* We can now tell the memory manager to allocate virtual arrays. */
    1.68 +  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
    1.69 +
    1.70 +  /* Write the datastream header (SOI) immediately.
    1.71 +   * Frame and scan headers are postponed till later.
    1.72 +   * This lets application insert special markers after the SOI.
    1.73 +   */
    1.74 +  (*cinfo->marker->write_file_header) (cinfo);
    1.75 +}