ctr_compress
The ctr_compress tool creates compressed data in a format that can be handled by the cx library of the CTR-SDK.
% ctr_compress <-d(8|16)|r|l|lex|lb|h(4|8)|lh|lrc> [-s] [-<t|T>[width]] [-H] [-A(4|8|16|32)] [-o outputFile] <inputFile>
% ctr_compress <-x|xlb> [-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, LZ77 backward 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 zeroes so that the file size is in alignment with the byte size of the n argument. You cannot use the -lb and -x options together.
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, files that were compressed using ctr_compress (with the exception of LZ77 backward compression files ) can be decompressed on the PC. For files that have been compressed with LZ77 backward compression, use the -xlb option.
If you omit the input file name, the data will be loaded from standard input. If you specify "-" for the output file name with the -o option, the data will be written to standard output. An example is given below.
% ctr_compress -l -o - < inputFile > outputFile
The following formats can be specified for the compression method:
| Options | Compression Method | Parameters |
|---|---|---|
-d | Difference filtering. | Specifies the bit size of the comparison unit { 8 | 16 } |
-r | Run-length compression. | None. |
| -h | Huffman compression. | Specifies the bit size to encode { 4 | 8 } |
-lex | LZ77 extended compression | None. |
-l | LZ77 compression (for backward compatibility). | None. |
| -lb | LZ77 backward compression | None. |
| -lh | LZ77 + Huffman combined compression | None. |
| -lrc | LZ77 + Range Coder combined compression | None. |
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.
-A option.-lb and -xlb options.CONFIDENTIAL