cohpsk scatter diagram rotation and freq offset stats
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 18 Jun 2015 03:02:19 +0000 (03:02 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 18 Jun 2015 03:02:19 +0000 (03:02 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2206 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/src/cohpsk.c
codec2-dev/unittest/vqtrainsp.c

index 4c3231e402a02bd97d56bc48504a5f46612c3f9c..c8ed48df79f95cb54cd6f083734e41701dc93f60 100644 (file)
@@ -1105,13 +1105,17 @@ int cohpsk_fs_offset(COMP out[], COMP in[], int n, float sample_rate_ppm)
 void cohpsk_get_demod_stats(struct COHPSK *coh, struct MODEM_STATS *stats)
 {
     int   c,r;
+    COMP  pi_4;
+
+    pi_4.real = cosf(M_PI/4.0);
+    pi_4.imag = sinf(M_PI/4.0);
 
     stats->Nc = COHPSK_NC*ND;
     assert(stats->Nc <= MODEM_STATS_NC_MAX);
     stats->snr_est = 20*log10((coh->sig_rms+1E-6)/(coh->noise_rms+1E-6)) - 10*log10(3000.0/700.0);
     //fprintf(stderr, "sig_rms: %f noise_rms: %f snr_est: %f\n", coh->sig_rms, coh->noise_rms, stats->snr_est);
     stats->sync = coh->sync;
-    stats->foff = coh->f_est;
+    stats->foff = coh->f_est - FDMDV_FCENTRE;
     stats->rx_timing = coh->rx_timing;
     stats->clock_offset = 0.0; /* TODO - implement clock offset estimation */
 
@@ -1119,7 +1123,7 @@ void cohpsk_get_demod_stats(struct COHPSK *coh, struct MODEM_STATS *stats)
     stats->nr = NSYMROW;
     for(c=0; c<COHPSK_NC*ND; c++) {
         for (r=0; r<NSYMROW; r++) {
-            stats->rx_symbols[r][c] = coh->rx_symb[r][c];
+            stats->rx_symbols[r][c] = cmult(coh->rx_symb[r][c], pi_4);
         }
     }
 }
index f68d882830e401785f9f2d30a333bd8e1f1ad5f8..551280bd4552171362a8cd91b6b2247e27c8d39c 100644 (file)
@@ -118,7 +118,7 @@ int main(int argc, char *argv[]) {
     cb = (float*)malloc(sizeof(float)*d*e);
     cent = (float*)malloc(sizeof(float)*d*e);
     n = (int*)malloc(sizeof(int)*d*e);
-    if (cb == NULL || cb == NULL || cent == NULL || vec == NULL) {
+    if (vec == NULL || cb == NULL || cent == NULL || n == NULL) {
        printf("Error in malloc.\n");
        exit(1);
     }