Bugfix in equalizer. Seems to be working now. Bugfix in wrapper to make equalizer return array one-dimensional

This commit is contained in:
Anne de Jong 2020-02-23 20:07:21 +01:00
parent 281d4bf921
commit 0940179f50
2 changed files with 6 additions and 6 deletions

View File

@ -23,8 +23,8 @@ vd Eq_equalize(Eq* eq,const vd* input_data) {
assertvalidptr(eq); assertvalidptr(eq);
assert_vx(input_data); assert_vx(input_data);
vd result = vd_alloc(input_data->n_rows); vd result = vd_alloc(input_data->n_rows);
dmat_set(&result, 0);
dmat filtered = Sosfilterbank_filter(eq->fb, input_data); dmat filtered = Sosfilterbank_filter(eq->fb, input_data);
dmat_set(&filtered, 0);
for(us filter=0;filter<eq->nfilters;filter++) { for(us filter=0;filter<eq->nfilters;filter++) {
d ampl = *getvdval(&(eq->ampl_values), filter); d ampl = *getvdval(&(eq->ampl_values), filter);

View File

@ -708,22 +708,22 @@ cdef class Equalizer:
Eq_setLevels(self.ceq, &dmat_new_levels) Eq_setLevels(self.ceq, &dmat_new_levels)
dmat_free(&dmat_new_levels) dmat_free(&dmat_new_levels)
def equalize(self, d[::1, :] input_data): def equalize(self, d[::1] input_data):
assert input_data.shape[1] == 1
cdef: cdef:
vd res vd res
cdef dmat input_dmat = dmat_foreign_data(input_data.shape[0], cdef dmat input_dmat = dmat_foreign_data(input_data.size,
1, 1,
&input_data[0,0], &input_data[0],
False) False)
with nogil: with nogil:
res = Eq_equalize(self.ceq, &input_dmat) res = Eq_equalize(self.ceq, &input_dmat)
# Steal the pointer from output # Steal the pointer from output
py_res = dmat_to_ndarray(&res,True) py_res = dmat_to_ndarray(&res,True)[:,0]
dmat_free(&res) dmat_free(&res)
vd_free(&input_dmat) vd_free(&input_dmat)
return py_res return py_res
def __dealloc__(self): def __dealloc__(self):