1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
3  <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5    <meta http-equiv="Content-Style-Type" content="text/css" />
6<title>ctr_compress</title>
7    <style type="text/css">
8    <!--
9    body {
10    /*
11        font-size       : 10pt;
12    */
13        font-weight     : normal;
14        color           : #000000;
15        margin          : 8px;
16    }
17
18    div {
19        width           : 98%;
20        white-space     : nowrap;
21    }
22
23    div.title {
24        text-align      : left;
25        font-weight     : bold;
26    /*
27        font-size       : 16pt;
28    */
29        font-size       : 150%;
30        color           : #202020;
31        border-style    : double;
32        border-width    : 8px;
33        /* タイトルを囲む枠線の色を指定 */
34        border-color    : #CD202C;
35
36        /* RVLプラットフォーム系列 */
37    /*
38        border-color    : #34beed;
39    */
40
41        /* TWLプラットフォーム系列 */
42    /*
43        border-color    : #ff458f;
44    */
45
46        margin          : 4px;
47        padding         : 4px;
48    }
49    H1 {
50      font-size                 : 150%;
51      font-family               : Arial;
52      border-bottom-width       : 5px;
53      border-bottom-style       : solid;
54      border-bottom-color       : #CD202C;
55      padding-bottom            : 1px;
56      margin-bottom             : 20px;
57      letter-spacing            : normal;
58      font-weight               : bold;
59    }
60
61    h2 {
62        font-weight     : bold;
63    /*
64        font-size       : 16pt;
65    */
66        font-size       : 150%;
67        border-style    : none none solid double;
68        border-width    : 0px 0px 2px 8px;
69        /* 見出しの線の色を指定 */
70        border-color    : #CD202C;
71
72        /* RVLプラットフォーム系列 */
73    /*
74        border-color    : #34beed;
75    */
76
77        /* TWLプラットフォーム系列 */
78    /*
79        border-color    : #ff458f;
80    */
81
82        margin-left     : 2px;
83        padding-left    : 4px;
84    }
85    CODE {
86      font-family       : "Courier New", monospace;
87      position          : normal;
88      left              : 12px;
89      font-size         : 10pt;
90    }
91    table {
92      margin-top        : 2pt;
93      margin-bottom     : 2pt;
94      margin-left       : 0pt;
95      margin-right      : 0pt;
96      padding-left      : 0pt;
97      padding-right     : 0pt;
98      position          : relative;
99      left              : 12px;
100      font-family       : Arial;
101      font-size         : 10pt;
102      border-style      : none none none none;
103    }
104    td,th {
105      padding           : 2pt;
106      border-width      : 2pt;
107      border-style      : none none none none;
108      font-style        : normal;
109      text-align        : left;
110    }
111    td {
112      background        : #e8f4f4;
113      font-weight       : normal;
114    }
115    th {
116      background        : #c0d8d8;
117      font-weight       : bold;
118    }
119
120    p {
121        margin-left     : 4px;
122    }
123    p.code {
124      font-family       : "Courier New", monospace;
125      position          : normal;
126      left              : 12px;
127      font-size         : 10pt;
128      background        : #e8f4f4;
129    }
130
131    -->
132    </style>
133
134  </head>
135  <body>
136<h1><CODE>ctr_compress</CODE></h1>
137<h2>Description</h2>
138    <p>
139The <CODE>ctr_compress</CODE> tool creates compressed data in a format that can be handled by the <CODE>cx</CODE> library of the CTR-SDK.
140    </p>
141<h2>How to Use</h2>
142<h3>Command</h3>
143
144    <p class="code">
145% ctr_compress &lt;-d(8|16)|r|l|lex|lb|h(4|8)|lh|lrc&gt; [-s] [-&lt;t|T&gt;[width]] [-H] [-A(4|8|16|32)] [-o outputFile] &lt;inputFile&gt;
146    </p>
147    <p class="code">
148% ctr_compress &lt;-x|xlb&gt; [-o outputFile] [-s] &lt;inputFile&gt;
149    </p>
150
151    <p>
152Compresses and converts the input file that is designated by <CODE>inputFile</CODE> into a designated format. Run-length compression, LZ77 extended compression, LZ77 backward compression, Huffman compression, and difference filter conversion are all possible.
153    </p>
154    <p>
155With the <code>-s</code> option, the message indicating successful compression will not be displayed.
156    </p>
157    <p>
158With the <CODE>-H</CODE> 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.
159    </p>
160    <p>
161With the <code>-A</code> 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 <SPAN class="argument">n</SPAN> argument. You cannot use the <CODE>-lb</CODE> and <CODE>-x</CODE> options together.
162    </p>
163    <p>
164With the <CODE>-o</CODE> option, the file name of the output file can be designated. If nothing is designated, the output file is created with the name (<EM>main portion of the input file name</EM>)_(<EM>compression method</EM>).bin.
165    </p>
166    <p>
167With the <CODE>-t</CODE> or <CODE>-T</CODE> 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 <CODE>-t</CODE> and big-endian with <CODE>-T</CODE> when u16 or u32 has been specified.
168    </p>
169    <p>
170With the <CODE>-x</CODE> option, files that were compressed using <CODE>ctr_compress</CODE> (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 <CODE>-xlb</CODE> option.
171    </p>
172    <p>
173If you omit the input file name, the data will be loaded from standard input. If you specify &quot;-&quot; for the output file name with the <CODE>-o</CODE> option, the data will be written to standard output. An example is given below.
174    </p>
175    <p class="code">
176% ctr_compress -l -o - &lt; inputFile &gt; outputFile
177    </p>
178
179<h3>Format of Options for Designating the Compression Method</h3>
180
181    <p>
182The following formats can be specified for the compression method:
183    </p>
184    <p>
185      <table class="table"><tbody>
186<tr><th>Options</th><th>Compression Method</th><th>Parameters</th></tr>
187<tr><td><code>-d</code></td><td>Difference filtering.</td><td>Specifies the bit size of the comparison unit  { 8 | 16 }</td></tr>
188<tr><td><CODE>-r</CODE></td><td>Run-length compression.</td><td>None.</td></tr>
189<tr><td>-h</td><td>Huffman compression.</td><td>Specifies the bit size to encode  { 4 | 8 }</td></tr>
190<tr><td><CODE>-lex</CODE></td><td>LZ77 extended compression</td><td>None.</td></tr>
191<tr><td><code>-l</code></td><td>LZ77 compression (for backward compatibility).</td><td>None.</td></tr>
192<tr><td>-lb</td><td>LZ77 backward compression</td><td>None.</td></tr>
193<tr><td>-lh</td><td>LZ77 + Huffman combined compression</td><td>None.</td></tr>
194<tr><td>-lrc</td><td>LZ77 + Range Coder combined compression</td><td>None.</td></tr>
195      </tbody></table>
196    </p>
197    <p>
198Although you can expect a higher compression ratio with LZ77 extended compression (<CODE>-lex</CODE>) as compared to LZ77 compression (<CODE>-l</CODE>), the <CODE>-l</CODE> option is preserved for backward compatibility. Either format can be decompressed using the same <CODE>nn:cx::UncomrpessLZ*</CODE> functions.
199    </p>
200    <p>
201Although extended LZ compression (<CODE>-lex</CODE>) may have a worst-case compression time several times greater than when using conventional LZ compression (<CODE>-l</CODE>), 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.
202    </p>
203
204<h2>Revision History</h2>
205    <dl class="history">
206      <dt>2011/10/13</dt>
207<dd>Added note about support for standard input and standard output. <br /></dd>
208      <dt>2011/10/03</dt>
209<dd>Added note specific to restrictions for the <CODE>-A</CODE> option.</dd>
210      <dt>2011/06/02</dt>
211<dd>Added the <CODE>-lb</CODE> and  <CODE>-xlb</CODE> options.</dd>
212      <dt>2010/09/17</dt>
213<dd>Initial version.<br /></dd>
214    </dl>
215  <hr><p>CONFIDENTIAL</p></body>
216</html>