Reference.
This commit is contained in:
@@ -225,8 +225,7 @@ void AdjustSync::AutosyncTempo()
|
||||
// be enough in most cases.
|
||||
float fFilteredError = 0.0;
|
||||
s_iStepsFiltered = s_vAutosyncTempoData.size();
|
||||
FilterHighErrorPoints( &s_vAutosyncTempoData,
|
||||
fSlope, fIntercept, ERROR_TOO_HIGH );
|
||||
FilterHighErrorPoints( s_vAutosyncTempoData, fSlope, fIntercept, ERROR_TOO_HIGH );
|
||||
s_iStepsFiltered -= s_vAutosyncTempoData.size();
|
||||
|
||||
if( !CalcLeastSquares( s_vAutosyncTempoData, fSlope, fIntercept, fFilteredError ) )
|
||||
|
||||
@@ -1027,21 +1027,20 @@ bool CalcLeastSquares( const vector< pair<float, float> > &vCoordinates,
|
||||
return true;
|
||||
}
|
||||
|
||||
void FilterHighErrorPoints( vector< pair<float, float> > *vCoordinates,
|
||||
void FilterHighErrorPoints( vector< pair<float, float> > &vCoordinates,
|
||||
float fSlope, float fIntercept, float fCutoff )
|
||||
{
|
||||
unsigned int iOut = 0;
|
||||
for( unsigned int iIn = 0; iIn < vCoordinates->size(); ++iIn )
|
||||
for( unsigned int iIn = 0; iIn < vCoordinates.size(); ++iIn )
|
||||
{
|
||||
float fError = ((*vCoordinates)[iIn].second -
|
||||
(fIntercept + fSlope * (*vCoordinates)[iIn].first));
|
||||
const float fError = fIntercept + fSlope * vCoordinates[iIn].first - vCoordinates[iIn].second;
|
||||
if( fabsf(fError) < fCutoff )
|
||||
{
|
||||
(*vCoordinates)[iOut] = (*vCoordinates)[iIn];
|
||||
vCoordinates[iOut] = vCoordinates[iIn];
|
||||
++iOut;
|
||||
}
|
||||
}
|
||||
vCoordinates->resize(iOut);
|
||||
vCoordinates.resize( iOut );
|
||||
}
|
||||
|
||||
void TrimLeft( RString &sStr, const char *s )
|
||||
|
||||
@@ -456,7 +456,7 @@ bool CalcLeastSquares( const vector< pair<float, float> > &vCoordinates,
|
||||
* This method throws away any points that are more than fCutoff away from
|
||||
* the line defined by fSlope and fIntercept.
|
||||
*/
|
||||
void FilterHighErrorPoints( vector< pair<float, float> > *vCoordinates,
|
||||
void FilterHighErrorPoints( vector< pair<float, float> > &vCoordinates,
|
||||
float fSlope, float fIntercept, float fCutoff );
|
||||
|
||||
template<class T1, class T2>
|
||||
|
||||
Reference in New Issue
Block a user