mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-06 06:46:29 -04:00
audioconvert: reuse hist_mem as window scratch space
Instead of allocating a potentially unsafe 1MB array on the stack to store the window, reuse the hist_mem, which has more than enough space as a scratch space for the window.
This commit is contained in:
parent
057ae16504
commit
c263a52ab7
1 changed files with 3 additions and 3 deletions
|
|
@ -184,10 +184,9 @@ static inline double sinc(double x, double cutoff)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int build_filter(struct resample *r, float *taps, uint32_t stride, uint32_t n_taps,
|
static int build_filter(struct resample *r, float *taps, uint32_t stride, uint32_t n_taps,
|
||||||
uint32_t n_phases, double cutoff)
|
uint32_t n_phases, double cutoff, double *window)
|
||||||
{
|
{
|
||||||
uint32_t i, j, n_taps12 = n_taps/2;
|
uint32_t i, j, n_taps12 = n_taps/2;
|
||||||
double window[n_taps12+1];
|
|
||||||
|
|
||||||
for (i = 0; i <= n_phases; i++) {
|
for (i = 0; i <= n_phases; i++) {
|
||||||
double t = (double) i / (double) n_phases;
|
double t = (double) i / (double) n_phases;
|
||||||
|
|
@ -567,7 +566,8 @@ int resample_native_init(struct resample *r)
|
||||||
spa_memcpy(d->filter, precomp_coeffs[i].filter, filter_size);
|
spa_memcpy(d->filter, precomp_coeffs[i].filter, filter_size);
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
build_filter(r, d->filter, d->filter_stride, n_taps, n_phases, scale);
|
build_filter(r, d->filter, d->filter_stride, n_taps, n_phases, scale,
|
||||||
|
(double *)d->hist_mem);
|
||||||
#ifndef RESAMPLE_DISABLE_PRECOMP
|
#ifndef RESAMPLE_DISABLE_PRECOMP
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue