\BaconQrCode\CommonReedSolomonCodec

Reed-Solomon codec for 8-bit characters.

Based on libfec by Phil Karn, KA9Q.

Summary

Methods
Properties
Constants
__construct()
encode()
decode()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
modNn()
$symbolSize
$blockSize
$firstRoot
$primitive
$iPrimitive
$numRoots
$padding
$alphaTo
$indexOf
$generatorPoly
N/A

Properties

$symbolSize

$symbolSize : int

Symbol size in bits.

Type

int

$blockSize

$blockSize : int

Block size in symbols.

Type

int

$firstRoot

$firstRoot : int

First root of RS code generator polynomial, index form.

Type

int

$primitive

$primitive : int

Primitive element to generate polynomial roots, index form.

Type

int

$iPrimitive

$iPrimitive : int

Prim-th root of 1, index form.

Type

int

$numRoots

$numRoots : int

RS code generator polynomial degree (number of roots).

Type

int

$padding

$padding : int

Padding bytes at front of shortened block.

Type

int

$alphaTo

$alphaTo : \SplFixedArray

Log lookup table.

Type

\SplFixedArray —

$indexOf

$indexOf : \SplFixedArray

Anti-Log lookup table.

Type

\SplFixedArray —

$generatorPoly

$generatorPoly : \SplFixedArray

Generator polynomial.

Type

\SplFixedArray —

Methods

__construct()

__construct(int  $symbolSize, int  $gfPoly, int  $firstRoot, int  $primitive, int  $numRoots, int  $padding) : mixed

Parameters

int $symbolSize
int $gfPoly
int $firstRoot
int $primitive
int $numRoots
int $padding

Throws

\BaconQrCode\Exception\InvalidArgumentException

if symbol size ist not between 0 and 8

\BaconQrCode\Exception\InvalidArgumentException

if first root is invalid

\BaconQrCode\Exception\InvalidArgumentException

if num roots is invalid

\BaconQrCode\Exception\InvalidArgumentException

if padding is invalid

\BaconQrCode\Exception\RuntimeException

if field generator polynomial is not primitive

Returns

mixed —

encode()

encode(\SplFixedArray  $data, \SplFixedArray  $parity) : void

Encodes data and writes result back into parity array.

Parameters

\SplFixedArray $data
\SplFixedArray $parity

decode()

decode(\SplFixedArray  $data, \SplFixedArray  $erasures = null) : ?int

Decodes received data.

Parameters

\SplFixedArray $data
\SplFixedArray $erasures

Returns

?int —

modNn()

modNn(int  $x) : int

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

Parameters

int $x

Returns

int —