需要算法来压缩字节数组 [英] Need an algorythm to compress a byte array

查看:100
本文介绍了需要算法来压缩字节数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我需要将数据压缩为字节数组并存储在数据库中.速度受到青睐.
我想比简单的算法更好地压缩,例如计算重复的字节数.
我希望使用比lempel-ziv更简单的算法来压缩少量字节,例如500个字节.
我特别希望这样做:1-压缩小型数组,2速度,3-小代码,4压缩比值得压缩.
任何指导或文章表示赞赏.
如果操作系统提供压缩和解压缩,那就更好了.
在此先感谢
mr.abzadeh

Hello guys
I need to compress data in a byte array and store in database. speed is favored.
I want to compress better than very simple algorythms such as counting repeated bytes.
I want simpler algorythms than lempel-ziv, to compress small count of bytes, say 500 bytes.
Specifically I Want this: 1- compress small arrays, 2-speed, 3-small code, 4-compresion ratio to worth compressing.
Any guidance or article appreciated.
If operating system provides compresion and decompresion, It will be better.
Thanks in advance
mr.abzadeh

推荐答案

最好的算法取决于数据的性质.例如,如果它们是随机值,则最好甚至不要尝试压缩它们.
如果您需要有关压缩方法的指南,那么我建议您使用Salomon的书: [System.IO.Compression命名空间 [朋友 [
The best alogorithm depends on the nature of your data. If they are, for instance, random values then you''ll better don''t even try to compress them.
If you need a guidance on a compression method then I suggest you the Salomon''s book: "Data Compression: The Complete Reference"[^].

On the other hand, if you are searching for a ready-to-use library, then you have several options (they depend also on your favourite development platform, for instance, .NET Framework provides the System.IO.Compression Namespace[^]) and Google is you friend friend[^].


我经常使用#ziplib [ ^ ],因为受支持的格式范围很广-包括加密支持.
[更新]
当我在C ++中需要这样的东西时,请查看 LZMA SDK [
I often use #ziplib [^] because of the wide range of supported formats - including encryption support.

[Update]
When I need something like this in C++ I look to the LZMA SDK[^]

Best regards
Espen Harlinn


关于霍夫曼编码的方法 http://hbfs. wordpress.com/2011/05/17/huffman-codes/ [ ^ ].我已经做到了,但是不确定它的速度.不知道这是否对您有帮助.
how about huffman encoding http://hbfs.wordpress.com/2011/05/17/huffman-codes/[^]. i have done it.but not sure about the speed of it. don''t know whether this helps you.


这篇关于需要算法来压缩字节数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