Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated correction symbols do not match those ones of MATLAB #66

Closed
DmitryYenkov opened this issue Jul 5, 2023 · 5 comments
Closed

Comments

@DmitryYenkov
Copy link

image
image

prim=285 is the same, as the length and number of correction symbols.
Why is the difference?
How can I get same result?

@lrq3000
Copy link
Collaborator

lrq3000 commented Jul 8, 2023

Try with fcr=1, it's often an implicitly hardcoded value in most implementations of Reed-Solomon that most developers aren't aware of. In our implementation, fcr is set to 0 by default, but often it is set to 1 by mistake in other implementations (it's essentially at which iteration you start encoding/decoding, and since MATLAB is 1 indexed, they may have mistakenly started at 1). But fcr can also be another value especially if they followed US military standards.

I would suggest you try this function here to autodetect the parameters by providing the message without the ecc, and then the message with ecc symbols (ie, the input and output of what you fed/received from matlab rs codec), and the algo should tell you what are the adequate parameters.

@DmitryYenkov
Copy link
Author

Thanks! It works.
I tried 5 or 6 different implementations of RS encoder from github and none of them give the same result as MATLAB.

@lrq3000
Copy link
Collaborator

lrq3000 commented Jul 10, 2023 via email

@DmitryYenkov
Copy link
Author

DmitryYenkov commented Jul 12, 2023

With fcr=1.

In MATLAB there is a function for creation of generator polynomial for RS-code - rsgenpoly.
By default it gives thefollowing output:

rsgenpoly(255, 239, prim_poly)
ans = GF(2^8) array. Primitive polynomial = D^8+D^4+D^3+D^2+1 (285 decimal)
Array elements =
1 118 52 103 31 104 126 187 232 17 56 183 49 100 81 44 79

But I guess with fcr=0 this polynom is different. I extracted one from this github project:
https://github.com/raeudigerRaeffi/generalizedReedSolomon/tree/master

And it looks like this:
1, 59, 13, 104, 189, 68, 209, 30, 8, 163, 65, 41, 229, 98, 50, 36, 59

So, here is a comparation. 1st output is default to MATLAB, 2nd is with poly (1,59,13,...) and 3rd is with (1,118,52,...) poly
image
Correction symbols only.

@lrq3000
Copy link
Collaborator

lrq3000 commented Jul 15, 2023

Thank you very much for your feedback!

I’m reopening this issue to remind myself to add the autodetection script in reedsolo directly so that it will be easier for others to find the adequate parameters for messages encoded by arbitrary RS codecs, and also to document better the interoperability with MATLAB (a common RS codec).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants