module Goban::ECC::RSInflator

Overview

Module for generating redundant Reed-Solomon error correction bits.

Extended Modules

Defined in:

goban/ecc/rsinflator.cr

Constant Summary

EXP_TABLE_2X = begin a = uninitialized ::StaticArray(UInt8, 510) 510.times do |i| a[i] = GF::EXP_TABLE[i % 255] end a end

GF::EXP_TABLE repeated twice, so that the sum of two logarithms can be looked up without taking the modulo.

GEN_POLY_LOGS = begin GEN_POLYS.map do |poly| Slice(UInt8).new(poly.size - 1) do |i| coeff = poly[i + 1] if coeff == 0 raise(InternalError.new("Zero coefficient in generator polynomial")) end GF.log(coeff) end end end

Logarithms of the coefficients of each generator polynomial except the leading one, which is always 1. The coefficients are all nonzero.

GEN_POLYS = begin a = uninitialized ::StaticArray(GFPoly, 31) a[0] = GFPoly.new(Slice[1_u8]) (1_u8..30_u8).each do |d| last_gen = a[d - 1] a[d] = last_gen.mul(Slice[1_u8, GF.exp(d - 1)]) end a end

Instance Method Summary

Instance Method Detail

def inflate_codewords(codewords : Slice(UInt8), version : QR::Version | RMQR::Version, ecl : Level) #

[View source]
def inflate_codewords(codewords : Slice(UInt8), version : MQR::Version, ecl : Level) #

[View source]