spectrum and waterfall working on analog pass through
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 23 Jun 2015 07:30:19 +0000 (07:30 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 23 Jun 2015 07:30:19 +0000 (07:30 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2213 01035d8c-6547-0410-b346-abe4f91aad63

fdmdv2-dev/README.txt
fdmdv2-dev/src/fdmdv2_main.cpp

index 54bf87ea792979d415d4a45544300606eb35f42a..ea5a5c88a005c17dc3503c720bbc87011d27f70f 100644 (file)
@@ -8,7 +8,7 @@ Quickstart 1
 Builds static versions of wxWidgets, portaudio, codec2-dev, which are commonly
 missing on many Linux systems, or of the wrong (older) version.
 
-1/ Assuming the freedv-dev sources is checked out into ~/fdmdv2-dev:
+1/ Assuming the fdmdv2-dev source is checked out into ~/fdmdv2-dev:
 
   $ sudo apt-get install libgtk2.0-dev libhamlib-dev libsamplerate-dev libasound2-dev libao-dev
   $ cd fdmdv2-dev
@@ -19,7 +19,7 @@ missing on many Linux systems, or of the wrong (older) version.
 
 2/ Then you can configure FreeDV using your local codec-dev, something like:
 
-  $ cmake -DCMAKE_BUILD_TYPE=Debug -DBOOTSTRAP_WXWIDGETS=TRUE -DCODEC2_INCLUDE_DIRS=/home/david/codec2-dev/src -DCODEC2_LIBRARY=/home/david/codec2-dev/build_linux/src/libcodec2.so -DUSE_STATIC_CODEC2=FALSE -DUSE_STATIC_PORTAUDIO=TRUE -DUSE_STATIC_SOX=TRUE ../
+  $ cmake -DCMAKE_BUILD_TYPE=Debug -DBOOTSTRAP_WXWIDGETS=TRUE -DCODEC2_INCLUDE_DIRS=/path/to/codec2-dev/src -DCODEC2_LIBRARY=/path/to/codec2-dev/build_linux/src/libcodec2.so -DUSE_STATIC_CODEC2=FALSE -DUSE_STATIC_PORTAUDIO=TRUE -DUSE_STATIC_SOX=TRUE ../
 
 3/ OR build a local copy of codec2-dev:
 
@@ -171,24 +171,40 @@ TODO
         [ ] normalise output pwr across modes?
             + or maybe peak output?
             + option?
-    [ ] test mode
-        [ ] get error patterns working again, both 700 and 1600
-        [ ] how to plot error histogram
+    [ ] test frames 
+        [X] freedv API support
+        [X] BER displayed on GUI for 700 and 1600
+        [ ] plot error patterns for 700 and 1600
+        [ ] plot error histograms for 700 and 1600
     [X] file sample replay at 7500Hz work OK?
     [X] interp 7500 to 8k for spectrum plotting
     [X] rotation of scatter diagram on FreeDV 700
     [X] freq track plot
 
+[ ] Mel Bugs
+    [X] resync issue
+    [X] equalise power on 700 and 1600
+    [X] research real and complex PAPR
+    [ ] Squelch control on 1600 mode will not open up squelch to 0  (appears to be around 2 dB)
+    [ ] waterfall and spectrum in analog mode
+    [ ] On TX, intermittently PTT will cause signal to be heard in speakers.  Toggle PTT or 
+        Stop/Start toggle and then starts working.
+    [ ] There is a .dll missing otherwise FreeDV will not excite.  We tested it on xp, win7, 8, 8.1 and 10.   
+        Needs ilbusb0.dll  the 32bit one on all releases. 
+    [ ] The waterfall in analog mode appears to quit working sometimes?
+    [ ] I am not sure the "checksum" is still working when enabled (1600 mode)
+
 [ ] FreeDV 700 improvements
     [ ] bpf filter after clipping to remove clicks
         [ ] tcohpsk first, measure PAPR, impl loss
     [ ] error masking
     [ ] plotting other demod stats like ch ampl and phase ests
 
-[ ] win32 X-compile
-    [ ] installer
-    [ ] works
+[ ] win32
+    [X] X-compile works
+    [X] basic installer
+    [ ] 
+
 [ ] Small fixes
     [X] Playfile bug
     [X] running again
@@ -198,9 +214,8 @@ TODO
     [X] default squelch 2dB
     [ ] cmd line file decode
     [ ] Waterfall direction
-    [ ] test mode on 1600 with freedv api
-        + maybe calc stats, hist
     [ ] documenttation or use, walk through,you tube, blog posts
+    [ ] scatter diagram agc with hysteresis
 
 [ ] Web support for Presence/spotting hooks
 
index e31209ef0732dff79ef75b0b657cdd69d21302e2..1356faa6d2b08c64ea952076b5c14741e34cadb6 100644 (file)
@@ -124,6 +124,7 @@ SpeexPreprocessState *g_speex_st;
 // WxWidgets - initialize the application
 IMPLEMENT_APP(MainApp);
 
+//FILE *ft;
 FILE *g_logfile;
 
 //-------------------------------------------------------------------------
@@ -168,6 +169,9 @@ bool MainApp::OnInit()
     frame->Show();
     g_parent =frame;
 
+    //ft = fopen("tmp.raw","wb");
+    //assert(ft != NULL);
+
     return true;
 }
 
@@ -506,6 +510,7 @@ MainFrame::~MainFrame()
     int w;
     int h;
 
+    //fclose(ft);
     #ifdef __WXMSW__
     fclose(g_logfile);
     #endif
@@ -888,7 +893,7 @@ void MainFrame::OnTimer(wxTimerEvent &evt)
     if (snr_limited > 20.0) snr_limited = 20.0;
 
     char snr[15];
-    sprintf(snr, "%d", (int)(snr_limited+0.5)); // round to nearest dB
+    sprintf(snr, "%d", (int)(g_snr+0.5)); // round to nearest dB
 
     //printf("snr_est: %f m_snrBeta: %f g_snr: %f snr_limited: %f\n", g_stats.snr_est,  m_snrBeta, g_snr, snr_limited);
 
@@ -1983,12 +1988,14 @@ void MainFrame::OnTogBtnOnOff(wxCommandEvent& event)
             g_Nc = 14;
         }
    
