Documentation

ReedSolomonCodec
in package

Reed-Solomon codec for 8-bit characters.

Based on libfec by Phil Karn, KA9Q.

Table of Contents

$alphaTo  : SplFixedArray
Log lookup table.
$blockSize  : int
Block size in symbols.
$firstRoot  : int
First root of RS code generator polynomial, index form.
$generatorPoly  : SplFixedArray
Generator polynomial.
$indexOf  : SplFixedArray
Anti-Log lookup table.
$iPrimitive  : int
Prim-th root of 1, index form.
$numRoots  : int
RS code generator polynomial degree (number of roots).
$padding  : int
Padding bytes at front of shortened block.
$primitive  : int
Primitive element to generate polynomial roots, index form.
$symbolSize  : int
Symbol size in bits.
__construct()  : mixed
decode()  : int|null
Decodes received data.
encode()  : void
Encodes data and writes result back into parity array.
modNn()  : int
Computes $x % GF_SIZE, where GF_SIZE is 2**GF_BITS - 1, without a slow divide.

Properties

$firstRoot

First root of RS code generator polynomial, index form.

private int $firstRoot

$generatorPoly

Generator polynomial.

private SplFixedArray $generatorPoly

$numRoots

RS code generator polynomial degree (number of roots).

private int $numRoots

$padding

Padding bytes at front of shortened block.

private int $padding

$primitive

Primitive element to generate polynomial roots, index form.

private int $primitive

Methods

__construct()

public __construct(int $symbolSize, int $gfPoly, int $firstRoot, int $primitive, int $numRoots, int $padding) : mixed
Parameters
$symbolSize : int
$gfPoly : int
$firstRoot : int
$primitive : int
$numRoots : int
$padding : int
Tags
throws
InvalidArgumentException

if symbol size ist not between 0 and 8

throws
InvalidArgumentException

if first root is invalid

throws
InvalidArgumentException

if num roots is invalid

throws
InvalidArgumentException

if padding is invalid

throws
RuntimeException

if field generator polynomial is not primitive

Return values
mixed

decode()

Decodes received data.

public decode(SplFixedArray $data[, SplFixedArray $erasures = null ]) : int|null
Parameters
$data : SplFixedArray
$erasures : SplFixedArray = null
Return values
int|null

encode()

Encodes data and writes result back into parity array.

public encode(SplFixedArray $data, SplFixedArray $parity) : void
Parameters
$data : SplFixedArray
$parity : SplFixedArray
Return values
void

modNn()

Computes $x % GF_SIZE, where GF_SIZE is 2**GF_BITS - 1, without a slow divide.

private modNn(int $x) : int
Parameters
$x : int
Return values
int

Search results