Octane v1.01.20 - The Open Compression Toolkit for C++ | http://octane.sourceforge.net/ |
00001 00002 00003 00004 00005 00006 00007 //--------------------------------------------------------------------------- 00008 00009 //--------------------------------------------------------------------------- 00010 // application includes 00011 #include "samplecoder.hpp" 00012 //--------------------------------------------------------------------------- 00013 00014 00015 00016 00017 //--------------------------------------------------------------------------- 00018 // Functions from CODER PUBLIC API 00019 bool SampleCoder::WriteSymbolBits(int symbolnum,bitwriter &bw) 00020 { 00021 // write compressed output for symbol specified 00022 // return true on success 00023 00024 // for our sample coder, we will just write the raw binary data in an int 00025 bw.put(symbolnum); 00026 00027 // return success 00028 return true; 00029 } 00030 00031 bool SampleCoder::DecodeSymbolFromInput(int &symbolnum, bitreader &br) 00032 { 00033 // decode a symbol from the input 00034 // return false on no symbols left in stream (or error) 00035 00036 // input is empty yet? 00037 if (br.empty()) 00038 return false; 00039 00040 // for our sample coder, we just read the binary data for an int 00041 br.get(symbolnum); 00042 00043 // return success 00044 return true; 00045 } 00046 //---------------------------------------------------------------------------