Compress your data in real-time on any embedded system!
- Small ROM footprint
- No static RAM required
- Compression of data streams
- High performance
What is emCompress-ToGo?
emCompress-ToGo is a portable compression software, designed primarily for but not only embedded systems. It can compress and decompress data with basically no RAM requirements.
The lossless compression is fast and efficient and can be easily done on the embedded system, just like the decompression. In general, there are multiple compression algorithms that allow compression on the host and decompression on target (emCompress-Embed). There are not many, if any, options to compress easily and efficiently on an embedded system, especially with limited RAM.
emCompress-ToGo uses SEGGER's SMASH-2 (Small Microcontroller Advanced Super High) compression algorithm, specifically designed for this type of application, and achieving amazing compression.
One Professional Solution For All Applications
A multitude of applications will benefit from compression. Whether compression is used to reduce the required memory size, to reduce the required bandwidth or just to safe time, emCompress-ToGo enables compression and decompression for all applications even in resource-constrained microcontroller based systems.
We have been looking at a large variety of different data types. SMASH works well in all cases. The table below displays the compression ratios for various use cases. If the compression ratio is 25%, the compression rate is 4, as the resulting data size is a fourth of the original data.
|Type of data||Window size|
|256 bytes||512 bytes||1024 bytes||2 kB||4 kB|
|HTML file |
|39.95% (129731 bytes)||33.05% (107325 bytes)||28.54% (92674 bytes)||20.83% (67656 bytes)||15.88% (51577 bytes)|
|Blog article |
|50.64% (10581 bytes)||44.78% (9357 bytes)||40.19% (8398 bytes)||36.86% (7701 bytes)||34.35% (7177 bytes)|
|FPGA bitstream |
|31.66% (36290 bytes)||28.79% (33033 bytes)||26.95% (30889 bytes)||25.70% (29452 bytes)||22.58% (25880 bytes)|
|MIDI file |
|39.10% (22209 bytes)||30.05% (17072 bytes)||23.20% (13181 bytes)||18.92% (10747 bytes)||17.03% (9676 bytes)|
|49.00% (107213 bytes)||44.30% (96949 bytes)||41.89% (91655 bytes)||40.76% (89198 bytes)||40.33% (88245 bytes)|
|41.02% (252503 bytes)||37.79% (232605 bytes)||35.46% (218250 bytes)||34.16% (210296 bytes)||33.59% (206786 bytes)|
Compression ratios are quite good, especially given that this can be done quickly and with no work RAM on the target. The 512 byte setting is the recommended default for on target compression. To verify the compression results on your own, please refer to the evaluation package.
Compression performance and time go up with larger window sizes.
A Cortex-M4 running at 200 MHz has been used to measure the performance.
In a fixed parameter default configuration, RAM to RAM compression with 256 bytes window, it takes about 2500 cycles / byte, so the compression performance is about 400 kB/sec.
Decompression performance is largely independent of the parameters, so that the window size does not have a major effect on decompression performance.
Similar to the performance values for compression, a Cortex-M4 running at 200 MHz has been used to measure the performance.
In a fixed parameter, RAM to RAM decompression, it takes about 50 cycles / byte, so the decompression performance is about 4MB/sec.
In most cases, no RAM is required! Since SMASH works with references, it uses the uncompressed part as “window”. In cases of compression of a stream, compressing blocks of 2KB or even less at a time (down to as little as just 256 bytes) can be done.
There are different decompressors available, basically 2 types: For fixed parameters and for flexible parameters. In most cases, the fixed parameter decompressor can be used. In a memory to memory compression scenario, it needs only about 500 bytes!
The flexible variant requires about 800 bytes.
The compressor needs about 900 bytes of ROM.
PC Evaluation Software
Compression and decompression with SMASH can be evaluated on a Windows PC with the tools of the software package available for download. It includes a compressor and a decompressor tool and the data files we used in the compression table previously mentioned.
PC Evaluation Software Package Content
|Smash.exe||Windows executable of SMASH compressor|
|Unsmash.exe||Windows executable of SMASH decompressor|
|Blog.txt||Text content of "What's cooking at SEGGER" blog|
|Firmware.bin||Binary file of a firmware image for a microcontroller|
|Firmware.hex||Hex file of above mentioned firmware image|
|Index.htm||HTML code taken from the SEGGER website|
|MIDI.mid||Standard .midi file|
The software package includes a batch file, ShowStats.bat, which compresses the included data files. You can compare the compression results of the different files with different window sizes being used.
You can also compress and decompress your own files to test the efficiency of the SMASH-2 compression algorithm and to find the best balance of compression ratio and window size (i.e. memory requirement) for your use cases.
Evaluation on a Microcontroller
To evaluate the use of emCompress-ToGo in an embedded application, a trial package for Embedded Studio is available for download. It includes a project to test compression and decompression in Embedded Studio's simulator. It can also easily be configured to run on actual hardware.
Running the Simulator Project in Embedded Studio
Running the emCompress-ToGo demo project will generate some output in the terminal that provides data of the compressed or decompressed file in different compression modes. emCompress-ToGo can run compression and decompression from memory to memory, from function to function, from memory to function and vice versa. All four resulting combinations are tested in the simulation project.
To get started, follow these steps:
- Open Start.emProject with Embedded Studio.
- Select "Decode_Release" for testing the decompressor or "Encode_Release" for testing the compressor as the active build configuration.
- Build the project.
- Start a debug session and let it run.
- The debug terminal will show the compression or decompression results of the example application.
List of available Downloads
|User Manual of emCompress-ToGo|
|PC evaluation tool|
|Simulator project for evaluation|
Can the software be used for streaming data?
A: Yes. This can easily be done. It actually comes with a sample showing how to do this.
Can I use the software to compress data I want to store in files?
A: Yes, No problem!
I am storing a long file. Is there a way to "fast forward" in the file, so to extract a portion of it without having to extract the whole file?
A: Yes, this can easily be done by chunking the output and prefixing every chunk with the chunk size
(compressed and uncompressed). The software comes with a sample showing how to do this.
Can I test the software?
A: A Windows executable can be downloaded which compresses a file. Drag and drop the file onto the compressor to compress it. As easy as that.
Do I have to select parameters for compression?
A: No. There basically is only one parameter, and that is the size of the window.
This affects the amount of uncompressed data which needs to be in memory at any given time as well as the compression speed. The default usually works well, typically there is no need to fine tune the parameter.