Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / compiler / libjpeg / main / jcinit.c
blobd04a401f5c0be390d674754aa5b7b3c938a82048
1 /*
2 $Id$
3 */
5 /*
6 * jcinit.c
8 * Copyright (C) 1991-1997, Thomas G. Lane.
9 * This file is part of the Independent JPEG Group's software.
10 * For conditions of distribution and use, see the accompanying README file.
12 * This file contains initialization logic for the JPEG compressor.
13 * This routine is in charge of selecting the modules to be executed and
14 * making an initialization call to each one.
16 * Logically, this code belongs in jcmaster.c. It's split out because
17 * linking this routine implies linking the entire compression library.
18 * For a transcoding-only application, we want to be able to use jcmaster.c
19 * without linking in the whole library.
22 #define JPEG_INTERNALS
23 #include "jinclude.h"
24 #include "jpeglib.h"
28 * Master selection of compression modules.
29 * This is done once at the start of processing an image. We determine
30 * which modules will be used and give them appropriate initialization calls.
33 JGLOBAL(void)
34 jinit_compress_master (j_compress_ptr cinfo)
36 /* Initialize master control (includes parameter checking/processing) */
37 jinit_c_master_control(cinfo, FALSE /* full compression */);
39 /* Initialize compression codec */
40 jinit_c_codec(cinfo);
42 /* Preprocessing */
43 if (! cinfo->raw_data_in) {
44 jinit_color_converter(cinfo);
45 jinit_downsampler(cinfo);
46 jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */);
49 jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);
51 jinit_marker_writer(cinfo);
53 /* We can now tell the memory manager to allocate virtual arrays. */
54 (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
56 /* Write the datastream header (SOI) immediately.
57 * Frame and scan headers are postponed till later.
58 * This lets application insert special markers after the SOI.
60 (*cinfo->marker->write_file_header) (cinfo);