8 * Copyright (C) 1998, 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.
12 * This file contains sample downscaling by 2^Pt for lossless JPEG.
15 #define JPEG_INTERNALS
18 #include "jlossls.h" /* Private declarations for lossless codec */
21 #ifdef C_LOSSLESS_SUPPORTED
24 simple_downscale(j_compress_ptr cinfo
,
25 JSAMPROW input_buf
, JSAMPROW output_buf
, JDIMENSION width
)
27 j_lossless_c_ptr losslsc
= (j_lossless_c_ptr
) cinfo
->codec
;
30 for (xindex
= 0; xindex
< width
; xindex
++)
31 output_buf
[xindex
] = (JSAMPLE
) RIGHT_SHIFT(GETJSAMPLE(input_buf
[xindex
]),
37 noscale(j_compress_ptr cinfo
,
38 JSAMPROW input_buf
, JSAMPROW output_buf
, JDIMENSION width
)
40 MEMCOPY(output_buf
, input_buf
, width
* SIZEOF(JSAMPLE
));
46 scaler_start_pass (j_compress_ptr cinfo
)
48 j_lossless_c_ptr losslsc
= (j_lossless_c_ptr
) cinfo
->codec
;
50 /* Set scaler function based on Pt */
52 losslsc
->scaler_scale
= simple_downscale
;
54 losslsc
->scaler_scale
= noscale
;
59 jinit_c_scaler (j_compress_ptr cinfo
)
61 j_lossless_c_ptr losslsc
= (j_lossless_c_ptr
) cinfo
->codec
;
63 losslsc
->scaler_start_pass
= scaler_start_pass
;
66 #endif /* C_LOSSLESS_SUPPORTED */