small RAM compression

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

I'm trying to find a small memory footprint compressor that I can use or develop for a non-commercial project; key requirement is that it consumes no more than 8KB of RAM. -- unfortunately what I've looked at so far (various LZ, compress and gzip) code requires far more.

Data being compressed is largely GPS positional strings. Compression ratio does not need to be high.

Suggestions?

M

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, since you know very well the type and range of your data, you may simply "bit-compact" each position. For example, lets assume you want to compact bidimensional positions from 0 to 15; in this case, you can compact one position in 1 byte, 4 bits for each coordinate. This may be enough for you.
If the positions change little, you can also save only the differences, using far less bits (of course, you must have a way to "synchronize" the curent position, saving full position data).

Embedded Dreams
One day, knowledge will replace money.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I found that lzo still requires too much RAM: 64K.

I will consider rolling my own GPS specific compression routine, but for the first pass wanted to try a generic compressor.

With more looking, I found something that works well: lzhuf (you can find it as public domain code on the web as lzhuf.c, and also within lharc). Not only is the compression pretty good, but it's still good when the data structures have been tuned to fit into 8K. With a bit of tweaking, the output file will be in lzh/lha format and therefore readable with standard windows decompression tools. So it looks like I'll work with lzhuf to start with.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yup, another vote for Huffman here. If you have plenty of example data I'd do a static Huffman after analysing for the probabilities of each character in the alphabet, this will use virtually no RAM whatsoever just a large fixed table of encoded symbols in flash.

Cliff