31.01.2014 Views

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

9.9 Burrows-Wheeler Transform ( BWTCoder )<br />

1. Definition<br />

<strong>The</strong> class BWTCoder applies the Burrows-Wheeler transform [18] (in encoding mode)<br />

or its reversal (in decoding mode) to the input stream. To be more precise, in encoding<br />

mode the input stream is partitioned in blocks and the transformation is applied to each<br />

block. <strong>The</strong> size of the blocks, i.e. the number of characters per block, can be specified by<br />

the user.<br />

This transformation does not compress the input but it can be used as a preprocessing<br />

step for other coders. Applying BWTCoder first often improves the overall compression<br />

rates. <strong>The</strong> following combinations yield very good compression results:<br />

• CoderPipe3<br />

• CoderPipe4<br />

#include < <strong>LEDA</strong>/coding/BWT.h ><br />

2. Creation<br />

BWTCoder C(streambuf ∗ src stream = 0, streambuf ∗ tgt stream = 0,<br />

bool own streams = false, uint32 block size = DefaultBlockSize);<br />

creates an instance C which uses the given source and target<br />

streams. If own streams is set, then C is responsible for the destruction<br />

of the streams, otherwise the pointers src stream and tgt stream<br />

must be valid during the life-time of C. <strong>The</strong> block size can be controlled<br />

via block size.<br />

BWTCoder<br />

C(const char ∗ src file name, const char ∗ tgt file name,<br />

uint32 block size = DefaultBlockSize);<br />

creates an instance C which uses file-streams for input and output.<br />

<strong>The</strong> block size can be controlled via block size.<br />

3. Operations<br />

Standard Operations<br />

void C.encode( ) encodes the source stream and writes the output to<br />

the target stream.<br />

void C.decode( ) decodes the source stream and writes the output to<br />

the target stream.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!