[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 22/39: fec: LDPC: Updating decoder to handl
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 22/39: fec: LDPC: Updating decoder to handle parity bits either first or last. |
Date: |
Thu, 15 Oct 2015 21:21:30 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 35bc6a3b99033e46946521960afb39a515a98cb3
Author: tracierenea <address@hidden>
Date: Wed Feb 25 00:09:41 2015 -0600
fec: LDPC: Updating decoder to handle parity bits either first or
last.
The convention (I hear) is that parity bits come last, at the end of
the codeword. Richarson/Urbanke's encoding method has them first
though. So, adding flexibility to handle either case; default is
parity bits expected last.
---
gr-fec/include/gnuradio/fec/fec_mtrx.h | 4 ++++
gr-fec/lib/fec_mtrx.cc | 9 ++++++++-
gr-fec/lib/ldpc_R_U_mtrx.cc | 5 +++++
gr-fec/lib/ldpc_bit_flip_decoder_impl.cc | 15 +++++++++++----
4 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/gr-fec/include/gnuradio/fec/fec_mtrx.h
b/gr-fec/include/gnuradio/fec/fec_mtrx.h
index fceb86d..973f881 100644
--- a/gr-fec/include/gnuradio/fec/fec_mtrx.h
+++ b/gr-fec/include/gnuradio/fec/fec_mtrx.h
@@ -50,6 +50,8 @@ namespace gr {
gsl_matrix *d_H_ptr;
// Read the matrix from a file in alist format
gsl_matrix *read_matrix_from_file(const std::string filename);
+ // Flag for whether or not the parity bits come first or last
+ bool d_par_bits_last;
public:
// Returns the parity check matrix H (needed by decoder)
@@ -73,6 +75,8 @@ namespace gr {
// Find the inverse of a square matrix using modulo 2
// operations
gsl_matrix *calc_inverse_mod2(const gsl_matrix *) const;
+ // The decoder will need to know this
+ bool parity_bits_come_last() const;
virtual ~fec_mtrx();
};
diff --git a/gr-fec/lib/fec_mtrx.cc b/gr-fec/lib/fec_mtrx.cc
index 342526b..0ff60e3 100644
--- a/gr-fec/lib/fec_mtrx.cc
+++ b/gr-fec/lib/fec_mtrx.cc
@@ -34,7 +34,9 @@ namespace gr {
fec_mtrx::fec_mtrx()
{
- // nothing for the default constructor to do
+ // Assume the convention that parity bits come last in the
+ // codeword
+ d_par_bits_last = true;
}
gsl_matrix*
@@ -291,6 +293,11 @@ namespace gr {
return matrix_inverse;
}
+ bool
+ fec_mtrx::parity_bits_come_last() const
+ {
+ return d_par_bits_last;
+ }
fec_mtrx::~fec_mtrx()
{
diff --git a/gr-fec/lib/ldpc_R_U_mtrx.cc b/gr-fec/lib/ldpc_R_U_mtrx.cc
index 2fe0605..bb7b86d 100644
--- a/gr-fec/lib/ldpc_R_U_mtrx.cc
+++ b/gr-fec/lib/ldpc_R_U_mtrx.cc
@@ -48,6 +48,11 @@ namespace gr {
// For info about this see get_base_ptr() function
d_base_ptr = this;
+ // The parity bits come first in this particular matrix
+ // format (specifically required for the Richardson Urbanke
+ // encoder)
+ d_par_bits_last = false;
+
} // Constructor
// Default constructor, should not be used
diff --git a/gr-fec/lib/ldpc_bit_flip_decoder_impl.cc
b/gr-fec/lib/ldpc_bit_flip_decoder_impl.cc
index f7fbd3c..d99a1d5 100644
--- a/gr-fec/lib/ldpc_bit_flip_decoder_impl.cc
+++ b/gr-fec/lib/ldpc_bit_flip_decoder_impl.cc
@@ -182,10 +182,17 @@ namespace gr {
// Extract the info word and assign to output. This will
// happen regardless of if a valid codeword was found.
unsigned char *out = (unsigned char*) outbuffer;
- for (index = 0; index < d_frame_size; index++) {
- unsigned int i = index + n - d_frame_size;
- int value = gsl_matrix_get(x, i, 0);
- out[index] = value;
+ if (d_mtrx->parity_bits_come_last()) {
+ for (index = 0; index < d_frame_size; index++) {
+ out[index] = gsl_matrix_get(x, index, 0);
+ }
+ }
+ else {
+ for (index = 0; index < d_frame_size; index++) {
+ unsigned int i = index + n - d_frame_size;
+ int value = gsl_matrix_get(x, i, 0);
+ out[index] = value;
+ }
}
// Free memory
- [Commit-gnuradio] [gnuradio] 03/39: fec: LDPC: Renaming some files., (continued)
- [Commit-gnuradio] [gnuradio] 03/39: fec: LDPC: Renaming some files., git, 2015/10/15
- [Commit-gnuradio] [gnuradio] 12/39: fec: LDPC: Improving memory management (GSL matrices)., git, 2015/10/15
- [Commit-gnuradio] [gnuradio] 11/39: fec: LDPC: Fixing simple, but crucial, error in decoder. doh!, git, 2015/10/15
- [Commit-gnuradio] [gnuradio] 06/39: fec: LDPC: Adding bit flip decoder variable work function., git, 2015/10/15
- [Commit-gnuradio] [gnuradio] 15/39: fec: LDPC: Change GRC block name text to match new class name., git, 2015/10/15
- [Commit-gnuradio] [gnuradio] 19/39: fec: LDPC: renaming some of the LDPC classes for clarity/consistency., git, 2015/10/15
- [Commit-gnuradio] [gnuradio] 09/39: fec: LDPC: Adding scripts to generate matrices for encoder., git, 2015/10/15
- [Commit-gnuradio] [gnuradio] 18/39: fec: LDPC: Updates to LDPC-related matrix classes., git, 2015/10/15
- [Commit-gnuradio] [gnuradio] 01/39: fec: LDPC: Adding class for LDPC parity check matrix., git, 2015/10/15
- [Commit-gnuradio] [gnuradio] 16/39: fec: LDPC: updates for LDPC functionality., git, 2015/10/15
- [Commit-gnuradio] [gnuradio] 22/39: fec: LDPC: Updating decoder to handle parity bits either first or last.,
git <=
- [Commit-gnuradio] [gnuradio] 28/39: qtgui: fixes calculation of BPSK BER curve., git, 2015/10/15
- [Commit-gnuradio] [gnuradio] 05/39: fec: LDPC: Adding LDPC encoder variable., git, 2015/10/15
- [Commit-gnuradio] [gnuradio] 34/39: fec: LDPC: changing namespace of ldpc_encoder back., git, 2015/10/15
- [Commit-gnuradio] [gnuradio] 30/39: fec: Updated docs for Forward Error Correction section in manual., git, 2015/10/15
- [Commit-gnuradio] [gnuradio] 32/39: fec: LDPC: removing apps until we can fix them up properly., git, 2015/10/15
- [Commit-gnuradio] [gnuradio] 35/39: fec: LDPC: better docs describing encoder/decoders and how to use., git, 2015/10/15
- [Commit-gnuradio] [gnuradio] 39/39: Merge remote-tracking branch 'tom/fec/ldpc_methods', git, 2015/10/15
- [Commit-gnuradio] [gnuradio] 26/39: fec: LDPC: Setting copyright date to current year., git, 2015/10/15
- [Commit-gnuradio] [gnuradio] 38/39: fec: LDPC: added back all QA tests and added a test of ldpc_gen_mtrx_encoder., git, 2015/10/15
- [Commit-gnuradio] [gnuradio] 13/39: fec: LDPC: Renaming class from ldpc_par_chk_mtrx to ldpc_R_U_mtrx, git, 2015/10/15