1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-02-21 04:58:38 -05:00

ATV Modulator: added vertical bars and vertical gradient inputs

This commit is contained in:
f4exb 2017-03-07 01:38:19 +01:00
parent d5cb0bf267
commit b832ea2173
3 changed files with 49 additions and 12 deletions

View File

@ -37,7 +37,7 @@ ATVMod::ATVMod() :
m_config.m_outputSampleRate = 1000000; m_config.m_outputSampleRate = 1000000;
m_config.m_inputFrequencyOffset = 0; m_config.m_inputFrequencyOffset = 0;
m_config.m_rfBandwidth = 1000000; m_config.m_rfBandwidth = 1000000;
m_config.m_atvModInput = ATVModInputBarChart; m_config.m_atvModInput = ATVModInputHBars;
m_config.m_atvStd = ATVStdPAL625; m_config.m_atvStd = ATVStdPAL625;
applyStandard(); applyStandard();
@ -132,7 +132,7 @@ void ATVMod::modulateSample()
void ATVMod::pullVideo(Real& sample) void ATVMod::pullVideo(Real& sample)
{ {
if ((m_lineCount < 21) || (m_lineCount > 621) || ((m_lineCount > 309) && (m_lineCount < 335))) if ((m_lineCount < 21) || (m_lineCount > 621) || ((m_lineCount > 309) && (m_lineCount < 333)))
{ {
pullVSyncLine(sample); pullVSyncLine(sample);
} }
@ -302,10 +302,16 @@ void ATVMod::applyStandard()
m_pointsPerFSync = (uint32_t) roundf(2.3f * m_pointsPerTU); // equalizing pulse (2.3/1.008 us) m_pointsPerFSync = (uint32_t) roundf(2.3f * m_pointsPerTU); // equalizing pulse (2.3/1.008 us)
// what is left in a 64/1.008 us line for the image // what is left in a 64/1.008 us line for the image
m_pointsPerImgLine = 64 * m_pointsPerTU - m_pointsPerSync - m_pointsPerBP - m_pointsPerFP; m_pointsPerImgLine = 64 * m_pointsPerTU - m_pointsPerSync - m_pointsPerBP - m_pointsPerFP;
m_pointsPerBar = 10 * m_pointsPerTU; // set a bar length to 10/1.008 us (~5 bars per line) m_pointsPerHBar = 10 * m_pointsPerTU; // set a bar length to 10/1.008 us (~5 bars per line)
m_linesPerVBar = 30;
m_nbLines = 525; m_nbLines = 525;
m_nbLines2 = 262;
m_nbImageLines = 510;
m_nbImageLines2 = 205;
m_interlaced = true; m_interlaced = true;
m_nbHorizPoints = 64 * m_pointsPerTU; // full line m_nbHorizPoints = 64 * m_pointsPerTU; // full line
m_hBarIncrement = m_spanLevel / 5.0f;
m_vBarIncrement = m_spanLevel / 10.0f;
break; break;
case ATVStdPAL625: case ATVStdPAL625:
default: default:
@ -315,9 +321,15 @@ void ATVMod::applyStandard()
m_pointsPerFSync = (uint32_t) roundf(2.3f * m_pointsPerTU); // equalizing pulse (2.3 us) m_pointsPerFSync = (uint32_t) roundf(2.3f * m_pointsPerTU); // equalizing pulse (2.3 us)
// what is left in a 64 us line for the image // what is left in a 64 us line for the image
m_pointsPerImgLine = 64 * m_pointsPerTU - m_pointsPerSync - m_pointsPerBP - m_pointsPerFP; m_pointsPerImgLine = 64 * m_pointsPerTU - m_pointsPerSync - m_pointsPerBP - m_pointsPerFP;
m_pointsPerBar = 10 * m_pointsPerTU; // set a bar length to 10 us (~5 bars per line) m_pointsPerHBar = 10 * m_pointsPerTU; // set a bar length to 10 us (~5 bars per line)
m_linesPerVBar = 30;
m_nbLines = 625; m_nbLines = 625;
m_nbLines2 = 312;
m_nbImageLines = 610;
m_nbImageLines2 = 305;
m_interlaced = true; m_interlaced = true;
m_nbHorizPoints = 64 * m_pointsPerTU; // full line m_nbHorizPoints = 64 * m_pointsPerTU; // full line
m_hBarIncrement = m_spanLevel / 5.0f;
m_vBarIncrement = m_spanLevel / 10.0f;
} }
} }

