0N/A/*
0N/A * reserved comment block
0N/A * DO NOT REMOVE OR ALTER!
0N/A */
0N/A/*
0N/A * jcinit.c
0N/A *
0N/A * Copyright (C) 1991-1997, Thomas G. Lane.
0N/A * This file is part of the Independent JPEG Group's software.
0N/A * For conditions of distribution and use, see the accompanying README file.
0N/A *
0N/A * This file contains initialization logic for the JPEG compressor.
0N/A * This routine is in charge of selecting the modules to be executed and
0N/A * making an initialization call to each one.
0N/A *
0N/A * Logically, this code belongs in jcmaster.c. It's split out because
0N/A * linking this routine implies linking the entire compression library.
0N/A * For a transcoding-only application, we want to be able to use jcmaster.c
0N/A * without linking in the whole library.
0N/A */
0N/A
0N/A#define JPEG_INTERNALS
0N/A#include "jinclude.h"
0N/A#include "jpeglib.h"
0N/A
0N/A
0N/A/*
0N/A * Master selection of compression modules.
0N/A * This is done once at the start of processing an image. We determine
0N/A * which modules will be used and give them appropriate initialization calls.
0N/A */
0N/A
0N/AGLOBAL(void)
0N/Ajinit_compress_master (j_compress_ptr cinfo)
0N/A{
0N/A /* Initialize master control (includes parameter checking/processing) */
0N/A jinit_c_master_control(cinfo, FALSE /* full compression */);
0N/A
0N/A /* Preprocessing */
0N/A if (! cinfo->raw_data_in) {
0N/A jinit_color_converter(cinfo);
0N/A jinit_downsampler(cinfo);
0N/A jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */);
0N/A }
0N/A /* Forward DCT */
0N/A jinit_forward_dct(cinfo);
0N/A /* Entropy encoding: either Huffman or arithmetic coding. */
0N/A if (cinfo->arith_code) {
0N/A ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
0N/A } else {
0N/A if (cinfo->progressive_mode) {
0N/A#ifdef C_PROGRESSIVE_SUPPORTED
0N/A jinit_phuff_encoder(cinfo);
0N/A#else
0N/A ERREXIT(cinfo, JERR_NOT_COMPILED);
0N/A#endif
0N/A } else
0N/A jinit_huff_encoder(cinfo);
0N/A }
0N/A
0N/A /* Need a full-image coefficient buffer in any multi-pass mode. */
0N/A jinit_c_coef_controller(cinfo,
0N/A (boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding));
0N/A jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);
0N/A
0N/A jinit_marker_writer(cinfo);
0N/A
0N/A /* We can now tell the memory manager to allocate virtual arrays. */
0N/A (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
0N/A
0N/A /* Write the datastream header (SOI) immediately.
0N/A * Frame and scan headers are postponed till later.
0N/A * This lets application insert special markers after the SOI.
0N/A */
0N/A (*cinfo->marker->write_file_header) (cinfo);
0N/A}