home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
Development
General Development (no feature request here!)
MediaPortal Audio renderer - better video playback quality
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="tourettes" data-source="post: 661501" data-attributes="member: 10858"><p>dAdjustment adjustment is not calculated at all, It is either 1.0, 0.997 or 1.003. This is used for the minor v-sync position correctins and it is the EVR presenter who decides what adjustment should be used - basicly it will slowly move the v-sync into correct position by resampling the audio a bit. So, m_dAdjustment is not related to the audio HW clock at all.</p><p></p><p>[code]</p><p>void MPEVRCustomPresenter::AdjustAVSync(double currentPhaseDiff)</p><p>{</p><p> // Keep a rolling average of last X deviations from target phase. </p><p> // These numbers have values between -0.5 and 0.5</p><p> int tempNextPhDev = (m_nNextPhDev % NUM_PHASE_DEVIATIONS);</p><p> m_sumPhaseDiff -= m_dPhaseDeviations[tempNextPhDev];</p><p> m_dPhaseDeviations[tempNextPhDev] = currentPhaseDiff;</p><p> m_sumPhaseDiff += currentPhaseDiff;</p><p> m_nNextPhDev++;</p><p></p><p> double averagePhaseDifference = m_sumPhaseDiff / NUM_PHASE_DEVIATIONS;</p><p> </p><p> m_avPhaseDiff = averagePhaseDifference;</p><p></p><p> // If we are getting close to target then stop correcting.</p><p> // Since it is a rolling average we will overshoot the target, so we plan to stop early.</p><p> // If we are speeding up, we should stop when above the "green" limit</p><p> if (m_dVariableFreq > 1.0)</p><p> {</p><p> if (averagePhaseDifference > -0.05 )</p><p> {</p><p> m_dVariableFreq = 1.0;</p><p> }</p><p> }</p><p> // If we are slowing down, we should stop when below the "green" limit</p><p> if (m_dVariableFreq < 1.0)</p><p> {</p><p> if (averagePhaseDifference < 0.05 )</p><p> {</p><p> m_dVariableFreq = 1.0;</p><p> }</p><p> }</p><p></p><p> // If we have drifted significantly away from target, let us speed up or slow down until we are within above limits again</p><p> if (averagePhaseDifference > 0.1)</p><p> {</p><p> m_dVariableFreq = 1.003;</p><p> }</p><p> if (averagePhaseDifference < -0.1)</p><p> {</p><p> m_dVariableFreq = 0.997;</p><p> }</p><p></p><p> //Log("VF: %f averagePhaseDif: %f CP: %f ", m_dVariableFreq, averagePhaseDifference, currentPhase);</p><p></p><p> if (m_pAVSyncClock && m_dVariableFreq != m_dPreviousVariableFreq)</p><p> {</p><p> m_pAVSyncClock->AdjustClock(1.0/m_dVariableFreq);</p><p> m_iClockAdjustmentsDone++;</p><p> }</p><p></p><p> m_dPreviousVariableFreq = m_dVariableFreq;</p><p>}</p><p>[/code]</p></blockquote><p></p>
[QUOTE="tourettes, post: 661501, member: 10858"] dAdjustment adjustment is not calculated at all, It is either 1.0, 0.997 or 1.003. This is used for the minor v-sync position correctins and it is the EVR presenter who decides what adjustment should be used - basicly it will slowly move the v-sync into correct position by resampling the audio a bit. So, m_dAdjustment is not related to the audio HW clock at all. [code] void MPEVRCustomPresenter::AdjustAVSync(double currentPhaseDiff) { // Keep a rolling average of last X deviations from target phase. // These numbers have values between -0.5 and 0.5 int tempNextPhDev = (m_nNextPhDev % NUM_PHASE_DEVIATIONS); m_sumPhaseDiff -= m_dPhaseDeviations[tempNextPhDev]; m_dPhaseDeviations[tempNextPhDev] = currentPhaseDiff; m_sumPhaseDiff += currentPhaseDiff; m_nNextPhDev++; double averagePhaseDifference = m_sumPhaseDiff / NUM_PHASE_DEVIATIONS; m_avPhaseDiff = averagePhaseDifference; // If we are getting close to target then stop correcting. // Since it is a rolling average we will overshoot the target, so we plan to stop early. // If we are speeding up, we should stop when above the "green" limit if (m_dVariableFreq > 1.0) { if (averagePhaseDifference > -0.05 ) { m_dVariableFreq = 1.0; } } // If we are slowing down, we should stop when below the "green" limit if (m_dVariableFreq < 1.0) { if (averagePhaseDifference < 0.05 ) { m_dVariableFreq = 1.0; } } // If we have drifted significantly away from target, let us speed up or slow down until we are within above limits again if (averagePhaseDifference > 0.1) { m_dVariableFreq = 1.003; } if (averagePhaseDifference < -0.1) { m_dVariableFreq = 0.997; } //Log("VF: %f averagePhaseDif: %f CP: %f ", m_dVariableFreq, averagePhaseDifference, currentPhase); if (m_pAVSyncClock && m_dVariableFreq != m_dPreviousVariableFreq) { m_pAVSyncClock->AdjustClock(1.0/m_dVariableFreq); m_iClockAdjustmentsDone++; } m_dPreviousVariableFreq = m_dVariableFreq; } [/code] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Development
General Development (no feature request here!)
MediaPortal Audio renderer - better video playback quality
Contact us
RSS
Top
Bottom