quiet / libcorrect

C library for Convolutional codes and Reed-Solomon

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

decode_rs_char() should return int

zhangboyang opened this issue · comments

According to documention of libfec:

The decode_ functions correct the errors in a Reed-Solomon codeword of N symbols up to the capability of the code. An optional list of "erased" symbol indices may be given in the eras_pos array to assist the decoder; this parameter may be NULL if no erasures are given. The number of erased symbols must be given in the no_eras parameter.

The decoder corrects the symbols "in place", returning the number of symbols in error. If the codeword is uncorrectable, -1 is returned and the data block is unchanged. If eras_pos is non-null, it is used to return a list of corrected symbol positions, in no particular order. This means that the array passed through this parameter must have at least nroots elements to prevent a possible buffer overflow.

The decode_ functions return a count of corrected
symbols, or -1 if the block was uncorrectible.

However, in the compatibility layer, decode_rs_char() returns void, and there is no return value in erasure_locations.

Thanks for the report. The shim is built for compatibility with https://github.com/jgaeddert/liquid-dsp so it doesn't do everything exactly right. I've avoided taking bits from libfec's source so that this project could operate cleanly from an IP perspective. Now that you've reported this, I'll look into fixing it.