00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __CODEC37_H_
00021 #define __CODEC37_H_
00022
00023 #ifdef HAVE_CONFIG_H
00024 #include "config.h"
00025 #endif
00026
00027 #ifdef DEBUG
00028 # ifndef NO_DEBUG_CODEC37
00029 # define DEBUG_CODEC37
00030 # endif
00031 #else
00032 # ifdef DEBUG_CODEC37
00033 # error DEBUG_CODEC37 defined without DEBUG
00034 # endif
00035 #endif
00036
00037 #ifdef DEBUG_CODEC37
00038 # ifndef NO_DEBUG_CODEC37_PROCS
00039 # define DEBUG_CODEC37_PROC1
00040 # define DEBUG_CODEC37_PROC2
00041 # define DEBUG_CODEC37_PROC3
00042 # define DEBUG_CODEC37_PROC4
00043 # endif
00044 #endif
00045
00046 #include <exception>
00047 #include "decoder.h"
00048
00052 class codec37_decoder : public decoder {
00053 private:
00054 int _deltaSize;
00055 unsigned char * _deltaBufs[2];
00056 unsigned char * _deltaBuf;
00057 short * _offset_table;
00058 int _curtable;
00059 unsigned short _prev_seq_nb;
00060 int _table_last_pitch;
00061 int _table_last_index;
00062 static const int DELTA_ADD = 0x3E00;
00063
00064 public:
00065 bool init_size(const point &, const rect &) throw(std::exception);
00066 codec37_decoder() throw();
00067 void clean() throw();
00068 virtual ~codec37_decoder() throw();
00069 protected:
00070 static inline unsigned int expand(unsigned char b) {
00071 unsigned int r = b | (b << 8);
00072 return r | (r << 16);
00073 }
00074 void maketable(int, int);
00075 void proc1(blitter &, chunck &, int, int, int, int);
00076 void proc2(blitter &, chunck &, int);
00077 void proc3_with_fdfe(blitter &, chunck &, int, int, int);
00078 void proc3_without_fdfe(blitter &, chunck &, int, int, int);
00079 void proc4(blitter &, chunck &, int, int, int);
00080 public:
00081 bool decode(blitter &, chunck &) throw(std::exception);
00082 };
00083
00084 #endif