From 1622bc90e55d709aee4b7218a9c2f5555d164e9d Mon Sep 17 00:00:00 2001
From: "A. Maitland Bottoms" <bottoms@debian.org>
Date: Sat, 17 Oct 2020 22:24:47 -0400
Subject: [PATCH 6/6] enable 2020 using freedv api not avx

If system libcodec2 provides the 2020 mode via freedv_api, use it.
No need to check for avx support in the GUI. Trust the library.
---
 src/fdmdv2_main.cpp | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/fdmdv2_main.cpp b/src/fdmdv2_main.cpp
index 12b1dfd..7c2f394 100644
--- a/src/fdmdv2_main.cpp
+++ b/src/fdmdv2_main.cpp
@@ -319,11 +319,10 @@ MainFrame::MainFrame(wxString plugInName, wxWindow *parent) : TopFrame(plugInNam
 
     wxGetApp().m_serialport = new Serialport();
 
-    // Check for AVX support in the processor.  If it's not present, 2020 won't be processed
-    // fast enough
-    checkAvxSupport();
-    if(!isAvxPresent)
-        m_rb2020->Disable();
+    // Check for mode 2020 support in codec2/freedv_api.h
+#ifndef FREEDV_MODE_2020_EN
+    m_rb2020->Disable();
+#endif
 
     tools->AppendSeparator();
     wxMenuItem* m_menuItemToolsConfigDelete;
@@ -589,8 +588,10 @@ MainFrame::MainFrame(wxString plugInName, wxWindow *parent) : TopFrame(plugInNam
     if (mode == 7)
         m_rbHorusBinary->SetValue(1);
 #endif
-    if (mode == 8 && isAvxPresent)
+#ifdef FREEDV_MODE_2020_EN
+    if (mode == 8)
         m_rb2020->SetValue(1);
+#endif
     pConfig->SetPath(wxT("/"));
 
 //    this->Connect(m_menuItemHelpUpdates->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::OnHelpCheckUpdatesUI));
@@ -2736,7 +2737,7 @@ void MainFrame::OnTogBtnOnOff(wxCommandEvent& event)
             g_modemInbufferSize = (int)(FRAME_DURATION * horus_get_Fs(g_horus));
         }
 #endif
-        if (m_rb2020->GetValue() && isAvxPresent) {
+        if (m_rb2020->GetValue()) {
             g_mode = FREEDV_MODE_2020;
             g_Nc = 31;                         /* TODO: be nice if we didn't have to hard code this, maybe API call? */
             m_panelScatter->setNc(g_Nc);
@@ -2973,8 +2974,9 @@ void MainFrame::OnTogBtnOnOff(wxCommandEvent& event)
 #ifdef __HORUS__
         m_rbHorusBinary->Enable();
 #endif
-        if(isAvxPresent)
-            m_rb2020->Enable();
+#ifdef FREEDV_MODE_2020_EN
+	m_rb2020->Enable();
+#endif
         if (m_rbPlugIn != NULL)
             m_rbPlugIn->Enable();
            
-- 
2.20.1

