From ed95e8d45cfc6cd3e026298dadf4d2e8f9f1c3b8 Mon Sep 17 00:00:00 2001
From: mormj <34754695+mormj@users.noreply.github.com>
Date: Tue, 3 Nov 2020 16:51:44 -0500
Subject: Move FFT functions and blocks to templates (#3903)

* fft: refactor fft classes as templates

In order to reduce code duplication construct fft objects and blocks
with template paramters.

Separate forward and reverse as a template
parameter

Maintain the real fft block forward as r2c and reverse as r2c as well

Co-authored-by: Andrej Rode <mail@andrejro.de>
---
 gr-fft/python/fft/CMakeLists.txt                   |   2 +
 gr-fft/python/fft/__init__.py                      |   3 +
 gr-fft/python/fft/bindings/CMakeLists.txt          |   4 +-
 .../fft/bindings/docstrings/fft_pydoc_template.h   | 108 --------------
 .../fft/bindings/docstrings/fft_v_pydoc_template.h |  15 ++
 .../bindings/docstrings/fft_vcc_pydoc_template.h   |  36 -----
 .../bindings/docstrings/fft_vfc_pydoc_template.h   |  36 -----
 gr-fft/python/fft/bindings/fft_python.cc           | 156 ---------------------
 gr-fft/python/fft/bindings/fft_v_python.cc         |  57 ++++++++
 gr-fft/python/fft/bindings/fft_vcc_python.cc       |  64 ---------
 gr-fft/python/fft/bindings/fft_vfc_python.cc       |  62 --------
 gr-fft/python/fft/bindings/python_bindings.cc      |   8 +-
 gr-fft/python/fft/fft_vcc.py                       |  22 +++
 gr-fft/python/fft/fft_vfc.py                       |  22 +++
 14 files changed, 124 insertions(+), 471 deletions(-)
 delete mode 100644 gr-fft/python/fft/bindings/docstrings/fft_pydoc_template.h
 create mode 100644 gr-fft/python/fft/bindings/docstrings/fft_v_pydoc_template.h
 delete mode 100644 gr-fft/python/fft/bindings/docstrings/fft_vcc_pydoc_template.h
 delete mode 100644 gr-fft/python/fft/bindings/docstrings/fft_vfc_pydoc_template.h
 delete mode 100644 gr-fft/python/fft/bindings/fft_python.cc
 create mode 100644 gr-fft/python/fft/bindings/fft_v_python.cc
 delete mode 100644 gr-fft/python/fft/bindings/fft_vcc_python.cc
 delete mode 100644 gr-fft/python/fft/bindings/fft_vfc_python.cc
 create mode 100644 gr-fft/python/fft/fft_vcc.py
 create mode 100644 gr-fft/python/fft/fft_vfc.py

(limited to 'gr-fft/python')

diff --git a/gr-fft/python/fft/CMakeLists.txt b/gr-fft/python/fft/CMakeLists.txt
index e94f206352..2bd0afb0e1 100644
--- a/gr-fft/python/fft/CMakeLists.txt
+++ b/gr-fft/python/fft/CMakeLists.txt
@@ -10,6 +10,8 @@ include(GrPython)
 
 GR_PYTHON_INSTALL(
     FILES
+    fft_vcc.py
+    fft_vfc.py
     __init__.py
     logpwrfft.py
     DESTINATION ${GR_PYTHON_DIR}/gnuradio/fft
diff --git a/gr-fft/python/fft/__init__.py b/gr-fft/python/fft/__init__.py
index d4d2c964cb..bb370a333a 100644
--- a/gr-fft/python/fft/__init__.py
+++ b/gr-fft/python/fft/__init__.py
@@ -20,3 +20,6 @@ except ImportError:
     dirname, filename = os.path.split(os.path.abspath(__file__))
     __path__.append(os.path.join(dirname, "bindings"))
     from .fft_python import *
+
+from .fft_vcc import fft_vcc
+from .fft_vfc import fft_vfc
\ No newline at end of file
diff --git a/gr-fft/python/fft/bindings/CMakeLists.txt b/gr-fft/python/fft/bindings/CMakeLists.txt
index 4ca22cf43e..f67e6a81e0 100644
--- a/gr-fft/python/fft/bindings/CMakeLists.txt
+++ b/gr-fft/python/fft/bindings/CMakeLists.txt
@@ -6,10 +6,8 @@ include(GrPybind)
 
 list(APPEND fft_python_files
     #ctrlport_probe_psd_python.cc
-    fft_python.cc
     fft_shift_python.cc
-    fft_vcc_python.cc
-    fft_vfc_python.cc
+    fft_v_python.cc
     goertzel_python.cc
     goertzel_fc_python.cc
     window_python.cc
diff --git a/gr-fft/python/fft/bindings/docstrings/fft_pydoc_template.h b/gr-fft/python/fft/bindings/docstrings/fft_pydoc_template.h
deleted file mode 100644
index 0f37f06b93..0000000000
--- a/gr-fft/python/fft/bindings/docstrings/fft_pydoc_template.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright 2020 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * SPDX-License-Identifier: GPL-3.0-or-later
- *
- */
-#include "pydoc_macros.h"
-#define D(...) DOC(gr, fft, __VA_ARGS__)
-/*
-  This file contains placeholders for docstrings for the Python bindings.
-  Do not edit! These were automatically extracted during the binding process
-  and will be overwritten during the build process
- */
-
-
-static const char* __doc_gr_fft_planner = R"doc()doc";
-
-
-static const char* __doc_gr_fft_planner_planner_0 = R"doc()doc";
-
-
-static const char* __doc_gr_fft_planner_planner_1 = R"doc()doc";
-
-
-static const char* __doc_gr_fft_planner_mutex = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_complex = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_complex_fft_complex = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_complex_get_inbuf = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_complex_get_outbuf = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_complex_inbuf_length = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_complex_outbuf_length = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_complex_set_nthreads = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_complex_nthreads = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_complex_execute = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_real_fwd = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_real_fwd_fft_real_fwd = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_real_fwd_get_inbuf = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_real_fwd_get_outbuf = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_real_fwd_inbuf_length = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_real_fwd_outbuf_length = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_real_fwd_set_nthreads = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_real_fwd_nthreads = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_real_fwd_execute = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_real_rev = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_real_rev_fft_real_rev = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_real_rev_get_inbuf = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_real_rev_get_outbuf = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_real_rev_inbuf_length = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_real_rev_outbuf_length = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_real_rev_set_nthreads = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_real_rev_nthreads = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_real_rev_execute = R"doc()doc";
diff --git a/gr-fft/python/fft/bindings/docstrings/fft_v_pydoc_template.h b/gr-fft/python/fft/bindings/docstrings/fft_v_pydoc_template.h
new file mode 100644
index 0000000000..4a1b3ede3e
--- /dev/null
+++ b/gr-fft/python/fft/bindings/docstrings/fft_v_pydoc_template.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2020 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ *
+ */
+#include "pydoc_macros.h"
+#define D(...) DOC(gr, fft, __VA_ARGS__)
+/*
+  This file contains placeholders for docstrings for the Python bindings.
+  Do not edit! These were automatically extracted during the binding process
+  and will be overwritten during the build process
+ */
diff --git a/gr-fft/python/fft/bindings/docstrings/fft_vcc_pydoc_template.h b/gr-fft/python/fft/bindings/docstrings/fft_vcc_pydoc_template.h
deleted file mode 100644
index ecf12fc7f5..0000000000
--- a/gr-fft/python/fft/bindings/docstrings/fft_vcc_pydoc_template.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2020 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * SPDX-License-Identifier: GPL-3.0-or-later
- *
- */
-#include "pydoc_macros.h"
-#define D(...) DOC(gr, fft, __VA_ARGS__)
-/*
-  This file contains placeholders for docstrings for the Python bindings.
-  Do not edit! These were automatically extracted during the binding process
-  and will be overwritten during the build process
- */
-
-
-static const char* __doc_gr_fft_fft_vcc = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_vcc_fft_vcc_0 = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_vcc_fft_vcc_1 = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_vcc_make = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_vcc_set_nthreads = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_vcc_nthreads = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_vcc_set_window = R"doc()doc";
diff --git a/gr-fft/python/fft/bindings/docstrings/fft_vfc_pydoc_template.h b/gr-fft/python/fft/bindings/docstrings/fft_vfc_pydoc_template.h
deleted file mode 100644
index 6c8a4b15b7..0000000000
--- a/gr-fft/python/fft/bindings/docstrings/fft_vfc_pydoc_template.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2020 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * SPDX-License-Identifier: GPL-3.0-or-later
- *
- */
-#include "pydoc_macros.h"
-#define D(...) DOC(gr, fft, __VA_ARGS__)
-/*
-  This file contains placeholders for docstrings for the Python bindings.
-  Do not edit! These were automatically extracted during the binding process
-  and will be overwritten during the build process
- */
-
-
-static const char* __doc_gr_fft_fft_vfc = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_vfc_fft_vfc_0 = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_vfc_fft_vfc_1 = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_vfc_make = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_vfc_set_nthreads = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_vfc_nthreads = R"doc()doc";
-
-
-static const char* __doc_gr_fft_fft_vfc_set_window = R"doc()doc";
diff --git a/gr-fft/python/fft/bindings/fft_python.cc b/gr-fft/python/fft/bindings/fft_python.cc
deleted file mode 100644
index 268edfaa24..0000000000
--- a/gr-fft/python/fft/bindings/fft_python.cc
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright 2020 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * SPDX-License-Identifier: GPL-3.0-or-later
- *
- */
-
-/***********************************************************************************/
-/* This file is automatically generated using bindtool and can be manually edited  */
-/* The following lines can be configured to regenerate this file during cmake      */
-/* If manual edits are made, the following tags should be modified accordingly.    */
-/* BINDTOOL_GEN_AUTOMATIC(0)                                                       */
-/* BINDTOOL_USE_PYGCCXML(0)                                                        */
-/* BINDTOOL_HEADER_FILE(fft.h)                                        */
-/* BINDTOOL_HEADER_FILE_HASH(ebbb274b1b433908749981712d96b3e9)                     */
-/***********************************************************************************/
-
-#include <pybind11/complex.h>
-#include <pybind11/pybind11.h>
-#include <pybind11/stl.h>
-
-namespace py = pybind11;
-
-#include <gnuradio/fft/fft.h>
-// pydoc.h is automatically generated in the build directory
-#include <fft_pydoc.h>
-
-void bind_fft(py::module& m)
-{
-
-    using planner = ::gr::fft::planner;
-    using fft_complex = ::gr::fft::fft_complex;
-    using fft_real_fwd = ::gr::fft::fft_real_fwd;
-    using fft_real_rev = ::gr::fft::fft_real_rev;
-
-
-    py::class_<planner, std::shared_ptr<planner>>(m, "planner", D(planner))
-
-        .def(py::init<>(), D(planner, planner, 0))
-        .def(py::init<gr::fft::planner const&>(), py::arg("arg0"), D(planner, planner, 1))
-
-
-        .def_static("mutex", &planner::mutex, D(planner, mutex))
-
-        ;
-
-
-    py::class_<fft_complex, std::shared_ptr<fft_complex>>(
-        m, "fft_complex", D(fft_complex))
-
-        .def(py::init<int, bool, int>(),
-             py::arg("fft_size"),
-             py::arg("forward") = true,
-             py::arg("nthreads") = 1,
-             D(fft_complex, fft_complex))
-
-
-        .def("get_inbuf", &fft_complex::get_inbuf, D(fft_complex, get_inbuf))
-
-
-        .def("get_outbuf", &fft_complex::get_outbuf, D(fft_complex, get_outbuf))
-
-
-        .def("inbuf_length", &fft_complex::inbuf_length, D(fft_complex, inbuf_length))
-
-
-        .def("outbuf_length", &fft_complex::outbuf_length, D(fft_complex, outbuf_length))
-
-
-        .def("set_nthreads",
-             &fft_complex::set_nthreads,
-             py::arg("n"),
-             D(fft_complex, set_nthreads))
-
-
-        .def("nthreads", &fft_complex::nthreads, D(fft_complex, nthreads))
-
-
-        .def("execute", &fft_complex::execute, D(fft_complex, execute))
-
-        ;
-
-
-    py::class_<fft_real_fwd, std::shared_ptr<fft_real_fwd>>(
-        m, "fft_real_fwd", D(fft_real_fwd))
-
-        .def(py::init<int, int>(),
-             py::arg("fft_size"),
-             py::arg("nthreads") = 1,
-             D(fft_real_fwd, fft_real_fwd))
-
-
-        .def("get_inbuf", &fft_real_fwd::get_inbuf, D(fft_real_fwd, get_inbuf))
-
-
-        .def("get_outbuf", &fft_real_fwd::get_outbuf, D(fft_real_fwd, get_outbuf))
-
-
-        .def("inbuf_length", &fft_real_fwd::inbuf_length, D(fft_real_fwd, inbuf_length))
-
-
-        .def(
-            "outbuf_length", &fft_real_fwd::outbuf_length, D(fft_real_fwd, outbuf_length))
-
-
-        .def("set_nthreads",
-             &fft_real_fwd::set_nthreads,
-             py::arg("n"),
-             D(fft_real_fwd, set_nthreads))
-
-
-        .def("nthreads", &fft_real_fwd::nthreads, D(fft_real_fwd, nthreads))
-
-
-        .def("execute", &fft_real_fwd::execute, D(fft_real_fwd, execute))
-
-        ;
-
-
-    py::class_<fft_real_rev, std::shared_ptr<fft_real_rev>>(
-        m, "fft_real_rev", D(fft_real_rev))
-
-        .def(py::init<int, int>(),
-             py::arg("fft_size"),
-             py::arg("nthreads") = 1,
-             D(fft_real_rev, fft_real_rev))
-
-
-        .def("get_inbuf", &fft_real_rev::get_inbuf, D(fft_real_rev, get_inbuf))
-
-
-        .def("get_outbuf", &fft_real_rev::get_outbuf, D(fft_real_rev, get_outbuf))
-
-
-        .def("inbuf_length", &fft_real_rev::inbuf_length, D(fft_real_rev, inbuf_length))
-
-
-        .def(
-            "outbuf_length", &fft_real_rev::outbuf_length, D(fft_real_rev, outbuf_length))
-
-
-        .def("set_nthreads",
-             &fft_real_rev::set_nthreads,
-             py::arg("n"),
-             D(fft_real_rev, set_nthreads))
-
-
-        .def("nthreads", &fft_real_rev::nthreads, D(fft_real_rev, nthreads))
-
-
-        .def("execute", &fft_real_rev::execute, D(fft_real_rev, execute))
-
-        ;
-}
diff --git a/gr-fft/python/fft/bindings/fft_v_python.cc b/gr-fft/python/fft/bindings/fft_v_python.cc
new file mode 100644
index 0000000000..720c484863
--- /dev/null
+++ b/gr-fft/python/fft/bindings/fft_v_python.cc
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2020 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ *
+ */
+
+/***********************************************************************************/
+/* This file is automatically generated using bindtool and can be manually edited  */
+/* The following lines can be configured to regenerate this file during cmake      */
+/* If manual edits are made, the following tags should be modified accordingly.    */
+/* BINDTOOL_GEN_AUTOMATIC(0)                                                       */
+/* BINDTOOL_USE_PYGCCXML(0)                                                        */
+/* BINDTOOL_HEADER_FILE(fft_v.h)                                        */
+/* BINDTOOL_HEADER_FILE_HASH(ef3398e963b1b296e309b81721bef8cb)                     */
+/***********************************************************************************/
+
+#include <pybind11/complex.h>
+#include <pybind11/pybind11.h>
+#include <pybind11/stl.h>
+
+namespace py = pybind11;
+
+#include <gnuradio/fft/fft_v.h>
+// pydoc.h is automatically generated in the build directory
+#include <fft_v_pydoc.h>
+
+
+template <class T, bool forward>
+void bind_fft_v_template(py::module& m, const char* classname)
+{
+    using fft_v_blk = gr::fft::fft_v<T, forward>;
+
+    py::class_<fft_v_blk,
+               gr::sync_block,
+               gr::block,
+               gr::basic_block,
+               std::shared_ptr<fft_v_blk>>(m, classname)
+        .def(py::init(&gr::fft::fft_v<T, forward>::make),
+             py::arg("fft_size"),
+             py::arg("window"),
+             py::arg("shift") = false,
+             py::arg("nthreads") = 1)
+        .def("set_nthreads", &fft_v_blk::set_nthreads, py::arg("n"))
+        .def("nthreads", &fft_v_blk::nthreads)
+        .def("set_window", &fft_v_blk::set_window, py::arg("window"));
+}
+
+void bind_fft_v(py::module& m)
+{
+    bind_fft_v_template<gr_complex, true>(m, "fft_vcc_fwd");
+    bind_fft_v_template<gr_complex, false>(m, "fft_vcc_rev");
+    bind_fft_v_template<float, true>(m, "fft_vfc_fwd");
+    bind_fft_v_template<float, false>(m, "fft_vfc_rev");
+}
diff --git a/gr-fft/python/fft/bindings/fft_vcc_python.cc b/gr-fft/python/fft/bindings/fft_vcc_python.cc
deleted file mode 100644
index 66c21c2db1..0000000000
--- a/gr-fft/python/fft/bindings/fft_vcc_python.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2020 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * SPDX-License-Identifier: GPL-3.0-or-later
- *
- */
-
-/***********************************************************************************/
-/* This file is automatically generated using bindtool and can be manually edited  */
-/* The following lines can be configured to regenerate this file during cmake      */
-/* If manual edits are made, the following tags should be modified accordingly.    */
-/* BINDTOOL_GEN_AUTOMATIC(0)                                                       */
-/* BINDTOOL_USE_PYGCCXML(0)                                                        */
-/* BINDTOOL_HEADER_FILE(fft_vcc.h)                                        */
-/* BINDTOOL_HEADER_FILE_HASH(815bbb036e65e51800b2732772a9eaeb)                     */
-/***********************************************************************************/
-
-#include <pybind11/complex.h>
-#include <pybind11/pybind11.h>
-#include <pybind11/stl.h>
-
-namespace py = pybind11;
-
-#include <gnuradio/fft/fft_vcc.h>
-// pydoc.h is automatically generated in the build directory
-#include <fft_vcc_pydoc.h>
-
-void bind_fft_vcc(py::module& m)
-{
-
-    using fft_vcc = ::gr::fft::fft_vcc;
-
-
-    py::class_<fft_vcc,
-               gr::sync_block,
-               gr::block,
-               gr::basic_block,
-               std::shared_ptr<fft_vcc>>(m, "fft_vcc", D(fft_vcc))
-
-        .def(py::init(&fft_vcc::make),
-             py::arg("fft_size"),
-             py::arg("forward"),
-             py::arg("window"),
-             py::arg("shift") = false,
-             py::arg("nthreads") = 1,
-             D(fft_vcc, make))
-
-
-        .def("set_nthreads",
-             &fft_vcc::set_nthreads,
-             py::arg("n"),
-             D(fft_vcc, set_nthreads))
-
-
-        .def("nthreads", &fft_vcc::nthreads, D(fft_vcc, nthreads))
-
-
-        .def("set_window",
-             &fft_vcc::set_window,
-             py::arg("window"),
-             D(fft_vcc, set_window));
-}
diff --git a/gr-fft/python/fft/bindings/fft_vfc_python.cc b/gr-fft/python/fft/bindings/fft_vfc_python.cc
deleted file mode 100644
index d8faefec65..0000000000
--- a/gr-fft/python/fft/bindings/fft_vfc_python.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2020 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * SPDX-License-Identifier: GPL-3.0-or-later
- *
- */
-
-/***********************************************************************************/
-/* This file is automatically generated using bindtool and can be manually edited  */
-/* The following lines can be configured to regenerate this file during cmake      */
-/* If manual edits are made, the following tags should be modified accordingly.    */
-/* BINDTOOL_GEN_AUTOMATIC(0)                                                       */
-/* BINDTOOL_USE_PYGCCXML(0)                                                        */
-/* BINDTOOL_HEADER_FILE(fft_vfc.h)                                        */
-/* BINDTOOL_HEADER_FILE_HASH(4de2f3aa3119e3d636a1a533974a2e95)                     */
-/***********************************************************************************/
-
-#include <pybind11/complex.h>
-#include <pybind11/pybind11.h>
-#include <pybind11/stl.h>
-
-namespace py = pybind11;
-
-#include <gnuradio/fft/fft_vfc.h>
-// pydoc.h is automatically generated in the build directory
-#include <fft_vfc_pydoc.h>
-
-void bind_fft_vfc(py::module& m)
-{
-    using fft_vfc = gr::fft::fft_vfc;
-
-
-    py::class_<fft_vfc,
-               gr::sync_block,
-               gr::block,
-               gr::basic_block,
-               std::shared_ptr<fft_vfc>>(m, "fft_vfc", D(fft_vfc))
-
-        .def(py::init(&fft_vfc::make),
-             py::arg("fft_size"),
-             py::arg("forward"),
-             py::arg("window"),
-             py::arg("nthreads") = 1,
-             D(fft_vfc, make))
-
-
-        .def("set_nthreads",
-             &fft_vfc::set_nthreads,
-             py::arg("n"),
-             D(fft_vfc, set_nthreads))
-
-
-        .def("nthreads", &fft_vfc::nthreads, D(fft_vfc, nthreads))
-
-
-        .def("set_window",
-             &fft_vfc::set_window,
-             py::arg("window"),
-             D(fft_vfc, set_window));
-}
diff --git a/gr-fft/python/fft/bindings/python_bindings.cc b/gr-fft/python/fft/bindings/python_bindings.cc
index a1c191ed3d..ea94cd7b8e 100644
--- a/gr-fft/python/fft/bindings/python_bindings.cc
+++ b/gr-fft/python/fft/bindings/python_bindings.cc
@@ -16,10 +16,8 @@
 namespace py = pybind11;
 
 // void bind_ctrlport_probe_psd(py::module&);
-void bind_fft(py::module&);
 void bind_fft_shift(py::module&);
-void bind_fft_vcc(py::module&);
-void bind_fft_vfc(py::module&);
+void bind_fft_v(py::module&);
 void bind_goertzel(py::module&);
 void bind_goertzel_fc(py::module&);
 void bind_window(py::module&);
@@ -44,10 +42,8 @@ PYBIND11_MODULE(fft_python, m)
     py::module::import("gnuradio.gr");
 
     // bind_ctrlport_probe_psd(m);
-    bind_fft(m);
     bind_fft_shift(m);
-    bind_fft_vcc(m);
-    bind_fft_vfc(m);
+    bind_fft_v(m);
     bind_goertzel(m);
     bind_goertzel_fc(m);
     bind_window(m);
diff --git a/gr-fft/python/fft/fft_vcc.py b/gr-fft/python/fft/fft_vcc.py
new file mode 100644
index 0000000000..3f5dae91b0
--- /dev/null
+++ b/gr-fft/python/fft/fft_vcc.py
@@ -0,0 +1,22 @@
+#
+# Copyright 2020 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+#
+
+from . import fft_python as fft
+
+
+class fft_vcc():
+    def __new__(self, fft_size,
+                forward,
+                window,
+                shift=False,
+                nthreads=1):
+        if forward:
+            return fft.fft_vcc_fwd(fft_size, window, shift, nthreads)
+        else:
+            return fft.fft_vcc_rev(fft_size, window, shift, nthreads)
diff --git a/gr-fft/python/fft/fft_vfc.py b/gr-fft/python/fft/fft_vfc.py
new file mode 100644
index 0000000000..5194b72f29
--- /dev/null
+++ b/gr-fft/python/fft/fft_vfc.py
@@ -0,0 +1,22 @@
+#
+# Copyright 2020 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+#
+
+from . import fft_python as fft
+
+
+class fft_vfc():
+    def __new__(self, fft_size,
+                forward,
+                window,
+                shift=False,
+                nthreads=1):
+        if forward:
+            return fft.fft_vfc_fwd(fft_size, window, shift, nthreads)
+        else:
+            return fft.fft_vfc_rev(fft_size, window, shift, nthreads)
-- 
cgit v1.2.3