mirror of
https://github.com/azahar-emu/soundtouch
synced 2025-11-07 07:30:02 +01:00
Modify 'maxnorm' value insider critical section when using OpenMP with integer samples
This commit is contained in:
parent
5d9bc2fdf3
commit
6f82bdebdb
@ -909,10 +909,15 @@ double TDStretch::calcCrossCorr(const short *mixingPos, const short *compare, do
|
|||||||
mixingPos[i + 3] * mixingPos[i + 3]) >> overlapDividerBitsNorm;
|
mixingPos[i + 3] * mixingPos[i + 3]) >> overlapDividerBitsNorm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lnorm > maxnorm)
|
||||||
|
{
|
||||||
|
// modify 'maxnorm' inside critical section to avoid multi-access conflict if in OpenMP mode
|
||||||
|
#pragma omp critical
|
||||||
if (lnorm > maxnorm)
|
if (lnorm > maxnorm)
|
||||||
{
|
{
|
||||||
maxnorm = lnorm;
|
maxnorm = lnorm;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Normalize result by dividing by sqrt(norm) - this step is easiest
|
// Normalize result by dividing by sqrt(norm) - this step is easiest
|
||||||
// done using floating point operation
|
// done using floating point operation
|
||||||
norm = (double)lnorm;
|
norm = (double)lnorm;
|
||||||
|
|||||||
@ -123,10 +123,15 @@ double TDStretchMMX::calcCrossCorr(const short *pV1, const short *pV2, double &d
|
|||||||
// Clear MMS state
|
// Clear MMS state
|
||||||
_m_empty();
|
_m_empty();
|
||||||
|
|
||||||
|
if (norm > (long)maxnorm)
|
||||||
|
{
|
||||||
|
// modify 'maxnorm' inside critical section to avoid multi-access conflict if in OpenMP mode
|
||||||
|
#pragma omp critical
|
||||||
if (norm > (long)maxnorm)
|
if (norm > (long)maxnorm)
|
||||||
{
|
{
|
||||||
maxnorm = norm;
|
maxnorm = norm;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Normalize result by dividing by sqrt(norm) - this step is easiest
|
// Normalize result by dividing by sqrt(norm) - this step is easiest
|
||||||
// done using floating point operation
|
// done using floating point operation
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user