kopia lustrzana https://github.com/rs1729/RS
ecc: RS(15,9) encode
rodzic
7d8383221e
commit
456108ea15
|
@ -846,7 +846,7 @@ int rs_encode(ui8_t cw[]) {
|
||||||
for (j = RS.R; j < RS.N; j++) __cw[j] = cw[j];
|
for (j = RS.R; j < RS.N; j++) __cw[j] = cw[j];
|
||||||
poly_divmod(__cw, RS.g, d, parity);
|
poly_divmod(__cw, RS.g, d, parity);
|
||||||
//if (poly_deg(parity) >= RS.R) return -1;
|
//if (poly_deg(parity) >= RS.R) return -1;
|
||||||
for (j = 0; j <= poly_deg(parity); j++) cw[j] = parity[j];
|
for (j = 0; j < RS.R; j++) cw[j] = parity[j];
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ int main(int argc, char *argv[]) {
|
||||||
for (i = 0; i < errors; i++) printf(" %d", errpos[i]);
|
for (i = 0; i < errors; i++) printf(" %d", errpos[i]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
for (i = 0; i < rs_N; i++) printf("%1X", codeword[i]); printf("\n");
|
for (i = 0; i < rs_N; i++) printf("%1x", codeword[i]); printf("\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -218,9 +218,9 @@ RS(15,9):
|
||||||
message length 9
|
message length 9
|
||||||
parity length 6
|
parity length 6
|
||||||
|
|
||||||
./ecc-rs15 str1 [str2]
|
./ecc-rs15 msg [par]
|
||||||
str1: 9 nibbles (msg)
|
msg: 9 nibbles
|
||||||
str2: 6 nibbles (par)
|
par: 6 nibbles
|
||||||
|
|
||||||
ecc-rs15 input/output: nibbles
|
ecc-rs15 input/output: nibbles
|
||||||
cw[]: 1 byte / 1 nibble
|
cw[]: 1 byte / 1 nibble
|
||||||
|
@ -228,7 +228,7 @@ cw[]: 1 byte / 1 nibble
|
||||||
|
|
||||||
examples:
|
examples:
|
||||||
|
|
||||||
$./ecc-rs15 000000001
|
$ ./ecc-rs15 000000001
|
||||||
|
|
||||||
msg: 000000001
|
msg: 000000001
|
||||||
|
|
||||||
|
@ -243,8 +243,7 @@ parity : 1af243
|
||||||
codeword:
|
codeword:
|
||||||
1000000001af243
|
1000000001af243
|
||||||
|
|
||||||
|
$ ./ecc-rs15 000000001 342FA1
|
||||||
$./ecc-rs15 000000001 342FA1
|
|
||||||
|
|
||||||
msg: 000000001
|
msg: 000000001
|
||||||
par: 342FA1
|
par: 342FA1
|
||||||
|
@ -255,7 +254,7 @@ errs: 0
|
||||||
|
|
||||||
codeword
|
codeword
|
||||||
errors: 0
|
errors: 0
|
||||||
1000000001AF243
|
1000000001af243
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue