summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-08-14 01:12:25 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-08-14 01:12:25 +0000
commit4a3242dbe74043e5e90e21324eae38e2ee83de43 (patch)
tree33faade4d6545803c13c840adef828f424678b40
parent97030e46e370403e2e41a07cfe8513f7652c3afe (diff)
parent1ff76551881efa1ac4dc071eb86dd3f2cd0d5a75 (diff)
downloadsonivox-4a3242dbe74043e5e90e21324eae38e2ee83de43.tar.gz
Merge cherrypicks of [15567411, 15567547, 15567447, 15567095, 15567367, 15566999, 15567396, 15567397, 15567412, 15567413, 15567096, 15567448, 15567449, 15567097, 15567098, 15567450, 15567099, 15567398, 15567100, 15567621, 15567622, 15567468, 15567000] into rvc-qpr3-release am: 1ff7655188
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/sonivox/+/15567661 Change-Id: I19ba72667fe7e39a78605212bd4afa8ee33d6371
-rw-r--r--arm-wt-22k/lib_src/eas_wtengine.c16
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 */