source: golgotha/src/i4/loaders/jpg/jcinit.cc @ 608

Last change on this file since 608 was 80, checked in by Sam Hocevar, 15 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 2.9 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9/*
10 * jcinit.c
11 *
12 * Copyright (C) 1991-1996, Thomas G. Lane.
13 * This file is part of the Independent JPEG Group's software.
14 * For conditions of distribution and use, see the accompanying README file.
15 *
16 * This file contains initialization logic for the JPEG compressor.
17 * This routine is in charge of selecting the modules to be executed and
18 * making an initialization call to each one.
19 *
20 * Logically, this code belongs in jcmaster.c.  It's split out because
21 * linking this routine implies linking the entire compression library.
22 * For a transcoding-only application, we want to be able to use jcmaster.c
23 * without linking in the whole library.
24 */
25
26#define JPEG_INTERNALS
27#include "loaders/jpg/jinclude.h"
28#include "loaders/jpg/jpeglib.h"
29
30
31/*
32 * Master selection of compression modules.
33 * This is done once at the start of processing an image.  We determine
34 * which modules will be used and give them appropriate initialization calls.
35 */
36
37GLOBAL(void)
38jinit_compress_master (j_compress_ptr cinfo)
39{
40  /* Initialize master control (includes parameter checking/processing) */
41  jinit_c_master_control(cinfo, FALSE /* full compression */);
42
43  /* Preprocessing */
44  if (! cinfo->raw_data_in) {
45    jinit_color_converter(cinfo);
46    jinit_downsampler(cinfo);
47    jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */);
48  }
49  /* Forward DCT */
50  jinit_forward_dct(cinfo);
51  /* Entropy encoding: either Huffman or arithmetic coding. */
52  if (cinfo->arith_code) {
53    ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
54  } else {
55    if (cinfo->progressive_mode) {
56#ifdef C_PROGRESSIVE_SUPPORTED
57      jinit_phuff_encoder(cinfo);
58#else
59      ERREXIT(cinfo, JERR_NOT_COMPILED);
60#endif
61    } else
62      jinit_huff_encoder(cinfo);
63  }
64
65  /* Need a full-image coefficient buffer in any multi-pass mode. */
66  jinit_c_coef_controller(cinfo,
67                          (cinfo->num_scans > 1 || cinfo->optimize_coding));
68  jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);
69
70  jinit_marker_writer(cinfo);
71
72  /* We can now tell the memory manager to allocate virtual arrays. */
73  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
74
75  /* Write the datastream header (SOI) immediately.
76   * Frame and scan headers are postponed till later.
77   * This lets application insert special markers after the SOI.
78   */
79  (*cinfo->marker->write_file_header) (cinfo);
80}
Note: See TracBrowser for help on using the repository browser.