1 /*
2  * jcodec.c
3  *
4  * Copyright (C) 1998, Thomas G. Lane.
5  * This file is part of the Independent JPEG Group's software.
6  * For conditions of distribution and use, see the accompanying README file.
7  *
8  * This file contains utility functions for the JPEG codec(s).
9  */
10 
11 #define JPEG_INTERNALS
12 #include "jinclude16.h"
13 #include "jpeglib16.h"
14 #include "jlossy16.h"
15 #include "jlossls16.h"
16 
17 
18 /*
19  * Initialize the compression codec.
20  * This is called only once, during master selection.
21  */
22 
23 GLOBAL(void)
jinit_c_codec(j_compress_ptr cinfo)24 jinit_c_codec (j_compress_ptr cinfo)
25 {
26   if (cinfo->process == JPROC_LOSSLESS) {
27 #ifdef C_LOSSLESS_SUPPORTED
28     jinit_lossless_c_codec(cinfo);
29 #else
30     ERREXIT(cinfo, JERR_NOT_COMPILED);
31 #endif
32   } else
33     jinit_lossy_c_codec(cinfo);
34 }
35 
36 
37 /*
38  * Initialize the decompression codec.
39  * This is called only once, during master selection.
40  */
41 
42 GLOBAL(void)
jinit_d_codec(j_decompress_ptr cinfo)43 jinit_d_codec (j_decompress_ptr cinfo)
44 {
45   if (cinfo->process == JPROC_LOSSLESS) {
46 #ifdef D_LOSSLESS_SUPPORTED
47     jinit_lossless_d_codec(cinfo);
48 #else
49     ERREXIT(cinfo, JERR_NOT_COMPILED);
50 #endif
51   } else
52     jinit_lossy_d_codec(cinfo);
53 }
54