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

📄 lzwcompress.h

📁 点对点传输通讯源代码
💻 H
字号:
// LZWCompress.h: interface for the LZWCompress .
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_LZWCOMPRESS_H__8179F78F_9100_42AD_9BCE_C0D81692DEA5__INCLUDED_)
#define AFX_LZWCOMPRESS_H__8179F78F_9100_42AD_9BCE_C0D81692DEA5__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define INIT_BITS	9 //初始编码大小
#define MAX_BITS	14 //最大编码大小 
#define HASHING_SHIFT MAX_BITS - 8	//哈希位移

#if MAX_BITS == 14            
#define TABLE_SIZE 18041	// 编码表大小. 必须是一个大于2^MAX_S的素数
#elif MAX_BITS == 13
#define TABLE_SIZE 9029
#else
#define TABLE_SIZE 5021
#endif

#define CLEAR_TABLE 256    // 表满刷新标志
#define TERMINATOR  257    // 解码结束标志
#define FIRST_CODE  258    // 编码表中第一个有效编码
#define CHECK_TIME  500    // 检查压缩率的变化情况:-)好像是最优值

#define MAXVAL(n) (( 1 <<( n )) -1)   // 最大编码数
/////////////////////////////////////////////////////
extern int *code_value;						/* This is the code value array */
extern unsigned int  *prefix_code;			/* This array holds the prefix codes */
extern unsigned char *append_character;		/* This array holds the appended chars */
extern int num_bits;						/* Starting with 9 bit codes */
extern unsigned long bytes_in,bytes_out;	/* Used to monitor compression ratio */
extern unsigned int max_code;				/* old MAX_CODE */
extern unsigned long checkpoint;			/* For compression ratio monitoring */
extern unsigned long incounts;
extern unsigned long outcounts;
extern unsigned long counts;
extern unsigned char *input,*output;
extern int output_bit_count;
extern unsigned long output_bit_buffer;
//////////////////////////////////////////
unsigned long LZWCompress(unsigned char *inputs,unsigned long lens,unsigned char *outputs);
int find_match(unsigned int hash_prefix, unsigned int hash_character);
void output_code(unsigned int code);
void LZWFreeTables();
bool LZWAllocTables(void);
#endif // !defined(AFX_LZWCOMPRESS_H__8179F78F_9100_42AD_9BCE_C0D81692DEA5__INCLUDED_)

⌨️ 快捷键说明

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