View File

@ -41,8 +41,10 @@ public:
typedef enum typedef enum
{ {
ATVModInputUniform, ATVModInputUniform,
ATVModInputBarChart, ATVModInputHBars,
ATVModInputGradient ATVModInputVBars,
ATVModInputHGradient,
ATVModInputVGradient
} ATVModInput; } ATVModInput;
ATVMod(); ATVMod();
@ -127,7 +129,7 @@ private:
m_inputFrequencyOffset(0), m_inputFrequencyOffset(0),
m_rfBandwidth(0), m_rfBandwidth(0),
m_atvStd(ATVStdPAL625), m_atvStd(ATVStdPAL625),
m_atvModInput(ATVModInputBarChart), m_atvModInput(ATVModInputHBars),
m_uniformLevel(0.5f) m_uniformLevel(0.5f)
{ } { }
}; };
@ -146,10 +148,16 @@ private:
uint32_t m_pointsPerImgLine; //!< number of line points for the image line uint32_t m_pointsPerImgLine; //!< number of line points for the image line
uint32_t m_pointsPerFP; //!< number of line points for the front porch uint32_t m_pointsPerFP; //!< number of line points for the front porch
uint32_t m_pointsPerFSync; //!< number of line points for the field first sync uint32_t m_pointsPerFSync; //!< number of line points for the field first sync
uint32_t m_pointsPerBar; //!< number of line points for a bar of the bar chart uint32_t m_pointsPerHBar; //!< number of line points for a bar of the bar chart
uint32_t m_linesPerVBar; //!< number of lines for a bar of the bar chart
uint32_t m_pointsPerTU; //!< number of line points per time unit uint32_t m_pointsPerTU; //!< number of line points per time unit
uint32_t m_nbLines; //!< number of lines per complete frame uint32_t m_nbLines; //!< number of lines per complete frame
uint32_t m_nbLines2;
uint32_t m_nbImageLines;
uint32_t m_nbImageLines2;
uint32_t m_nbHorizPoints; //!< number of line points per horizontal line uint32_t m_nbHorizPoints; //!< number of line points per horizontal line
float m_hBarIncrement;
float m_vBarIncrement;
bool m_interlaced; //!< true if image is interlaced (2 half frames per frame) bool m_interlaced; //!< true if image is interlaced (2 half frames per frame)
bool m_evenImage; bool m_evenImage;
QMutex m_settingsMutex; QMutex m_settingsMutex;
@ -185,15 +193,22 @@ private:
else if (m_horizontalCount < m_pointsPerSync + m_pointsPerBP + m_pointsPerImgLine) else if (m_horizontalCount < m_pointsPerSync + m_pointsPerBP + m_pointsPerImgLine)
{ {
int pointIndex = m_horizontalCount - (m_pointsPerSync + m_pointsPerBP); int pointIndex = m_horizontalCount - (m_pointsPerSync + m_pointsPerBP);
int iLine = m_lineCount % m_nbLines2;
switch(m_running.m_atvModInput) switch(m_running.m_atvModInput)
{ {
case ATVModInputBarChart: case ATVModInputHBars:
sample = (pointIndex / m_pointsPerBar) * (m_spanLevel/5.0f) + m_blackLevel; sample = (pointIndex / m_pointsPerHBar) * m_hBarIncrement + m_blackLevel;
break; break;
case ATVModInputGradient: case ATVModInputVBars:
sample = (iLine / m_linesPerVBar) * m_vBarIncrement + m_blackLevel;
break;
case ATVModInputHGradient:
sample = (pointIndex / (float) m_pointsPerImgLine) * m_spanLevel + m_blackLevel; sample = (pointIndex / (float) m_pointsPerImgLine) * m_spanLevel + m_blackLevel;
break; break;
case ATVModInputVGradient:
sample = ((iLine -5) / (float) m_nbImageLines2) * m_spanLevel + m_blackLevel;
break;
case ATVModInputUniform: case ATVModInputUniform:
default: default:
sample = m_spanLevel * m_running.m_uniformLevel + m_blackLevel; sample = m_spanLevel * m_running.m_uniformLevel + m_blackLevel;

View File

@ -337,7 +337,17 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Gradient</string> <string>V Bars</string>
</property>
</item>
<item>
<property name="text">
<string>H Grad</string>
</property>
</item>
<item>
<property name="text">
<string>V Grad</string>
</property> </property>
</item> </item>
</widget> </widget>