From efad6f948cdf4a5642c5824f754b1dab9f77f496 Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 3 Apr 2017 03:17:37 +0200 Subject: [PATCH] ATV: implemented short vsync non interleaved mode --- plugins/channelrx/demodatv/atvdemod.cpp | 19 +++++++++++++++---- plugins/channelrx/demodatv/atvdemod.h | 4 +++- plugins/channelrx/demodatv/atvdemodgui.ui | 5 +++++ plugins/channeltx/modatv/atvmod.cpp | 19 ++++++++++++++++++- plugins/channeltx/modatv/atvmod.h | 3 ++- plugins/channeltx/modatv/atvmodgui.ui | 5 +++++ 6 files changed, 48 insertions(+), 7 deletions(-) diff --git a/plugins/channelrx/demodatv/atvdemod.cpp b/plugins/channelrx/demodatv/atvdemod.cpp index 8dca7208e..67a92b204 100644 --- a/plugins/channelrx/demodatv/atvdemod.cpp +++ b/plugins/channelrx/demodatv/atvdemod.cpp @@ -64,6 +64,7 @@ ATVDemod::ATVDemod(BasebandSampleSink* objScopeSink) : m_intNumberSamplePerLine=0; m_intSynchroPoints=0; m_intNumberOfLines=0; + m_interleaved = true; m_objMagSqAverage.resize(32, 1.0); @@ -471,7 +472,7 @@ void ATVDemod::demod(Complex& c) m_fltAmpLineAverage=0.0f; //New line + Interleaving - m_intRowIndex += 2; + m_intRowIndex += m_interleaved ? 2 : 1; if (m_intRowIndex < m_intNumberOfLines) { @@ -500,7 +501,7 @@ void ATVDemod::demod(Complex& c) { m_blnVerticalSynchroDetected = true; // prevent repetition - if (m_intLineIndex % 2 == 0) // even => odd image + if ((m_intLineIndex % 2 == 0) || !m_interleaved) // even => odd image { m_objRegisteredATVScreen->renderImage(0); @@ -780,31 +781,41 @@ void ATVDemod::applyStandard() { switch(m_objConfig.m_enmATVStandard) { - case ATVStdShortInterleaved: // Follows loosely the 405 lines standard + case ATVStdShort: // what is left in a line for the image m_intNumberOfSyncLines = 4; m_intNumberOfBlackLines = 4; + m_interleaved = false; + break; + case ATVStdShortInterleaved: + // what is left in a line for the image + m_intNumberOfSyncLines = 4; + m_intNumberOfBlackLines = 4; + m_interleaved = true; break; case ATVStd405: // Follows loosely the 405 lines standard // what is left in a ine for the image m_intNumberOfSyncLines = 24; // (15+7)*2 - 20 m_intNumberOfBlackLines = 28; // above + 4 + m_interleaved = true; break; case ATVStdPAL525: // Follows PAL-M standard // what is left in a 64/1.008 us line for the image m_intNumberOfSyncLines = 40; // (15+15)*2 - 20 m_intNumberOfBlackLines = 44; // above + 4 + m_interleaved = true; break; case ATVStdPAL625: // Follows PAL-B/G/H standard default: // what is left in a 64 us line for the image m_intNumberOfSyncLines = 44; // (15+17)*2 - 20 m_intNumberOfBlackLines = 48; // above + 4 + m_interleaved = true; } // for now all standards apply this m_intNumberSamplePerLineSignals = (int) ((12.0f/64.0f)*m_objConfig.m_fltLineDuration * m_objConfig.m_intSampleRate); // 12.0 = 7.3 + 4.7 - m_intNumberSaplesPerHSync = (int) ((9.4f/64.0f)*m_objConfig.m_fltLineDuration * m_objConfig.m_intSampleRate); // 9.4 = 4.7 + 4.7 + m_intNumberSaplesPerHSync = (int) ((9.6f/64.0f)*m_objConfig.m_fltLineDuration * m_objConfig.m_intSampleRate); // 9.4 = 4.7 + 4.7 } int ATVDemod::getSampleRate() diff --git a/plugins/channelrx/demodatv/atvdemod.h b/plugins/channelrx/demodatv/atvdemod.h index ed833eced..ca5f51093 100644 --- a/plugins/channelrx/demodatv/atvdemod.h +++ b/plugins/channelrx/demodatv/atvdemod.h @@ -50,7 +50,8 @@ public: ATVStdPAL625, ATVStdPAL525, ATVStd405, - ATVStdShortInterleaved + ATVStdShortInterleaved, + ATVStdShort }; enum ATVModulation { @@ -350,6 +351,7 @@ private: int m_intNumberOfBlackLines; //!< this is the total number of lines not part of the image and is used for vertical screen size int m_intNumberSamplePerLineSignals; //!< number of samples in the non image part of the line (signals) int m_intNumberSaplesPerHSync; //!< number of samples per horizontal synchronization pattern (pulse + back porch) + bool m_interleaved; //!< interleaved image //*************** PROCESSING *************** diff --git a/plugins/channelrx/demodatv/atvdemodgui.ui b/plugins/channelrx/demodatv/atvdemodgui.ui index e51a68f35..2d513705b 100644 --- a/plugins/channelrx/demodatv/atvdemodgui.ui +++ b/plugins/channelrx/demodatv/atvdemodgui.ui @@ -576,6 +576,11 @@ SHi + + + SHni + + diff --git a/plugins/channeltx/modatv/atvmod.cpp b/plugins/channeltx/modatv/atvmod.cpp index 71f308691..2f20ebf51 100644 --- a/plugins/channeltx/modatv/atvmod.cpp +++ b/plugins/channeltx/modatv/atvmod.cpp @@ -808,7 +808,6 @@ void ATVMod::applyStandard() m_nbHorizPoints = m_pointsPerLine; m_pointsPerHBar = m_pointsPerImgLine / m_nbBars; - m_linesPerVBar = m_nbImageLines2 / m_nbBars; m_hBarIncrement = m_spanLevel / (float) m_nbBars; m_vBarIncrement = m_spanLevel / (float) m_nbBars; @@ -826,6 +825,22 @@ void ATVMod::applyStandard() switch(m_config.m_atvStd) { + case ATVStdShort: // Follows loosely the 405 lines standard + // what is left in a 64 us line for the image + m_nbImageLines = m_nbLines - 2; // lines less the total number of sync lines + m_nbImageLines2 = m_nbImageLines; // force non interleaved for vbars + m_interleaved = false; + m_nbSyncLinesHeadE = 1; // number of sync lines on the top of a frame even + m_nbSyncLinesHeadO = 1; // number of sync lines on the top of a frame odd + m_nbSyncLinesBottom = 0; + m_nbLongSyncLines = 1; + m_nbHalfLongSync = 0; + m_nbWholeEqLines = 0; + m_singleLongSync = true; + m_nbBlankLines = 1; + m_blankLineLvel = 0.7f; + m_nbLines2 = m_nbLines; // force non interleaved => treated as even for all lines + break; case ATVStdShortInterleaved: // Follows loosely the 405 lines standard // what is left in a 64 us line for the image m_nbImageLines = m_nbLines - 2; // lines less the total number of sync lines @@ -888,6 +903,8 @@ void ATVMod::applyStandard() m_blankLineLvel = m_blackLevel; } + m_linesPerVBar = m_nbImageLines2 / m_nbBars; + if (m_imageOK) { resizeImage(); diff --git a/plugins/channeltx/modatv/atvmod.h b/plugins/channeltx/modatv/atvmod.h index d85c30e66..fa0503b9a 100644 --- a/plugins/channeltx/modatv/atvmod.h +++ b/plugins/channeltx/modatv/atvmod.h @@ -43,7 +43,8 @@ public: ATVStdPAL625, ATVStdPAL525, ATVStd405, - ATVStdShortInterleaved + ATVStdShortInterleaved, + ATVStdShort, } ATVStd; typedef enum diff --git a/plugins/channeltx/modatv/atvmodgui.ui b/plugins/channeltx/modatv/atvmodgui.ui index a9ebcd29a..c97bb5c19 100644 --- a/plugins/channeltx/modatv/atvmodgui.ui +++ b/plugins/channeltx/modatv/atvmodgui.ui @@ -634,6 +634,11 @@ SHi + + + SHni + +