EmbeddedRelated.com
Forums

Data compression?

Started by itsjustimpossible September 16, 2006
Hi
We need to move several hundred Kbytes of binary data over an RS232
connection from a PC to an LPC2294. This is all fine but is taking too
long to transfer even at a high baud rate.
The physical architecture cannot be changed so I am looking to
compress the data file as much as possible before transmission.

Does anyone know of a commercial lossless compression library that is
available for the LPC2000 devices? We are using Keil as the compiler.

If anyone has any thoughts or experience with this sort of thing I
would be very grateful. We only need to decompress the data in the
LPC2294.

Many thanks
Simon

An Engineer's Guide to the LPC2100 Series

Hi,

zlib http://www.zlib.net/ might be a good option for you. It has has
been developed by the same guys responsible for gzip and it is a very
stable package. Also comes with a zlib license (not GPL!) which
allows you to use for any purpose including commercial applications.

zlib is very portable, you can compile it for the PC and LPC2K.
Although I have not used it on LPC2K I have used it on another
embedded platform. The same code running on both ends of the
communication will definitely save you some grief. Also you can
quickly prototype and debug almost entire process on the PC which will
give you insight into the compression ratios with your data.

One issue that might come up is the memory footprint. As shipped it is
configured for desktops and with these settings inflate() requires max
44KB plus some extra bytes. You are targeting LPC2294 so I am
assuming board has external memory, might not be an issue. In any case
you can tune it to reduce memory requirements.
Check the technical discussion on this page
http://www.zlib.net/zlib_tech.html

thanks,
elektrknight
---------------------------------
http://www.hbbrbasic.com/ Embedded IDE and Compiler for ARM based
microcontrollers

>
> Hi
> We need to move several hundred Kbytes of binary data over an RS232
> connection from a PC to an LPC2294. This is all fine but is taking too
> long to transfer even at a high baud rate.
> The physical architecture cannot be changed so I am looking to
> compress the data file as much as possible before transmission.
>
> Does anyone know of a commercial lossless compression library that is
> available for the LPC2000 devices? We are using Keil as the compiler.
>
> If anyone has any thoughts or experience with this sort of thing I
> would be very grateful. We only need to decompress the data in the
> LPC2294.
>
> Many thanks
> Simon
>
Hi,

due to my experience using algorythms like ZIP and GZIP can not be used on
embedded systems like a LPC because of:

* The do use too much RAM
* They are too slow (especially when you want to decompress data "on the fly")

I had a similar problem a long time ago when making a hard disk cloning
software (this was one of the first products running on plain old DOS on a
386 processor); I found some compression algs on the net at this time (boy,
this was about 10 years ago) which I modified slightly without really
understanding how it works ;-)

If you do not expect me to explain how the source code works, I can send it
via email, please let me know. It's only one file containing the
compression and uncompression as well and should be easily portable to the
LPC, I assume. Do not expect a compression rate like ZIP (this is something
costing very much RAM and processing power), but the results are not that bad.

Regards
Herbert

At 13:17 16.09.2006 +0000, you wrote:

>Hi,
>
>zlib http://www.zlib.net/ might be a good option for
>you. It has has
>been developed by the same guys responsible for gzip and it is a very
>stable package. Also comes with a zlib license (not GPL!) which
>allows you to use for any purpose including commercial applications.
>
>zlib is very portable, you can compile it for the PC and LPC2K.
>Although I have not used it on LPC2K I have used it on another
>embedded platform. The same code running on both ends of the
>communication will definitely save you some grief. Also you can
>quickly prototype and debug almost entire process on the PC which will
>give you insight into the compression ratios with your data.
>
>One issue that might come up is the memory footprint. As shipped it is
>configured for desktops and with these settings inflate() requires max
>44KB plus some extra bytes. You are targeting LPC2294 so I am
>assuming board has external memory, might not be an issue. In any case
>you can tune it to reduce memory requirements.
>Check the technical discussion on this page
>http://www.zlib.net/zlib_tech.html
>
>thanks,
>elektrknight
>----------------------
>http://www.hbbrbasic.com/ Embedded IDE and
>Compiler for ARM based
>microcontrollers
>
> >
> > Hi
> > We need to move several hundred Kbytes of binary data over an RS232
> > connection from a PC to an LPC2294. This is all fine but is taking too
> > long to transfer even at a high baud rate.
> > The physical architecture cannot be changed so I am looking to
> > compress the data file as much as possible before transmission.
> >
> > Does anyone know of a commercial lossless compression library that is
> > available for the LPC2000 devices? We are using Keil as the compiler.
> >
> > If anyone has any thoughts or experience with this sort of thing I
> > would be very grateful. We only need to decompress the data in the
> > LPC2294.
> >
> > Many thanks
> > Simon
> >
Herbert,

