Chapter 3. Usage

Table of Contents

Initializing
Encoding
Decoding
Decoding with syndrome calculation, direct data correction
Decoding with syndrome given by hardware decoder, direct data correction
Decoding with syndrome given by hardware decoder, no direct data correction.
Cleanup

This chapter provides examples how to use the library.

Initializing

The init function init_rs returns a pointer to a rs decoder structure, which holds the necessary information for encoding, decoding and error correction with the given polynomial. It either uses an existing matching decoder or creates a new one. On creation all the lookup tables for fast en/decoding are created. The function may take a while, so make sure not to call it in critical code paths.

/* the Reed Solomon control structure */
static struct rs_control *rs_decoder;

/* Symbolsize is 10 (bits)
 * Primitve polynomial is x^10+x^3+1
 * first consecutive root is 0
 * primitve element to generate roots = 1
 * generator polinomial degree (number of roots) = 6
 */
rs_decoder = init_rs (10, 0x409, 0, 1, 6);