diff options
Diffstat (limited to 'Modules/audioop.c')
-rw-r--r-- | Modules/audioop.c | 124 |
1 files changed, 68 insertions, 56 deletions
diff --git a/Modules/audioop.c b/Modules/audioop.c index 9a5d8c16bb..1e131d2476 100644 --- a/Modules/audioop.c +++ b/Modules/audioop.c @@ -46,7 +46,7 @@ fbound(double val, double minval, double maxval) */ #define BIAS 0x84 /* define the add-in bias for 16 bit samples */ #define CLIP 32635 -#define SIGN_BIT (0x80) /* Sign bit for a A-law byte. */ +#define SIGN_BIT (0x80) /* Sign bit for an A-law byte. */ #define QUANT_MASK (0xf) /* Quantization field mask. */ #define SEG_SHIFT (4) /* Left shift for segment number. */ #define SEG_MASK (0x70) /* Segment field mask. */ @@ -217,7 +217,7 @@ static PyInt16 _st_alaw2linear16[256] = { }; /* - * linear2alaw() accepts an 13-bit signed integer and encodes it as A-law data + * linear2alaw() accepts a 13-bit signed integer and encodes it as A-law data * stored in an unsigned char. This function should only be called with * the data shifted such that it only contains information in the lower * 13-bits. @@ -391,10 +391,9 @@ audioop_check_parameters(Py_ssize_t len, int size) } /*[clinic input] -output preset file module audioop [clinic start generated code]*/ -/*[clinic end generated code: output=da39a3ee5e6b4b0d input=5619f935f269199a]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=8fa8f6611be3591a]*/ /*[clinic input] audioop.getsample @@ -408,8 +407,9 @@ Return the value of sample index from the fragment. [clinic start generated code]*/ static PyObject * -audioop_getsample_impl(PyModuleDef *module, Py_buffer *fragment, int width, Py_ssize_t index) -/*[clinic end generated code: output=f4482497e6f6e78f input=88edbe2871393549]*/ +audioop_getsample_impl(PyObject *module, Py_buffer *fragment, int width, + Py_ssize_t index) +/*[clinic end generated code: output=8fe1b1775134f39a input=88edbe2871393549]*/ { int val; @@ -434,8 +434,8 @@ Return the maximum of the absolute value of all samples in a fragment. [clinic start generated code]*/ static PyObject * -audioop_max_impl(PyModuleDef *module, Py_buffer *fragment, int width) -/*[clinic end generated code: output=85047ee1001f2305 input=32bea5ea0ac8c223]*/ +audioop_max_impl(PyObject *module, Py_buffer *fragment, int width) +/*[clinic end generated code: output=e6c5952714f1c3f0 input=32bea5ea0ac8c223]*/ { Py_ssize_t i; unsigned int absval, max = 0; @@ -462,8 +462,8 @@ Return the minimum and maximum values of all samples in the sound fragment. [clinic start generated code]*/ static PyObject * -audioop_minmax_impl(PyModuleDef *module, Py_buffer *fragment, int width) -/*[clinic end generated code: output=ae8f5513c64fd569 input=89848e9b927a0696]*/ +audioop_minmax_impl(PyObject *module, Py_buffer *fragment, int width) +/*[clinic end generated code: output=473fda66b15c836e input=89848e9b927a0696]*/ { Py_ssize_t i; /* -1 trick below is needed on Windows to support -0x80000000 without @@ -491,8 +491,8 @@ Return the average over all samples in the fragment. [clinic start generated code]*/ static PyObject * -audioop_avg_impl(PyModuleDef *module, Py_buffer *fragment, int width) -/*[clinic end generated code: output=7fccd645c95f4860 input=1114493c7611334d]*/ +audioop_avg_impl(PyObject *module, Py_buffer *fragment, int width) +/*[clinic end generated code: output=4410a4c12c3586e6 input=1114493c7611334d]*/ { Py_ssize_t i; int avg; @@ -520,8 +520,8 @@ Return the root-mean-square of the fragment, i.e. sqrt(sum(S_i^2)/n). [clinic start generated code]*/ static PyObject * -audioop_rms_impl(PyModuleDef *module, Py_buffer *fragment, int width) -/*[clinic end generated code: output=7b398702c81b709d input=4cc57c6c94219d78]*/ +audioop_rms_impl(PyObject *module, Py_buffer *fragment, int width) +/*[clinic end generated code: output=1e7871c826445698 input=4cc57c6c94219d78]*/ { Py_ssize_t i; unsigned int res; @@ -594,8 +594,9 @@ Try to match reference as well as possible to a portion of fragment. [clinic start generated code]*/ static PyObject * -audioop_findfit_impl(PyModuleDef *module, Py_buffer *fragment, Py_buffer *reference) -/*[clinic end generated code: output=505fd04d4244db31 input=62c305605e183c9a]*/ +audioop_findfit_impl(PyObject *module, Py_buffer *fragment, + Py_buffer *reference) +/*[clinic end generated code: output=5752306d83cbbada input=62c305605e183c9a]*/ { const short *cp1, *cp2; Py_ssize_t len1, len2; @@ -662,8 +663,9 @@ Return a factor F such that rms(add(fragment, mul(reference, -F))) is minimal. [clinic start generated code]*/ static PyObject * -audioop_findfactor_impl(PyModuleDef *module, Py_buffer *fragment, Py_buffer *reference) -/*[clinic end generated code: output=ddf35a1e57575ce4 input=816680301d012b21]*/ +audioop_findfactor_impl(PyObject *module, Py_buffer *fragment, + Py_buffer *reference) +/*[clinic end generated code: output=14ea95652c1afcf8 input=816680301d012b21]*/ { const short *cp1, *cp2; Py_ssize_t len; @@ -703,8 +705,9 @@ Search fragment for a slice of specified number of samples with maximum energy. [clinic start generated code]*/ static PyObject * -audioop_findmax_impl(PyModuleDef *module, Py_buffer *fragment, Py_ssize_t length) -/*[clinic end generated code: output=21d0c2a1e5655134 input=2f304801ed42383c]*/ +audioop_findmax_impl(PyObject *module, Py_buffer *fragment, + Py_ssize_t length) +/*[clinic end generated code: output=f008128233523040 input=2f304801ed42383c]*/ { const short *cp1; Py_ssize_t len1; @@ -756,8 +759,8 @@ Return the average peak-peak value over all samples in the fragment. [clinic start generated code]*/ static PyObject * -audioop_avgpp_impl(PyModuleDef *module, Py_buffer *fragment, int width) -/*[clinic end generated code: output=06c8380fd6e34207 input=0b3cceeae420a7d9]*/ +audioop_avgpp_impl(PyObject *module, Py_buffer *fragment, int width) +/*[clinic end generated code: output=269596b0d5ae0b2b input=0b3cceeae420a7d9]*/ { Py_ssize_t i; int prevval, prevextremevalid = 0, prevextreme = 0; @@ -813,8 +816,8 @@ Return the maximum peak-peak value in the sound fragment. [clinic start generated code]*/ static PyObject * -audioop_maxpp_impl(PyModuleDef *module, Py_buffer *fragment, int width) -/*[clinic end generated code: output=c300c0bd7e8535c0 input=671a13e1518f80a1]*/ +audioop_maxpp_impl(PyObject *module, Py_buffer *fragment, int width) +/*[clinic end generated code: output=5b918ed5dbbdb978 input=671a13e1518f80a1]*/ { Py_ssize_t i; int prevval, prevextremevalid = 0, prevextreme = 0; @@ -866,8 +869,8 @@ Return the number of zero crossings in the fragment passed as an argument. [clinic start generated code]*/ static PyObject * -audioop_cross_impl(PyModuleDef *module, Py_buffer *fragment, int width) -/*[clinic end generated code: output=99e6572d7d7cdbf1 input=b1b3f15b83f6b41a]*/ +audioop_cross_impl(PyObject *module, Py_buffer *fragment, int width) +/*[clinic end generated code: output=5938dcdd74a1f431 input=b1b3f15b83f6b41a]*/ { Py_ssize_t i; int prevval; @@ -897,8 +900,9 @@ Return a fragment that has all samples in the original fragment multiplied by th [clinic start generated code]*/ static PyObject * -audioop_mul_impl(PyModuleDef *module, Py_buffer *fragment, int width, double factor) -/*[clinic end generated code: output=a697ebbd5852d38f input=c726667baa157d3c]*/ +audioop_mul_impl(PyObject *module, Py_buffer *fragment, int width, + double factor) +/*[clinic end generated code: output=6cd48fe796da0ea4 input=c726667baa157d3c]*/ { signed char *ncp; Py_ssize_t i; @@ -938,8 +942,9 @@ Convert a stereo fragment to a mono fragment. [clinic start generated code]*/ static PyObject * -audioop_tomono_impl(PyModuleDef *module, Py_buffer *fragment, int width, double lfactor, double rfactor) -/*[clinic end generated code: output=436e7710521661dd input=c4ec949b3f4dddfa]*/ +audioop_tomono_impl(PyObject *module, Py_buffer *fragment, int width, + double lfactor, double rfactor) +/*[clinic end generated code: output=235c8277216d4e4e input=c4ec949b3f4dddfa]*/ { signed char *cp, *ncp; Py_ssize_t len, i; @@ -986,8 +991,9 @@ Generate a stereo fragment from a mono fragment. [clinic start generated code]*/ static PyObject * -audioop_tostereo_impl(PyModuleDef *module, Py_buffer *fragment, int width, double lfactor, double rfactor) -/*[clinic end generated code: output=6ff50681c87f4c1c input=27b6395ebfdff37a]*/ +audioop_tostereo_impl(PyObject *module, Py_buffer *fragment, int width, + double lfactor, double rfactor) +/*[clinic end generated code: output=046f13defa5f1595 input=27b6395ebfdff37a]*/ { signed char *ncp; Py_ssize_t i; @@ -1033,8 +1039,9 @@ Return a fragment which is the addition of the two samples passed as parameters. [clinic start generated code]*/ static PyObject * -audioop_add_impl(PyModuleDef *module, Py_buffer *fragment1, Py_buffer *fragment2, int width) -/*[clinic end generated code: output=f9218bf9ea75c3f1 input=4a8d4bae4c1605c7]*/ +audioop_add_impl(PyObject *module, Py_buffer *fragment1, + Py_buffer *fragment2, int width) +/*[clinic end generated code: output=60140af4d1aab6f2 input=4a8d4bae4c1605c7]*/ { signed char *ncp; Py_ssize_t i; @@ -1091,8 +1098,8 @@ Return a fragment that is the original fragment with a bias added to each sample [clinic start generated code]*/ static PyObject * -audioop_bias_impl(PyModuleDef *module, Py_buffer *fragment, int width, int bias) -/*[clinic end generated code: output=8ec80b3f5d510a51 input=2b5cce5c3bb4838c]*/ +audioop_bias_impl(PyObject *module, Py_buffer *fragment, int width, int bias) +/*[clinic end generated code: output=6e0aa8f68f045093 input=2b5cce5c3bb4838c]*/ { signed char *ncp; Py_ssize_t i; @@ -1150,8 +1157,8 @@ Reverse the samples in a fragment and returns the modified fragment. [clinic start generated code]*/ static PyObject * -audioop_reverse_impl(PyModuleDef *module, Py_buffer *fragment, int width) -/*[clinic end generated code: output=6ec3c91337f5925e input=668f890cf9f9d225]*/ +audioop_reverse_impl(PyObject *module, Py_buffer *fragment, int width) +/*[clinic end generated code: output=b44135698418da14 input=668f890cf9f9d225]*/ { unsigned char *ncp; Py_ssize_t i; @@ -1183,8 +1190,8 @@ Convert big-endian samples to little-endian and vice versa. [clinic start generated code]*/ static PyObject * -audioop_byteswap_impl(PyModuleDef *module, Py_buffer *fragment, int width) -/*[clinic end generated code: output=bfe4aa584b7a3f5b input=fae7611ceffa5c82]*/ +audioop_byteswap_impl(PyObject *module, Py_buffer *fragment, int width) +/*[clinic end generated code: output=50838a9e4b87cd4d input=fae7611ceffa5c82]*/ { unsigned char *ncp; Py_ssize_t i; @@ -1218,8 +1225,9 @@ Convert samples between 1-, 2-, 3- and 4-byte formats. [clinic start generated code]*/ static PyObject * -audioop_lin2lin_impl(PyModuleDef *module, Py_buffer *fragment, int width, int newwidth) -/*[clinic end generated code: output=3f9468a74472a93e input=5ce08c8aa2f24d96]*/ +audioop_lin2lin_impl(PyObject *module, Py_buffer *fragment, int width, + int newwidth) +/*[clinic end generated code: output=17b14109248f1d99 input=5ce08c8aa2f24d96]*/ { unsigned char *ncp; Py_ssize_t i, j; @@ -1275,8 +1283,10 @@ Convert the frame rate of the input fragment. [clinic start generated code]*/ static PyObject * -audioop_ratecv_impl(PyModuleDef *module, Py_buffer *fragment, int width, int nchannels, int inrate, int outrate, PyObject *state, int weightA, int weightB) -/*[clinic end generated code: output=5585dddc4b5ff236 input=aff3acdc94476191]*/ +audioop_ratecv_impl(PyObject *module, Py_buffer *fragment, int width, + int nchannels, int inrate, int outrate, PyObject *state, + int weightA, int weightB) +/*[clinic end generated code: output=624038e843243139 input=aff3acdc94476191]*/ { char *cp, *ncp; Py_ssize_t len; @@ -1454,8 +1464,8 @@ Convert samples in the audio fragment to u-LAW encoding. [clinic start generated code]*/ static PyObject * -audioop_lin2ulaw_impl(PyModuleDef *module, Py_buffer *fragment, int width) -/*[clinic end generated code: output=26263cc877c5e1bc input=2450d1b870b6bac2]*/ +audioop_lin2ulaw_impl(PyObject *module, Py_buffer *fragment, int width) +/*[clinic end generated code: output=14fb62b16fe8ea8e input=2450d1b870b6bac2]*/ { unsigned char *ncp; Py_ssize_t i; @@ -1487,8 +1497,8 @@ Convert sound fragments in u-LAW encoding to linearly encoded sound fragments. [clinic start generated code]*/ static PyObject * -audioop_ulaw2lin_impl(PyModuleDef *module, Py_buffer *fragment, int width) -/*[clinic end generated code: output=9864cb34e3a1d876 input=45d53ddce5be7d06]*/ +audioop_ulaw2lin_impl(PyObject *module, Py_buffer *fragment, int width) +/*[clinic end generated code: output=378356b047521ba2 input=45d53ddce5be7d06]*/ { unsigned char *cp; signed char *ncp; @@ -1527,8 +1537,8 @@ Convert samples in the audio fragment to a-LAW encoding. [clinic start generated code]*/ static PyObject * -audioop_lin2alaw_impl(PyModuleDef *module, Py_buffer *fragment, int width) -/*[clinic end generated code: output=d5bf14bd0fe6fdcd input=ffb1ef8bb39da945]*/ +audioop_lin2alaw_impl(PyObject *module, Py_buffer *fragment, int width) +/*[clinic end generated code: output=d076f130121a82f0 input=ffb1ef8bb39da945]*/ { unsigned char *ncp; Py_ssize_t i; @@ -1560,8 +1570,8 @@ Convert sound fragments in a-LAW encoding to linearly encoded sound fragments. [clinic start generated code]*/ static PyObject * -audioop_alaw2lin_impl(PyModuleDef *module, Py_buffer *fragment, int width) -/*[clinic end generated code: output=d2b604ddd036e1cd input=4140626046cd1772]*/ +audioop_alaw2lin_impl(PyObject *module, Py_buffer *fragment, int width) +/*[clinic end generated code: output=85c365ec559df647 input=4140626046cd1772]*/ { unsigned char *cp; signed char *ncp; @@ -1602,8 +1612,9 @@ Convert samples to 4 bit Intel/DVI ADPCM encoding. [clinic start generated code]*/ static PyObject * -audioop_lin2adpcm_impl(PyModuleDef *module, Py_buffer *fragment, int width, PyObject *state) -/*[clinic end generated code: output=4654c29d2731fafe input=12919d549b90c90a]*/ +audioop_lin2adpcm_impl(PyObject *module, Py_buffer *fragment, int width, + PyObject *state) +/*[clinic end generated code: output=cc19f159f16c6793 input=12919d549b90c90a]*/ { signed char *ncp; Py_ssize_t i; @@ -1729,8 +1740,9 @@ Decode an Intel/DVI ADPCM coded fragment to a linear fragment. [clinic start generated code]*/ static PyObject * -audioop_adpcm2lin_impl(PyModuleDef *module, Py_buffer *fragment, int width, PyObject *state) -/*[clinic end generated code: output=371965cdcc0aa69b input=f5221144f5ca9ef0]*/ +audioop_adpcm2lin_impl(PyObject *module, Py_buffer *fragment, int width, + PyObject *state) +/*[clinic end generated code: output=3440ea105acb3456 input=f5221144f5ca9ef0]*/ { signed char *cp; signed char *ncp; |