00001 #ifndef VLICODEC_HEADER_
00002 #define VLICODEC_HEADER_
00003
00004 #include "../headers.h"
00005 #include "../fileUtil.h"
00006
00007 class VLI;
00008
00010
00012 class MDifferentialVLICodec: public IIntCodec {
00013
00014 DECLARE_TypeInfo( MDifferentialVLICodec, "Differential VLI"
00015 , "Variable-length-integer differential encoder with adjustable distribution"
00016 , {
00017 label: "First level symbols",
00018 desc: "The number of possibilities\n"
00019 "that will occupy least space",
00020 type: settingInt(0,0,8,IntLog2)
00021 } )
00022
00023 private:
00025 enum Settings { VLIExponent };
00026
00027 private:
00028 int possib
00029 , lastSymbol;
00030 public:
00033 void setPossibilities(int possibilities) {
00034 possib= possibilities;
00035 lastSymbol= possib/2;
00036 }
00037 void encode(std::vector<int> &data,std::ostream &file);
00038 void decode(std::istream &file,int count,std::vector<int> &data);
00039
00040 void writeSettings(std::ostream &file)
00041 { put<Uchar>( file, settingsInt(VLIExponent) ); }
00042 void readSettings(std::istream &file)
00043 { settingsInt(VLIExponent)= get<Uchar>(file); }
00045 };
00046
00047 #endif // VLICODEC_HEADER_