diff --git a/CMakeLists.txt b/CMakeLists.txt index b3ebbef6d..21df20ae7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -163,6 +163,7 @@ set(CUSTOM_WINDOWS_INCLUDE "${CMAKE_SOURCE_DIR}/custom/windows" CACHE INTERNAL " if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") set(LINUX TRUE) + add_definitions(-DLINUX) # populate distribution name # LSB_CODENAME will hold trusty for example find_program(LSB_RELEASE_EXECUTABLE lsb_release) diff --git a/doc/img/ChAnalyzerNG_plugin_settings.png b/doc/img/ChAnalyzerNG_plugin_settings.png index f80fabcb6..f34173577 100644 Binary files a/doc/img/ChAnalyzerNG_plugin_settings.png and b/doc/img/ChAnalyzerNG_plugin_settings.png differ diff --git a/doc/img/ChAnalyzerNG_plugin_settings.xcf b/doc/img/ChAnalyzerNG_plugin_settings.xcf index 160df81b0..87c8fc5a6 100644 Binary files a/doc/img/ChAnalyzerNG_plugin_settings.xcf and b/doc/img/ChAnalyzerNG_plugin_settings.xcf differ diff --git a/plugins/channelrx/demoddatv/CMakeLists.txt b/plugins/channelrx/demoddatv/CMakeLists.txt index 318877e14..cff346a85 100644 --- a/plugins/channelrx/demoddatv/CMakeLists.txt +++ b/plugins/channelrx/demoddatv/CMakeLists.txt @@ -19,11 +19,14 @@ set(datv_SOURCES leansdr/framework.cpp leansdr/math.cpp leansdr/sdr.cpp - ldpctool/tables_handler.cpp datvdemodgui.ui datvdvbs2ldpcdialog.ui ) +set(ldpc_SOURCES + ldpctool/tables_handler.cpp +) + set(datv_HEADERS datvdemod.h datvdemodgui.h @@ -45,6 +48,9 @@ set(datv_HEADERS leansdr/framework.h leansdr/math.h leansdr/sdr.h +) + +set(ldpc_HEADERS ldpctool/ldpc.h ldpctool/dvb_s2_tables.h ldpctool/dvb_s2x_tables.h @@ -60,9 +66,16 @@ include_directories( ${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client ) -add_library(demoddatv SHARED - ${datv_SOURCES} -) +if (LINUX) + add_library(demoddatv SHARED + ${datv_SOURCES} + ${ldpc_SOURCES} + ) +else() + add_library(demoddatv SHARED + ${datv_SOURCES} + ) +endif() target_link_libraries(demoddatv Qt5::Core @@ -78,10 +91,12 @@ target_link_libraries(demoddatv ${SWRESAMPLE_LIBRARIES} ) -add_executable(ldpctool - ldpctool/ldpc_tool.cpp - ldpctool/tables_handler.cpp -) +if (LINUX) + add_executable(ldpctool + ldpctool/ldpc_tool.cpp + ldpctool/tables_handler.cpp + ) + install(TARGETS ldpctool DESTINATION ${INSTALL_BIN_DIR}) +endif() install(TARGETS demoddatv DESTINATION ${INSTALL_PLUGINS_DIR}) -install(TARGETS ldpctool DESTINATION ${INSTALL_BIN_DIR}) diff --git a/plugins/channelrx/demoddatv/datvdemodgui.cpp b/plugins/channelrx/demoddatv/datvdemodgui.cpp index 045ba4ff6..c44a344ea 100644 --- a/plugins/channelrx/demoddatv/datvdemodgui.cpp +++ b/plugins/channelrx/demoddatv/datvdemodgui.cpp @@ -251,8 +251,13 @@ DATVDemodGUI::DATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, Ba CRightClickEnabler *audioMuteRightClickEnabler = new CRightClickEnabler(ui->audioMute); connect(audioMuteRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(audioSelect())); +#ifdef LINUX CRightClickEnabler *ldpcToolRightClickEnabler = new CRightClickEnabler(ui->softLDPC); connect(ldpcToolRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(ldpcToolSelect())); +#else + ui->softLDPC->setEnabled(false); + ui->softLDPC->setStyleSheet("QCheckBox { color: gray }"); +#endif resetToDefaults(); // does applySettings() } @@ -294,13 +299,11 @@ void DATVDemodGUI::displaySettings() ui->chkHardMetric->setEnabled(true); ui->chkFastlock->setEnabled(true); ui->chkViterbi->setEnabled(true); - ui->softLDPC->setEnabled(false); ui->maxBitflips->setEnabled(false); ui->chkAllowDrift->setStyleSheet("QCheckBox { color: white }"); ui->chkHardMetric->setStyleSheet("QCheckBox { color: white }"); ui->chkFastlock->setStyleSheet("QCheckBox { color: white }"); ui->chkViterbi->setStyleSheet("QCheckBox { color: white }"); - ui->softLDPC->setStyleSheet("QCheckBox { color: gray }"); ui->maxBitflips->setStyleSheet("QSpinBox { color: gray }"); ui->maxBitflipsLabel->setStyleSheet("QLabel { color: gray }"); } @@ -310,17 +313,28 @@ void DATVDemodGUI::displaySettings() ui->chkHardMetric->setEnabled(false); ui->chkFastlock->setEnabled(false); ui->chkViterbi->setEnabled(false); - ui->softLDPC->setEnabled(true); ui->maxBitflips->setEnabled(true); ui->chkAllowDrift->setStyleSheet("QCheckBox { color: gray }"); ui->chkHardMetric->setStyleSheet("QCheckBox { color: gray }"); ui->chkFastlock->setStyleSheet("QCheckBox { color: gray }"); ui->chkViterbi->setStyleSheet("QCheckBox { color: gray }"); - ui->softLDPC->setStyleSheet("QCheckBox { color: white }"); ui->maxBitflips->setStyleSheet("QSpinBox { color: white }"); ui->maxBitflipsLabel->setStyleSheet("QLabel { color: white }"); } +#ifdef LINUX + if (m_settings.m_standard == DATVDemodSettings::dvb_version::DVB_S) + { + ui->softLDPC->setEnabled(false); + ui->softLDPC->setStyleSheet("QCheckBox { color: gray }"); + } + else + { + ui->softLDPC->setEnabled(true); + ui->softLDPC->setStyleSheet("QCheckBox { color: white }"); + } +#endif + if (m_settings.m_standard == DATVDemodSettings::dvb_version::DVB_S) { ui->statusText->clear(); } @@ -539,13 +553,11 @@ void DATVDemodGUI::on_cmbStandard_currentIndexChanged(int index) ui->chkHardMetric->setEnabled(true); ui->chkFastlock->setEnabled(true); ui->chkViterbi->setEnabled(true); - ui->softLDPC->setEnabled(false); ui->maxBitflips->setEnabled(false); ui->chkAllowDrift->setStyleSheet("QCheckBox { color: white }"); ui->chkHardMetric->setStyleSheet("QCheckBox { color: white }"); ui->chkFastlock->setStyleSheet("QCheckBox { color: white }"); ui->chkViterbi->setStyleSheet("QCheckBox { color: white }"); - ui->softLDPC->setStyleSheet("QCheckBox { color: gray }"); ui->maxBitflips->setStyleSheet("QSpinBox { color: gray }"); ui->maxBitflipsLabel->setStyleSheet("QLabel { color: gray }"); } @@ -555,17 +567,28 @@ void DATVDemodGUI::on_cmbStandard_currentIndexChanged(int index) ui->chkHardMetric->setEnabled(false); ui->chkFastlock->setEnabled(false); ui->chkViterbi->setEnabled(false); - ui->softLDPC->setEnabled(true); ui->maxBitflips->setEnabled(true); ui->chkAllowDrift->setStyleSheet("QCheckBox { color: gray }"); ui->chkHardMetric->setStyleSheet("QCheckBox { color: gray }"); ui->chkFastlock->setStyleSheet("QCheckBox { color: gray }"); ui->chkViterbi->setStyleSheet("QCheckBox { color: gray }"); - ui->softLDPC->setStyleSheet("QCheckBox { color: white }"); ui->maxBitflips->setStyleSheet("QSpinBox { color: white }"); ui->maxBitflipsLabel->setStyleSheet("QLabel { color: white }"); } +#ifdef LINUX + if (m_settings.m_standard == DATVDemodSettings::dvb_version::DVB_S) + { + ui->softLDPC->setEnabled(false); + ui->softLDPC->setStyleSheet("QCheckBox { color: gray }"); + } + else + { + ui->softLDPC->setEnabled(true); + ui->softLDPC->setStyleSheet("QCheckBox { color: white }"); + } +#endif + if (m_settings.m_standard == DATVDemodSettings::dvb_version::DVB_S) { ui->statusText->clear(); } @@ -603,8 +626,10 @@ void DATVDemodGUI::on_cmbFEC_currentIndexChanged(const QString &arg1) void DATVDemodGUI::on_softLDPC_clicked() { +#ifdef LINUX m_settings.m_softLDPC = ui->softLDPC->isChecked(); applySettings(); +#endif } void DATVDemodGUI::on_maxBitflips_valueChanged(int value) diff --git a/plugins/channelrx/demoddatv/datvdemodsink.cpp b/plugins/channelrx/demoddatv/datvdemodsink.cpp index 2bfc8c26d..62f5dee15 100644 --- a/plugins/channelrx/demoddatv/datvdemodsink.cpp +++ b/plugins/channelrx/demoddatv/datvdemodsink.cpp @@ -425,10 +425,12 @@ void DATVDemodSink::CleanUpDATVFramework(bool blnRelease) delete (leansdr::s2_fecdec*) r_fecdec; } +#ifdef LINUX if(r_fecdecsoft != nullptr) { delete (leansdr::s2_fecdec_soft*) r_fecdecsoft; } +#endif if(p_deframer != nullptr) { @@ -1140,6 +1142,7 @@ void DATVDemodSink::InitDATVS2Framework() p_vbitcount= new leansdr::pipebuf(m_objScheduler, "Bits processed", BUF_S2PACKETS); p_verrcount = new leansdr::pipebuf(m_objScheduler, "Bits corrected", BUF_S2PACKETS); +#ifdef LINUX bool commandFileValid = false; if (QFileInfo::exists(m_settings.m_softLDPCToolPath)) @@ -1216,6 +1219,25 @@ void DATVDemodSink::InitDATVS2Framework() leansdr::s2_fecdec *fecdec = (leansdr::s2_fecdec * ) r_fecdec; fecdec->bitflips=m_settings.m_maxBitflips; } +#else + // Bit-flipping mode. + // Deinterleave into hard bits. + p_fecframes = new leansdr::pipebuf< leansdr::fecframe >(m_objScheduler, "FEC frames", BUF_FRAMES); + p_s2_deinterleaver = new leansdr::s2_deinterleaver( + m_objScheduler, + *(leansdr::pipebuf< leansdr::plslot > *) p_slots_dvbs2, + *(leansdr::pipebuf< leansdr::fecframe > * ) p_fecframes + ); + r_fecdec = new leansdr::s2_fecdec( + m_objScheduler, + *(leansdr::pipebuf< leansdr::fecframe > * ) p_fecframes, + *(leansdr::pipebuf *) p_bbframes, + p_vbitcount, + p_verrcount + ); + leansdr::s2_fecdec *fecdec = (leansdr::s2_fecdec * ) r_fecdec; + fecdec->bitflips=m_settings.m_maxBitflips; +#endif // Deframe BB frames to TS packets p_lock = new leansdr::pipebuf (m_objScheduler, "lock", BUF_SLOW); diff --git a/plugins/channelrx/demoddatv/leansdr/dvbs2.h b/plugins/channelrx/demoddatv/leansdr/dvbs2.h index ee3539fbb..d7d1585fd 100644 --- a/plugins/channelrx/demoddatv/leansdr/dvbs2.h +++ b/plugins/channelrx/demoddatv/leansdr/dvbs2.h @@ -36,9 +36,11 @@ #include "ldpc.h" #include "sdr.h" +#ifdef LINUX #include "ldpctool/layered_decoder.h" #include "ldpctool/testbench.h" #include "ldpctool/algorithms.h" +#endif namespace leansdr { @@ -2174,6 +2176,8 @@ struct s2_fecdec : runnable pipewriter *bitcount, *errcount; }; // s2_fecdec +#ifdef LINUX + // Soft LDPC decoder // Internally implemented LDPC tool. Replaces external LDPC decoder @@ -2316,7 +2320,6 @@ private: // External LDPC decoder // Spawns a user-specified command, FEC frames on stdin/stdout. - template struct simplequeue { @@ -2620,6 +2623,7 @@ struct s2_fecdec_helper : runnable std::deque errcount_q; pipewriter *bitcount, *errcount; }; // s2_fecdec_helper +#endif // S2 FRAMER // EN 302 307-1 section 5.1 Mode adaptation diff --git a/plugins/channelrx/demoddatv/readme.md b/plugins/channelrx/demoddatv/readme.md index b1448c39a..e5f91c2cf 100644 --- a/plugins/channelrx/demoddatv/readme.md +++ b/plugins/channelrx/demoddatv/readme.md @@ -165,7 +165,7 @@ The controls specific to DVB-S are disabled and greyed out. These are: Fast Lock
B.2b.6: DVB-S2 specific - Soft LDPC decoder
-This is for experimenters only. It can be used to decode signals lower that ~10 db MER which is the limit of LDPC hard decoding as explained next (B.2b.7). Video degrades progressively down to about 7.5 dB MER and drops below this limit. +This is for experimenters only working in Linux. It can be used to decode signals lower that ~10 db MER which is the limit of LDPC hard decoding as explained next (B.2b.7). Video degrades progressively down to about 7.5 dB MER and drops below this limit. Runs the `ldpctool` program for soft LDPC decoding. Frames are sent on its standard input and decoded frames retrieved from its standard output. Two processes executing `ldpctool` are spawned but so far it seems that only one is effectively used.