klauspost / reedsolomon

Reed-Solomon Erasure Coding in Go
MIT License
1.86k stars 244 forks source link

Use of library for 20 data bits #83

Closed maberer closed 5 years ago

maberer commented 5 years ago

I have 20 data bits (not bytes) and a total of 60 bits that can be used for redundancy. I should be able to correct 5 errors.

How can I use this library for bits - is this even possible?

klauspost commented 5 years ago

Hi. Designing for these sizes will depend a lot on your expected failure scenario. Will bits be randomly flipped. Will some be missing, etc.

Remember that rs codes does not by itself tell you which values are correct - you need to have that information.

It seems Turbo codes or LDPC codes is more what you need.

maberer commented 5 years ago

Thank you for the answer, I will look into the alternatives to see if they better fit my needs.

By looking at the encoder example code of this library, I realized, that hashes are required if one does not know if the data is valid.... Since my data bits are extracted from the an image, I could tell, if I am unsure what its value really is (0/1) - in such a case, I would apply reconstruction... so I think an additional hash is not required in that case.

My main concern is, that it I do not seem to have strict control over the size of the generated data the library produces... (I have only 60 bits in total). So the goal is, to put an integer number (that can be represented with a maximum of 20 bits) into its total available space of 60 bits....

I basically porting over code from a legacy Java application, that seems to use a custom Galois-field with the following parameters GaloisField(2, 19, 4); where 2 = alpha, 19 = irreducible and 4 element length. The RSEncoder(5, 10) where 2 = plain, 10 = redundant is used to encode the integer. The solution is a bit array of length 60. The application claims, that it can correct 5 errors.

So would there be a chance to reproduce what the Java application does with this library?

klauspost commented 5 years ago

I don't know the library, so I can't really tell you.

Closing for now.