Ignore:
Timestamp:
Apr 28, 2016, 6:59:55 PM (9 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
6937842
Parents:
1f4d932
Message:

python/ext/py-cvec.c: rewrite and simplify aubio.cvec, safer and better memory usage (see #49)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/ext/py-fft.c

    r1f4d932 r92a8800  
    1414  cvec_t *out;
    1515  fvec_t *rout;
    16   // bridge for cvec output
    17   Py_cvec *py_out;
    1816} Py_fft;
    1917
     
    6159
    6260  self->out = new_cvec(self->win_s);
    63   self->py_out = (Py_cvec*) PyObject_New (Py_cvec, &Py_cvecType);
    64   Py_XINCREF(self->py_out);
    6561  self->rout = new_fvec(self->win_s);
    6662
     
    7167Py_fft_del (Py_fft *self, PyObject *unused)
    7268{
    73   Py_XDECREF((PyObject*)(self->py_out));
    7469  del_aubio_fft(self->o);
    7570  del_cvec(self->out);
     
    9388  // compute the function
    9489  aubio_fft_do (((Py_fft *)self)->o, &(self->vecin), self->out);
    95 #if 0
    96   Py_cvec * py_out = (Py_cvec*) PyObject_New (Py_cvec, &Py_cvecType);
    97   PyObject* output = PyAubio_CCvecToPyCvec(self->out, py_out);
    98   return output;
    99 #else
    100   // convert cvec to py_cvec, incrementing refcount to keep a copy
    101   return PyAubio_CCvecToPyCvec(self->out, self->py_out);
    102 #endif
     90  // convert cvec to py_cvec
     91  return PyAubio_CCvecToPyCvec(self->out);
    10392}
    10493
     
    118107  }
    119108
    120   if (!PyAubio_ArrayToCCvec (input, &(self->cvecin)) ) {
     109  if (!PyAubio_PyCvecToCCvec (input, &(self->cvecin)) ) {
    121110    return NULL;
    122111  }
Note: See TracChangeset for help on using the changeset viewer.