From 51c504ebb1ca21c5f7071826c1af03e45e391a65 Mon Sep 17 00:00:00 2001 From: Daniel Estévez <daniel@destevez.net> Date: Sun, 6 Jun 2021 11:25:57 +0200 Subject: digital: Add NRZI option to differential en/decoder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds an option to the differential encoder an decoder blocks to perform NRZI encoding and decoding. NRZI only makes sense with a modulus of 2, so the blocks constructors will throw and exception if passed nrzi = true and a modulus different from 2. The GRC blocks handle this by hiding the modulus field if the user selects NRZI encoding. A new unit test for the NRZI version of the blocks is added. Besides checking that encode plus decode gives the original, this test also compares the C++ implementation results against a Numpy implementation. Additionally, a faster implementation of differential encoding/ decoding for modulus 2 is included here. Signed-off-by: Daniel Estévez <daniel@destevez.net> --- gr-digital/python/digital/bindings/diff_decoder_bb_python.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gr-digital/python/digital/bindings/diff_decoder_bb_python.cc') diff --git a/gr-digital/python/digital/bindings/diff_decoder_bb_python.cc b/gr-digital/python/digital/bindings/diff_decoder_bb_python.cc index f7fb6b0943..a5628fb372 100644 --- a/gr-digital/python/digital/bindings/diff_decoder_bb_python.cc +++ b/gr-digital/python/digital/bindings/diff_decoder_bb_python.cc @@ -14,7 +14,7 @@ /* BINDTOOL_GEN_AUTOMATIC(0) */ /* BINDTOOL_USE_PYGCCXML(0) */ /* BINDTOOL_HEADER_FILE(diff_decoder_bb.h) */ -/* BINDTOOL_HEADER_FILE_HASH(3814f3ba5b3a9425eae5611e1a4876ec) */ +/* BINDTOOL_HEADER_FILE_HASH(92f143bcb3f067b3cdf8292a75956d31) */ /***********************************************************************************/ #include <pybind11/complex.h> @@ -41,6 +41,7 @@ void bind_diff_decoder_bb(py::module& m) .def(py::init(&diff_decoder_bb::make), py::arg("modulus"), + py::arg("nrzi") = ::gr::digital::DIFF_DIFFERENTIAL, D(diff_decoder_bb, make)) -- cgit v1.2.3