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);
/* 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 */
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;
#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 */
/* 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;
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 */
/* printf( "Cleaning v-nodes \n" ); */
free( v_nodes );
+
+ return iter;
}
}
-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
}
}
//fprintf(stderr, "iter: %d\n", iter);
+ return iter;
}