4 * This file was part of the Independent JPEG Group's software:
5 * Copyright (C) 1998, Thomas G. Lane.
6 * Lossless JPEG Modifications:
7 * Copyright (C) 1999, Ken Murchison.
8 * libjpeg-turbo Modifications:
9 * Copyright (C) 2022, D. R. Commander.
10 * For conditions of distribution and use, see the accompanying README.ijg
13 * This include file contains common declarations for the lossless JPEG
20 #if defined(C_LOSSLESS_SUPPORTED) || defined(D_LOSSLESS_SUPPORTED)
22 #define JPEG_INTERNALS
24 #include "jsamplecomp.h"
27 #define ALLOC_DARRAY(pool_id, diffsperrow, numrows) \
28 (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
29 ((j_common_ptr)cinfo, pool_id, \
30 (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
34 * Table H.1: Predictors for lossless coding.
40 #define PREDICTOR4 (int)((JLONG)Ra + (JLONG)Rb - (JLONG)Rc)
41 #define PREDICTOR5 (int)((JLONG)Ra + RIGHT_SHIFT((JLONG)Rb - (JLONG)Rc, 1))
42 #define PREDICTOR6 (int)((JLONG)Rb + RIGHT_SHIFT((JLONG)Ra - (JLONG)Rc, 1))
43 #define PREDICTOR7 (int)RIGHT_SHIFT((JLONG)Ra + (JLONG)Rb, 1)
48 #ifdef C_LOSSLESS_SUPPORTED
50 typedef void (*predict_difference_method_ptr) (j_compress_ptr cinfo, int ci,
56 /* Lossless compressor */
58 struct jpeg_forward_dct pub; /* public fields */
60 /* It is useful to allow each component to have a separate diff method. */
61 predict_difference_method_ptr predict_difference[MAX_COMPONENTS];
63 /* MCU rows left in the restart interval for each component */
64 unsigned int restart_rows_to_go[MAX_COMPONENTS];
67 void (*scaler_scale) (j_compress_ptr cinfo, _JSAMPROW input_buf,
68 _JSAMPROW output_buf, JDIMENSION width);
69 } jpeg_lossless_compressor;
71 typedef jpeg_lossless_compressor *lossless_comp_ptr;
73 #endif /* C_LOSSLESS_SUPPORTED */
76 #ifdef D_LOSSLESS_SUPPORTED
78 typedef void (*predict_undifference_method_ptr) (j_decompress_ptr cinfo,
85 /* Lossless decompressor */
87 struct jpeg_inverse_dct pub; /* public fields */
89 /* It is useful to allow each component to have a separate undiff method. */
90 predict_undifference_method_ptr predict_undifference[MAX_COMPONENTS];
93 void (*scaler_scale) (j_decompress_ptr cinfo, JDIFFROW diff_buf,
94 _JSAMPROW output_buf, JDIMENSION width);
95 } jpeg_lossless_decompressor;
97 typedef jpeg_lossless_decompressor *lossless_decomp_ptr;
99 #endif /* D_LOSSLESS_SUPPORTED */
101 #endif /* JLOSSLS_H */