|
<html><head><title>dlib C++ Library - jcinit.c</title></head><body bgcolor='white'><pre> |
|
<font color='#009900'>/*
|
|
* jcinit.c
|
|
*
|
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
|
* This file is part of the Independent JPEG Group's software.
|
|
* For conditions of distribution and use, see the accompanying README file.
|
|
*
|
|
* This file contains initialization logic for the JPEG compressor.
|
|
* This routine is in charge of selecting the modules to be executed and
|
|
* making an initialization call to each one.
|
|
*
|
|
* Logically, this code belongs in jcmaster.c. It's split out because
|
|
* linking this routine implies linking the entire compression library.
|
|
* For a transcoding-only application, we want to be able to use jcmaster.c
|
|
* without linking in the whole library.
|
|
*/</font>
|
|
|
|
<font color='#0000FF'>#define</font> JPEG_INTERNALS
|
|
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='jinclude.h.html'>jinclude.h</a>"
|
|
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='jpeglib.h.html'>jpeglib.h</a>"
|
|
|
|
|
|
<font color='#009900'>/*
|
|
* Master selection of compression modules.
|
|
* This is done once at the start of processing an image. We determine
|
|
* which modules will be used and give them appropriate initialization calls.
|
|
*/</font>
|
|
|
|
<b><a name='GLOBAL'></a>GLOBAL</b><font face='Lucida Console'>(</font><font color='#0000FF'><u>void</u></font><font face='Lucida Console'>)</font>
|
|
<b><a name='jinit_compress_master'></a>jinit_compress_master</b> <font face='Lucida Console'>(</font>j_compress_ptr cinfo<font face='Lucida Console'>)</font>
|
|
<b>{</b>
|
|
<font color='#009900'>/* Initialize master control (includes parameter checking/processing) */</font>
|
|
<font color='#BB00BB'>jinit_c_master_control</font><font face='Lucida Console'>(</font>cinfo, FALSE <font color='#009900'>/* full compression */</font><font face='Lucida Console'>)</font>;
|
|
|
|
<font color='#009900'>/* Preprocessing */</font>
|
|
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font> cinfo<font color='#5555FF'>-</font><font color='#5555FF'>></font>raw_data_in<font face='Lucida Console'>)</font> <b>{</b>
|
|
<font color='#BB00BB'>jinit_color_converter</font><font face='Lucida Console'>(</font>cinfo<font face='Lucida Console'>)</font>;
|
|
<font color='#BB00BB'>jinit_downsampler</font><font face='Lucida Console'>(</font>cinfo<font face='Lucida Console'>)</font>;
|
|
<font color='#BB00BB'>jinit_c_prep_controller</font><font face='Lucida Console'>(</font>cinfo, FALSE <font color='#009900'>/* never need full buffer here */</font><font face='Lucida Console'>)</font>;
|
|
<b>}</b>
|
|
<font color='#009900'>/* Forward DCT */</font>
|
|
<font color='#BB00BB'>jinit_forward_dct</font><font face='Lucida Console'>(</font>cinfo<font face='Lucida Console'>)</font>;
|
|
<font color='#009900'>/* Entropy encoding: either Huffman or arithmetic coding. */</font>
|
|
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>cinfo<font color='#5555FF'>-</font><font color='#5555FF'>></font>arith_code<font face='Lucida Console'>)</font>
|
|
<font color='#BB00BB'>jinit_arith_encoder</font><font face='Lucida Console'>(</font>cinfo<font face='Lucida Console'>)</font>;
|
|
<font color='#0000FF'>else</font> <b>{</b>
|
|
<font color='#BB00BB'>jinit_huff_encoder</font><font face='Lucida Console'>(</font>cinfo<font face='Lucida Console'>)</font>;
|
|
<b>}</b>
|
|
|
|
<font color='#009900'>/* Need a full-image coefficient buffer in any multi-pass mode. */</font>
|
|
<font color='#BB00BB'>jinit_c_coef_controller</font><font face='Lucida Console'>(</font>cinfo,
|
|
<font face='Lucida Console'>(</font>boolean<font face='Lucida Console'>)</font> <font face='Lucida Console'>(</font>cinfo<font color='#5555FF'>-</font><font color='#5555FF'>></font>num_scans <font color='#5555FF'>></font> <font color='#979000'>1</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font> cinfo<font color='#5555FF'>-</font><font color='#5555FF'>></font>optimize_coding<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
|
|
<font color='#BB00BB'>jinit_c_main_controller</font><font face='Lucida Console'>(</font>cinfo, FALSE <font color='#009900'>/* never need full buffer here */</font><font face='Lucida Console'>)</font>;
|
|
|
|
<font color='#BB00BB'>jinit_marker_writer</font><font face='Lucida Console'>(</font>cinfo<font face='Lucida Console'>)</font>;
|
|
|
|
<font color='#009900'>/* We can now tell the memory manager to allocate virtual arrays. */</font>
|
|
<font face='Lucida Console'>(</font><font color='#5555FF'>*</font>cinfo<font color='#5555FF'>-</font><font color='#5555FF'>></font>mem<font color='#5555FF'>-</font><font color='#5555FF'>></font>realize_virt_arrays<font face='Lucida Console'>)</font> <font face='Lucida Console'>(</font><font face='Lucida Console'>(</font>j_common_ptr<font face='Lucida Console'>)</font> cinfo<font face='Lucida Console'>)</font>;
|
|
|
|
<font color='#009900'>/* Write the datastream header (SOI) immediately.
|
|
* Frame and scan headers are postponed till later.
|
|
* This lets application insert special markers after the SOI.
|
|
*/</font>
|
|
<font face='Lucida Console'>(</font><font color='#5555FF'>*</font>cinfo<font color='#5555FF'>-</font><font color='#5555FF'>></font>marker<font color='#5555FF'>-</font><font color='#5555FF'>></font>write_file_header<font face='Lucida Console'>)</font> <font face='Lucida Console'>(</font>cinfo<font face='Lucida Console'>)</font>;
|
|
<b>}</b>
|
|
|
|
</pre></body></html> |