1 /* ----------------------------------------------------------------------
2  * Project:      CMSIS DSP Python Wrapper
3  * Title:        cmsismodule.h
4  * Description:  C code for the CMSIS-DSP Python wrapper
5  *
6  * $Date:        15 December 2022
7  * $Revision:    v1.15.0
8  *
9  * Target Processor: Cortex-M cores
10  * -------------------------------------------------------------------- */
11 /*
12  * Copyright (C) 2010-2022 ARM Limited or its affiliates. All rights reserved.
13  *
14  * SPDX-License-Identifier: Apache-2.0
15  *
16  * Licensed under the Apache License, Version 2.0 (the License); you may
17  * not use this file except in compliance with the License.
18  * You may obtain a copy of the License at
19  *
20  * www.apache.org/licenses/LICENSE-2.0
21  *
22  * Unless required by applicable law or agreed to in writing, software
23  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
24  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25  * See the License for the specific language governing permissions and
26  * limitations under the License.
27  */
28 
29 #define MODNAME "cmsisdsp_window"
30 #define MODINITNAME cmsisdsp_window
31 
32 #include "cmsisdsp_module.h"
33 
34 
35 NUMPYVECTORFROMBUFFER(f32,float32_t,NPY_FLOAT);
36 
37 
typeRegistration(PyObject * module)38 void typeRegistration(PyObject *module) {
39 
40 
41 }
42 
43 
44 static PyObject *
cmsis_arm_welch_f32(PyObject * obj,PyObject * args)45 cmsis_arm_welch_f32(PyObject *obj, PyObject *args)
46 {
47 
48 
49   float32_t *pDst=NULL; // output
50   int nb; // input
51 
52   if (PyArg_ParseTuple(args,"i",&nb))
53   {
54 
55     pDst=PyMem_Malloc(sizeof(float32_t)*nb);
56 
57 
58     arm_welch_f32(pDst,nb);
59     FLOATARRAY1(pDstOBJ,nb,pDst);
60 
61     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
62 
63     Py_DECREF(pDstOBJ);
64     return(pythonResult);
65 
66   }
67   return(NULL);
68 }
69 
70 static PyObject *
cmsis_arm_welch_f64(PyObject * obj,PyObject * args)71 cmsis_arm_welch_f64(PyObject *obj, PyObject *args)
72 {
73 
74 
75   float64_t *pDst=NULL; // output
76   int nb; // input
77 
78   if (PyArg_ParseTuple(args,"i",&nb))
79   {
80 
81     pDst=PyMem_Malloc(sizeof(float64_t)*nb);
82 
83 
84     arm_welch_f64(pDst,nb);
85     FLOAT64ARRAY1(pDstOBJ,nb,pDst);
86 
87     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
88 
89     Py_DECREF(pDstOBJ);
90     return(pythonResult);
91 
92   }
93   return(NULL);
94 }
95 
96 
97 static PyObject *
cmsis_arm_bartlett_f32(PyObject * obj,PyObject * args)98 cmsis_arm_bartlett_f32(PyObject *obj, PyObject *args)
99 {
100 
101 
102   float32_t *pDst=NULL; // output
103   int nb; // input
104 
105   if (PyArg_ParseTuple(args,"i",&nb))
106   {
107 
108     pDst=PyMem_Malloc(sizeof(float32_t)*nb);
109 
110 
111     arm_bartlett_f32(pDst,nb);
112     FLOATARRAY1(pDstOBJ,nb,pDst);
113 
114     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
115 
116     Py_DECREF(pDstOBJ);
117     return(pythonResult);
118 
119   }
120   return(NULL);
121 }
122 
123 static PyObject *
cmsis_arm_bartlett_f64(PyObject * obj,PyObject * args)124 cmsis_arm_bartlett_f64(PyObject *obj, PyObject *args)
125 {
126 
127 
128   float64_t *pDst=NULL; // output
129   int nb; // input
130 
131   if (PyArg_ParseTuple(args,"i",&nb))
132   {
133 
134     pDst=PyMem_Malloc(sizeof(float64_t)*nb);
135 
136 
137     arm_bartlett_f64(pDst,nb);
138     FLOAT64ARRAY1(pDstOBJ,nb,pDst);
139 
140     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
141 
142     Py_DECREF(pDstOBJ);
143     return(pythonResult);
144 
145   }
146   return(NULL);
147 }
148 
149 
150 static PyObject *
cmsis_arm_hamming_f32(PyObject * obj,PyObject * args)151 cmsis_arm_hamming_f32(PyObject *obj, PyObject *args)
152 {
153 
154 
155   float32_t *pDst=NULL; // output
156   int nb; // input
157 
158   if (PyArg_ParseTuple(args,"i",&nb))
159   {
160 
161     pDst=PyMem_Malloc(sizeof(float32_t)*nb);
162 
163 
164     arm_hamming_f32(pDst,nb);
165     FLOATARRAY1(pDstOBJ,nb,pDst);
166 
167     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
168 
169     Py_DECREF(pDstOBJ);
170     return(pythonResult);
171 
172   }
173   return(NULL);
174 }
175 
176 static PyObject *
cmsis_arm_hamming_f64(PyObject * obj,PyObject * args)177 cmsis_arm_hamming_f64(PyObject *obj, PyObject *args)
178 {
179 
180 
181   float64_t *pDst=NULL; // output
182   int nb; // input
183 
184   if (PyArg_ParseTuple(args,"i",&nb))
185   {
186 
187     pDst=PyMem_Malloc(sizeof(float64_t)*nb);
188 
189 
190     arm_hamming_f64(pDst,nb);
191     FLOAT64ARRAY1(pDstOBJ,nb,pDst);
192 
193     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
194 
195     Py_DECREF(pDstOBJ);
196     return(pythonResult);
197 
198   }
199   return(NULL);
200 }
201 
202 
203 static PyObject *
cmsis_arm_hanning_f32(PyObject * obj,PyObject * args)204 cmsis_arm_hanning_f32(PyObject *obj, PyObject *args)
205 {
206 
207 
208   float32_t *pDst=NULL; // output
209   int nb; // input
210 
211   if (PyArg_ParseTuple(args,"i",&nb))
212   {
213 
214     pDst=PyMem_Malloc(sizeof(float32_t)*nb);
215 
216 
217     arm_hanning_f32(pDst,nb);
218     FLOATARRAY1(pDstOBJ,nb,pDst);
219 
220     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
221 
222     Py_DECREF(pDstOBJ);
223     return(pythonResult);
224 
225   }
226   return(NULL);
227 }
228 
229 static PyObject *
cmsis_arm_hanning_f64(PyObject * obj,PyObject * args)230 cmsis_arm_hanning_f64(PyObject *obj, PyObject *args)
231 {
232 
233 
234   float64_t *pDst=NULL; // output
235   int nb; // input
236 
237   if (PyArg_ParseTuple(args,"i",&nb))
238   {
239 
240     pDst=PyMem_Malloc(sizeof(float64_t)*nb);
241 
242 
243     arm_hanning_f64(pDst,nb);
244     FLOAT64ARRAY1(pDstOBJ,nb,pDst);
245 
246     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
247 
248     Py_DECREF(pDstOBJ);
249     return(pythonResult);
250 
251   }
252   return(NULL);
253 }
254 
255 
256 static PyObject *
cmsis_arm_nuttall3_f32(PyObject * obj,PyObject * args)257 cmsis_arm_nuttall3_f32(PyObject *obj, PyObject *args)
258 {
259 
260 
261   float32_t *pDst=NULL; // output
262   int nb; // input
263 
264   if (PyArg_ParseTuple(args,"i",&nb))
265   {
266 
267     pDst=PyMem_Malloc(sizeof(float32_t)*nb);
268 
269 
270     arm_nuttall3_f32(pDst,nb);
271     FLOATARRAY1(pDstOBJ,nb,pDst);
272 
273     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
274 
275     Py_DECREF(pDstOBJ);
276     return(pythonResult);
277 
278   }
279   return(NULL);
280 }
281 
282 static PyObject *
cmsis_arm_nuttall3_f64(PyObject * obj,PyObject * args)283 cmsis_arm_nuttall3_f64(PyObject *obj, PyObject *args)
284 {
285 
286 
287   float64_t *pDst=NULL; // output
288   int nb; // input
289 
290   if (PyArg_ParseTuple(args,"i",&nb))
291   {
292 
293     pDst=PyMem_Malloc(sizeof(float64_t)*nb);
294 
295 
296     arm_nuttall3_f64(pDst,nb);
297     FLOAT64ARRAY1(pDstOBJ,nb,pDst);
298 
299     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
300 
301     Py_DECREF(pDstOBJ);
302     return(pythonResult);
303 
304   }
305   return(NULL);
306 }
307 
308 
309 static PyObject *
cmsis_arm_nuttall4_f32(PyObject * obj,PyObject * args)310 cmsis_arm_nuttall4_f32(PyObject *obj, PyObject *args)
311 {
312 
313 
314   float32_t *pDst=NULL; // output
315   int nb; // input
316 
317   if (PyArg_ParseTuple(args,"i",&nb))
318   {
319 
320     pDst=PyMem_Malloc(sizeof(float32_t)*nb);
321 
322 
323     arm_nuttall4_f32(pDst,nb);
324     FLOATARRAY1(pDstOBJ,nb,pDst);
325 
326     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
327 
328     Py_DECREF(pDstOBJ);
329     return(pythonResult);
330 
331   }
332   return(NULL);
333 }
334 
335 static PyObject *
cmsis_arm_nuttall4_f64(PyObject * obj,PyObject * args)336 cmsis_arm_nuttall4_f64(PyObject *obj, PyObject *args)
337 {
338 
339 
340   float64_t *pDst=NULL; // output
341   int nb; // input
342 
343   if (PyArg_ParseTuple(args,"i",&nb))
344   {
345 
346     pDst=PyMem_Malloc(sizeof(float64_t)*nb);
347 
348 
349     arm_nuttall4_f64(pDst,nb);
350     FLOAT64ARRAY1(pDstOBJ,nb,pDst);
351 
352     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
353 
354     Py_DECREF(pDstOBJ);
355     return(pythonResult);
356 
357   }
358   return(NULL);
359 }
360 
361 
362 static PyObject *
cmsis_arm_nuttall3a_f32(PyObject * obj,PyObject * args)363 cmsis_arm_nuttall3a_f32(PyObject *obj, PyObject *args)
364 {
365 
366 
367   float32_t *pDst=NULL; // output
368   int nb; // input
369 
370   if (PyArg_ParseTuple(args,"i",&nb))
371   {
372 
373     pDst=PyMem_Malloc(sizeof(float32_t)*nb);
374 
375 
376     arm_nuttall3a_f32(pDst,nb);
377     FLOATARRAY1(pDstOBJ,nb,pDst);
378 
379     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
380 
381     Py_DECREF(pDstOBJ);
382     return(pythonResult);
383 
384   }
385   return(NULL);
386 }
387 
388 static PyObject *
cmsis_arm_nuttall3a_f64(PyObject * obj,PyObject * args)389 cmsis_arm_nuttall3a_f64(PyObject *obj, PyObject *args)
390 {
391 
392 
393   float64_t *pDst=NULL; // output
394   int nb; // input
395 
396   if (PyArg_ParseTuple(args,"i",&nb))
397   {
398 
399     pDst=PyMem_Malloc(sizeof(float64_t)*nb);
400 
401 
402     arm_nuttall3a_f64(pDst,nb);
403     FLOAT64ARRAY1(pDstOBJ,nb,pDst);
404 
405     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
406 
407     Py_DECREF(pDstOBJ);
408     return(pythonResult);
409 
410   }
411   return(NULL);
412 }
413 
414 
415 static PyObject *
cmsis_arm_nuttall3b_f32(PyObject * obj,PyObject * args)416 cmsis_arm_nuttall3b_f32(PyObject *obj, PyObject *args)
417 {
418 
419 
420   float32_t *pDst=NULL; // output
421   int nb; // input
422 
423   if (PyArg_ParseTuple(args,"i",&nb))
424   {
425 
426     pDst=PyMem_Malloc(sizeof(float32_t)*nb);
427 
428 
429     arm_nuttall3b_f32(pDst,nb);
430     FLOATARRAY1(pDstOBJ,nb,pDst);
431 
432     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
433 
434     Py_DECREF(pDstOBJ);
435     return(pythonResult);
436 
437   }
438   return(NULL);
439 }
440 
441 static PyObject *
cmsis_arm_nuttall3b_f64(PyObject * obj,PyObject * args)442 cmsis_arm_nuttall3b_f64(PyObject *obj, PyObject *args)
443 {
444 
445 
446   float64_t *pDst=NULL; // output
447   int nb; // input
448 
449   if (PyArg_ParseTuple(args,"i",&nb))
450   {
451 
452     pDst=PyMem_Malloc(sizeof(float64_t)*nb);
453 
454 
455     arm_nuttall3b_f64(pDst,nb);
456     FLOAT64ARRAY1(pDstOBJ,nb,pDst);
457 
458     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
459 
460     Py_DECREF(pDstOBJ);
461     return(pythonResult);
462 
463   }
464   return(NULL);
465 }
466 
467 
468 static PyObject *
cmsis_arm_nuttall4a_f32(PyObject * obj,PyObject * args)469 cmsis_arm_nuttall4a_f32(PyObject *obj, PyObject *args)
470 {
471 
472 
473   float32_t *pDst=NULL; // output
474   int nb; // input
475 
476   if (PyArg_ParseTuple(args,"i",&nb))
477   {
478 
479     pDst=PyMem_Malloc(sizeof(float32_t)*nb);
480 
481 
482     arm_nuttall4a_f32(pDst,nb);
483     FLOATARRAY1(pDstOBJ,nb,pDst);
484 
485     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
486 
487     Py_DECREF(pDstOBJ);
488     return(pythonResult);
489 
490   }
491   return(NULL);
492 }
493 
494 static PyObject *
cmsis_arm_nuttall4a_f64(PyObject * obj,PyObject * args)495 cmsis_arm_nuttall4a_f64(PyObject *obj, PyObject *args)
496 {
497 
498 
499   float64_t *pDst=NULL; // output
500   int nb; // input
501 
502   if (PyArg_ParseTuple(args,"i",&nb))
503   {
504 
505     pDst=PyMem_Malloc(sizeof(float64_t)*nb);
506 
507 
508     arm_nuttall4a_f64(pDst,nb);
509     FLOAT64ARRAY1(pDstOBJ,nb,pDst);
510 
511     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
512 
513     Py_DECREF(pDstOBJ);
514     return(pythonResult);
515 
516   }
517   return(NULL);
518 }
519 
520 
521 static PyObject *
cmsis_arm_blackman_harris_92db_f32(PyObject * obj,PyObject * args)522 cmsis_arm_blackman_harris_92db_f32(PyObject *obj, PyObject *args)
523 {
524 
525 
526   float32_t *pDst=NULL; // output
527   int nb; // input
528 
529   if (PyArg_ParseTuple(args,"i",&nb))
530   {
531 
532     pDst=PyMem_Malloc(sizeof(float32_t)*nb);
533 
534 
535     arm_blackman_harris_92db_f32(pDst,nb);
536     FLOATARRAY1(pDstOBJ,nb,pDst);
537 
538     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
539 
540     Py_DECREF(pDstOBJ);
541     return(pythonResult);
542 
543   }
544   return(NULL);
545 }
546 
547 static PyObject *
cmsis_arm_blackman_harris_92db_f64(PyObject * obj,PyObject * args)548 cmsis_arm_blackman_harris_92db_f64(PyObject *obj, PyObject *args)
549 {
550 
551 
552   float64_t *pDst=NULL; // output
553   int nb; // input
554 
555   if (PyArg_ParseTuple(args,"i",&nb))
556   {
557 
558     pDst=PyMem_Malloc(sizeof(float64_t)*nb);
559 
560 
561     arm_blackman_harris_92db_f64(pDst,nb);
562     FLOAT64ARRAY1(pDstOBJ,nb,pDst);
563 
564     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
565 
566     Py_DECREF(pDstOBJ);
567     return(pythonResult);
568 
569   }
570   return(NULL);
571 }
572 
573 
574 static PyObject *
cmsis_arm_nuttall4b_f32(PyObject * obj,PyObject * args)575 cmsis_arm_nuttall4b_f32(PyObject *obj, PyObject *args)
576 {
577 
578 
579   float32_t *pDst=NULL; // output
580   int nb; // input
581 
582   if (PyArg_ParseTuple(args,"i",&nb))
583   {
584 
585     pDst=PyMem_Malloc(sizeof(float32_t)*nb);
586 
587 
588     arm_nuttall4b_f32(pDst,nb);
589     FLOATARRAY1(pDstOBJ,nb,pDst);
590 
591     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
592 
593     Py_DECREF(pDstOBJ);
594     return(pythonResult);
595 
596   }
597   return(NULL);
598 }
599 
600 static PyObject *
cmsis_arm_nuttall4b_f64(PyObject * obj,PyObject * args)601 cmsis_arm_nuttall4b_f64(PyObject *obj, PyObject *args)
602 {
603 
604 
605   float64_t *pDst=NULL; // output
606   int nb; // input
607 
608   if (PyArg_ParseTuple(args,"i",&nb))
609   {
610 
611     pDst=PyMem_Malloc(sizeof(float64_t)*nb);
612 
613 
614     arm_nuttall4b_f64(pDst,nb);
615     FLOAT64ARRAY1(pDstOBJ,nb,pDst);
616 
617     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
618 
619     Py_DECREF(pDstOBJ);
620     return(pythonResult);
621 
622   }
623   return(NULL);
624 }
625 
626 
627 static PyObject *
cmsis_arm_nuttall4c_f32(PyObject * obj,PyObject * args)628 cmsis_arm_nuttall4c_f32(PyObject *obj, PyObject *args)
629 {
630 
631 
632   float32_t *pDst=NULL; // output
633   int nb; // input
634 
635   if (PyArg_ParseTuple(args,"i",&nb))
636   {
637 
638     pDst=PyMem_Malloc(sizeof(float32_t)*nb);
639 
640 
641     arm_nuttall4c_f32(pDst,nb);
642     FLOATARRAY1(pDstOBJ,nb,pDst);
643 
644     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
645 
646     Py_DECREF(pDstOBJ);
647     return(pythonResult);
648 
649   }
650   return(NULL);
651 }
652 
653 static PyObject *
cmsis_arm_nuttall4c_f64(PyObject * obj,PyObject * args)654 cmsis_arm_nuttall4c_f64(PyObject *obj, PyObject *args)
655 {
656 
657 
658   float64_t *pDst=NULL; // output
659   int nb; // input
660 
661   if (PyArg_ParseTuple(args,"i",&nb))
662   {
663 
664     pDst=PyMem_Malloc(sizeof(float64_t)*nb);
665 
666 
667     arm_nuttall4c_f64(pDst,nb);
668     FLOAT64ARRAY1(pDstOBJ,nb,pDst);
669 
670     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
671 
672     Py_DECREF(pDstOBJ);
673     return(pythonResult);
674 
675   }
676   return(NULL);
677 }
678 
679 
680 static PyObject *
cmsis_arm_hft90d_f32(PyObject * obj,PyObject * args)681 cmsis_arm_hft90d_f32(PyObject *obj, PyObject *args)
682 {
683 
684 
685   float32_t *pDst=NULL; // output
686   int nb; // input
687 
688   if (PyArg_ParseTuple(args,"i",&nb))
689   {
690 
691     pDst=PyMem_Malloc(sizeof(float32_t)*nb);
692 
693 
694     arm_hft90d_f32(pDst,nb);
695     FLOATARRAY1(pDstOBJ,nb,pDst);
696 
697     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
698 
699     Py_DECREF(pDstOBJ);
700     return(pythonResult);
701 
702   }
703   return(NULL);
704 }
705 
706 static PyObject *
cmsis_arm_hft90d_f64(PyObject * obj,PyObject * args)707 cmsis_arm_hft90d_f64(PyObject *obj, PyObject *args)
708 {
709 
710 
711   float64_t *pDst=NULL; // output
712   int nb; // input
713 
714   if (PyArg_ParseTuple(args,"i",&nb))
715   {
716 
717     pDst=PyMem_Malloc(sizeof(float64_t)*nb);
718 
719 
720     arm_hft90d_f64(pDst,nb);
721     FLOAT64ARRAY1(pDstOBJ,nb,pDst);
722 
723     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
724 
725     Py_DECREF(pDstOBJ);
726     return(pythonResult);
727 
728   }
729   return(NULL);
730 }
731 
732 
733 static PyObject *
cmsis_arm_hft95_f32(PyObject * obj,PyObject * args)734 cmsis_arm_hft95_f32(PyObject *obj, PyObject *args)
735 {
736 
737 
738   float32_t *pDst=NULL; // output
739   int nb; // input
740 
741   if (PyArg_ParseTuple(args,"i",&nb))
742   {
743 
744     pDst=PyMem_Malloc(sizeof(float32_t)*nb);
745 
746 
747     arm_hft95_f32(pDst,nb);
748     FLOATARRAY1(pDstOBJ,nb,pDst);
749 
750     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
751 
752     Py_DECREF(pDstOBJ);
753     return(pythonResult);
754 
755   }
756   return(NULL);
757 }
758 
759 static PyObject *
cmsis_arm_hft95_f64(PyObject * obj,PyObject * args)760 cmsis_arm_hft95_f64(PyObject *obj, PyObject *args)
761 {
762 
763 
764   float64_t *pDst=NULL; // output
765   int nb; // input
766 
767   if (PyArg_ParseTuple(args,"i",&nb))
768   {
769 
770     pDst=PyMem_Malloc(sizeof(float64_t)*nb);
771 
772 
773     arm_hft95_f64(pDst,nb);
774     FLOAT64ARRAY1(pDstOBJ,nb,pDst);
775 
776     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
777 
778     Py_DECREF(pDstOBJ);
779     return(pythonResult);
780 
781   }
782   return(NULL);
783 }
784 
785 
786 static PyObject *
cmsis_arm_hft116d_f32(PyObject * obj,PyObject * args)787 cmsis_arm_hft116d_f32(PyObject *obj, PyObject *args)
788 {
789 
790 
791   float32_t *pDst=NULL; // output
792   int nb; // input
793 
794   if (PyArg_ParseTuple(args,"i",&nb))
795   {
796 
797     pDst=PyMem_Malloc(sizeof(float32_t)*nb);
798 
799 
800     arm_hft116d_f32(pDst,nb);
801     FLOATARRAY1(pDstOBJ,nb,pDst);
802 
803     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
804 
805     Py_DECREF(pDstOBJ);
806     return(pythonResult);
807 
808   }
809   return(NULL);
810 }
811 
812 static PyObject *
cmsis_arm_hft116d_f64(PyObject * obj,PyObject * args)813 cmsis_arm_hft116d_f64(PyObject *obj, PyObject *args)
814 {
815 
816 
817   float64_t *pDst=NULL; // output
818   int nb; // input
819 
820   if (PyArg_ParseTuple(args,"i",&nb))
821   {
822 
823     pDst=PyMem_Malloc(sizeof(float64_t)*nb);
824 
825 
826     arm_hft116d_f64(pDst,nb);
827     FLOAT64ARRAY1(pDstOBJ,nb,pDst);
828 
829     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
830 
831     Py_DECREF(pDstOBJ);
832     return(pythonResult);
833 
834   }
835   return(NULL);
836 }
837 
838 
839 static PyObject *
cmsis_arm_hft144d_f32(PyObject * obj,PyObject * args)840 cmsis_arm_hft144d_f32(PyObject *obj, PyObject *args)
841 {
842 
843 
844   float32_t *pDst=NULL; // output
845   int nb; // input
846 
847   if (PyArg_ParseTuple(args,"i",&nb))
848   {
849 
850     pDst=PyMem_Malloc(sizeof(float32_t)*nb);
851 
852 
853     arm_hft144d_f32(pDst,nb);
854     FLOATARRAY1(pDstOBJ,nb,pDst);
855 
856     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
857 
858     Py_DECREF(pDstOBJ);
859     return(pythonResult);
860 
861   }
862   return(NULL);
863 }
864 
865 static PyObject *
cmsis_arm_hft144d_f64(PyObject * obj,PyObject * args)866 cmsis_arm_hft144d_f64(PyObject *obj, PyObject *args)
867 {
868 
869 
870   float64_t *pDst=NULL; // output
871   int nb; // input
872 
873   if (PyArg_ParseTuple(args,"i",&nb))
874   {
875 
876     pDst=PyMem_Malloc(sizeof(float64_t)*nb);
877 
878 
879     arm_hft144d_f64(pDst,nb);
880     FLOAT64ARRAY1(pDstOBJ,nb,pDst);
881 
882     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
883 
884     Py_DECREF(pDstOBJ);
885     return(pythonResult);
886 
887   }
888   return(NULL);
889 }
890 
891 
892 static PyObject *
cmsis_arm_hft169d_f32(PyObject * obj,PyObject * args)893 cmsis_arm_hft169d_f32(PyObject *obj, PyObject *args)
894 {
895 
896 
897   float32_t *pDst=NULL; // output
898   int nb; // input
899 
900   if (PyArg_ParseTuple(args,"i",&nb))
901   {
902 
903     pDst=PyMem_Malloc(sizeof(float32_t)*nb);
904 
905 
906     arm_hft169d_f32(pDst,nb);
907     FLOATARRAY1(pDstOBJ,nb,pDst);
908 
909     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
910 
911     Py_DECREF(pDstOBJ);
912     return(pythonResult);
913 
914   }
915   return(NULL);
916 }
917 
918 static PyObject *
cmsis_arm_hft169d_f64(PyObject * obj,PyObject * args)919 cmsis_arm_hft169d_f64(PyObject *obj, PyObject *args)
920 {
921 
922 
923   float64_t *pDst=NULL; // output
924   int nb; // input
925 
926   if (PyArg_ParseTuple(args,"i",&nb))
927   {
928 
929     pDst=PyMem_Malloc(sizeof(float64_t)*nb);
930 
931 
932     arm_hft169d_f64(pDst,nb);
933     FLOAT64ARRAY1(pDstOBJ,nb,pDst);
934 
935     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
936 
937     Py_DECREF(pDstOBJ);
938     return(pythonResult);
939 
940   }
941   return(NULL);
942 }
943 
944 
945 static PyObject *
cmsis_arm_hft196d_f32(PyObject * obj,PyObject * args)946 cmsis_arm_hft196d_f32(PyObject *obj, PyObject *args)
947 {
948 
949 
950   float32_t *pDst=NULL; // output
951   int nb; // input
952 
953   if (PyArg_ParseTuple(args,"i",&nb))
954   {
955 
956     pDst=PyMem_Malloc(sizeof(float32_t)*nb);
957 
958 
959     arm_hft196d_f32(pDst,nb);
960     FLOATARRAY1(pDstOBJ,nb,pDst);
961 
962     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
963 
964     Py_DECREF(pDstOBJ);
965     return(pythonResult);
966 
967   }
968   return(NULL);
969 }
970 
971 static PyObject *
cmsis_arm_hft196d_f64(PyObject * obj,PyObject * args)972 cmsis_arm_hft196d_f64(PyObject *obj, PyObject *args)
973 {
974 
975 
976   float64_t *pDst=NULL; // output
977   int nb; // input
978 
979   if (PyArg_ParseTuple(args,"i",&nb))
980   {
981 
982     pDst=PyMem_Malloc(sizeof(float64_t)*nb);
983 
984 
985     arm_hft196d_f64(pDst,nb);
986     FLOAT64ARRAY1(pDstOBJ,nb,pDst);
987 
988     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
989 
990     Py_DECREF(pDstOBJ);
991     return(pythonResult);
992 
993   }
994   return(NULL);
995 }
996 
997 
998 static PyObject *
cmsis_arm_hft223d_f32(PyObject * obj,PyObject * args)999 cmsis_arm_hft223d_f32(PyObject *obj, PyObject *args)
1000 {
1001 
1002 
1003   float32_t *pDst=NULL; // output
1004   int nb; // input
1005 
1006   if (PyArg_ParseTuple(args,"i",&nb))
1007   {
1008 
1009     pDst=PyMem_Malloc(sizeof(float32_t)*nb);
1010 
1011 
1012     arm_hft223d_f32(pDst,nb);
1013     FLOATARRAY1(pDstOBJ,nb,pDst);
1014 
1015     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
1016 
1017     Py_DECREF(pDstOBJ);
1018     return(pythonResult);
1019 
1020   }
1021   return(NULL);
1022 }
1023 
1024 static PyObject *
cmsis_arm_hft223d_f64(PyObject * obj,PyObject * args)1025 cmsis_arm_hft223d_f64(PyObject *obj, PyObject *args)
1026 {
1027 
1028 
1029   float64_t *pDst=NULL; // output
1030   int nb; // input
1031 
1032   if (PyArg_ParseTuple(args,"i",&nb))
1033   {
1034 
1035     pDst=PyMem_Malloc(sizeof(float64_t)*nb);
1036 
1037 
1038     arm_hft223d_f64(pDst,nb);
1039     FLOAT64ARRAY1(pDstOBJ,nb,pDst);
1040 
1041     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
1042 
1043     Py_DECREF(pDstOBJ);
1044     return(pythonResult);
1045 
1046   }
1047   return(NULL);
1048 }
1049 
1050 
1051 static PyObject *
cmsis_arm_hft248d_f32(PyObject * obj,PyObject * args)1052 cmsis_arm_hft248d_f32(PyObject *obj, PyObject *args)
1053 {
1054 
1055 
1056   float32_t *pDst=NULL; // output
1057   int nb; // input
1058 
1059   if (PyArg_ParseTuple(args,"i",&nb))
1060   {
1061 
1062     pDst=PyMem_Malloc(sizeof(float32_t)*nb);
1063 
1064 
1065     arm_hft248d_f32(pDst,nb);
1066     FLOATARRAY1(pDstOBJ,nb,pDst);
1067 
1068     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
1069 
1070     Py_DECREF(pDstOBJ);
1071     return(pythonResult);
1072 
1073   }
1074   return(NULL);
1075 }
1076 
1077 static PyObject *
cmsis_arm_hft248d_f64(PyObject * obj,PyObject * args)1078 cmsis_arm_hft248d_f64(PyObject *obj, PyObject *args)
1079 {
1080 
1081 
1082   float64_t *pDst=NULL; // output
1083   int nb; // input
1084 
1085   if (PyArg_ParseTuple(args,"i",&nb))
1086   {
1087 
1088     pDst=PyMem_Malloc(sizeof(float64_t)*nb);
1089 
1090 
1091     arm_hft248d_f64(pDst,nb);
1092     FLOAT64ARRAY1(pDstOBJ,nb,pDst);
1093 
1094     PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
1095 
1096     Py_DECREF(pDstOBJ);
1097     return(pythonResult);
1098 
1099   }
1100   return(NULL);
1101 }
1102 
1103 
1104 static PyMethodDef CMSISDSPMethods[] = {
1105 
1106 
1107 
1108 
1109 
1110 
1111 {"arm_welch_f32" ,  cmsis_arm_welch_f32, METH_VARARGS,""},
1112 {"arm_welch_f64" ,  cmsis_arm_welch_f64, METH_VARARGS,""},
1113 
1114 
1115 {"arm_bartlett_f32" ,  cmsis_arm_bartlett_f32, METH_VARARGS,""},
1116 {"arm_bartlett_f64" ,  cmsis_arm_bartlett_f64, METH_VARARGS,""},
1117 
1118 
1119 {"arm_hamming_f32" ,  cmsis_arm_hamming_f32, METH_VARARGS,""},
1120 {"arm_hamming_f64" ,  cmsis_arm_hamming_f64, METH_VARARGS,""},
1121 
1122 
1123 {"arm_hanning_f32" ,  cmsis_arm_hanning_f32, METH_VARARGS,""},
1124 {"arm_hanning_f64" ,  cmsis_arm_hanning_f64, METH_VARARGS,""},
1125 
1126 
1127 {"arm_nuttall3_f32" ,  cmsis_arm_nuttall3_f32, METH_VARARGS,""},
1128 {"arm_nuttall3_f64" ,  cmsis_arm_nuttall3_f64, METH_VARARGS,""},
1129 
1130 
1131 {"arm_nuttall4_f32" ,  cmsis_arm_nuttall4_f32, METH_VARARGS,""},
1132 {"arm_nuttall4_f64" ,  cmsis_arm_nuttall4_f64, METH_VARARGS,""},
1133 
1134 
1135 {"arm_nuttall3a_f32" ,  cmsis_arm_nuttall3a_f32, METH_VARARGS,""},
1136 {"arm_nuttall3a_f64" ,  cmsis_arm_nuttall3a_f64, METH_VARARGS,""},
1137 
1138 
1139 {"arm_nuttall3b_f32" ,  cmsis_arm_nuttall3b_f32, METH_VARARGS,""},
1140 {"arm_nuttall3b_f64" ,  cmsis_arm_nuttall3b_f64, METH_VARARGS,""},
1141 
1142 
1143 {"arm_nuttall4a_f32" ,  cmsis_arm_nuttall4a_f32, METH_VARARGS,""},
1144 {"arm_nuttall4a_f64" ,  cmsis_arm_nuttall4a_f64, METH_VARARGS,""},
1145 
1146 
1147 {"arm_blackman_harris_92db_f32" ,  cmsis_arm_blackman_harris_92db_f32, METH_VARARGS,""},
1148 {"arm_blackman_harris_92db_f64" ,  cmsis_arm_blackman_harris_92db_f64, METH_VARARGS,""},
1149 
1150 
1151 {"arm_nuttall4b_f32" ,  cmsis_arm_nuttall4b_f32, METH_VARARGS,""},
1152 {"arm_nuttall4b_f64" ,  cmsis_arm_nuttall4b_f64, METH_VARARGS,""},
1153 
1154 
1155 {"arm_nuttall4c_f32" ,  cmsis_arm_nuttall4c_f32, METH_VARARGS,""},
1156 {"arm_nuttall4c_f64" ,  cmsis_arm_nuttall4c_f64, METH_VARARGS,""},
1157 
1158 
1159 {"arm_hft90d_f32" ,  cmsis_arm_hft90d_f32, METH_VARARGS,""},
1160 {"arm_hft90d_f64" ,  cmsis_arm_hft90d_f64, METH_VARARGS,""},
1161 
1162 
1163 {"arm_hft95_f32" ,  cmsis_arm_hft95_f32, METH_VARARGS,""},
1164 {"arm_hft95_f64" ,  cmsis_arm_hft95_f64, METH_VARARGS,""},
1165 
1166 
1167 {"arm_hft116d_f32" ,  cmsis_arm_hft116d_f32, METH_VARARGS,""},
1168 {"arm_hft116d_f64" ,  cmsis_arm_hft116d_f64, METH_VARARGS,""},
1169 
1170 
1171 {"arm_hft144d_f32" ,  cmsis_arm_hft144d_f32, METH_VARARGS,""},
1172 {"arm_hft144d_f64" ,  cmsis_arm_hft144d_f64, METH_VARARGS,""},
1173 
1174 
1175 {"arm_hft169d_f32" ,  cmsis_arm_hft169d_f32, METH_VARARGS,""},
1176 {"arm_hft169d_f64" ,  cmsis_arm_hft169d_f64, METH_VARARGS,""},
1177 
1178 
1179 {"arm_hft196d_f32" ,  cmsis_arm_hft196d_f32, METH_VARARGS,""},
1180 {"arm_hft196d_f64" ,  cmsis_arm_hft196d_f64, METH_VARARGS,""},
1181 
1182 
1183 {"arm_hft223d_f32" ,  cmsis_arm_hft223d_f32, METH_VARARGS,""},
1184 {"arm_hft223d_f64" ,  cmsis_arm_hft223d_f64, METH_VARARGS,""},
1185 
1186 
1187 {"arm_hft248d_f32" ,  cmsis_arm_hft248d_f32, METH_VARARGS,""},
1188 {"arm_hft248d_f64" ,  cmsis_arm_hft248d_f64, METH_VARARGS,""},
1189 
1190 
1191     {"error_out", (PyCFunction)error_out, METH_NOARGS, NULL},
1192     {NULL, NULL, 0, NULL}        /* Sentinel */
1193 };
1194 
1195 #ifdef IS_PY3K
cmsisdsp_traverse(PyObject * m,visitproc visit,void * arg)1196 static int cmsisdsp_traverse(PyObject *m, visitproc visit, void *arg) {
1197     Py_VISIT(GETSTATE(m)->error);
1198     return 0;
1199 }
1200 
cmsisdsp_clear(PyObject * m)1201 static int cmsisdsp_clear(PyObject *m) {
1202     Py_CLEAR(GETSTATE(m)->error);
1203     return 0;
1204 }
1205 
1206 
1207 static struct PyModuleDef moduledef = {
1208         PyModuleDef_HEAD_INIT,
1209         MODNAME,
1210         NULL,
1211         sizeof(struct module_state),
1212         CMSISDSPMethods,
1213         NULL,
1214         cmsisdsp_traverse,
1215         cmsisdsp_clear,
1216         NULL
1217 };
1218 
1219 #define INITERROR return NULL
1220 
1221 PyMODINIT_FUNC
CAT(PyInit_,MODINITNAME)1222 CAT(PyInit_,MODINITNAME)(void)
1223 
1224 
1225 #else
1226 #define INITERROR return
1227 
1228 void CAT(init,MODINITNAME)(void)
1229 #endif
1230 {
1231     import_array();
1232 
1233   #ifdef IS_PY3K
1234     PyObject *module = PyModule_Create(&moduledef);
1235   #else
1236     PyObject *module = Py_InitModule(MODNAME, CMSISDSPMethods);
1237   #endif
1238 
1239   if (module == NULL)
1240       INITERROR;
1241   struct module_state *st = GETSTATE(module);
1242 
1243   st->error = PyErr_NewException(MODNAME".Error", NULL, NULL);
1244   if (st->error == NULL) {
1245       Py_DECREF(module);
1246       INITERROR;
1247   }
1248 
1249 
1250   typeRegistration(module);
1251 
1252   #ifdef IS_PY3K
1253     return module;
1254   #endif
1255 }
1256