samplecoder.cpp

来自「Octane v1.01.20 The Open Compression To」· C++ 代码 · 共 47 行

CPP
47
字号
/// @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 + =
减小字号Ctrl + -
显示快捷键?