PLATO Compression/Decompression Tool
If you find a bug or have a feature request please file an issue or send
me an email.
Compiled executables can be found here.
Usage
usage: cmp_tool [options] [<argument>]
General Options
| Options | Description |
|---|---|
-h, --help |
Print some help text and exit |
-V, --version |
Print program version and exit |
-v, --verbose |
Print various debugging information |
-n, --model_cfg |
Print a default model configuration and exit1 |
--diff_cfg |
Print a default 1d-differencing configuration and exit1 |
-a, --rdcu_par |
Add additional RDCU control parameters |
-o <prefix> |
Use the <prefix> for output files2
|
1) NOTE: In the default configurations the samples
and buffer_length parameter is set to 0!
2) NOTE: If the -o option is not used the <prefix>
will be set to "OUTPUT".
Compression Options
| Options | Description |
|---|---|
-c <file> |
File containing the compressing configuration |
-d <file> |
File containing the data to be compressed |
-m <file> |
File containing the model of the data to be compressed |
--rdcu_pkt |
Generate RMAP packets for an RDCU compression3 |
--last_info <.info file> |
Generate RMAP packets for an RDCU compression with parallel read of the last results |
3) NOTE: When using the --rdcu_pkt option the
configuration of the RMAP parameters can be found in the .rdcu_pkt_mode_cfg file.
The generated packets can be found in the TC_FILES directory.
Decompression Options
| Options | Description |
|---|---|
-i <file> |
File containing the decompression information |
-d <file> |
File containing the compressed data |
-m <file> |
File containing the model of the compressed data |
Guessing Options
| Options | Description |
|---|---|
--guess <mode> |
Search for a good configuration for compression <mode>4 |
-d <file> |
File containing the data to be compressed |
-m <file> |
File containing the model of the data to be compressed |
--guess_level <level> |
Set guess level to <level> (optional)5 |
4) NOTE: <mode> can be either the compression mode
number or the keyword: RDCU. The RDCU mode automatically selects the correct
RDCU-compatible compression mode depending on if the Model (-m) option is set.
5) Supported levels:
| guess level | Description |
|---|---|
1 |
fast mode (not implemented yet) |
2 |
default mode |
3 |
brute force |
Example of Compression Parmeter guessing:
./cmp_tool --guess RDCU -d test_data/test_data1.dat -o myguess
This command creates the file myguess.cfg with the guessed compression parameters.
Data Format
The input data must be formatted as two hex numbers separated by a space.
For example: 12 AB 34 CD.
How to use the tool
A simple example to show how the compression tool works.
-
Download the tool or run
maketo build the tool -
Create a configuration file
- Create a cfg directory
mkdir cfg - To create a default 1d-differencing mode configuration:
./cmp_tool --diff_cfg > cfg/default_config_1d.cfg - To create a default model mode configuration:
./cmp_tool --model_cfg > cfg/default_config_model.cfg - Change the the
samplesandbuffer_lengthparameters from0to50in thedefault_config_1d.cfganddefault_config_model.cfgfiles
- Compress data with the default configurations:
-
Create a directory for the compressed data
mkdir compressed -
1d-differencing mode compression
./cmp_tool -c cfg/default_config_1d.cfg -d test_data/test_data1.dat -o compressed/data1
This creates these two files in the compressed directory:
data1.cmp-> compressedtest_data1.datfile
data1.info-> decompression information fordata1.cmp -
Model mode compression
./cmp_tool -c cfg/default_config_model.cfg -d test_data/test_data2.dat -m test_data/test_data1.dat -o compressed/data2
We usetest_data1.datas the first model fortest_data2.dat.Creates these three files in the compressed directory:
data2.cmp-> compressedtest_data3.datfile
data2.info-> decompression information fordata2.cmp
data2_upmodel.dat-> updated model used to compress the next data in model mode
- Decompress the data
-
Create a directory for the decompressed data
mkdir decompressed -
Decompress
data1.cmp
./cmp_tool -i compressed/data1.info -d compressed/data1.cmp -o decompressed/test_data1
Creates this file in the decompressed directory:
test_data1.dat-> decompresseddata1.cmpfile -
Decompress
data2.cmp
./cmp_tool -i compressed/data2.info -d compressed/data2.cmp -m decompressed/test_data1.dat -o decompressed/test_data2
As for the compression we usetest_data1.datas our model for decompression.Creates these two files in the decompressed directory:
test_data2.dat-> decompresseddata2.cmpfile
data2_upmodel.dat-> updated model used to decompress the next data in model mode
-
Bonus: Check if the decompressed data are equal to the original data
The moment of truth!
diff test_data/test_data1.dat decompressed/test_data1.dat
diff test_data/test_data2.dat decompressed/test_data2.datAnd also check if the updated model is the same
diff compressed/data2_upmodel.dat decompressed/test_data2_upmodel.dat