From 07f6e563a2e84716b820c32c24c01f7606946c4f Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 24 May 2013 13:53:08 -0700 Subject: [PATCH] cmProc2.h: Added _cmSpecDistBump() to cmSpecDist. --- cmProc2.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/cmProc2.c b/cmProc2.c index 32cc04a..28f09e0 100644 --- a/cmProc2.c +++ b/cmProc2.c @@ -3838,8 +3838,50 @@ cmReal_t _cmSpecDistCentMode( cmSpecDist_t* p, cmReal_t* X1m ) return spcUnit; } -void _cmSpecDistFlipAbove( cmSpecDist_t* p, cmReal_t* X1m) +void _cmSpecDistBump( cmSpecDist_t* p, cmReal_t* x, unsigned binCnt, double thresh) { + /* + thresh *= -1; + minDb = -100; + + if db < minDb + db = minDb; + endif + + if db > thresh + y = 1; + else + x = (minDb - db)/(minDb - thresh); + + y = x + (x - (x.^coeff)); + endif + + y = minDb + abs(minDb) * y; + */ + unsigned i=0; + + double minDb = -100.0; + thresh = -thresh; + + for(i=0; i thresh ) + y = 1; + else + { + y = (minDb - x[i])/(minDb - thresh); + y += y - pow(y,p->lwrSlope); + } + + x[i] = minDb + (-minDb) * y; + + } + } @@ -3915,7 +3957,10 @@ cmRC_t cmSpecDistExec( cmSpecDist_t* p, const cmSample_t* sp, unsigned sn ) break; case 4: - _cmSpecDistFlipAbove(p,X1m); + _cmSpecDistBump(p,X1m, p->pva->binCnt, p->thresh); + break; + + case 5: break; default: