History

oversampler buffer size fix

Matthew Wang committed 6 years ago

Commit 61205ba1 parent 5e8c53e1 file · +8 −8Browse files

Unified · Split

LEAF/Src/leaf-distortion.c+8−8
@@ -23,7 +23,7 @@ · 22 unmodified lines
2323 //============================================================================================================
2424 void tLockhartWavefolder_init(tLockhartWavefolder* const wf)
2525 {
26− _tLockhartWavefolder* w = *wf = (_tLockhartWavefolder*) leaf_alloc(sizeof(_tLockhartWavefolder));
26+ _tLockhartWavefolder* w = *wf = (_tLockhartWavefolder*) leaf_alloc(sizeof(_tLockhartWavefolder));
2727
2828 w->Ln1 = 0.0;
2929 w->Fn1 = 0.0;
@@ -221,8 +221,8 @@ void tOversampler_init(tOversampler* const osr, int ratio, oBool extraQuality) · 191 unmodified lines
221221 os->numTaps = firNumTaps[idx];
222222 os->phaseLength = os->numTaps / os->ratio;
223223 os->pCoeffs = (float*) firCoeffs[idx];
224− os->upState = leaf_alloc(sizeof(float) * os->phaseLength);
225− os->downState = leaf_alloc(sizeof(float) * os->phaseLength);
224+ os->upState = leaf_alloc(sizeof(float) * os->numTaps * 2);
225+ os->downState = leaf_alloc(sizeof(float) * os->numTaps * 2);
226226 }
227227 }
228228
@@ -256,10 +256,10 @@ void tOversampler_upsample(tOversampler* const osr, float input, float* output) · 27 unmodified lines
256256 _tOversampler* os = *osr;
257257
258258 float *pState = os->upState; /* State pointer */
259− const float *pCoeffs = os->pCoeffs; /* Coefficient pointer */
259+ float *pCoeffs = os->pCoeffs; /* Coefficient pointer */
260260 float *pStateCur;
261261 float *ptr1; /* Temporary pointer for state buffer */
262− const float *ptr2; /* Temporary pointer for coefficient buffer */
262+ float *ptr2; /* Temporary pointer for coefficient buffer */
263263 float sum0; /* Accumulators */
264264 uint32_t i, tapCnt; /* Loop counters */
265265 uint32_t phaseLen = os->phaseLength; /* Length of each polyphase filter component */
@@ -329,7 +329,7 @@ void tOversampler_upsample(tOversampler* const osr, float input, float* output) · 63 unmodified lines
329329
330330 /* Points to the start of the state buffer */
331331 pStateCur = os->upState;
332−
332+
333333 /* Initialize tapCnt with number of samples */
334334 tapCnt = (phaseLen - 1U);
335335
@@ -349,10 +349,10 @@ float tOversampler_downsample(tOversampler *const osr, float* input) · 13 unmodified lines
349349 _tOversampler* os = *osr;
350350
351351 float *pState = os->downState; /* State pointer */
352− const float *pCoeffs = os->pCoeffs; /* Coefficient pointer */
352+ float *pCoeffs = os->pCoeffs; /* Coefficient pointer */
353353 float *pStateCur; /* Points to the current sample of the state */
354354 float *px0; /* Temporary pointer for state buffer */
355− const float *pb; /* Temporary pointer for coefficient buffer */
355+ float *pb; /* Temporary pointer for coefficient buffer */
356356 float x0, c0; /* Temporary variables to hold state and coefficient values */
357357 float acc0; /* Accumulator */
358358 uint32_t numTaps = os->numTaps; /* Number of filter coefficients in the filter */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t