From 0857f1348af937adfd77c7d11d776f239d0e2e82 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Wed, 31 Mar 2021 16:41:42 +0100 Subject: [PATCH 1/2] Add DVB-S2 modulator --- plugins/channeltx/moddatv/CMakeLists.txt | 15 + plugins/channeltx/moddatv/datvmodgui.cpp | 104 +- plugins/channeltx/moddatv/datvmodgui.h | 1 + plugins/channeltx/moddatv/datvmodgui.ui | 5 + plugins/channeltx/moddatv/datvmodplugin.cpp | 4 +- plugins/channeltx/moddatv/datvmodsource.cpp | 235 ++- plugins/channeltx/moddatv/datvmodsource.h | 5 + plugins/channeltx/moddatv/dvb-s2/DVB2.cpp | 272 +++ plugins/channeltx/moddatv/dvb-s2/DVB2.h | 218 +++ plugins/channeltx/moddatv/dvb-s2/DVBS2.cpp | 156 ++ plugins/channeltx/moddatv/dvb-s2/DVBS2.h | 65 + .../moddatv/dvb-s2/dvb2_bbheader.cpp | 149 ++ plugins/channeltx/moddatv/dvb-s2/dvb2_bch.cpp | 408 +++++ .../moddatv/dvb-s2/dvb2_ldpc_encode.cpp | 157 ++ .../moddatv/dvb-s2/dvb2_ldpc_tables.cpp | 1595 +++++++++++++++++ .../moddatv/dvb-s2/dvb2_scrambler.cpp | 23 + .../moddatv/dvb-s2/dvbs2_interleave.cpp | 89 + .../moddatv/dvb-s2/dvbs2_modulator.cpp | 209 +++ .../moddatv/dvb-s2/dvbs2_physical.cpp | 332 ++++ .../moddatv/dvb-s2/dvbs2_scrambler.cpp | 110 ++ .../channeltx/moddatv/dvb-s2/dvbs2_tables.cpp | 19 + plugins/channeltx/moddatv/dvb-s2/readme.md | 1 + plugins/channeltx/moddatv/readme.md | 18 +- 23 files changed, 4114 insertions(+), 76 deletions(-) create mode 100644 plugins/channeltx/moddatv/dvb-s2/DVB2.cpp create mode 100644 plugins/channeltx/moddatv/dvb-s2/DVB2.h create mode 100644 plugins/channeltx/moddatv/dvb-s2/DVBS2.cpp create mode 100644 plugins/channeltx/moddatv/dvb-s2/DVBS2.h create mode 100644 plugins/channeltx/moddatv/dvb-s2/dvb2_bbheader.cpp create mode 100644 plugins/channeltx/moddatv/dvb-s2/dvb2_bch.cpp create mode 100644 plugins/channeltx/moddatv/dvb-s2/dvb2_ldpc_encode.cpp create mode 100644 plugins/channeltx/moddatv/dvb-s2/dvb2_ldpc_tables.cpp create mode 100644 plugins/channeltx/moddatv/dvb-s2/dvb2_scrambler.cpp create mode 100644 plugins/channeltx/moddatv/dvb-s2/dvbs2_interleave.cpp create mode 100644 plugins/channeltx/moddatv/dvb-s2/dvbs2_modulator.cpp create mode 100644 plugins/channeltx/moddatv/dvb-s2/dvbs2_physical.cpp create mode 100644 plugins/channeltx/moddatv/dvb-s2/dvbs2_scrambler.cpp create mode 100644 plugins/channeltx/moddatv/dvb-s2/dvbs2_tables.cpp create mode 100644 plugins/channeltx/moddatv/dvb-s2/readme.md diff --git a/plugins/channeltx/moddatv/CMakeLists.txt b/plugins/channeltx/moddatv/CMakeLists.txt index c0fbe90c2..c5a3df5a1 100644 --- a/plugins/channeltx/moddatv/CMakeLists.txt +++ b/plugins/channeltx/moddatv/CMakeLists.txt @@ -9,6 +9,18 @@ set(moddatv_SOURCES datvmodsettings.cpp datvmodwebapiadapter.cpp dvb-s/dvb-s.cpp + dvb-s2/DVB2.cpp + dvb-s2/DVBS2.cpp + dvb-s2/dvb2_bbheader.cpp + dvb-s2/dvb2_bch.cpp + dvb-s2/dvb2_ldpc_encode.cpp + dvb-s2/dvb2_ldpc_tables.cpp + dvb-s2/dvb2_scrambler.cpp + dvb-s2/dvbs2_interleave.cpp + dvb-s2/dvbs2_modulator.cpp + dvb-s2/dvbs2_physical.cpp + dvb-s2/dvbs2_scrambler.cpp + dvb-s2/dvbs2_tables.cpp ) set(moddatv_HEADERS @@ -20,6 +32,9 @@ set(moddatv_HEADERS datvmodsettings.h datvmodwebapiadapter.h dvb-s/dvb-s.h + dvb-s/dvb-s.h + dvb-s2/DVB2.h + dvb-s2/DVBS2.h ) include_directories( diff --git a/plugins/channeltx/moddatv/datvmodgui.cpp b/plugins/channeltx/moddatv/datvmodgui.cpp index 23dd8fa2f..2acbf2129 100644 --- a/plugins/channeltx/moddatv/datvmodgui.cpp +++ b/plugins/channeltx/moddatv/datvmodgui.cpp @@ -225,16 +225,59 @@ void DATVModGUI::on_deltaFrequency_changed(qint64 value) void DATVModGUI::on_dvbStandard_currentIndexChanged(int index) { + int idx; + m_settings.m_standard = (DATVModSettings::DVBStandard) index; - ui->fec->blockSignals(true); ui->rollOff->blockSignals(true); ui->modulation->blockSignals(true); - ui->fec->clear(); ui->rollOff->clear(); ui->modulation->clear(); + if (m_settings.m_standard == DATVModSettings::DVB_S) + { + ui->rollOff->addItem("0.35"); + ui->modulation->addItem("BPSK"); + ui->modulation->addItem("QPSK"); + } + else + { + ui->rollOff->addItem("0.20"); + ui->rollOff->addItem("0.25"); + ui->rollOff->addItem("0.35"); + ui->modulation->addItem("QPSK"); + ui->modulation->addItem("8PSK"); + ui->modulation->addItem("16APSK"); + ui->modulation->addItem("32APSK"); + } + + ui->rollOff->blockSignals(false); + ui->modulation->blockSignals(false); + + m_doApplySettings = false; + + idx = ui->rollOff->findText(QString("%1").arg(m_settings.m_rollOff, 0, 'f', 2)); + idx = idx == -1 ? 0 : idx; + ui->rollOff->setCurrentIndex(idx); + on_rollOff_currentIndexChanged(idx); + idx = ui->modulation->findText(DATVModSettings::mapModulation(m_settings.m_modulation)); + idx = idx == -1 ? 0 : idx; + ui->modulation->setCurrentIndex(idx); + on_modulation_currentIndexChanged(idx); + + updateFEC(); + + m_doApplySettings = true; + + applySettings(); +} + +void DATVModGUI::updateFEC() +{ + ui->fec->blockSignals(true); + + ui->fec->clear(); if (m_settings.m_standard == DATVModSettings::DVB_S) { ui->fec->addItem("1/2"); @@ -242,11 +285,8 @@ void DATVModGUI::on_dvbStandard_currentIndexChanged(int index) ui->fec->addItem("3/4"); ui->fec->addItem("5/6"); ui->fec->addItem("7/8"); - ui->rollOff->addItem("0.35"); - ui->modulation->addItem("BPSK"); - ui->modulation->addItem("QPSK"); } - else + else if (m_settings.m_modulation == DATVModSettings::QPSK) { ui->fec->addItem("1/4"); ui->fec->addItem("1/3"); @@ -259,29 +299,51 @@ void DATVModGUI::on_dvbStandard_currentIndexChanged(int index) ui->fec->addItem("5/6"); ui->fec->addItem("8/9"); ui->fec->addItem("9/10"); - ui->rollOff->addItem("0.20"); - ui->rollOff->addItem("0.25"); - ui->rollOff->addItem("0.35"); - ui->modulation->addItem("QPSK"); - ui->modulation->addItem("8PSK"); - ui->modulation->addItem("16APSK"); - ui->modulation->addItem("32APSK"); + } + else if (m_settings.m_modulation == DATVModSettings::PSK8) + { + ui->fec->addItem("3/5"); + ui->fec->addItem("2/3"); + ui->fec->addItem("3/4"); + ui->fec->addItem("5/6"); + ui->fec->addItem("8/9"); + ui->fec->addItem("9/10"); + } + else if (m_settings.m_modulation == DATVModSettings::APSK16) + { + ui->fec->addItem("2/3"); + ui->fec->addItem("3/4"); + ui->fec->addItem("4/5"); + ui->fec->addItem("5/6"); + ui->fec->addItem("8/9"); + ui->fec->addItem("9/10"); + } + else if (m_settings.m_modulation == DATVModSettings::APSK32) + { + ui->fec->addItem("3/4"); + ui->fec->addItem("4/5"); + ui->fec->addItem("5/6"); + ui->fec->addItem("8/9"); + ui->fec->addItem("9/10"); } - ui->fec->setCurrentIndex(ui->fec->findText(DATVModSettings::mapCodeRate(m_settings.m_fec))); - ui->rollOff->setCurrentIndex(ui->rollOff->findText(QString("%1").arg(m_settings.m_rollOff, 0, 'f', 2))); - ui->modulation->setCurrentIndex(ui->modulation->findText(DATVModSettings::mapModulation(m_settings.m_modulation))); - ui->fec->blockSignals(false); - ui->rollOff->blockSignals(false); - ui->modulation->blockSignals(false); - applySettings(); + int idx = ui->fec->findText(DATVModSettings::mapCodeRate(m_settings.m_fec)); + idx = idx == -1 ? 0 : idx; + ui->fec->setCurrentIndex(idx); + on_fec_currentIndexChanged(idx); } void DATVModGUI::on_modulation_currentIndexChanged(int index) { - m_settings.m_modulation = (DATVModSettings::DATVModulation) index; + if (m_settings.m_standard == DATVModSettings::DVB_S) + m_settings.m_modulation = (DATVModSettings::DATVModulation) index; + else + m_settings.m_modulation = (DATVModSettings::DATVModulation) (index + 1); + m_doApplySettings = false; + updateFEC(); + m_doApplySettings = true; applySettings(); } diff --git a/plugins/channeltx/moddatv/datvmodgui.h b/plugins/channeltx/moddatv/datvmodgui.h index 32ffd5ed7..6fef4c374 100644 --- a/plugins/channeltx/moddatv/datvmodgui.h +++ b/plugins/channeltx/moddatv/datvmodgui.h @@ -84,6 +84,7 @@ private: void updateWithStreamTime(); void setChannelMarkerBandwidth(); bool handleMessage(const Message& message); + void updateFEC(); void leaveEvent(QEvent*); void enterEvent(QEvent*); diff --git a/plugins/channeltx/moddatv/datvmodgui.ui b/plugins/channeltx/moddatv/datvmodgui.ui index d1f0d32b7..250af16ba 100644 --- a/plugins/channeltx/moddatv/datvmodgui.ui +++ b/plugins/channeltx/moddatv/datvmodgui.ui @@ -246,6 +246,11 @@ DVB-S + + + DVB-S2 + + diff --git a/plugins/channeltx/moddatv/datvmodplugin.cpp b/plugins/channeltx/moddatv/datvmodplugin.cpp index 74a4a5d84..7caeed274 100644 --- a/plugins/channeltx/moddatv/datvmodplugin.cpp +++ b/plugins/channeltx/moddatv/datvmodplugin.cpp @@ -29,8 +29,8 @@ const PluginDescriptor DATVModPlugin::m_pluginDescriptor = { DATVMod::m_channelId, QStringLiteral("DATV Modulator"), - QStringLiteral("6.6.3"), - QStringLiteral("(c) Jon Beniston, M7RCE and Edouard Griffiths, F4EXB"), + QStringLiteral("6.7.1"), + QStringLiteral("(c) Jon Beniston, M7RCE, Edouard Griffiths, F4EXB. DVB-S2 by G4GUO"), QStringLiteral("https://github.com/f4exb/sdrangel"), true, QStringLiteral("https://github.com/f4exb/sdrangel") diff --git a/plugins/channeltx/moddatv/datvmodsource.cpp b/plugins/channeltx/moddatv/datvmodsource.cpp index 187244482..28b0d0874 100644 --- a/plugins/channeltx/moddatv/datvmodsource.cpp +++ b/plugins/channeltx/moddatv/datvmodsource.cpp @@ -74,49 +74,10 @@ int DATVModSource::getTSBitrate(const QString& filename) // Get data bitrate (i.e. excluding FEC overhead) int DATVModSource::getDVBSDataBitrate(const DATVModSettings& settings) { - float rsFactor = DVBS::tsPacketLen/(float)DVBS::rsPacketLen; - float convFactor; + float fecFactor; + float plFactor; float bitsPerSymbol; - switch (settings.m_fec) - { - case DATVModSettings::FEC12: - convFactor = 1.0f/2.0f; - break; - case DATVModSettings::FEC23: - convFactor = 2.0f/3.0f; - break; - case DATVModSettings::FEC34: - convFactor = 3.0f/4.0f; - break; - case DATVModSettings::FEC56: - convFactor = 5.0f/6.0f; - break; - case DATVModSettings::FEC78: - convFactor = 7.0f/8.0f; - break; - case DATVModSettings::FEC45: - convFactor = 4.0f/5.0f; - break; - case DATVModSettings::FEC89: - convFactor = 8.0f/9.0f; - break; - case DATVModSettings::FEC910: - convFactor = 9.0f/10.0f; - break; - case DATVModSettings::FEC14: - convFactor = 1.0f/4.0f; - break; - case DATVModSettings::FEC13: - convFactor = 1.0f/3.0f; - break; - case DATVModSettings::FEC25: - convFactor = 2.0f/5.0f; - break; - case DATVModSettings::FEC35: - convFactor = 3.0f/5.0f; - break; - } switch (settings.m_modulation) { case DATVModSettings::BPSK: @@ -136,16 +97,113 @@ int DATVModSource::getDVBSDataBitrate(const DATVModSettings& settings) break; } - return std::round(settings.m_symbolRate * bitsPerSymbol * rsFactor * convFactor); + if (settings.m_standard == DATVModSettings::DVB_S) + { + float rsFactor; + float convFactor; + + rsFactor = DVBS::tsPacketLen/(float)DVBS::rsPacketLen; + switch (settings.m_fec) + { + case DATVModSettings::FEC12: + convFactor = 1.0f/2.0f; + break; + case DATVModSettings::FEC23: + convFactor = 2.0f/3.0f; + break; + case DATVModSettings::FEC34: + convFactor = 3.0f/4.0f; + break; + case DATVModSettings::FEC56: + convFactor = 5.0f/6.0f; + break; + case DATVModSettings::FEC78: + convFactor = 7.0f/8.0f; + break; + case DATVModSettings::FEC45: + convFactor = 4.0f/5.0f; + break; + case DATVModSettings::FEC89: + convFactor = 8.0f/9.0f; + break; + case DATVModSettings::FEC910: + convFactor = 9.0f/10.0f; + break; + case DATVModSettings::FEC14: + convFactor = 1.0f/4.0f; + break; + case DATVModSettings::FEC13: + convFactor = 1.0f/3.0f; + break; + case DATVModSettings::FEC25: + convFactor = 2.0f/5.0f; + break; + case DATVModSettings::FEC35: + convFactor = 3.0f/5.0f; + break; + } + fecFactor = rsFactor * convFactor; + plFactor = 1.0f; + } + else + { + // For normal frames + int codedBlockSize = 64800; + int uncodedBlockSize; + int bbHeaderBits = 80; + // See table 5a in DVBS2 spec + switch (settings.m_fec) + { + case DATVModSettings::FEC12: + uncodedBlockSize = 32208; + break; + case DATVModSettings::FEC23: + uncodedBlockSize = 43040; + break; + case DATVModSettings::FEC34: + uncodedBlockSize = 48408; + break; + case DATVModSettings::FEC56: + uncodedBlockSize = 53840; + break; + case DATVModSettings::FEC45: + uncodedBlockSize = 51648; + break; + case DATVModSettings::FEC89: + uncodedBlockSize = 57472; + break; + case DATVModSettings::FEC910: + uncodedBlockSize = 58192; + break; + case DATVModSettings::FEC14: + uncodedBlockSize = 16008; + break; + case DATVModSettings::FEC13: + uncodedBlockSize = 21408; + break; + case DATVModSettings::FEC25: + uncodedBlockSize = 25728; + break; + case DATVModSettings::FEC35: + uncodedBlockSize = 38688; + break; + } + fecFactor = (uncodedBlockSize-bbHeaderBits)/(float)codedBlockSize; + float symbolsPerFrame = codedBlockSize/bitsPerSymbol; + // 90 symbols for PL header + plFactor = symbolsPerFrame / (symbolsPerFrame + 90.0f); + } + + return std::round(settings.m_symbolRate * bitsPerSymbol * fecFactor * plFactor); } void DATVModSource::checkBitrates() { int dataBitrate = getDVBSDataBitrate(m_settings); qDebug() << "MPEG-TS bitrate: " << m_mpegTSBitrate; - qDebug() << "DVB-S data bitrate: " << dataBitrate; + qDebug() << "DVB data bitrate: " << dataBitrate; if (dataBitrate < m_mpegTSBitrate) - qWarning() << "DVB-S data bitrate is lower than the bitrate of the MPEG transport stream"; + qWarning() << "DVB data bitrate is lower than the bitrate of the MPEG transport stream"; m_tsRatio = m_mpegTSBitrate/(float)dataBitrate; } @@ -316,6 +374,12 @@ void DATVModSource::modulateSample() // Encode using DVB-S m_symbolCount = m_dvbs.encode(m_mpegTS, m_iqSymbols); } + else + { + // Encode using DVB-S2 + m_symbolCount = m_dvbs2.s2_add_ts_frame((u8 *)m_mpegTS); + m_plFrame = m_dvbs2.pl_get_frame(); + } // Loop file if we reach the end if ((m_frameIdx*DVBS::tsPacketLen >= m_mpegTSSize) && m_settings.m_tsFilePlayLoop) @@ -372,9 +436,17 @@ void DATVModSource::modulateSample() q = m_pulseShapeQ.filter(sin(5*M_PI/4)); } */ + m_symbolIdx++; + m_symbolCount--; + } + else + { + // First 90 symbols of DVB-S2 are pi/2 BPSK, then remaining symbols are in specified modulation + i = m_pulseShapeI.filter(m_plFrame[m_symbolIdx].re/32767.0); + q = m_pulseShapeQ.filter(m_plFrame[m_symbolIdx].im/32767.0); + m_symbolIdx++; + m_symbolCount--; } - m_symbolIdx++; - m_symbolCount--; } } else @@ -621,6 +693,77 @@ void DATVModSource::applySettings(const DATVModSettings& settings, bool force) break; } } + else + { + m_dvbs2Format.frame_type = FRAME_NORMAL; + m_dvbs2Format.pilots = 0; // PILOTS_OFF; + m_dvbs2Format.dummy_frame = 0; + m_dvbs2Format.null_deletion = 0; + m_dvbs2Format.intface = M_ACM; // Unused? + m_dvbs2Format.broadcasting = 1; + + switch (settings.m_modulation) + { + case DATVModSettings::QPSK: + m_dvbs2Format.constellation = M_QPSK; + break; + case DATVModSettings::PSK8: + m_dvbs2Format.constellation = M_8PSK; + break; + case DATVModSettings::APSK16: + m_dvbs2Format.constellation = M_16APSK; + break; + case DATVModSettings::APSK32: + m_dvbs2Format.constellation = M_32APSK; + break; + } + + switch (settings.m_fec) + { + case DATVModSettings::FEC12: + m_dvbs2Format.code_rate = CR_1_2; + break; + case DATVModSettings::FEC23: + m_dvbs2Format.code_rate = CR_2_3; + break; + case DATVModSettings::FEC34: + m_dvbs2Format.code_rate = CR_3_4; + break; + case DATVModSettings::FEC56: + m_dvbs2Format.code_rate = CR_5_6; + break; + case DATVModSettings::FEC45: + m_dvbs2Format.code_rate = CR_4_5; + break; + case DATVModSettings::FEC89: + m_dvbs2Format.code_rate = CR_8_9; + break; + case DATVModSettings::FEC910: + m_dvbs2Format.code_rate = CR_9_10; + break; + case DATVModSettings::FEC14: + m_dvbs2Format.code_rate = CR_1_4; + break; + case DATVModSettings::FEC13: + m_dvbs2Format.code_rate = CR_1_3; + break; + case DATVModSettings::FEC25: + m_dvbs2Format.code_rate = CR_2_5; + break; + case DATVModSettings::FEC35: + m_dvbs2Format.code_rate = CR_3_5; + break; + } + + if (settings.m_rollOff == 0.35f) + m_dvbs2Format.roll_off = RO_0_35; + else if (settings.m_rollOff == 0.25f) + m_dvbs2Format.roll_off = RO_0_25; + else + m_dvbs2Format.roll_off = RO_0_20; + + m_dvbs2.s2_set_configure(&m_dvbs2Format); + } if (getMessageQueueToGUI()) { getMessageQueueToGUI()->push(DATVModReport::MsgReportRates::create( diff --git a/plugins/channeltx/moddatv/datvmodsource.h b/plugins/channeltx/moddatv/datvmodsource.h index fec93a789..6e35c8d4a 100644 --- a/plugins/channeltx/moddatv/datvmodsource.h +++ b/plugins/channeltx/moddatv/datvmodsource.h @@ -38,6 +38,7 @@ #include "datvmodsettings.h" #include "dvb-s/dvb-s.h" +#include "dvb-s2/DVBS2.h" class MessageQueue; class QUdpSocket; @@ -88,6 +89,10 @@ private: int m_samplesPerSymbol; uint8_t m_iqSymbols[DVBS::m_maxIQSymbols*2]; + DVBS2 m_dvbs2; + DVB2FrameFormat m_dvbs2Format; + scmplx *m_plFrame; + QUdpSocket *m_udpSocket; //!< UDP socket to receive MPEG transport stream via int m_udpByteCount; //!< Count of bytes received via UDP for bitrate calculation boost::chrono::steady_clock::time_point m_udpTimingStart; //!< When we last started counting UDP bytes diff --git a/plugins/channeltx/moddatv/dvb-s2/DVB2.cpp b/plugins/channeltx/moddatv/dvb-s2/DVB2.cpp new file mode 100644 index 000000000..7c5ca39a7 --- /dev/null +++ b/plugins/channeltx/moddatv/dvb-s2/DVB2.cpp @@ -0,0 +1,272 @@ +#include "memory.h" +#include "DVB2.h" + + +// +// Update working parameters for the next frame +// This prevents parameters changing during a frame +// +void DVB2::base_end_of_frame_actions(void) +{ + if( m_params_changed ) + { + m_format[0] = m_format[1]; + ldpc_lookup_generate(); + m_params_changed = 0; + } + // reset the pointer + m_frame_offset_bits = 0; +} + +// +// This configures the system and calculates +// any required intermediate values +// +int DVB2::set_configure( DVB2FrameFormat *f ) +{ + int bch_bits = 0; + int error = 0; + + if( f->broadcasting ) + { + // Set standard parametrs for broadcasting + f->frame_type = FRAME_NORMAL; + f->bb_header.ts_gs = TS_GS_TRANSPORT; + f->bb_header.sis_mis = SIS_MIS_SINGLE; + f->bb_header.ccm_acm = CCM; + f->bb_header.issyi = 0; + f->bb_header.npd = 0; + f->bb_header.upl = 188*8; + f->bb_header.sync = 0x47; + } + f->bb_header.ro = f->roll_off; + // Fill in the mode specific values and bit lengths + if( f->frame_type == FRAME_NORMAL ) + { + f->nldpc = 64800; + bch_bits = 192; + f->bch_code = BCH_CODE_N12; + // Apply code rate + switch(f->code_rate ) + { + case CR_1_4: + f->q_val = 135; + f->kbch = 16008; + f->bch_code = BCH_CODE_N12; + break; + case CR_1_3: + f->q_val = 120; + f->kbch = 21408; + f->bch_code = BCH_CODE_N12; + break; + case CR_2_5: + f->q_val = 108; + f->kbch = 25728; + f->bch_code = BCH_CODE_N12; + break; + case CR_1_2: + f->q_val = 90; + f->kbch = 32208; + f->bch_code = BCH_CODE_N12; + break; + case CR_3_5: + f->q_val = 72; + f->kbch = 38688; + f->bch_code = BCH_CODE_N12; + break; + case CR_2_3: + bch_bits = 160; + f->q_val = 60; + f->kbch = 43040; + f->bch_code = BCH_CODE_N10; + break; + case CR_3_4: + f->q_val = 45; + f->kbch = 48408; + f->bch_code = BCH_CODE_N12; + break; + case CR_4_5: + f->q_val = 36; + f->kbch = 51648; + f->bch_code = BCH_CODE_N12; + break; + case CR_5_6: + bch_bits = 160; + f->q_val = 30; + f->kbch = 53840; + f->bch_code = BCH_CODE_N10; + break; + case CR_8_9: + bch_bits = 128; + f->q_val = 20; + f->kbch = 57472; + f->bch_code = BCH_CODE_N8; + break; + case CR_9_10: + bch_bits = 128; + f->q_val = 18; + f->kbch = 58192; + f->bch_code = BCH_CODE_N8; + break; + default: +// loggerf("Configuration error DVB2\n"); + error = -1; + break; + } + } + + if( f->frame_type == FRAME_SHORT ) + { + f->nldpc = 16200; + bch_bits = 168; + f->bch_code = BCH_CODE_S12; + // Apply code rate + switch(f->code_rate ) + { + case CR_1_4: + f->q_val = 36; + f->kbch = 3072; + break; + case CR_1_3: + f->q_val = 30; + f->kbch = 5232; + break; + case CR_2_5: + f->q_val = 27; + f->kbch = 6312; + break; + case CR_1_2: + f->q_val = 25; + f->kbch = 7032; + break; + case CR_3_5: + f->q_val = 18; + f->kbch = 9552; + break; + case CR_2_3: + f->q_val = 15; + f->kbch = 10632; + break; + case CR_3_4: + f->q_val = 12; + f->kbch = 11712; + break; + case CR_4_5: + f->q_val = 10; + f->kbch = 12432; + break; + case CR_5_6: + f->q_val = 8; + f->kbch = 13152; + break; + case CR_8_9: + f->q_val = 5; + f->kbch = 14232; + break; + case CR_9_10: + error = 1; + f->kbch = 0; + break; + default: +// loggerf("Configuration error DVB2\n"); + error = -1; + break; + } + } + if( error == 0 ) + { + // Length of the user packets + f->bb_header.upl = 188*8; + // Payload length + f->bb_header.dfl = f->kbch - 80; + // Transport packet sync + f->bb_header.sync = 0x47; + // Start of LDPC bits + f->kldpc = f->kbch + bch_bits; + // Number of padding bits required (not used) + f->padding_bits = 0; + // Number of useable data bits (not used) + f->useable_data_bits = f->kbch - 80; + // Save the configuration, will be updated on next frame + m_format[1] = *f; + // reset various pointers + m_dnp = 0;// No deleted null packets + // Signal we need to update on the next frame. + if( m_params_changed ) + base_end_of_frame_actions(); + else + m_params_changed = 1; + } + return error; +} +void DVB2::get_configure( DVB2FrameFormat *f ) +{ + *f = m_format[1]; +} + +// Points to first byte in transport packet + +int DVB2::add_ts_frame_base( u8 *ts ) +{ + if( m_frame_offset_bits == 0 ) + { + // New frame needs to be sent + add_bbheader(); // Add the header + } + // Add a new transport packet + unpack_transport_packet_add_crc( ts ); + // Have we reached the end? + if( m_frame_offset_bits == m_format[0].kbch ) + { + // Yes so now Scramble the BB frame + bb_randomise(); + // BCH encode the BB Frame + bch_encode(); + // LDPC encode the BB frame and BCHFEC bits + ldpc_encode(); + // Signal to the modulation specific class we have something to send + base_end_of_frame_actions(); + return 1; + } + return 0; +} +// +// Dump NULL packets appends a counter to the end of each UP +// it is not implemented at the moment. +// +int DVB2::next_ts_frame_base( u8 *ts ) +{ + int res = 0; + // See if we need to dump null packets + if( m_format[0].null_deletion == 1 ) + { + if(((ts[0]&0x1F) == 0x1F)&&(ts[1] == 0xFF )) + { + // Null packet detected + if( m_dnp < 0xFF ) + { + m_dnp++;// Increment the number of null packets + return 0; + } + } + } + // Need to send a new transport packet + res = add_ts_frame_base( ts ); + if( res ) m_dnp = 0;// Clear the DNP counter + // return whether it is time to transmit a new frame + return res; +} +DVB2::DVB2(void) +{ + // Clear the transport queue + m_tp_q.empty(); + init_bb_randomiser(); + bch_poly_build_tables(); + build_crc8_table(); + m_dnp = 0;// No delted null packets + m_frame_offset_bits = 0; + m_params_changed = 1; +} +DVB2::~DVB2(void) +{ +} diff --git a/plugins/channeltx/moddatv/dvb-s2/DVB2.h b/plugins/channeltx/moddatv/dvb-s2/DVB2.h new file mode 100644 index 000000000..ff1a0a2c2 --- /dev/null +++ b/plugins/channeltx/moddatv/dvb-s2/DVB2.h @@ -0,0 +1,218 @@ +#ifndef DVB2_H +#define DVB2_H +#include +#include +#include +#include + +typedef unsigned int u32; +typedef unsigned char u8; + + +using namespace std; + +// BB HEADER fileds +#define TS_GS_TRANSPORT 3 +#define TS_GS_GENERIC_PACKETIZED 0 +#define TS_GS_GENERIC_CONTINUOUS 1 +#define TS_GS_RESERVED 2 + +#define SIS_MIS_SINGLE 1 +#define SIS_MIS_MULTIPLE 0 + +#define CCM 1 +#define ACM 0 + +#define ISSYI_ACTIVE 1 +#define ISSYI_NOT_ACTIVE 0 + +#define NPD_ACTIVE 1 +#define NPD_NOT_ACTIVE 0 +// Rolloff +#define RO_0_35 0 +#define RO_0_25 1 +#define RO_0_20 2 +#define RO_RESERVED 3 + +// Pilots +#define PILOTS_OFF 0 +#define PILOTS_ON 1 + +typedef struct{ + int ts_gs; + int sis_mis; + int ccm_acm; + int issyi; + int npd; + int ro; + int isi; + int upl; + int dfl; + int sync; + int syncd; +}BBHeader; + +typedef int Bit; + +// The number of useable and stuff bits in a frame +typedef struct{ + int data_bits; + int stuff_bits; +}FrameBits; + +#define FRAME_SIZE_NORMAL 64800 +#define FRAME_SIZE_SHORT 16200 +#define LDPC_ENCODE_TABLE_LENGTH (FRAME_SIZE_NORMAL*10) + +typedef struct{ + int table_length; + Bit d[LDPC_ENCODE_TABLE_LENGTH]; + Bit p[LDPC_ENCODE_TABLE_LENGTH]; +}Ldpc_encode_table; + +#define FRAME_NORMAL 0x00 +#define FRAME_SHORT 0x10 +#define BB_HEADER_LENGTH_BITS 72 +#define CRC8_LENGTH_BITS 8 + +#define PADDING_LENGTH 200 + +// Code rates +#define CR_1_4 0 +#define CR_1_3 1 +#define CR_2_5 2 +#define CR_1_2 3 +#define CR_3_5 4 +#define CR_2_3 5 +#define CR_3_4 6 +#define CR_4_5 7 +#define CR_5_6 8 +#define CR_8_9 9 +#define CR_9_10 10 +// BCH Code +#define BCH_CODE_N8 0 +#define BCH_CODE_N10 1 +#define BCH_CODE_N12 2 +#define BCH_CODE_S12 3 +// Constellation +#define M_QPSK 0 +#define M_8PSK 1 +#define M_16APSK 2 +#define M_32APSK 3 +//Interface +#define M_ACM 0 +#define M_CCM 1 +#define M_VCM 2 + + +typedef struct{ + int frame_type; + int code_rate; + int roll_off; + int constellation; + int pilots; + int dummy_frame; + int null_deletion; + int intface; + int broadcasting; + // Calculated information, not used by caller + BBHeader bb_header; + int kldpc; + int kbch; + int nldpc; + int q_val; + int bch_code; + int useable_data_bits; + int padding_bits; + int total_bits; + int nr_tps; + int nr_tps_bits; +}DVB2FrameFormat; + + +class DVB2{ + +public: + +protected: + Bit m_frame[FRAME_SIZE_NORMAL]; + DVB2FrameFormat m_format[2]; + Bit m_padding[PADDING_LENGTH]; + int m_frame_offset_bits; + int m_params_changed; + +private: + int m_bbheader[BB_HEADER_LENGTH_BITS+CRC8_LENGTH_BITS]; + int m_bb_randomise[FRAME_SIZE_NORMAL]; + u32 m_poly_n_8[4]; + u32 m_poly_n_10[5]; + u32 m_poly_n_12[6]; + u32 m_poly_s_12[6]; + u8 m_crc_tab[256]; + u8 m_dnp; // Deleted null packet + // Transport packet queue + queue m_tp_q; + + // LDPC tables + const static int ldpc_tab_1_4N[45][13]; + const static int ldpc_tab_1_3N[60][13]; + const static int ldpc_tab_2_5N[72][13]; + const static int ldpc_tab_1_2N[90][9]; + const static int ldpc_tab_3_5N[108][13]; + const static int ldpc_tab_2_3N[120][14]; + const static int ldpc_tab_3_4N[135][13]; + const static int ldpc_tab_4_5N[144][12]; + const static int ldpc_tab_5_6N[150][14]; + const static int ldpc_tab_8_9N[160][5]; + const static int ldpc_tab_9_10N[162][5]; + const static int ldpc_tab_1_4S[9][13]; + const static int ldpc_tab_1_3S[15][13]; + const static int ldpc_tab_2_5S[18][13]; + const static int ldpc_tab_1_2S[20][9]; + const static int ldpc_tab_3_5S[27][13]; + const static int ldpc_tab_2_3S[30][14]; + const static int ldpc_tab_3_4S[33][13]; + const static int ldpc_tab_4_5S[35][4]; + const static int ldpc_tab_5_6S[37][14]; + const static int ldpc_tab_8_9S[40][5]; + + + Ldpc_encode_table m_ldpc_encode; + void bb_randomise(void); + void init_scrambler(void); + void init_bb_randomiser(void); + void ldpc_lookup_generate(void); + void ldpc_encode( void ); + int add_transport_packet( u8 *pkt, Bit *b ); + void build_crc8_table( void ); + u8 calc_crc8( u8 *b, int len ); + int add_crc8_bits( Bit *in, int length ); + void unpack_transport_packet_add_crc( u8 *ts ); + void add_bbheader( void ); + void poly_reverse( int *pin, int *pout, int len ); + void poly_pack( const int *pin, u32* pout, int len ); + int poly_mult( const int *ina, int lena, const int *inb, int lenb, int *out ); + void bch_poly_build_tables( void ); + void reg_4_shift( u32 *sr ); + void reg_5_shift( u32 *sr ); + void reg_6_shift( u32 *sr ); + Bit bch_n_8_encode( Bit *in, int len ); + Bit bch_n_10_encode( Bit *in, int len ); + Bit bch_n_12_encode( Bit *in, int len ); + Bit bch_s_12_encode( Bit *in, int len ); + int bch_encode( void ); + int add_ts_frame_base( u8 *ts ); + void ldpc_encode_test(); + void base_end_of_frame_actions(void); +protected: + int set_configure( DVB2FrameFormat *f ); + void get_configure( DVB2FrameFormat *f ); + int next_ts_frame_base( u8 *ts ); +public: + // encode a new transport packet +// virtual void physical(void); + DVB2(); + ~DVB2(); +}; + +#endif diff --git a/plugins/channeltx/moddatv/dvb-s2/DVBS2.cpp b/plugins/channeltx/moddatv/dvb-s2/DVBS2.cpp new file mode 100644 index 000000000..8fef268f6 --- /dev/null +++ b/plugins/channeltx/moddatv/dvb-s2/DVBS2.cpp @@ -0,0 +1,156 @@ +#include "memory.h" +#include "DVBS2.h" + +// +// called at the end of a frame +// +void DVBS2::end_of_frame_actions(void) +{ + if( m_s2_config_updated ) + { + modulator_configuration(); + m_s2_config_updated = 0; + } +} + +int DVBS2::is_valid( int mod, int coderate ) +{ + if( mod == M_QPSK ) + { + if(coderate == CR_1_4) return 0; + if(coderate == CR_1_3) return 0; + if(coderate == CR_2_5) return 0; + if(coderate == CR_1_2) return 0; + if(coderate == CR_3_5) return 0; + if(coderate == CR_2_3) return 0; + if(coderate == CR_3_4) return 0; + if(coderate == CR_4_5) return 0; + if(coderate == CR_5_6) return 0; + if(coderate == CR_8_9) return 0; + if(coderate == CR_9_10) return 0; + } + if( mod == M_8PSK ) + { + if(coderate == CR_3_5) return 0; + if(coderate == CR_2_3) return 0; + if(coderate == CR_3_4) return 0; + if(coderate == CR_5_6) return 0; + if(coderate == CR_8_9) return 0; + if(coderate == CR_9_10) return 0; + } + if( mod == M_16APSK ) + { + if(coderate == CR_2_3) return 0; + if(coderate == CR_3_4) return 0; + if(coderate == CR_4_5) return 0; + if(coderate == CR_5_6) return 0; + if(coderate == CR_8_9) return 0; + if(coderate == CR_9_10) return 0; + } + if( mod == M_32APSK ) + { + if(coderate == CR_3_4) return 0; + if(coderate == CR_4_5) return 0; + if(coderate == CR_5_6) return 0; + if(coderate == CR_8_9) return 0; + if(coderate == CR_9_10) return 0; + } + return -1; +} +// +// index 0 and 1 will only be different when being reconfigured. +// Use index 1 as this will be applied in the following transmit +// frames +// +void DVBS2::calc_efficiency( void ) +{ + double p,m,a,s,b,po; + // Calculate the number of symbols in the payload + p = 0;a = 0; m = 0; + if( m_format[1].frame_type == FRAME_NORMAL ) p = (double)FRAME_SIZE_NORMAL; + if( m_format[1].frame_type == FRAME_SHORT ) p = (double)FRAME_SIZE_SHORT; + if( m_format[1].constellation == M_QPSK ) m = 2.0; + if( m_format[1].constellation == M_8PSK ) m = 3.0; + if( m_format[1].constellation == M_16APSK ) m = 4.0; + if( m_format[1].constellation == M_32APSK ) m = 5.0; + s = p/m;//Number of symbols per frame + // PL header overhead + if( m_format[1].pilots ) + { + po = (s/(90*16))-1;// 1 pilot every 16 blocks (of 90 symbols) + po = po*36; // No pilot at the end + a = s/(90+po+s); + } + else + { + a = s/(90+s);// No pilots + } + // Modulation efficiency + a = a*m; + // Take into account pilot symbols + // TBD + // Now calculate the useable data as percentage of the frame + b = ((double)m_format[1].useable_data_bits)/p; + // Now calculate the efficiency by multiplying the + // useable bits efficiency by the modulation efficiency + m_efficiency = b*a; +} +// +// Multiply the efficiency value by the symbol rate +// to get the useable bitrate +// +double DVBS2::s2_get_efficiency( void ) +{ + return m_efficiency; +} + +int DVBS2::s2_set_configure( DVB2FrameFormat *f ) +{ + if( is_valid( f->constellation, f->code_rate ) == 0 ) + { + if( set_configure( f ) == 0 ) + { + calc_efficiency(); + m_s2_config_updated = 1; + m_configured = 1; + + return 0; + } + } + return -1; +} +void DVBS2::s2_get_configure( DVB2FrameFormat *f ) +{ + get_configure( f ); +} +int DVBS2::s2_add_ts_frame( u8 *ts ) +{ + int res = 0; + if (m_configured == 0) return 0; + // Call base class + if( next_ts_frame_base( ts ) ) + { + // Interleave and pack + s2_interleave(); + // create the header + s2_pl_header_create(); + // Add the data + res = s2_pl_data_pack(); + // Do any updates required for the next frame + end_of_frame_actions(); + } + return res; +} +void DVBS2::physical( void ) +{ + +} + +DVBS2::DVBS2() +{ + m_configured = 0; + modulator_configuration(); + build_symbol_scrambler_table(); + pl_build_dummy(); +} + diff --git a/plugins/channeltx/moddatv/dvb-s2/DVBS2.h b/plugins/channeltx/moddatv/dvb-s2/DVBS2.h new file mode 100644 index 000000000..4faaef400 --- /dev/null +++ b/plugins/channeltx/moddatv/dvb-s2/DVBS2.h @@ -0,0 +1,65 @@ +#include "DVB2.h" + +#ifndef __SCMPLX__ +typedef struct{ + short re; + short im; +}scmplx; + +#endif + +#ifndef DVBS2_H +#define DVBS2_H + +#ifndef M_PI +#define M_PI 3.14159f +#endif + +#define loggerf printf + +class DVBS2 : public DVB2{ +private: + const static unsigned long g[6]; + const static int ph_scram_tab[64]; + const static int ph_sync_seq[26]; + scmplx m_bpsk[2][2]; + scmplx m_qpsk[4]; + scmplx m_8psk[8]; + scmplx m_16apsk[16]; + scmplx m_32apsk[32]; + scmplx m_pl[FRAME_SIZE_NORMAL]; + scmplx m_pl_dummy[FRAME_SIZE_NORMAL]; + int m_cscram[FRAME_SIZE_NORMAL]; + int m_iframe[FRAME_SIZE_NORMAL]; + int m_payload_symbols; + int m_dummy_frame_length; + int m_configured; + double m_efficiency; + int m_s2_config_updated; + void b_64_7_code( unsigned char in, int *out ); + void s2_pl_header_encode( u8 modcod, u8 type, int *out); + void modulator_configuration(void); + void s2_interleave( void ); + void s2_pl_header_create(void); + int s2_pl_data_pack( void ); + void pl_scramble_symbols( scmplx *fs, int len ); + void pl_scramble_dummy_symbols( int len ); + void pl_build_dummy( void ); + int parity_chk( long a, long b); + void build_symbol_scrambler_table( void ); + void calc_efficiency( void ); + void end_of_frame_actions(void); + +public: + int is_valid(int mod, int coderate); + double s2_get_efficiency( void ); + void physical(void); + int s2_set_configure( DVB2FrameFormat *f ); + void s2_get_configure( DVB2FrameFormat *f ); + scmplx *pl_get_frame(void); + scmplx *pl_get_dummy( int &len ); + int s2_add_ts_frame( u8 *ts ); + DVBS2(); +}; + +#endif diff --git a/plugins/channeltx/moddatv/dvb-s2/dvb2_bbheader.cpp b/plugins/channeltx/moddatv/dvb-s2/dvb2_bbheader.cpp new file mode 100644 index 000000000..eb90bab7f --- /dev/null +++ b/plugins/channeltx/moddatv/dvb-s2/dvb2_bbheader.cpp @@ -0,0 +1,149 @@ +#include "DVB2.h" +#include "memory.h" +// +// This file adds the BB header and new transport packets +// +#define CRC_POLY 0xAB +// Reversed +#define CRC_POLYR 0xD5 + +void DVB2::build_crc8_table( void ) +{ + int r,crc; + + for( int i = 0; i < 256; i++ ) + { + r = i; + crc = 0; + for( int j = 7; j >= 0; j-- ) + { + if((r&(1<>= 1; + if( b ) crc ^= CRC_POLY; + } + + for( int n = 0; n < 8; n++ ) + { + in[i++] = (crc&(1<ts_gs>>1; + m_frame[1] = h->ts_gs&1; + m_frame[2] = h->sis_mis; + m_frame[3] = h->ccm_acm; + m_frame[4] = h->issyi&1; + m_frame[5] = h->npd&1; + m_frame[6] = h->ro>>1; + m_frame[7] = h->ro&1; + m_frame_offset_bits = 8; + if( h->sis_mis == SIS_MIS_MULTIPLE ) + { + temp = h->isi; + for( int n = 7; n >= 0; n-- ) + { + m_frame[m_frame_offset_bits++] = temp&(1<= 0 ; n-- ) + { + m_frame[m_frame_offset_bits++] = 0; + } + } + temp = h->upl; + for( int n = 15; n >= 0; n-- ) + { + m_frame[m_frame_offset_bits++] = temp&(1<dfl; + for( int n = 15; n >= 0; n-- ) + { + m_frame[m_frame_offset_bits++] = temp&(1<sync; + for( int n = 7; n >= 0; n-- ) + { + m_frame[m_frame_offset_bits++] = temp&(1<syncd;// Syncd + for( int n = 15; n >= 0; n-- ) + { + m_frame[m_frame_offset_bits++] = temp&(1<= 0; n-- ) + { + m_frame[m_frame_offset_bits++] = b&(1<>24); + break; + case 2: + // loggerf("%.2X",in[(len/32)]>>24); + // loggerf("%.2X",in[(len/32)]>>16); + break; + case 3: + // loggerf("%.2X",in[(len/32)]>>24); + // loggerf("%.2X",in[(len/32)]>>16); + // loggerf("%.2X",in[(len/32)]>>8); + break; + } + // loggerf("\n"); +} + +// +// Polynomial calculation routines +// +// multiply polynomials +// +int DVB2::poly_mult( const int *ina, int lena, const int *inb, int lenb, int *out ) +{ + memset( out, 0, sizeof(int)*(lena+lenb)); + + for( int i = 0; i < lena; i++ ) + { + for( int j = 0; j < lenb; j++ ) + { + if( ina[i]*inb[j] > 0 ) out[i+j]++;// count number of terms for this pwr of x + } + } + int max=0; + for( int i = 0; i < lena+lenb; i++ ) + { + out[i] = out[i]&1;// If even ignore the term + if(out[i]) max = i; + } + // return the size of array to house the result. + return max+1; + +} +// +// Pack the polynomial into a 32 bit array +// + +void DVB2::poly_pack( const int *pin, u32* pout, int len ) +{ + int lw = len/32; + int ptr = 0; + u32 temp; + if( len % 32 ) lw++; + + for( int i = 0; i < lw; i++ ) + { + temp = 0x80000000; + pout[i] = 0; + for( int j = 0; j < 32; j++ ) + { + if( pin[ptr++] ) pout[i] |= temp; + temp >>= 1; + } + } +} + +void DVB2::poly_reverse( int *pin, int *pout, int len ) +{ + int c; + c = len-1; + + for( int i = 0; i < len; i++ ) + { + pout[c--] = pin[i]; + } +} +// +// Shift a 128 bit register +// +void inline DVB2::reg_4_shift( u32 *sr ) +{ + sr[3] = (sr[3]>>1) | (sr[2]<<31); + sr[2] = (sr[2]>>1) | (sr[1]<<31); + sr[1] = (sr[1]>>1) | (sr[0]<<31); + sr[0] = (sr[0]>>1); +} +// +// Shift 160 bits +// +void inline DVB2::reg_5_shift( u32 *sr ) +{ + sr[4] = (sr[4]>>1) | (sr[3]<<31); + sr[3] = (sr[3]>>1) | (sr[2]<<31); + sr[2] = (sr[2]>>1) | (sr[1]<<31); + sr[1] = (sr[1]>>1) | (sr[0]<<31); + sr[0] = (sr[0]>>1); +} +// +// Shift 192 bits +// +void inline DVB2::reg_6_shift( u32 *sr ) +{ + sr[5] = (sr[5]>>1) | (sr[4]<<31); + sr[4] = (sr[4]>>1) | (sr[3]<<31); + sr[3] = (sr[3]>>1) | (sr[2]<<31); + sr[2] = (sr[2]>>1) | (sr[1]<<31); + sr[1] = (sr[1]>>1) | (sr[0]<<31); + sr[0] = (sr[0]>>1); +} + +// +// Take an bit array, bch encode it and place the result in a bit array +// The input length is in bits. +// +Bit DVB2::bch_n_8_encode( Bit *in, int len ) +{ + Bit b; + int i; + u32 shift[4]; + + //Zero the shift register + memset( shift,0,sizeof(u32)*4); + + for( i = 0; i < len; i++ ) + { + b = in[i]^(shift[3]&1); + reg_4_shift( shift ); + if( b ) + { + shift[0] ^= m_poly_n_8[0]; + shift[1] ^= m_poly_n_8[1]; + shift[2] ^= m_poly_n_8[2]; + shift[3] ^= m_poly_n_8[3]; + } + } + // Now add the parity bits to the output + for( int n = 0; n < 128; n++ ) + { + in[i++] = shift[3]&1; + reg_4_shift( shift ); + } + return i; +} +Bit DVB2::bch_n_10_encode( Bit *in,int len ) +{ + Bit b; + int i; + u32 shift[5]; + + //Zero the shift register + memset( shift,0,sizeof(u32)*5); + + for( i = 0; i < len; i++ ) + { + b = in[i]^(shift[4]&1); + reg_5_shift( shift ); + if(b) + { + shift[0] ^= m_poly_n_10[0]; + shift[1] ^= m_poly_n_10[1]; + shift[2] ^= m_poly_n_10[2]; + shift[3] ^= m_poly_n_10[3]; + shift[4] ^= m_poly_n_10[4]; + } + } + // Now add the parity bits to the output + for( int n = 0; n < 160; n++ ) + { + in[i++] = shift[4]&1; + reg_5_shift( shift ); + } + return i; +} + +Bit DVB2::bch_n_12_encode( Bit *in, int len ) +{ + Bit b; + int i; + u32 shift[6]; + //Zero the shift register + memset( shift,0,sizeof(u32)*6); + // MSB of the codeword first + for( i = 0; i < len; i++ ) + { + b = in[i] ^ (shift[5]&1); + reg_6_shift( shift ); + if(b) + { + shift[0] ^= m_poly_n_12[0]; + shift[1] ^= m_poly_n_12[1]; + shift[2] ^= m_poly_n_12[2]; + shift[3] ^= m_poly_n_12[3]; + shift[4] ^= m_poly_n_12[4]; + shift[5] ^= m_poly_n_12[5]; + } + } + // Now add the parity bits to the output + for( int n = 0; n < 192; n++ ) + { + in[i++] = shift[5]&1; + reg_6_shift( shift ); + } + return i; +} + +Bit DVB2::bch_s_12_encode( Bit *in, int len ) +{ + Bit b; + int i; + u32 shift[6]; + + //Zero the shift register + memset( shift,0,sizeof(u32)*6); + + for( i = 0; i < len; i++ ) + { + b = (in[i] ^ ((shift[5]&0x01000000)?1:0)); + reg_6_shift( shift ); + if(b) + { + shift[0] ^= m_poly_s_12[0]; + shift[1] ^= m_poly_s_12[1]; + shift[2] ^= m_poly_s_12[2]; + shift[3] ^= m_poly_s_12[3]; + shift[4] ^= m_poly_s_12[4]; + shift[5] ^= m_poly_s_12[5]; + } + } + // Now add the parity bits to the output + for( int n = 0; n < 168; n++ ) + { + in[i++] = (shift[5]&0x01000000) ? 1:0; + reg_6_shift( shift ); + } + return i; +} + + +int DVB2::bch_encode( void ) +{ + int res; + int len = m_format[0].kbch; + + switch(m_format[0].bch_code) + { + case BCH_CODE_N8: + res = bch_n_8_encode( m_frame, len ); + break; + case BCH_CODE_N10: + res = bch_n_10_encode( m_frame, len ); + break; + case BCH_CODE_N12: + res = bch_n_12_encode( m_frame, len ); + break; + case BCH_CODE_S12: + res = bch_s_12_encode( m_frame, len ); + break; + default: + printf("BCH error situation\n"); + res = 0; + break; + } + return res; +} + +// +// +// +void DVB2::bch_poly_build_tables( void ) +{ + // Normal polynomials + const int polyn01[]={1,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,1}; + const int polyn02[]={1,1,0,0,1,1,1,0,1,0,0,0,0,0,0,0,1}; + const int polyn03[]={1,0,1,1,1,1,0,1,1,1,1,1,0,0,0,0,1}; + const int polyn04[]={1,0,1,0,1,0,1,0,0,1,0,1,1,0,1,0,1}; + const int polyn05[]={1,1,1,1,0,1,0,0,1,1,1,1,1,0,0,0,1}; + const int polyn06[]={1,0,1,0,1,1,0,1,1,1,1,0,1,1,1,1,1}; + const int polyn07[]={1,0,1,0,0,1,1,0,1,1,1,1,0,1,0,1,1}; + const int polyn08[]={1,1,1,0,0,1,1,0,1,1,0,0,1,1,1,0,1}; + const int polyn09[]={1,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,1}; + const int polyn10[]={1,1,1,0,0,1,0,1,1,0,1,0,1,1,1,0,1}; + const int polyn11[]={1,0,1,1,0,1,0,0,0,1,0,1,1,1,0,0,1}; + const int polyn12[]={1,1,0,0,0,1,1,1,0,1,0,1,1,0,0,0,1}; + + // Short polynomials + const int polys01[]={1,1,0,1,0,1,0,0,0,0,0,0,0,0,1}; + const int polys02[]={1,0,0,0,0,0,1,0,1,0,0,1,0,0,1}; + const int polys03[]={1,1,1,0,0,0,1,0,0,1,1,0,0,0,1}; + const int polys04[]={1,0,0,0,1,0,0,1,1,0,1,0,1,0,1}; + const int polys05[]={1,0,1,0,1,0,1,0,1,1,0,1,0,1,1}; + const int polys06[]={1,0,0,1,0,0,0,1,1,1,0,0,0,1,1}; + const int polys07[]={1,0,1,0,0,1,1,1,0,0,1,1,0,1,1}; + const int polys08[]={1,0,0,0,0,1,0,0,1,1,1,1,0,0,1}; + const int polys09[]={1,1,1,1,0,0,0,0,0,1,1,0,0,0,1}; + const int polys10[]={1,0,0,1,0,0,1,0,0,1,0,1,1,0,1}; + const int polys11[]={1,0,0,0,1,0,0,0,0,0,0,1,1,0,1}; + const int polys12[]={1,1,1,1,0,1,1,1,1,0,1,0,0,1,1}; + + int len; + int polyout[3][2000]; + + len = poly_mult( polyn01, 17, polyn02, 17, polyout[0] ); + len = poly_mult( polyn03, 17, polyout[0], len, polyout[1] ); + len = poly_mult( polyn04, 17, polyout[1], len, polyout[0] ); + len = poly_mult( polyn05, 17, polyout[0], len, polyout[1] ); + len = poly_mult( polyn06, 17, polyout[1], len, polyout[0] ); + len = poly_mult( polyn07, 17, polyout[0], len, polyout[1] ); + len = poly_mult( polyn08, 17, polyout[1], len, polyout[0] ); + poly_pack( polyout[0], m_poly_n_8, 128 ); +// display_poly_pack( m_poly_n_8, 128); + + len = poly_mult( polyn09, 17, polyout[0], len, polyout[1] ); + len = poly_mult( polyn10, 17, polyout[1], len, polyout[0] ); + poly_pack( polyout[0], m_poly_n_10, 160 ); +// display_poly_pack( m_poly_n_10, 160); + + len = poly_mult( polyn11, 17, polyout[0], len, polyout[1] ); + len = poly_mult( polyn12, 17, polyout[1], len, polyout[0] ); + poly_pack( polyout[0], m_poly_n_12, 192 ); +// display_poly_pack( m_poly_n_12, 192); +// display_poly( polyout[0], len );//12 + + + len = poly_mult( polys01, 15, polys02, 15, polyout[0] ); + len = poly_mult( polys03, 15, polyout[0], len, polyout[1] ); + len = poly_mult( polys04, 15, polyout[1], len, polyout[0] ); + len = poly_mult( polys05, 15, polyout[0], len, polyout[1] ); + len = poly_mult( polys06, 15, polyout[1], len, polyout[0] ); + len = poly_mult( polys07, 15, polyout[0], len, polyout[1] ); + len = poly_mult( polys08, 15, polyout[1], len, polyout[0] ); + len = poly_mult( polys09, 15, polyout[0], len, polyout[1] ); + len = poly_mult( polys10, 15, polyout[1], len, polyout[0] ); + len = poly_mult( polys11, 15, polyout[0], len, polyout[1] ); + len = poly_mult( polys12, 15, polyout[1], len, polyout[0] ); + poly_pack( polyout[0], m_poly_s_12, 168 ); +// display_poly_pack( m_poly_s_12, 168); + +/* + // test + int pt1[] = {1,1}; + int pt2[] = {1,1,1}; + int pt3[] = {1,0,1,1,1,1}; + len = poly_mult( pt1, 2, pt2, 3, polyout[0] ); + len = poly_mult( pt3, 6, polyout[0], len, polyout[1] ); + display_poly( polyout[1], len ); + poly_pack( polyout[1], m_poly_s_12, len ); + display_poly_pack( m_poly_s_12, 8 ); + u32 shift[6]; + shift[0] = 0x80000000; + shift[1] = 0x00000000; + shift[2] = 0x00000000; + shift[3] = 0x00000000; + shift[4] = 0x00000000; + shift[5] = 0x00000000; + + for( int i = 0; i < 192; i++ ) + { + display_poly_pack( shift, 192 ); + reg_6_shift( shift ); + } + +// display_poly( polyout[0], len );//12 +// display_poly_pack( m_poly_s_12, 168 );// Wont work because of shift register length +*/ +} diff --git a/plugins/channeltx/moddatv/dvb-s2/dvb2_ldpc_encode.cpp b/plugins/channeltx/moddatv/dvb-s2/dvb2_ldpc_encode.cpp new file mode 100644 index 000000000..36224d224 --- /dev/null +++ b/plugins/channeltx/moddatv/dvb-s2/dvb2_ldpc_encode.cpp @@ -0,0 +1,157 @@ +#include "memory.h" +#include "DVB2.h" + +/* +for( int row = 0; row < rows; row++ ) +{ + for( int n = 0; n < 360; n++ ) + { + for( int col = 1; col <= table_name[row][0]; col++ ) + { + // parity bit location, position from start of block + m_ldpc_encode.p[index] = m_format.kldpc + (table_name[row][col] + (n*m_format.q_val))%pbits; + // data bit to be accumulated + m_ldpc_encode.d[index] = im; + index++; + } + im++; + } +} +*/ + +#define LDPC_BF( TABLE_NAME, ROWS ) \ +for( int row = 0; row < ROWS; row++ ) \ +{ \ + for( int n = 0; n < 360; n++ ) \ + { \ + for( int col = 1; col <= TABLE_NAME[row][0]; col++ ) \ + { \ + m_ldpc_encode.p[index] = (TABLE_NAME[row][col] + (n*q))%pbits; \ + m_ldpc_encode.d[index] = im; \ + index++; \ + } \ + im++; \ + } \ +} + +/* +// +// Generate the lookup tables for the ldpc mode +// +void DVBS2::ldpc_lookup_generate( void ) +{ + int im; + int index; + int pbits; + int uc; + int rows; + + index = 0; + im = 0; + + if(m_format.frame_type == FRAME_NORMAL) + { + if(m_format.code_rate == CR_2_3) + { + uc = m_format.kldpc; + pbits = m_format.nldpc - m_format.kldpc; //number of parity bits + rows = 120; + + for( int row = 0; row < rows; row++ )// for each row + { + for( int n = 0; n < 360; n++ ) + { + for( int col = 1; col <= ldpc_tab_2_3N[row][0]; col++ ) + { + // parity bit location, position from start of block + m_ldpc_encode.p[index] = m_format.kldpc + (ldpc_tab_2_3N[row][col] + (n*m_format.q_val))%pbits; + // data bit to be accumulated + m_ldpc_encode.d[index] = im; + index++; + } + im++; + } + } + } + } + m_ldpc_encode.length = index; +} +*/ +void DVB2::ldpc_lookup_generate( void ) +{ + int im; + int index; + int pbits; + int q; + index = 0; + im = 0; + + pbits = m_format[0].nldpc - m_format[0].kldpc; //number of parity bits + q = m_format[0].q_val; + + if(m_format[0].frame_type == FRAME_NORMAL) + { + if( m_format[0].code_rate == CR_1_4 ) LDPC_BF( ldpc_tab_1_4N, 45 ); + if( m_format[0].code_rate == CR_1_3 ) LDPC_BF( ldpc_tab_1_3N, 60 ); + if( m_format[0].code_rate == CR_2_5 ) LDPC_BF( ldpc_tab_2_5N, 72 ); + if( m_format[0].code_rate == CR_1_2 ) LDPC_BF( ldpc_tab_1_2N, 90 ); + if( m_format[0].code_rate == CR_3_5 ) LDPC_BF( ldpc_tab_3_5N, 108 ); + if( m_format[0].code_rate == CR_2_3 ) LDPC_BF( ldpc_tab_2_3N, 120 ); + if( m_format[0].code_rate == CR_3_4 ) LDPC_BF( ldpc_tab_3_4N, 135 ); + if( m_format[0].code_rate == CR_4_5 ) LDPC_BF( ldpc_tab_4_5N, 144 ); + if( m_format[0].code_rate == CR_5_6 ) LDPC_BF( ldpc_tab_5_6N, 150 ); + if( m_format[0].code_rate == CR_8_9 ) LDPC_BF( ldpc_tab_8_9N, 160 ); + if( m_format[0].code_rate == CR_9_10) LDPC_BF( ldpc_tab_9_10N, 162 ); + } + if(m_format[0].frame_type == FRAME_SHORT) + { + if( m_format[0].code_rate == CR_1_4 ) LDPC_BF( ldpc_tab_1_4S, 9 ); + if( m_format[0].code_rate == CR_1_3 ) LDPC_BF( ldpc_tab_1_3S, 15 ); + if( m_format[0].code_rate == CR_2_5 ) LDPC_BF( ldpc_tab_2_5S, 18 ); + if( m_format[0].code_rate == CR_1_2 ) LDPC_BF( ldpc_tab_1_2S, 20 ); + if( m_format[0].code_rate == CR_3_5 ) LDPC_BF( ldpc_tab_3_5S, 27 ); + if( m_format[0].code_rate == CR_2_3 ) LDPC_BF( ldpc_tab_2_3S, 30 ); + if( m_format[0].code_rate == CR_3_4 ) LDPC_BF( ldpc_tab_3_4S, 33 ); + if( m_format[0].code_rate == CR_4_5 ) LDPC_BF( ldpc_tab_4_5S, 35 ); + if( m_format[0].code_rate == CR_5_6 ) LDPC_BF( ldpc_tab_5_6S, 37 ); + if( m_format[0].code_rate == CR_8_9 ) LDPC_BF( ldpc_tab_8_9S, 40 ); + } + m_ldpc_encode.table_length = index; +} + +void DVB2::ldpc_encode( void ) +{ + Bit *d,*p; + // Calculate the number of parity bits + int plen = m_format[0].nldpc - m_format[0].kldpc; + d = m_frame; + p = &m_frame[m_format[0].kldpc]; + // First zero all the parity bits + memset( p, 0, sizeof(Bit)*plen); + + // now do the parity checking + for( int i = 0; i < m_ldpc_encode.table_length; i++ ) + { + p[m_ldpc_encode.p[i]] ^= d[m_ldpc_encode.d[i]]; + } + for (int i = 1; i < plen; i++) + { + p[i] ^= p[i - 1]; + } +} +void DVB2::ldpc_encode_test( void ) +{ + if(1)// m_format.code_rate == CR_1_2 ) + { + printf("\n\nEncode length %d\n",m_ldpc_encode.table_length); + printf("Parity start %d\n",m_format[0].kldpc); + for( int i = 0; i < m_ldpc_encode.table_length; i++ ) + { + if(m_ldpc_encode.d[i] == 0 ) + { + printf("%d+%d\n",m_ldpc_encode.p[i],m_ldpc_encode.d[i]); + } + } + printf("Encode test end\n\n"); + } +} diff --git a/plugins/channeltx/moddatv/dvb-s2/dvb2_ldpc_tables.cpp b/plugins/channeltx/moddatv/dvb-s2/dvb2_ldpc_tables.cpp new file mode 100644 index 000000000..58fe13cb4 --- /dev/null +++ b/plugins/channeltx/moddatv/dvb-s2/dvb2_ldpc_tables.cpp @@ -0,0 +1,1595 @@ +#include "DVB2.h" + +const int DVB2::ldpc_tab_1_4N[45][13]= +{ + {12,23606,36098,1140,28859,18148,18510,6226,540,42014,20879,23802,47088}, + {12,16419,24928,16609,17248,7693,24997,42587,16858,34921,21042,37024,20692}, + {12,1874,40094,18704,14474,14004,11519,13106,28826,38669,22363,30255,31105}, + {12,22254,40564,22645,22532,6134,9176,39998,23892,8937,15608,16854,31009}, + {12,8037,40401,13550,19526,41902,28782,13304,32796,24679,27140,45980,10021}, + {12,40540,44498,13911,22435,32701,18405,39929,25521,12497,9851,39223,34823}, + {12,15233,45333,5041,44979,45710,42150,19416,1892,23121,15860,8832,10308}, + {12,10468,44296,3611,1480,37581,32254,13817,6883,32892,40258,46538,11940}, + {12,6705,21634,28150,43757,895,6547,20970,28914,30117,25736,41734,11392}, + {12,22002,5739,27210,27828,34192,37992,10915,6998,3824,42130,4494,35739}, + {12,8515,1191,13642,30950,25943,12673,16726,34261,31828,3340,8747,39225}, + {12,18979,17058,43130,4246,4793,44030,19454,29511,47929,15174,24333,19354}, + {12,16694,8381,29642,46516,32224,26344,9405,18292,12437,27316,35466,41992}, + {12,15642,5871,46489,26723,23396,7257,8974,3156,37420,44823,35423,13541}, + {12,42858,32008,41282,38773,26570,2702,27260,46974,1469,20887,27426,38553}, + {3,22152,24261,8297,0,0,0,0,0,0,0,0,0}, + {3,19347,9978,27802,0,0,0,0,0,0,0,0,0}, + {3,34991,6354,33561,0,0,0,0,0,0,0,0,0}, + {3,29782,30875,29523,0,0,0,0,0,0,0,0,0}, + {3,9278,48512,14349,0,0,0,0,0,0,0,0,0}, + {3,38061,4165,43878,0,0,0,0,0,0,0,0,0}, + {3,8548,33172,34410,0,0,0,0,0,0,0,0,0}, + {3,22535,28811,23950,0,0,0,0,0,0,0,0,0}, + {3,20439,4027,24186,0,0,0,0,0,0,0,0,0}, + {3,38618,8187,30947,0,0,0,0,0,0,0,0,0}, + {3,35538,43880,21459,0,0,0,0,0,0,0,0,0}, + {3,7091,45616,15063,0,0,0,0,0,0,0,0,0}, + {3,5505,9315,21908,0,0,0,0,0,0,0,0,0}, + {3,36046,32914,11836,0,0,0,0,0,0,0,0,0}, + {3,7304,39782,33721,0,0,0,0,0,0,0,0,0}, + {3,16905,29962,12980,0,0,0,0,0,0,0,0,0}, + {3,11171,23709,22460,0,0,0,0,0,0,0,0,0}, + {3,34541,9937,44500,0,0,0,0,0,0,0,0,0}, + {3,14035,47316,8815,0,0,0,0,0,0,0,0,0}, + {3,15057,45482,24461,0,0,0,0,0,0,0,0,0}, + {3,30518,36877,879,0,0,0,0,0,0,0,0,0}, + {3,7583,13364,24332,0,0,0,0,0,0,0,0,0}, + {3,448,27056,4682,0,0,0,0,0,0,0,0,0}, + {3,12083,31378,21670,0,0,0,0,0,0,0,0,0}, + {3,1159,18031,2221,0,0,0,0,0,0,0,0,0}, + {3,17028,38715,9350,0,0,0,0,0,0,0,0,0}, + {3,17343,24530,29574,0,0,0,0,0,0,0,0,0}, + {3,46128,31039,32818,0,0,0,0,0,0,0,0,0}, + {3,20373,36967,18345,0,0,0,0,0,0,0,0,0}, + {3,46685,20622,32806,0,0,0,0,0,0,0,0,0} +}; + +const int DVB2::ldpc_tab_1_3N[60][13]= +{ + {12,34903,20927,32093,1052,25611,16093,16454,5520,506,37399,18518,21120}, + {12,11636,14594,22158,14763,15333,6838,22222,37856,14985,31041,18704,32910}, + {12,17449,1665,35639,16624,12867,12449,10241,11650,25622,34372,19878,26894}, + {12,29235,19780,36056,20129,20029,5457,8157,35554,21237,7943,13873,14980}, + {12,9912,7143,35911,12043,17360,37253,25588,11827,29152,21936,24125,40870}, + {12,40701,36035,39556,12366,19946,29072,16365,35495,22686,11106,8756,34863}, + {12,19165,15702,13536,40238,4465,40034,40590,37540,17162,1712,20577,14138}, + {12,31338,19342,9301,39375,3211,1316,33409,28670,12282,6118,29236,35787}, + {12,11504,30506,19558,5100,24188,24738,30397,33775,9699,6215,3397,37451}, + {12,34689,23126,7571,1058,12127,27518,23064,11265,14867,30451,28289,2966}, + {12,11660,15334,16867,15160,38343,3778,4265,39139,17293,26229,42604,13486}, + {12,31497,1365,14828,7453,26350,41346,28643,23421,8354,16255,11055,24279}, + {12,15687,12467,13906,5215,41328,23755,20800,6447,7970,2803,33262,39843}, + {12,5363,22469,38091,28457,36696,34471,23619,2404,24229,41754,1297,18563}, + {12,3673,39070,14480,30279,37483,7580,29519,30519,39831,20252,18132,20010}, + {12,34386,7252,27526,12950,6875,43020,31566,39069,18985,15541,40020,16715}, + {12,1721,37332,39953,17430,32134,29162,10490,12971,28581,29331,6489,35383}, + {12,736,7022,42349,8783,6767,11871,21675,10325,11548,25978,431,24085}, + {12,1925,10602,28585,12170,15156,34404,8351,13273,20208,5800,15367,21764}, + {12,16279,37832,34792,21250,34192,7406,41488,18346,29227,26127,25493,7048}, + {3,39948,28229,24899,0,0,0,0,0,0,0,0,0}, + {3,17408,14274,38993,0,0,0,0,0,0,0,0,0}, + {3,38774,15968,28459,0,0,0,0,0,0,0,0,0}, + {3,41404,27249,27425,0,0,0,0,0,0,0,0,0}, + {3,41229,6082,43114,0,0,0,0,0,0,0,0,0}, + {3,13957,4979,40654,0,0,0,0,0,0,0,0,0}, + {3,3093,3438,34992,0,0,0,0,0,0,0,0,0}, + {3,34082,6172,28760,0,0,0,0,0,0,0,0,0}, + {3,42210,34141,41021,0,0,0,0,0,0,0,0,0}, + {3,14705,17783,10134,0,0,0,0,0,0,0,0,0}, + {3,41755,39884,22773,0,0,0,0,0,0,0,0,0}, + {3,14615,15593,1642,0,0,0,0,0,0,0,0,0}, + {3,29111,37061,39860,0,0,0,0,0,0,0,0,0}, + {3,9579,33552,633,0,0,0,0,0,0,0,0,0}, + {3,12951,21137,39608,0,0,0,0,0,0,0,0,0}, + {3,38244,27361,29417,0,0,0,0,0,0,0,0,0}, + {3,2939,10172,36479,0,0,0,0,0,0,0,0,0}, + {3,29094,5357,19224,0,0,0,0,0,0,0,0,0}, + {3,9562,24436,28637,0,0,0,0,0,0,0,0,0}, + {3,40177,2326,13504,0,0,0,0,0,0,0,0,0}, + {3,6834,21583,42516,0,0,0,0,0,0,0,0,0}, + {3,40651,42810,25709,0,0,0,0,0,0,0,0,0}, + {3,31557,32138,38142,0,0,0,0,0,0,0,0,0}, + {3,18624,41867,39296,0,0,0,0,0,0,0,0,0}, + {3,37560,14295,16245,0,0,0,0,0,0,0,0,0}, + {3,6821,21679,31570,0,0,0,0,0,0,0,0,0}, + {3,25339,25083,22081,0,0,0,0,0,0,0,0,0}, + {3,8047,697,35268,0,0,0,0,0,0,0,0,0}, + {3,9884,17073,19995,0,0,0,0,0,0,0,0,0}, + {3,26848,35245,8390,0,0,0,0,0,0,0,0,0}, + {3,18658,16134,14807,0,0,0,0,0,0,0,0,0}, + {3,12201,32944,5035,0,0,0,0,0,0,0,0,0}, + {3,25236,1216,38986,0,0,0,0,0,0,0,0,0}, + {3,42994,24782,8681,0,0,0,0,0,0,0,0,0}, + {3,28321,4932,34249,0,0,0,0,0,0,0,0,0}, + {3,4107,29382,32124,0,0,0,0,0,0,0,0,0}, + {3,22157,2624,14468,0,0,0,0,0,0,0,0,0}, + {3,38788,27081,7936,0,0,0,0,0,0,0,0,0}, + {3,4368,26148,10578,0,0,0,0,0,0,0,0,0}, + {3,25353,4122,39751,0,0,0,0,0,0,0,0,0} +}; + +const int DVB2::ldpc_tab_2_5N[72][13]= +{ + {12,31413,18834,28884,947,23050,14484,14809,4968,455,33659,16666,19008}, + {12,13172,19939,13354,13719,6132,20086,34040,13442,27958,16813,29619,16553}, + {12,1499,32075,14962,11578,11204,9217,10485,23062,30936,17892,24204,24885}, + {12,32490,18086,18007,4957,7285,32073,19038,7152,12486,13483,24808,21759}, + {12,32321,10839,15620,33521,23030,10646,26236,19744,21713,36784,8016,12869}, + {12,35597,11129,17948,26160,14729,31943,20416,10000,7882,31380,27858,33356}, + {12,14125,12131,36199,4058,35992,36594,33698,15475,1566,18498,12725,7067}, + {12,17406,8372,35437,2888,1184,30068,25802,11056,5507,26313,32205,37232}, + {12,15254,5365,17308,22519,35009,718,5240,16778,23131,24092,20587,33385}, + {12,27455,17602,4590,21767,22266,27357,30400,8732,5596,3060,33703,3596}, + {12,6882,873,10997,24738,20770,10067,13379,27409,25463,2673,6998,31378}, + {12,15181,13645,34501,3393,3840,35227,15562,23615,38342,12139,19471,15483}, + {12,13350,6707,23709,37204,25778,21082,7511,14588,10010,21854,28375,33591}, + {12,12514,4695,37190,21379,18723,5802,7182,2529,29936,35860,28338,10835}, + {12,34283,25610,33026,31017,21259,2165,21807,37578,1175,16710,21939,30841}, + {12,27292,33730,6836,26476,27539,35784,18245,16394,17939,23094,19216,17432}, + {12,11655,6183,38708,28408,35157,17089,13998,36029,15052,16617,5638,36464}, + {12,15693,28923,26245,9432,11675,25720,26405,5838,31851,26898,8090,37037}, + {12,24418,27583,7959,35562,37771,17784,11382,11156,37855,7073,21685,34515}, + {12,10977,13633,30969,7516,11943,18199,5231,13825,19589,23661,11150,35602}, + {12,19124,30774,6670,37344,16510,26317,23518,22957,6348,34069,8845,20175}, + {12,34985,14441,25668,4116,3019,21049,37308,24551,24727,20104,24850,12114}, + {12,38187,28527,13108,13985,1425,21477,30807,8613,26241,33368,35913,32477}, + {12,5903,34390,24641,26556,23007,27305,38247,2621,9122,32806,21554,18685}, + {3,17287,27292,19033,0,0,0,0,0,0,0,0,0}, + {3,25796,31795,12152,0,0,0,0,0,0,0,0,0}, + {3,12184,35088,31226,0,0,0,0,0,0,0,0,0}, + {3,38263,33386,24892,0,0,0,0,0,0,0,0,0}, + {3,23114,37995,29796,0,0,0,0,0,0,0,0,0}, + {3,34336,10551,36245,0,0,0,0,0,0,0,0,0}, + {3,35407,175,7203,0,0,0,0,0,0,0,0,0}, + {3,14654,38201,22605,0,0,0,0,0,0,0,0,0}, + {3,28404,6595,1018,0,0,0,0,0,0,0,0,0}, + {3,19932,3524,29305,0,0,0,0,0,0,0,0,0}, + {3,31749,20247,8128,0,0,0,0,0,0,0,0,0}, + {3,18026,36357,26735,0,0,0,0,0,0,0,0,0}, + {3,7543,29767,13588,0,0,0,0,0,0,0,0,0}, + {3,13333,25965,8463,0,0,0,0,0,0,0,0,0}, + {3,14504,36796,19710,0,0,0,0,0,0,0,0,0}, + {3,4528,25299,7318,0,0,0,0,0,0,0,0,0}, + {3,35091,25550,14798,0,0,0,0,0,0,0,0,0}, + {3,7824,215,1248,0,0,0,0,0,0,0,0,0}, + {3,30848,5362,17291,0,0,0,0,0,0,0,0,0}, + {3,28932,30249,27073,0,0,0,0,0,0,0,0,0}, + {3,13062,2103,16206,0,0,0,0,0,0,0,0,0}, + {3,7129,32062,19612,0,0,0,0,0,0,0,0,0}, + {3,9512,21936,38833,0,0,0,0,0,0,0,0,0}, + {3,35849,33754,23450,0,0,0,0,0,0,0,0,0}, + {3,18705,28656,18111,0,0,0,0,0,0,0,0,0}, + {3,22749,27456,32187,0,0,0,0,0,0,0,0,0}, + {3,28229,31684,30160,0,0,0,0,0,0,0,0,0}, + {3,15293,8483,28002,0,0,0,0,0,0,0,0,0}, + {3,14880,13334,12584,0,0,0,0,0,0,0,0,0}, + {3,28646,2558,19687,0,0,0,0,0,0,0,0,0}, + {3,6259,4499,26336,0,0,0,0,0,0,0,0,0}, + {3,11952,28386,8405,0,0,0,0,0,0,0,0,0}, + {3,10609,961,7582,0,0,0,0,0,0,0,0,0}, + {3,10423,13191,26818,0,0,0,0,0,0,0,0,0}, + {3,15922,36654,21450,0,0,0,0,0,0,0,0,0}, + {3,10492,1532,1205,0,0,0,0,0,0,0,0,0}, + {3,30551,36482,22153,0,0,0,0,0,0,0,0,0}, + {3,5156,11330,34243,0,0,0,0,0,0,0,0,0}, + {3,28616,35369,13322,0,0,0,0,0,0,0,0,0}, + {3,8962,1485,21186,0,0,0,0,0,0,0,0,0}, + {3,23541,17445,35561,0,0,0,0,0,0,0,0,0}, + {3,33133,11593,19895,0,0,0,0,0,0,0,0,0}, + {3,33917,7863,33651,0,0,0,0,0,0,0,0,0}, + {3,20063,28331,10702,0,0,0,0,0,0,0,0,0}, + {3,13195,21107,21859,0,0,0,0,0,0,0,0,0}, + {3,4364,31137,4804,0,0,0,0,0,0,0,0,0}, + {3,5585,2037,4830,0,0,0,0,0,0,0,0,0}, + {3,30672,16927,14800,0,0,0,0,0,0,0,0,0} +}; + +const int DVB2::ldpc_tab_1_2N[90][9]= +{ + {8,54,9318,14392,27561,26909,10219,2534,8597}, + {8,55,7263,4635,2530,28130,3033,23830,3651}, + {8,56,24731,23583,26036,17299,5750,792,9169}, + {8,57,5811,26154,18653,11551,15447,13685,16264}, + {8,58,12610,11347,28768,2792,3174,29371,12997}, + {8,59,16789,16018,21449,6165,21202,15850,3186}, + {8,60,31016,21449,17618,6213,12166,8334,18212}, + {8,61,22836,14213,11327,5896,718,11727,9308}, + {8,62,2091,24941,29966,23634,9013,15587,5444}, + {8,63,22207,3983,16904,28534,21415,27524,25912}, + {8,64,25687,4501,22193,14665,14798,16158,5491}, + {8,65,4520,17094,23397,4264,22370,16941,21526}, + {8,66,10490,6182,32370,9597,30841,25954,2762}, + {8,67,22120,22865,29870,15147,13668,14955,19235}, + {8,68,6689,18408,18346,9918,25746,5443,20645}, + {8,69,29982,12529,13858,4746,30370,10023,24828}, + {8,70,1262,28032,29888,13063,24033,21951,7863}, + {8,71,6594,29642,31451,14831,9509,9335,31552}, + {8,72,1358,6454,16633,20354,24598,624,5265}, + {8,73,19529,295,18011,3080,13364,8032,15323}, + {8,74,11981,1510,7960,21462,9129,11370,25741}, + {8,75,9276,29656,4543,30699,20646,21921,28050}, + {8,76,15975,25634,5520,31119,13715,21949,19605}, + {8,77,18688,4608,31755,30165,13103,10706,29224}, + {8,78,21514,23117,12245,26035,31656,25631,30699}, + {8,79,9674,24966,31285,29908,17042,24588,31857}, + {8,80,21856,27777,29919,27000,14897,11409,7122}, + {8,81,29773,23310,263,4877,28622,20545,22092}, + {8,82,15605,5651,21864,3967,14419,22757,15896}, + {8,83,30145,1759,10139,29223,26086,10556,5098}, + {8,84,18815,16575,2936,24457,26738,6030,505}, + {8,85,30326,22298,27562,20131,26390,6247,24791}, + {8,86,928,29246,21246,12400,15311,32309,18608}, + {8,87,20314,6025,26689,16302,2296,3244,19613}, + {8,88,6237,11943,22851,15642,23857,15112,20947}, + {8,89,26403,25168,19038,18384,8882,12719,7093}, + {3,0,14567,24965,0,0,0,0,0}, + {3,1,3908,100,0,0,0,0,0}, + {3,2,10279,240,0,0,0,0,0}, + {3,3,24102,764,0,0,0,0,0}, + {3,4,12383,4173,0,0,0,0,0}, + {3,5,13861,15918,0,0,0,0,0}, + {3,6,21327,1046,0,0,0,0,0}, + {3,7,5288,14579,0,0,0,0,0}, + {3,8,28158,8069,0,0,0,0,0}, + {3,9,16583,11098,0,0,0,0,0}, + {3,10,16681,28363,0,0,0,0,0}, + {3,11,13980,24725,0,0,0,0,0}, + {3,12,32169,17989,0,0,0,0,0}, + {3,13,10907,2767,0,0,0,0,0}, + {3,14,21557,3818,0,0,0,0,0}, + {3,15,26676,12422,0,0,0,0,0}, + {3,16,7676,8754,0,0,0,0,0}, + {3,17,14905,20232,0,0,0,0,0}, + {3,18,15719,24646,0,0,0,0,0}, + {3,19,31942,8589,0,0,0,0,0}, + {3,20,19978,27197,0,0,0,0,0}, + {3,21,27060,15071,0,0,0,0,0}, + {3,22,6071,26649,0,0,0,0,0}, + {3,23,10393,11176,0,0,0,0,0}, + {3,24,9597,13370,0,0,0,0,0}, + {3,25,7081,17677,0,0,0,0,0}, + {3,26,1433,19513,0,0,0,0,0}, + {3,27,26925,9014,0,0,0,0,0}, + {3,28,19202,8900,0,0,0,0,0}, + {3,29,18152,30647,0,0,0,0,0}, + {3,30,20803,1737,0,0,0,0,0}, + {3,31,11804,25221,0,0,0,0,0}, + {3,32,31683,17783,0,0,0,0,0}, + {3,33,29694,9345,0,0,0,0,0}, + {3,34,12280,26611,0,0,0,0,0}, + {3,35,6526,26122,0,0,0,0,0}, + {3,36,26165,11241,0,0,0,0,0}, + {3,37,7666,26962,0,0,0,0,0}, + {3,38,16290,8480,0,0,0,0,0}, + {3,39,11774,10120,0,0,0,0,0}, + {3,40,30051,30426,0,0,0,0,0}, + {3,41,1335,15424,0,0,0,0,0}, + {3,42,6865,17742,0,0,0,0,0}, + {3,43,31779,12489,0,0,0,0,0}, + {3,44,32120,21001,0,0,0,0,0}, + {3,45,14508,6996,0,0,0,0,0}, + {3,46,979,25024,0,0,0,0,0}, + {3,47,4554,21896,0,0,0,0,0}, + {3,48,7989,21777,0,0,0,0,0}, + {3,49,4972,20661,0,0,0,0,0}, + {3,50,6612,2730,0,0,0,0,0}, + {3,51,12742,4418,0,0,0,0,0}, + {3,52,29194,595,0,0,0,0,0}, + {3,53,19267,20113,0,0,0,0,0} +}; + +const int DVB2::ldpc_tab_3_5N[108][13]= +{ + {12,22422,10282,11626,19997,11161,2922,3122,99,5625,17064,8270,179}, + {12,25087,16218,17015,828,20041,25656,4186,11629,22599,17305,22515,6463}, + {12,11049,22853,25706,14388,5500,19245,8732,2177,13555,11346,17265,3069}, + {12,16581,22225,12563,19717,23577,11555,25496,6853,25403,5218,15925,21766}, + {12,16529,14487,7643,10715,17442,11119,5679,14155,24213,21000,1116,15620}, + {12,5340,8636,16693,1434,5635,6516,9482,20189,1066,15013,25361,14243}, + {12,18506,22236,20912,8952,5421,15691,6126,21595,500,6904,13059,6802}, + {12,8433,4694,5524,14216,3685,19721,25420,9937,23813,9047,25651,16826}, + {12,21500,24814,6344,17382,7064,13929,4004,16552,12818,8720,5286,2206}, + {12,22517,2429,19065,2921,21611,1873,7507,5661,23006,23128,20543,19777}, + {12,1770,4636,20900,14931,9247,12340,11008,12966,4471,2731,16445,791}, + {12,6635,14556,18865,22421,22124,12697,9803,25485,7744,18254,11313,9004}, + {12,19982,23963,18912,7206,12500,4382,20067,6177,21007,1195,23547,24837}, + {12,756,11158,14646,20534,3647,17728,11676,11843,12937,4402,8261,22944}, + {12,9306,24009,10012,11081,3746,24325,8060,19826,842,8836,2898,5019}, + {12,7575,7455,25244,4736,14400,22981,5543,8006,24203,13053,1120,5128}, + {12,3482,9270,13059,15825,7453,23747,3656,24585,16542,17507,22462,14670}, + {12,15627,15290,4198,22748,5842,13395,23918,16985,14929,3726,25350,24157}, + {12,24896,16365,16423,13461,16615,8107,24741,3604,25904,8716,9604,20365}, + {12,3729,17245,18448,9862,20831,25326,20517,24618,13282,5099,14183,8804}, + {12,16455,17646,15376,18194,25528,1777,6066,21855,14372,12517,4488,17490}, + {12,1400,8135,23375,20879,8476,4084,12936,25536,22309,16582,6402,24360}, + {12,25119,23586,128,4761,10443,22536,8607,9752,25446,15053,1856,4040}, + {12,377,21160,13474,5451,17170,5938,10256,11972,24210,17833,22047,16108}, + {12,13075,9648,24546,13150,23867,7309,19798,2988,16858,4825,23950,15125}, + {12,20526,3553,11525,23366,2452,17626,19265,20172,18060,24593,13255,1552}, + {12,18839,21132,20119,15214,14705,7096,10174,5663,18651,19700,12524,14033}, + {12,4127,2971,17499,16287,22368,21463,7943,18880,5567,8047,23363,6797}, + {12,10651,24471,14325,4081,7258,4949,7044,1078,797,22910,20474,4318}, + {12,21374,13231,22985,5056,3821,23718,14178,9978,19030,23594,8895,25358}, + {12,6199,22056,7749,13310,3999,23697,16445,22636,5225,22437,24153,9442}, + {12,7978,12177,2893,20778,3175,8645,11863,24623,10311,25767,17057,3691}, + {12,20473,11294,9914,22815,2574,8439,3699,5431,24840,21908,16088,18244}, + {12,8208,5755,19059,8541,24924,6454,11234,10492,16406,10831,11436,9649}, + {12,16264,11275,24953,2347,12667,19190,7257,7174,24819,2938,2522,11749}, + {12,3627,5969,13862,1538,23176,6353,2855,17720,2472,7428,573,15036}, + {3,0,18539,18661,0,0,0,0,0,0,0,0,0}, + {3,1,10502,3002,0,0,0,0,0,0,0,0,0}, + {3,2,9368,10761,0,0,0,0,0,0,0,0,0}, + {3,3,12299,7828,0,0,0,0,0,0,0,0,0}, + {3,4,15048,13362,0,0,0,0,0,0,0,0,0}, + {3,5,18444,24640,0,0,0,0,0,0,0,0,0}, + {3,6,20775,19175,0,0,0,0,0,0,0,0,0}, + {3,7,18970,10971,0,0,0,0,0,0,0,0,0}, + {3,8,5329,19982,0,0,0,0,0,0,0,0,0}, + {3,9,11296,18655,0,0,0,0,0,0,0,0,0}, + {3,10,15046,20659,0,0,0,0,0,0,0,0,0}, + {3,11,7300,22140,0,0,0,0,0,0,0,0,0}, + {3,12,22029,14477,0,0,0,0,0,0,0,0,0}, + {3,13,11129,742,0,0,0,0,0,0,0,0,0}, + {3,14,13254,13813,0,0,0,0,0,0,0,0,0}, + {3,15,19234,13273,0,0,0,0,0,0,0,0,0}, + {3,16,6079,21122,0,0,0,0,0,0,0,0,0}, + {3,17,22782,5828,0,0,0,0,0,0,0,0,0}, + {3,18,19775,4247,0,0,0,0,0,0,0,0,0}, + {3,19,1660,19413,0,0,0,0,0,0,0,0,0}, + {3,20,4403,3649,0,0,0,0,0,0,0,0,0}, + {3,21,13371,25851,0,0,0,0,0,0,0,0,0}, + {3,22,22770,21784,0,0,0,0,0,0,0,0,0}, + {3,23,10757,14131,0,0,0,0,0,0,0,0,0}, + {3,24,16071,21617,0,0,0,0,0,0,0,0,0}, + {3,25,6393,3725,0,0,0,0,0,0,0,0,0}, + {3,26,597,19968,0,0,0,0,0,0,0,0,0}, + {3,27,5743,8084,0,0,0,0,0,0,0,0,0}, + {3,28,6770,9548,0,0,0,0,0,0,0,0,0}, + {3,29,4285,17542,0,0,0,0,0,0,0,0,0}, + {3,30,13568,22599,0,0,0,0,0,0,0,0,0}, + {3,31,1786,4617,0,0,0,0,0,0,0,0,0}, + {3,32,23238,11648,0,0,0,0,0,0,0,0,0}, + {3,33,19627,2030,0,0,0,0,0,0,0,0,0}, + {3,34,13601,13458,0,0,0,0,0,0,0,0,0}, + {3,35,13740,17328,0,0,0,0,0,0,0,0,0}, + {3,36,25012,13944,0,0,0,0,0,0,0,0,0}, + {3,37,22513,6687,0,0,0,0,0,0,0,0,0}, + {3,38,4934,12587,0,0,0,0,0,0,0,0,0}, + {3,39,21197,5133,0,0,0,0,0,0,0,0,0}, + {3,40,22705,6938,0,0,0,0,0,0,0,0,0}, + {3,41,7534,24633,0,0,0,0,0,0,0,0,0}, + {3,42,24400,12797,0,0,0,0,0,0,0,0,0}, + {3,43,21911,25712,0,0,0,0,0,0,0,0,0}, + {3,44,12039,1140,0,0,0,0,0,0,0,0,0}, + {3,45,24306,1021,0,0,0,0,0,0,0,0,0}, + {3,46,14012,20747,0,0,0,0,0,0,0,0,0}, + {3,47,11265,15219,0,0,0,0,0,0,0,0,0}, + {3,48,4670,15531,0,0,0,0,0,0,0,0,0}, + {3,49,9417,14359,0,0,0,0,0,0,0,0,0}, + {3,50,2415,6504,0,0,0,0,0,0,0,0,0}, + {3,51,24964,24690,0,0,0,0,0,0,0,0,0}, + {3,52,14443,8816,0,0,0,0,0,0,0,0,0}, + {3,53,6926,1291,0,0,0,0,0,0,0,0,0}, + {3,54,6209,20806,0,0,0,0,0,0,0,0,0}, + {3,55,13915,4079,0,0,0,0,0,0,0,0,0}, + {3,56,24410,13196,0,0,0,0,0,0,0,0,0}, + {3,57,13505,6117,0,0,0,0,0,0,0,0,0}, + {3,58,9869,8220,0,0,0,0,0,0,0,0,0}, + {3,59,1570,6044,0,0,0,0,0,0,0,0,0}, + {3,60,25780,17387,0,0,0,0,0,0,0,0,0}, + {3,61,20671,24913,0,0,0,0,0,0,0,0,0}, + {3,62,24558,20591,0,0,0,0,0,0,0,0,0}, + {3,63,12402,3702,0,0,0,0,0,0,0,0,0}, + {3,64,8314,1357,0,0,0,0,0,0,0,0,0}, + {3,65,20071,14616,0,0,0,0,0,0,0,0,0}, + {3,66,17014,3688,0,0,0,0,0,0,0,0,0}, + {3,67,19837,946,0,0,0,0,0,0,0,0,0}, + {3,68,15195,12136,0,0,0,0,0,0,0,0,0}, + {3,69,7758,22808,0,0,0,0,0,0,0,0,0}, + {3,70,3564,2925,0,0,0,0,0,0,0,0,0}, + {3,71,3434,7769,0,0,0,0,0,0,0,0,0} +}; + +const int DVB2::ldpc_tab_2_3N[120][14]= +{ + {13,0,10491,16043,506,12826,8065,8226,2767,240,18673,9279,10579,20928}, + {13,1,17819,8313,6433,6224,5120,5824,12812,17187,9940,13447,13825,18483}, + {13,2,17957,6024,8681,18628,12794,5915,14576,10970,12064,20437,4455,7151}, + {13,3,19777,6183,9972,14536,8182,17749,11341,5556,4379,17434,15477,18532}, + {13,4,4651,19689,1608,659,16707,14335,6143,3058,14618,17894,20684,5306}, + {13,5,9778,2552,12096,12369,15198,16890,4851,3109,1700,18725,1997,15882}, + {13,6,486,6111,13743,11537,5591,7433,15227,14145,1483,3887,17431,12430}, + {13,7,20647,14311,11734,4180,8110,5525,12141,15761,18661,18441,10569,8192}, + {13,8,3791,14759,15264,19918,10132,9062,10010,12786,10675,9682,19246,5454}, + {13,9,19525,9485,7777,19999,8378,9209,3163,20232,6690,16518,716,7353}, + {13,10,4588,6709,20202,10905,915,4317,11073,13576,16433,368,3508,21171}, + {13,11,14072,4033,19959,12608,631,19494,14160,8249,10223,21504,12395,4322}, + {3,12,13800,14161,0,0,0,0,0,0,0,0,0,0}, + {3,13,2948,9647,0,0,0,0,0,0,0,0,0,0}, + {3,14,14693,16027,0,0,0,0,0,0,0,0,0,0}, + {3,15,20506,11082,0,0,0,0,0,0,0,0,0,0}, + {3,16,1143,9020,0,0,0,0,0,0,0,0,0,0}, + {3,17,13501,4014,0,0,0,0,0,0,0,0,0,0}, + {3,18,1548,2190,0,0,0,0,0,0,0,0,0,0}, + {3,19,12216,21556,0,0,0,0,0,0,0,0,0,0}, + {3,20,2095,19897,0,0,0,0,0,0,0,0,0,0}, + {3,21,4189,7958,0,0,0,0,0,0,0,0,0,0}, + {3,22,15940,10048,0,0,0,0,0,0,0,0,0,0}, + {3,23,515,12614,0,0,0,0,0,0,0,0,0,0}, + {3,24,8501,8450,0,0,0,0,0,0,0,0,0,0}, + {3,25,17595,16784,0,0,0,0,0,0,0,0,0,0}, + {3,26,5913,8495,0,0,0,0,0,0,0,0,0,0}, + {3,27,16394,10423,0,0,0,0,0,0,0,0,0,0}, + {3,28,7409,6981,0,0,0,0,0,0,0,0,0,0}, + {3,29,6678,15939,0,0,0,0,0,0,0,0,0,0}, + {3,30,20344,12987,0,0,0,0,0,0,0,0,0,0}, + {3,31,2510,14588,0,0,0,0,0,0,0,0,0,0}, + {3,32,17918,6655,0,0,0,0,0,0,0,0,0,0}, + {3,33,6703,19451,0,0,0,0,0,0,0,0,0,0}, + {3,34,496,4217,0,0,0,0,0,0,0,0,0,0}, + {3,35,7290,5766,0,0,0,0,0,0,0,0,0,0}, + {3,36,10521,8925,0,0,0,0,0,0,0,0,0,0}, + {3,37,20379,11905,0,0,0,0,0,0,0,0,0,0}, + {3,38,4090,5838,0,0,0,0,0,0,0,0,0,0}, + {3,39,19082,17040,0,0,0,0,0,0,0,0,0,0}, + {3,40,20233,12352,0,0,0,0,0,0,0,0,0,0}, + {3,41,19365,19546,0,0,0,0,0,0,0,0,0,0}, + {3,42,6249,19030,0,0,0,0,0,0,0,0,0,0}, + {3,43,11037,19193,0,0,0,0,0,0,0,0,0,0}, + {3,44,19760,11772,0,0,0,0,0,0,0,0,0,0}, + {3,45,19644,7428,0,0,0,0,0,0,0,0,0,0}, + {3,46,16076,3521,0,0,0,0,0,0,0,0,0,0}, + {3,47,11779,21062,0,0,0,0,0,0,0,0,0,0}, + {3,48,13062,9682,0,0,0,0,0,0,0,0,0,0}, + {3,49,8934,5217,0,0,0,0,0,0,0,0,0,0}, + {3,50,11087,3319,0,0,0,0,0,0,0,0,0,0}, + {3,51,18892,4356,0,0,0,0,0,0,0,0,0,0}, + {3,52,7894,3898,0,0,0,0,0,0,0,0,0,0}, + {3,53,5963,4360,0,0,0,0,0,0,0,0,0,0}, + {3,54,7346,11726,0,0,0,0,0,0,0,0,0,0}, + {3,55,5182,5609,0,0,0,0,0,0,0,0,0,0}, + {3,56,2412,17295,0,0,0,0,0,0,0,0,0,0}, + {3,57,9845,20494,0,0,0,0,0,0,0,0,0,0}, + {3,58,6687,1864,0,0,0,0,0,0,0,0,0,0}, + {3,59,20564,5216,0,0,0,0,0,0,0,0,0,0}, + {3,0,18226,17207,0,0,0,0,0,0,0,0,0,0}, + {3,1,9380,8266,0,0,0,0,0,0,0,0,0,0}, + {3,2,7073,3065,0,0,0,0,0,0,0,0,0,0}, + {3,3,18252,13437,0,0,0,0,0,0,0,0,0,0}, + {3,4,9161,15642,0,0,0,0,0,0,0,0,0,0}, + {3,5,10714,10153,0,0,0,0,0,0,0,0,0,0}, + {3,6,11585,9078,0,0,0,0,0,0,0,0,0,0}, + {3,7,5359,9418,0,0,0,0,0,0,0,0,0,0}, + {3,8,9024,9515,0,0,0,0,0,0,0,0,0,0}, + {3,9,1206,16354,0,0,0,0,0,0,0,0,0,0}, + {3,10,14994,1102,0,0,0,0,0,0,0,0,0,0}, + {3,11,9375,20796,0,0,0,0,0,0,0,0,0,0}, + {3,12,15964,6027,0,0,0,0,0,0,0,0,0,0}, + {3,13,14789,6452,0,0,0,0,0,0,0,0,0,0}, + {3,14,8002,18591,0,0,0,0,0,0,0,0,0,0}, + {3,15,14742,14089,0,0,0,0,0,0,0,0,0,0}, + {3,16,253,3045,0,0,0,0,0,0,0,0,0,0}, + {3,17,1274,19286,0,0,0,0,0,0,0,0,0,0}, + {3,18,14777,2044,0,0,0,0,0,0,0,0,0,0}, + {3,19,13920,9900,0,0,0,0,0,0,0,0,0,0}, + {3,20,452,7374,0,0,0,0,0,0,0,0,0,0}, + {3,21,18206,9921,0,0,0,0,0,0,0,0,0,0}, + {3,22,6131,5414,0,0,0,0,0,0,0,0,0,0}, + {3,23,10077,9726,0,0,0,0,0,0,0,0,0,0}, + {3,24,12045,5479,0,0,0,0,0,0,0,0,0,0}, + {3,25,4322,7990,0,0,0,0,0,0,0,0,0,0}, + {3,26,15616,5550,0,0,0,0,0,0,0,0,0,0}, + {3,27,15561,10661,0,0,0,0,0,0,0,0,0,0}, + {3,28,20718,7387,0,0,0,0,0,0,0,0,0,0}, + {3,29,2518,18804,0,0,0,0,0,0,0,0,0,0}, + {3,30,8984,2600,0,0,0,0,0,0,0,0,0,0}, + {3,31,6516,17909,0,0,0,0,0,0,0,0,0,0}, + {3,32,11148,98,0,0,0,0,0,0,0,0,0,0}, + {3,33,20559,3704,0,0,0,0,0,0,0,0,0,0}, + {3,34,7510,1569,0,0,0,0,0,0,0,0,0,0}, + {3,35,16000,11692,0,0,0,0,0,0,0,0,0,0}, + {3,36,9147,10303,0,0,0,0,0,0,0,0,0,0}, + {3,37,16650,191,0,0,0,0,0,0,0,0,0,0}, + {3,38,15577,18685,0,0,0,0,0,0,0,0,0,0}, + {3,39,17167,20917,0,0,0,0,0,0,0,0,0,0}, + {3,40,4256,3391,0,0,0,0,0,0,0,0,0,0}, + {3,41,20092,17219,0,0,0,0,0,0,0,0,0,0}, + {3,42,9218,5056,0,0,0,0,0,0,0,0,0,0}, + {3,43,18429,8472,0,0,0,0,0,0,0,0,0,0}, + {3,44,12093,20753,0,0,0,0,0,0,0,0,0,0}, + {3,45,16345,12748,0,0,0,0,0,0,0,0,0,0}, + {3,46,16023,11095,0,0,0,0,0,0,0,0,0,0}, + {3,47,5048,17595,0,0,0,0,0,0,0,0,0,0}, + {3,48,18995,4817,0,0,0,0,0,0,0,0,0,0}, + {3,49,16483,3536,0,0,0,0,0,0,0,0,0,0}, + {3,50,1439,16148,0,0,0,0,0,0,0,0,0,0}, + {3,51,3661,3039,0,0,0,0,0,0,0,0,0,0}, + {3,52,19010,18121,0,0,0,0,0,0,0,0,0,0}, + {3,53,8968,11793,0,0,0,0,0,0,0,0,0,0}, + {3,54,13427,18003,0,0,0,0,0,0,0,0,0,0}, + {3,55,5303,3083,0,0,0,0,0,0,0,0,0,0}, + {3,56,531,16668,0,0,0,0,0,0,0,0,0,0}, + {3,57,4771,6722,0,0,0,0,0,0,0,0,0,0}, + {3,58,5695,7960,0,0,0,0,0,0,0,0,0,0}, + {3,59,3589,14630,0,0,0,0,0,0,0,0,0,0} +}; + +const int DVB2::ldpc_tab_3_4N[135][13]= +{ + {12,0,6385,7901,14611,13389,11200,3252,5243,2504,2722,821,7374}, + {12,1,11359,2698,357,13824,12772,7244,6752,15310,852,2001,11417}, + {12,2,7862,7977,6321,13612,12197,14449,15137,13860,1708,6399,13444}, + {12,3,1560,11804,6975,13292,3646,3812,8772,7306,5795,14327,7866}, + {12,4,7626,11407,14599,9689,1628,2113,10809,9283,1230,15241,4870}, + {12,5,1610,5699,15876,9446,12515,1400,6303,5411,14181,13925,7358}, + {12,6,4059,8836,3405,7853,7992,15336,5970,10368,10278,9675,4651}, + {12,7,4441,3963,9153,2109,12683,7459,12030,12221,629,15212,406}, + {12,8,6007,8411,5771,3497,543,14202,875,9186,6235,13908,3563}, + {12,9,3232,6625,4795,546,9781,2071,7312,3399,7250,4932,12652}, + {12,10,8820,10088,11090,7069,6585,13134,10158,7183,488,7455,9238}, + {12,11,1903,10818,119,215,7558,11046,10615,11545,14784,7961,15619}, + {12,12,3655,8736,4917,15874,5129,2134,15944,14768,7150,2692,1469}, + {12,13,8316,3820,505,8923,6757,806,7957,4216,15589,13244,2622}, + {12,14,14463,4852,15733,3041,11193,12860,13673,8152,6551,15108,8758}, + {3,15,3149,11981,0,0,0,0,0,0,0,0,0}, + {3,16,13416,6906,0,0,0,0,0,0,0,0,0}, + {3,17,13098,13352,0,0,0,0,0,0,0,0,0}, + {3,18,2009,14460,0,0,0,0,0,0,0,0,0}, + {3,19,7207,4314,0,0,0,0,0,0,0,0,0}, + {3,20,3312,3945,0,0,0,0,0,0,0,0,0}, + {3,21,4418,6248,0,0,0,0,0,0,0,0,0}, + {3,22,2669,13975,0,0,0,0,0,0,0,0,0}, + {3,23,7571,9023,0,0,0,0,0,0,0,0,0}, + {3,24,14172,2967,0,0,0,0,0,0,0,0,0}, + {3,25,7271,7138,0,0,0,0,0,0,0,0,0}, + {3,26,6135,13670,0,0,0,0,0,0,0,0,0}, + {3,27,7490,14559,0,0,0,0,0,0,0,0,0}, + {3,28,8657,2466,0,0,0,0,0,0,0,0,0}, + {3,29,8599,12834,0,0,0,0,0,0,0,0,0}, + {3,30,3470,3152,0,0,0,0,0,0,0,0,0}, + {3,31,13917,4365,0,0,0,0,0,0,0,0,0}, + {3,32,6024,13730,0,0,0,0,0,0,0,0,0}, + {3,33,10973,14182,0,0,0,0,0,0,0,0,0}, + {3,34,2464,13167,0,0,0,0,0,0,0,0,0}, + {3,35,5281,15049,0,0,0,0,0,0,0,0,0}, + {3,36,1103,1849,0,0,0,0,0,0,0,0,0}, + {3,37,2058,1069,0,0,0,0,0,0,0,0,0}, + {3,38,9654,6095,0,0,0,0,0,0,0,0,0}, + {3,39,14311,7667,0,0,0,0,0,0,0,0,0}, + {3,40,15617,8146,0,0,0,0,0,0,0,0,0}, + {3,41,4588,11218,0,0,0,0,0,0,0,0,0}, + {3,42,13660,6243,0,0,0,0,0,0,0,0,0}, + {3,43,8578,7874,0,0,0,0,0,0,0,0,0}, + {3,44,11741,2686,0,0,0,0,0,0,0,0,0}, + {3,0,1022,1264,0,0,0,0,0,0,0,0,0}, + {3,1,12604,9965,0,0,0,0,0,0,0,0,0}, + {3,2,8217,2707,0,0,0,0,0,0,0,0,0}, + {3,3,3156,11793,0,0,0,0,0,0,0,0,0}, + {3,4,354,1514,0,0,0,0,0,0,0,0,0}, + {3,5,6978,14058,0,0,0,0,0,0,0,0,0}, + {3,6,7922,16079,0,0,0,0,0,0,0,0,0}, + {3,7,15087,12138,0,0,0,0,0,0,0,0,0}, + {3,8,5053,6470,0,0,0,0,0,0,0,0,0}, + {3,9,12687,14932,0,0,0,0,0,0,0,0,0}, + {3,10,15458,1763,0,0,0,0,0,0,0,0,0}, + {3,11,8121,1721,0,0,0,0,0,0,0,0,0}, + {3,12,12431,549,0,0,0,0,0,0,0,0,0}, + {3,13,4129,7091,0,0,0,0,0,0,0,0,0}, + {3,14,1426,8415,0,0,0,0,0,0,0,0,0}, + {3,15,9783,7604,0,0,0,0,0,0,0,0,0}, + {3,16,6295,11329,0,0,0,0,0,0,0,0,0}, + {3,17,1409,12061,0,0,0,0,0,0,0,0,0}, + {3,18,8065,9087,0,0,0,0,0,0,0,0,0}, + {3,19,2918,8438,0,0,0,0,0,0,0,0,0}, + {3,20,1293,14115,0,0,0,0,0,0,0,0,0}, + {3,21,3922,13851,0,0,0,0,0,0,0,0,0}, + {3,22,3851,4000,0,0,0,0,0,0,0,0,0}, + {3,23,5865,1768,0,0,0,0,0,0,0,0,0}, + {3,24,2655,14957,0,0,0,0,0,0,0,0,0}, + {3,25,5565,6332,0,0,0,0,0,0,0,0,0}, + {3,26,4303,12631,0,0,0,0,0,0,0,0,0}, + {3,27,11653,12236,0,0,0,0,0,0,0,0,0}, + {3,28,16025,7632,0,0,0,0,0,0,0,0,0}, + {3,29,4655,14128,0,0,0,0,0,0,0,0,0}, + {3,30,9584,13123,0,0,0,0,0,0,0,0,0}, + {3,31,13987,9597,0,0,0,0,0,0,0,0,0}, + {3,32,15409,12110,0,0,0,0,0,0,0,0,0}, + {3,33,8754,15490,0,0,0,0,0,0,0,0,0}, + {3,34,7416,15325,0,0,0,0,0,0,0,0,0}, + {3,35,2909,15549,0,0,0,0,0,0,0,0,0}, + {3,36,2995,8257,0,0,0,0,0,0,0,0,0}, + {3,37,9406,4791,0,0,0,0,0,0,0,0,0}, + {3,38,11111,4854,0,0,0,0,0,0,0,0,0}, + {3,39,2812,8521,0,0,0,0,0,0,0,0,0}, + {3,40,8476,14717,0,0,0,0,0,0,0,0,0}, + {3,41,7820,15360,0,0,0,0,0,0,0,0,0}, + {3,42,1179,7939,0,0,0,0,0,0,0,0,0}, + {3,43,2357,8678,0,0,0,0,0,0,0,0,0}, + {3,44,7703,6216,0,0,0,0,0,0,0,0,0}, + {3,0,3477,7067,0,0,0,0,0,0,0,0,0}, + {3,1,3931,13845,0,0,0,0,0,0,0,0,0}, + {3,2,7675,12899,0,0,0,0,0,0,0,0,0}, + {3,3,1754,8187,0,0,0,0,0,0,0,0,0}, + {3,4,7785,1400,0,0,0,0,0,0,0,0,0}, + {3,5,9213,5891,0,0,0,0,0,0,0,0,0}, + {3,6,2494,7703,0,0,0,0,0,0,0,0,0}, + {3,7,2576,7902,0,0,0,0,0,0,0,0,0}, + {3,8,4821,15682,0,0,0,0,0,0,0,0,0}, + {3,9,10426,11935,0,0,0,0,0,0,0,0,0}, + {3,10,1810,904,0,0,0,0,0,0,0,0,0}, + {3,11,11332,9264,0,0,0,0,0,0,0,0,0}, + {3,12,11312,3570,0,0,0,0,0,0,0,0,0}, + {3,13,14916,2650,0,0,0,0,0,0,0,0,0}, + {3,14,7679,7842,0,0,0,0,0,0,0,0,0}, + {3,15,6089,13084,0,0,0,0,0,0,0,0,0}, + {3,16,3938,2751,0,0,0,0,0,0,0,0,0}, + {3,17,8509,4648,0,0,0,0,0,0,0,0,0}, + {3,18,12204,8917,0,0,0,0,0,0,0,0,0}, + {3,19,5749,12443,0,0,0,0,0,0,0,0,0}, + {3,20,12613,4431,0,0,0,0,0,0,0,0,0}, + {3,21,1344,4014,0,0,0,0,0,0,0,0,0}, + {3,22,8488,13850,0,0,0,0,0,0,0,0,0}, + {3,23,1730,14896,0,0,0,0,0,0,0,0,0}, + {3,24,14942,7126,0,0,0,0,0,0,0,0,0}, + {3,25,14983,8863,0,0,0,0,0,0,0,0,0}, + {3,26,6578,8564,0,0,0,0,0,0,0,0,0}, + {3,27,4947,396,0,0,0,0,0,0,0,0,0}, + {3,28,297,12805,0,0,0,0,0,0,0,0,0}, + {3,29,13878,6692,0,0,0,0,0,0,0,0,0}, + {3,30,11857,11186,0,0,0,0,0,0,0,0,0}, + {3,31,14395,11493,0,0,0,0,0,0,0,0,0}, + {3,32,16145,12251,0,0,0,0,0,0,0,0,0}, + {3,33,13462,7428,0,0,0,0,0,0,0,0,0}, + {3,34,14526,13119,0,0,0,0,0,0,0,0,0}, + {3,35,2535,11243,0,0,0,0,0,0,0,0,0}, + {3,36,6465,12690,0,0,0,0,0,0,0,0,0}, + {3,37,6872,9334,0,0,0,0,0,0,0,0,0}, + {3,38,15371,14023,0,0,0,0,0,0,0,0,0}, + {3,39,8101,10187,0,0,0,0,0,0,0,0,0}, + {3,40,11963,4848,0,0,0,0,0,0,0,0,0}, + {3,41,15125,6119,0,0,0,0,0,0,0,0,0}, + {3,42,8051,14465,0,0,0,0,0,0,0,0,0}, + {3,43,11139,5167,0,0,0,0,0,0,0,0,0}, + {3,44,2883,14521,0,0,0,0,0,0,0,0,0} +}; + +const int DVB2::ldpc_tab_4_5N[144][12]= +{ + {11,0,149,11212,5575,6360,12559,8108,8505,408,10026,12828}, + {11,1,5237,490,10677,4998,3869,3734,3092,3509,7703,10305}, + {11,2,8742,5553,2820,7085,12116,10485,564,7795,2972,2157}, + {11,3,2699,4304,8350,712,2841,3250,4731,10105,517,7516}, + {11,4,12067,1351,11992,12191,11267,5161,537,6166,4246,2363}, + {11,5,6828,7107,2127,3724,5743,11040,10756,4073,1011,3422}, + {11,6,11259,1216,9526,1466,10816,940,3744,2815,11506,11573}, + {11,7,4549,11507,1118,1274,11751,5207,7854,12803,4047,6484}, + {11,8,8430,4115,9440,413,4455,2262,7915,12402,8579,7052}, + {11,9,3885,9126,5665,4505,2343,253,4707,3742,4166,1556}, + {11,10,1704,8936,6775,8639,8179,7954,8234,7850,8883,8713}, + {11,11,11716,4344,9087,11264,2274,8832,9147,11930,6054,5455}, + {11,12,7323,3970,10329,2170,8262,3854,2087,12899,9497,11700}, + {11,13,4418,1467,2490,5841,817,11453,533,11217,11962,5251}, + {11,14,1541,4525,7976,3457,9536,7725,3788,2982,6307,5997}, + {11,15,11484,2739,4023,12107,6516,551,2572,6628,8150,9852}, + {11,16,6070,1761,4627,6534,7913,3730,11866,1813,12306,8249}, + {11,17,12441,5489,8748,7837,7660,2102,11341,2936,6712,11977}, + {3,18,10155,4210,0,0,0,0,0,0,0,0}, + {3,19,1010,10483,0,0,0,0,0,0,0,0}, + {3,20,8900,10250,0,0,0,0,0,0,0,0}, + {3,21,10243,12278,0,0,0,0,0,0,0,0}, + {3,22,7070,4397,0,0,0,0,0,0,0,0}, + {3,23,12271,3887,0,0,0,0,0,0,0,0}, + {3,24,11980,6836,0,0,0,0,0,0,0,0}, + {3,25,9514,4356,0,0,0,0,0,0,0,0}, + {3,26,7137,10281,0,0,0,0,0,0,0,0}, + {3,27,11881,2526,0,0,0,0,0,0,0,0}, + {3,28,1969,11477,0,0,0,0,0,0,0,0}, + {3,29,3044,10921,0,0,0,0,0,0,0,0}, + {3,30,2236,8724,0,0,0,0,0,0,0,0}, + {3,31,9104,6340,0,0,0,0,0,0,0,0}, + {3,32,7342,8582,0,0,0,0,0,0,0,0}, + {3,33,11675,10405,0,0,0,0,0,0,0,0}, + {3,34,6467,12775,0,0,0,0,0,0,0,0}, + {3,35,3186,12198,0,0,0,0,0,0,0,0}, + {3,0,9621,11445,0,0,0,0,0,0,0,0}, + {3,1,7486,5611,0,0,0,0,0,0,0,0}, + {3,2,4319,4879,0,0,0,0,0,0,0,0}, + {3,3,2196,344,0,0,0,0,0,0,0,0}, + {3,4,7527,6650,0,0,0,0,0,0,0,0}, + {3,5,10693,2440,0,0,0,0,0,0,0,0}, + {3,6,6755,2706,0,0,0,0,0,0,0,0}, + {3,7,5144,5998,0,0,0,0,0,0,0,0}, + {3,8,11043,8033,0,0,0,0,0,0,0,0}, + {3,9,4846,4435,0,0,0,0,0,0,0,0}, + {3,10,4157,9228,0,0,0,0,0,0,0,0}, + {3,11,12270,6562,0,0,0,0,0,0,0,0}, + {3,12,11954,7592,0,0,0,0,0,0,0,0}, + {3,13,7420,2592,0,0,0,0,0,0,0,0}, + {3,14,8810,9636,0,0,0,0,0,0,0,0}, + {3,15,689,5430,0,0,0,0,0,0,0,0}, + {3,16,920,1304,0,0,0,0,0,0,0,0}, + {3,17,1253,11934,0,0,0,0,0,0,0,0}, + {3,18,9559,6016,0,0,0,0,0,0,0,0}, + {3,19,312,7589,0,0,0,0,0,0,0,0}, + {3,20,4439,4197,0,0,0,0,0,0,0,0}, + {3,21,4002,9555,0,0,0,0,0,0,0,0}, + {3,22,12232,7779,0,0,0,0,0,0,0,0}, + {3,23,1494,8782,0,0,0,0,0,0,0,0}, + {3,24,10749,3969,0,0,0,0,0,0,0,0}, + {3,25,4368,3479,0,0,0,0,0,0,0,0}, + {3,26,6316,5342,0,0,0,0,0,0,0,0}, + {3,27,2455,3493,0,0,0,0,0,0,0,0}, + {3,28,12157,7405,0,0,0,0,0,0,0,0}, + {3,29,6598,11495,0,0,0,0,0,0,0,0}, + {3,30,11805,4455,0,0,0,0,0,0,0,0}, + {3,31,9625,2090,0,0,0,0,0,0,0,0}, + {3,32,4731,2321,0,0,0,0,0,0,0,0}, + {3,33,3578,2608,0,0,0,0,0,0,0,0}, + {3,34,8504,1849,0,0,0,0,0,0,0,0}, + {3,35,4027,1151,0,0,0,0,0,0,0,0}, + {3,0,5647,4935,0,0,0,0,0,0,0,0}, + {3,1,4219,1870,0,0,0,0,0,0,0,0}, + {3,2,10968,8054,0,0,0,0,0,0,0,0}, + {3,3,6970,5447,0,0,0,0,0,0,0,0}, + {3,4,3217,5638,0,0,0,0,0,0,0,0}, + {3,5,8972,669,0,0,0,0,0,0,0,0}, + {3,6,5618,12472,0,0,0,0,0,0,0,0}, + {3,7,1457,1280,0,0,0,0,0,0,0,0}, + {3,8,8868,3883,0,0,0,0,0,0,0,0}, + {3,9,8866,1224,0,0,0,0,0,0,0,0}, + {3,10,8371,5972,0,0,0,0,0,0,0,0}, + {3,11,266,4405,0,0,0,0,0,0,0,0}, + {3,12,3706,3244,0,0,0,0,0,0,0,0}, + {3,13,6039,5844,0,0,0,0,0,0,0,0}, + {3,14,7200,3283,0,0,0,0,0,0,0,0}, + {3,15,1502,11282,0,0,0,0,0,0,0,0}, + {3,16,12318,2202,0,0,0,0,0,0,0,0}, + {3,17,4523,965,0,0,0,0,0,0,0,0}, + {3,18,9587,7011,0,0,0,0,0,0,0,0}, + {3,19,2552,2051,0,0,0,0,0,0,0,0}, + {3,20,12045,10306,0,0,0,0,0,0,0,0}, + {3,21,11070,5104,0,0,0,0,0,0,0,0}, + {3,22,6627,6906,0,0,0,0,0,0,0,0}, + {3,23,9889,2121,0,0,0,0,0,0,0,0}, + {3,24,829,9701,0,0,0,0,0,0,0,0}, + {3,25,2201,1819,0,0,0,0,0,0,0,0}, + {3,26,6689,12925,0,0,0,0,0,0,0,0}, + {3,27,2139,8757,0,0,0,0,0,0,0,0}, + {3,28,12004,5948,0,0,0,0,0,0,0,0}, + {3,29,8704,3191,0,0,0,0,0,0,0,0}, + {3,30,8171,10933,0,0,0,0,0,0,0,0}, + {3,31,6297,7116,0,0,0,0,0,0,0,0}, + {3,32,616,7146,0,0,0,0,0,0,0,0}, + {3,33,5142,9761,0,0,0,0,0,0,0,0}, + {3,34,10377,8138,0,0,0,0,0,0,0,0}, + {3,35,7616,5811,0,0,0,0,0,0,0,0}, + {3,0,7285,9863,0,0,0,0,0,0,0,0}, + {3,1,7764,10867,0,0,0,0,0,0,0,0}, + {3,2,12343,9019,0,0,0,0,0,0,0,0}, + {3,3,4414,8331,0,0,0,0,0,0,0,0}, + {3,4,3464,642,0,0,0,0,0,0,0,0}, + {3,5,6960,2039,0,0,0,0,0,0,0,0}, + {3,6,786,3021,0,0,0,0,0,0,0,0}, + {3,7,710,2086,0,0,0,0,0,0,0,0}, + {3,8,7423,5601,0,0,0,0,0,0,0,0}, + {3,9,8120,4885,0,0,0,0,0,0,0,0}, + {3,10,12385,11990,0,0,0,0,0,0,0,0}, + {3,11,9739,10034,0,0,0,0,0,0,0,0}, + {3,12,424,10162,0,0,0,0,0,0,0,0}, + {3,13,1347,7597,0,0,0,0,0,0,0,0}, + {3,14,1450,112,0,0,0,0,0,0,0,0}, + {3,15,7965,8478,0,0,0,0,0,0,0,0}, + {3,16,8945,7397,0,0,0,0,0,0,0,0}, + {3,17,6590,8316,0,0,0,0,0,0,0,0}, + {3,18,6838,9011,0,0,0,0,0,0,0,0}, + {3,19,6174,9410,0,0,0,0,0,0,0,0}, + {3,20,255,113,0,0,0,0,0,0,0,0}, + {3,21,6197,5835,0,0,0,0,0,0,0,0}, + {3,22,12902,3844,0,0,0,0,0,0,0,0}, + {3,23,4377,3505,0,0,0,0,0,0,0,0}, + {3,24,5478,8672,0,0,0,0,0,0,0,0}, + {3,25,4453,2132,0,0,0,0,0,0,0,0}, + {3,26,9724,1380,0,0,0,0,0,0,0,0}, + {3,27,12131,11526,0,0,0,0,0,0,0,0}, + {3,28,12323,9511,0,0,0,0,0,0,0,0}, + {3,29,8231,1752,0,0,0,0,0,0,0,0}, + {3,30,497,9022,0,0,0,0,0,0,0,0}, + {3,31,9288,3080,0,0,0,0,0,0,0,0}, + {3,32,2481,7515,0,0,0,0,0,0,0,0}, + {3,33,2696,268,0,0,0,0,0,0,0,0}, + {3,34,4023,12341,0,0,0,0,0,0,0,0}, + {3,35,7108,5553,0,0,0,0,0,0,0,0} +}; + +const int DVB2::ldpc_tab_5_6N[150][14]= +{ + {13,0,4362,416,8909,4156,3216,3112,2560,2912,6405,8593,4969,6723}, + {13,1,2479,1786,8978,3011,4339,9313,6397,2957,7288,5484,6031,10217}, + {13,2,10175,9009,9889,3091,4985,7267,4092,8874,5671,2777,2189,8716}, + {13,3,9052,4795,3924,3370,10058,1128,9996,10165,9360,4297,434,5138}, + {13,4,2379,7834,4835,2327,9843,804,329,8353,7167,3070,1528,7311}, + {13,5,3435,7871,348,3693,1876,6585,10340,7144,5870,2084,4052,2780}, + {13,6,3917,3111,3476,1304,10331,5939,5199,1611,1991,699,8316,9960}, + {13,7,6883,3237,1717,10752,7891,9764,4745,3888,10009,4176,4614,1567}, + {13,8,10587,2195,1689,2968,5420,2580,2883,6496,111,6023,1024,4449}, + {13,9,3786,8593,2074,3321,5057,1450,3840,5444,6572,3094,9892,1512}, + {13,10,8548,1848,10372,4585,7313,6536,6379,1766,9462,2456,5606,9975}, + {13,11,8204,10593,7935,3636,3882,394,5968,8561,2395,7289,9267,9978}, + {13,12,7795,74,1633,9542,6867,7352,6417,7568,10623,725,2531,9115}, + {13,13,7151,2482,4260,5003,10105,7419,9203,6691,8798,2092,8263,3755}, + {13,14,3600,570,4527,200,9718,6771,1995,8902,5446,768,1103,6520}, + {3,15,6304,7621,0,0,0,0,0,0,0,0,0,0}, + {3,16,6498,9209,0,0,0,0,0,0,0,0,0,0}, + {3,17,7293,6786,0,0,0,0,0,0,0,0,0,0}, + {3,18,5950,1708,0,0,0,0,0,0,0,0,0,0}, + {3,19,8521,1793,0,0,0,0,0,0,0,0,0,0}, + {3,20,6174,7854,0,0,0,0,0,0,0,0,0,0}, + {3,21,9773,1190,0,0,0,0,0,0,0,0,0,0}, + {3,22,9517,10268,0,0,0,0,0,0,0,0,0,0}, + {3,23,2181,9349,0,0,0,0,0,0,0,0,0,0}, + {3,24,1949,5560,0,0,0,0,0,0,0,0,0,0}, + {3,25,1556,555,0,0,0,0,0,0,0,0,0,0}, + {3,26,8600,3827,0,0,0,0,0,0,0,0,0,0}, + {3,27,5072,1057,0,0,0,0,0,0,0,0,0,0}, + {3,28,7928,3542,0,0,0,0,0,0,0,0,0,0}, + {3,29,3226,3762,0,0,0,0,0,0,0,0,0,0}, + {3,0,7045,2420,0,0,0,0,0,0,0,0,0,0}, + {3,1,9645,2641,0,0,0,0,0,0,0,0,0}, + {3,2,2774,2452,0,0,0,0,0,0,0,0,0,0}, + {3,3,5331,2031,0,0,0,0,0,0,0,0,0,0}, + {3,4,9400,7503,0,0,0,0,0,0,0,0,0,0}, + {3,5,1850,2338,0,0,0,0,0,0,0,0,0,0}, + {3,6,10456,9774,0,0,0,0,0,0,0,0,0,0}, + {3,7,1692,9276,0,0,0,0,0,0,0,0,0,0}, + {3,8,10037,4038,0,0,0,0,0,0,0,0,0,0}, + {3,9,3964,338,0,0,0,0,0,0,0,0,0,0}, + {3,10,2640,5087,0,0,0,0,0,0,0,0,0,0}, + {3,11,858,3473,0,0,0,0,0,0,0,0,0,0}, + {3,12,5582,5683,0,0,0,0,0,0,0,0,0,0}, + {3,13,9523,916,0,0,0,0,0,0,0,0,0,0}, + {3,14,4107,1559,0,0,0,0,0,0,0,0,0,0}, + {3,15,4506,3491,0,0,0,0,0,0,0,0,0,0}, + {3,16,8191,4182,0,0,0,0,0,0,0,0,0,0}, + {3,17,10192,6157,0,0,0,0,0,0,0,0,0,0}, + {3,18,5668,3305,0,0,0,0,0,0,0,0,0,0}, + {3,19,3449,1540,0,0,0,0,0,0,0,0,0,0}, + {3,20,4766,2697,0,0,0,0,0,0,0,0,0,0}, + {3,21,4069,6675,0,0,0,0,0,0,0,0,0,0}, + {3,22,1117,1016,0,0,0,0,0,0,0,0,0,0}, + {3,23,5619,3085,0,0,0,0,0,0,0,0,0,0}, + {3,24,8483,8400,0,0,0,0,0,0,0,0,0,0}, + {3,25,8255,394,0,0,0,0,0,0,0,0,0,0}, + {3,26,6338,5042,0,0,0,0,0,0,0,0,0,0}, + {3,27,6174,5119,0,0,0,0,0,0,0,0,0,0}, + {3,28,7203,1989,0,0,0,0,0,0,0,0,0,0}, + {3,29,1781,5174,0,0,0,0,0,0,0,0,0,0}, + {3,0,1464,3559,0,0,0,0,0,0,0,0,0,0}, + {3,1,3376,4214,0,0,0,0,0,0,0,0,0,0}, + {3,2,7238,67,0,0,0,0,0,0,0,0,0,0}, + {3,3,10595,8831,0,0,0,0,0,0,0,0,0,0}, + {3,4,1221,6513,0,0,0,0,0,0,0,0,0,0}, + {3,5,5300,4652,0,0,0,0,0,0,0,0,0,0}, + {3,6,1429,9749,0,0,0,0,0,0,0,0,0,0}, + {3,7,7878,5131,0,0,0,0,0,0,0,0,0,0}, + {3,8,4435,10284,0,0,0,0,0,0,0,0,0,0}, + {3,9,6331,5507,0,0,0,0,0,0,0,0,0,0}, + {3,10,6662,4941,0,0,0,0,0,0,0,0,0,0}, + {3,11,9614,10238,0,0,0,0,0,0,0,0,0,0}, + {3,12,8400,8025,0,0,0,0,0,0,0,0,0,0}, + {3,13,9156,5630,0,0,0,0,0,0,0,0,0,0}, + {3,14,7067,8878,0,0,0,0,0,0,0,0,0,0}, + {3,15,9027,3415,0,0,0,0,0,0,0,0,0,0}, + {3,16,1690,3866,0,0,0,0,0,0,0,0,0,0}, + {3,17,2854,8469,0,0,0,0,0,0,0,0,0,0}, + {3,18,6206,630,0,0,0,0,0,0,0,0,0,0}, + {3,19,363,5453,0,0,0,0,0,0,0,0,0,0}, + {3,20,4125,7008,0,0,0,0,0,0,0,0,0,0}, + {3,21,1612,6702,0,0,0,0,0,0,0,0,0,0}, + {3,22,9069,9226,0,0,0,0,0,0,0,0,0,0}, + {3,23,5767,4060,0,0,0,0,0,0,0,0,0,0}, + {3,24,3743,9237,0,0,0,0,0,0,0,0,0,0}, + {3,25,7018,5572,0,0,0,0,0,0,0,0,0,0}, + {3,26,8892,4536,0,0,0,0,0,0,0,0,0,0}, + {3,27,853,6064,0,0,0,0,0,0,0,0,0,0}, + {3,28,8069,5893,0,0,0,0,0,0,0,0,0,0}, + {3,29,2051,2885,0,0,0,0,0,0,0,0,0,0}, + {3,0,10691,3153,0,0,0,0,0,0,0,0,0,0}, + {3,1,3602,4055,0,0,0,0,0,0,0,0,0,0}, + {3,2,328,1717,0,0,0,0,0,0,0,0,0,0}, + {3,3,2219,9299,0,0,0,0,0,0,0,0,0,0}, + {3,4,1939,7898,0,0,0,0,0,0,0,0,0,0}, + {3,5,617,206,0,0,0,0,0,0,0,0,0,0}, + {3,6,8544,1374,0,0,0,0,0,0,0,0,0,0}, + {3,7,10676,3240,0,0,0,0,0,0,0,0,0,0}, + {3,8,6672,9489,0,0,0,0,0,0,0,0,0,0}, + {3,9,3170,7457,0,0,0,0,0,0,0,0,0,0}, + {3,10,7868,5731,0,0,0,0,0,0,0,0,0,0}, + {3,11,6121,10732,0,0,0,0,0,0,0,0,0,0}, + {3,12,4843,9132,0,0,0,0,0,0,0,0,0,0}, + {3,13,580,9591,0,0,0,0,0,0,0,0,0,0}, + {3,14,6267,9290,0,0,0,0,0,0,0,0,0,0}, + {3,15,3009,2268,0,0,0,0,0,0,0,0,0,0}, + {3,16,195,2419,0,0,0,0,0,0,0,0,0,0}, + {3,17,8016,1557,0,0,0,0,0,0,0,0,0,0}, + {3,18,1516,9195,0,0,0,0,0,0,0,0,0,0}, + {3,19,8062,9064,0,0,0,0,0,0,0,0,0,0}, + {3,20,2095,8968,0,0,0,0,0,0,0,0,0,0}, + {3,21,753,7326,0,0,0,0,0,0,0,0,0,0}, + {3,22,6291,3833,0,0,0,0,0,0,0,0,0,0}, + {3,23,2614,7844,0,0,0,0,0,0,0,0,0,0}, + {3,24,2303,646,0,0,0,0,0,0,0,0,0,0}, + {3,25,2075,611,0,0,0,0,0,0,0,0,0,0}, + {3,26,4687,362,0,0,0,0,0,0,0,0,0,0}, + {3,27,8684,9940,0,0,0,0,0,0,0,0,0,0}, + {3,28,4830,2065,0,0,0,0,0,0,0,0,0,0}, + {3,29,7038,1363,0,0,0,0,0,0,0,0,0,0}, + {3,0,1769,7837,0,0,0,0,0,0,0,0,0,0}, + {3,1,3801,1689,0,0,0,0,0,0,0,0,0,0}, + {3,2,10070,2359,0,0,0,0,0,0,0,0,0,0}, + {3,3,3667,9918,0,0,0,0,0,0,0,0,0,0}, + {3,4,1914,6920,0,0,0,0,0,0,0,0,0,0}, + {3,5,4244,5669,0,0,0,0,0,0,0,0,0,0}, + {3,6,10245,7821,0,0,0,0,0,0,0,0,0,0}, + {3,7,7648,3944,0,0,0,0,0,0,0,0,0,0}, + {3,8,3310,5488,0,0,0,0,0,0,0,0,0,0}, + {3,9,6346,9666,0,0,0,0,0,0,0,0,0,0}, + {3,10,7088,6122,0,0,0,0,0,0,0,0,0,0}, + {3,11,1291,7827,0,0,0,0,0,0,0,0,0,0}, + {3,12,10592,8945,0,0,0,0,0,0,0,0,0,0}, + {3,13,3609,7120,0,0,0,0,0,0,0,0,0,0}, + {3,14,9168,9112,0,0,0,0,0,0,0,0,0,0}, + {3,15,6203,8052,0,0,0,0,0,0,0,0,0,0}, + {3,16,3330,2895,0,0,0,0,0,0,0,0,0,0}, + {3,17,4264,10563,0,0,0,0,0,0,0,0,0,0}, + {3,18,10556,6496,0,0,0,0,0,0,0,0,0,0}, + {3,19,8807,7645,0,0,0,0,0,0,0,0,0,0}, + {3,20,1999,4530,0,0,0,0,0,0,0,0,0,0}, + {3,21,9202,6818,0,0,0,0,0,0,0,0,0,0}, + {3,22,3403,1734,0,0,0,0,0,0,0,0,0,0}, + {3,23,2106,9023,0,0,0,0,0,0,0,0,0,0}, + {3,24,6881,3883,0,0,0,0,0,0,0,0,0,0}, + {3,25,3895,2171,0,0,0,0,0,0,0,0,0,0}, + {3,26,4062,6424,0,0,0,0,0,0,0,0,0,0}, + {3,27,3755,9536,0,0,0,0,0,0,0,0,0,0}, + {3,28,4683,2131,0,0,0,0,0,0,0,0,0,0}, + {3,29,7347,8027,0,0,0,0,0,0,0,0,0,0} +}; + +const int DVB2::ldpc_tab_8_9N[160][5]= +{ + {4,0,6235,2848,3222}, + {4,1,5800,3492,5348}, + {4,2,2757,927,90}, + {4,3,6961,4516,4739}, + {4,4,1172,3237,6264}, + {4,5,1927,2425,3683}, + {4,6,3714,6309,2495}, + {4,7,3070,6342,7154}, + {4,8,2428,613,3761}, + {4,9,2906,264,5927}, + {4,10,1716,1950,4273}, + {4,11,4613,6179,3491}, + {4,12,4865,3286,6005}, + {4,13,1343,5923,3529}, + {4,14,4589,4035,2132}, + {4,15,1579,3920,6737}, + {4,16,1644,1191,5998}, + {4,17,1482,2381,4620}, + {4,18,6791,6014,6596}, + {4,19,2738,5918,3786}, + {3,0,5156,6166,0}, + {3,1,1504,4356,0}, + {3,2,130,1904,0}, + {3,3,6027,3187,0}, + {3,4,6718,759,0}, + {3,5,6240,2870,0}, + {3,6,2343,1311,0}, + {3,7,1039,5465,0}, + {3,8,6617,2513,0}, + {3,9,1588,5222,0}, + {3,10,6561,535,0}, + {3,11,4765,2054,0}, + {3,12,5966,6892,0}, + {3,13,1969,3869,0}, + {3,14,3571,2420,0}, + {3,15,4632,981,0}, + {3,16,3215,4163,0}, + {3,17,973,3117,0}, + {3,18,3802,6198,0}, + {3,19,3794,3948,0}, + {3,0,3196,6126,0}, + {3,1,573,1909,0}, + {3,2,850,4034,0}, + {3,3,5622,1601,0}, + {3,4,6005,524,0}, + {3,5,5251,5783,0}, + {3,6,172,2032,0}, + {3,7,1875,2475,0}, + {3,8,497,1291,0}, + {3,9,2566,3430,0}, + {3,10,1249,740,0}, + {3,11,2944,1948,0}, + {3,12,6528,2899,0}, + {3,13,2243,3616,0}, + {3,14,867,3733,0}, + {3,15,1374,4702,0}, + {3,16,4698,2285,0}, + {3,17,4760,3917,0}, + {3,18,1859,4058,0}, + {3,19,6141,3527,0}, + {3,0,2148,5066,0}, + {3,1,1306,145,0}, + {3,2,2319,871,0}, + {3,3,3463,1061,0}, + {3,4,5554,6647,0}, + {3,5,5837,339,0}, + {3,6,5821,4932,0}, + {3,7,6356,4756,0}, + {3,8,3930,418,0}, + {3,9,211,3094,0}, + {3,10,1007,4928,0}, + {3,11,3584,1235,0}, + {3,12,6982,2869,0}, + {3,13,1612,1013,0}, + {3,14,953,4964,0}, + {3,15,4555,4410,0}, + {3,16,4925,4842,0}, + {3,17,5778,600,0}, + {3,18,6509,2417,0}, + {3,19,1260,4903,0}, + {3,0,3369,3031,0}, + {3,1,3557,3224,0}, + {3,2,3028,583,0}, + {3,3,3258,440,0}, + {3,4,6226,6655,0}, + {3,5,4895,1094,0}, + {3,6,1481,6847,0}, + {3,7,4433,1932,0}, + {3,8,2107,1649,0}, + {3,9,2119,2065,0}, + {3,10,4003,6388,0}, + {3,11,6720,3622,0}, + {3,12,3694,4521,0}, + {3,13,1164,7050,0}, + {3,14,1965,3613,0}, + {3,15,4331,66,0}, + {3,16,2970,1796,0}, + {3,17,4652,3218,0}, + {3,18,1762,4777,0}, + {3,19,5736,1399,0}, + {3,0,970,2572,0}, + {3,1,2062,6599,0}, + {3,2,4597,4870,0}, + {3,3,1228,6913,0}, + {3,4,4159,1037,0}, + {3,5,2916,2362,0}, + {3,6,395,1226,0}, + {3,7,6911,4548,0}, + {3,8,4618,2241,0}, + {3,9,4120,4280,0}, + {3,10,5825,474,0}, + {3,11,2154,5558,0}, + {3,12,3793,5471,0}, + {3,13,5707,1595,0}, + {3,14,1403,325,0}, + {3,15,6601,5183,0}, + {3,16,6369,4569,0}, + {3,17,4846,896,0}, + {3,18,7092,6184,0}, + {3,19,6764,7127,0}, + {3,0,6358,1951,0}, + {3,1,3117,6960,0}, + {3,2,2710,7062,0}, + {3,3,1133,3604,0}, + {3,4,3694,657,0}, + {3,5,1355,110,0}, + {3,6,3329,6736,0}, + {3,7,2505,3407,0}, + {3,8,2462,4806,0}, + {3,9,4216,214,0}, + {3,10,5348,5619,0}, + {3,11,6627,6243,0}, + {3,12,2644,5073,0}, + {3,13,4212,5088,0}, + {3,14,3463,3889,0}, + {3,15,5306,478,0}, + {3,16,4320,6121,0}, + {3,17,3961,1125,0}, + {3,18,5699,1195,0}, + {3,19,6511,792,0}, + {3,0,3934,2778,0}, + {3,1,3238,6587,0}, + {3,2,1111,6596,0}, + {3,3,1457,6226,0}, + {3,4,1446,3885,0}, + {3,5,3907,4043,0}, + {3,6,6839,2873,0}, + {3,7,1733,5615,0}, + {3,8,5202,4269,0}, + {3,9,3024,4722,0}, + {3,10,5445,6372,0}, + {3,11,370,1828,0}, + {3,12,4695,1600,0}, + {3,13,680,2074,0}, + {3,14,1801,6690,0}, + {3,15,2669,1377,0}, + {3,16,2463,1681,0}, + {3,17,5972,5171,0}, + {3,18,5728,4284,0}, + {3,19,1696,1459,0} +}; + +const int DVB2::ldpc_tab_9_10N[162][5]= +{ + {4,0,5611,2563,2900}, + {4,1,5220,3143,4813}, + {4,2,2481,834,81}, + {4,3,6265,4064,4265}, + {4,4,1055,2914,5638}, + {4,5,1734,2182,3315}, + {4,6,3342,5678,2246}, + {4,7,2185,552,3385}, + {4,8,2615,236,5334}, + {4,9,1546,1755,3846}, + {4,10,4154,5561,3142}, + {4,11,4382,2957,5400}, + {4,12,1209,5329,3179}, + {4,13,1421,3528,6063}, + {4,14,1480,1072,5398}, + {4,15,3843,1777,4369}, + {4,16,1334,2145,4163}, + {4,17,2368,5055,260}, + {3,0,6118,5405,0}, + {3,1,2994,4370,0}, + {3,2,3405,1669,0}, + {3,3,4640,5550,0}, + {3,4,1354,3921,0}, + {3,5,117,1713,0}, + {3,6,5425,2866,0}, + {3,7,6047,683,0}, + {3,8,5616,2582,0}, + {3,9,2108,1179,0}, + {3,10,933,4921,0}, + {3,11,5953,2261,0}, + {3,12,1430,4699,0}, + {3,13,5905,480,0}, + {3,14,4289,1846,0}, + {3,15,5374,6208,0}, + {3,16,1775,3476,0}, + {3,17,3216,2178,0}, + {3,0,4165,884,0}, + {3,1,2896,3744,0}, + {3,2,874,2801,0}, + {3,3,3423,5579,0}, + {3,4,3404,3552,0}, + {3,5,2876,5515,0}, + {3,6,516,1719,0}, + {3,7,765,3631,0}, + {3,8,5059,1441,0}, + {3,9,5629,598,0}, + {3,10,5405,473,0}, + {3,11,4724,5210,0}, + {3,12,155,1832,0}, + {3,13,1689,2229,0}, + {3,14,449,1164,0}, + {3,15,2308,3088,0}, + {3,16,1122,669,0}, + {3,17,2268,5758,0}, + {3,0,5878,2609,0}, + {3,1,782,3359,0}, + {3,2,1231,4231,0}, + {3,3,4225,2052,0}, + {3,4,4286,3517,0}, + {3,5,5531,3184,0}, + {3,6,1935,4560,0}, + {3,7,1174,131,0}, + {3,8,3115,956,0}, + {3,9,3129,1088,0}, + {3,10,5238,4440,0}, + {3,11,5722,4280,0}, + {3,12,3540,375,0}, + {3,13,191,2782,0}, + {3,14,906,4432,0}, + {3,15,3225,1111,0}, + {3,16,6296,2583,0}, + {3,17,1457,903,0}, + {3,0,855,4475,0}, + {3,1,4097,3970,0}, + {3,2,4433,4361,0}, + {3,3,5198,541,0}, + {3,4,1146,4426,0}, + {3,5,3202,2902,0}, + {3,6,2724,525,0}, + {3,7,1083,4124,0}, + {3,8,2326,6003,0}, + {3,9,5605,5990,0}, + {3,10,4376,1579,0}, + {3,11,4407,984,0}, + {3,12,1332,6163,0}, + {3,13,5359,3975,0}, + {3,14,1907,1854,0}, + {3,15,3601,5748,0}, + {3,16,6056,3266,0}, + {3,17,3322,4085,0}, + {3,0,1768,3244,0}, + {3,1,2149,144,0}, + {3,2,1589,4291,0}, + {3,3,5154,1252,0}, + {3,4,1855,5939,0}, + {3,5,4820,2706,0}, + {3,6,1475,3360,0}, + {3,7,4266,693,0}, + {3,8,4156,2018,0}, + {3,9,2103,752,0}, + {3,10,3710,3853,0}, + {3,11,5123,931,0}, + {3,12,6146,3323,0}, + {3,13,1939,5002,0}, + {3,14,5140,1437,0}, + {3,15,1263,293,0}, + {3,16,5949,4665,0}, + {3,17,4548,6380,0}, + {3,0,3171,4690,0}, + {3,1,5204,2114,0}, + {3,2,6384,5565,0}, + {3,3,5722,1757,0}, + {3,4,2805,6264,0}, + {3,5,1202,2616,0}, + {3,6,1018,3244,0}, + {3,7,4018,5289,0}, + {3,8,2257,3067,0}, + {3,9,2483,3073,0}, + {3,10,1196,5329,0}, + {3,11,649,3918,0}, + {3,12,3791,4581,0}, + {3,13,5028,3803,0}, + {3,14,3119,3506,0}, + {3,15,4779,431,0}, + {3,16,3888,5510,0}, + {3,17,4387,4084,0}, + {3,0,5836,1692,0}, + {3,1,5126,1078,0}, + {3,2,5721,6165,0}, + {3,3,3540,2499,0}, + {3,4,2225,6348,0}, + {3,5,1044,1484,0}, + {3,6,6323,4042,0}, + {3,7,1313,5603,0}, + {3,8,1303,3496,0}, + {3,9,3516,3639,0}, + {3,10,5161,2293,0}, + {3,11,4682,3845,0}, + {3,12,3045,643,0}, + {3,13,2818,2616,0}, + {3,14,3267,649,0}, + {3,15,6236,593,0}, + {3,16,646,2948,0}, + {3,17,4213,1442,0}, + {3,0,5779,1596,0}, + {3,1,2403,1237,0}, + {3,2,2217,1514,0}, + {3,3,5609,716,0}, + {3,4,5155,3858,0}, + {3,5,1517,1312,0}, + {3,6,2554,3158,0}, + {3,7,5280,2643,0}, + {3,8,4990,1353,0}, + {3,9,5648,1170,0}, + {3,10,1152,4366,0}, + {3,11,3561,5368,0}, + {3,12,3581,1411,0}, + {3,13,5647,4661,0}, + {3,14,1542,5401,0}, + {3,15,5078,2687,0}, + {3,16,316,1755,0}, + {3,17,3392,1991,0} +}; + +const int DVB2::ldpc_tab_1_4S[9][13]= +{ + {12,6295,9626,304,7695,4839,4936,1660,144,11203,5567,6347,12557}, + {12,10691,4988,3859,3734,3071,3494,7687,10313,5964,8069,8296,11090}, + {12,10774,3613,5208,11177,7676,3549,8746,6583,7239,12265,2674,4292}, + {12,11869,3708,5981,8718,4908,10650,6805,3334,2627,10461,9285,11120}, + {3,7844,3079,10773,0,0,0,0,0,0,0,0,0}, + {3,3385,10854,5747,0,0,0,0,0,0,0,0,0}, + {3,1360,12010,12202,0,0,0,0,0,0,0,0,0}, + {3,6189,4241,2343,0,0,0,0,0,0,0,0,0}, + {3,9840,12726,4977,0,0,0,0,0,0,0,0,0} +}; + +const int DVB2::ldpc_tab_1_3S[15][13]= +{ + {12,416,8909,4156,3216,3112,2560,2912,6405,8593,4969,6723,6912}, + {12,8978,3011,4339,9312,6396,2957,7288,5485,6031,10218,2226,3575}, + {12,3383,10059,1114,10008,10147,9384,4290,434,5139,3536,1965,2291}, + {12,2797,3693,7615,7077,743,1941,8716,6215,3840,5140,4582,5420}, + {12,6110,8551,1515,7404,4879,4946,5383,1831,3441,9569,10472,4306}, + {3,1505,5682,7778,0,0,0,0,0,0,0,0,0}, + {3,7172,6830,6623,0,0,0,0,0,0,0,0,0}, + {3,7281,3941,3505,0,0,0,0,0,0,0,0,0}, + {3,10270,8669,914,0,0,0,0,0,0,0,0,0}, + {3,3622,7563,9388,0,0,0,0,0,0,0,0,0}, + {3,9930,5058,4554,0,0,0,0,0,0,0,0,0}, + {3,4844,9609,2707,0,0,0,0,0,0,0,0,0}, + {3,6883,3237,1714,0,0,0,0,0,0,0,0,0}, + {3,4768,3878,10017,0,0,0,0,0,0,0,0,0}, + {3,10127,3334,8267,0,0,0,0,0,0,0,0,0} +}; + +const int DVB2::ldpc_tab_2_5S[18][13]= +{ + {12,5650,4143,8750,583,6720,8071,635,1767,1344,6922,738,6658}, + {12,5696,1685,3207,415,7019,5023,5608,2605,857,6915,1770,8016}, + {12,3992,771,2190,7258,8970,7792,1802,1866,6137,8841,886,1931}, + {12,4108,3781,7577,6810,9322,8226,5396,5867,4428,8827,7766,2254}, + {12,4247,888,4367,8821,9660,324,5864,4774,227,7889,6405,8963}, + {12,9693,500,2520,2227,1811,9330,1928,5140,4030,4824,806,3134}, + {3,1652,8171,1435,0,0,0,0,0,0,0,0,0}, + {3,3366,6543,3745,0,0,0,0,0,0,0,0,0}, + {3,9286,8509,4645,0,0,0,0,0,0,0,0,0}, + {3,7397,5790,8972,0,0,0,0,0,0,0,0,0}, + {3,6597,4422,1799,0,0,0,0,0,0,0,0,0}, + {3,9276,4041,3847,0,0,0,0,0,0,0,0,0}, + {3,8683,7378,4946,0,0,0,0,0,0,0,0,0}, + {3,5348,1993,9186,0,0,0,0,0,0,0,0,0}, + {3,6724,9015,5646,0,0,0,0,0,0,0,0,0}, + {3,4502,4439,8474,0,0,0,0,0,0,0,0,0}, + {3,5107,7342,9442,0,0,0,0,0,0,0,0,0}, + {3,1387,8910,2660,0,0,0,0,0,0,0,0,0} +}; + +const int DVB2::ldpc_tab_1_2S[20][9]= +{ + {8,20,712,2386,6354,4061,1062,5045,5158}, + {8,21,2543,5748,4822,2348,3089,6328,5876}, + {8,22,926,5701,269,3693,2438,3190,3507}, + {8,23,2802,4520,3577,5324,1091,4667,4449}, + {8,24,5140,2003,1263,4742,6497,1185,6202}, + {3,0,4046,6934,0,0,0,0,0}, + {3,1,2855,66,0,0,0,0,0}, + {3,2,6694,212,0,0,0,0,0}, + {3,3,3439,1158,0,0,0,0,0}, + {3,4,3850,4422,0,0,0,0,0}, + {3,5,5924,290,0,0,0,0,0}, + {3,6,1467,4049,0,0,0,0,0}, + {3,7,7820,2242,0,0,0,0,0}, + {3,8,4606,3080,0,0,0,0,0}, + {3,9,4633,7877,0,0,0,0,0}, + {3,10,3884,6868,0,0,0,0,0}, + {3,11,8935,4996,0,0,0,0,0}, + {3,12,3028,764,0,0,0,0,0}, + {3,13,5988,1057,0,0,0,0,0}, + {3,14,7411,3450,0,0,0,0,0} +}; + +const int DVB2::ldpc_tab_3_5S[27][13]= +{ + {12,2765,5713,6426,3596,1374,4811,2182,544,3394,2840,4310,771}, + {12,4951,211,2208,723,1246,2928,398,5739,265,5601,5993,2615}, + {12,210,4730,5777,3096,4282,6238,4939,1119,6463,5298,6320,4016}, + {12,4167,2063,4757,3157,5664,3956,6045,563,4284,2441,3412,6334}, + {12,4201,2428,4474,59,1721,736,2997,428,3807,1513,4732,6195}, + {12,2670,3081,5139,3736,1999,5889,4362,3806,4534,5409,6384,5809}, + {12,5516,1622,2906,3285,1257,5797,3816,817,875,2311,3543,1205}, + {12,4244,2184,5415,1705,5642,4886,2333,287,1848,1121,3595,6022}, + {12,2142,2830,4069,5654,1295,2951,3919,1356,884,1786,396,4738}, + {3,0,2161,2653,0,0,0,0,0,0,0,0,0}, + {3,1,1380,1461,0,0,0,0,0,0,0,0,0}, + {3,2,2502,3707,0,0,0,0,0,0,0,0,0}, + {3,3,3971,1057,0,0,0,0,0,0,0,0,0}, + {3,4,5985,6062,0,0,0,0,0,0,0,0,0}, + {3,5,1733,6028,0,0,0,0,0,0,0,0,0}, + {3,6,3786,1936,0,0,0,0,0,0,0,0,0}, + {3,7,4292,956,0,0,0,0,0,0,0,0,0}, + {3,8,5692,3417,0,0,0,0,0,0,0,0,0}, + {3,9,266,4878,0,0,0,0,0,0,0,0,0}, + {3,10,4913,3247,0,0,0,0,0,0,0,0,0}, + {3,11,4763,3937,0,0,0,0,0,0,0,0,0}, + {3,12,3590,2903,0,0,0,0,0,0,0,0,0}, + {3,13,2566,4215,0,0,0,0,0,0,0,0,0}, + {3,14,5208,4707,0,0,0,0,0,0,0,0,0}, + {3,15,3940,3388,0,0,0,0,0,0,0,0,0}, + {3,16,5109,4556,0,0,0,0,0,0,0,0,0}, + {3,17,4908,4177,0,0,0,0,0,0,0,0,0} +}; + +const int DVB2::ldpc_tab_2_3S[30][14]= +{ + {13,0,2084,1613,1548,1286,1460,3196,4297,2481,3369,3451,4620,2622}, + {13,1,122,1516,3448,2880,1407,1847,3799,3529,373,971,4358,3108}, + {13,2,259,3399,929,2650,864,3996,3833,107,5287,164,3125,2350}, + {3,3,342,3529,0,0,0,0,0,0,0,0,0,0}, + {3,4,4198,2147,0,0,0,0,0,0,0,0,0,0}, + {3,5,1880,4836,0,0,0,0,0,0,0,0,0,0}, + {3,6,3864,4910,0,0,0,0,0,0,0,0,0,0}, + {3,7,243,1542,0,0,0,0,0,0,0,0,0,0}, + {3,8,3011,1436,0,0,0,0,0,0,0,0,0,0}, + {3,9,2167,2512,0,0,0,0,0,0,0,0,0,0}, + {3,10,4606,1003,0,0,0,0,0,0,0,0,0,0}, + {3,11,2835,705,0,0,0,0,0,0,0,0,0,0}, + {3,12,3426,2365,0,0,0,0,0,0,0,0,0,0}, + {3,13,3848,2474,0,0,0,0,0,0,0,0,0,0}, + {3,14,1360,1743,0,0,0,0,0,0,0,0,0,0}, + {3,0,163,2536,0,0,0,0,0,0,0,0,0,0}, + {3,1,2583,1180,0,0,0,0,0,0,0,0,0,0}, + {3,2,1542,509,0,0,0,0,0,0,0,0,0,0}, + {3,3,4418,1005,0,0,0,0,0,0,0,0,0,0}, + {3,4,5212,5117,0,0,0,0,0,0,0,0,0,0}, + {3,5,2155,2922,0,0,0,0,0,0,0,0,0,0}, + {3,6,347,2696,0,0,0,0,0,0,0,0,0,0}, + {3,7,226,4296,0,0,0,0,0,0,0,0,0,0}, + {3,8,1560,487,0,0,0,0,0,0,0,0,0,0}, + {3,9,3926,1640,0,0,0,0,0,0,0,0,0,0}, + {3,10,149,2928,0,0,0,0,0,0,0,0,0,0}, + {3,11,2364,563,0,0,0,0,0,0,0,0,0,0}, + {3,12,635,688,0,0,0,0,0,0,0,0,0,0}, + {3,13,231,1684,0,0,0,0,0,0,0,0,0,0}, + {3,14,1129,3894,0,0,0,0,0,0,0,0,0,0} +}; + +const int DVB2::ldpc_tab_3_4S[33][13]= +{ + {12,3,3198,478,4207,1481,1009,2616,1924,3437,554,683,1801}, + {3,4,2681,2135,0,0,0,0,0,0,0,0,0}, + {3,5,3107,4027,0,0,0,0,0,0,0,0,0}, + {3,6,2637,3373,0,0,0,0,0,0,0,0,0}, + {3,7,3830,3449,0,0,0,0,0,0,0,0,0}, + {3,8,4129,2060,0,0,0,0,0,0,0,0,0}, + {3,9,4184,2742,0,0,0,0,0,0,0,0,0}, + {3,10,3946,1070,0,0,0,0,0,0,0,0,0}, + {3,11,2239,984,0,0,0,0,0,0,0,0,0}, + {3,0,1458,3031,0,0,0,0,0,0,0,0,0}, + {3,1,3003,1328,0,0,0,0,0,0,0,0,0}, + {3,2,1137,1716,0,0,0,0,0,0,0,0,0}, + {3,3,132,3725,0,0,0,0,0,0,0,0,0}, + {3,4,1817,638,0,0,0,0,0,0,0,0,0}, + {3,5,1774,3447,0,0,0,0,0,0,0,0,0}, + {3,6,3632,1257,0,0,0,0,0,0,0,0,0}, + {3,7,542,3694,0,0,0,0,0,0,0,0,0}, + {3,8,1015,1945,0,0,0,0,0,0,0,0,0}, + {3,9,1948,412,0,0,0,0,0,0,0,0,0}, + {3,10,995,2238,0,0,0,0,0,0,0,0,0}, + {3,11,4141,1907,0,0,0,0,0,0,0,0,0}, + {3,0,2480,3079,0,0,0,0,0,0,0,0,0}, + {3,1,3021,1088,0,0,0,0,0,0,0,0,0}, + {3,2,713,1379,0,0,0,0,0,0,0,0,0}, + {3,3,997,3903,0,0,0,0,0,0,0,0,0}, + {3,4,2323,3361,0,0,0,0,0,0,0,0,0}, + {3,5,1110,986,0,0,0,0,0,0,0,0,0}, + {3,6,2532,142,0,0,0,0,0,0,0,0,0}, + {3,7,1690,2405,0,0,0,0,0,0,0,0,0}, + {3,8,1298,1881,0,0,0,0,0,0,0,0,0}, + {3,9,615,174,0,0,0,0,0,0,0,0,0}, + {3,10,1648,3112,0,0,0,0,0,0,0,0,0}, + {3,11,1415,2808,0,0,0,0,0,0,0,0,0} +}; + +const int DVB2::ldpc_tab_4_5S[35][4]= +{ + {3,5,896,1565}, + {3,6,2493,184}, + {3,7,212,3210}, + {3,8,727,1339}, + {3,9,3428,612}, + {3,0,2663,1947}, + {3,1,230,2695}, + {3,2,2025,2794}, + {3,3,3039,283}, + {3,4,862,2889}, + {3,5,376,2110}, + {3,6,2034,2286}, + {3,7,951,2068}, + {3,8,3108,3542}, + {3,9,307,1421}, + {3,0,2272,1197}, + {3,1,1800,3280}, + {3,2,331,2308}, + {3,3,465,2552}, + {3,4,1038,2479}, + {3,5,1383,343}, + {3,6,94,236}, + {3,7,2619,121}, + {3,8,1497,2774}, + {3,9,2116,1855}, + {3,0,722,1584}, + {3,1,2767,1881}, + {3,2,2701,1610}, + {3,3,3283,1732}, + {3,4,168,1099}, + {3,5,3074,243}, + {3,6,3460,945}, + {3,7,2049,1746}, + {3,8,566,1427}, + {3,9,3545,1168} +}; + +const int DVB2::ldpc_tab_5_6S[37][14]= +{ + {13,3,2409,499,1481,908,559,716,1270,333,2508,2264,1702,2805}, + {3,4,2447,1926,0,0,0,0,0,0,0,0,0,0}, + {3,5,414,1224,0,0,0,0,0,0,0,0,0,0}, + {3,6,2114,842,0,0,0,0,0,0,0,0,0,0}, + {3,7,212,573,0,0,0,0,0,0,0,0,0,0}, + {3,0,2383,2112,0,0,0,0,0,0,0,0,0,0}, + {3,1,2286,2348,0,0,0,0,0,0,0,0,0,0}, + {3,2,545,819,0,0,0,0,0,0,0,0,0,0}, + {3,3,1264,143,0,0,0,0,0,0,0,0,0,0}, + {3,4,1701,2258,0,0,0,0,0,0,0,0,0,0}, + {3,5,964,166,0,0,0,0,0,0,0,0,0,0}, + {3,6,114,2413,0,0,0,0,0,0,0,0,0,0}, + {3,7,2243,81,0,0,0,0,0,0,0,0,0,0}, + {3,0,1245,1581,0,0,0,0,0,0,0,0,0,0}, + {3,1,775,169,0,0,0,0,0,0,0,0,0,0}, + {3,2,1696,1104,0,0,0,0,0,0,0,0,0,0}, + {3,3,1914,2831,0,0,0,0,0,0,0,0,0,0}, + {3,4,532,1450,0,0,0,0,0,0,0,0,0,0}, + {3,5,91,974,0,0,0,0,0,0,0,0,0,0}, + {3,6,497,2228,0,0,0,0,0,0,0,0,0,0}, + {3,7,2326,1579,0,0,0,0,0,0,0,0,0,0}, + {3,0,2482,256,0,0,0,0,0,0,0,0,0,0}, + {3,1,1117,1261,0,0,0,0,0,0,0,0,0,0}, + {3,2,1257,1658,0,0,0,0,0,0,0,0,0,0}, + {3,3,1478,1225,0,0,0,0,0,0,0,0,0,0}, + {3,4,2511,980,0,0,0,0,0,0,0,0,0,0}, + {3,5,2320,2675,0,0,0,0,0,0,0,0,0,0}, + {3,6,435,1278,0,0,0,0,0,0,0,0,0,0}, + {3,7,228,503,0,0,0,0,0,0,0,0,0,0}, + {3,0,1885,2369,0,0,0,0,0,0,0,0,0,0}, + {3,1,57,483,0,0,0,0,0,0,0,0,0,0}, + {3,2,838,1050,0,0,0,0,0,0,0,0,0,0}, + {3,3,1231,1990,0,0,0,0,0,0,0,0,0,0}, + {3,4,1738,68,0,0,0,0,0,0,0,0,0,0}, + {3,5,2392,951,0,0,0,0,0,0,0,0,0,0}, + {3,6,163,645,0,0,0,0,0,0,0,0,0,0}, + {3,7,2644,1704,0,0,0,0,0,0,0,0,0,0} +}; + +const int DVB2::ldpc_tab_8_9S[40][5]= +{ + {4,0,1558,712,805}, + {4,1,1450,873,1337}, + {4,2,1741,1129,1184}, + {4,3,294,806,1566}, + {4,4,482,605,923}, + {3,0,926,1578,0}, + {3,1,777,1374,0}, + {3,2,608,151,0}, + {3,3,1195,210,0}, + {3,4,1484,692,0}, + {3,0,427,488,0}, + {3,1,828,1124,0}, + {3,2,874,1366,0}, + {3,3,1500,835,0}, + {3,4,1496,502,0}, + {3,0,1006,1701,0}, + {3,1,1155,97,0}, + {3,2,657,1403,0}, + {3,3,1453,624,0}, + {3,4,429,1495,0}, + {3,0,809,385,0}, + {3,1,367,151,0}, + {3,2,1323,202,0}, + {3,3,960,318,0}, + {3,4,1451,1039,0}, + {3,0,1098,1722,0}, + {3,1,1015,1428,0}, + {3,2,1261,1564,0}, + {3,3,544,1190,0}, + {3,4,1472,1246,0}, + {3,0,508,630,0}, + {3,1,421,1704,0}, + {3,2,284,898,0}, + {3,3,392,577,0}, + {3,4,1155,556,0}, + {3,0,631,1000,0}, + {3,1,732,1368,0}, + {3,2,1328,329,0}, + {3,3,1515,506,0}, + {3,4,1104,1172,0} +}; diff --git a/plugins/channeltx/moddatv/dvb-s2/dvb2_scrambler.cpp b/plugins/channeltx/moddatv/dvb-s2/dvb2_scrambler.cpp new file mode 100644 index 000000000..e5537be1e --- /dev/null +++ b/plugins/channeltx/moddatv/dvb-s2/dvb2_scrambler.cpp @@ -0,0 +1,23 @@ +#include "DVB2.h" + +void DVB2::init_bb_randomiser(void) +{ + int sr = 0x4A80; + for( int i = 0; i < FRAME_SIZE_NORMAL; i++ ) + { + int b = ((sr)^(sr>>1))&1; + m_bb_randomise[i] = b; + sr >>= 1; + if( b ) sr |= 0x4000; + } +} +// +// Randomise the data bits +// +void DVB2::bb_randomise(void) +{ + for( int i = 0; i < m_format[0].kbch; i++ ) + { + m_frame[i] ^= m_bb_randomise[i]; + } +} diff --git a/plugins/channeltx/moddatv/dvb-s2/dvbs2_interleave.cpp b/plugins/channeltx/moddatv/dvb-s2/dvbs2_interleave.cpp new file mode 100644 index 000000000..819a9e008 --- /dev/null +++ b/plugins/channeltx/moddatv/dvb-s2/dvbs2_interleave.cpp @@ -0,0 +1,89 @@ +#include "memory.h" +#include "DVBS2.h" +// +// The output is bit packed ready for modulating +// +void DVBS2::s2_interleave( void ) +{ + int index=0; + int rows=0; + + int frame_size = m_format[0].nldpc; + + if( m_format[0].constellation == M_QPSK ) + { + rows = frame_size/2; + m_payload_symbols = rows; + for( int i = 0; i < rows; i++ ) + { + m_iframe[i] = (m_frame[index++]<<1); + m_iframe[i] |= m_frame[index++]; + } + return; + } + + if( m_format[0].constellation == M_8PSK ) + { + if( m_format[0].code_rate == CR_3_5 ) + { + rows = frame_size/3; + m_payload_symbols = rows; + Bit *c1,*c2,*c3; + c1 = &m_frame[rows*2]; + c2 = &m_frame[rows]; + c3 = &m_frame[0]; + for( int i = 0; i < rows; i++ ) + { + m_iframe[i] = (c1[i]<<2) | (c2[i]<<1) | (c3[i]); + } + } + else + { + rows = frame_size/3; + m_payload_symbols = rows; + Bit *c1,*c2,*c3; + c1 = &m_frame[0]; + c2 = &m_frame[rows]; + c3 = &m_frame[rows*2]; + for( int i = 0; i < rows; i++ ) + { + m_iframe[i] = (c1[i]<<2) | (c2[i]<<1) | (c3[i]); + } + } + return; + } + + if( m_format[0].constellation == M_16APSK ) + { + rows = frame_size/4; + m_payload_symbols = rows; + Bit *c1,*c2,*c3,*c4; + c1 = &m_frame[0]; + c2 = &m_frame[rows]; + c3 = &m_frame[rows*2]; + c4 = &m_frame[rows*3]; + for( int i = 0; i < rows; i++ ) + { + m_iframe[i] = (c1[i]<<3) | (c2[i]<<2) | (c3[i]<<1) | (c4[i]); + } + return; + } + + if( m_format[0].constellation == M_32APSK ) + { + rows = frame_size/5; + m_payload_symbols = rows; + Bit *c1,*c2,*c3,*c4,*c5; + c1 = &m_frame[0]; + c2 = &m_frame[rows]; + c3 = &m_frame[rows*2]; + c4 = &m_frame[rows*3]; + c5 = &m_frame[rows*4]; + for( int i = 0; i < rows; i++ ) + { + m_iframe[i] = (c1[i]<<4) | (c2[i]<<3) | (c3[i]<<2) | (c4[i]<<1) | c5[i]; + } + + return; + } +} diff --git a/plugins/channeltx/moddatv/dvb-s2/dvbs2_modulator.cpp b/plugins/channeltx/moddatv/dvb-s2/dvbs2_modulator.cpp new file mode 100644 index 000000000..189ca9556 --- /dev/null +++ b/plugins/channeltx/moddatv/dvb-s2/dvbs2_modulator.cpp @@ -0,0 +1,209 @@ +#include "math.h" +#include "DVBS2.h" + +#define CP 0x7FFF + +void DVBS2::modulator_configuration() +{ + double r0,r1,r2,r3; + double m = 1.0; + if (m_format[0].constellation == M_32APSK) + r0 = 0.9*m;// I am not sure why this needs to be 0.9 but 32APSK does not work if == 1.0 + else + r0 = 1.0*m;// Don't use 0.9 for other mods, as that results in worse MER + r1 = m; + // BPSK + m_bpsk[0][0].re = (short)((r0*cos(1*M_PI/4.0))*CP); + m_bpsk[0][0].im = (short)((r0*sin(1*M_PI/4.0))*CP); + m_bpsk[0][1].re = (short)((r0*cos(5*M_PI/4.0))*CP); + m_bpsk[0][1].im = (short)((r0*sin(5*M_PI/4.0))*CP); + + m_bpsk[1][0].re = (short)((r0*cos(3*M_PI/4.0))*CP); + m_bpsk[1][0].im = (short)((r0*sin(3*M_PI/4.0))*CP); + m_bpsk[1][1].re = (short)((r0*cos(7*M_PI/4.0))*CP); + m_bpsk[1][1].im = (short)((r0*sin(7*M_PI/4.0))*CP); + + // QPSK + m_qpsk[0].re = (short)((r1*cos(M_PI/4.0))*CP); + m_qpsk[0].im = (short)((r1*sin(M_PI/4.0))*CP); + m_qpsk[1].re = (short)((r1*cos(7*M_PI/4.0))*CP); + m_qpsk[1].im = (short)((r1*sin(7*M_PI/4.0))*CP); + m_qpsk[2].re = (short)((r1*cos(3*M_PI/4.0))*CP); + m_qpsk[2].im = (short)((r1*sin(3*M_PI/4.0))*CP); + m_qpsk[3].re = (short)((r1*cos(5*M_PI/4.0))*CP); + m_qpsk[3].im = (short)((r1*sin(5*M_PI/4.0))*CP); + + // 8PSK + m_8psk[0].re = (short)((r1*cos(M_PI/4.0))*CP); + m_8psk[0].im = (short)((r1*sin(M_PI/4.0))*CP); + m_8psk[1].re = (short)((r1*cos(0.0))*CP); + m_8psk[1].im = (short)((r1*sin(0.0))*CP); + m_8psk[2].re = (short)((r1*cos(4*M_PI/4.0))*CP); + m_8psk[2].im = (short)((r1*sin(4*M_PI/4.0))*CP); + m_8psk[3].re = (short)((r1*cos(5*M_PI/4.0))*CP); + m_8psk[3].im = (short)((r1*sin(5*M_PI/4.0))*CP); + m_8psk[4].re = (short)((r1*cos(2*M_PI/4.0))*CP); + m_8psk[4].im = (short)((r1*sin(2*M_PI/4.0))*CP); + m_8psk[5].re = (short)((r1*cos(7*M_PI/4.0))*CP); + m_8psk[5].im = (short)((r1*sin(7*M_PI/4.0))*CP); + m_8psk[6].re = (short)((r1*cos(3*M_PI/4.0))*CP); + m_8psk[6].im = (short)((r1*sin(3*M_PI/4.0))*CP); + m_8psk[7].re = (short)((r1*cos(6*M_PI/4.0))*CP); + m_8psk[7].im = (short)((r1*sin(6*M_PI/4.0))*CP); + + // 16 APSK + r2 = m; + switch( m_format[0].code_rate ) + { + case CR_2_3: + r1 = r2/3.15; + break; + case CR_3_4: + r1 = r2/2.85; + break; + case CR_4_5: + r1 = r2/2.75; + break; + case CR_5_6: + r1 = r2/2.70; + break; + case CR_8_9: + r1 = r2/2.60; + break; + case CR_9_10: + r1 = r2/2.57; + break; + default: + // Illegal + r1 = 0; + break; + } + + m_16apsk[0].re = (short)((r2*cos(M_PI/4.0))*CP); + m_16apsk[0].im = (short)((r2*sin(M_PI/4.0))*CP); + m_16apsk[1].re = (short)((r2*cos(-M_PI/4.0))*CP); + m_16apsk[1].im = (short)((r2*sin(-M_PI/4.0))*CP); + m_16apsk[2].re = (short)((r2*cos(3*M_PI/4.0))*CP); + m_16apsk[2].im = (short)((r2*sin(3*M_PI/4.0))*CP); + m_16apsk[3].re = (short)((r2*cos(-3*M_PI/4.0))*CP); + m_16apsk[3].im = (short)((r2*sin(-3*M_PI/4.0))*CP); + m_16apsk[4].re = (short)((r2*cos(M_PI/12.0))*CP); + m_16apsk[4].im = (short)((r2*sin(M_PI/12.0))*CP); + m_16apsk[5].re = (short)((r2*cos(-M_PI/12.0))*CP); + m_16apsk[5].im = (short)((r2*sin(-M_PI/12.0))*CP); + m_16apsk[6].re = (short)((r2*cos(11*M_PI/12.0))*CP); + m_16apsk[6].im = (short)((r2*sin(11*M_PI/12.0))*CP); + m_16apsk[7].re = (short)((r2*cos(-11*M_PI/12.0))*CP); + m_16apsk[7].im = (short)((r2*sin(-11*M_PI/12.0))*CP); + m_16apsk[8].re = (short)((r2*cos(5*M_PI/12.0))*CP); + m_16apsk[8].im = (short)((r2*sin(5*M_PI/12.0))*CP); + m_16apsk[9].re = (short)((r2*cos(-5*M_PI/12.0))*CP); + m_16apsk[9].im = (short)((r2*sin(-5*M_PI/12.0))*CP); + m_16apsk[10].re = (short)((r2*cos(7*M_PI/12.0))*CP); + m_16apsk[10].im = (short)((r2*sin(7*M_PI/12.0))*CP); + m_16apsk[11].re = (short)((r2*cos(-7*M_PI/12.0))*CP); + m_16apsk[11].im = (short)((r2*sin(-7*M_PI/12.0))*CP); + m_16apsk[12].re = (short)((r1*cos(M_PI/4.0))*CP); + m_16apsk[12].im = (short)((r1*sin(M_PI/4.0))*CP); + m_16apsk[13].re = (short)((r1*cos(-M_PI/4.0))*CP); + m_16apsk[13].im = (short)((r1*sin(-M_PI/4.0))*CP); + m_16apsk[14].re = (short)((r1*cos(3*M_PI/4.0))*CP); + m_16apsk[14].im = (short)((r1*sin(3*M_PI/4.0))*CP); + m_16apsk[15].re = (short)((r1*cos(-3*M_PI/4.0))*CP); + m_16apsk[15].im = (short)((r1*sin(-3*M_PI/4.0))*CP); + // 32 APSK + r3 = m; + switch( m_format[0].code_rate ) + { + case CR_3_4: + r1 = r3/5.27; + r2 = r1*2.84; + break; + case CR_4_5: + r1 = r3/4.87; + r2 = r1*2.72; + break; + case CR_5_6: + r1 = r3/4.64; + r2 = r1*2.64; + break; + case CR_8_9: + r1 = r3/4.33; + r2 = r1*2.54; + break; + case CR_9_10: + r1 = r3/4.30; + r2 = r1*2.53; + break; + default: + // Illegal + r1 = 0; + r2 = 0; + break; + } + + m_32apsk[0].re = (short)((r2*cos(M_PI/4.0))*CP); + m_32apsk[0].im = (short)((r2*sin(M_PI/4.0))*CP); + m_32apsk[1].re = (short)((r2*cos(5*M_PI/12.0))*CP); + m_32apsk[1].im = (short)((r2*sin(5*M_PI/12.0))*CP); + m_32apsk[2].re = (short)((r2*cos(-M_PI/4.0))*CP); + m_32apsk[2].im = (short)((r2*sin(-M_PI/4.0))*CP); + m_32apsk[3].re = (short)((r2*cos(-5*M_PI/12.0))*CP); + m_32apsk[3].im = (short)((r2*sin(-5*M_PI/12.0))*CP); + m_32apsk[4].re = (short)((r2*cos(3*M_PI/4.0))*CP); + m_32apsk[4].im = (short)((r2*sin(3*M_PI/4.0))*CP); + m_32apsk[5].re = (short)((r2*cos(7*M_PI/12.0))*CP); + m_32apsk[5].im = (short)((r2*sin(7*M_PI/12.0))*CP); + m_32apsk[6].re = (short)((r2*cos(-3*M_PI/4.0))*CP); + m_32apsk[6].im = (short)((r2*sin(-3*M_PI/4.0))*CP); + m_32apsk[7].re = (short)((r2*cos(-7*M_PI/12.0))*CP); + m_32apsk[7].im = (short)((r2*sin(-7*M_PI/12.0))*CP); + m_32apsk[8].re = (short)((r3*cos(M_PI/8.0))*CP); + m_32apsk[8].im = (short)((r3*sin(M_PI/8.0))*CP); + m_32apsk[9].re = (short)((r3*cos(3*M_PI/8.0))*CP); + m_32apsk[9].im = (short)((r3*sin(3*M_PI/8.0))*CP); + m_32apsk[10].re = (short)((r3*cos(-M_PI/4.0))*CP); + m_32apsk[10].im = (short)((r3*sin(-M_PI/4.0))*CP); + m_32apsk[11].re = (short)((r3*cos(-M_PI/2.0))*CP); + m_32apsk[11].im = (short)((r3*sin(-M_PI/2.0))*CP); + m_32apsk[12].re = (short)((r3*cos(3*M_PI/4.0))*CP); + m_32apsk[12].im = (short)((r3*sin(3*M_PI/4.0))*CP); + m_32apsk[13].re = (short)((r3*cos(M_PI/2.0))*CP); + m_32apsk[13].im = (short)((r3*sin(M_PI/2.0))*CP); + m_32apsk[14].re = (short)((r3*cos(-7*M_PI/8.0))*CP); + m_32apsk[14].im = (short)((r3*sin(-7*M_PI/8.0))*CP); + m_32apsk[15].re = (short)((r3*cos(-5*M_PI/8.0))*CP); + m_32apsk[15].im = (short)((r3*sin(-5*M_PI/8.0))*CP); + m_32apsk[16].re = (short)((r2*cos(M_PI/12.0))*CP); + m_32apsk[16].im = (short)((r2*sin(M_PI/12.0))*CP); + m_32apsk[17].re = (short)((r1*cos(M_PI/4.0))*CP); + m_32apsk[17].im = (short)((r1*sin(M_PI/4.0))*CP); + m_32apsk[18].re = (short)((r2*cos(-M_PI/12.0))*CP); + m_32apsk[18].im = (short)((r2*sin(-M_PI/12.0))*CP); + m_32apsk[19].re = (short)((r1*cos(-M_PI/4.0))*CP); + m_32apsk[19].im = (short)((r1*sin(-M_PI/4.0))*CP); + m_32apsk[20].re = (short)((r2*cos(11*M_PI/12.0))*CP); + m_32apsk[20].im = (short)((r2*sin(11*M_PI/12.0))*CP); + m_32apsk[21].re = (short)((r1*cos(3*M_PI/4.0))*CP); + m_32apsk[21].im = (short)((r1*sin(3*M_PI/4.0))*CP); + m_32apsk[22].re = (short)((r2*cos(-11*M_PI/12.0))*CP); + m_32apsk[22].im = (short)((r2*sin(-11*M_PI/12.0))*CP); + m_32apsk[23].re = (short)((r1*cos(-3*M_PI/4.0))*CP); + m_32apsk[23].im = (short)((r1*sin(-3*M_PI/4.0))*CP); + m_32apsk[24].re = (short)((r3*cos(0.0))*CP); + m_32apsk[24].im = (short)((r3*sin(0.0))*CP); + m_32apsk[25].re = (short)((r3*cos(M_PI/4.0))*CP); + m_32apsk[25].im = (short)((r3*sin(M_PI/4.0))*CP); + m_32apsk[26].re = (short)((r3*cos(-M_PI/8.0))*CP); + m_32apsk[26].im = (short)((r3*sin(-M_PI/8.0))*CP); + m_32apsk[27].re = (short)((r3*cos(-3*M_PI/8.0))*CP); + m_32apsk[27].im = (short)((r3*sin(-3*M_PI/8.0))*CP); + m_32apsk[28].re = (short)((r3*cos(7*M_PI/8.0))*CP); + m_32apsk[28].im = (short)((r3*sin(7*M_PI/8.0))*CP); + m_32apsk[29].re = (short)((r3*cos(5*M_PI/8.0))*CP); + m_32apsk[29].im = (short)((r3*sin(5*M_PI/8.0))*CP); + m_32apsk[30].re = (short)((r3*cos(M_PI))*CP); + m_32apsk[30].im = (short)((r3*sin(M_PI))*CP); + m_32apsk[31].re = (short)((r3*cos(-3*M_PI/4.0))*CP); + m_32apsk[31].im = (short)((r3*sin(-3*M_PI/4.0))*CP); +} diff --git a/plugins/channeltx/moddatv/dvb-s2/dvbs2_physical.cpp b/plugins/channeltx/moddatv/dvb-s2/dvbs2_physical.cpp new file mode 100644 index 000000000..a054a2925 --- /dev/null +++ b/plugins/channeltx/moddatv/dvb-s2/dvbs2_physical.cpp @@ -0,0 +1,332 @@ +#include "DVBS2.h" + +void DVBS2::b_64_7_code( unsigned char in, int *out ) +{ + unsigned long temp,bit; + + temp = 0; + + if(in&0x40) temp ^= g[0]; + if(in&0x20) temp ^= g[1]; + if(in&0x10) temp ^= g[2]; + if(in&0x08) temp ^= g[3]; + if(in&0x04) temp ^= g[4]; + if(in&0x02) temp ^= g[5]; + + bit = 0x80000000; + for( int m = 0; m < 32; m++ ) + { + out[(m*2)] = (temp&bit)?1:0; + out[(m*2)+1] = out[m*2]^(in&0x01); + bit >>= 1; + } + // Randomise it + for( int m = 0; m < 64; m++ ) + { + out[m] = out[m] ^ ph_scram_tab[m]; + } +} +//[MODCOD 6:2 ][TYPE 1:0 ] +void DVBS2::s2_pl_header_encode( u8 modcod, u8 type, int *out) +{ + unsigned char code; + + code = (modcod<<2) | type; + //printf("MODCOD %d TYPE %d %d\n",modcod,type,code); + // Add the modcod and type information and scramble it + b_64_7_code( code, out ); +} +void DVBS2::s2_pl_header_create(void) +{ + int type, modcod; + + modcod = 0; + + if( m_format[0].frame_type == FRAME_NORMAL ) + type = 0; + else + type = 2; + + if( m_format[0].pilots ) type |= 1; + + // Mode and code rate + if( m_format[0].constellation == M_QPSK ) + { + switch( m_format[0].code_rate ) + { + case CR_1_4: + modcod = 1; + break; + case CR_1_3: + modcod = 2; + break; + case CR_2_5: + modcod = 3; + break; + case CR_1_2: + modcod = 4; + break; + case CR_3_5: + modcod = 5; + break; + case CR_2_3: + modcod = 6; + break; + case CR_3_4: + modcod = 7; + break; + case CR_4_5: + modcod = 8; + break; + case CR_5_6: + modcod = 9; + break; + case CR_8_9: + modcod = 10; + break; + case CR_9_10: + modcod = 11; + break; + default: + modcod = 0; + break; + } + } + + if( m_format[0].constellation == M_8PSK ) + { + switch( m_format[0].code_rate ) + { + case CR_3_5: + modcod = 12; + break; + case CR_2_3: + modcod = 13; + break; + case CR_3_4: + modcod = 14; + break; + case CR_5_6: + modcod = 15; + break; + case CR_8_9: + modcod = 16; + break; + case CR_9_10: + modcod = 17; + break; + default: + modcod = 0; + break; + } + } + + if( m_format[0].constellation == M_16APSK ) + { + switch( m_format[0].code_rate ) + { + case CR_2_3: + modcod = 18; + break; + case CR_3_4: + modcod = 19; + break; + case CR_4_5: + modcod = 20; + break; + case CR_5_6: + modcod = 21; + break; + case CR_8_9: + modcod = 22; + break; + case CR_9_10: + modcod = 23; + break; + default: + modcod = 0; + break; + } + } + + if( m_format[0].constellation == M_32APSK ) + { + switch( m_format[0].code_rate ) + { + case CR_3_4: + modcod = 24; + break; + case CR_4_5: + modcod = 25; + break; + case CR_5_6: + modcod = 26; + break; + case CR_8_9: + modcod = 27; + break; + case CR_9_10: + modcod = 28; + break; + default: + modcod = 0; + break; + } + } + // Now create the PL header. + int b[90]; + // Add the sync sequence SOF + for( int i = 0; i < 26; i++ ) b[i] = ph_sync_seq[i]; + // Add the mode and code + s2_pl_header_encode( modcod, type, &b[26] ); + + // BPSK modulate and add the header + for( int i = 0; i < 90; i++ ) + { + m_pl[i] = m_bpsk[i&1][b[i]]; + } +} +// +// m_symbols is the total number of complex symbols in the frame +// Modulate the data starting at symbol 90 +// +int DVBS2::s2_pl_data_pack( void ) +{ + int m = 0; + int n = 90;// Jump over header + int blocks = m_payload_symbols/90; + int block_count = 0; + + // See if PSK + if( m_format[0].constellation == M_QPSK ) + { + for( int i = 0; i < blocks; i++ ) + { + for( int j = 0; j < 90; j++ ) + { + m_pl[n++] = m_qpsk[m_iframe[m++]&0x3]; + } + block_count = (block_count+1)%16; + if((block_count == 0)&&(i>= 1; + if( xb ) x |= 0x20000; + + ya = parity_chk( y, 0x04A1 ); + yb = parity_chk( y, 0xFF60 ); + yc = y&1; + + y >>= 1; + if( ya ) y |= 0x20000; + + zna = xc ^ yc; + znb = xa ^ yb; + rn = (znb<<1) + zna; + m_cscram[i] = rn; + } +} + +void DVBS2::pl_scramble_symbols( scmplx *fs, int len ) +{ + scmplx x; + + // Start at the end of the PL Header. + + for( int n = 0; n < len; n++ ) + { + switch( m_cscram[n] ) + { + case 0: + // Do nothing + break; + case 1: + x = fs[n]; + fs[n].re = -x.im; + fs[n].im = x.re; + break; + case 2: + fs[n].re = -fs[n].re; + fs[n].im = -fs[n].im; + break; + case 03: + x = fs[n]; + fs[n].re = x.im; + fs[n].im = -x.re; + break; + } + } +} +void DVBS2::pl_scramble_dummy_symbols( int len ) +{ + scmplx x; + int p = 0; + + x = m_bpsk[0][0]; + + for( int n = 90; n < len; n++ ) + { + switch( m_cscram[p] ) + { + case 0: + // Do nothing + m_pl_dummy[n].re = x.re; + m_pl_dummy[n].im = x.im; + break; + case 1: + m_pl_dummy[n].re = -x.im; + m_pl_dummy[n].im = x.re; + break; + case 2: + m_pl_dummy[n].re = -x.re; + m_pl_dummy[n].im = -x.im; + break; + case 3: + m_pl_dummy[n].re = x.im; + m_pl_dummy[n].im = -x.re; + break; + } + p++; + } +} diff --git a/plugins/channeltx/moddatv/dvb-s2/dvbs2_tables.cpp b/plugins/channeltx/moddatv/dvb-s2/dvbs2_tables.cpp new file mode 100644 index 000000000..e05861812 --- /dev/null +++ b/plugins/channeltx/moddatv/dvb-s2/dvbs2_tables.cpp @@ -0,0 +1,19 @@ +#include "DVBS2.h" +// +// Modcod error correction +// + +const unsigned long DVBS2::g[6]= +{ + 0x55555555,0x33333333,0x0F0F0F0F,0x00FF00FF,0x0000FFFF,0xFFFFFFFF +}; + +const int DVBS2::ph_scram_tab[64]= +{ + 0,1,1,1,0,0,0,1,1,0,0,1,1,1,0,1,1,0,0,0,0,0,1,1,1,1,0,0,1,0,0,1, + 0,1,0,1,0,0,1,1,0,1,0,0,0,0,1,0,0,0,1,0,1,1,0,1,1,1,1,1,1,0,1,0 +}; +const int DVBS2::ph_sync_seq[26]= +{ + 0,1,1,0,0,0,1,1,0,1,0,0,1,0,1,1,1,0,1,0,0,0,0,0,1,0 +}; diff --git a/plugins/channeltx/moddatv/dvb-s2/readme.md b/plugins/channeltx/moddatv/dvb-s2/readme.md new file mode 100644 index 000000000..50b635bc0 --- /dev/null +++ b/plugins/channeltx/moddatv/dvb-s2/readme.md @@ -0,0 +1 @@ +This DVB-S2 code is from https://github.com/G4GUO/ diff --git a/plugins/channeltx/moddatv/readme.md b/plugins/channeltx/moddatv/readme.md index cf956f298..94b598861 100644 --- a/plugins/channeltx/moddatv/readme.md +++ b/plugins/channeltx/moddatv/readme.md @@ -2,7 +2,7 @@

Introduction

-This plugin can be used to transmit a digital amateur TV signal in the DVB-S standard. The plugin requires the video and audio to be transmitted to be in an MPEG transport stream. +This plugin can be used to transmit a digital amateur TV signal in the DVB-S or DVB-S2 standards. The plugin requires the video and audio to be transmitted to be in an MPEG transport stream. The MPEG transport stream can either be read from a file or streamed via UDP. The MPEG transport stream must (for now) be created outside of SDRangel, using software such as ffmpeg. The MPEG transport stream can contain video compressed using codecs such as MPEG-2, h264 or h265 (HEVC). @@ -11,6 +11,8 @@ The DATV modulator plugin just performs channel coding and modulation of the tra DVB-S includes: scrambling, Reed-Solomon RS(204,188,T=8) coding, convolutional interleaving (I=12), convolutional encoding (code rate=1/2, with optional puncturing to rates of 2/3, 3/4, 5/6 and 7/8) and BPSK or QPSK modulation. +DVB-S2 includes: scrambling, BCH encoder, LDPC encoder, bit interleaver and QPSK, 8PSK, 16APSK or 32APSK modulation. +

Interface

![DATV Modulator plugin GUI](../../../doc/img/DATVMod_plugin.png) @@ -44,7 +46,7 @@ Use this button to toggle mute for this channel. The radio waves on the icon are

6: Standard

-Select the DVB standard to use for channel coding and modulation. Currenty only DVB-S is supported. +Select the DVB standard to use for channel coding and modulation. This can be either DVB-S or DVB-S2.

7: Symbol rate

@@ -67,15 +69,17 @@ When using UDP, the packet size should be an integer multiple of the MPEG transp Forward error correction code rate. This controls the number of bits sent to help the receiver to correct errors. A code rate of 1/2 has the highest overhead (corresponding to a lower data rate), but allows the most amount of errors to be correct. -7/8 has the least overhead (corresponding to higher data rates), but will allow the fewest amount of errors to be corrected. +7/8 (DVB-S) or 9/10 (DVB-S2) has the least overhead (corresponding to higher data rates), but will allow the fewest amount of errors to be corrected.

11: Modulation

-Select the modulation to be used. This can either be BPSK or QPSK. BPSK transmits a single bit per symbol, whereas QPSK transmits two bits per symbol, so has twice the bitrate. +Select the modulation to be used. For DVB-S, this can either be BPSK or QPSK. For DVB-S2, this can be QPSK, 8PSK, 16APSK or 32PSK. + +BPSK transmits a single bit per symbol, whereas QPSK transmits two bits per symbol, so has twice the bitrate. Similar, 8PSK is 3 bits per symbol, 16APSK 4 and 32PSK 5. BPSK, QPSK and 8PSK only modulate phase. 16APSK and 32APKS modulate both phase and amplitude.

12: Roll off

-Roll-off for the root raised cosine filter. For DVB-S, this should be 0.35. +Roll-off for the root raised cosine filter. For DVB-S, this should be 0.35. For DVB-S2 this can be 0.2, 0.25 or 0.35.

13: UDP IP address

@@ -121,11 +125,11 @@ This slider can be used to randomly set the current position in the file when fi An MPEG transport stream file can be created from a video file using ffpmeg: - ffmpeg -i input.avi -pix_fmt yuv420p -r 25 -s 720x576 -aspect 4:3 -c:v hevc -c:a libopus -b:v 500k -b:a 64k -maxrate 600k -bufsize 50k -f mpegts -mpegts_original_network_id 1 -mpegts_transport_stream_id 1 -mpegts_service_id 1 -mpegts_pmt_start_pid 4096 -streamid 0:289 -streamid 1:337 -metadata service_provider="SDRangel" -metadata service_name="SDRangel TV" -y mpeg.ts + ffmpeg -i input.avi -pix_fmt yuv420p -r 25 -s 720x576 -aspect 4:3 -c:v hevc -c:a libopus -b:v 500k -b:a 64k -maxrate 600k -bufsize 50k -f mpegts -mpegts_original_network_id 1 -mpegts_transport_stream_id 1 -mpegts_service_id 1 -mpegts_pmt_start_pid 4096 -streamid 0:289 -streamid 1:337 -metadata service_provider="SDRangel" -metadata service_name="SDRangel TV" -y mpeg.ts To stream from a video camera via UDP (on Windows): - ffmpeg -f dshow -i video="c922 Pro Stream Webcam":audio="Microphone (C922 Pro Stream Webcam)" -pix_fmt yuv420p -r 25 -s 720x576 -aspect 4:3 -c:v hevc -c:a libopus -b:v 500k -b:a 64k -maxrate 600k -bufsize 50k -f mpegts -mpegts_original_network_id 1 -mpegts_transport_stream_id 1 -mpegts_service_id 1 -mpegts_pmt_start_pid 4096 -streamid 0:289 -streamid 1:337 -metadata service_provider="SDRangel" -metadata service_name="SDRangel TV" -flush_packets 0 "udp://127.0.0.1:5004?pkt_size=1316&bitrate=600000" + ffmpeg -f dshow -i video="c922 Pro Stream Webcam":audio="Microphone (C922 Pro Stream Webcam)" -pix_fmt yuv420p -r 25 -s 720x576 -aspect 4:3 -c:v hevc -c:a libopus -b:v 500k -b:a 64k -maxrate 600k -bufsize 50k -f mpegts -mpegts_original_network_id 1 -mpegts_transport_stream_id 1 -mpegts_service_id 1 -mpegts_pmt_start_pid 4096 -streamid 0:289 -streamid 1:337 -metadata service_provider="SDRangel" -metadata service_name="SDRangel TV" -flush_packets 0 "udp://127.0.0.1:5004?pkt_size=1316&bitrate=600000" You can list camera devices with: From 0e2304de1daa34f4a816db638d2e324ad2bf48a5 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Wed, 31 Mar 2021 17:01:47 +0100 Subject: [PATCH 2/2] Fix gcc compiler warnings --- plugins/channeltx/moddatv/datvmodsource.cpp | 9 +++++++++ plugins/channeltx/moddatv/dvb-s2/dvb2_bch.cpp | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/channeltx/moddatv/datvmodsource.cpp b/plugins/channeltx/moddatv/datvmodsource.cpp index 28b0d0874..81c29ac02 100644 --- a/plugins/channeltx/moddatv/datvmodsource.cpp +++ b/plugins/channeltx/moddatv/datvmodsource.cpp @@ -187,6 +187,9 @@ int DATVModSource::getDVBSDataBitrate(const DATVModSettings& settings) case DATVModSettings::FEC35: uncodedBlockSize = 38688; break; + default: + qDebug() << "DATVModSource::getDVBSDataBitrate: Unsupported DVB-S2 code rate"; + break; } fecFactor = (uncodedBlockSize-bbHeaderBits)/(float)codedBlockSize; float symbolsPerFrame = codedBlockSize/bitsPerSymbol; @@ -716,6 +719,9 @@ void DATVModSource::applySettings(const DATVModSettings& settings, bool force) case DATVModSettings::APSK32: m_dvbs2Format.constellation = M_32APSK; break; + default: + qDebug() << "DATVModSource::applySettings: Unsupported modulation for DVB-S2"; + break; } switch (settings.m_fec) @@ -753,6 +759,9 @@ void DATVModSource::applySettings(const DATVModSettings& settings, bool force) case DATVModSettings::FEC35: m_dvbs2Format.code_rate = CR_3_5; break; + default: + qDebug() << "DATVModSource::getDVBSDataBitrate: Unsupported code rate for DVB-S2"; + break; } if (settings.m_rollOff == 0.35f) diff --git a/plugins/channeltx/moddatv/dvb-s2/dvb2_bch.cpp b/plugins/channeltx/moddatv/dvb-s2/dvb2_bch.cpp index 767d11187..6326cdccc 100644 --- a/plugins/channeltx/moddatv/dvb-s2/dvb2_bch.cpp +++ b/plugins/channeltx/moddatv/dvb-s2/dvb2_bch.cpp @@ -32,7 +32,7 @@ void display_poly( int *in, int len ) // void display_poly_pack( unsigned int *in, int len ) { - + (void) in; // loggerf("\n"); for( int i = 0; i < len/32; i++ ) {