DATV demod: use ldpctool in Linux only

This commit is contained in:
f4exb 2021-03-07 07:41:19 +01:00
parent f95b23ad23
commit 6fb451145b
8 changed files with 86 additions and 19 deletions

View File

@ -163,6 +163,7 @@ set(CUSTOM_WINDOWS_INCLUDE "${CMAKE_SOURCE_DIR}/custom/windows" CACHE INTERNAL "
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(LINUX TRUE) set(LINUX TRUE)
add_definitions(-DLINUX)
# populate distribution name # populate distribution name
# LSB_CODENAME will hold trusty for example # LSB_CODENAME will hold trusty for example
find_program(LSB_RELEASE_EXECUTABLE lsb_release) find_program(LSB_RELEASE_EXECUTABLE lsb_release)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -19,11 +19,14 @@ set(datv_SOURCES
leansdr/framework.cpp leansdr/framework.cpp
leansdr/math.cpp leansdr/math.cpp
leansdr/sdr.cpp leansdr/sdr.cpp
ldpctool/tables_handler.cpp
datvdemodgui.ui datvdemodgui.ui
datvdvbs2ldpcdialog.ui datvdvbs2ldpcdialog.ui
) )
set(ldpc_SOURCES
ldpctool/tables_handler.cpp
)
set(datv_HEADERS set(datv_HEADERS
datvdemod.h datvdemod.h
datvdemodgui.h datvdemodgui.h
@ -45,6 +48,9 @@ set(datv_HEADERS
leansdr/framework.h leansdr/framework.h
leansdr/math.h leansdr/math.h
leansdr/sdr.h leansdr/sdr.h
)
set(ldpc_HEADERS
ldpctool/ldpc.h ldpctool/ldpc.h
ldpctool/dvb_s2_tables.h ldpctool/dvb_s2_tables.h
ldpctool/dvb_s2x_tables.h ldpctool/dvb_s2x_tables.h
@ -60,9 +66,16 @@ include_directories(
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client ${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
) )
if (LINUX)
add_library(demoddatv SHARED
${datv_SOURCES}
${ldpc_SOURCES}
)
else()
add_library(demoddatv SHARED add_library(demoddatv SHARED
${datv_SOURCES} ${datv_SOURCES}
) )
endif()
target_link_libraries(demoddatv target_link_libraries(demoddatv
Qt5::Core Qt5::Core
@ -78,10 +91,12 @@ target_link_libraries(demoddatv
${SWRESAMPLE_LIBRARIES} ${SWRESAMPLE_LIBRARIES}
) )
if (LINUX)
add_executable(ldpctool add_executable(ldpctool
ldpctool/ldpc_tool.cpp ldpctool/ldpc_tool.cpp
ldpctool/tables_handler.cpp ldpctool/tables_handler.cpp
) )
install(TARGETS ldpctool DESTINATION ${INSTALL_BIN_DIR})
endif()
install(TARGETS demoddatv DESTINATION ${INSTALL_PLUGINS_DIR}) install(TARGETS demoddatv DESTINATION ${INSTALL_PLUGINS_DIR})
install(TARGETS ldpctool DESTINATION ${INSTALL_BIN_DIR})

View File

@ -251,8 +251,13 @@ DATVDemodGUI::DATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, Ba
CRightClickEnabler *audioMuteRightClickEnabler = new CRightClickEnabler(ui->audioMute); CRightClickEnabler *audioMuteRightClickEnabler = new CRightClickEnabler(ui->audioMute);
connect(audioMuteRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(audioSelect())); connect(audioMuteRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(audioSelect()));
#ifdef LINUX
CRightClickEnabler *ldpcToolRightClickEnabler = new CRightClickEnabler(ui->softLDPC); CRightClickEnabler *ldpcToolRightClickEnabler = new CRightClickEnabler(ui->softLDPC);
connect(ldpcToolRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(ldpcToolSelect())); connect(ldpcToolRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(ldpcToolSelect()));
#else
ui->softLDPC->setEnabled(false);
ui->softLDPC->setStyleSheet("QCheckBox { color: gray }");
#endif
resetToDefaults(); // does applySettings() resetToDefaults(); // does applySettings()
} }
@ -294,13 +299,11 @@ void DATVDemodGUI::displaySettings()
ui->chkHardMetric->setEnabled(true); ui->chkHardMetric->setEnabled(true);
ui->chkFastlock->setEnabled(true); ui->chkFastlock->setEnabled(true);
ui->chkViterbi->setEnabled(true); ui->chkViterbi->setEnabled(true);
ui->softLDPC->setEnabled(false);
ui->maxBitflips->setEnabled(false); ui->maxBitflips->setEnabled(false);
ui->chkAllowDrift->setStyleSheet("QCheckBox { color: white }"); ui->chkAllowDrift->setStyleSheet("QCheckBox { color: white }");
ui->chkHardMetric->setStyleSheet("QCheckBox { color: white }"); ui->chkHardMetric->setStyleSheet("QCheckBox { color: white }");
ui->chkFastlock->setStyleSheet("QCheckBox { color: white }"); ui->chkFastlock->setStyleSheet("QCheckBox { color: white }");
ui->chkViterbi->setStyleSheet("QCheckBox { color: white }"); ui->chkViterbi->setStyleSheet("QCheckBox { color: white }");
ui->softLDPC->setStyleSheet("QCheckBox { color: gray }");
ui->maxBitflips->setStyleSheet("QSpinBox { color: gray }"); ui->maxBitflips->setStyleSheet("QSpinBox { color: gray }");
ui->maxBitflipsLabel->setStyleSheet("QLabel { color: gray }"); ui->maxBitflipsLabel->setStyleSheet("QLabel { color: gray }");
} }
@ -310,17 +313,28 @@ void DATVDemodGUI::displaySettings()
ui->chkHardMetric->setEnabled(false); ui->chkHardMetric->setEnabled(false);
ui->chkFastlock->setEnabled(false); ui->chkFastlock->setEnabled(false);
ui->chkViterbi->setEnabled(false); ui->chkViterbi->setEnabled(false);
ui->softLDPC->setEnabled(true);
ui->maxBitflips->setEnabled(true); ui->maxBitflips->setEnabled(true);
ui->chkAllowDrift->setStyleSheet("QCheckBox { color: gray }"); ui->chkAllowDrift->setStyleSheet("QCheckBox { color: gray }");
ui->chkHardMetric->setStyleSheet("QCheckBox { color: gray }"); ui->chkHardMetric->setStyleSheet("QCheckBox { color: gray }");
ui->chkFastlock->setStyleSheet("QCheckBox { color: gray }"); ui->chkFastlock->setStyleSheet("QCheckBox { color: gray }");
ui->chkViterbi->setStyleSheet("QCheckBox { color: gray }"); ui->chkViterbi->setStyleSheet("QCheckBox { color: gray }");
ui->softLDPC->setStyleSheet("QCheckBox { color: white }");
ui->maxBitflips->setStyleSheet("QSpinBox { color: white }"); ui->maxBitflips->setStyleSheet("QSpinBox { color: white }");
ui->maxBitflipsLabel->setStyleSheet("QLabel { 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) { if (m_settings.m_standard == DATVDemodSettings::dvb_version::DVB_S) {
ui->statusText->clear(); ui->statusText->clear();
} }
@ -539,13 +553,11 @@ void DATVDemodGUI::on_cmbStandard_currentIndexChanged(int index)
ui->chkHardMetric->setEnabled(true); ui->chkHardMetric->setEnabled(true);
ui->chkFastlock->setEnabled(true); ui->chkFastlock->setEnabled(true);
ui->chkViterbi->setEnabled(true); ui->chkViterbi->setEnabled(true);
ui->softLDPC->setEnabled(false);
ui->maxBitflips->setEnabled(false); ui->maxBitflips->setEnabled(false);
ui->chkAllowDrift->setStyleSheet("QCheckBox { color: white }"); ui->chkAllowDrift->setStyleSheet("QCheckBox { color: white }");
ui->chkHardMetric->setStyleSheet("QCheckBox { color: white }"); ui->chkHardMetric->setStyleSheet("QCheckBox { color: white }");
ui->chkFastlock->setStyleSheet("QCheckBox { color: white }"); ui->chkFastlock->setStyleSheet("QCheckBox { color: white }");
ui->chkViterbi->setStyleSheet("QCheckBox { color: white }"); ui->chkViterbi->setStyleSheet("QCheckBox { color: white }");
ui->softLDPC->setStyleSheet("QCheckBox { color: gray }");
ui->maxBitflips->setStyleSheet("QSpinBox { color: gray }"); ui->maxBitflips->setStyleSheet("QSpinBox { color: gray }");
ui->maxBitflipsLabel->setStyleSheet("QLabel { color: gray }"); ui->maxBitflipsLabel->setStyleSheet("QLabel { color: gray }");
} }
@ -555,17 +567,28 @@ void DATVDemodGUI::on_cmbStandard_currentIndexChanged(int index)
ui->chkHardMetric->setEnabled(false); ui->chkHardMetric->setEnabled(false);
ui->chkFastlock->setEnabled(false); ui->chkFastlock->setEnabled(false);
ui->chkViterbi->setEnabled(false); ui->chkViterbi->setEnabled(false);
ui->softLDPC->setEnabled(true);
ui->maxBitflips->setEnabled(true); ui->maxBitflips->setEnabled(true);
ui->chkAllowDrift->setStyleSheet("QCheckBox { color: gray }"); ui->chkAllowDrift->setStyleSheet("QCheckBox { color: gray }");
ui->chkHardMetric->setStyleSheet("QCheckBox { color: gray }"); ui->chkHardMetric->setStyleSheet("QCheckBox { color: gray }");
ui->chkFastlock->setStyleSheet("QCheckBox { color: gray }"); ui->chkFastlock->setStyleSheet("QCheckBox { color: gray }");
ui->chkViterbi->setStyleSheet("QCheckBox { color: gray }"); ui->chkViterbi->setStyleSheet("QCheckBox { color: gray }");
ui->softLDPC->setStyleSheet("QCheckBox { color: white }");
ui->maxBitflips->setStyleSheet("QSpinBox { color: white }"); ui->maxBitflips->setStyleSheet("QSpinBox { color: white }");
ui->maxBitflipsLabel->setStyleSheet("QLabel { 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) { if (m_settings.m_standard == DATVDemodSettings::dvb_version::DVB_S) {
ui->statusText->clear(); ui->statusText->clear();
} }
@ -603,8 +626,10 @@ void DATVDemodGUI::on_cmbFEC_currentIndexChanged(const QString &arg1)
void DATVDemodGUI::on_softLDPC_clicked() void DATVDemodGUI::on_softLDPC_clicked()
{ {
#ifdef LINUX
m_settings.m_softLDPC = ui->softLDPC->isChecked(); m_settings.m_softLDPC = ui->softLDPC->isChecked();
applySettings(); applySettings();
#endif
} }
void DATVDemodGUI::on_maxBitflips_valueChanged(int value) void DATVDemodGUI::on_maxBitflips_valueChanged(int value)

View File

@ -425,10 +425,12 @@ void DATVDemodSink::CleanUpDATVFramework(bool blnRelease)
delete (leansdr::s2_fecdec<bool, leansdr::hard_sb>*) r_fecdec; delete (leansdr::s2_fecdec<bool, leansdr::hard_sb>*) r_fecdec;
} }
#ifdef LINUX
if(r_fecdecsoft != nullptr) if(r_fecdecsoft != nullptr)
{ {
delete (leansdr::s2_fecdec_soft<leansdr::llr_t,leansdr::llr_sb>*) r_fecdecsoft; delete (leansdr::s2_fecdec_soft<leansdr::llr_t,leansdr::llr_sb>*) r_fecdecsoft;
} }
#endif
if(p_deframer != nullptr) if(p_deframer != nullptr)
{ {
@ -1140,6 +1142,7 @@ void DATVDemodSink::InitDATVS2Framework()
p_vbitcount= new leansdr::pipebuf<int>(m_objScheduler, "Bits processed", BUF_S2PACKETS); p_vbitcount= new leansdr::pipebuf<int>(m_objScheduler, "Bits processed", BUF_S2PACKETS);
p_verrcount = new leansdr::pipebuf<int>(m_objScheduler, "Bits corrected", BUF_S2PACKETS); p_verrcount = new leansdr::pipebuf<int>(m_objScheduler, "Bits corrected", BUF_S2PACKETS);
#ifdef LINUX
bool commandFileValid = false; bool commandFileValid = false;
if (QFileInfo::exists(m_settings.m_softLDPCToolPath)) if (QFileInfo::exists(m_settings.m_softLDPCToolPath))
@ -1216,6 +1219,25 @@ void DATVDemodSink::InitDATVS2Framework()
leansdr::s2_fecdec<bool, leansdr::hard_sb> *fecdec = (leansdr::s2_fecdec<bool, leansdr::hard_sb> * ) r_fecdec; leansdr::s2_fecdec<bool, leansdr::hard_sb> *fecdec = (leansdr::s2_fecdec<bool, leansdr::hard_sb> * ) r_fecdec;
fecdec->bitflips=m_settings.m_maxBitflips; fecdec->bitflips=m_settings.m_maxBitflips;
} }
#else
// Bit-flipping mode.
// Deinterleave into hard bits.
p_fecframes = new leansdr::pipebuf< leansdr::fecframe<leansdr::hard_sb> >(m_objScheduler, "FEC frames", BUF_FRAMES);
p_s2_deinterleaver = new leansdr::s2_deinterleaver<leansdr::llr_ss,leansdr::hard_sb>(
m_objScheduler,
*(leansdr::pipebuf< leansdr::plslot<leansdr::llr_ss> > *) p_slots_dvbs2,
*(leansdr::pipebuf< leansdr::fecframe<leansdr::hard_sb> > * ) p_fecframes
);
r_fecdec = new leansdr::s2_fecdec<bool, leansdr::hard_sb>(
m_objScheduler,
*(leansdr::pipebuf< leansdr::fecframe<leansdr::hard_sb> > * ) p_fecframes,
*(leansdr::pipebuf<leansdr::bbframe> *) p_bbframes,
p_vbitcount,
p_verrcount
);
leansdr::s2_fecdec<bool, leansdr::hard_sb> *fecdec = (leansdr::s2_fecdec<bool, leansdr::hard_sb> * ) r_fecdec;
fecdec->bitflips=m_settings.m_maxBitflips;
#endif
// Deframe BB frames to TS packets // Deframe BB frames to TS packets
p_lock = new leansdr::pipebuf<int> (m_objScheduler, "lock", BUF_SLOW); p_lock = new leansdr::pipebuf<int> (m_objScheduler, "lock", BUF_SLOW);

