Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/share/native/libjavajpeg/jcinit.c
41152 views
1
/*
2
* reserved comment block
3
* DO NOT REMOVE OR ALTER!
4
*/
5
/*
6
* jcinit.c
7
*
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.
11
*
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.
15
*
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.
20
*/
21
22
#define JPEG_INTERNALS
23
#include "jinclude.h"
24
#include "jpeglib.h"
25
26
27
/*
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.
31
*/
32
33
GLOBAL(void)
34
jinit_compress_master (j_compress_ptr cinfo)
35
{
36
/* Initialize master control (includes parameter checking/processing) */
37
jinit_c_master_control(cinfo, FALSE /* full compression */);
38
39
/* Preprocessing */
40
if (! cinfo->raw_data_in) {
41
jinit_color_converter(cinfo);
42
jinit_downsampler(cinfo);
43
jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */);
44
}
45
/* Forward DCT */
46
jinit_forward_dct(cinfo);
47
/* Entropy encoding: either Huffman or arithmetic coding. */
48
if (cinfo->arith_code) {
49
ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
50
} else {
51
if (cinfo->progressive_mode) {
52
#ifdef C_PROGRESSIVE_SUPPORTED
53
jinit_phuff_encoder(cinfo);
54
#else
55
ERREXIT(cinfo, JERR_NOT_COMPILED);
56
#endif
57
} else
58
jinit_huff_encoder(cinfo);
59
}
60
61
/* Need a full-image coefficient buffer in any multi-pass mode. */
62
jinit_c_coef_controller(cinfo,
63
(boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding));
64
jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);
65
66
jinit_marker_writer(cinfo);
67
68
/* We can now tell the memory manager to allocate virtual arrays. */
69
(*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
70
71
/* Write the datastream header (SOI) immediately.
72
* Frame and scan headers are postponed till later.
73
* This lets application insert special markers after the SOI.
74
*/
75
(*cinfo->marker->write_file_header) (cinfo);
76
}
77
78