mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-25 18:07:31 +09:00
AAAAAAAA
This commit is contained in:
parent
75ea9b2376
commit
592e211deb
1 changed files with 11 additions and 13 deletions
|
|
@ -292,10 +292,10 @@ inline void TDStretch::overlap(SAMPLETYPE *pOutput, const SAMPLETYPE *pInput, ui
|
|||
// The best position is determined as the position where the two overlapped
|
||||
// sample sequences are 'most alike', in terms of the highest cross-correlation
|
||||
// value over the overlapping period
|
||||
int TDStretch::seekBestOverlapPositionFull(const SAMPLETYPE *refPos)
|
||||
int TDStretch::seekBestOverlapPositionFull(const SAMPLETYPE *refPos)
|
||||
{
|
||||
int bestOffs;
|
||||
double bestCorr;
|
||||
int bestOffs;
|
||||
int i;
|
||||
double norm;
|
||||
|
||||
|
|
@ -306,28 +306,28 @@ int TDStretch::seekBestOverlapPositionFull(const SAMPLETYPE *refPos)
|
|||
// over the permitted range.
|
||||
bestCorr = calcCrossCorr(refPos, pMidBuffer, norm);
|
||||
bestCorr = (bestCorr + 0.1) * 0.75;
|
||||
|
||||
const int seekLen = seekLength;
|
||||
const int nChannels = channels;
|
||||
const SAMPLETYPE *midBuffer = pMidBuffer;
|
||||
|
||||
#if defined(_OPENMP)
|
||||
#pragma omp parallel for default(none) shared(refPos, bestCorr, bestOffs, midBuffer) private(i) schedule(static)
|
||||
#pragma omp parallel for default(none) \
|
||||
shared(refPos, bestCorr, bestOffs, midBuffer, seekLen, nChannels) \
|
||||
private(i) schedule(static)
|
||||
#endif
|
||||
for (i = 1; i < seekLen; i ++)
|
||||
for (i = 1; i < seekLen; i ++)
|
||||
{
|
||||
double corr;
|
||||
double localNorm;
|
||||
|
||||
// Calculates correlation value for the mixing position corresponding to 'i'
|
||||
#if defined(_OPENMP) || defined(ST_SIMD_AVOID_UNALIGNED)
|
||||
// in parallel OpenMP mode, can't use norm accumulator version as parallel executor won't
|
||||
// iterate the loop in sequential order
|
||||
// in SIMD mode, avoid accumulator version to allow avoiding unaligned positions
|
||||
corr = calcCrossCorr(refPos + nChannels * i, midBuffer, localNorm);
|
||||
#else
|
||||
// In non-parallel version call "calcCrossCorrAccumulate" that is otherwise same
|
||||
// as "calcCrossCorr", but saves time by reusing & updating previously stored
|
||||
// "norm" value
|
||||
corr = calcCrossCorrAccumulate(refPos + nChannels * i, midBuffer, norm);
|
||||
#endif
|
||||
|
||||
// heuristic rule to slightly favour values close to mid of the range
|
||||
double tmp = (double)(2 * i - seekLen) / (double)seekLen;
|
||||
corr = ((corr + 0.1) * (1.0 - 0.25 * tmp * tmp));
|
||||
|
|
@ -336,8 +336,6 @@ for (i = 1; i < seekLen; i ++)
|
|||
if (corr > bestCorr)
|
||||
{
|
||||
// For optimal performance, enter critical section only in case that best value found.
|
||||
// in such case repeat 'if' condition as it's possible that parallel execution may have
|
||||
// updated the bestCorr value in the mean time
|
||||
#if defined(_OPENMP)
|
||||
#pragma omp critical(soundtouch_bestcorr)
|
||||
#endif
|
||||
|
|
@ -353,7 +351,7 @@ for (i = 1; i < seekLen; i ++)
|
|||
adaptNormalizer();
|
||||
#endif
|
||||
|
||||
// clear cross correlation routine state if necessary (is so e.g. in MMX routines).
|
||||
// clear cross correlation routine state if necessary
|
||||
clearCrossCorrState();
|
||||
|
||||
return bestOffs;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue