lzwcompress.h

来自「一个不错的远程控制软件源码」· C头文件 代码 · 共 51 行

H
51
字号
// 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 + =
减小字号Ctrl + -
显示快捷键?