00001 /* 00002 * jlossls.h 00003 * 00004 * Copyright (C) 1998, Thomas G. Lane. 00005 * This file is part of the Independent JPEG Group's software. 00006 * For conditions of distribution and use, see the accompanying README file. 00007 * 00008 * This include file contains common declarations for the lossless JPEG 00009 * codec modules. 00010 */ 00011 00012 #ifndef JLOSSLS_H 00013 #define JLOSSLS_H 00014 00015 00016 /* 00017 * Table H.1: Predictors for lossless coding. 00018 */ 00019 00020 #define PREDICTOR1 Ra 00021 #define PREDICTOR2 Rb 00022 #define PREDICTOR3 Rc 00023 #define PREDICTOR4 (int) ((IJG_INT32) Ra + (IJG_INT32) Rb - (IJG_INT32) Rc) 00024 #define PREDICTOR5 (int) ((IJG_INT32) Ra + RIGHT_SHIFT((IJG_INT32) Rb - (IJG_INT32) Rc, 1)) 00025 #define PREDICTOR6 (int) ((IJG_INT32) Rb + RIGHT_SHIFT((IJG_INT32) Ra - (IJG_INT32) Rc, 1)) 00026 #define PREDICTOR7 (int) RIGHT_SHIFT((IJG_INT32) Ra + (IJG_INT32) Rb, 1) 00027 00028 00029 typedef JMETHOD(void, predict_difference_method_ptr, 00030 (j_compress_ptr cinfo, int ci, 00031 JSAMPROW input_buf, JSAMPROW prev_row, 00032 JDIFFROW diff_buf, JDIMENSION width)); 00033 00034 typedef JMETHOD(void, scaler_method_ptr, 00035 (j_compress_ptr cinfo, int ci, 00036 JSAMPROW input_buf, JSAMPROW output_buf, 00037 JDIMENSION width)); 00038 00039 /* Lossless-specific compression codec (compressor proper) */ 00040 typedef struct { 00041 struct jpeg_c_codec pub; /* public fields */ 00042 00043 00044 /* Difference buffer control */ 00045 JMETHOD(void, diff_start_pass, (j_compress_ptr cinfo, 00046 J_BUF_MODE pass_mode)); 00047 00048 /* Pointer to data which is private to diff controller */ 00049 void *diff_private; 00050 00051 00052 /* Entropy encoding */ 00053 JMETHOD(JDIMENSION, entropy_encode_mcus, (j_compress_ptr cinfo, 00054 JDIFFIMAGE diff_buf, 00055 JDIMENSION MCU_row_num, 00056 JDIMENSION MCU_col_num, 00057 JDIMENSION nMCU)); 00058 00059 /* Pointer to data which is private to entropy module */ 00060 void *entropy_private; 00061 00062 00063 /* Prediction, differencing */ 00064 JMETHOD(void, predict_start_pass, (j_compress_ptr cinfo)); 00065 00066 /* It is useful to allow each component to have a separate diff method. */ 00067 predict_difference_method_ptr predict_difference[MAX_COMPONENTS]; 00068 00069 /* Pointer to data which is private to predictor module */ 00070 void *pred_private; 00071 00072 /* Sample scaling */ 00073 JMETHOD(void, scaler_start_pass, (j_compress_ptr cinfo)); 00074 JMETHOD(void, scaler_scale, (j_compress_ptr cinfo, 00075 JSAMPROW input_buf, JSAMPROW output_buf, 00076 JDIMENSION width)); 00077 00078 /* Pointer to data which is private to scaler module */ 00079 void *scaler_private; 00080 00081 } jpeg_lossless_c_codec; 00082 00083 typedef jpeg_lossless_c_codec * j_lossless_c_ptr; 00084 00085 00086 typedef JMETHOD(void, predict_undifference_method_ptr, 00087 (j_decompress_ptr cinfo, int comp_index, 00088 JDIFFROW diff_buf, JDIFFROW prev_row, 00089 JDIFFROW undiff_buf, JDIMENSION width)); 00090 00091 /* Lossless-specific decompression codec (decompressor proper) */ 00092 typedef struct { 00093 struct jpeg_d_codec pub; /* public fields */ 00094 00095 00096 /* Difference buffer control */ 00097 JMETHOD(void, diff_start_input_pass, (j_decompress_ptr cinfo)); 00098 00099 /* Pointer to data which is private to diff controller */ 00100 void *diff_private; 00101 00102 00103 /* Entropy decoding */ 00104 JMETHOD(void, entropy_start_pass, (j_decompress_ptr cinfo)); 00105 JMETHOD(boolean, entropy_process_restart, (j_decompress_ptr cinfo)); 00106 JMETHOD(JDIMENSION, entropy_decode_mcus, (j_decompress_ptr cinfo, 00107 JDIFFIMAGE diff_buf, 00108 JDIMENSION MCU_row_num, 00109 JDIMENSION MCU_col_num, 00110 JDIMENSION nMCU)); 00111 00112 /* Pointer to data which is private to entropy module */ 00113 void *entropy_private; 00114 00115 00116 /* Prediction, undifferencing */ 00117 JMETHOD(void, predict_start_pass, (j_decompress_ptr cinfo)); 00118 JMETHOD(void, predict_process_restart, (j_decompress_ptr cinfo)); 00119 00120 /* It is useful to allow each component to have a separate undiff method. */ 00121 predict_undifference_method_ptr predict_undifference[MAX_COMPONENTS]; 00122 00123 /* Pointer to data which is private to predictor module */ 00124 void *pred_private; 00125 00126 /* Sample scaling */ 00127 JMETHOD(void, scaler_start_pass, (j_decompress_ptr cinfo)); 00128 JMETHOD(void, scaler_scale, (j_decompress_ptr cinfo, 00129 JDIFFROW diff_buf, JSAMPROW output_buf, 00130 JDIMENSION width)); 00131 00132 /* Pointer to data which is private to scaler module */ 00133 void *scaler_private; 00134 00135 } jpeg_lossless_d_codec; 00136 00137 typedef jpeg_lossless_d_codec * j_lossless_d_ptr; 00138 00139 00140 /* Compression module initialization routines */ 00141 EXTERN(void) jinit_lossless_c_codec JPP((j_compress_ptr cinfo)); 00142 EXTERN(void) jinit_lhuff_encoder JPP((j_compress_ptr cinfo)); 00143 EXTERN(void) jinit_differencer JPP((j_compress_ptr cinfo)); 00144 EXTERN(void) jinit_c_scaler JPP((j_compress_ptr cinfo)); 00145 /* Decompression module initialization routines */ 00146 EXTERN(void) jinit_lossless_d_codec JPP((j_decompress_ptr cinfo)); 00147 EXTERN(void) jinit_lhuff_decoder JPP((j_decompress_ptr cinfo)); 00148 EXTERN(void) jinit_undifferencer JPP((j_decompress_ptr cinfo)); 00149 EXTERN(void) jinit_d_scaler JPP((j_decompress_ptr cinfo)); 00150 00151 #endif /* JLOSSLS_H */