[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 09/24: digital: Removed parse_soft and pack
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 09/24: digital: Removed parse_soft and packet_parse_f. |
Date: |
Tue, 14 Jun 2016 00:40:57 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch packet2
in repository gnuradio.
commit 1353ca306da19d115e3e4fd8c14ca623c919e2ce
Author: Tom Rondeau <address@hidden>
Date: Fri Apr 8 14:39:28 2016 -0400
digital: Removed parse_soft and packet_parse_f.
Lots of duplicated code removed. Expect the input to packet_parse_b to
be sliced or decoded by an FEC decoder already.
---
gr-digital/grc/digital_block_tree.xml | 2 +-
gr-digital/grc/digital_packet_parse_x.xml | 20 +---
gr-digital/include/gnuradio/digital/CMakeLists.txt | 1 -
.../gnuradio/digital/packet_formatter_default.h | 70 +++-----------
.../include/gnuradio/digital/packet_parse_f.h | 105 ---------------------
gr-digital/lib/CMakeLists.txt | 1 -
gr-digital/lib/packet_formatter_default.cc | 59 +-----------
gr-digital/lib/packet_parse_f_impl.cc | 98 -------------------
gr-digital/lib/packet_parse_f_impl.h | 53 -----------
gr-digital/swig/digital_swig.i | 3 -
10 files changed, 20 insertions(+), 392 deletions(-)
diff --git a/gr-digital/grc/digital_block_tree.xml
b/gr-digital/grc/digital_block_tree.xml
index 3ae99f3..3a7776b 100644
--- a/gr-digital/grc/digital_block_tree.xml
+++ b/gr-digital/grc/digital_block_tree.xml
@@ -74,7 +74,7 @@
<block>digital_framer_sink_1</block>
<block>variable_packet_formatter_default</block>
<block>digital_packet_format_async</block>
- <block>digital_packet_parse_x</block>
+ <block>digital_packet_parse_b</block>
<block>digital_header_payload_demux</block>
<block>digital_packet_headergenerator_bb</block>
<block>digital_packet_headergenerator_bb_default</block>
diff --git a/gr-digital/grc/digital_packet_parse_x.xml
b/gr-digital/grc/digital_packet_parse_x.xml
index 493b916..db9448e 100644
--- a/gr-digital/grc/digital_packet_parse_x.xml
+++ b/gr-digital/grc/digital_packet_parse_x.xml
@@ -1,24 +1,8 @@
<block>
<name>Packet Parser</name>
- <key>digital_packet_parse_x</key>
+ <key>digital_packet_parse_b</key>
<import>from gnuradio import digital</import>
- <make>digital.packet_parse_$(type)($formatter, $threshold)</make>
-
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Hard Bits</name>
- <key>b</key>
- <opt>input:byte</opt>
- </option>
- <option>
- <name>Soft Bits</name>
- <key>f</key>
- <opt>input:float</opt>
- </option>
- </param>
+ <make>digital.packet_parse_b($formatter, $threshold)</make>
<param>
<name>Formatter</name>
diff --git a/gr-digital/include/gnuradio/digital/CMakeLists.txt
b/gr-digital/include/gnuradio/digital/CMakeLists.txt
index a2d115d..546d80c 100644
--- a/gr-digital/include/gnuradio/digital/CMakeLists.txt
+++ b/gr-digital/include/gnuradio/digital/CMakeLists.txt
@@ -95,7 +95,6 @@ install(FILES
packet_formatter_counter.h
packet_format_async.h
packet_parse_b.h
- packet_parse_f.h
packet_header_default.h
packet_header_ofdm.h
packet_headergenerator_bb.h
diff --git a/gr-digital/include/gnuradio/digital/packet_formatter_default.h
b/gr-digital/include/gnuradio/digital/packet_formatter_default.h
index 371a92c..e8026a6 100644
--- a/gr-digital/include/gnuradio/digital/packet_formatter_default.h
+++ b/gr-digital/include/gnuradio/digital/packet_formatter_default.h
@@ -43,18 +43,15 @@ namespace gr {
* \li packet_formatter_default::format: takes in a
* payload and creates a header from it.
*
- * \li packet_formatter_default::parse receive bits and
- * extract the header info.
- *
- * Another version of the parser is
- * packet_formatter_default::parse_soft that receives soft
- * decisions instead of hard bits.
+ * \li packet_formatter_default::parse receive bits and extract
+ * the header info. These are expected to be hard bits (0 or 1)
+ * that have either been sliced or gone through an FEC decoder.
*
* This class is specifically designed to work with packets/frames
* in the asynchronous PDU architecture of GNU Radio. See the
* packet_format_async block for formatting the headers onto
- * payloads and packet_parse_b and packet_parse_f blocks for
- * parsing headers in a receiver.
+ * payloads and packet_parse_b block for parsing headers in a
+ * receiver.
*
* The Packet Format block takes in a PDU and uses a formatter
* class derived from this class to add a header onto the
@@ -68,18 +65,18 @@ namespace gr {
* flowgraph can then separately modulate and combine these two
* pieces in the follow-on processing.
*
- * The packet_sync_b and packet_sync_f blocks use the same
- * formatter class by calling the 'parse' or 'parse_soft' to parse
- * the received packet headers. These parser blocks are sinks for
- * the data stream and emit a message from an 'info' port that
- * contains an PMT dictionary of the information in the
- * header. The formatter class determines the dictionary keys.
+ * The packet_sync_b block uses the formatter class by calling the
+ * 'parse' function to parse the received packet headers. This
+ * parser block is a sink for the data stream and emits a message
+ * from an 'info' port that contains an PMT dictionary of the
+ * information in the header. The formatter class determines the
+ * dictionary keys.
*
* This is the base class for dealing with formatting headers for
* different protocols and purposes. For other header formatting
* behaviors, create a child class from here and overload the
- * format, parse, parse_soft, and parsing state machine functions
- * as necessary.
+ * format, parse, and parsing state machine functions as
+ * necessary.
*
* The default header created in this base class consists of an
* access code and the packet length. The length is encoded as a
@@ -190,45 +187,6 @@ namespace gr {
int &nbits_processed);
/*!
- * Parses a header of the form:
- *
- * \verbatim
- | access code | pkt len | pkt len | payload |
- \endverbatim
- *
- * This is implemented as a state machine that starts off
- * searching for the access code. Once found, the access code is
- * used to find the start of the packet and the following
- * header. This default header encodes the length of the payload
- * a 16 bit integer twice. The state machine finds the header
- * and checks that both payload length values are the same. It
- * then goes into its final state that reads in the payload
- * (based on the payload length) and produces a payload as a PMT
- * f32 vector of soft decision bits.
- *
- * This form of the header parser is specifically intended for
- * use with FEC decoders, in particular the
- * gr::fec::async_decoder.
- *
- * \param nbits_in The number of soft decisions in the input array.
- * \param input The input as soft decision floats.
- * \param info A vector of pmt::dicts to hold any meta data or
- * info about the PDU. When parsing the header, the
- * formatter can add info from the header into this dict.
- * Each packet has a single PMT dictionary of info, so
- * the vector length is the number of packets received
- * extracted during one call to this parser function.
- * \param nbits_processed Number of input bits actually
- * processed; If all goes well, this is nbits_in. A
- * premature return after a bad header could be less than
- * this.
- */
- virtual bool parse_soft(int nbits_in,
- const float *input,
- std::vector<pmt::pmt_t> &info,
- int &nbits_processed);
-
- /*!
* Returns the length of the formatted header in bits.
*/
virtual size_t header_nbits() const;
@@ -281,7 +239,7 @@ namespace gr {
header_buffer d_hdr_reg;
int d_pkt_len; //!< Length of the packet to put into the
output buffer
- int d_pkt_count; //!< Number of bytes/soft bits already
received
+ int d_pkt_count; //!< Number of bytes bits already received
pmt::pmt_t d_info; //!< info captured from the header
uint16_t d_bps; //!< bits/sec of payload modulation
diff --git a/gr-digital/include/gnuradio/digital/packet_parse_f.h
b/gr-digital/include/gnuradio/digital/packet_parse_f.h
deleted file mode 100644
index d146702..0000000
--- a/gr-digital/include/gnuradio/digital/packet_parse_f.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2014 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-
-#ifndef INCLUDED_DIGITAL_PACKET_PARSE_F_H
-#define INCLUDED_DIGITAL_PACKET_PARSE_F_H
-
-#include <gnuradio/digital/api.h>
-#include <gnuradio/digital/packet_formatter_default.h>
-#include <gnuradio/sync_block.h>
-
-namespace gr {
- namespace digital {
-
- /*!
- * \brief Block that synchronizes to a header based on a header
- * formatter class. Designed to accept soft decisions and produce
- * PDUs with soft decisions (pmt::f32vector).
- *
- * \ingroup packet_operators_blk
- *
- * \details
- *
- * A packet synchronizer block. This block takes in soft decision
- * bits (floats) and finds the access code as a sync word to find
- * the start of a frame.
- *
- * The block uses a formatter derived from a
- * packet_formatter_default formatter class. The only thing
- * this class is required to have in the header is an access code
- * of up to 64 bits. This block uses the formatter and access code
- * to do the frame synchronization. An access code is found if the
- * received bits have fewer than \p threshold errors detected.
- *
- * As soft decisions are received, the header is generally uncoded
- * or the formatter will understand the code and handle it
- * itself. Mostly, the header_parser will just slice the decisions
- * at 0 and convert to hard 1's and 0's.
- *
- * Once the frame access code is detected, the block uses the
- * formatter's parse_header to decode the remaining
- * header. Generally, as in the default header case, the header
- * will contain the length of the frame's payload. That and
- * anything else in the header will generally go into the PDU's
- * meta-data dictionary.
- *
- * The block will output a PDU that contains frame's header info
- * in the meta-data portion of the PDU and the payload itself. The
- * payload will be the input soft decision values, so the payload
- * will be a float vector.
- *
- * \sa packet_sync_bb for a hard decision version.
- */
- class DIGITAL_API packet_parse_f : virtual public sync_block
- {
- public:
- typedef boost::shared_ptr<packet_parse_f> sptr;
-
- /*!
- * Make a packet header block using a given \p formatter.
- *
- * \param formatter The formatter class to use when reading the
- * header.
- * \param threshold How many bits in the access code the
- * \p formatter can miss and still trigger a hit.
- */
- static sptr make(const packet_formatter_default::sptr &formatter,
- unsigned int threshold=0);
-
- /*!
- * Sets the threshold level for the formatter when finding the
- * access code. See packet_formatter_default::set_threshold
- * for more details.
- */
- virtual void set_threshold(unsigned int thresh) = 0;
-
- /*!
- * Gets the access code detection threshold from the formatter.
- */
- virtual unsigned int threshold() const = 0;
- };
-
- } // namespace digital
-} // namespace gr
-
-#endif /* INCLUDED_DIGITAL_PACKET_PARSE_F_H */
diff --git a/gr-digital/lib/CMakeLists.txt b/gr-digital/lib/CMakeLists.txt
index 9432082..2d25c2d 100644
--- a/gr-digital/lib/CMakeLists.txt
+++ b/gr-digital/lib/CMakeLists.txt
@@ -111,7 +111,6 @@ list(APPEND digital_sources
packet_formatter_counter.cc
packet_format_async_impl.cc
packet_parse_b_impl.cc
- packet_parse_f_impl.cc
packet_header_default.cc
packet_header_ofdm.cc
packet_headergenerator_bb_impl.cc
diff --git a/gr-digital/lib/packet_formatter_default.cc
b/gr-digital/lib/packet_formatter_default.cc
index 053918b..c11768f 100644
--- a/gr-digital/lib/packet_formatter_default.cc
+++ b/gr-digital/lib/packet_formatter_default.cc
@@ -156,11 +156,13 @@ namespace gr {
while(nbits_processed <= nbits_in) { // Shift bits one at a time
into header
d_hdr_reg.insert_bit(input[nbits_processed++]);
if(d_hdr_reg.length() == (header_nbits()-d_access_code_len)) {
+
// we have a full header, check to see if it has been received
properly
if(header_ok()) {
int payload_len = header_payload();
enter_have_header(payload_len);
info.push_back(d_info);
+ return true;
}
else {
enter_search(); // bad header
@@ -173,64 +175,9 @@ namespace gr {
}
}
- return true;
+ return false;
}
- bool
- packet_formatter_default::parse_soft(int nbits_in,
- const float *input,
- std::vector<pmt::pmt_t> &info,
- int &nbits_processed)
- {
- nbits_processed = 0;
-
- while(nbits_processed < nbits_in) {
- switch(d_state) {
- case STATE_SYNC_SEARCH: // Look for the access code correlation
-
- while(nbits_processed < nbits_in) {
- // shift in new data
- d_data_reg = (d_data_reg << 1) |
(gr::branchless_binary_slicer(input[nbits_processed++]) & 0x1);
-
- // compute hamming distance between desired access code and
current data
- uint64_t wrong_bits = 0;
- uint64_t nwrong = d_threshold+1;
-
- wrong_bits = (d_data_reg ^ d_access_code) & d_mask;
- volk_64u_popcnt(&nwrong, wrong_bits);
-
- if(nwrong <= d_threshold) {
- enter_have_sync();
- break;
- }
- }
- break;
-
- case STATE_HAVE_SYNC:
- while(nbits_processed < nbits_in) { // Shift bits one at a time
into header
-
d_hdr_reg.insert_bit(gr::branchless_binary_slicer(input[nbits_processed++]));
-
- if(d_hdr_reg.length() == (header_nbits()-d_access_code_len)) {
- // we have a full header, check to see if it has been received
properly
- if(header_ok()) {
- int payload_len = header_payload();
- enter_have_header(8*payload_len);
- info.push_back(d_info);
- }
- else {
- enter_search(); // bad header
- }
- break;
- }
- }
- break;
- }
- }
-
- return true;
- }
-
-
size_t
packet_formatter_default::header_nbits() const
{
diff --git a/gr-digital/lib/packet_parse_f_impl.cc
b/gr-digital/lib/packet_parse_f_impl.cc
deleted file mode 100644
index 3fe65ba..0000000
--- a/gr-digital/lib/packet_parse_f_impl.cc
+++ /dev/null
@@ -1,98 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2014 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "packet_parse_f_impl.h"
-#include <gnuradio/io_signature.h>
-#include <stdexcept>
-#include <volk/volk.h>
-#include <iostream>
-
-namespace gr {
- namespace digital {
-
- packet_parse_f::sptr
- packet_parse_f::make(const packet_formatter_default::sptr &formatter,
- unsigned int threshold)
- {
- return gnuradio::get_initial_sptr
- (new packet_parse_f_impl(formatter, threshold));
- }
-
-
- packet_parse_f_impl::packet_parse_f_impl(const
packet_formatter_default::sptr &formatter,
- unsigned int threshold)
- : sync_block("packet_parse_f",
- io_signature::make(1, 1, sizeof(float)),
- io_signature::make(0, 0, 0))
- {
- d_formatter = formatter;
- set_threshold(threshold);
-
- d_out_port = pmt::mp("info");
- message_port_register_out(d_out_port);
- }
-
- packet_parse_f_impl::~packet_parse_f_impl()
- {
- }
-
- void
- packet_parse_f_impl::set_threshold(unsigned int thresh)
- {
- d_formatter->set_threshold(thresh);
- }
-
- unsigned int
- packet_parse_f_impl::threshold() const
- {
- return d_formatter->threshold();
- }
-
- int
- packet_parse_f_impl::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- const float *in = (const float*)input_items[0];
-
- int count = 0;
- std::vector<pmt::pmt_t> info;
- bool ret = d_formatter->parse_soft(noutput_items, in, info, count);
-
- if(ret) {
- for(size_t i = 0; i < info.size(); i++) {
- message_port_pub(d_out_port, info[i]);
- }
- }
- else {
- message_port_pub(d_out_port, pmt::PMT_F);
- }
-
- return count;
- }
-
- } /* namespace digital */
-} /* namespace gr */
diff --git a/gr-digital/lib/packet_parse_f_impl.h
b/gr-digital/lib/packet_parse_f_impl.h
deleted file mode 100644
index 2c38975..0000000
--- a/gr-digital/lib/packet_parse_f_impl.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2014 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_DIGITAL_PACKET_PARSE_F_IMPL_H
-#define INCLUDED_DIGITAL_PACKET_PARSE_F_IMPL_H
-
-#include <gnuradio/digital/packet_parse_f.h>
-
-namespace gr {
- namespace digital {
-
- class packet_parse_f_impl : public packet_parse_f
- {
- private:
- packet_formatter_default::sptr d_formatter;
- pmt::pmt_t d_out_port;
-
- public:
- packet_parse_f_impl(const packet_formatter_default::sptr &formatter,
- unsigned int threshold=0);
- ~packet_parse_f_impl();
-
- void set_threshold(unsigned int thresh);
- unsigned int threshold() const;
-
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- };
-
- } // namespace digital
-} // namespace gr
-
-#endif /* INCLUDED_DIGITAL_PACKET_PARSE_F_IMPL_H */
diff --git a/gr-digital/swig/digital_swig.i b/gr-digital/swig/digital_swig.i
index b0fe202..0270cfc 100644
--- a/gr-digital/swig/digital_swig.i
+++ b/gr-digital/swig/digital_swig.i
@@ -104,7 +104,6 @@
#include "gnuradio/digital/packet_formatter_counter.h"
#include "gnuradio/digital/packet_format_async.h"
#include "gnuradio/digital/packet_parse_b.h"
-#include "gnuradio/digital/packet_parse_f.h"
#include "gnuradio/digital/packet_header_default.h"
#include "gnuradio/digital/packet_header_ofdm.h"
#include "gnuradio/digital/packet_headergenerator_bb.h"
@@ -190,7 +189,6 @@
%include "gnuradio/digital/packet_formatter_counter.h"
%include "gnuradio/digital/packet_format_async.h"
%include "gnuradio/digital/packet_parse_b.h"
-%include "gnuradio/digital/packet_parse_f.h"
%include "gnuradio/digital/packet_header_default.h"
%include "gnuradio/digital/packet_header_ofdm.h"
%include "gnuradio/digital/packet_headergenerator_bb.h"
@@ -261,7 +259,6 @@ GR_SWIG_BLOCK_MAGIC2(digital, ofdm_serializer_vcc);
GR_SWIG_BLOCK_MAGIC2(digital, ofdm_sync_sc_cfb);
GR_SWIG_BLOCK_MAGIC2(digital, packet_format_async);
GR_SWIG_BLOCK_MAGIC2(digital, packet_parse_b);
-GR_SWIG_BLOCK_MAGIC2(digital, packet_parse_f);
GR_SWIG_BLOCK_MAGIC2(digital, packet_headergenerator_bb);
GR_SWIG_BLOCK_MAGIC2(digital, packet_headerparser_b);
GR_SWIG_BLOCK_MAGIC2(digital, packet_sink);
- [Commit-gnuradio] [gnuradio] branch packet2 created (now 93acb5b), git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 11/24: digital: fixed packet parser QA tests, git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 04/24: digital: Cleaning up some of the packet parsing code., git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 12/24: blocks: Adds a multiple (complex only) block that responds to tags., git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 13/24: digital: Dealing with scaling issues with corr_est., git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 09/24: digital: Removed parse_soft and packet_parse_f.,
git <=
- [Commit-gnuradio] [gnuradio] 15/24: digital: wip: packet formatters specify payload in symbols, not bits., git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 03/24: Adding new test block to adjust the sample rate of a stream and make sure tags are being placed in the correct locations., git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 06/24: digital: updates to packet_formatter classes and parsing blocks., git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 08/24: digital: fixing PFB clock sync block handling of tags., git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 23/24: digital: Fixing QA code for testing header formatter/parsers., git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 14/24: digital: wip: pfb_clock_sync_ccf tag offset update., git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 18/24: digital: fixing up some of the packet formatters since the new base class., git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 17/24: docs: Adding documentation for packet comms, git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 07/24: digital: Updates to corr_est block., git, 2016/06/13
- [Commit-gnuradio] [gnuradio] 20/24: digital: fixed packet_parse from using default formatter to base class, git, 2016/06/13