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

📄 arith.h

📁 wavelet codec there are 34 files with code about the wavelet theory
💻 H
字号:

// These objects implement arithmetic coding as described in
// Bell, Cleary, and Witten "Text Compression" Prentice Hall.

#ifndef _ARITH_CODER_
#define _ARITH_CODER_

#include <iostream.h>
#include "iHisto.h"
#include "BitIO.h"

class CodingValues {
public:
    long low, high, value;
    static const int CodeValueBits;
    static const long MaxFreq;
    static const long One;
    static const long Qtr;
    static const long Half;
    static const long ThreeQtr;
};		

class ArithEncoder : public CodingValues {    
    BitOut &output;
    inline void bpf(int bit)
    {
	output.output_bit(bit);
	for (int i = 0; i < bitsToFollow; i++) {
	    output.output_bit(1 - bit);
	}
	bitsToFollow = 0;
    }
public:
    ArithEncoder(BitOut &bo);
    void Encode(int count, int countLeft, int countTot);
    void flush(void);
    int bitsToFollow;
};

class ArithDecoder : public CodingValues {
    BitIn &input;
public:
    ArithDecoder(BitIn &bi);
    int Decode(iHistogram &h);
};

#endif

⌨️ 快捷键说明

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