Closed vinnitu closed 5 years ago
I'm not sure what you mean by rs(10,6). I mixed it myself sometimes, in the following I mean RS(N,N-R)=RS(code_len,msg_len). I have an example for RS(15,9), i.e. the codewords have length 15, the message is length 9, parity 6 (can correct up to 3 errors). Actually I never used GF(2^4), but since 4 bit is a nibble, I thought it would be useful some day. However the rs_encode() function, which I used for testing RS-255, was not prepared for GF(16). (In RS-255 it is always N==MAX_DEG+1.) I updated bch_ecc.c so it can be used with the test-example ecc-rs_gf16.c. I didn't test it much, though I included the possibility to compare with ka9q's fec-lib (the polynomial/byte-order is reversed). The input and output are nibbles, but the polynomials have each nibble in one byte as coefficients. So if you want to pack the codeword (2 nibbles in 1 byte), you should consider this.
You can choose some parameters for the Reed-Solomon code, don't know if CCSDS specifies parameters for GF(16)-Reed-Solomon?
So with 15 nibble codewords and 9 nibble message length, if you want to shorten the 15 nibbles to 10, take 4 nibble messages (+ 5 nibbles padding with 0), and 6 nibble parity. [If you would take message length 6, you would have parity length 9 (is not even, 2*4.5?), so only 1 nibble from the message could go into length 10, unless you shorten your parity nibbles (puncturing).]
You can choose some parameters for the Reed-Solomon code, don't know if CCSDS specifies parameters for GF(16)-Reed-Solomon?
Look here on page 63: https://public.ccsds.org/Pubs/732x0b3e1.pdf
To explain the example (here N=rs_N, R=rs_R, K=rs_K=N-R): init RS(15,9) by rs_init_RS15(). Your codeword will be stored in ui8_t cw[N]. If you have a message of K nibbles, you put them into the upper K bytes of cw[], cw[R,...,N-1] (and clear cw[0,...,R-1], where R=N-K is the number of parity nibbles (R=2t and up to t errors can be corrected). Then rs_encode(cw) will give you the parity nibbles in the first R entries and cw[] should be a valid codeword. If you want to shorten to 10 nibbles, you zero out 5 nibbles of the message and don't transmit them.
[CCSDS ... GF(16)-Reed-Solomon?] Look here on page 63: https://public.ccsds.org/Pubs/732x0b3e1.pdf
Ah, ok, I understand, it is supposed to correct up to 2 errors, i.e. t=2 and (10,6)=(15-5,11-5), and also b=6 for the generator polynomial. Needs a little modification (initialization), maybe I modify. If you have matching encoder/decoder, it doesn't matter, but if other people shall be able to decode, some test vectors could be helpful to make sure we are talking about the same parameters.
I updated/changed the example and init to RS(15,11), can correct up to 2 errors. The generator polynomial (b=6) is now:
RS(255,32)-CCSDS has some additional parameter, so I hope I didn't miss anything. If you have test codewords, it could tested.
Hello!
Can you show example usage rs_encode for GF16RS I CCSDS used rs(10,6) shortned code for primary header protection
Thanks!