mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-10-02 17:56:45 -04:00
ATV Demod: added an averaging class for horizontal sync averaging
This commit is contained in:
parent
8b1ea0d178
commit
553a06635d
@ -446,7 +446,7 @@ void ATVDemod::demod(Complex& c)
|
|||||||
|
|
||||||
if (blnComputeImage)
|
if (blnComputeImage)
|
||||||
{
|
{
|
||||||
m_objRegisteredATVScreen->setDataColor(m_intColIndex - m_intNumberSamplePerTop, intVal, intVal, intVal);
|
m_objRegisteredATVScreen->setDataColor(m_intColIndex - m_intNumberSamplePerTop, intVal, intVal, intVal); // TODO: the subtraction should be made with back porch number of samples
|
||||||
}
|
}
|
||||||
|
|
||||||
m_intColIndex++;
|
m_intColIndex++;
|
||||||
@ -454,6 +454,7 @@ void ATVDemod::demod(Complex& c)
|
|||||||
//////////////////////
|
//////////////////////
|
||||||
|
|
||||||
m_blnSynchroDetected=false;
|
m_blnSynchroDetected=false;
|
||||||
|
|
||||||
if((m_objRunning.m_blnHSync) && (m_intRowIndex>1))
|
if((m_objRunning.m_blnHSync) && (m_intRowIndex>1))
|
||||||
{
|
{
|
||||||
//********** Line Synchro 0-0-0 -> 0.3-0.3 0.3 **********
|
//********** Line Synchro 0-0-0 -> 0.3-0.3 0.3 **********
|
||||||
@ -518,6 +519,8 @@ void ATVDemod::demod(Complex& c)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: stabilize horizontal sync by (exponential) averaging the column index at sync detection.
|
||||||
|
// Then on the next block trigger on this column index average.
|
||||||
|
|
||||||
//Horizontal Synchro
|
//Horizontal Synchro
|
||||||
if((m_intColIndex>=m_intNumberSamplePerLine)
|
if((m_intColIndex>=m_intNumberSamplePerLine)
|
||||||
|
@ -297,6 +297,36 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exponential average using integers and alpha as the inverse of a power of two
|
||||||
|
*/
|
||||||
|
class AvgExpInt
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AvgExpInt(int log2Alpha) : m_log2Alpha(log2Alpha), m_m1(0), m_start(true) {}
|
||||||
|
void reset() { m_start = true; }
|
||||||
|
|
||||||
|
int run(int m0)
|
||||||
|
{
|
||||||
|
if (m_start)
|
||||||
|
{
|
||||||
|
m_m1 = m0;
|
||||||
|
m_start = false;
|
||||||
|
return m0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_m1 = m0 + m_m1 - (m_m1>>m_log2Alpha);
|
||||||
|
return m_m1>>m_log2Alpha;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
int m_log2Alpha;
|
||||||
|
int m_m1;
|
||||||
|
bool m_start;
|
||||||
|
};
|
||||||
|
|
||||||
//*************** SCOPE ***************
|
//*************** SCOPE ***************
|
||||||
|
|
||||||
BasebandSampleSink* m_objScopeSink;
|
BasebandSampleSink* m_objScopeSink;
|
||||||
|
Loading…
Reference in New Issue
Block a user