diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-08-12 15:52:57 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-08-12 15:52:57 +0000 |
commit | e73e3f6847f0712eaafc36d91b1851866c191d2a (patch) | |
tree | d9ca2cb2372afb5ccd76d2fb15fca97004353823 | |
parent | 772dfa84a626e3f6bf5b636b90453f6148f4b3aa (diff) | |
parent | 8014baa634d20d4e7cf2aa873ec58446d845dc4e (diff) | |
download | sonivox-android12--mainline-release.tar.gz |
Snap for 7635892 from 8014baa634d20d4e7cf2aa873ec58446d845dc4e to sc-mainline-releaseandroid-mainline-12.0.0_r4android-mainline-12.0.0_r36android12--mainline-release
Change-Id: I9cb6c3db272bbd88147b722c7f92fb61cde64b1d
-rw-r--r-- | arm-wt-22k/lib_src/eas_wtengine.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/arm-wt-22k/lib_src/eas_wtengine.c b/arm-wt-22k/lib_src/eas_wtengine.c index c3012e5..950616e 100644 --- a/arm-wt-22k/lib_src/eas_wtengine.c +++ b/arm-wt-22k/lib_src/eas_wtengine.c @@ -284,6 +284,7 @@ void WT_InterpolateNoLoop (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame) EAS_I32 phaseFrac; EAS_I32 acc0; const EAS_SAMPLE *pSamples; + const EAS_SAMPLE *bufferEndP1; EAS_I32 samp1; EAS_I32 samp2; EAS_I32 numSamples; @@ -298,8 +299,9 @@ void WT_InterpolateNoLoop (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame) pOutputBuffer = pWTIntFrame->pAudioBuffer; phaseInc = pWTIntFrame->frame.phaseIncrement; + bufferEndP1 = (const EAS_SAMPLE*) pWTVoice->loopEnd + 1; pSamples = (const EAS_SAMPLE*) pWTVoice->phaseAccum; - phaseFrac = (EAS_I32)pWTVoice->phaseFrac; + phaseFrac = (EAS_I32)(pWTVoice->phaseFrac & PHASE_FRAC_MASK); /* fetch adjacent samples */ #if defined(_8_BIT_SAMPLES) @@ -314,6 +316,7 @@ void WT_InterpolateNoLoop (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame) while (numSamples--) { + EAS_I32 nextSamplePhaseInc; /* linear interpolation */ acc0 = samp2 - samp1; @@ -328,13 +331,18 @@ void WT_InterpolateNoLoop (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame) /* increment phase */ phaseFrac += phaseInc; /*lint -e{704} <avoid divide>*/ - acc0 = phaseFrac >> NUM_PHASE_FRAC_BITS; + nextSamplePhaseInc = phaseFrac >> NUM_PHASE_FRAC_BITS; /* next sample */ - if (acc0 > 0) { + if (nextSamplePhaseInc > 0) { + + /* check for loop end */ + if ( &pSamples[nextSamplePhaseInc+1] >= bufferEndP1) { + break; + } /* advance sample pointer */ - pSamples += acc0; + pSamples += nextSamplePhaseInc; phaseFrac = (EAS_I32)((EAS_U32)phaseFrac & PHASE_FRAC_MASK); /* fetch new samples */ |