Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/external/source/vncdll/winvnc/libjpeg/jcinit.c
Views: 11784
/*1* jcinit.c2*3* Copyright (C) 1991-1997, Thomas G. Lane.4* This file is part of the Independent JPEG Group's software.5* For conditions of distribution and use, see the accompanying README file.6*7* This file contains initialization logic for the JPEG compressor.8* This routine is in charge of selecting the modules to be executed and9* making an initialization call to each one.10*11* Logically, this code belongs in jcmaster.c. It's split out because12* linking this routine implies linking the entire compression library.13* For a transcoding-only application, we want to be able to use jcmaster.c14* without linking in the whole library.15*/1617#define JPEG_INTERNALS18#include "jinclude.h"19#include "jpeglib.h"202122/*23* Master selection of compression modules.24* This is done once at the start of processing an image. We determine25* which modules will be used and give them appropriate initialization calls.26*/2728GLOBAL(void)29jinit_compress_master (j_compress_ptr cinfo)30{31/* Initialize master control (includes parameter checking/processing) */32jinit_c_master_control(cinfo, FALSE /* full compression */);3334/* Preprocessing */35if (! cinfo->raw_data_in) {36jinit_color_converter(cinfo);37jinit_downsampler(cinfo);38jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */);39}40/* Forward DCT */41jinit_forward_dct(cinfo);42/* Entropy encoding: either Huffman or arithmetic coding. */43if (cinfo->arith_code) {44ERREXIT(cinfo, JERR_ARITH_NOTIMPL);45} else {46if (cinfo->progressive_mode) {47#ifdef C_PROGRESSIVE_SUPPORTED48jinit_phuff_encoder(cinfo);49#else50ERREXIT(cinfo, JERR_NOT_COMPILED);51#endif52} else53jinit_huff_encoder(cinfo);54}5556/* Need a full-image coefficient buffer in any multi-pass mode. */57jinit_c_coef_controller(cinfo,58(boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding));59jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);6061jinit_marker_writer(cinfo);6263/* We can now tell the memory manager to allocate virtual arrays. */64(*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);6566/* Write the datastream header (SOI) immediately.67* Frame and scan headers are postponed till later.68* This lets application insert special markers after the SOI.69*/70(*cinfo->marker->write_file_header) (cinfo);71}727374