erlcode (erlcode v0.1.0) View Source
API for various coding schemes with Rust NIF as the backend.
Exposes:
golay_extended_encode
golay_extended_decode
golay_standard_encode
golay_standard_decode
golay_shortened_encode
golay_shortened_decode
bch_encode
bch_decode
hamming_standard_encode
hamming_standard_decode
hamming_shortened_encode
hamming_shortened_decode
Link to this section Summary
Functions
Try to decode the given 64-bit word to the nearest codeword, correcting up to 11 bit errors
Try to decode the given 24-bit word to the nearest codeword, correcting up to 3 errors and detecting 4 errors
Try to decode the given 18-bit word to the nearest codeword, correcting up to 3 errors
Try to decode the given 23-bit word to the nearest codeword, correcting up to 3 errors and detecting 4 errors
Try to decode the given 10-bit word to the nearest codeword, correcting up to 1 bit error
Try to decode the given 15-bit word to the nearest codeword, correcting up to 1 bit error
Link to this section Functions
Specs
bch_decode(Data :: pos_integer()) -> {ok, {Decoded :: pos_integer(), Corrupted :: non_neg_integer()}} | {error, {unrecoverable, non_neg_integer()}}.
Try to decode the given 64-bit word to the nearest codeword, correcting up to 11 bit errors
If decoding was successful, return{ok, (data, err)}
, where data
is the 16 data bits and err
is the number of corrected bits. Otherwise, return {error, {unrecoverable, data}}
to indicate an unrecoverable error.
Specs
bch_encode(Data :: pos_integer()) -> {ok, Encoded :: pos_integer()}.
Specs
golay_extended_decode(Data :: pos_integer()) -> {ok, {Decoded :: pos_integer(), Corrupted :: non_neg_integer()}} | {error, {unrecoverable, non_neg_integer()}}.
Try to decode the given 24-bit word to the nearest codeword, correcting up to 3 errors and detecting 4 errors
If decoding was successful, return{ok, (data, err)}
, where data
is the 12 data bits and err
is the number of corrected bits. Otherwise, return {error, {unrecoverable, data}}
to indicate an unrecoverable error.
Specs
golay_extended_encode(Data :: pos_integer()) -> {ok, Encoded :: pos_integer()}.
Specs
golay_shortened_decode(Data :: pos_integer()) -> {ok, {Decoded :: pos_integer(), Corrupted :: non_neg_integer()}} | {error, {unrecoverable, non_neg_integer()}}.
Try to decode the given 18-bit word to the nearest codeword, correcting up to 3 errors
If decoding was successful, return{ok, (data, err)}
, where data
is the 6 data bits and err
is the number of corrected bits. Otherwise, return {error, {unrecoverable, data}}
to indicate an unrecoverable error.
Specs
golay_shortened_encode(Data :: pos_integer()) -> {ok, Encoded :: pos_integer()}.
Specs
golay_standard_decode(Data :: pos_integer()) -> {ok, {Decoded :: pos_integer(), Corrupted :: non_neg_integer()}} | {error, {unrecoverable, non_neg_integer()}}.
Try to decode the given 23-bit word to the nearest codeword, correcting up to 3 errors and detecting 4 errors
If decoding was successful, return{ok, (data, err)}
, where data
is the 12 data bits and err
is the number of corrected bits. Otherwise, return {error, {unrecoverable, data}}
to indicate an unrecoverable error.
Specs
golay_standard_encode(Data :: pos_integer()) -> {ok, Encoded :: pos_integer()}.
Specs
hamming_shortened_decode(Data :: pos_integer()) -> {ok, {Decoded :: pos_integer(), Corrupted :: non_neg_integer()}} | {error, {unrecoverable, non_neg_integer()}}.
Try to decode the given 10-bit word to the nearest codeword, correcting up to 1 bit error
If decoding was successful, return{ok, (data, err)}
, where data
is the 6 data bits and err
is the number of corrected bits. Otherwise, return {error, {unrecoverable, data}}
to indicate an unrecoverable error.
Specs
hamming_shortened_encode(Data :: pos_integer()) -> {ok, Encoded :: pos_integer()}.
Specs
hamming_standard_decode(Data :: pos_integer()) -> {ok, {Decoded :: pos_integer(), Corrupted :: non_neg_integer()}} | {error, {unrecoverable, non_neg_integer()}}.
Try to decode the given 15-bit word to the nearest codeword, correcting up to 1 bit error
If decoding was successful, return{ok, (data, err)}
, where data
is the 11 data bits and err
is the number of corrected bits. Otherwise, return {error, {unrecoverable, data}}
to indicate an unrecoverable error.
Specs
hamming_standard_encode(Data :: pos_integer()) -> {ok, Encoded :: pos_integer()}.