From 290b34c99cc1734d2a4f0780ebfb5714c76578f3 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Mon, 5 Feb 2024 16:25:51 -0500 Subject: [PATCH] WIP on rst8. --- lib/superfox/Makefile | 13 +++++++++++-- lib/superfox/sfoxtest.f90 | 10 ++++++---- lib/superfox/wrap_rs_8.c | 14 ++++++++++++++ 3 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 lib/superfox/wrap_rs_8.c diff --git a/lib/superfox/Makefile b/lib/superfox/Makefile index 7cacd12ad..a9bf9b593 100644 --- a/lib/superfox/Makefile +++ b/lib/superfox/Makefile @@ -15,7 +15,7 @@ CFLAGS= -O9 -Wall %.o: %.F90 ${FC} ${FFLAGS} -c $< -all: rs_sf.a rstest rs_125_49 +all: rs_sf.a rstest rs_125_49 rst8 OBJS1 = rstest.o ran1.o rs_sf.a rstest: $(OBJS1) @@ -25,7 +25,11 @@ OBJS2 = rs_125_49.o ran1.o get_crc14.o rs_sf.a rs_125_49: $(OBJS2) $(FC) -o rs_125_49 $(OBJS2) rs_sf.a -rs_sf.a: init_rs_sf.o encode_rs_sf.o decode_rs_sf.o rs_sf.o +#OBJS3 = rst8.o encode_rs_8.o decode_rs_8.o wrap_rs_8.o +rst8: rst8.o wrap_rs_8.o + $(FC) -o rst8 rst8.o wrap_rs_8.o librs.a + +rs_sf.a: init_rs_sf.o encode_rs_sf.o decode_rs_sf.o rs_sf.o ar -crs rs_sf.a init_rs_sf.o encode_rs_sf.o decode_rs_sf.o rs_sf.o init_rs_sf.o: init_rs.c @@ -35,6 +39,11 @@ encode_rs_sf.o: encode_rs.c decode_rs_sf.o: decode_rs.c gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $^ +encode_rs_8.o: encode_rs.c + gcc -DFIXED=1 $(CFLAGS) -c -o $@ $^ +decode_rs_8.o: decode_rs.c + gcc -DFIXED=1 $(CFLAGS) -c -o $@ $^ + .PHONY : clean clean: -rm -f *.o *.a *.exe diff --git a/lib/superfox/sfoxtest.f90 b/lib/superfox/sfoxtest.f90 index 6de819f5b..648bb08f3 100644 --- a/lib/superfox/sfoxtest.f90 +++ b/lib/superfox/sfoxtest.f90 @@ -77,6 +77,7 @@ program sfoxtest ngoodsync=0 ngood=0 ntot=0 + nworst=0 do ifile=1,nfiles xnoise=0. @@ -123,6 +124,7 @@ program sfoxtest nharderr=count(jdat.ne.idat) !Count hard errors ntot=ntot+nharderr + nworst=max(nworst,nharderr) if(snrdb.ne.0) then fname='000000_000001.wav' @@ -147,11 +149,11 @@ program sfoxtest fgoodsync=float(ngoodsync)/nfiles fgood=float(ngood)/nfiles if(isnr.eq.0) write(*,1300) -1300 format(' SNR N fsync fgood'/ & - '----------------------------') +1300 format(' SNR N fsync fgood averr worst'/ & + '-----------------------------------------') ave_harderr=float(ntot)/nfiles - write(*,1310) snr,nfiles,fgoodsync,fgood,ave_harderr -1310 format(f7.2,i6,2f7.2,f7.1) + write(*,1310) snr,nfiles,fgoodsync,fgood,ave_harderr,nworst +1310 format(f7.2,i6,2f7.2,f7.1,i6) if(snrdb.ne.0.0) exit if(fgoodsync.lt.0.5) exit enddo ! isnr diff --git a/lib/superfox/wrap_rs_8.c b/lib/superfox/wrap_rs_8.c new file mode 100644 index 000000000..9cd8f0a1f --- /dev/null +++ b/lib/superfox/wrap_rs_8.c @@ -0,0 +1,14 @@ +#include + +void encode_rs_8_(unsigned char data[], unsigned char parity[], int *npad) +{ + encode_rs_8(data,parity,*npad); //Compute the parity symbols +} + + +int decode_rs_8_(unsigned char *data, int *era_pos, int *numera, int *npad) +{ + int nerr; + nerr=decode_rs_8(data,era_pos,*numera,*npad); + return nerr; +}