# From Iris Image to Embedded Code: System of Methods
## 8 Error Correction Cascade
### Block Coding
Then the probability of obtaining a certain code \(C\) from zero code is \(p^{b(C)}(1-p)^{n-\beta(C)}\), where \(\beta(C)\equiv\rho(0,C)\) is number of unit bits in \(C\), and  
\[P_{corr}=\sum_{C}p(0|C)p^{\beta(C)}(1-p)^{n-\beta(C)}\, \tag{43}\]  
where \(p(0|C)\) is the likelihood to obtain zero code from \(C\). Define the set of attractors for string \(C\) as code table entries with minimal distance to the code:  
\[ \begin{split}& A(C)=\left\{C^{\prime}\in\mathbb{C}:\rho(C^{\prime},C) =\rho_{\min}(C)\right\}\,,\\ &\rho_{\min}(C)=\min_{C^{\prime}\in\mathbb{C}}\rho(C,C^{\prime}) \.\end{split}  \tag{44}\]  
Define the cardinality of this set as \(\alpha=|A(C)|\) and state that \(\alpha=0\) if there is another code table entry more close to \(C\) then the correct code: \(\exists C^{\prime}\in\mathbb{C},C^{\prime}\
eq C^{*}:\rho(C^{\prime},C)<\rho(C ^{*},C)\). Then we can write  
\[p(0|C)= \begin{cases}0\,\ \ \alpha=0\,\\ 1/\alpha\,\ \ \alpha\
eq 0\.\end{cases}  \tag{45}\]  
For small values of \(n\) all points of code space \(\mathbb{B}^{n}\) can be enumerated and their distribution by distance to zero \(\beta\) and attractor number \(\alpha\) can be estimated:  
\[ \begin{split}& H(\tilde{\beta},\tilde{\alpha})=\left|\{C:0\in A (C),|\alpha(C)|=\tilde{\alpha}\,\ \ \beta(C)=\tilde{\beta}\}\right|\,\\ &\tilde{\beta}\in[0;n]\,\ \ \tilde{\alpha}\in[1;2^{k}]\.\end{split}  \tag{46}\]  
Substituting to (43) we get:  
\[P_{corr}=\sum_{\alpha\
eq 0}\sum_{\beta}\frac{H(\beta,\alpha)}{\alpha}p^{\beta} (1-p)^{n-\beta}=\sum_{\beta}p^{\beta}(1-p)^{n-\beta}\sum_{\alpha\
eq 0}\frac{H( \beta,\alpha)}{\alpha} \tag{47}\]  
and decoding error  
\[p_{H}=1-P_{corr}=1-(1-p)^{n}\sum_{\beta}h(\beta)\left(\frac{p}{1-p}\right)^{ \beta}\,\ \ h(\beta)=\sum_{\alpha\
eq 0}\frac{H(\beta,\alpha)}{\alpha}. \tag{48}\]  
The formula is the same as (40) except for the coefficients and summation limits. The values of \(h(\beta)\) for the augmented Hadamard code of order \(5\) (\(n=2^{5}-1=31\), \(k=5+1=6\)) are given in Table 6. All meaningful values are given, and values for other \(\alpha\) and \(\beta\) are zero. For instance, if the code is distorted in 12 bits or more, it will be never recovered to the correct value, since there will be another valid code from the code table, closer to distorted value. Up to values \(\beta=7\) only one attractor is chosen, i.e., at this or less divergence the message is definitely recovered. This corresponds to Hamming boundary (40). However, even with larger divergences, up to \(\beta=11\) there is a significant probability of correct recovery. This plays a big role since the majority of distorted codes fall outside of Hamming boundary but still have the significant probability to restore the message correctly. Thus, the probability (40) is overestimated. For example, for the considered code and error \(p=0.250\), the formula (40) gives \(p_{H}=0.527\), which would seem to prevent using such a code. However, the calculation using the formula (48) gives \(p_{H}=0.261\), which is fairly suitable for use in the next step of coder. The Hadamard coding parameter is only the word length \(k\). The size of the codeword \(n\) is dependent: \(n=2^{k-1}\) for the augmented variant.