View File

@ -36,9 +36,11 @@
#include "ldpc.h" #include "ldpc.h"
#include "sdr.h" #include "sdr.h"
#ifdef LINUX
#include "ldpctool/layered_decoder.h" #include "ldpctool/layered_decoder.h"
#include "ldpctool/testbench.h" #include "ldpctool/testbench.h"
#include "ldpctool/algorithms.h" #include "ldpctool/algorithms.h"
#endif
namespace leansdr namespace leansdr
{ {
@ -2174,6 +2176,8 @@ struct s2_fecdec : runnable
pipewriter<int> *bitcount, *errcount; pipewriter<int> *bitcount, *errcount;
}; // s2_fecdec }; // s2_fecdec
#ifdef LINUX
// Soft LDPC decoder // Soft LDPC decoder
// Internally implemented LDPC tool. Replaces external LDPC decoder // Internally implemented LDPC tool. Replaces external LDPC decoder
@ -2316,7 +2320,6 @@ private:
// External LDPC decoder // External LDPC decoder
// Spawns a user-specified command, FEC frames on stdin/stdout. // Spawns a user-specified command, FEC frames on stdin/stdout.
template <typename T, int _SIZE> template <typename T, int _SIZE>
struct simplequeue struct simplequeue
{ {
@ -2620,6 +2623,7 @@ struct s2_fecdec_helper : runnable
std::deque<int> errcount_q; std::deque<int> errcount_q;
pipewriter<int> *bitcount, *errcount; pipewriter<int> *bitcount, *errcount;
}; // s2_fecdec_helper }; // s2_fecdec_helper
#endif
// S2 FRAMER // S2 FRAMER
// EN 302 307-1 section 5.1 Mode adaptation // EN 302 307-1 section 5.1 Mode adaptation

View File

@ -165,7 +165,7 @@ The controls specific to DVB-S are disabled and greyed out. These are: Fast Lock
<h5>B.2b.6: DVB-S2 specific - Soft LDPC decoder</h5> <h5>B.2b.6: DVB-S2 specific - Soft LDPC decoder</h5>
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. 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.