Tuesday, May 7, 2013
Reed-Solomon Forward Error Correction for Android/Java
A few days ago I was scouring the internet looking for a java library that did forward error correction for a project at work, but I couldn't find anything for java that didn't rely on JNI classes.
Finally I came across some classes that are part of the ZXing project that did some Reed-Solomon encoding and decoding, so I wrote a wrapper class around them to do all the dirty work.
I figured I'd contribute it back to the masses, so here it is:
https://code.google.com/p/reed-solomon-android/
Here's an example of how to use it:
https://code.google.com/p/reed-solomon-android/wiki/ExampleUsage
It's only limitation is that it can only encode data in chunks of 256 bytes.
The two second version of Reed-Solomon forward error correction is you give it your data and it generates error correction codes which get appended to the end of your data. You send your data through a lossy connection (RF link in my case) and the decoder can use those error correction codes to fix bit errors in your data on the receiving end (up to a point). The more error correction bytes you use, the more errors in your data (and in the codes themselves) can be tolerated and still successfully recover your data.
Reed-Solomon coding of some form is used in a lot of commercial technologies like CD's, DVD's, deep space communications (Voyager!), etc. Check it out on Wikipedia, it's good stuff.
The library I created allows you to specify how many error correction bytes you'd like to use (the more the better), so long as the size of your data + the number of error correction bytes is less than or equal to 256 bytes.
Subscribe to:
Post Comments (Atom)
hi can you help me please, i don´t see the wrapper that you said in the first link.
ReplyDeletei am a NON expert in java, and really need a helping hand to do this...
can you send to me the library and a complete example, i really apreciated man