⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zeroorder_modeler.cpp

📁 Octane v1.01.20 The Open Compression Toolkit for C++ . The Open Compression Toolkit is a set of mo
💻 CPP
字号:
/// @file zeroorder_modeler.cpp
/// A simple zero-order modeler, which just uses summary frequencies of symbols
///
/// @author mouser
/// @date   2003.07.29
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
#include "zeroorder_modeler.hpp"
//---------------------------------------------------------------------------



	
	
//---------------------------------------------------------------------------
// MODELLER PUBLIC API

bool ZeroOrderModeler::CreateModelUsingStream(OctaneParser *parserp, bitreader &from)
{
	// build a model of frequencies
	bool bretv;

	// calculate symbol frequencies, by asking the weightvector to do our dirty work in conjunction with the parser
	bretv=weightvector.CountSymbolFrequencies(parserp,from);

	// make sure no symbol has freq count == 0 which would break huffman coder and others
	weightvector.EnforceZeroCountFloor(1);

	// normalize to probability distribution
	weightvector.NormalizeToProbabilityDistribution();

	// success
	return bretv;
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -