jcinit.c

Go to the documentation of this file.
00001 /*
00002  * jcinit.c
00003  *
00004  * Copyright (C) 1991-1997, Thomas G. Lane.
00005  * This file is part of the Independent JPEG Group's software.
00006  * For conditions of distribution and use, see the accompanying README file.
00007  *
00008  * This file contains initialization logic for the JPEG compressor.
00009  * This routine is in charge of selecting the modules to be executed and
00010  * making an initialization call to each one.
00011  *
00012  * Logically, this code belongs in jcmaster.c.  It's split out because
00013  * linking this routine implies linking the entire compression library.
00014  * For a transcoding-only application, we want to be able to use jcmaster.c
00015  * without linking in the whole library.
00016  */
00017 
00018 #define JPEG_INTERNALS
00019 #include "jinclude.h"
00020 #include "jpeglib.h"
00021 
00022 
00023 /*
00024  * Master selection of compression modules.
00025  * This is done once at the start of processing an image.  We determine
00026  * which modules will be used and give them appropriate initialization calls.
00027  */
00028 
00029 GLOBAL(void)
00030 jinit_compress_master (j_compress_ptr cinfo)
00031 {
00032   /* Initialize master control (includes parameter checking/processing) */
00033   jinit_c_master_control(cinfo, FALSE /* full compression */);
00034 
00035   /* Preprocessing */
00036   if (! cinfo->raw_data_in) {
00037     jinit_color_converter(cinfo);
00038     jinit_downsampler(cinfo);
00039     jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */);
00040   }
00041   /* Forward DCT */
00042   jinit_forward_dct(cinfo);
00043   /* Entropy encoding: either Huffman or arithmetic coding. */
00044   if (cinfo->arith_code)
00045     jinit_arith_encoder(cinfo);
00046   else {
00047     jinit_huff_encoder(cinfo);
00048   }
00049 
00050   /* Need a full-image coefficient buffer in any multi-pass mode. */
00051   jinit_c_coef_controller(cinfo,
00052                 (boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding));
00053   jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);
00054 
00055   jinit_marker_writer(cinfo);
00056 
00057   /* We can now tell the memory manager to allocate virtual arrays. */
00058   (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
00059 
00060   /* Write the datastream header (SOI) immediately.
00061    * Frame and scan headers are postponed till later.
00062    * This lets application insert special markers after the SOI.
00063    */
00064   (*cinfo->marker->write_file_header) (cinfo);
00065 }

Generated on Tue Jul 5 14:13:28 2011 for ROOT_528-00b_version by  doxygen 1.5.1