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.
8 * This file contains the control logic for the lossless JPEG compressor.
11 #define JPEG_INTERNALS
17 #ifdef C_LOSSLESS_SUPPORTED
20 * Initialize for a processing pass.
24 start_pass (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
26 j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec;
28 (*losslsc->scaler_start_pass) (cinfo);
29 (*losslsc->predict_start_pass) (cinfo);
30 (*losslsc->diff_start_pass) (cinfo, pass_mode);
35 * Initialize the lossless compression codec.
36 * This is called only once, during master selection.
40 jinit_lossless_c_codec(j_compress_ptr cinfo)
42 j_lossless_c_ptr losslsc;
44 /* Create subobject in permanent pool */
45 losslsc = (j_lossless_c_ptr)
46 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
47 SIZEOF(jpeg_lossless_c_codec));
48 cinfo->codec = (struct jpeg_c_codec *) losslsc;
50 /* Initialize sub-modules */
53 jinit_c_scaler(cinfo);
56 jinit_differencer(cinfo);
58 /* Entropy encoding: either Huffman or arithmetic coding. */
59 if (cinfo->arith_code) {
60 jinit_arith_encoder(cinfo);
62 jinit_lhuff_encoder(cinfo);
65 /* Need a full-image difference buffer in any multi-pass mode. */
66 jinit_c_diff_controller(cinfo,
67 (boolean) (cinfo->num_scans > 1 ||
68 cinfo->optimize_coding));
70 /* Initialize method pointers.
72 * Note: entropy_start_pass and entropy_finish_pass are assigned in
73 * jclhuff.c and compress_data is assigned in jcdiffct.c.
75 losslsc->pub.start_pass = start_pass;
78 #endif /* C_LOSSLESS_SUPPORTED */