4 * Copyright (C) 1991-1997, Thomas G. Lane.
5 * This file is part of the Independent JPEG Group's software.
6 * For conditions of distribution and use, see the accompanying README file.
8 * This file contains initialization logic for the JPEG compressor.
9 * This routine is in charge of selecting the modules to be executed and
10 * making an initialization call to each one.
12 * Logically, this code belongs in jcmaster.c. It's split out because
13 * linking this routine implies linking the entire compression library.
14 * For a transcoding-only application, we want to be able to use jcmaster.c
15 * without linking in the whole library.
18 #define JPEG_INTERNALS
24 * Master selection of compression modules.
25 * This is done once at the start of processing an image. We determine
26 * which modules will be used and give them appropriate initialization calls.
30 jinit_compress_master (j_compress_ptr cinfo)
32 /* Initialize master control (includes parameter checking/processing) */
33 jinit_c_master_control(cinfo, FALSE /* full compression */);
35 /* Initialize compression codec */
39 if (! cinfo->raw_data_in) {
40 jinit_color_converter(cinfo);
41 jinit_downsampler(cinfo);
42 jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */);
45 jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);
47 jinit_marker_writer(cinfo);
49 /* We can now tell the memory manager to allocate virtual arrays. */
50 (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
52 /* Write the datastream header (SOI) immediately.
53 * Frame and scan headers are postponed till later.
54 * This lets application insert special markers after the SOI.
56 (*cinfo->marker->write_file_header) (cinfo);