[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 06/12: dtv: atsc: adds ControlPort hooks to
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 06/12: dtv: atsc: adds ControlPort hooks to RS decoder. |
Date: |
Tue, 29 Dec 2015 22:49:23 +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 8e54c0201cb10c974460122cf4db6df13a00caf0
Author: Tom Rondeau <address@hidden>
Date: Fri May 8 13:16:22 2015 -0400
dtv: atsc: adds ControlPort hooks to RS decoder.
Can get info on number of packets observed, number of erroneous
packets, and estimated number of bit errors.
---
gr-dtv/include/gnuradio/dtv/atsc_rs_decoder.h | 15 +++++
gr-dtv/lib/atsc/atsc_rs_decoder_impl.cc | 92 +++++++++++++++++++++------
gr-dtv/lib/atsc/atsc_rs_decoder_impl.h | 13 +++-
3 files changed, 99 insertions(+), 21 deletions(-)
diff --git a/gr-dtv/include/gnuradio/dtv/atsc_rs_decoder.h
b/gr-dtv/include/gnuradio/dtv/atsc_rs_decoder.h
index 92eb263..c2b7d0d 100644
--- a/gr-dtv/include/gnuradio/dtv/atsc_rs_decoder.h
+++ b/gr-dtv/include/gnuradio/dtv/atsc_rs_decoder.h
@@ -42,6 +42,21 @@ namespace gr {
typedef boost::shared_ptr<atsc_rs_decoder> sptr;
/*!
+ * Returns the number of errors corrected by the decoder.
+ */
+ virtual int num_errors_corrected() const = 0;
+
+ /*!
+ * Returns the number of bad packets rejected by the decoder.
+ */
+ virtual int num_bad_packets() const = 0;
+
+ /*!
+ * Returns the total number of packets seen by the decoder.
+ */
+ virtual int num_packets() const = 0;
+
+ /*!
* \brief Make a new instance of gr::dtv::atsc_rs_decoder.
*/
static sptr make();
diff --git a/gr-dtv/lib/atsc/atsc_rs_decoder_impl.cc
b/gr-dtv/lib/atsc/atsc_rs_decoder_impl.cc
index 7a950e7..7a8b4a8 100644
--- a/gr-dtv/lib/atsc/atsc_rs_decoder_impl.cc
+++ b/gr-dtv/lib/atsc/atsc_rs_decoder_impl.cc
@@ -56,9 +56,9 @@ namespace gr {
{
d_rs = init_rs_char(rs_init_symsize, rs_init_gfpoly, rs_init_fcr,
rs_init_prim, rs_init_nroots);
assert (d_rs != 0);
- nerrors_corrrected_count = 0;
- bad_packet_count = 0;
- total_packets = 0;
+ d_nerrors_corrrected_count = 0;
+ d_bad_packet_count = 0;
+ d_total_packets = 0;
}
int atsc_rs_decoder_impl::decode (atsc_mpeg_packet_no_sync &out, const
atsc_mpeg_packet_rs_encoded &in)
@@ -89,6 +89,24 @@ namespace gr {
}
int
+ atsc_rs_decoder_impl::num_errors_corrected() const
+ {
+ return d_nerrors_corrrected_count;
+ }
+
+ int
+ atsc_rs_decoder_impl::num_bad_packets() const
+ {
+ return d_bad_packet_count;
+ }
+
+ int
+ atsc_rs_decoder_impl::num_packets() const
+ {
+ return d_total_packets;
+ }
+
+ int
atsc_rs_decoder_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
@@ -102,24 +120,25 @@ namespace gr {
int nerrors_corrrected = decode(out[i], in[i]);
out[i].pli.set_transport_error(nerrors_corrrected == -1);
- if (nerrors_corrrected == -1)
- bad_packet_count++;
- else
- nerrors_corrrected_count += nerrors_corrrected;
+ if (nerrors_corrrected == -1) {
+ d_bad_packet_count++;
+ d_nerrors_corrrected_count += 10; // lower bound estimate; most this
RS can fix
+ }
+ else {
+ d_nerrors_corrrected_count += nerrors_corrrected;
+ }
- total_packets++;
+ d_total_packets++;
#if 0
- if (total_packets > 1000) {
+ if (d_total_packets > 1000) {
// FIXME: convert to logger
- std::cout << "Error rate: "
- << (float)nerrors_corrrected_count/total_packets
- << "\tPacket error rate: "
- << (float)bad_packet_count/total_packets
- << std::endl;
-
- nerrors_corrrected_count = 0;
- bad_packet_count = 0;
- total_packets = 0;
+ GR_LOG_DEBUG(d_logger, boost::format("Error rate: %1%\tPacket error
rate: %2%") \
+ %
((float)d_nerrors_corrrected_count/(ATSC_MPEG_DATA_LENGTH*d_total_packets))
+ % ((float)d_bad_packet_count/d_total_packets));
+
+ //d_nerrors_corrrected_count = 0;
+ //d_bad_packet_count = 0;
+ //d_total_packets = 0;
}
#endif
}
@@ -127,5 +146,42 @@ namespace gr {
return noutput_items;
}
+
+ void
+ atsc_rs_decoder_impl::setup_rpc()
+ {
+#ifdef GR_CTRLPORT
+ add_rpc_variable(
+ rpcbasic_sptr(new rpcbasic_register_get<atsc_rs_decoder, int >(
+ alias(), "num_errors_corrected",
+ &atsc_rs_decoder::num_errors_corrected,
+ pmt::from_long(0),
+ pmt::from_long(10000000),
+ pmt::from_long(0),
+ "", "Number of errors corrected", RPC_PRIVLVL_MIN,
+ DISPTIME)));
+
+ add_rpc_variable(
+ rpcbasic_sptr(new rpcbasic_register_get<atsc_rs_decoder, int >(
+ alias(), "num_bad_packets",
+ &atsc_rs_decoder::num_bad_packets,
+ pmt::from_long(0),
+ pmt::from_long(10000000),
+ pmt::from_long(0),
+ "", "Number of bad packets", RPC_PRIVLVL_MIN,
+ DISPTIME)));
+
+ add_rpc_variable(
+ rpcbasic_sptr(new rpcbasic_register_get<atsc_rs_decoder, int >(
+ alias(), "num_packets",
+ &atsc_rs_decoder::num_packets,
+ pmt::from_long(0),
+ pmt::from_long(10000000),
+ pmt::from_long(0),
+ "", "Number of packets", RPC_PRIVLVL_MIN,
+ DISPTIME)));
+#endif /* GR_CTRLPORT */
+ }
+
} /* namespace dtv */
} /* namespace gr */
diff --git a/gr-dtv/lib/atsc/atsc_rs_decoder_impl.h
b/gr-dtv/lib/atsc/atsc_rs_decoder_impl.h
index 5746012..adbc487 100644
--- a/gr-dtv/lib/atsc/atsc_rs_decoder_impl.h
+++ b/gr-dtv/lib/atsc/atsc_rs_decoder_impl.h
@@ -36,15 +36,22 @@ namespace gr {
class atsc_rs_decoder_impl : public atsc_rs_decoder
{
private:
- int nerrors_corrrected_count;
- int bad_packet_count;
- int total_packets;
+ int d_nerrors_corrrected_count;
+ int d_bad_packet_count;
+ int d_total_packets;
+ int d_total_bits;
void *d_rs;
public:
atsc_rs_decoder_impl();
~atsc_rs_decoder_impl();
+ void setup_rpc();
+
+ int num_errors_corrected() const;
+ int num_bad_packets() const;
+ int num_packets() const;
+
/*!
* Decode RS encoded packet.
* \returns a count of corrected symbols, or -1 if the block was
uncorrectible.
- [Commit-gnuradio] [gnuradio] branch master updated (b858d8f -> b17bcb8), git, 2015/12/29
- [Commit-gnuradio] [gnuradio] 04/12: dtv: atsc: adds ControlPort interface to get equalizer taps., git, 2015/12/29
- [Commit-gnuradio] [gnuradio] 10/12: dtv: installing all examples, git, 2015/12/29
- [Commit-gnuradio] [gnuradio] 12/12: Merge remote-tracking branch 'tom/dtv/atsc_controlport', git, 2015/12/29
- [Commit-gnuradio] [gnuradio] 03/12: dtv: atsc: performance improvements for equalizer., git, 2015/12/29
- [Commit-gnuradio] [gnuradio] 11/12: Merge remote-tracking branch 'iohannez/gr_uhd_issue_stream_cmd_on_start', git, 2015/12/29
- [Commit-gnuradio] [gnuradio] 06/12: dtv: atsc: adds ControlPort hooks to RS decoder.,
git <=
- [Commit-gnuradio] [gnuradio] 08/12: dtv: Adding a ControlPort client example for plotting the quality of an ATSC receiver., git, 2015/12/29
- [Commit-gnuradio] [gnuradio] 02/12: gr-uhd: add parameter to enable/disable streaming when flowgraph starts, git, 2015/12/29
- [Commit-gnuradio] [gnuradio] 01/12: Check RX/TX streamers::sptr before flush/reset, git, 2015/12/29
- [Commit-gnuradio] [gnuradio] 05/12: dtv: atsc: adds controlport hooks to equalizer., git, 2015/12/29
- [Commit-gnuradio] [gnuradio] 09/12: dtv: Cleanup; ATSC RS decoder - change log level to INFO instead of DEBUG., git, 2015/12/29
- [Commit-gnuradio] [gnuradio] 07/12: dtv: atsc: add ControlPort hooks into Viterbi decoder., git, 2015/12/29