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

📄 cdecompress.hpp

📁 bt848,bt878 a采集卡的探测
💻 HPP
字号:
// Our decompressor object
#ifndef _CDECOMPRESS_HPP
#define _CDECOMPRESS_HPP

#include "CMemory.hpp"

#define EXP2_DIC_MAX  12
/* 2^EXP2_DIC_MAX gives the maximum word counter in the dictionary during *all* the compressions.
   Possible values: 3 to 25.
   Attention: Beyond 12, you can have some errors of memory allocation
   depending on your compiler and your computer. */

class CDecompress {

protected:
	// Our pointers for decompression
	unsigned char *blk_ptr;
	unsigned char *blk_ptr_end;

	// Our output buffer
	CMemory* outblk;

	// Internal variables
	unsigned long int val_to_write,
					  val_to_read;
	unsigned char bit_counter_to_write,
				  bit_counter_to_read;

	// typedefs
	typedef struct s_dic_link { unsigned int character;
		                        struct s_dic_link *predecessor;
			                  } t_dic_link,*p_dic_link;

	unsigned int index_dic; /* Word counter already known in the dictionary. */
	unsigned char bit_counter_decoding; /* Bit counter in the decoding. */
	
	/* 2^EXP2_DIC_MAX gives the maximum word counter in the dictionary during *all* the compressions.
		Possible values: 3 to 25.
		Attention: Beyond 12, you can have some errors of memory allocation
		depending on your compiler and your computer. */
	unsigned int index_dic_max;
	/* index_dic_max gives the maximum word counter in the dictionary during *one* compression.
		This constant is restricted to the range of end_information_code to 2^EXP2_DIC_MAX. */
	unsigned char output_bit_counter,
	/* Bit counter for each data in output.
		With output_bit_counter=1, we can compress/decompress monochrome pictures
		and with output_bit_counter=8, we can handle 256-colors pictures or any kind of files. */
			      bit_counter_min_decoding;
	/* Bit counter to encode 'initialization_code'. */
	unsigned int initialization_code;
	unsigned int end_information_code;
	/* initialization_code and end_information_code are both consecutive
		coming up just after the last known word in the initial dictionary. */
	p_dic_link dictionary[1<<EXP2_DIC_MAX];

protected:

	// Internal Fns
	bool init_dictionary1();
	bool init_dictionary2();
	void remove_dictionary();
	void write_output(unsigned int value);
	void complete_output();
	void write_link( p_dic_link chainage, unsigned int *character );
	unsigned int write_string(unsigned int pred_code, unsigned intcurrent_code, unsigned int first_char);
	void add_string( unsigned int code, unsigned int first_char);
	unsigned int read_code_lr();
	unsigned int write_code_rl();
	bool lzwdecoding();

public:
	bool Decompress(CMemory& in,CMemory& out);

};

#endif

⌨️ 快捷键说明

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