-       // init freedv states
+        // init freedv states
 
         g_pfreedv = freedv_open(g_mode);
         g_pfreedv->callback_state = NULL;
         g_pfreedv->freedv_get_next_tx_char = &my_get_next_tx_char;
         g_pfreedv->freedv_put_next_rx_char = &my_put_next_rx_char;
+        //if (g_mode == FREEDV_MODE_700)
+        //    cohpsk_set_verbose(g_pfreedv->cohpsk, 1);
 
         //cohpsk_set_verbose(g_pfreedv->cohpsk, 1);
         assert(g_pfreedv != NULL);
@@ -1999,13 +2006,6 @@ void MainFrame::OnTogBtnOnOff(wxCommandEvent& event)
 
         g_speex_st = speex_preprocess_state_init(g_pfreedv->n_speech_samples, FS); 
 
-#ifdef TODO
-        g_sz_error_pattern = fdmdv_error_pattern_size(g_pfreedv->fdmdv);
-        g_error_pattern = (short*)malloc(g_sz_error_pattern*sizeof(short));
-
-        assert(g_error_pattern != NULL);
-
-#endif
         // adjust spectrum and waterfall freq scaling base on mode
 
         m_panelSpectrum->setFreqScale(MODEM_STATS_NSPEC*((float)MAX_F_HZ/(g_pfreedv->modem_sample_rate/2)));
@@ -2922,20 +2922,38 @@ void txRxProcessing()
 
         resample_for_plot(g_plotDemodInFifo, in8k_short, n8k, samplerate);
 
