Skip to content

Commit

Permalink
Additional copy optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
sadko4u committed Nov 11, 2023
1 parent 3a91c5a commit bfe01f1
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions src/main/plug/mb_gate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1390,12 +1390,18 @@ namespace lsp
for (size_t i=0; i<channels; ++i)
{
channel_t *c = &vChannels[i];
c->sDelay.process(c->vBuffer, c->vBuffer, to_process); // Apply delay to compensate lookahead feature
dsp::copy(c->vInBuffer, c->vBuffer, to_process);

for (size_t j=0; j<c->nPlanSize; ++j)
// Apply delay to compensate lookahead feature
c->sDelay.process(c->vInBuffer, c->vBuffer, to_process);

// Process first band
gate_band_t *b = c->vPlan[0];
sFilters.process(b->nFilterID, c->vBuffer, c->vInBuffer, b->vVCA, to_process);

// Process other bands
for (size_t j=1; j<c->nPlanSize; ++j)
{
gate_band_t *b = c->vPlan[j];
b = c->vPlan[j];
sFilters.process(b->nFilterID, c->vBuffer, c->vBuffer, b->vVCA, to_process);
}
}
Expand All @@ -1409,18 +1415,15 @@ namespace lsp

// Originally, there is no signal
c->sDelay.process(c->vInBuffer, c->vBuffer, to_process); // Apply delay to compensate lookahead feature, store into vBuffer
dsp::copy(vBuffer, c->vInBuffer, to_process);

gate_band_t *b = c->vPlan[0];
// First step
// Process the signal with all-pass
b->sAllFilter.process(c->vBuffer, c->vBuffer, to_process);
gate_band_t *b = c->vPlan[0];
// Filter frequencies from input
b->sPassFilter.process(vEnv, vBuffer, to_process);
b->sPassFilter.process(vEnv, c->vInBuffer, to_process);
// Apply VCA gain and add to the channel buffer
dsp::mul3(c->vBuffer, vEnv, b->vVCA, to_process);
// Filter frequencies from input
b->sRejFilter.process(vBuffer, vBuffer, to_process);
b->sRejFilter.process(vBuffer, c->vInBuffer, to_process);

// All other steps
for (size_t j=1; j<c->nPlanSize; ++j)
Expand Down Expand Up @@ -1526,12 +1529,14 @@ namespace lsp
{
if (enXOver == XOVER_MODERN)
{
dsp::pcomplex_fill_ri(c->vTr, 1.0f, 0.0f, meta::mb_gate_metadata::FFT_MESH_POINTS);
// Calculate transfer function: first band
gate_band_t *b = c->vPlan[0];
sFilters.freq_chart(b->nFilterID, c->vTr, vFreqs, b->fGainLevel, meta::mb_gate_metadata::FFT_MESH_POINTS);

// Calculate transfer function
for (size_t j=0; j<c->nPlanSize; ++j)
// Calculate transfer function: other bands
for (size_t j=1; j<c->nPlanSize; ++j)
{
gate_band_t *b = c->vPlan[j];
b = c->vPlan[j];
sFilters.freq_chart(b->nFilterID, vTr, vFreqs, b->fGainLevel, meta::mb_gate_metadata::FFT_MESH_POINTS);
dsp::pcomplex_mul2(c->vTr, vTr, meta::mb_gate_metadata::FFT_MESH_POINTS);
}
Expand Down

0 comments on commit bfe01f1

Please sign in to comment.