diff options
author | Daniel Estévez <daniel@destevez.net> | 2021-06-06 11:25:57 +0200 |
---|---|---|
committer | mormj <34754695+mormj@users.noreply.github.com> | 2021-06-12 12:01:12 -0400 |
commit | 51c504ebb1ca21c5f7071826c1af03e45e391a65 (patch) | |
tree | dbabf0b0b825f834cff2067248d193fe8d951dd8 /gr-digital/include/gnuradio/digital/diff_encoder_bb.h | |
parent | 16d1b0215d59c52009b09867fbfce0b4c3585add (diff) |
digital: Add NRZI option to differential en/decoder
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>
Diffstat (limited to 'gr-digital/include/gnuradio/digital/diff_encoder_bb.h')
-rw-r--r-- | gr-digital/include/gnuradio/digital/diff_encoder_bb.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gr-digital/include/gnuradio/digital/diff_encoder_bb.h b/gr-digital/include/gnuradio/digital/diff_encoder_bb.h index 183be32873..b00445ac2a 100644 --- a/gr-digital/include/gnuradio/digital/diff_encoder_bb.h +++ b/gr-digital/include/gnuradio/digital/diff_encoder_bb.h @@ -1,6 +1,7 @@ /* -*- c++ -*- */ /* * Copyright 2006,2012 Free Software Foundation, Inc. + * Copyright 2021 Daniel Estevez <daniel@destevez.net> * * This file is part of GNU Radio * @@ -12,6 +13,7 @@ #define INCLUDED_GR_DIFF_ENCODER_BB_H #include <gnuradio/digital/api.h> +#include <gnuradio/digital/diff_coding_type.h> #include <gnuradio/sync_block.h> namespace gr { @@ -35,8 +37,10 @@ public: * Make a differential encoder block. * * \param modulus Modulus of code's alphabet + * \param coding Differential coding type */ - static sptr make(unsigned int modulus); + static sptr make(unsigned int modulus, + enum diff_coding_type coding = DIFF_DIFFERENTIAL); }; } /* namespace digital */ |