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

Encode the given 16 data bits into a 64-bit codeword

Try to decode the given 24-bit word to the nearest codeword, correcting up to 3 errors and detecting 4 errors

Encode the given 12 data bits into a 24-bit codeword

Try to decode the given 18-bit word to the nearest codeword, correcting up to 3 errors

Encode the given 6 data bits into a 18-bit codeword

Try to decode the given 23-bit word to the nearest codeword, correcting up to 3 errors and detecting 4 errors

Encode the given 12 data bits into a 23-bit codeword

Try to decode the given 10-bit word to the nearest codeword, correcting up to 1 bit error

Encode the given 6 data bits into a 10-bit codeword

Try to decode the given 15-bit word to the nearest codeword, correcting up to 1 bit error

Encode the given 11 data bits into a 15-bit codeword

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()}.
Encode the given 16 data bits into a 64-bit codeword
Link to this function

golay_extended_decode(Data)

View Source

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.
Link to this function

golay_extended_encode(Data)

View Source

Specs

golay_extended_encode(Data :: pos_integer()) -> {ok, Encoded :: pos_integer()}.
Encode the given 12 data bits into a 24-bit codeword
Link to this function

golay_shortened_decode(Data)

View Source

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.
Link to this function

golay_shortened_encode(Data)

View Source

Specs

golay_shortened_encode(Data :: pos_integer()) -> {ok, Encoded :: pos_integer()}.
Encode the given 6 data bits into a 18-bit codeword
Link to this function

golay_standard_decode(Data)

View Source

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.
Link to this function

golay_standard_encode(Data)

View Source

Specs

golay_standard_encode(Data :: pos_integer()) -> {ok, Encoded :: pos_integer()}.
Encode the given 12 data bits into a 23-bit codeword
Link to this function

hamming_shortened_decode(Data)

View Source

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.
Link to this function

hamming_shortened_encode(Data)

View Source

Specs

hamming_shortened_encode(Data :: pos_integer()) -> {ok, Encoded :: pos_integer()}.
Encode the given 6 data bits into a 10-bit codeword
Link to this function

hamming_standard_decode(Data)

View Source

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.
Link to this function

hamming_standard_encode(Data)

View Source

Specs

hamming_standard_encode(Data :: pos_integer()) -> {ok, Encoded :: pos_integer()}.
Encode the given 11 data bits into a 15-bit codeword