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 sample downscaling by 2^Pt for lossless JPEG.
11 #define JPEG_INTERNALS
14 #include "jlossls.h" /* Private declarations for lossless codec */
17 #ifdef C_LOSSLESS_SUPPORTED
20 simple_downscale(j_compress_ptr cinfo,
21 JSAMPROW input_buf, JSAMPROW output_buf, JDIMENSION width)
23 /* j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec; */
27 for (xindex = 0; xindex < width; xindex++)
28 output_buf[xindex] = (JSAMPLE) RIGHT_SHIFT(GETJSAMPLE(input_buf[xindex]),
34 noscale(j_compress_ptr cinfo,
35 JSAMPROW input_buf, JSAMPROW output_buf, JDIMENSION width)
38 MEMCOPY(output_buf, input_buf, width * SIZEOF(JSAMPLE));
44 scaler_start_pass (j_compress_ptr cinfo)
46 j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec;
48 /* Set scaler function based on Pt */
50 losslsc->scaler_scale = simple_downscale;
52 losslsc->scaler_scale = noscale;
57 jinit_c_scaler (j_compress_ptr cinfo)
59 j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec;
61 losslsc->scaler_start_pass = scaler_start_pass;
64 #endif /* C_LOSSLESS_SUPPORTED */