added iter display with -v
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 20 Oct 2016 05:21:15 +0000 (05:21 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 20 Oct 2016 05:21:15 +0000 (05:21 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2893 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/src/drs232_ldpc.c
codec2-dev/src/mpdecode_core.c
codec2-dev/src/mpdecode_core.h

index 0ea066104681ae6beeff31a72f6d87f6336a3f95..40bb7061fe1045284ed7bee7e9a390846d74e3d5 100755 (executable)
@@ -114,7 +114,7 @@ int main(int argc, char *argv[]) {
     uint8_t     packet[BYTES_PER_PACKET+CRC_BYTES];
     uint8_t     abyte;
     uint16_t    tx_checksum, rx_checksum, packet_errors, packets;
-    int         CodeLength;
+    int         CodeLength, iter;
     struct LDPC ldpc;
 
     assert(sizeof(uw) == UW_BITS);
@@ -227,7 +227,7 @@ int main(int argc, char *argv[]) {
                /* now LDPC decode */
 
                sd_to_llr(llr, symbol_buf_no_rs232, CodeLength);
-               run_ldpc_decoder(&ldpc, unpacked_packet, llr);
+               iter = run_ldpc_decoder(&ldpc, unpacked_packet, llr);
 
                /* pack into bytes */
 
@@ -258,9 +258,9 @@ int main(int argc, char *argv[]) {
                    packet_errors++;
 
                if (verbose) {
-                   fprintf(stderr, "packets: %d packet_errors: %d PER: %4.3f\n", 
+                   fprintf(stderr, "packets: %d packet_errors: %d PER: %4.3f iter: %d\n", 
                            packets, packet_errors, 
-                           (float)packet_errors/packets);
+                           (float)packet_errors/packets, iter);
                }
                //exit(0);
                next_state = LOOK_FOR_UW;
index 815c6085a205d64a6f4ed82cfe6ff1208cfa8d89..a42f03bb95bd700bda47832df7a6433ad7b38a75 100644 (file)
@@ -12,7 +12,7 @@
 #include <stdio.h>
 #include "mpdecode_core.h"
 
-void extract_output(char out_char[], int DecodedBits[], int ParityCheckCount[], 
+int extract_output(char out_char[], int DecodedBits[], int ParityCheckCount[], 
                     int max_iter, int CodeLength, int NumberParityBits);
 
 /* Phi function */
@@ -562,7 +562,7 @@ void SumProduct(     int      BitErrors[],
 
 /* Convenience function to call LDPC decoder from C programs */
 
-void run_ldpc_decoder(struct LDPC *ldpc, char out_char[], double input[]) {
+int 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;
@@ -633,7 +633,7 @@ void run_ldpc_decoder(struct LDPC *ldpc, char out_char[], double input[]) {
                     NumberParityBits, max_iter, r_scale_factor, q_scale_factor, data_int ); 
     }
 
-    extract_output(out_char, DecodedBits, ParityCheckCount, max_iter, CodeLength, NumberParityBits);
+    int iter = extract_output(out_char, DecodedBits, ParityCheckCount, max_iter, CodeLength, NumberParityBits);
 
     /* Clean up memory */
 
@@ -662,6 +662,8 @@ void run_ldpc_decoder(struct LDPC *ldpc, char out_char[], double input[]) {
        
     /* printf( "Cleaning v-nodes \n" ); */
     free( v_nodes );
+
+    return iter;
 }
 
 
@@ -700,7 +702,7 @@ void sd_to_llr(double llr[], double sd[], int n) {
 }
 
 
-void extract_output(char out_char[], int DecodedBits[], int ParityCheckCount[], int max_iter, int CodeLength, int NumberParityBits) {
+int extract_output(char out_char[], int DecodedBits[], int ParityCheckCount[], int max_iter, int CodeLength, int NumberParityBits) {
     int i, j;
 
     /* extract output bits from iteration that solved all parity
@@ -724,5 +726,6 @@ void extract_output(char out_char[], int DecodedBits[], int ParityCheckCount[],
         }
     }
     //fprintf(stderr, "iter: %d\n", iter);
+    return iter;
 }
 
index e665a9220db962edce0d9471d80abeb1ae5394f3..bbb6250fadf1cba682ffdf8711dc1cbb396090e9 100644 (file)
@@ -25,7 +25,7 @@ struct LDPC {
     double *H_cols;
 };
 
-void run_ldpc_decoder(struct LDPC *ldpc, char out_char[], double input[]);
+int run_ldpc_decoder(struct LDPC *ldpc, char out_char[], double input[]);
 
 void sd_to_llr(double llr[], double sd[], int n);