### QRazyBox Help

## Reed-Solomon Decoder

Reed-Solomon error correction is the error correcting codes that used widely in two-dimensional barcode, including QR code. It allows to correct reading when some of the data is damaged or unreadable.
This is the most essential tool of QRazyBox, since our recovery method is very dependent on Reed-Solomon.
This tool implements all type of correction process (also known as Reed-Solomon decoding).

#### Error and Erasure Correction

There are three types of correction that used by Reed-Solomon codes: Error correction, Erasure correction and both of Error and Erasure correction.
Error correction is type of correction where the errors location are unknown, whereas Erasure correction is type of correction where the errors location are known.
Using Error correction, we can correct errors up to half of the number of ECC symbol (Reed-Solomon blocks) and correct errors as many as the number of ECC symbol with Erasure correction. Therefore, Error correction become twice as strong when the error location is known.
Thus, according to that fact, when we know position of the errors, the capability to restore the data of each ECC level can be doubled.
See the following table to see the difference.

Error Correction Level | % of data that can be restored
--- | ---
Without Erasure Correction | With Erasure Correction
Level L | ± 7% | ± 14%
Level M | ± 15% | ± 30%
Level Q | ± 25% | ± 50%
Level H | ± 30% | ± 60%

However, normal QR code scanner doesn't have erasure correction feature, since it difficult to recognize the error locations of QR code automatically and may resulting in slower scan.

#### Example of Reed-Solomon in General

Before using this tool, it is better to know how Reed-Solomon works generally. Take a look at the following simple example.

Suppose we will encode text "HELLO WORLD" to Reed-Solomon block.

Convert the text to decimal value :
72,69,76,76,79,32,87,79,82,76,68

Encode with Reed-Solomon using 11 ECC symbol :
72,69,76,76,79,32,87,79,82,76,68,123,80,185,183,114,194,10,36,93,160,102

Now, that we have the encoded Reed-Solomon block, we will try to calculate the correction possiblity in various damaged states.

According to the ECC symbol that being used to encode (in this case the number of ECC symbol is 11), we can correct up to 2*e+n <= 11, where e is number of error and n is number of erasure.
Suppose x as error and ? as erasure

72,69,x,x,x,x,87,79,82,76,68,123,80,185,183,114,194,10,36,93,160,102 (4 errors) =  8 <= 11 CORRECTABLE

72,69,x,x,x,x,87,79,82,76,68,123,80,185,183,114,x,x,x,93,160,102 (7 errors) =  14 <= 11 UNCORRECTABLE

72,69,?,?,?,?,87,79,82,76,68,123,80,185,183,114,194,10,36,93,160,102 (4 erasures) =  4 <= 11 CORRECTABLE

72,69,?,?,?,?,87,79,82,76,68,123,80,185,183,114,?,?,?,93,160,102 (7 erasures) =  7 <= 11 CORRECTABLE

?,?,?,?,?,?,87,?,?,76,68,123,80,185,183,114,?,?,?,?,160,102 (12 erasures) =  12 <= 11 UNCORRECTABLE

72,69,x,x,x,x,87,79,82,76,68,123,80,185,183,114,?,?,?,93,160,102 (4 errors & 3 erasures) =  11 <= 11 CORRECTABLE

#### Basic Usage

When you use Reed-Solomon Decoder, you will be prompted by dialog. There will be total 2 page of dialog, for input and output. Although, this tool will input the Reed-Solomon blocks automatically, but you can edit and enter manually if you want to.
You also don't have to input number of ECC symbol and even the error position/location, since this tool will automatically detect from the QR code that you already drawn before (zero values of Reed-Solomon blocks will be treated as error position).

Keep in mind, that Reed-Solomon block can also consist more than one on a larger QR code.
The second page of the dialog will display output such as decoded Reed-Solomon blocks and the final message from QR code.

Jump to examples section to see the further details about using Reed-Solomon Decoder.