normalised tx power across modes
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 8 Mar 2013 23:59:51 +0000 (23:59 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 8 Mar 2013 23:59:51 +0000 (23:59 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@1204 01035d8c-6547-0410-b346-abe4f91aad63

fdmdv2/src/fdmdv2_main.cpp

index 017e702cfead5c90ed9be70e757d6abc64af1085..34aebb195ff81a024d423fd466fef3183895df33 100644 (file)
@@ -39,6 +39,7 @@ int                 g_mode;
 struct CODEC2      *g_pCodec2;
 struct FDMDV       *g_pFDMDV;
 struct FDMDV_STATS  g_stats;
+float               g_pwr_scale;
 
 // test Frames
 int                 g_testFrames;
@@ -1611,6 +1612,11 @@ void MainFrame::OnTogBtnOnOff(wxCommandEvent& event)
 
         m_panelScatter->setNc(g_Nc);
 
+        // scale factor for to normalise ouput power across modes
+        // note: PAPR will still be worse for higher Nc, especially in frame test mode
+
+        g_pwr_scale = sqrt((14.0+4.0)/(g_Nc+4.0));
+
         // init Codec 2 LPC Post Filter
 
         codec2_set_lpc_post_filter(g_pCodec2, 
@@ -2779,10 +2785,12 @@ void per_frame_tx_processing(
 
     fdmdv_freq_shift(tx_fdm_offset, tx_fdm, g_TxFreqOffsetHz, &g_TxFreqOffsetPhaseRect, &g_TxFreqOffsetFreqRect, 2*FDMDV_NOM_SAMPLES_PER_FRAME);
 
-    /* scale and convert shorts, normalise depeding on Nc so all modes have same tx pwr */
+    /* compute scale factor to normalise tx power for all modes */
+
+    /* scale and convert shorts */
 
     for(i=0; i<2*FDMDV_NOM_SAMPLES_PER_FRAME; i++)
-        tx_fdm_scaled[i] = FDMDV_SCALE * ((float)FDMDV_NC/g_stats.Nc)*tx_fdm_offset[i].real;
+        tx_fdm_scaled[i] = FDMDV_SCALE * g_pwr_scale * tx_fdm_offset[i].real;
 
 }