From 4449a0d3afbf11380924ef0db2ac352da45adcba Mon Sep 17 00:00:00 2001 From: drowe67 Date: Tue, 19 Mar 2013 22:26:32 +0000 Subject: [PATCH] more accurate error meas in high BER channels git-svn-id: https://svn.code.sf.net/p/freetel/code@1216 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2-dev/src/fdmdv_put_test_bits.c | 48 ++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/codec2-dev/src/fdmdv_put_test_bits.c b/codec2-dev/src/fdmdv_put_test_bits.c index b1b3ee6f..3b8bf7bc 100644 --- a/codec2-dev/src/fdmdv_put_test_bits.c +++ b/codec2-dev/src/fdmdv_put_test_bits.c @@ -44,11 +44,12 @@ int main(int argc, char *argv[]) int *rx_bits; int i, bit, byte; int test_frame_sync, bit_errors, total_bit_errors, total_bits, ntest_bits; + int test_frame_sync_state, test_frame_count; int bits_per_fdmdv_frame; int bits_per_codec_frame; int bytes_per_codec_frame; int Nc; - int *error_pattern; + short *error_pattern; if (argc < 2) { printf("usage: %s InputBitFile [Nc]\n", argv[0]); @@ -96,6 +97,8 @@ int main(int argc, char *argv[]) total_bit_errors = 0; total_bits = 0; + test_frame_sync_state = 0; + test_frame_count = 0; while(fread(packed_bits, sizeof(char), bytes_per_codec_frame, fin) == bytes_per_codec_frame) { /* unpack bits, MSB first */ @@ -113,18 +116,45 @@ int main(int argc, char *argv[]) assert(byte == bytes_per_codec_frame); fdmdv_put_test_bits(fdmdv, &test_frame_sync, error_pattern, &bit_errors, &ntest_bits, rx_bits); + if (test_frame_sync == 1) { - total_bit_errors += bit_errors; - total_bits = total_bits + ntest_bits; - printf("+"); + test_frame_sync_state = 1; + test_frame_count = 0; + } + + if (test_frame_sync_state) { + if (test_frame_count == 0) { + total_bit_errors += bit_errors; + total_bits = total_bits + ntest_bits; + printf("+"); + } + else + printf("-"); + test_frame_count++; + if (test_frame_count == 4) + test_frame_count = 0; } - else - printf("-"); + else + printf("-"); + fdmdv_put_test_bits(fdmdv, &test_frame_sync, error_pattern, &bit_errors, &ntest_bits, &rx_bits[bits_per_fdmdv_frame]); + if (test_frame_sync == 1) { - total_bit_errors += bit_errors; - total_bits = total_bits + ntest_bits; - printf("+"); + test_frame_sync_state = 1; + test_frame_count = 0; + } + + if (test_frame_sync_state) { + if (test_frame_count == 0) { + total_bit_errors += bit_errors; + total_bits = total_bits + ntest_bits; + printf("+"); + } + else + printf("-"); + test_frame_count++; + if (test_frame_count == 4) + test_frame_count = 0; } else printf("-"); -- 2.25.1