From ae462a9cb8bb31073620113220fba082ce9baa11 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Fri, 2 Feb 2024 13:22:42 -0500 Subject: [PATCH] More code cleanup. --- lib/superfox/rs_sf.c | 53 ++++++++++++++++++++--------------------- lib/superfox/rstest.f90 | 6 +++-- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/lib/superfox/rs_sf.c b/lib/superfox/rs_sf.c index 97e0acbd1..4bb9528a2 100644 --- a/lib/superfox/rs_sf.c +++ b/lib/superfox/rs_sf.c @@ -6,49 +6,48 @@ static int first=1; static int nn,kk,nroots,npad; void rs_init_sf_(int *mm, int *nq, int *nn0, int *kk0, int *nfz) +// Initialize the RS decoder. { + // Save parameters nn, kk, nroots, npad for global access nn=*nn0; kk=*kk0; nroots=nn-kk; npad=*nq-1-nn; - if(*mm==6) rs_sf=init_rs_sf(*mm,0x43,*nfz,1,nroots,npad); //M=6 - if(*mm==7) rs_sf=init_rs_sf(*mm,0x89,*nfz,1,nroots,npad); //M=7 - if(*mm==8) rs_sf=init_rs_sf(*mm,0x11d,*nfz,1,nroots,npad); //M=8 + + int gfpoly=0x43; //For *mm=6 + if(*mm==7) gfpoly=0x89; + if(*mm==8) gfpoly=0x11d; + rs_sf=init_rs_sf(*mm,gfpoly,*nfz,1,nroots,npad); first=0; } void rs_encode_sf_(int *dgen, int *sent) - // Encode JT65 data dgen[...], producing sent[...]. +// Encode the information symbols dgen[KK], producing channel symbols sent[NN]. { - int dat1[256]; - int b[256]; - int i; + int b[256]; //These are the parity symbols + encode_rs_sf(rs_sf,dgen,b); //Compute the parity symbols - for(i=0; i