-
LZW压缩算法c++实现
应用背景本程序是一个使用C++实现的压缩算法,LZW算法,LZW压缩算法是Lempel-Ziv-Welch 3个人共同发明的,简称 LZW 的压缩算法,可以用任何一种语言来实现它.
LZW是GIF图片文件的压缩算法,而且zip压缩的思想也是基于LZW实现的,所以LZW对文本文件具有很好的压缩性能。
LZW压缩算法的基本原理:提取原始文本文件数据中的不同字符,基于这些字符创建一个编码表,然后用编码表中的字符的索引来替代原始文本文件数据中的相应字符,减少原始数据大小。看起来和调色板图象的实现原理差不多,但是应该注意到的是,我们这里的编码表不是事先创建好的,而是根据原始文件数据动态创建的,解码时还要从已编码的数据中还原出原来的编码表.
关键技术编码表中每一项的大小一般为12位,用来代表一个字符串。这样编码表有2**12=4096项,编码值是0~4095。通常情况下0~255是固定的,用
来代表单个字符0~255。而值256通常用来表示开始新的编码表,因为如果编码表的4096项都用完了,而待压缩文件还没有处理完,那么就需要生成新的
编码表继续压缩;257表示压缩结束,用来写到压缩文件尾。从258开始,每个值都代表一个字符串(至少2个字符)。
举个例子,有下面的字符串:ababcdefgefg。(a的ascii码是0x61=97)
压缩后的数据是:97 98 258 99 100 101 102 103 263 103。
请点击左侧文件开始预览 !预览只提供20%的代码片段,完整代码需下载后查看 加载中 侵权举报
- 2022-03-11 09:38:15下载
- 积分:1
-
这是一个简单的演示如何评价文本的数学表达式
This a simple demo of how to evaluate mathematical expressions in text
format, including provision for variables and functions. The code consists of
three simple classes: 1) Calc - which does the main calculations, 2) Stack -
which is used to push and pop intermediate operators and numbers and 3)
Symbol Table. The symbol table is a collection of calc symbols, a type structure
consisting of various elements, including the expression name, function name,
and the final value of the expression The evaluation procedure is done in three
steps: 1) simplify the expression by removing all the elements within () and
storing them in subexpressions within the symbol table. 2) Each of these sub
expressions are then converted to RPN format (Reverse polar notation) and
evaluated 3) Finally, the main expression is converted to RPN and evaluated-This is a simple demo of how to evaluate mathematical expressions in text
format, including provision for variables and functi
- 2022-02-20 06:26:41下载
- 积分:1
-
KomfortBlinker
用汇编语言编写的代码,实现安装在汽车上的KomfortBlinker。它基于Attiny13,使用了一些组件。此外,还提供了示意图
- 2022-07-20 17:27:17下载
- 积分:1
-
最小二乘法与曲线拟合-fortran
小二乘法合的fortran语言实现,与曲线拟合的fortran实现
- 2023-07-26 20:45:04下载
- 积分:1
-
zlib压缩源码
ZLIB 数据压缩库
zlib 1.2.5 是一个通用的数据压缩库。所有的代码
线程安全。Zlib 库所使用的数据格式是由 Rfc 描述的。
(评论要求) 1950 年到 1952 年的文件中
http://www.ietf.org/rfc/rfc1950.txt (zlib 格式)、 rfc1951.txt (紧缩格式)
和 rfc1952.txt (gzip 格式)。
压缩库的所有功能都记录在文件 zlib.h
(志愿者写的人的欢迎页面,联系 zlib@gzip.org)。用法示例
- 2022-05-21 06:30:25下载
- 积分:1
-
data mining algorithms decision tree classification algorithm presentations and...
数据挖掘分类算法决策树学习算法介绍以及SEE5的使用说明-data mining algorithms decision tree classification algorithm presentations and the use SEE5
- 2023-04-10 22:10:04下载
- 积分:1
-
一个Huffman的例子
一个Huffman的例子--A Huffman example
- 2022-08-19 09:15:43下载
- 积分:1
-
这是用来验证卡号世界各地LUHN算法。
This the Luhn algorithm used to verify card numbers throughout the world.
-This is the Luhn algorithm used to verify card numbers throughout the world.
- 2022-12-16 15:10:03下载
- 积分:1
-
曲线拟合程序代码 曲线拟合程序代码
曲线拟合程序代码 曲线拟合程序代码-Curve-fitting program code
- 2023-08-23 20:45:03下载
- 积分:1
-
这是一个高通滤波器的最优化算法。有约束问题采用的是惩罚函数法,无约束问题采用的是单纯形法...
这是一个高通滤波器的最优化算法。有约束问题采用的是惩罚函数法,无约束问题采用的是单纯形法-this is a high-pass filter to the optimization algorithm. Binding the issue of punitive function without constraint using the simplex method
- 2022-01-22 03:21:39下载
- 积分:1