ecc: RS(15,9) encode

pull/11/head
me 2019-02-05 10:09:30 +01:00
rodzic 7d8383221e
commit 456108ea15
2 zmienionych plików z 8 dodań i 9 usunięć

Wyświetl plik

@ -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;
} }

Wyświetl plik

@ -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
*/ */