Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #ifndef __PCL_IO_RANGECODING__
00042 #define __PCL_IO_RANGECODING__
00043
00044 #include <map>
00045 #include <iostream>
00046 #include <vector>
00047 #include <string>
00048 #include <cmath>
00049 #include <algorithm>
00050 #include <stdio.h>
00051 #include <boost/cstdint.hpp>
00052
00053 namespace pcl
00054 {
00055
00056 using boost::uint8_t;
00057 using boost::uint32_t;
00058 using boost::uint64_t;
00059
00061
00067
00068 class AdaptiveRangeCoder
00069 {
00070
00071 public:
00072
00074 AdaptiveRangeCoder () : outputCharVector_ ()
00075 {
00076 }
00077
00079 virtual
00080 ~AdaptiveRangeCoder ()
00081 {
00082 }
00083
00089 unsigned long
00090 encodeCharVectorToStream (const std::vector<char>& inputByteVector_arg, std::ostream& outputByteStream_arg);
00091
00097 unsigned long
00098 decodeStreamToCharVector (std::istream& inputByteStream_arg, std::vector<char>& outputByteVector_arg);
00099
00100 protected:
00101 typedef boost::uint32_t DWord;
00102
00103 private:
00106 std::vector<char> outputCharVector_;
00107
00108 };
00109
00111
00117
00118 class StaticRangeCoder
00119 {
00120 public:
00122 StaticRangeCoder () :
00123 cFreqTable_ (65537), outputCharVector_ ()
00124 {
00125 }
00126
00128 virtual
00129 ~StaticRangeCoder ()
00130 {
00131 }
00132
00138 unsigned long
00139 encodeIntVectorToStream (std::vector<unsigned int>& inputIntVector_arg, std::ostream& outputByterStream_arg);
00140
00146 unsigned long
00147 decodeStreamToIntVector (std::istream& inputByteStream_arg, std::vector<unsigned int>& outputIntVector_arg);
00148
00154 unsigned long
00155 encodeCharVectorToStream (const std::vector<char>& inputByteVector_arg, std::ostream& outputByteStream_arg);
00156
00162 unsigned long
00163 decodeStreamToCharVector (std::istream& inputByteStream_arg, std::vector<char>& outputByteVector_arg);
00164
00165 protected:
00166 typedef boost::uint32_t DWord;
00167
00172 inline double
00173 Log2 (double n_arg)
00174 {
00175 return log (n_arg) / log (2.0);
00176 }
00177
00178 private:
00180 std::vector<uint64_t> cFreqTable_;
00181
00183 std::vector<char> outputCharVector_;
00184
00185 };
00186 }
00187
00188
00189
00190
00191 #endif
00192