Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 60ed5000 authored by Andy Hung's avatar Andy Hung
Browse files

EffectBundle: Proper bundle buffer forwarding of float data.

EffectBundle combines effects on the same session into a single processing step.
Intermediate processing must forward or accumulate float buffers properly.

Test: Compilation
Bug: 70237476
Change-Id: I9344cc6c32e32c15892bd96ea676da635e34e569
parent ad32026a
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -3330,14 +3330,19 @@ int Effect_process(effect_handle_t self,
        //ALOGV("\tEffect_process Not Calling process with %d effects enabled, %d called: Effect %d",
        //pContext->pBundledContext->NumberEffectsEnabled,
        //pContext->pBundledContext->NumberEffectsCalled, pContext->EffectType);
        // 2 is for stereo input

        if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE) {
            for (size_t i=0; i < outBuffer->frameCount*2; i++){
                outBuffer->s16[i] =
                        clamp16((LVM_INT32)outBuffer->s16[i] + (LVM_INT32)inBuffer->s16[i]);
            for (size_t i = 0; i < outBuffer->frameCount * FCC_2; ++i){
#ifdef NATIVE_FLOAT_BUFFER
                outBuffer->f32[i] += inBuffer->f32[i];
#else
                outBuffer->s16[i] = clamp16((LVM_INT32)outBuffer->s16[i] + inBuffer->s16[i]);
#endif
            }
        } else if (outBuffer->raw != inBuffer->raw) {
            memcpy(outBuffer->raw, inBuffer->raw, outBuffer->frameCount*sizeof(LVM_INT16)*2);
            memcpy(outBuffer->raw,
                    inBuffer->raw,
                    outBuffer->frameCount * sizeof(effect_buffer_t) * FCC_2);
        }
    }