From: drowe67 Date: Fri, 16 Sep 2016 07:06:43 +0000 (+0000) Subject: refactored ldpcdec to have smaller ldpc code include file, and a simpler interface X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=6dfa55b307e4b454fa6f26f3cd37836383354a94;p=freetel-svn-tracking.git refactored ldpcdec to have smaller ldpc code include file, and a simpler interface git-svn-id: https://svn.code.sf.net/p/freetel/code@2867 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/src/mpdecode_core.c b/codec2-dev/src/mpdecode_core.c index 746bc5ff..f193b62c 100644 --- a/codec2-dev/src/mpdecode_core.c +++ b/codec2-dev/src/mpdecode_core.c @@ -12,6 +12,9 @@ #include #include "mpdecode_core.h" +void extract_output(char out_char[], int DecodedBits[], int ParityCheckCount[], + int max_iter, int CodeLength, int NumberParityBits); + /* Phi function */ static float phi0( float x ) @@ -559,7 +562,7 @@ void SumProduct( int BitErrors[], /* Convenience function to call LDPC decoder from C programs */ -void run_ldpc_decoder(struct LDPC *ldpc, int DecodedBits[], int ParityCheckCount[], double input[]) { +void run_ldpc_decoder(struct LDPC *ldpc, char out_char[], double input[]) { int max_iter, dec_type; float q_scale_factor, r_scale_factor; int max_row_weight, max_col_weight; @@ -579,6 +582,9 @@ void run_ldpc_decoder(struct LDPC *ldpc, int DecodedBits[], int ParityCheckCount NumberParityBits = ldpc->NumberParityBits; NumberRowsHcols = ldpc->NumberRowsHcols; + int *DecodedBits = calloc( max_iter*CodeLength, sizeof( int ) ); + int *ParityCheckCount = calloc( max_iter, sizeof(int) ); + /* derive some parameters */ shift = (NumberParityBits + NumberRowsHcols) - CodeLength; @@ -627,8 +633,12 @@ void run_ldpc_decoder(struct LDPC *ldpc, int DecodedBits[], int ParityCheckCount NumberParityBits, max_iter, r_scale_factor, q_scale_factor, data_int ); } + extract_output(out_char, DecodedBits, ParityCheckCount, max_iter, CodeLength, NumberParityBits); + /* Clean up memory */ + free(ParityCheckCount); + free(DecodedBits); free( data_int ); /* Cleaning c-node elements */ @@ -688,3 +698,30 @@ void sd_to_llr(double llr[], double sd[], int n) { for(i=0; i