Reed-Solomon code over GF(256) with the polynomial 0x11d and lengths which are defined at runtime. The generator roots are alpha^fcr to alpha^(fcr+ecc-1): fcr = 0 is used by ggwave (Mike Lubinets' library) and IL2P, fcr = 1 by FX.25. The parity bytes follow the message, the first byte is the highest power (like Phil Karn's library).
More...
#include <ReedSolomon.h>
|
| static void | encode (const uint8_t *msg, int len, int ecc, uint8_t *out, int fcr=0) |
| static bool | decode (uint8_t *data, int len, int ecc, int fcr=0) |
| static int | correct (uint8_t *data, int len, int ecc, int fcr=0) |
|
| static constexpr int | MAX_LEN = 255 |
| | max length of message + parity
|
| static constexpr int | MAX_ECC = 64 |
|
| static const Tables & | tables () |
| static uint8_t | mul (uint8_t a, uint8_t b) |
| static uint8_t | div (uint8_t a, uint8_t b) |
| static uint8_t | pow2 (int power) |
| | alpha^power (power 0 - 255)
|
| static uint8_t | powOf (uint8_t x, int power) |
| static uint8_t | eval (const uint8_t *poly, int n, uint8_t x) |
| | Evaluates a polynomial with ascending powers.
|
| static void | generator (int ecc, uint8_t *gen, int fcr) |
| | Generator polynomial (descending powers) with ecc + 1 coefficients.
|
| static bool | syndromes (const uint8_t *data, int n, int ecc, uint8_t *synd, int fcr) |
Reed-Solomon code over GF(256) with the polynomial 0x11d and lengths which are defined at runtime. The generator roots are alpha^fcr to alpha^(fcr+ecc-1): fcr = 0 is used by ggwave (Mike Lubinets' library) and IL2P, fcr = 1 by FX.25. The parity bytes follow the message, the first byte is the highest power (like Phil Karn's library).
- Copyright
- GPLv3
◆ correct()
| int tinymodem::RSCodec::correct |
( |
uint8_t * | data, |
|
|
int | len, |
|
|
int | ecc, |
|
|
int | fcr = 0 ) |
|
inlinestatic |
Corrects up to ecc / 2 wrong bytes of the len + ecc bytes in place: returns the number of corrected bytes or -1 if the data can't be corrected
◆ decode()
| bool tinymodem::RSCodec::decode |
( |
uint8_t * | data, |
|
|
int | len, |
|
|
int | ecc, |
|
|
int | fcr = 0 ) |
|
inlinestatic |
Corrects up to ecc / 2 wrong bytes of the len + ecc bytes in place: returns false if the data can't be corrected
◆ div()
| uint8_t tinymodem::RSCodec::div |
( |
uint8_t | a, |
|
|
uint8_t | b ) |
|
inlinestaticprotected |
◆ encode()
| void tinymodem::RSCodec::encode |
( |
const uint8_t * | msg, |
|
|
int | len, |
|
|
int | ecc, |
|
|
uint8_t * | out, |
|
|
int | fcr = 0 ) |
|
inlinestatic |
Writes the message followed by ecc parity bytes (at most MAX_ECC, len + ecc <= MAX_LEN) to out
◆ eval()
| uint8_t tinymodem::RSCodec::eval |
( |
const uint8_t * | poly, |
|
|
int | n, |
|
|
uint8_t | x ) |
|
inlinestaticprotected |
Evaluates a polynomial with ascending powers.
◆ generator()
| void tinymodem::RSCodec::generator |
( |
int | ecc, |
|
|
uint8_t * | gen, |
|
|
int | fcr ) |
|
inlinestaticprotected |
Generator polynomial (descending powers) with ecc + 1 coefficients.
◆ mul()
| uint8_t tinymodem::RSCodec::mul |
( |
uint8_t | a, |
|
|
uint8_t | b ) |
|
inlinestaticprotected |
◆ pow2()
| uint8_t tinymodem::RSCodec::pow2 |
( |
int | power | ) |
|
|
inlinestaticprotected |
alpha^power (power 0 - 255)
◆ powOf()
| uint8_t tinymodem::RSCodec::powOf |
( |
uint8_t | x, |
|
|
int | power ) |
|
inlinestaticprotected |
◆ syndromes()
| bool tinymodem::RSCodec::syndromes |
( |
const uint8_t * | data, |
|
|
int | n, |
|
|
int | ecc, |
|
|
uint8_t * | synd, |
|
|
int | fcr ) |
|
inlinestaticprotected |
Calculates the syndromes (data[0] is the highest power): returns true if there are errors
◆ tables()
| const Tables & tinymodem::RSCodec::tables |
( |
| ) |
|
|
inlinestaticprotected |
◆ MAX_ECC
| int tinymodem::RSCodec::MAX_ECC = 64 |
|
staticconstexpr |
max number of parity bytes (FX.25: 64, ggwave: 56): limits the stack usage
◆ MAX_LEN
| int tinymodem::RSCodec::MAX_LEN = 255 |
|
staticconstexpr |
max length of message + parity
The documentation for this class was generated from the following file: