📄 samplecoder.cpp
字号:
/// @file samplecoder.cpp
/// Sample Coder useful as a skeleton for writing new coders
///
/// @note This coder ignores any statistics that the modeler may provide
/// @author mouser
/// @date 2003.07.29
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// application includes
#include "samplecoder.hpp"
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Functions from CODER PUBLIC API
bool SampleCoder::WriteSymbolBits(int symbolnum,bitwriter &bw)
{
// write compressed output for symbol specified
// return true on success
// for our sample coder, we will just write the raw binary data in an int
bw.put(symbolnum);
// return success
return true;
}
bool SampleCoder::DecodeSymbolFromInput(int &symbolnum, bitreader &br)
{
// decode a symbol from the input
// return false on no symbols left in stream (or error)
// input is empty yet?
if (br.empty())
return false;
// for our sample coder, we just read the binary data for an int
br.get(symbolnum);
// return success
return true;
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -