Comparision | ClassNameA | MethodA | ClassNameB | MethodNameB | Method A | Method B | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
audioop..audioop_alaw2lin()-audioop..audioop_reverse() | Type 2 | audioop | audioop_al | audioop | audioop_reverse | static PyObje | static PyObject * audioop_reverse(PyObject *self, PyObject *args) { signed char *cp; unsigned char *ncp; int len, size, val = 0; PyObject *rv; int i, j; if ( !PyArg_ParseTuple(args, "s#i:reverse", &cp, &len, &size) ) return 0; if ( size != 1 && size != 2 && size != 4 ) { PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); return 0; } rv = PyString_FromStringAndSize(NULL, len); if ( rv == 0 ) return 0; ncp = (unsigned char *)PyString_AsString(rv); for ( i=0; i < len; i += size ) { if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; else if ( size == 2 ) val = (int)*SHORTP(cp, i); else if ( size == 4 ) val = ((int)*LONGP(cp, i)) >> 16; j = len - i - size; if ( size == 1 ) *CHARP(ncp, j) = (signed char)(val >> 8); else if ( size == 2 ) *SHORTP(ncp, j) = (short)(val); else if ( size == 4 ) *LONGP(ncp, j) = (Py_Int32)(val<<16); } return rv; } |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
audioop..audioop_rms()-audioop..audioop_max() | Type 2 | audioop | audioop_r | audioop | audioop_max | static PyObje | static PyObject * audioop_max(PyObject *self, PyObject *args) { signed char *cp; int len, size, val = 0; int i; int max = 0; if ( !PyArg_ParseTuple(args, "s#i:max", &cp, &len, &size) ) return 0; if ( size != 1 && size != 2 && size != 4 ) { PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); return 0; } for ( i=0; i<len; i+= size) { if ( size == 1 ) val = (int)*CHARP(cp, i); else if ( size == 2 ) val = (int)*SHORTP(cp, i); else if ( size == 4 ) val = (int)*LONGP(cp, i); if ( val < 0 ) val = (-val); if ( val > max ) max = val; } return PyInt_FromLong(max); } |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
audioop..audioop_maxpp()-audioop..audioop_avgpp() | Type 2 | audioop | audioop_m | audioop | audioop_avgpp | static PyObje | static PyObject * audioop_avgpp(PyObject *self, PyObject *args) { signed char *cp; int len, size, val = 0, prevval = 0, prevextremevalid = 0, prevextreme = 0; int i; double avg = 0.0; int diff, prevdiff, extremediff, nextreme = 0; if ( !PyArg_ParseTuple(args, "s#i:avgpp", &cp, &len, &size) ) return 0; if ( size != 1 && size != 2 && size != 4 ) { PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); return 0; } /* Compute first delta value ahead. Also automatically makes us ** skip the first extreme value */ if ( size == 1 ) prevval = (int)*CHARP(cp, 0); else if ( size == 2 ) prevval = (int)*SHORTP(cp, 0); else if ( size == 4 ) prevval = (int)*LONGP(cp, 0); if ( size == 1 ) val = (int)*CHARP(cp, size); else if ( size == 2 ) val = (int)*SHORTP(cp, size); else if ( size == 4 ) val = (int)*LONGP(cp, size); prevdiff = val - prevval; for ( i=size; i<len; i+= size) { if ( size == 1 ) val = (int)*CHARP(cp, i); else if ( size == 2 ) val = (int)*SHORTP(cp, i); else if ( size == 4 ) val = (int)*LONGP(cp, i); diff = val - prevval; if ( diff*prevdiff < 0 ) { /* Derivative changed sign. Compute difference to last ** extreme value and remember. */ if ( prevextremevalid ) { extremediff = prevval - prevextreme; if ( extremediff < 0 ) extremediff = -extremediff; avg += extremediff; nextreme++; } prevextremevalid = 1; prevextreme = prevval; } prevval = val; if ( diff != 0 ) prevdiff = diff; } if ( nextreme == 0 ) val = 0; else val = (int)(avg / (double)nextreme); return PyInt_FromLong(val); } |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
audioop..audioop_avg()-audioop..audioop_minmax() | Type 2 | audioop | audioop_a | audioop | audioop_minmax | static PyObje | static PyObject * audioop_minmax(PyObject *self, PyObject *args) { signed char *cp; int len, size, val = 0; int i; int min = 0x7fffffff, max = -0x7fffffff; if (!PyArg_ParseTuple(args, "s#i:minmax", &cp, &len, &size)) return NULL; if (size != 1 && size != 2 && size != 4) { PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); return NULL; } for (i = 0; i < len; i += size) { if (size == 1) val = (int) *CHARP(cp, i); else if (size == 2) val = (int) *SHORTP(cp, i); else if (size == 4) val = (int) *LONGP(cp, i); if (val > max) max = val; if (val < min) min = val; } return Py_BuildValue("(ii)", min, max); } |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
audioop..audioop_avg()-audioop..audioop_max() | Type 2 | audioop | audioop_a | audioop | audioop_max | static PyObje | static PyObject * audioop_max(PyObject *self, PyObject *args) { signed char *cp; int len, size, val = 0; int i; int max = 0; if ( !PyArg_ParseTuple(args, "s#i:max", &cp, &len, &size) ) return 0; if ( size != 1 && size != 2 && size != 4 ) { PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); return 0; } for ( i=0; i<len; i+= size) { if ( size == 1 ) val = (int)*CHARP(cp, i); else if ( size == 2 ) val = (int)*SHORTP(cp, i); else if ( size == 4 ) val = (int)*LONGP(cp, i); if ( val < 0 ) val = (-val); if ( val > max ) max = val; } return PyInt_FromLong(max); } |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cmathmodule..c_acosh()-cmathmodule..c_atanh() | Type 2 | cmathmod | c_acosh | cmathmodule | c_atanh | static Py_com | static Py_complex c_atanh(Py_complex x) { return c_prod(c_half,c_log(c_quot(c_sum(c_one,x),c_diff(c_one,x)))); } PyDoc_STRVAR(c_atanh_doc, "atanh(x)\n" "\n" "Return the hyperbolic arc tangent of x."); |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
audioop..audioop_bias()-audioop..audioop_ulaw2lin() | Type 2 | audioop | audioop_bi | audioop | audioop_ulaw2lin | static PyObje | static PyObject * audioop_ulaw2lin(PyObject *self, PyObject *args) { unsigned char *cp; unsigned char cval; signed char *ncp; int len, size, val; PyObject *rv; int i; if ( !PyArg_ParseTuple(args, "s#i:ulaw2lin", &cp, &len, &size) ) return 0; if ( size != 1 && size != 2 && size != 4) { PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); return 0; } rv = PyString_FromStringAndSize(NULL, len*size); if ( rv == 0 ) return 0; ncp = (signed char *)PyString_AsString(rv); for ( i=0; i < len*size; i += size ) { cval = *cp++; val = st_ulaw2linear16(cval); if ( size == 1 ) *CHARP(ncp, i) = (signed char)(val >> 8); else if ( size == 2 ) *SHORTP(ncp, i) = (short)(val); else if ( size == 4 ) *LONGP(ncp, i) = (Py_Int32)(val<<16); } return rv; } |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
audioop..audioop_mul()-audioop..audioop_reverse() | Type 3 | audioop | audioop_m | audioop | audioop_reverse | static PyObje | static PyObject * audioop_reverse(PyObject *self, PyObject *args) { signed char *cp; unsigned char *ncp; int len, size, val = 0; PyObject *rv; int i, j; if ( !PyArg_ParseTuple(args, "s#i:reverse", &cp, &len, &size) ) return 0; if ( size != 1 && size != 2 && size != 4 ) { PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); return 0; } rv = PyString_FromStringAndSize(NULL, len); if ( rv == 0 ) return 0; ncp = (unsigned char *)PyString_AsString(rv); for ( i=0; i < len; i += size ) { if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; else if ( size == 2 ) val = (int)*SHORTP(cp, i); else if ( size == 4 ) val = ((int)*LONGP(cp, i)) >> 16; j = len - i - size; if ( size == 1 ) *CHARP(ncp, j) = (signed char)(val >> 8); else if ( size == 2 ) *SHORTP(ncp, j) = (short)(val); else if ( size == 4 ) *LONGP(ncp, j) = (Py_Int32)(val<<16); } return rv; } |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
audioop..audioop_lin2alaw()-audioop..audioop_reverse() | Type 3 | audioop | audioop_li | audioop | audioop_reverse | static PyObje | static PyObject * audioop_reverse(PyObject *self, PyObject *args) { signed char *cp; unsigned char *ncp; int len, size, val = 0; PyObject *rv; int i, j; if ( !PyArg_ParseTuple(args, "s#i:reverse", &cp, &len, &size) ) return 0; if ( size != 1 && size != 2 && size != 4 ) { PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); return 0; } rv = PyString_FromStringAndSize(NULL, len); if ( rv == 0 ) return 0; ncp = (unsigned char *)PyString_AsString(rv); for ( i=0; i < len; i += size ) { if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; else if ( size == 2 ) val = (int)*SHORTP(cp, i); else if ( size == 4 ) val = ((int)*LONGP(cp, i)) >> 16; j = len - i - size; if ( size == 1 ) *CHARP(ncp, j) = (signed char)(val >> 8); else if ( size == 2 ) *SHORTP(ncp, j) = (short)(val); else if ( size == 4 ) *LONGP(ncp, j) = (Py_Int32)(val<<16); } return rv; } |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
audioop..audioop_tomono()-audioop..audioop_mul() | Type 3 | audioop | audioop_t | audioop | audioop_mul | static PyObje | static PyObject * audioop_mul(PyObject *self, PyObject *args) { signed char *cp, *ncp; int len, size, val = 0; double factor, fval, maxval; PyObject *rv; int i; if ( !PyArg_ParseTuple(args, "s#id:mul", &cp, &len, &size, &factor ) ) return 0; if ( size == 1 ) maxval = (double) 0x7f; else if ( size == 2 ) maxval = (double) 0x7fff; else if ( size == 4 ) maxval = (double) 0x7fffffff; else { PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); return 0; } rv = PyString_FromStringAndSize(NULL, len); if ( rv == 0 ) return 0; ncp = (signed char *)PyString_AsString(rv); for ( i=0; i < len; i += size ) { if ( size == 1 ) val = (int)*CHARP(cp, i); else if ( size == 2 ) val = (int)*SHORTP(cp, i); else if ( size == 4 ) val = (int)*LONGP(cp, i); fval = (double)val*factor; if ( fval > maxval ) fval = maxval; else if ( fval < -maxval ) fval = -maxval; val = (int)fval; if ( size == 1 ) *CHARP(ncp, i) = (signed char)val; else if ( size == 2 ) *SHORTP(ncp, i) = (short)val; else if ( size == 4 ) *LONGP(ncp, i) = (Py_Int32)val; } return rv; } |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
audioop..audioop_lin2ulaw()-audioop..audioop_lin2lin() | Type 3 | audioop | audioop_li | audioop | audioop_lin2lin | static PyObje | static PyObject * audioop_lin2lin(PyObject *self, PyObject *args) { signed char *cp; unsigned char *ncp; int len, size, size2, val = 0; PyObject *rv; int i, j; if ( !PyArg_ParseTuple(args, "s#ii:lin2lin", &cp, &len, &size, &size2) ) return 0; if ( (size != 1 && size != 2 && size != 4) || (size2 != 1 && size2 != 2 && size2 != 4)) { PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); return 0; } rv = PyString_FromStringAndSize(NULL, (len/size)*size2); if ( rv == 0 ) return 0; ncp = (unsigned char *)PyString_AsString(rv); for ( i=0, j=0; i < len; i += size, j += size2 ) { if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; else if ( size == 2 ) val = (int)*SHORTP(cp, i); else if ( size == 4 ) val = ((int)*LONGP(cp, i)) >> 16; if ( size2 == 1 ) *CHARP(ncp, j) = (signed char)(val >> 8); else if ( size2 == 2 ) *SHORTP(ncp, j) = (short)(val); else if ( size2 == 4 ) *LONGP(ncp, j) = (Py_Int32)(val<<16); } return rv; } |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
audioop..audioop_lin2ulaw()-audioop..audioop_minmax() | Type 3 | audioop | audioop_li | audioop | audioop_minmax | static PyObje | static PyObject * audioop_minmax(PyObject *self, PyObject *args) { signed char *cp; int len, size, val = 0; int i; int min = 0x7fffffff, max = -0x7fffffff; if (!PyArg_ParseTuple(args, "s#i:minmax", &cp, &len, &size)) return NULL; if (size != 1 && size != 2 && size != 4) { PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); return NULL; } for (i = 0; i < len; i += size) { if (size == 1) val = (int) *CHARP(cp, i); else if (size == 2) val = (int) *SHORTP(cp, i); else if (size == 4) val = (int) *LONGP(cp, i); if (val > max) max = val; if (val < min) min = val; } return Py_BuildValue("(ii)", min, max); } |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
audioop..audioop_getsample()-audioop..audioop_minmax() | Type 3 | audioop | audioop_g | audioop | audioop_minmax | static PyObje | static PyObject * audioop_minmax(PyObject *self, PyObject *args) { signed char *cp; int len, size, val = 0; int i; int min = 0x7fffffff, max = -0x7fffffff; if (!PyArg_ParseTuple(args, "s#i:minmax", &cp, &len, &size)) return NULL; if (size != 1 && size != 2 && size != 4) { PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); return NULL; } for (i = 0; i < len; i += size) { if (size == 1) val = (int) *CHARP(cp, i); else if (size == 2) val = (int) *SHORTP(cp, i); else if (size == 4) val = (int) *LONGP(cp, i); if (val > max) max = val; if (val < min) min = val; } return Py_BuildValue("(ii)", min, max); } |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
audioop..audioop_ulaw2lin()-audioop..audioop_lin2lin() | Type 3 | audioop | audioop_ul | audioop | audioop_lin2lin | static PyObje | static PyObject * audioop_lin2lin(PyObject *self, PyObject *args) { signed char *cp; unsigned char *ncp; int len, size, size2, val = 0; PyObject *rv; int i, j; if ( !PyArg_ParseTuple(args, "s#ii:lin2lin", &cp, &len, &size, &size2) ) return 0; if ( (size != 1 && size != 2 && size != 4) || (size2 != 1 && size2 != 2 && size2 != 4)) { PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); return 0; } rv = PyString_FromStringAndSize(NULL, (len/size)*size2); if ( rv == 0 ) return 0; ncp = (unsigned char *)PyString_AsString(rv); for ( i=0, j=0; i < len; i += size, j += size2 ) { if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; else if ( size == 2 ) val = (int)*SHORTP(cp, i); else if ( size == 4 ) val = ((int)*LONGP(cp, i)) >> 16; if ( size2 == 1 ) *CHARP(ncp, j) = (signed char)(val >> 8); else if ( size2 == 2 ) *SHORTP(ncp, j) = (short)(val); else if ( size2 == 4 ) *LONGP(ncp, j) = (Py_Int32)(val<<16); } return rv; } |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
audioop..audioop_avg()-audioop..audioop_getsample() | Type 3 | audioop | audioop_a | audioop | audioop_getsample | static PyObje | static PyObject * audioop_getsample(PyObject *self, PyObject *args) { signed char *cp; int len, size, val = 0; int i; if ( !PyArg_ParseTuple(args, "s#ii:getsample", &cp, &len, &size, &i) ) return 0; if ( size != 1 && size != 2 && size != 4 ) { PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); return 0; } if ( i < 0 || i >= len/size ) { PyErr_SetString(AudioopError, "Index out of range"); return 0; } if ( size == 1 ) val = (int)*CHARP(cp, i); else if ( size == 2 ) val = (int)*SHORTP(cp, i*2); else if ( size == 4 ) val = (int)*LONGP(cp, i*4); return PyInt_FromLong(val); } |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||