📄 arithmeticcoder.h
字号:
// ArithmeticCoder.h: interface for the CArithmeticCoder class.
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_ARITHMETICCODER_H__DB9BDBC0_E10E_4397_8D52_615FA191BDF3__INCLUDED_)
#define AFX_ARITHMETICCODER_H__DB9BDBC0_E10E_4397_8D52_615FA191BDF3__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/////////////////////////////////////////////////////////////////////////////////
#include <stdio.h>
#include "BitIO.h"
#include "Model.h" // Added by ClassView
#define Code_value_bits 16 // number of bits in a code value
typedef long code_value; // type of an arithmetic code value
#define top_value (((long)1<<Code_value_bits)-1) // largest codevalue
// half and quarter points int he code value range
#define first_qtr (top_value/4+1)
#define half (2*first_qtr)
#define third_qtr (3*first_qtr)
class CArithmeticCoder
{
public:
void SetInputFileName(char*filein);
void Decode( );
void SetOutputFileName(char* outfilename);
bool Attach(CBitIO *pBitIO);
bool Attach(CModel *);
FILE* fileout;
FILE* filein;
char *name_fileout;
char *name_filein;
void Encode();
CModel *m_pModel;
CBitIO *m_pBitIO;
//---------------------------------------------------------------
//--------------- current state of the coding--------------------
code_value low, high, value;
long bits_to_follow;
void bit_plus_follow(int bit);
//================================================================
CArithmeticCoder();
virtual ~CArithmeticCoder();
//----------------------------------------------------------------
void start_encoding();
void encode_symbol(int symbol, int cum_freq[]);
void done_encoding();
//=================================================================
//-----------------------------------------------------------------
//----------------functions for decoding---------------------------
void start_decoding();
int decode_symbol(int cum_freq[]);
//=================================================================
};
/////////////////////////////////////////////////////////////////////////////////
#endif // !defined(AFX_ARITHMETICCODER_H__DB9BDBC0_E10E_4397_8D52_615FA191BDF3__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -