Pull out ms buffer onto the heap (was being used after end of block in which it was allocated on the stack)
This commit is contained in:
@@ -86,6 +86,7 @@ RubberBandStretcher::Impl::ChannelData::construct(const std::set<size_t> &sizes,
|
|||||||
|
|
||||||
accumulator = allocate_and_zero<float>(maxSize);
|
accumulator = allocate_and_zero<float>(maxSize);
|
||||||
windowAccumulator = allocate_and_zero<float>(maxSize);
|
windowAccumulator = allocate_and_zero<float>(maxSize);
|
||||||
|
ms = allocate_and_zero<float>(maxSize);
|
||||||
interpolator = allocate_and_zero<float>(maxSize);
|
interpolator = allocate_and_zero<float>(maxSize);
|
||||||
interpolatorScale = 0;
|
interpolatorScale = 0;
|
||||||
|
|
||||||
@@ -176,8 +177,8 @@ RubberBandStretcher::Impl::ChannelData::setSizes(size_t windowSize,
|
|||||||
envelope = reallocate_and_zero(envelope, oldReal, realSize);
|
envelope = reallocate_and_zero(envelope, oldReal, realSize);
|
||||||
fltbuf = reallocate_and_zero(fltbuf, oldMax, maxSize);
|
fltbuf = reallocate_and_zero(fltbuf, oldMax, maxSize);
|
||||||
dblbuf = reallocate_and_zero(dblbuf, oldMax, maxSize);
|
dblbuf = reallocate_and_zero(dblbuf, oldMax, maxSize);
|
||||||
|
ms = reallocate_and_zero(ms, oldMax, maxSize);
|
||||||
interpolator = reallocate_and_zero<float>(interpolator, oldMax, maxSize);
|
interpolator = reallocate_and_zero(interpolator, oldMax, maxSize);
|
||||||
|
|
||||||
// But we do want to preserve data in these
|
// But we do want to preserve data in these
|
||||||
|
|
||||||
@@ -243,6 +244,8 @@ RubberBandStretcher::Impl::ChannelData::~ChannelData()
|
|||||||
deallocate(prevError);
|
deallocate(prevError);
|
||||||
deallocate(unwrappedPhase);
|
deallocate(unwrappedPhase);
|
||||||
deallocate(envelope);
|
deallocate(envelope);
|
||||||
|
deallocate(interpolator);
|
||||||
|
deallocate(ms);
|
||||||
deallocate(accumulator);
|
deallocate(accumulator);
|
||||||
deallocate(windowAccumulator);
|
deallocate(windowAccumulator);
|
||||||
deallocate(fltbuf);
|
deallocate(fltbuf);
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ public:
|
|||||||
float *accumulator;
|
float *accumulator;
|
||||||
size_t accumulatorFill;
|
size_t accumulatorFill;
|
||||||
float *windowAccumulator;
|
float *windowAccumulator;
|
||||||
|
float *ms; // only used when mid-side processing
|
||||||
float *interpolator; // only used when time-domain smoothing is on
|
float *interpolator; // only used when time-domain smoothing is on
|
||||||
int interpolatorScale;
|
int interpolatorScale;
|
||||||
|
|
||||||
|
|||||||
@@ -183,7 +183,6 @@ RubberBandStretcher::Impl::consumeChannel(size_t c,
|
|||||||
|
|
||||||
bool resampling = resampleBeforeStretching();
|
bool resampling = resampleBeforeStretching();
|
||||||
|
|
||||||
float *ms = 0;
|
|
||||||
const float *input = 0;
|
const float *input = 0;
|
||||||
|
|
||||||
bool useMidSide = ((m_options & OptionChannelsTogether) &&
|
bool useMidSide = ((m_options & OptionChannelsTogether) &&
|
||||||
@@ -214,9 +213,8 @@ RubberBandStretcher::Impl::consumeChannel(size_t c,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (useMidSide) {
|
if (useMidSide) {
|
||||||
ms = (float *)alloca(samples * sizeof(float));
|
prepareChannelMS(c, inputs, offset, samples, cd.ms);
|
||||||
prepareChannelMS(c, inputs, offset, samples, ms);
|
input = cd.ms;
|
||||||
input = ms;
|
|
||||||
} else {
|
} else {
|
||||||
input = inputs[c] + offset;
|
input = inputs[c] + offset;
|
||||||
}
|
}
|
||||||
@@ -252,9 +250,8 @@ RubberBandStretcher::Impl::consumeChannel(size_t c,
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (useMidSide) {
|
if (useMidSide) {
|
||||||
ms = (float *)alloca(toWrite * sizeof(float));
|
prepareChannelMS(c, inputs, offset, toWrite, cd.ms);
|
||||||
prepareChannelMS(c, inputs, offset, toWrite, ms);
|
input = cd.ms;
|
||||||
input = ms;
|
|
||||||
} else {
|
} else {
|
||||||
input = inputs[c] + offset;
|
input = inputs[c] + offset;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user