Use OpenMP for calculations
This commit is contained in:
1 parent
05c8bfea6c
commit
f2711c53cc
2 files changed
+8
-4
No files matched your search
@@ -135,6 +135,7 @@
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<OmitFramePointers>false</OmitFramePointers>
|
||||
<OpenMPSupport>true</OpenMPSupport>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -157,6 +158,7 @@
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<OpenMPSupport>true</OpenMPSupport>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
||||
@@ -163,16 +163,18 @@ int PtAKF::_GetNote(float samples[_SampleCt], float* restrict maxVolume, float w
|
||||
float lastWeight = 1.f;
|
||||
float maxWeight = 0.f;
|
||||
|
||||
#pragma omp parallel for schedule(static)
|
||||
for (int toneIndex = 0; toneIndex <= _MaxHalfTone; toneIndex++){
|
||||
float curWeight = _AnalyzeByTone(samples, samplesWindowed, toneIndex);
|
||||
|
||||
weights[toneIndex] = curWeight;
|
||||
}
|
||||
|
||||
for (int toneIndex = 0; toneIndex <= _MaxHalfTone; toneIndex++){
|
||||
float curWeight = weights[toneIndex];
|
||||
if(curWeight > maxWeight){
|
||||
maxWeight = curWeight;
|
||||
}
|
||||
|
||||
weights[toneIndex] = curWeight;
|
||||
|
||||
//Filter:
|
||||
if(lastWeight > curWeight || (lastWeight > 0.f && curWeight <= 0.f))
|
||||
lastValidTone = toneIndex - 1;
|
||||
lastWeight = curWeight;
|
||||
|
||||
Reference in new issue
Block a user