-        // Get some audio to send to headphones/speaker.  If out of
-        // sync or in analog mode we pass thru the "from radio" audio
-        // to the headphones/speaker.  When out of sync it's useful to
-        // hear the audio from the channel, e.g. as a tuning aid
-        
+        // Get some audio to send to headphones/speaker.  If in analog
+        // mode we pass thru the "from radio" audio to the
+        // headphones/speaker.
+
         if (g_analog) {
             memcpy(out8k_short, in8k_short, sizeof(short)*n8k);
+            
+            // compute rx spectrum 
+
+            COMP  rx_fdm[n8k];
+            float rx_spec[MODEM_STATS_NSPEC];
+            unsigned int   i;
+
+            for(i=0; i<n8k; i++) {
+                rx_fdm[i].real = in8k_short[i];
+                rx_fdm[i].imag = 0.0;
+            }            
+            modem_stats_get_rx_spectrum(&g_stats, rx_spec, rx_fdm, n8k);
+
+            // Average rx spectrum data using a simple IIR low pass filter
+
+            for(i = 0; i<MODEM_STATS_NSPEC; i++) {
+                g_avmag[i] = BETA * g_avmag[i] + (1.0 - BETA) * rx_spec[i];
+            }
         }
         else {
             fifo_write(cbData->rxinfifo, in8k_short, n8k);
             per_frame_rx_processing(cbData->rxoutfifo, cbData->rxinfifo);
             memset(out8k_short, 0, sizeof(short)*N8);
             fifo_read(cbData->rxoutfifo, out8k_short, N8);
-        }
+       }
+
 
         // Optional Spk Out EQ Filtering, need mutex as filter can change at run time
         g_mutexProtectingCallbackData.Lock();
@@ -3185,6 +3203,7 @@ void per_frame_rx_processing(
         assert(nin <= g_pfreedv->n_max_modem_samples);
 
         nin_prev = nin;
+        //fwrite(input_buf, sizeof(short), nin, ft);
 
         // demod per frame processing
         for(i=0; i<nin; i++)
@@ -3194,6 +3213,7 @@ void per_frame_rx_processing(
         }
        
         // only implemented for FreeDV 1600 at this stage
+
         if (g_channel_noise && FREEDV_MODE_1600) {
             fdmdv_simulate_channel(g_pfreedv->fdmdv, rx_fdm, nin, 2.0);
         }
@@ -3205,33 +3225,25 @@ void per_frame_rx_processing(
         nin = freedv_nin(g_pfreedv);
         g_State = g_pfreedv->sync;
 
-        // compute rx spectrum & get demod stats, and update GUI plot data
+        // compute rx spectrum 
 
         modem_stats_get_rx_spectrum(&g_stats, rx_spec, rx_fdm, nin_prev);
+        // Average rx spectrum data using a simple IIR low pass filter
+
+        for(i = 0; i<MODEM_STATS_NSPEC; i++) {
+            g_avmag[i] = BETA * g_avmag[i] + (1.0 - BETA) * rx_spec[i];
+        }
+
         if (g_pfreedv->mode == FREEDV_MODE_1600)
             fdmdv_get_demod_stats(g_pfreedv->fdmdv, &g_stats);
         if (g_pfreedv->mode == FREEDV_MODE_700)
             cohpsk_get_demod_stats(g_pfreedv->cohpsk, &g_stats);
 
-        // Average rx spectrum data using a simple IIR low pass filter
-        for(i = 0; i < MODEM_STATS_NSPEC; i++)
-        {
-            g_avmag[i] = BETA * g_avmag[i] + (1.0 - BETA) * rx_spec[i];
-        }
-
     }
 }
 
 
-#ifdef TODO
-                    if (n_ascii) {
-                        short ashort = ascii_out;
-                        fifo_write(g_rxDataOutFifo, &ashort, 1);
-                    }
-#endif
-
-
-
 //-------------------------------------------------------------------------
 // txCallback()
 //-------------------------------------------------------------------------