summaryrefslogtreecommitdiff
path: root/bindings/galearn_pdm.cpp
diff options
context:
space:
mode:
authorJon Nordby <jononor@gmail.com>2025-05-14 19:55:05 +0200
committerJon Nordby <jononor@gmail.com>2025-05-14 19:55:05 +0200
commitc86294b1f07624eee3c3749fb877aff96413f17b (patch)
tree938838ca4a52685f772768af79f501d0aea429d5 /bindings/galearn_pdm.cpp
parent8b2563ef4764f93901d65fffc786ae1a9ae9774d (diff)
bindings: Actually build cic3_pdm code
Diffstat (limited to 'bindings/galearn_pdm.cpp')
-rw-r--r--bindings/galearn_pdm.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/bindings/galearn_pdm.cpp b/bindings/galearn_pdm.cpp
index 5b7e4f5..541ba1a 100644
--- a/bindings/galearn_pdm.cpp
+++ b/bindings/galearn_pdm.cpp
@@ -1,11 +1,12 @@
#include <pybind11/pybind11.h>
#include <pybind11/numpy.h>
-int sim(void);
+int pdm2pcm_cic3(const uint8_t *pdm, int pdm_length, int16_t *pcm, int pcm_length);
+
namespace py = pybind11;
-void process(py::array_t<uint8_t> arr1, py::array_t<int16_t> arr2) {
+int process(py::array_t<uint8_t> arr1, py::array_t<int16_t> arr2) {
// Check shapes or sizes if needed
auto buf1 = arr1.request();
auto buf2 = arr2.request();
@@ -18,19 +19,12 @@ void process(py::array_t<uint8_t> arr1, py::array_t<int16_t> arr2) {
throw std::runtime_error("Input 1 must be same or larger than input 2");
}
-#if 0
- // Example: access data
uint8_t* in = static_cast<uint8_t*>(buf1.ptr);
int16_t* out = static_cast<int16_t*>(buf2.ptr);
- for (int i=0; i<buf2.size; i++) {
- out[i] = in[i] + 1;
- }
-#else
-
- sim();
-#endif
+ int samples = pdm2pcm_cic3(in, arr1.size(), out, arr2.size());
+ return samples;
}
PYBIND11_MODULE(galearn_pdm, m) {