dcmjpeg/libijg16/jlossls16.h

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 /* This is an incorrect predictor that causes an overflow for images with 16 bits/pixel.
00029  * There is a known implementation of JPEG lossless that creates such incorrect images,
00030  * and we need this predictor to be able to correctly decode such incorrect images.
00031  */
00032 #define PREDICTOR6A     (int) ((INT16) Rb + RIGHT_SHIFT((INT16) Ra - (INT16) Rc, 1))
00033 
00034 
00035 typedef JMETHOD(void, predict_difference_method_ptr,
00036         (j_compress_ptr cinfo, int ci,
00037          JSAMPROW input_buf, JSAMPROW prev_row,
00038          JDIFFROW diff_buf, JDIMENSION width));
00039 
00040 typedef JMETHOD(void, scaler_method_ptr,
00041         (j_compress_ptr cinfo, int ci,
00042          JSAMPROW input_buf, JSAMPROW output_buf,
00043          JDIMENSION width));
00044 
00045 /* Lossless-specific compression codec (compressor proper) */
00046 typedef struct {
00047   struct jpeg_c_codec pub; /* public fields */
00048 
00049 
00050   /* Difference buffer control */
00051   JMETHOD(void, diff_start_pass, (j_compress_ptr cinfo,
00052                   J_BUF_MODE pass_mode));
00053 
00054   /* Pointer to data which is private to diff controller */
00055   void *diff_private;
00056 
00057 
00058   /* Entropy encoding */
00059   JMETHOD(JDIMENSION, entropy_encode_mcus, (j_compress_ptr cinfo,
00060                         JDIFFIMAGE diff_buf,
00061                         JDIMENSION MCU_row_num,
00062                         JDIMENSION MCU_col_num,
00063                         JDIMENSION nMCU));
00064 
00065   /* Pointer to data which is private to entropy module */
00066   void *entropy_private;
00067 
00068 
00069   /* Prediction, differencing */
00070   JMETHOD(void, predict_start_pass, (j_compress_ptr cinfo));
00071 
00072   /* It is useful to allow each component to have a separate diff method. */
00073   predict_difference_method_ptr predict_difference[MAX_COMPONENTS];
00074 
00075   /* Pointer to data which is private to predictor module */
00076   void *pred_private;
00077 
00078   /* Sample scaling */
00079   JMETHOD(void, scaler_start_pass, (j_compress_ptr cinfo));
00080   JMETHOD(void, scaler_scale, (j_compress_ptr cinfo,
00081                    JSAMPROW input_buf, JSAMPROW output_buf,
00082                    JDIMENSION width));
00083 
00084   /* Pointer to data which is private to scaler module */
00085   void *scaler_private;
00086 
00087 } jpeg_lossless_c_codec;
00088 
00089 typedef jpeg_lossless_c_codec * j_lossless_c_ptr;
00090 
00091 
00092 typedef JMETHOD(void, predict_undifference_method_ptr,
00093         (j_decompress_ptr cinfo, int comp_index,
00094          JDIFFROW diff_buf, JDIFFROW prev_row,
00095          JDIFFROW undiff_buf, JDIMENSION width));
00096 
00097 /* Lossless-specific decompression codec (decompressor proper) */
00098 typedef struct {
00099   struct jpeg_d_codec pub; /* public fields */
00100 
00101 
00102   /* Difference buffer control */
00103   JMETHOD(void, diff_start_input_pass, (j_decompress_ptr cinfo));
00104 
00105   /* Pointer to data which is private to diff controller */
00106   void *diff_private;
00107 
00108 
00109   /* Entropy decoding */
00110   JMETHOD(void, entropy_start_pass, (j_decompress_ptr cinfo));
00111   JMETHOD(boolean, entropy_process_restart, (j_decompress_ptr cinfo));
00112   JMETHOD(JDIMENSION, entropy_decode_mcus, (j_decompress_ptr cinfo,
00113                         JDIFFIMAGE diff_buf,
00114                         JDIMENSION MCU_row_num,
00115                         JDIMENSION MCU_col_num,
00116                         JDIMENSION nMCU));
00117 
00118   /* Pointer to data which is private to entropy module */
00119   void *entropy_private;
00120 
00121 
00122   /* Prediction, undifferencing */
00123   JMETHOD(void, predict_start_pass, (j_decompress_ptr cinfo));
00124   JMETHOD(void, predict_process_restart, (j_decompress_ptr cinfo));
00125 
00126   /* It is useful to allow each component to have a separate undiff method. */
00127   predict_undifference_method_ptr predict_undifference[MAX_COMPONENTS];
00128 
00129   /* Pointer to data which is private to predictor module */
00130   void *pred_private;
00131 
00132   /* Sample scaling */
00133   JMETHOD(void, scaler_start_pass, (j_decompress_ptr cinfo));
00134   JMETHOD(void, scaler_scale, (j_decompress_ptr cinfo,
00135                    JDIFFROW diff_buf, JSAMPROW output_buf,
00136                    JDIMENSION width));
00137 
00138   /* Pointer to data which is private to scaler module */
00139   void *scaler_private;
00140 
00141 } jpeg_lossless_d_codec;
00142 
00143 typedef jpeg_lossless_d_codec * j_lossless_d_ptr;
00144 
00145 
00146 /* Compression module initialization routines */
00147 EXTERN(void) jinit_lossless_c_codec JPP((j_compress_ptr cinfo));
00148 EXTERN(void) jinit_lhuff_encoder JPP((j_compress_ptr cinfo));
00149 EXTERN(void) jinit_differencer JPP((j_compress_ptr cinfo));
00150 EXTERN(void) jinit_c_scaler JPP((j_compress_ptr cinfo));
00151 /* Decompression module initialization routines */
00152 EXTERN(void) jinit_lossless_d_codec JPP((j_decompress_ptr cinfo));
00153 EXTERN(void) jinit_lhuff_decoder JPP((j_decompress_ptr cinfo));
00154 EXTERN(void) jinit_undifferencer JPP((j_decompress_ptr cinfo));
00155 EXTERN(void) jinit_d_scaler JPP((j_decompress_ptr cinfo));
00156 
00157 #endif /* JLOSSLS_H */


Generated on 6 Jan 2011 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.5.1