I have a data stream with following properties:
- Binary
- Dynamic length
- Comes in blocks of 20 bits
- Any random bits may flip creating an error (there isn't more probability that adjacent bits to flip together)
- I would like to use around 16 bits as data and 4 for redundancy per block, but I am open to change that number
- The probability that a bit is correct is around 97%
- Ideally, the code would be able to correct 2 bits per block
- The amount of blocks will be rather small, usually 1-6.
What would be a good code to use in this scenario? I thought of Reed-Solomon, but according to this article it would be a poor choice:
if a data stream is not characterized by error bursts or drop-outs but by random single bit errors,
a Reed-Solomon code is usually a poor choice. More effective codes are available for this case.
I've also looked into Bossen's b-adjacent algorithm, but it seems to be designed taking into account that adjacent bit-flips have higher probability of happening.
Modeling your errors as binomial, let's see what happens if you correct a single error:
The probability of 0 or 1 errors is $$q=(1-p)^{20}+20(1-p)^{19}p$$ which is approximately $0.88$ for $p=0.03,$ so your coded probability of error while correcting one error is $0.12$.
The probability of error with no coding is $1-(1-p)^{20}$ which is around $0.456$ so you do get quite an improvement if you use coding.
According to this paper here given $r\geq 3,$ and $2^{r-1}+1\leq n\leq 2^r-1,$ there is an $[n,n-r,3]$ shortened Hamming code with some nice double error detection properties. When $n=20,$ this gives $r=5,$ so you have a $[n,n-r,3]=[20,15,3]$ single error correcting shortened Hamming code and you can transmit $k=15$ bits per block of length $n=20.$