/Users/richardeakin/projects/libsms/trunk/src/peakContinuation.c File Reference

peak continuation algorithm and functions More...

#include "sms.h"
Include dependency graph for peakContinuation.c:

Defines

#define GUIDE_BEG   -2
#define GUIDE_DEAD   -1
#define GUIDE_ACTIVE   0
#define MAX_CONT_CANDIDATES   5

Functions

static int GetNextClosestPeak (sfloat fGuideFreq, sfloat *pFFreqDistance, SMS_Peak *pSpectralPeaks, SMS_AnalParams *pAnalParams, sfloat fFreqDev)
 function to get the next closest peak from a guide
static int ChooseBestCand (SMS_ContCandidate *pCandidate, int nCandidates, sfloat fFreqDev)
 choose the best candidate out of all
static int CheckForConflict (int iBestPeak, SMS_Guide *pGuides, int nGuides)
 check for one guide that has choosen iBestPeak
static int BestGuide (int iConflictingGuide, int iGuide, SMS_Guide *pGuides, SMS_Peak *pSpectralPeaks)
 chose the best of the two guides for the conflicting peak
static int GetBestPeak (SMS_Guide *pGuides, int iGuide, SMS_Peak *pSpectralPeaks, SMS_AnalParams *pAnalParams, sfloat fFreqDev)
 function to find the best continuation peak for a given guide
static int GetNextMax (SMS_Peak *pSpectralPeaks, sfloat *pFCurrentMax)
 function to get the next maximum (magnitude) peak
static int GetStartingPeak (int iGuide, SMS_Guide *pGuides, int nGuides, SMS_Peak *pSpectralPeaks, sfloat *pFCurrentMax)
 function to get a good starting peak for a track
int sms_peakContinuation (int iFrame, SMS_AnalParams *pAnalParams)
 function to advance the guides through the next frame

Detailed Description

peak continuation algorithm and functions


Define Documentation

#define GUIDE_ACTIVE   0

Referenced by sms_peakContinuation().

#define GUIDE_BEG   -2

diferent status of guide

Referenced by GetStartingPeak().

#define GUIDE_DEAD   -1

Referenced by sms_peakContinuation().

#define MAX_CONT_CANDIDATES   5

maximum number of peak continuation candidates

Referenced by GetBestPeak().


Function Documentation

static int BestGuide ( int  iConflictingGuide,
int  iGuide,
SMS_Guide pGuides,
SMS_Peak pSpectralPeaks 
) [static]

chose the best of the two guides for the conflicting peak

Parameters:
iConflictingGuide conflicting guide number
iGuide guide number
pGuides array of guides
pSpectralPeaks array of peaks
Returns:
number of guide

References SMS_Guide::iPeakChosen, and sfloat.

Referenced by GetBestPeak().

static int CheckForConflict ( int  iBestPeak,
SMS_Guide pGuides,
int  nGuides 
) [static]

check for one guide that has choosen iBestPeak

Parameters:
iBestPeak choosen peak for a guide
pGuides array of guides
nGuides total number of guides
Returns:
number of guide that chose the peak, or -1 if none

Referenced by GetBestPeak(), and GetStartingPeak().

static int ChooseBestCand ( SMS_ContCandidate pCandidate,
int  nCandidates,
sfloat  fFreqDev 
) [static]

choose the best candidate out of all

Parameters:
pCandidate pointer to all the continuation candidates
nCandidates number of candidates
fFreqDev maximum frequency deviation allowed
Returns:
the peak number of the best candidate

References SMS_ContCandidate::fFreqDev, SMS_ContCandidate::fMagDev, and sfloat.

Referenced by GetBestPeak().

static int GetBestPeak ( SMS_Guide pGuides,
int  iGuide,
SMS_Peak pSpectralPeaks,
SMS_AnalParams pAnalParams,
sfloat  fFreqDev 
) [static]

function to find the best continuation peak for a given guide

Parameters:
pGuides guide attributes
iGuide number of guide
pSpectralPeaks peak values at the current frame
pAnalParams analysis parameters
fFreqDev frequency deviation allowed
Returns:
the peak number

References BestGuide(), CheckForConflict(), ChooseBestCand(), SMS_Guide::fFreq, SMS_ContCandidate::fFreqDev, SMS_AnalParams::fFreqDeviation, SMS_Guide::fMag, SMS_ContCandidate::fMagDev, GetNextClosestPeak(), SMS_AnalParams::iDebugMode, SMS_ContCandidate::iPeak, SMS_Guide::iPeakChosen, MAX_CONT_CANDIDATES, SMS_AnalParams::nGuides, sfloat, SMS_DBG_ALL, and SMS_DBG_PEAK_CONT.

Referenced by sms_peakContinuation().

Here is the call graph for this function:

static int GetNextClosestPeak ( sfloat  fGuideFreq,
sfloat *  pFFreqDistance,
SMS_Peak pSpectralPeaks,
SMS_AnalParams pAnalParams,
sfloat  fFreqDev 
) [static]

function to get the next closest peak from a guide

Parameters:
fGuideFreq guide's frequency
pFFreqDistance distance of last best peak from guide
pSpectralPeaks array of peaks
pAnalParams analysis parameters
fFreqDev maximum deviation from guide
Returns:
peak number or -1 if nothing is good

References SMS_Peak::fFreq, sfloat, and SMS_MAX_NPEAKS.

Referenced by GetBestPeak().

static int GetNextMax ( SMS_Peak pSpectralPeaks,
sfloat *  pFCurrentMax 
) [static]

function to get the next maximum (magnitude) peak

Parameters:
pSpectralPeaks array of peaks
pFCurrentMax last peak maximum
Returns:
the number of the maximum peak

References SMS_Peak::fMag, sfloat, and SMS_MAX_NPEAKS.

Referenced by GetStartingPeak().

static int GetStartingPeak ( int  iGuide,
SMS_Guide pGuides,
int  nGuides,
SMS_Peak pSpectralPeaks,
sfloat *  pFCurrentMax 
) [static]

function to get a good starting peak for a track

Parameters:
iGuide current guide
pGuides array of guides
nGuides total number of guides
pSpectralPeaks array of peaks
pFCurrentMax current peak maximum
Returns:
Todo:
should this return something?

References CheckForConflict(), SMS_Peak::fFreq, SMS_Guide::fFreq, GetNextMax(), GUIDE_BEG, SMS_Guide::iPeakChosen, and SMS_Guide::iStatus.

Referenced by sms_peakContinuation().

Here is the call graph for this function:

int sms_peakContinuation ( int  iFrame,
SMS_AnalParams pAnalParams 
)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on Thu Oct 29 04:08:07 2009 for libsms by  doxygen 1.6.1