LZW COM pression / DECOM pression内存不足的情况​​下, [英] LZW compression/decompression under low memory conditions

查看:146
本文介绍了LZW COM pression / DECOM pression内存不足的情况​​下,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以指点我如何能实现LZW COM pression / DECOM pression在内存不足的条件下(小于2K)。这可能吗?

Can anybody give pointers how I can implement lzw compression/decompression in low memory conditions (< 2k). is that possible?

推荐答案

这是每个人都使用zlib库是在其他问题臃肿(用于嵌入式)。我是pretty的确保它不会为您的情况。我有一个小的内存也许16K并且不可能得到它适合。它分配和零点大块内存,并保持的东西拷贝等算法也许可以这样做,但发现存在code是挑战。

The zlib library that everyone uses is bloated among other problems (for embedded). I am pretty sure it wont work for your case. I had a little more memory maybe 16K and couldnt get it to fit. It allocates and zeros large chunks of memory and keeps copies of stuff, etc. The algorithm can maybe do it but finding existing code is the challenge.

我去 HTTP://lzfx.google$c$c.com 的DECOM pression循环是微小的,这是老LZ输入com pression依赖于现有成绩,所以你需要有机会获得uncom pressed结果...下一个字节是一个0x5的,在下一个字节是0x23,接下来的15个字节是15的200个字节前一个副本,在接下来的6个字节是127年前...正在更新的LZ算法是可变宽度表基础,可以是大的还是取决于成长如何实现的。

I went with http://lzfx.googlecode.com The decompression loop is tiny, it is the older lz type compression that relies on the prior results so you need to have access to the uncompressed results...The next byte is a 0x5, the next byte is a 0x23, the next 15 bytes are a copy of the 15 200 bytes ago, the next 6 bytes are a copy of 127 ago...the newer lz algorithm is variable width table based that can be big or grow depending on how implemented.

我正在处理重复数据,并试图向下挤压几K到几百个,我觉得COM pression约为50%,不是很大,但做的工作和DECOM pression例程小。上述lzfx包很小,并不像zlib的,像有code右边有两个主要功能,而不是几十个文件。你可以有可能更改缓冲区的深度,也许是提高玉米pression算法,如果你愿意的话。我也不得不修改DECOM pression code(如20或30行code也许)是指针很重,我切换到我的嵌入式环境中,因为数组的指针是放错了地方。伯恩斯也许一个额外的寄存器或不取决于你如何实现它和你的编译器。我也做到了,所以我可以抽象的取和字节的存储为我使他们安置到存储器中的wasnt字节寻址。

I was dealing with repetitive data and trying to squeeze a few K down into a few hundred, I think the compression was about 50%, not great but did the job and the decompression routine was tiny. The lzfx package above is small, not like zlib, like two main functions that have the code right there, not dozens of files. You could likely change the depth of the buffer, perhaps improve the compression algorithm if you so desire. I did have to modify the decompression code (like 20 or 30 lines of code perhaps) it was pointer heavy and I switched it to arrays because in my embedded environment the pointers were in the wrong place. Burns maybe an extra register or not depending on how you implement it and your compiler. I also did that so I could abstract the fetches and the stores of the bytes as I had them packed into memory that wasnt byte addressable.

如果你找到一个更好的,请在这里发表或通过计算器ping通了我,我也是在其他嵌入式解决方案很感兴趣。我搜索了不少和上面是唯一有用的,我发现,我很幸运,我的数据是这样的,它融为一体pressed不够好,使用该算法......现在。

If you find something better please post it here or ping me through stackoverflow, I am also very interested in other embedded solutions. I searched quite a bit and the above was the only useful one I found and I was lucky that my data was such that it compressed well enough using that algorithm...for now.

这篇关于LZW COM pression / DECOM pression内存不足的情况​​下,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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