ctr_compress

Description

The ctr_compress tool creates compressed data in a format that can be handled by the cx library of the CTR-SDK.

How to Use

Command

% ctr_compress <-d(8|16)|r|l|lex|h(4|8)|lh|lrc> [-s] [-<t|T>[width]] [-H] [-A(4|8|16|32)] [-o outputFile] <inputFile>

% ctr_compress -x [-o outputFile] [-s] <inputFile>

Compresses and converts the input file that is designated by inputFile into a designated format. Run-length compression, LZ77 extended compression, Huffman compression, and difference filter conversion are all possible.

With the -s option, the message indicating successful compression will not be displayed.

With the -H option, the data size is also appended to the data after expansion occurs. This is because header information is added to the data and compressed.

With the -A option, the end of the output file is padded with zeros so that the file size is in alignment with the byte size of the n argument.

With the -o option, the file name of the output file can be designated. If nothing is designated, the output file is created with the name (main portion of the input file name)_(compression method).bin.

With the -t or -T option, the output file can be created as a C format text file. By adding (1 | 2 | 4) to the option, you can choose between the u8, u16, and u32 types. (The default is u8.) The output is little-endian with -t and big-endian with -T when u16 or u32 has been specified.

With the -x option, ctr_compress is used and the compressed file is decompressed on the PC.

Format of Options for Designating the Compression Method

The following formats can be specified for the compression method:

OptionsCompression MethodParameters
-dDifference filtering.Specifies the bit size of the comparison unit { 8 | 16 }
-rRun-length compression.None.
-hHuffman compression.Specifies the bit size to encode { 4 | 8 }
-lexLZ77 extended compressionNone.
-lLZ77 compression (for backward compatibility).None.
-lhLZ77 + Huffman combined compressionNone.
-lrcLZ77 + Range Coder combined compressionNone.

Although you can expect a higher compression ratio with LZ77 extended compression (-lex) as compared to LZ77 compression (-l), the -l option is preserved for backward compatibility. Either format can be decompressed using the same nn:cx::UncomrpessLZ* functions.

Although extended LZ compression (-lex) may have a worst-case compression time several times greater than when using conventional LZ compression (-l), and although you can expect compression at more consistent speeds with the conventional version regardless of the data when compressing data at runtime, decompression speed is about the same for both methods.

Revision History

2010/09/17
Initial version.

CONFIDENTIAL