Reference.

This commit is contained in:
Steve Checkoway
2006-12-28 04:03:52 +00:00
parent f3fcf9c083
commit 39a2c9647e
3 changed files with 7 additions and 9 deletions
+1 -2
View File
@@ -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 ) )
+5 -6
View File
@@ -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 )
+1 -1
View File
@@ -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>