diff --git a/lib/fec.c b/lib/fec.c index 46eba27..4097e98 100644 --- a/lib/fec.c +++ b/lib/fec.c @@ -879,7 +879,16 @@ fec_decode(void *code0, void *pkt0[], int index[], int sz) return 0; } - +int get_n(void *code0) +{ + struct fec_parms * code= (struct fec_parms *)code0; + return code->n; +} +int get_k(void *code0) +{ + struct fec_parms * code= (struct fec_parms *)code0; + return code->k; +} /*********** end of FEC code -- beginning of test code ************/ #if (TEST || DEBUG) diff --git a/lib/fec.h b/lib/fec.h index 8d298d2..871af50 100644 --- a/lib/fec.h +++ b/lib/fec.h @@ -44,10 +44,13 @@ #define GF_SIZE ((1 << GF_BITS) - 1) /* powers of \alpha */ void fec_free(void *p) ; -void * fec_new(int k, int n) ; +void * fec_new(int k, int n) ;//n>=k void init_fec() ; void fec_encode(void *code, void *src[], void *dst, int index, int sz) ; int fec_decode(void *code, void *pkt[], int index[], int sz) ; +int get_k(void *code); +int get_n(void *codev); + /* end of file */ diff --git a/lib/rs.c b/lib/rs.c index 8b1cd46..aaf8a02 100644 --- a/lib/rs.c +++ b/lib/rs.c @@ -4,5 +4,41 @@ * Created on: Sep 14, 2017 * Author: root */ +#include "rs.h" +void rs_encode(void *code,void *data[],int size) +{ + int k=get_k(code); + int n=get_n(code); + for(int i=k;i