<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968" /><title>Decoding</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="Reed-Solomon Library Programming Interface" /><link rel="up" href="ch03.html" title="Chapter 3. Usage" /><link rel="prev" href="ch03s02.html" title="Encoding" /><link rel="next" href="ch03s04.html" title="Cleanup" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Decoding</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s02.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Usage</th><td width="20%" align="right"> <a accesskey="n" href="ch03s04.html">Next</a></td></tr></table><hr /></div><div class="sect1" title="Decoding"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id3027652"></a>Decoding</h2></div></div></div><div class="toc"><dl><dt><span class="sect2"><a href="ch03s03.html#id3027686"> Decoding with syndrome calculation, direct data correction </a></span></dt><dt><span class="sect2"><a href="ch03s03.html#id3027704"> Decoding with syndrome given by hardware decoder, direct data correction </a></span></dt><dt><span class="sect2"><a href="ch03s03.html#id3027723"> Decoding with syndrome given by hardware decoder, no direct data correction. </a></span></dt></dl></div><p> The decoder calculates the syndrome over the given data length and the received parity symbols and corrects errors in the data. </p><p> If a syndrome is available from a hardware decoder then the syndrome calculation is skipped. </p><p> The correction of the data buffer can be suppressed by providing a correction pattern buffer and an error location buffer to the decoder. The decoder stores the calculated error location and the correction bitmask in the given buffers. This is useful for hardware decoders which use a weird bit ordering scheme. </p><p> The databytes are expanded to the given symbol size on the fly. There is no support for decoding continuous bitstreams with a symbolsize != 8 at the moment. If it is necessary it should be not a big deal to implement such functionality. </p><div class="sect2" title="Decoding with syndrome calculation, direct data correction"><div class="titlepage"><div><div><h3 class="title"><a id="id3027686"></a> Decoding with syndrome calculation, direct data correction </h3></div></div></div><pre class="programlisting"> /* Parity buffer. Size = number of roots */ uint16_t par[6]; uint8_t data[512]; int numerr; /* Receive data */ ..... /* Receive parity */ ..... /* Decode 512 byte in data8.*/ numerr = decode_rs8 (rs_decoder, data8, par, 512, NULL, 0, NULL, 0, NULL); </pre></div><div class="sect2" title="Decoding with syndrome given by hardware decoder, direct data correction"><div class="titlepage"><div><div><h3 class="title"><a id="id3027704"></a> Decoding with syndrome given by hardware decoder, direct data correction </h3></div></div></div><pre class="programlisting"> /* Parity buffer. Size = number of roots */ uint16_t par[6], syn[6]; uint8_t data[512]; int numerr; /* Receive data */ ..... /* Receive parity */ ..... /* Get syndrome from hardware decoder */ ..... /* Decode 512 byte in data8.*/ numerr = decode_rs8 (rs_decoder, data8, par, 512, syn, 0, NULL, 0, NULL); </pre></div><div class="sect2" title="Decoding with syndrome given by hardware decoder, no direct data correction."><div class="titlepage"><div><div><h3 class="title"><a id="id3027723"></a> Decoding with syndrome given by hardware decoder, no direct data correction. </h3></div></div></div><p> Note: It's not necessary to give data and received parity to the decoder. </p><pre class="programlisting"> /* Parity buffer. Size = number of roots */ uint16_t par[6], syn[6], corr[8]; uint8_t data[512]; int numerr, errpos[8]; /* Receive data */ ..... /* Receive parity */ ..... /* Get syndrome from hardware decoder */ ..... /* Decode 512 byte in data8.*/ numerr = decode_rs8 (rs_decoder, NULL, NULL, 512, syn, 0, errpos, 0, corr); for (i = 0; i < numerr; i++) { do_error_correction_in_your_buffer(errpos[i], corr[i]); } </pre></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Encoding </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Cleanup</td></tr></table></div></body></html>