From d6cdb6be34787ed65f2f1d09ea3b6ac139b2d3fb Mon Sep 17 00:00:00 2001 From: drowe67 Date: Thu, 20 Oct 2016 04:36:31 +0000 Subject: [PATCH] adjusted byte<->bit ordering to match python TX code git-svn-id: https://svn.code.sf.net/p/freetel/code@2892 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2-dev/src/drs232_ldpc.c | 22 +++++++++++++--------- codec2-dev/src/mpdecode_core.c | 1 + 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/codec2-dev/src/drs232_ldpc.c b/codec2-dev/src/drs232_ldpc.c index 9328430c..0ea06610 100755 --- a/codec2-dev/src/drs232_ldpc.c +++ b/codec2-dev/src/drs232_ldpc.c @@ -62,7 +62,7 @@ /* packet parameters */ -#define UW_BYTES 2 +#define UW_BYTES 4 #define UW_BITS 40 #define UW_ALLOWED_ERRORS 5 #define BYTES_PER_PACKET 256 @@ -117,13 +117,15 @@ int main(int argc, char *argv[]) { int CodeLength; struct LDPC ldpc; + assert(sizeof(uw) == UW_BITS); + /* LDPC parameters */ CodeLength = CODELENGTH; /* length of entire codeword in bits */ /* set up LDPC code from include file constants */ - ldpc.max_iter = 100; + ldpc.max_iter = MAX_ITER; ldpc.dec_type = 0; ldpc.q_scale_factor = 1; ldpc.r_scale_factor = 1; @@ -177,6 +179,7 @@ int main(int argc, char *argv[]) { bit = symbol < 0; //printf("symbol; %f bit: %d\n", symbol, bit); + next_state = state; if (state == LOOK_FOR_UW) { /* put latest input bit into sliding buffer */ @@ -199,7 +202,7 @@ int main(int argc, char *argv[]) { //fprintf(stderr,"UW score: %d\n", score); if (score >= (UW_BITS-UW_ALLOWED_ERRORS)) { - //fprintf(stderr,"UW found!\n"); + //fprintf(stderr,"UW found! score: %d\n verbose: %d\n", score, verbose); ind = 0; next_state = COLLECT_PACKET; } @@ -210,15 +213,16 @@ int main(int argc, char *argv[]) { if (ind == SYMBOLS_PER_PACKET) { - /* OK we have enough bits, remove RS232 sync symbols */ + /* OK we have enough bits, remove RS232 sync symbols. + This is set up for bit<->byte ordering as per python + tx code */ for(i=0,k=0; i