From 5d69a524f81f234b3fbc41d49ba18d6f6886baba Mon Sep 17 00:00:00 2001 From: jcorgan Date: Thu, 3 Aug 2006 04:51:51 +0000 Subject: Houston, we have a trunk. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@3122 221aa14e-8319-0410-a670-987f0aec2ac5 --- gnuradio-core/src/lib/reed-solomon/exercise.c | 126 ++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 gnuradio-core/src/lib/reed-solomon/exercise.c (limited to 'gnuradio-core/src/lib/reed-solomon/exercise.c') diff --git a/gnuradio-core/src/lib/reed-solomon/exercise.c b/gnuradio-core/src/lib/reed-solomon/exercise.c new file mode 100644 index 000000000..91d43e157 --- /dev/null +++ b/gnuradio-core/src/lib/reed-solomon/exercise.c @@ -0,0 +1,126 @@ +/* Exercise an RS codec a specified number of times using random + * data and error patterns + * + * Copyright 2002 Phil Karn, KA9Q + * May be used under the terms of the GNU General Public License (GPL) + */ +#define FLAG_ERASURE 1 /* Randomly flag 50% of errors as erasures */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include + +#ifdef FIXED +#include "fixed.h" +#define EXERCISE exercise_8 +#elif defined(CCSDS) +#include "fixed.h" +#include "ccsds.h" +#define EXERCISE exercise_ccsds +#elif defined(BIGSYM) +#include "int.h" +#define EXERCISE exercise_int +#else +#include "char.h" +#define EXERCISE exercise_char +#endif + +#ifdef FIXED +#define PRINTPARM printf("(255,223):"); +#elif defined(CCSDS) +#define PRINTPARM printf("CCSDS (255,223):"); +#else +#define PRINTPARM printf("(%d,%d):",rs->nn,rs->nn-rs->nroots); +#endif + +/* Exercise the RS codec passed as an argument */ +int EXERCISE( +#if !defined(CCSDS) && !defined(FIXED) +void *p, +#endif +int trials){ +#if !defined(CCSDS) && !defined(FIXED) + struct rs *rs = (struct rs *)p; +#endif + DTYPE block[NN],tblock[NN]; + int i; + int errors; + int errlocs[NN]; + int derrlocs[NROOTS]; + int derrors; + int errval,errloc; + int erasures; + int decoder_errors = 0; + + while(trials-- != 0){ + /* Test up to the error correction capacity of the code */ + for(errors=0;errors <= NROOTS/2;errors++){ + + /* Load block with random data and encode */ + for(i=0;i. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@8292 221aa14e-8319-0410-a670-987f0aec2ac5 --- gnuradio-core/src/lib/reed-solomon/exercise.c | 1 + 1 file changed, 1 insertion(+) (limited to 'gnuradio-core/src/lib/reed-solomon/exercise.c') diff --git a/gnuradio-core/src/lib/reed-solomon/exercise.c b/gnuradio-core/src/lib/reed-solomon/exercise.c index 91d43e157..1e04f618d 100644 --- a/gnuradio-core/src/lib/reed-solomon/exercise.c +++ b/gnuradio-core/src/lib/reed-solomon/exercise.c @@ -13,6 +13,7 @@ #include #include #include +#include #ifdef FIXED #include "fixed.h" -- cgit From 8abd6a443e72439f4c7e77bc0c6f5b54bb70f8e7 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 3 Aug 2011 00:12:43 -0700 Subject: rs: reasonable workaround for compiling reed-solomon under MSVC --- gnuradio-core/src/lib/reed-solomon/exercise.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'gnuradio-core/src/lib/reed-solomon/exercise.c') diff --git a/gnuradio-core/src/lib/reed-solomon/exercise.c b/gnuradio-core/src/lib/reed-solomon/exercise.c index 1e04f618d..987fe1aeb 100644 --- a/gnuradio-core/src/lib/reed-solomon/exercise.c +++ b/gnuradio-core/src/lib/reed-solomon/exercise.c @@ -13,7 +13,6 @@ #include #include #include -#include #ifdef FIXED #include "fixed.h" @@ -47,11 +46,19 @@ int trials){ #if !defined(CCSDS) && !defined(FIXED) struct rs *rs = (struct rs *)p; #endif +#if MAX_ARRAY + DTYPE block[MAX_ARRAY],tblock[MAX_ARRAY]; + int i; + int errors; + int errlocs[MAX_ARRAY]; + int derrlocs[MAX_ARRAY]; +#else DTYPE block[NN],tblock[NN]; int i; int errors; int errlocs[NN]; int derrlocs[NROOTS]; +#endif int derrors; int errval,errloc; int erasures; -- cgit From 9c853b962d73565f2980789a32f347309bcc605f Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Tue, 25 Oct 2011 14:50:14 -0400 Subject: reed-solomon: fixed the signed/unsigned warnings in the RS code. Some of these had to be done through type-casting since changing the actual data type would cause the tests to fail. make test still passes. --- gnuradio-core/src/lib/reed-solomon/exercise.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gnuradio-core/src/lib/reed-solomon/exercise.c') diff --git a/gnuradio-core/src/lib/reed-solomon/exercise.c b/gnuradio-core/src/lib/reed-solomon/exercise.c index 987fe1aeb..be3d3bd13 100644 --- a/gnuradio-core/src/lib/reed-solomon/exercise.c +++ b/gnuradio-core/src/lib/reed-solomon/exercise.c @@ -48,13 +48,13 @@ int trials){ #endif #if MAX_ARRAY DTYPE block[MAX_ARRAY],tblock[MAX_ARRAY]; - int i; + unsigned int i; int errors; int errlocs[MAX_ARRAY]; int derrlocs[MAX_ARRAY]; #else DTYPE block[NN],tblock[NN]; - int i; + unsigned int i; int errors; int errlocs[NN]; int derrlocs[NROOTS]; @@ -66,7 +66,7 @@ int trials){ while(trials-- != 0){ /* Test up to the error correction capacity of the code */ - for(errors=0;errors <= NROOTS/2;errors++){ + for(errors=0;(unsigned int)errors <= NROOTS/2;errors++){ /* Load block with random data and encode */ for(i=0;i