zlib can be used in LPC2K based embedded systems. The limiting factor
in this project is serial speed, neither memory nor CPU speed is an
issue with the correct configuration of the zlib.

For some of the examples of how zlib is used in embedded systems look
into uClinux or eCos.

Also, ARM is including zlib in ARM Firmware Suite for ARM7TDMI as an
example of third party library. I am not sure if Keil is including it
with the compiler but is is worth checking.
thanks,
elektrknight
---------------------------------
http://www.hbbrbasic.com/ Embedded IDE and Compiler for ARM based
microcontrollers

--- In l..., Herbert Demmel wrote:
>
> Hi,
>
> due to my experience using algorythms like ZIP and GZIP can not be
used on
> embedded systems like a LPC because of:
>
> * The do use too much RAM
> * They are too slow (especially when you want to decompress data "on
the fly")
>
> I had a similar problem a long time ago when making a hard disk cloning
> software (this was one of the first products running on plain old
DOS on a
> 386 processor); I found some compression algs on the net at this
time (boy,
> this was about 10 years ago) which I modified slightly without really
> understanding how it works ;-)
>
> If you do not expect me to explain how the source code works, I can
send it
> via email, please let me know. It's only one file containing the
> compression and uncompression as well and should be easily portable
to the
> LPC, I assume. Do not expect a compression rate like ZIP (this is
something
> costing very much RAM and processing power), but the results are not
that bad.
>
> Regards
> Herbert
>
> At 13:17 16.09.2006 +0000, you wrote:
>
> >Hi,
> >
> >zlib http://www.zlib.net/ might be a good
option for
> >you. It has has
> >been developed by the same guys responsible for gzip and it is a very
> >stable package. Also comes with a zlib license (not GPL!) which
> >allows you to use for any purpose including commercial applications.
> >
> >zlib is very portable, you can compile it for the PC and LPC2K.
> >Although I have not used it on LPC2K I have used it on another
> >embedded platform. The same code running on both ends of the
> >communication will definitely save you some grief. Also you can
> >quickly prototype and debug almost entire process on the PC which will
> >give you insight into the compression ratios with your data.
> >
> >One issue that might come up is the memory footprint. As shipped it is
> >configured for desktops and with these settings inflate() requires max
> >44KB plus some extra bytes. You are targeting LPC2294 so I am
> >assuming board has external memory, might not be an issue. In any case
> >you can tune it to reduce memory requirements.
> >Check the technical discussion on this page
> >http://www.zlib.net/zlib_tech.html
> >
> >thanks,
> >elektrknight
> >----------------------
> >http://www.hbbrbasic.com/ Embedded IDE and
> >Compiler for ARM based
> >microcontrollers
> >
> > >
> > > Hi
> > > We need to move several hundred Kbytes of binary data over an RS232
> > > connection from a PC to an LPC2294. This is all fine but is
taking too
> > > long to transfer even at a high baud rate.
> > > The physical architecture cannot be changed so I am looking to
> > > compress the data file as much as possible before transmission.
> > >
> > > Does anyone know of a commercial lossless compression library
that is
> > > available for the LPC2000 devices? We are using Keil as the
compiler.
> > >
> > > If anyone has any thoughts or experience with this sort of thing I
> > > would be very grateful. We only need to decompress the data in the
> > > LPC2294.
> > >
> > > Many thanks
> > > Simon
> > >
> >
> >
>
>
Hi elektrknight and Herbert
Many thanks for the suggestions, I am collecting files at the moment
and then I can go through the options tomorrow hopefully.

I have had a quick look at zlib and that looks pretty comprehensive,
and if you are kind enough to forward your suggestion onto me Herbert
it would be much appreciated.

There seem to be several different types of package available but
mostly for PCs and so too large. It also makes you feel a bit safer if
the library you use has been recommended by someone else who has
expereince with it..

Best regards
Simon

--- In l..., "itsjustimpossible"
wrote:
> Does anyone know of a commercial lossless compression library that
is
> available for the LPC2000 devices? We are using Keil as the compiler.
> Many thanks
> Simon
>