Lines Matching refs:fragment

430     fragment: Py_buffer
435 Return the value of sample index from the fragment.
439 audioop_getsample_impl(PyObject *module, Py_buffer *fragment, int width,
445 if (!audioop_check_parameters(module, fragment->len, width))
447 if (index < 0 || index >= fragment->len/width) {
452 val = GETRAWSAMPLE(width, fragment->buf, index*width);
459 fragment: Py_buffer
463 Return the maximum of the absolute value of all samples in a fragment.
467 audioop_max_impl(PyObject *module, Py_buffer *fragment, int width)
473 if (!audioop_check_parameters(module, fragment->len, width))
475 for (i = 0; i < fragment->len; i += width) {
476 int val = GETRAWSAMPLE(width, fragment->buf, i);
489 fragment: Py_buffer
493 Return the minimum and maximum values of all samples in the sound fragment.
497 audioop_minmax_impl(PyObject *module, Py_buffer *fragment, int width)
505 if (!audioop_check_parameters(module, fragment->len, width))
507 for (i = 0; i < fragment->len; i += width) {
508 int val = GETRAWSAMPLE(width, fragment->buf, i);
518 fragment: Py_buffer
522 Return the average over all samples in the fragment.
526 audioop_avg_impl(PyObject *module, Py_buffer *fragment, int width)
533 if (!audioop_check_parameters(module, fragment->len, width))
535 for (i = 0; i < fragment->len; i += width)
536 sum += GETRAWSAMPLE(width, fragment->buf, i);
537 if (fragment->len == 0)
540 avg = (int)floor(sum / (double)(fragment->len/width));
547 fragment: Py_buffer
551 Return the root-mean-square of the fragment, i.e. sqrt(sum(S_i^2)/n).
555 audioop_rms_impl(PyObject *module, Py_buffer *fragment, int width)
562 if (!audioop_check_parameters(module, fragment->len, width))
564 for (i = 0; i < fragment->len; i += width) {
565 double val = GETRAWSAMPLE(width, fragment->buf, i);
568 if (fragment->len == 0)
571 res = (unsigned int)sqrt(sum_squares / (double)(fragment->len/width));
621 fragment: Py_buffer
625 Try to match reference as well as possible to a portion of fragment.
629 audioop_findfit_impl(PyObject *module, Py_buffer *fragment,
639 if (fragment->len & 1 || reference->len & 1) {
644 cp1 = (const int16_t *)fragment->buf;
645 len1 = fragment->len >> 1;
692 fragment: Py_buffer
696 Return a factor F such that rms(add(fragment, mul(reference, -F))) is minimal.
700 audioop_findfactor_impl(PyObject *module, Py_buffer *fragment,
708 if (fragment->len & 1 || reference->len & 1) {
713 if (fragment->len != reference->len) {
718 cp1 = (const int16_t *)fragment->buf;
720 len = fragment->len >> 1;
736 fragment: Py_buffer
740 Search fragment for a slice of specified number of samples with maximum energy.
744 audioop_findmax_impl(PyObject *module, Py_buffer *fragment,
754 if (fragment->len & 1) {
759 cp1 = (const int16_t *)fragment->buf;
760 len1 = fragment->len >> 1;
792 fragment: Py_buffer
796 Return the average peak-peak value over all samples in the fragment.
800 audioop_avgpp_impl(PyObject *module, Py_buffer *fragment, int width)
809 if (!audioop_check_parameters(module, fragment->len, width))
811 if (fragment->len <= width)
813 prevval = GETRAWSAMPLE(width, fragment->buf, 0);
815 for (i = width; i < fragment->len; i += width) {
816 int val = GETRAWSAMPLE(width, fragment->buf, i);
849 fragment: Py_buffer
853 Return the maximum peak-peak value in the sound fragment.
857 audioop_maxpp_impl(PyObject *module, Py_buffer *fragment, int width)
865 if (!audioop_check_parameters(module, fragment->len, width))
867 if (fragment->len <= width)
869 prevval = GETRAWSAMPLE(width, fragment->buf, 0);
871 for (i = width; i < fragment->len; i += width) {
872 int val = GETRAWSAMPLE(width, fragment->buf, i);
902 fragment: Py_buffer
906 Return the number of zero crossings in the fragment passed as an argument.
910 audioop_cross_impl(PyObject *module, Py_buffer *fragment, int width)
917 if (!audioop_check_parameters(module, fragment->len, width))
921 for (i = 0; i < fragment->len; i += width) {
922 int val = GETRAWSAMPLE(width, fragment->buf, i) < 0;
932 fragment: Py_buffer
937 Return a fragment that has all samples in the original fragment multiplied by the floating-point value factor.
941 audioop_mul_impl(PyObject *module, Py_buffer *fragment, int width,
950 if (!audioop_check_parameters(module, fragment->len, width))
956 rv = PyBytes_FromStringAndSize(NULL, fragment->len);
961 for (i = 0; i < fragment->len; i += width) {
962 double val = GETRAWSAMPLE(width, fragment->buf, i);
972 fragment: Py_buffer
978 Convert a stereo fragment to a mono fragment.
982 audioop_tomono_impl(PyObject *module, Py_buffer *fragment, int width,
991 cp = fragment->buf;
992 len = fragment->len;
1022 fragment: Py_buffer
1028 Generate a stereo fragment from a mono fragment.
1032 audioop_tostereo_impl(PyObject *module, Py_buffer *fragment, int width,
1041 if (!audioop_check_parameters(module, fragment->len, width))
1047 if (fragment->len > PY_SSIZE_T_MAX/2) {
1053 rv = PyBytes_FromStringAndSize(NULL, fragment->len*2);
1058 for (i = 0; i < fragment->len; i += width) {
1059 double val = GETRAWSAMPLE(width, fragment->buf, i);
1076 Return a fragment which is the addition of the two samples passed as parameters.
1131 fragment: Py_buffer
1136 Return a fragment that is the original fragment with a bias added to each sample.
1140 audioop_bias_impl(PyObject *module, Py_buffer *fragment, int width, int bias)
1148 if (!audioop_check_parameters(module, fragment->len, width))
1151 rv = PyBytes_FromStringAndSize(NULL, fragment->len);
1158 for (i = 0; i < fragment->len; i += width) {
1160 val = GETINTX(unsigned char, fragment->buf, i);
1162 val = GETINTX(uint16_t, fragment->buf, i);
1164 val = ((unsigned int)GETINT24(fragment->buf, i)) & 0xffffffu;
1167 val = GETINTX(uint32_t, fragment->buf, i);
1191 fragment: Py_buffer
1195 Reverse the samples in a fragment and returns the modified fragment.
1199 audioop_reverse_impl(PyObject *module, Py_buffer *fragment, int width)
1206 if (!audioop_check_parameters(module, fragment->len, width))
1209 rv = PyBytes_FromStringAndSize(NULL, fragment->len);
1214 for (i = 0; i < fragment->len; i += width) {
1215 int val = GETRAWSAMPLE(width, fragment->buf, i);
1216 SETRAWSAMPLE(width, ncp, fragment->len - i - width, val);
1224 fragment: Py_buffer
1232 audioop_byteswap_impl(PyObject *module, Py_buffer *fragment, int width)
1239 if (!audioop_check_parameters(module, fragment->len, width))
1242 rv = PyBytes_FromStringAndSize(NULL, fragment->len);
1247 for (i = 0; i < fragment->len; i += width) {
1250 ncp[i + width - 1 - j] = ((unsigned char *)fragment->buf)[i + j];
1258 fragment: Py_buffer
1267 audioop_lin2lin_impl(PyObject *module, Py_buffer *fragment, int width,
1275 if (!audioop_check_parameters(module, fragment->len, width))
1280 if (fragment->len/width > PY_SSIZE_T_MAX/newwidth) {
1285 rv = PyBytes_FromStringAndSize(NULL, (fragment->len/width)*newwidth);
1290 for (i = j = 0; i < fragment->len; i += width, j += newwidth) {
1291 int val = GETSAMPLE32(width, fragment->buf, i);
1311 fragment: Py_buffer
1321 Convert the frame rate of the input fragment.
1325 audioop_ratecv_impl(PyObject *module, Py_buffer *fragment, int width,
1357 assert(fragment->len >= 0);
1358 if (fragment->len % bytes_per_frame != 0) {
1389 len = fragment->len / bytes_per_frame; /* # of frames */
1451 cp = fragment->buf;
1513 fragment: Py_buffer
1517 Convert samples in the audio fragment to u-LAW encoding.
1521 audioop_lin2ulaw_impl(PyObject *module, Py_buffer *fragment, int width)
1528 if (!audioop_check_parameters(module, fragment->len, width))
1531 rv = PyBytes_FromStringAndSize(NULL, fragment->len/width);
1536 for (i = 0; i < fragment->len; i += width) {
1537 int val = GETSAMPLE32(width, fragment->buf, i);
1546 fragment: Py_buffer
1554 audioop_ulaw2lin_impl(PyObject *module, Py_buffer *fragment, int width)
1565 if (fragment->len > PY_SSIZE_T_MAX/width) {
1570 rv = PyBytes_FromStringAndSize(NULL, fragment->len*width);
1575 cp = fragment->buf;
1576 for (i = 0; i < fragment->len*width; i += width) {
1586 fragment: Py_buffer
1590 Convert samples in the audio fragment to a-LAW encoding.
1594 audioop_lin2alaw_impl(PyObject *module, Py_buffer *fragment, int width)
1601 if (!audioop_check_parameters(module, fragment->len, width))
1604 rv = PyBytes_FromStringAndSize(NULL, fragment->len/width);
1609 for (i = 0; i < fragment->len; i += width) {
1610 int val = GETSAMPLE32(width, fragment->buf, i);
1619 fragment: Py_buffer
1627 audioop_alaw2lin_impl(PyObject *module, Py_buffer *fragment, int width)
1639 if (fragment->len > PY_SSIZE_T_MAX/width) {
1644 rv = PyBytes_FromStringAndSize(NULL, fragment->len*width);
1648 cp = fragment->buf;
1650 for (i = 0; i < fragment->len*width; i += width) {
1660 fragment: Py_buffer
1669 audioop_lin2adpcm_impl(PyObject *module, Py_buffer *fragment, int width,
1680 if (!audioop_check_parameters(module, fragment->len, width))
1704 str = PyBytes_FromStringAndSize(NULL, fragment->len/(width*2));
1712 for (i = 0; i < fragment->len; i += width) {
1713 int val = GETSAMPLE32(width, fragment->buf, i) >> 16;
1790 fragment: Py_buffer
1795 Decode an Intel/DVI ADPCM coded fragment to a linear fragment.
1799 audioop_adpcm2lin_impl(PyObject *module, Py_buffer *fragment, int width,
1834 if (fragment->len > (PY_SSIZE_T_MAX/2)/width) {
1839 outlen = fragment->len*width*2;
1844 cp = fragment->buf;