Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
  • Loading branch information
trondeau committed Oct 6, 2014
2 parents 4f03a54 + 41fbbc6 commit 797b592
Show file tree
Hide file tree
Showing 12 changed files with 213 additions and 238 deletions.
19 changes: 9 additions & 10 deletions gr-blocks/lib/multiply_matrix_cc_impl.cc
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
/* -*- 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,
Expand All @@ -34,7 +34,7 @@ namespace gr {
multiply_matrix_cc::sptr
multiply_matrix_cc::make(std::vector<std::vector<gr_complex> > A, gr::block::tag_propagation_policy_t tag_propagation_policy)
{
if (A.empty() or A[0].size() == 0) {
if (A.empty() || A[0].size() == 0) {
throw std::invalid_argument("matrix A has invalid dimensions.");
}
return gnuradio::get_initial_sptr
Expand Down Expand Up @@ -134,11 +134,11 @@ namespace gr {
void
multiply_matrix_cc_impl::msg_handler_A(pmt::pmt_t A)
{
if (not pmt::is_vector(A) and not pmt::is_tuple(A)) {
if (!pmt::is_vector(A) && !pmt::is_tuple(A)) {
GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong type).");
return;
}
if (not pmt::length(A) == d_A.size()) {
if (!pmt::length(A) == d_A.size()) {
GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong size).");
return;
}
Expand All @@ -151,7 +151,7 @@ namespace gr {
} else if (pmt::is_tuple(A)) {
row = pmt::tuple_ref(A, i);
}
if (pmt::is_vector(row) or pmt::is_tuple(row)) {
if (pmt::is_vector(row) || pmt::is_tuple(row)) {
if (pmt::length(row) != d_A[0].size()) {
GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong number of columns).");
return;
Expand Down Expand Up @@ -189,4 +189,3 @@ namespace gr {

} /* namespace blocks */
} /* namespace gr */

19 changes: 9 additions & 10 deletions gr-blocks/lib/multiply_matrix_ff_impl.cc
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
/* -*- 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,
Expand All @@ -34,7 +34,7 @@ namespace gr {
multiply_matrix_ff::sptr
multiply_matrix_ff::make(std::vector<std::vector<float> > A, gr::block::tag_propagation_policy_t tag_propagation_policy)
{
if (A.empty() or A[0].size() == 0) {
if (A.empty() || A[0].size() == 0) {
throw std::invalid_argument("matrix A has invalid dimensions.");
}
return gnuradio::get_initial_sptr
Expand Down Expand Up @@ -134,11 +134,11 @@ namespace gr {
void
multiply_matrix_ff_impl::msg_handler_A(pmt::pmt_t A)
{
if (not pmt::is_vector(A) and not pmt::is_tuple(A)) {
if (!pmt::is_vector(A) && !pmt::is_tuple(A)) {
GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong type).");
return;
}
if (not pmt::length(A) == d_A.size()) {
if (!pmt::length(A) == d_A.size()) {
GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong size).");
return;
}
Expand All @@ -151,7 +151,7 @@ namespace gr {
} else if (pmt::is_tuple(A)) {
row = pmt::tuple_ref(A, i);
}
if (pmt::is_vector(row) or pmt::is_tuple(row)) {
if (pmt::is_vector(row) || pmt::is_tuple(row)) {
if (pmt::length(row) != d_A[0].size()) {
GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong number of columns).");
return;
Expand Down Expand Up @@ -189,4 +189,3 @@ namespace gr {

} /* namespace blocks */
} /* namespace gr */

4 changes: 2 additions & 2 deletions gr-blocks/tests/benchmark_nco.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
#endif

#include <unistd.h>
#include <gnuradio/blocks/nco.h>
#include <gnuradio/blocks/fxpt_nco.h>
#include <gnuradio/nco.h>
#include <gnuradio/fxpt_nco.h>
#include <string.h>

#define ITERATIONS 20000000
Expand Down
4 changes: 2 additions & 2 deletions gr-blocks/tests/benchmark_vco.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
#endif

