const PolyphaseFilter *FindNearestPolyphaseFilter( int iUpFactor, float fCutoffFrequency ) { /* Find a cached filter with the same iUpFactor and a nearby cutoff frequency. * Round the cutoff down, if possible; it's better to filter out too much than * too little. */ PolyphaseFiltersLock.Lock(); pair<int,float> params( make_pair(iUpFactor, fCutoffFrequency + 0.0001f) ); FilterMap::const_iterator it = g_mapPolyphaseFilters.upper_bound( params ); if( it != g_mapPolyphaseFilters.begin() ) --it; ASSERT( it->first.first == iUpFactor ); PolyphaseFilter *pPolyphase = it->second; PolyphaseFiltersLock.Unlock(); return pPolyphase; }