#include <unistd.h>
#include <gnuradio/blocks/vco.h>
#include <gnuradio/blocks/fxpt_vco.h>
#include <gnuradio/vco.h>
#include <gnuradio/fxpt_vco.h>
#include <string.h>

#define ITERATIONS 5000000
Expand Down
37 changes: 36 additions & 1 deletion gr-fec/include/gnuradio/fec/ber_bf.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,49 @@ namespace gr {
*
* \details
*
* What does this block do?
* This block measures the bit error rate between two streams of
* packed data. It compares the bits of each streams and counts
* the number of incorrect bits between them. It outputs the log
* of the bit error rate, so a value of -X is 10^{-X} bit errors.
*
* When the \p mode is set to false (default), it is in streaming
* mode. This means that the output is constantly producing the
* current value of the BER. In this mode, there is a single
* output BER calculation per chunk of bytes passed to it, so
* there is no exact timing between calculations of BER. In this
* mode, the other two parameters to the constructor are ignored.
*
* When \p mode is true, the block is in test mode. This mode is
* used in the ber_curve_gen example and for other offline
* analysis of BER curves. Here, the block waits until at least \p
* berminerrors are observed and then produces a BER
* calculation. The parameter \p ber_limit helps make sure that
* the simulation is controlled. If the BER calculation drops
* bellow the \p ber_limit setting, the block will exit and simply
* return the set limit; the real BER is therefore some amount
* lower than this.
*
* Note that this block takes in data as packed bytes with 8-bits
* per byte used. It outputs a stream of floats as the log-scale BER.
*/
class FEC_API ber_bf : virtual public block
{
public:
// gr::fec::ber_bf::sptr
typedef boost::shared_ptr<ber_bf> sptr;

/*!
* Calculate the BER between two streams of data.
*
* \param test_mode false for normal streaming mode (default);
* true for test mode.
* \param berminerrors the block needs to observe this many
* errors before outputting a result. Only valid when
* test_mode=true.
* \param ber_limit if the BER calculation falls below this
* limit, produce this value and exit. Only valid when
* test_mode=true.
*/
static sptr make(bool test_mode = false, int berminerrors=100, float ber_limit=-7.0);
};

Expand Down
1 change: 0 additions & 1 deletion gr-fec/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ list(APPEND gnuradio_fec_sources
repetition_encoder_impl.cc
decode_ccsds_27_fb_impl.cc
encode_ccsds_27_bb_impl.cc
ber_tools.cc
ber_bf_impl.cc
conv_bit_corr_bb_impl.cc
puncture_bb_impl.cc
Expand Down
16 changes: 4 additions & 12 deletions gr-fec/lib/ber_bf_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#endif

#include "ber_bf_impl.h"
#include "ber_tools.h"
#include <gnuradio/io_signature.h>
#include <volk/volk.h>
#include <math.h>
Expand Down Expand Up @@ -79,18 +78,11 @@ namespace gr {
int items = ninput_items[0] <= ninput_items[1] ? ninput_items[0] : ninput_items[1];

if(items > 0) {
/*
for(int i = 0; i < items; ++i) {
if(inbuffer0[i] != inbuffer1[i]) {
GR_LOG_INFO(d_logger, boost::format("%1%/%2%: %3% versus %4%") \
% i % items % inbuffer0[i] % inbuffer1[i]);
}
uint32_t ret;
for(int i = 0; i < items; i++) {
volk_32u_popcnt(&ret, static_cast<uint32_t>(inbuffer0[i]^inbuffer1[i]));
d_total_errors += ret;
}
GR_LOG_INFO(d_logger, boost::format("%1% errors") \
% (compber(inbuffer0, inbuffer1, items)));
*/

d_total_errors += compber(inbuffer0, inbuffer1, items);
d_total += items;
}
consume_each(items);
Expand Down
117 changes: 0 additions & 117 deletions gr-fec/lib/ber_tools.cc

This file was deleted.

0 comments on commit 797b592

Please sign in to comment.