diff options
97 files changed, 681 insertions, 918 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 059575563..bcd43b6e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -357,7 +357,6 @@ include(GrBoost) # Enable python component ######################################################################## include(GrPython) -find_package(PythonLibs ${GR_PYTHON_MIN_VERSION}) GR_PYTHON_CHECK_MODULE("six - python 2 and 3 compatibility library" six "True" SIX_FOUND) find_package(SWIG) diff --git a/cmake/Modules/FindCodec2.cmake b/cmake/Modules/FindCodec2.cmake index 0c94ad0a0..f33de4dcd 100644 --- a/cmake/Modules/FindCodec2.cmake +++ b/cmake/Modules/FindCodec2.cmake @@ -61,6 +61,18 @@ if(LIBCODEC2_INCLUDE_DIR AND LIBCODEC2_LIBRARIES) else() set(LIBCODEC2_HAS_FREEDV_API false) endif() + + # we need to discover if codec2 < 0.9 + # moreover, codec2 < 0.8 doesn't provide codec2/version.h + if(EXISTS "${LIBCODEC2_INCLUDE_DIRS}/version.h") + file(READ "${LIBCODEC2_INCLUDE_DIRS}/version.h" _CODEC2_VERSION_H_CONTENTS) + string(REGEX MATCH "CODEC2_VERSION_MAJOR ([0-9]+)(.*)CODEC2_VERSION_MINOR ([0-9]+)" _CODEC2_TMP_MATCH " ${_CODEC2_VERSION_H_CONTENTS}") + if((CMAKE_MATCH_1 EQUAL 0) AND (CMAKE_MATCH_3 LESS 9)) + add_definitions(-DCODEC2_LEGACY) + endif() + else() + add_definitions(-DCODEC2_LEGACY) + endif() endif(LIBCODEC2_INCLUDE_DIR AND LIBCODEC2_LIBRARIES) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBCODEC2 DEFAULT_MSG LIBCODEC2_LIBRARIES LIBCODEC2_INCLUDE_DIRS) diff --git a/cmake/Modules/FindLOG4CPP.cmake b/cmake/Modules/FindLOG4CPP.cmake index 16073fdc7..3c1f2bdc5 100644 --- a/cmake/Modules/FindLOG4CPP.cmake +++ b/cmake/Modules/FindLOG4CPP.cmake @@ -12,15 +12,15 @@ if (LOG4CPP_INCLUDE_DIR) endif () find_path(LOG4CPP_INCLUDE_DIR log4cpp/Category.hh - /opt/local/include - /usr/local/include /usr/include + /usr/local/include + /opt/local/include ) set(LOG4CPP_NAMES log4cpp) find_library(LOG4CPP_LIBRARY NAMES ${LOG4CPP_NAMES} - PATHS /usr/lib /usr/local/lib /opt/local/lib + PATHS /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64 /opt/local/lib /opt/local/lib64 ) diff --git a/gnuradio-runtime/include/gnuradio/basic_block.h b/gnuradio-runtime/include/gnuradio/basic_block.h index de1cbe41f..1d31e2e9b 100644 --- a/gnuradio-runtime/include/gnuradio/basic_block.h +++ b/gnuradio-runtime/include/gnuradio/basic_block.h @@ -38,9 +38,7 @@ #include <map> #include <string> -#ifdef GR_CTRLPORT #include <gnuradio/rpcregisterhelpers.h> -#endif namespace gr { diff --git a/gnuradio-runtime/include/gnuradio/block_gateway.h b/gnuradio-runtime/include/gnuradio/block_gateway.h index 57041eb56..7756841a3 100644 --- a/gnuradio-runtime/include/gnuradio/block_gateway.h +++ b/gnuradio-runtime/include/gnuradio/block_gateway.h @@ -150,6 +150,18 @@ public: return gr::block::set_min_output_buffer(size); } + long block__max_output_buffer(size_t i) { + return gr::block::max_output_buffer(i); + } + + void block__set_max_output_buffer(long max_output_buffer) { + gr::block::set_max_output_buffer(max_output_buffer); + } + + void block__set_max_output_buffer(int port, long max_output_buffer) { + gr::block::set_max_output_buffer(port, max_output_buffer); + } + int block__output_multiple(void) const { return gr::block::output_multiple(); } void block__consume(int which_input, int how_many_items) diff --git a/gnuradio-runtime/include/gnuradio/block_registry.h b/gnuradio-runtime/include/gnuradio/block_registry.h index 2f12a01bb..5050df8ce 100644 --- a/gnuradio-runtime/include/gnuradio/block_registry.h +++ b/gnuradio-runtime/include/gnuradio/block_registry.h @@ -25,6 +25,7 @@ #include <gnuradio/api.h> #include <gnuradio/basic_block.h> +#include <gnuradio/thread/thread.h> #include <map> namespace gr { diff --git a/gnuradio-runtime/include/gnuradio/messages/msg_accepter_msgq.h b/gnuradio-runtime/include/gnuradio/messages/msg_accepter_msgq.h index 605196387..345933179 100644 --- a/gnuradio-runtime/include/gnuradio/messages/msg_accepter_msgq.h +++ b/gnuradio-runtime/include/gnuradio/messages/msg_accepter_msgq.h @@ -33,7 +33,7 @@ namespace messages { * \brief Concrete class that accepts messages and inserts them * into a message queue. */ -class GR_RUNTIME_API msg_accepter_msgq : public msg_accepter +class GR_RUNTIME_API msg_accepter_msgq { protected: msg_queue_sptr d_msg_queue; diff --git a/gnuradio-runtime/include/gnuradio/random.h b/gnuradio-runtime/include/gnuradio/random.h index 95931baf7..82c902678 100644 --- a/gnuradio-runtime/include/gnuradio/random.h +++ b/gnuradio-runtime/include/gnuradio/random.h @@ -96,7 +96,9 @@ public: float rayleigh(); /*! - * \brief FIXME: add description + * \brief Exponentially distributed random numbers with values less than or equal + * to factor replaced with zero. The underlying exponential distribution has + * mean sqrt(2) and variance 2. */ float impulse(float factor); diff --git a/gnuradio-runtime/include/gnuradio/rpcserver_aggregator.h b/gnuradio-runtime/include/gnuradio/rpcserver_aggregator.h index 85be9662e..70f8e1773 100644 --- a/gnuradio-runtime/include/gnuradio/rpcserver_aggregator.h +++ b/gnuradio-runtime/include/gnuradio/rpcserver_aggregator.h @@ -60,8 +60,8 @@ private: } void operator()(T& x) { x->i()->registerConfigureCallback(id, callback); } - const std::string& id; - const Tcallback& callback; + const std::string id; + const Tcallback callback; }; template <class T, typename Tcallback> @@ -69,7 +69,7 @@ private: unregisterConfigureCallback_f(const std::string& _id) : id(_id) { ; } void operator()(T& x) { x->i()->unregisterConfigureCallback(id); } - const std::string& id; + const std::string id; }; template <class T, typename Tcallback> @@ -81,8 +81,8 @@ private: } void operator()(T& x) { x->i()->registerQueryCallback(id, callback); } - const std::string& id; - const Tcallback& callback; + const std::string id; + const Tcallback callback; }; template <class T, typename Tcallback> @@ -90,7 +90,7 @@ private: unregisterQueryCallback_f(const std::string& _id) : id(_id) { ; } void operator()(T& x) { x->i()->unregisterQueryCallback(id); } - const std::string& id; + const std::string id; }; @@ -103,8 +103,8 @@ private: } void operator()(T& x) { x->i()->registerHandlerCallback(id, callback); } - const std::string& id; - const Tcallback& callback; + const std::string id; + const Tcallback callback; }; template <class T, typename Tcallback> @@ -112,7 +112,7 @@ private: unregisterHandlerCallback_f(const std::string& _id) : id(_id) { ; } void operator()(T& x) { x->i()->unregisterHandlerCallback(id); } - const std::string& id; + const std::string id; }; diff --git a/gnuradio-runtime/lib/CMakeLists.txt b/gnuradio-runtime/lib/CMakeLists.txt index 5aa90a5e1..b9253414f 100644 --- a/gnuradio-runtime/lib/CMakeLists.txt +++ b/gnuradio-runtime/lib/CMakeLists.txt @@ -59,7 +59,6 @@ add_library(gnuradio-runtime block_gateway_impl.cc block_registry.cc buffer.cc - circular_file.cc feval.cc flat_flowgraph.cc flowgraph.cc @@ -298,7 +297,6 @@ if(ENABLE_TESTING) list(APPEND test_gnuradio_runtime_sources qa_buffer.cc qa_io_signature.cc - qa_circular_file.cc qa_logger.cc qa_vmcircbuf.cc ) diff --git a/gnuradio-runtime/lib/block_executor.cc b/gnuradio-runtime/lib/block_executor.cc index 97e163b68..eafef6bcd 100644 --- a/gnuradio-runtime/lib/block_executor.cc +++ b/gnuradio-runtime/lib/block_executor.cc @@ -143,7 +143,7 @@ static bool propagate_tags(block::tag_propagation_policy_t policy, } else if (use_fp_rrate) { for (t = rtags.begin(); t != rtags.end(); t++) { tag_t new_tag = *t; - new_tag.offset = ((double)new_tag.offset * rrate) + 0.5; + new_tag.offset = std::llround((double)new_tag.offset * rrate); for (int o = 0; o < d->noutputs(); o++) out_buf[o]->add_item_tag(new_tag); } @@ -191,7 +191,7 @@ static bool propagate_tags(block::tag_propagation_policy_t policy, } else if (use_fp_rrate) { for (t = rtags.begin(); t != rtags.end(); t++) { tag_t new_tag = *t; - new_tag.offset = ((double)new_tag.offset * rrate) + 0.5; + new_tag.offset = std::llround((double)new_tag.offset * rrate); out_buf->add_item_tag(new_tag); } } else { diff --git a/gnuradio-runtime/lib/circular_file.cc b/gnuradio-runtime/lib/circular_file.cc deleted file mode 100644 index dcfccf9af..000000000 --- a/gnuradio-runtime/lib/circular_file.cc +++ /dev/null @@ -1,200 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2010,2013 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 "circular_file.h" - -#include <unistd.h> -#ifdef HAVE_SYS_MMAN_H -#include <sys/mman.h> -#endif - -#include <assert.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <unistd.h> - -#include <stdio.h> -#include <string.h> -#include <algorithm> - -#ifdef HAVE_IO_H -#include <io.h> -#endif - -namespace gr { - -static const int HEADER_SIZE = 4096; -static const int HEADER_MAGIC = 0xEB021026; - -static const int HD_MAGIC = 0; -static const int HD_HEADER_SIZE = 1; // integer offsets into header -static const int HD_BUFFER_SIZE = 2; -static const int HD_BUFFER_BASE = 3; -static const int HD_BUFFER_CURRENT = 4; - -circular_file::circular_file(const char* filename, bool writable, int size) - : d_fd(-1), d_header(0), d_buffer(0), d_mapped_size(0), d_bytes_read(0) -{ - int mm_prot; - if (writable) { -#ifdef HAVE_MMAP - mm_prot = PROT_READ | PROT_WRITE; -#endif - d_fd = open(filename, O_CREAT | O_RDWR | O_TRUNC, 0664); - if (d_fd < 0) { - perror(filename); - exit(1); - } -#ifdef HAVE_MMAP /* FIXME */ - if (ftruncate(d_fd, size + HEADER_SIZE) != 0) { - perror(filename); - exit(1); - } -#endif - } else { -#ifdef HAVE_MMAP - mm_prot = PROT_READ; -#endif - d_fd = open(filename, O_RDONLY); - if (d_fd < 0) { - perror(filename); - exit(1); - } - } - - struct stat statbuf; - if (fstat(d_fd, &statbuf) < 0) { - perror(filename); - exit(1); - } - - if (statbuf.st_size < HEADER_SIZE) { - fprintf(stderr, "%s: file too small to be circular buffer\n", filename); - exit(1); - } - - d_mapped_size = statbuf.st_size; -#ifdef HAVE_MMAP - void* p = mmap(0, d_mapped_size, mm_prot, MAP_SHARED, d_fd, 0); - if (p == MAP_FAILED) { - perror("gr::circular_file: mmap failed"); - exit(1); - } - - d_header = (int*)p; -#else - perror("gr::circular_file: mmap unsupported by this system"); - exit(1); -#endif - - if (writable) { // init header - - if (size < 0) { - fprintf(stderr, "gr::circular_buffer: size must be > 0 when writable\n"); - exit(1); - } - - d_header[HD_MAGIC] = HEADER_MAGIC; - d_header[HD_HEADER_SIZE] = HEADER_SIZE; - d_header[HD_BUFFER_SIZE] = size; - d_header[HD_BUFFER_BASE] = HEADER_SIZE; // right after header - d_header[HD_BUFFER_CURRENT] = 0; - } - - // sanity check (the asserts are a bit unforgiving...) - - assert(d_header[HD_MAGIC] == HEADER_MAGIC); - assert(d_header[HD_HEADER_SIZE] == HEADER_SIZE); - assert(d_header[HD_BUFFER_SIZE] > 0); - assert(d_header[HD_BUFFER_BASE] >= d_header[HD_HEADER_SIZE]); - assert(d_header[HD_BUFFER_BASE] + d_header[HD_BUFFER_SIZE] <= d_mapped_size); - assert(d_header[HD_BUFFER_CURRENT] >= 0 && - d_header[HD_BUFFER_CURRENT] < d_header[HD_BUFFER_SIZE]); - - d_bytes_read = 0; - d_buffer = (unsigned char*)d_header + d_header[HD_BUFFER_BASE]; -} - -circular_file::~circular_file() -{ -#ifdef HAVE_MMAP - if (munmap((char*)d_header, d_mapped_size) < 0) { - perror("gr::circular_file: munmap"); - exit(1); - } -#endif - close(d_fd); -} - -bool circular_file::write(void* vdata, int nbytes) -{ - unsigned char* data = (unsigned char*)vdata; - int buffer_size = d_header[HD_BUFFER_SIZE]; - int buffer_current = d_header[HD_BUFFER_CURRENT]; - - while (nbytes > 0) { - int n = std::min(nbytes, buffer_size - buffer_current); - memcpy(d_buffer + buffer_current, data, n); - - buffer_current += n; - if (buffer_current >= buffer_size) - buffer_current = 0; - - data += n; - nbytes -= n; - } - - d_header[HD_BUFFER_CURRENT] = buffer_current; - return true; -} - -int circular_file::read(void* vdata, int nbytes) -{ - unsigned char* data = (unsigned char*)vdata; - int buffer_current = d_header[HD_BUFFER_CURRENT]; - int buffer_size = d_header[HD_BUFFER_SIZE]; - int total = 0; - - nbytes = std::min(nbytes, buffer_size - d_bytes_read); - - while (nbytes > 0) { - int offset = (buffer_current + d_bytes_read) % buffer_size; - int n = std::min(nbytes, buffer_size - offset); - memcpy(data, d_buffer + offset, n); - data += n; - d_bytes_read += n; - total += n; - nbytes -= n; - } - return total; -} - -void circular_file::reset_read_pointer() { d_bytes_read = 0; } - -} /* namespace gr */ diff --git a/gnuradio-runtime/lib/circular_file.h b/gnuradio-runtime/lib/circular_file.h deleted file mode 100644 index 69cb82c81..000000000 --- a/gnuradio-runtime/lib/circular_file.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2013 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 GR_CIRCULAR_FILE_H -#define GR_CIRCULAR_FILE_H - -#include <gnuradio/api.h> - -namespace gr { - -/* - * writes input data into a circular buffer on disk. - * - * the file contains a fixed header: - * 0x0000: int32 magic (0xEB021026) - * 0x0004: int32 size in bytes of header (constant 4096) - * 0x0008: int32 size in bytes of circular buffer (not including header) - * 0x000C: int32 file offset to beginning of circular buffer - * 0x0010: int32 byte offset from beginning of circular buffer to - * current start of data - */ -class GR_RUNTIME_API circular_file -{ -private: - int d_fd; - int* d_header; - unsigned char* d_buffer; - int d_mapped_size; - int d_bytes_read; - -public: - circular_file(const char* filename, bool writable = false, int size = 0); - ~circular_file(); - - bool write(void* data, int nbytes); - - // returns # of bytes actually read or 0 if end of buffer, or -1 on error. - int read(void* data, int nbytes); - - // reset read pointer to beginning of buffer. - void reset_read_pointer(); -}; - -} /* namespace gr */ - -#endif /* GR_CIRCULAR_FILE_H */ diff --git a/gnuradio-runtime/lib/hier_block2_detail.cc b/gnuradio-runtime/lib/hier_block2_detail.cc index 0e06c07e3..feaf17f27 100644 --- a/gnuradio-runtime/lib/hier_block2_detail.cc +++ b/gnuradio-runtime/lib/hier_block2_detail.cc @@ -560,7 +560,7 @@ void hier_block2_detail::flatten_aux(flat_flowgraph_sptr sfg) const edge_vector_t edges = d_fg->edges(); msg_edge_vector_t msg_edges = d_fg->msg_edges(); edge_viter_t p; - msg_edge_viter_t q, u; + msg_edge_viter_t q; // Only run setup_rpc if ControlPort config param is enabled. bool ctrlport_on = prefs::singleton()->get_bool("ControlPort", "on", false); diff --git a/gnuradio-runtime/lib/local_sighandler.cc b/gnuradio-runtime/lib/local_sighandler.cc index 97491b24d..7f96b2460 100644 --- a/gnuradio-runtime/lib/local_sighandler.cc +++ b/gnuradio-runtime/lib/local_sighandler.cc @@ -28,6 +28,7 @@ #include <stdio.h> #include <string.h> #include <stdexcept> +#include <boost/format.hpp> namespace gr { @@ -49,7 +50,7 @@ local_sighandler::local_sighandler(int signum, void (*new_handler)(int)) #endif } -local_sighandler::~local_sighandler() +local_sighandler::~local_sighandler() noexcept(false) { #ifdef HAVE_SIGACTION if (sigaction(d_signum, &d_old_action, 0) < 0) { @@ -70,7 +71,7 @@ void local_sighandler::throw_signal(int signum) { throw signal(signum); } std::string signal::name() const { - char tmp[128]; + std::string tmp; switch (signum()) { #ifdef SIGHUP @@ -167,18 +168,14 @@ std::string signal::name() const SIGNAME(SIGSYS); #endif default: -#if defined(HAVE_SNPRINTF) #if defined(SIGRTMIN) && defined(SIGRTMAX) if (signum() >= SIGRTMIN && signum() <= SIGRTMAX) { - snprintf(tmp, sizeof(tmp), "SIGRTMIN + %d", signum()); + tmp = str(boost::format("SIGRTMIN + %d") % signum()); return tmp; } #endif - snprintf(tmp, sizeof(tmp), "SIGNAL %d", signum()); + tmp = str(boost::format("SIGNAL %d") % signum()); return tmp; -#else - return "Unknown signal"; -#endif } } diff --git a/gnuradio-runtime/lib/local_sighandler.h b/gnuradio-runtime/lib/local_sighandler.h index 688d43c28..4d9558f1b 100644 --- a/gnuradio-runtime/lib/local_sighandler.h +++ b/gnuradio-runtime/lib/local_sighandler.h @@ -49,7 +49,7 @@ private: public: local_sighandler(int signum, void (*new_handler)(int)); - ~local_sighandler(); + ~local_sighandler() noexcept(false); /* throw gr_signal (signum) */ static void throw_signal(int signum); diff --git a/gnuradio-runtime/lib/qa_circular_file.cc b/gnuradio-runtime/lib/qa_circular_file.cc deleted file mode 100644 index 53c98e9f8..000000000 --- a/gnuradio-runtime/lib/qa_circular_file.cc +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,2013,2018 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 "circular_file.h" -#include <unistd.h> -#include <boost/test/unit_test.hpp> - -static const char* test_file = "qa_gr_circular_file.data"; -static const int BUFFER_SIZE = 8192; -static const int NWRITE = 8192 * 9 / 8; - -BOOST_AUTO_TEST_CASE(t1) -{ -#ifdef HAVE_MMAP - gr::circular_file* cf_writer; - gr::circular_file* cf_reader; - - // write the data... - cf_writer = new gr::circular_file(test_file, true, BUFFER_SIZE * sizeof(short)); - - short sd; - for (int i = 0; i < NWRITE; i++) { - sd = i; - cf_writer->write(&sd, sizeof(sd)); - } - - delete cf_writer; - - // now read it back... - cf_reader = new gr::circular_file(test_file); - for (int i = 0; i < BUFFER_SIZE; i++) { - int n = cf_reader->read(&sd, sizeof(sd)); - BOOST_CHECK_EQUAL((int)sizeof(sd), n); - BOOST_CHECK_EQUAL(NWRITE - BUFFER_SIZE + i, (int)sd); - } - - int n = cf_reader->read(&sd, sizeof(sd)); - BOOST_CHECK_EQUAL(0, n); - - delete cf_reader; - unlink(test_file); -#endif // HAVE_MMAP -} diff --git a/gnuradio-runtime/lib/vmcircbuf_mmap_shm_open.cc b/gnuradio-runtime/lib/vmcircbuf_mmap_shm_open.cc index 94f0a26f1..7d63dc08d 100644 --- a/gnuradio-runtime/lib/vmcircbuf_mmap_shm_open.cc +++ b/gnuradio-runtime/lib/vmcircbuf_mmap_shm_open.cc @@ -39,6 +39,7 @@ #include <gnuradio/sys_paths.h> #include <errno.h> #include <stdio.h> +#include <boost/format.hpp> namespace gr { @@ -58,7 +59,7 @@ vmcircbuf_mmap_shm_open::vmcircbuf_mmap_shm_open(int size) : gr::vmcircbuf(size) } int shm_fd = -1; - char seg_name[1024]; + std::string seg_name; static bool portable_format = true; // open a new named shared memory segment @@ -67,23 +68,17 @@ vmcircbuf_mmap_shm_open::vmcircbuf_mmap_shm_open(int size) : gr::vmcircbuf(size) // This is the POSIX recommended "portable format". // Of course the "portable format" doesn't work on some systems... - - snprintf( - seg_name, sizeof(seg_name), "/gnuradio-%d-%d", getpid(), s_seg_counter); + seg_name = str(boost::format("/gnuradio-%d-%d") % getpid() % s_seg_counter); } else { // Where the "portable format" doesn't work, we try building // a full filesystem pathname pointing into a suitable temporary directory. - snprintf(seg_name, - sizeof(seg_name), - "%s/gnuradio-%d-%d", - gr::tmp_path(), - getpid(), - s_seg_counter); + seg_name = str(boost::format("%s/gnuradio-%d-%d") % + gr::tmp_path() % getpid() % s_seg_counter); } - shm_fd = shm_open(seg_name, O_RDWR | O_CREAT | O_EXCL, 0600); + shm_fd = shm_open(seg_name.c_str(), O_RDWR | O_CREAT | O_EXCL, 0600); if (shm_fd == -1 && errno == EACCES && portable_format) { portable_format = false; continue; // try again using "non-portable format" @@ -96,10 +91,10 @@ vmcircbuf_mmap_shm_open::vmcircbuf_mmap_shm_open(int size) : gr::vmcircbuf(size) EEXIST) // Named segment already exists (shouldn't happen). Try again continue; - char msg[1024]; - snprintf( - msg, sizeof(msg), "gr::vmcircbuf_mmap_shm_open: shm_open [%s]", seg_name); - perror(msg); + static std::string msg = + str(boost::format("gr::vmcircbuf_mmap_shm_open: shm_open [%s]") % + seg_name); + perror(msg.c_str()); throw std::runtime_error("gr::vmcircbuf_mmap_shm_open"); } break; @@ -156,7 +151,7 @@ vmcircbuf_mmap_shm_open::vmcircbuf_mmap_shm_open(int size) : gr::vmcircbuf(size) close(shm_fd); // fd no longer needed. The mapping is retained. - if (shm_unlink(seg_name) == -1) { // unlink the seg_name. + if (shm_unlink(seg_name.c_str()) == -1) { // unlink the seg_name. perror("gr::vmcircbuf_mmap_shm_open: shm_unlink"); throw std::runtime_error("gr::vmcircbuf_mmap_shm_open"); } diff --git a/gnuradio-runtime/lib/vmcircbuf_mmap_tmpfile.cc b/gnuradio-runtime/lib/vmcircbuf_mmap_tmpfile.cc index ec5f320ab..f6c177701 100644 --- a/gnuradio-runtime/lib/vmcircbuf_mmap_tmpfile.cc +++ b/gnuradio-runtime/lib/vmcircbuf_mmap_tmpfile.cc @@ -41,6 +41,7 @@ #include <fcntl.h> #include <stdio.h> #include <string.h> +#include <boost/format.hpp> namespace gr { @@ -58,34 +59,33 @@ vmcircbuf_mmap_tmpfile::vmcircbuf_mmap_tmpfile(int size) : gr::vmcircbuf(size) } int seg_fd = -1; - char seg_name[1024]; + std::string seg_name; static int s_seg_counter = 0; // open a temporary file that we'll map in a bit later while (1) { - snprintf(seg_name, - sizeof(seg_name), - "%s/gnuradio-%d-%d-XXXXXX", - gr::tmp_path(), - getpid(), - s_seg_counter); + seg_name = str(boost::format( + "%s/gnuradio-%d-%d-XXXXXX") % + gr::tmp_path() % + getpid() % + s_seg_counter); s_seg_counter++; - seg_fd = open(seg_name, O_RDWR | O_CREAT | O_EXCL, 0600); + seg_fd = open(seg_name.c_str(), O_RDWR | O_CREAT | O_EXCL, 0600); if (seg_fd == -1) { if (errno == EEXIST) // File already exists (shouldn't happen). Try again continue; - char msg[1024]; - snprintf(msg, sizeof(msg), "gr::vmcircbuf_mmap_tmpfile: open [%s]", seg_name); - perror(msg); + static std::string msg = + str(boost::format("gr::vmcircbuf_mmap_tmpfile: open [%s]") % seg_name); + perror(msg.c_str()); throw std::runtime_error("gr::vmcircbuf_mmap_tmpfile"); } break; } - if (unlink(seg_name) == -1) { + if (unlink(seg_name.c_str()) == -1) { perror("gr::vmcircbuf_mmap_tmpfile: unlink"); throw std::runtime_error("gr::vmcircbuf_mmap_tmpfile"); } diff --git a/gr-analog/python/analog/fm_demod.py b/gr-analog/python/analog/fm_demod.py index 1344db831..c1a498ef8 100644 --- a/gr-analog/python/analog/fm_demod.py +++ b/gr-analog/python/analog/fm_demod.py @@ -110,5 +110,4 @@ class demod_200kf3e_cf(fm_demod_cf): fm_demod_cf.__init__(self, channel_rate, audio_decim, 75000, # Deviation 15000, # Audio passband - 16000, # Audio stopband - 20.0) # Audio gain + 16000) # Audio stopband diff --git a/gr-audio/lib/jack/jack_sink.cc b/gr-audio/lib/jack/jack_sink.cc index a244c9e9e..62f751cae 100644 --- a/gr-audio/lib/jack/jack_sink.cc +++ b/gr-audio/lib/jack/jack_sink.cc @@ -99,7 +99,6 @@ jack_sink::jack_sink(int sampling_rate, const std::string device_name, bool ok_t "audio_jack_sink", io_signature::make(0, 0, 0), io_signature::make(0, 0, 0)), d_sampling_rate(sampling_rate), d_device_name(device_name.empty() ? default_device_name() : device_name), - d_ok_to_block(ok_to_block), d_jack_client(0), d_portcount(0), d_jack_output_port(), diff --git a/gr-audio/lib/jack/jack_sink.h b/gr-audio/lib/jack/jack_sink.h index c41700010..6c2ad24ba 100644 --- a/gr-audio/lib/jack/jack_sink.h +++ b/gr-audio/lib/jack/jack_sink.h @@ -52,7 +52,6 @@ class jack_sink : public sink unsigned int d_sampling_rate; std::string d_device_name; - bool d_ok_to_block; jack_client_t* d_jack_client; static const int MAX_PORTS = 10; diff --git a/gr-audio/lib/jack/jack_source.cc b/gr-audio/lib/jack/jack_source.cc index 7b931f36c..f89c939b8 100644 --- a/gr-audio/lib/jack/jack_source.cc +++ b/gr-audio/lib/jack/jack_source.cc @@ -101,7 +101,6 @@ jack_source::jack_source(int sampling_rate, "audio_jack_source", io_signature::make(0, 0, 0), io_signature::make(0, 0, 0)), d_sampling_rate(sampling_rate), d_device_name(device_name.empty() ? default_device_name() : device_name), - d_ok_to_block(ok_to_block), d_jack_client(0), d_portcount(0), d_jack_input_port(), diff --git a/gr-audio/lib/jack/jack_source.h b/gr-audio/lib/jack/jack_source.h index 2fbc97479..e9a93a656 100644 --- a/gr-audio/lib/jack/jack_source.h +++ b/gr-audio/lib/jack/jack_source.h @@ -52,7 +52,6 @@ class jack_source : public source unsigned int d_sampling_rate; std::string d_device_name; - bool d_ok_to_block; jack_client_t* d_jack_client; static const int MAX_PORTS = 10; diff --git a/gr-blocks/grc/blocks_transcendental.block.yml b/gr-blocks/grc/blocks_transcendental.block.yml index d21f05261..f1b1851ee 100644 --- a/gr-blocks/grc/blocks_transcendental.block.yml +++ b/gr-blocks/grc/blocks_transcendental.block.yml @@ -6,7 +6,7 @@ parameters: - id: type label: Type dtype: enum - options: [complex_double, float] + options: [complex_float, float] option_labels: [Complex, Float] option_attributes: type: [complex, float] diff --git a/gr-digital/lib/fll_band_edge_cc_impl.cc b/gr-digital/lib/fll_band_edge_cc_impl.cc index 366893a88..d669ac621 100644 --- a/gr-digital/lib/fll_band_edge_cc_impl.cc +++ b/gr-digital/lib/fll_band_edge_cc_impl.cc @@ -226,7 +226,6 @@ int fll_band_edge_cc_impl::work(int noutput_items, float error; gr_complex nco_out; gr_complex out_upper, out_lower; - gr_complex out_uppersse, out_lowersse; for (i = 0; i < noutput_items; i++) { nco_out = gr_expj(d_phase); diff --git a/gr-dtv/lib/atsc/atsc_field_sync_mux_impl.cc b/gr-dtv/lib/atsc/atsc_field_sync_mux_impl.cc index e173d4ba9..b6aca68c9 100644 --- a/gr-dtv/lib/atsc/atsc_field_sync_mux_impl.cc +++ b/gr-dtv/lib/atsc/atsc_field_sync_mux_impl.cc @@ -29,8 +29,6 @@ namespace gr { namespace dtv { -static const int N_SAVED_SYMBOLS = 12; - atsc_field_sync_mux::sptr atsc_field_sync_mux::make() { return gnuradio::get_initial_sptr(new atsc_field_sync_mux_impl()); diff --git a/gr-dtv/lib/atsc/atsc_trellis_encoder_impl.cc b/gr-dtv/lib/atsc/atsc_trellis_encoder_impl.cc index 1152a1764..8d8048be9 100644 --- a/gr-dtv/lib/atsc/atsc_trellis_encoder_impl.cc +++ b/gr-dtv/lib/atsc/atsc_trellis_encoder_impl.cc @@ -34,9 +34,6 @@ static const int DIBITS_PER_BYTE = 4; #define SEGOF(x) ((x) / ((SEGMENT_SIZE + 1) * DIBITS_PER_BYTE)) #define SYMOF(x) (((x) % ((SEGMENT_SIZE + 1) * DIBITS_PER_BYTE)) - 4) -/* How many separate Trellis encoders / Viterbi decoders run in parallel */ -static const int NCODERS = 12; - #define ENCODER_SEG_BUMP 4 /* A Segment sync symbol is an 8VSB +5,-5,-5,+5 sequence that occurs at diff --git a/gr-dtv/lib/atsc/atsc_trellis_encoder_impl.h b/gr-dtv/lib/atsc/atsc_trellis_encoder_impl.h index 31de4416f..9b7160c47 100644 --- a/gr-dtv/lib/atsc/atsc_trellis_encoder_impl.h +++ b/gr-dtv/lib/atsc/atsc_trellis_encoder_impl.h @@ -33,6 +33,7 @@ class atsc_trellis_encoder_impl : public atsc_trellis_encoder private: bool debug; + /* How many separate Trellis encoders / Viterbi decoders run in parallel */ static const int NCODERS = 12; static const int SEGMENT_SIZE = ATSC_MPEG_RS_ENCODED_LENGTH; static const int INPUT_SIZE = (SEGMENT_SIZE * 12); diff --git a/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.cc b/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.cc index 2b8e71e02..d1cc0c0c4 100644 --- a/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.cc +++ b/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.cc @@ -376,53 +376,6 @@ void dvb_ldpc_bb_impl::forecast(int noutput_items, gr_vector_int& ninput_items_r ninput_items_required[0] = (noutput_items / frame_size) * nbch; } -#define LDPC_BF(TABLE_NAME, ROWS) \ - for (int row = 0; row < ROWS; row++) { /* count the entries in the table */ \ - max_lut_arraysize += TABLE_NAME[row][0]; \ - } \ - max_lut_arraysize *= 360; /* 360 bits per table entry */ \ - max_lut_arraysize /= pbits; /* spread over all parity bits */ \ - for (int i = 0; i < FRAME_SIZE_NORMAL; i++) { \ - ldpc_lut_index[i] = 1; \ - } \ - for (int row = 0; row < ROWS; row++) { \ - for (int n = 0; n < 360; n++) { \ - for (int col = 1; col <= TABLE_NAME[row][0]; col++) { \ - int current_pbit = (TABLE_NAME[row][col] + (n * q)) % pbits; \ - ldpc_lut_index[current_pbit]++; \ - if (ldpc_lut_index[current_pbit] > max_index) { \ - max_index = ldpc_lut_index[current_pbit]; \ - } \ - } \ - } \ - } \ - max_lut_arraysize += \ - 1 + \ - (max_index - max_lut_arraysize); /* 1 for the size at the start of the array */ \ - \ - /* Allocate a 2D Array with pbits * max_lut_arraysize \ - * while preserving two-subscript access \ - * see \ - * https://stackoverflow.com/questions/29375797/copy-2d-array-using-memcpy/29375830#29375830 \ - */ \ - ldpc_lut = new int*[pbits]; \ - ldpc_lut[0] = new int[pbits * max_lut_arraysize]; \ - ldpc_lut[0][0] = 1; \ - for (int i = 1; i < pbits; i++) { \ - ldpc_lut[i] = ldpc_lut[i - 1] + max_lut_arraysize; \ - ldpc_lut[i][0] = 1; \ - } \ - for (int row = 0; row < ROWS; row++) { \ - for (int n = 0; n < 360; n++) { \ - for (int col = 1; col <= TABLE_NAME[row][0]; col++) { \ - int current_pbit = (TABLE_NAME[row][col] + (n * q)) % pbits; \ - ldpc_lut[current_pbit][ldpc_lut[current_pbit][0]] = im; \ - ldpc_lut[current_pbit][0]++; \ - } \ - im++; \ - } \ - } - /* * fill the lookup table, for each paritybit it contains * {number of infobits, infobit1, infobit2, ... ] @@ -431,202 +384,196 @@ void dvb_ldpc_bb_impl::forecast(int noutput_items, gr_vector_int& ninput_items_r */ void dvb_ldpc_bb_impl::ldpc_lookup_generate(void) { - int im = 0; - int pbits = (frame_size_real + Xp) - nbch; // number of parity bits - int q = q_val; - int max_lut_arraysize = 0; - int max_index = 0; - if (frame_size_type == FECFRAME_NORMAL) { if (code_rate == C1_4) { - LDPC_BF(ldpc_tab_1_4N, 45); + ldpc_bf(ldpc_tab_1_4N); } if (code_rate == C1_3) { - LDPC_BF(ldpc_tab_1_3N, 60); + ldpc_bf(ldpc_tab_1_3N); } if (code_rate == C2_5) { - LDPC_BF(ldpc_tab_2_5N, 72); + ldpc_bf(ldpc_tab_2_5N); } if (code_rate == C1_2) { - LDPC_BF(ldpc_tab_1_2N, 90); + ldpc_bf(ldpc_tab_1_2N); } if (code_rate == C3_5) { - LDPC_BF(ldpc_tab_3_5N, 108); + ldpc_bf(ldpc_tab_3_5N); } if (code_rate == C2_3) { if (dvb_standard == STANDARD_DVBT2) { - LDPC_BF(ldpc_tab_2_3N_DVBT2, 120); + ldpc_bf(ldpc_tab_2_3N_DVBT2); } else { - LDPC_BF(ldpc_tab_2_3N_DVBS2, 120); + ldpc_bf(ldpc_tab_2_3N_DVBS2); } } if (code_rate == C3_4) { - LDPC_BF(ldpc_tab_3_4N, 135); + ldpc_bf(ldpc_tab_3_4N); } if (code_rate == C4_5) { - LDPC_BF(ldpc_tab_4_5N, 144); + ldpc_bf(ldpc_tab_4_5N); } if (code_rate == C5_6) { - LDPC_BF(ldpc_tab_5_6N, 150); + ldpc_bf(ldpc_tab_5_6N); } if (code_rate == C8_9) { - LDPC_BF(ldpc_tab_8_9N, 160); + ldpc_bf(ldpc_tab_8_9N); } if (code_rate == C9_10) { - LDPC_BF(ldpc_tab_9_10N, 162); + ldpc_bf(ldpc_tab_9_10N); } if (code_rate == C2_9_VLSNR) { - LDPC_BF(ldpc_tab_2_9N, 40); + ldpc_bf(ldpc_tab_2_9N); } if (code_rate == C13_45) { - LDPC_BF(ldpc_tab_13_45N, 52); + ldpc_bf(ldpc_tab_13_45N); } if (code_rate == C9_20) { - LDPC_BF(ldpc_tab_9_20N, 81); + ldpc_bf(ldpc_tab_9_20N); } if (code_rate == C90_180) { - LDPC_BF(ldpc_tab_90_180N, 90); + ldpc_bf(ldpc_tab_90_180N); } if (code_rate == C96_180) { - LDPC_BF(ldpc_tab_96_180N, 96); + ldpc_bf(ldpc_tab_96_180N); } if (code_rate == C11_20) { - LDPC_BF(ldpc_tab_11_20N, 99); + ldpc_bf(ldpc_tab_11_20N); } if (code_rate == C100_180) { - LDPC_BF(ldpc_tab_100_180N, 100); + ldpc_bf(ldpc_tab_100_180N); } if (code_rate == C104_180) { - LDPC_BF(ldpc_tab_104_180N, 104); + ldpc_bf(ldpc_tab_104_180N); } if (code_rate == C26_45) { - LDPC_BF(ldpc_tab_26_45N, 104); + ldpc_bf(ldpc_tab_26_45N); } if (code_rate == C18_30) { - LDPC_BF(ldpc_tab_18_30N, 108); + ldpc_bf(ldpc_tab_18_30N); } if (code_rate == C28_45) { - LDPC_BF(ldpc_tab_28_45N, 112); + ldpc_bf(ldpc_tab_28_45N); } if (code_rate == C23_36) { - LDPC_BF(ldpc_tab_23_36N, 115); + ldpc_bf(ldpc_tab_23_36N); } if (code_rate == C116_180) { - LDPC_BF(ldpc_tab_116_180N, 116); + ldpc_bf(ldpc_tab_116_180N); } if (code_rate == C20_30) { - LDPC_BF(ldpc_tab_20_30N, 120); + ldpc_bf(ldpc_tab_20_30N); } if (code_rate == C124_180) { - LDPC_BF(ldpc_tab_124_180N, 124); + ldpc_bf(ldpc_tab_124_180N); } if (code_rate == C25_36) { - LDPC_BF(ldpc_tab_25_36N, 125); + ldpc_bf(ldpc_tab_25_36N); } if (code_rate == C128_180) { - LDPC_BF(ldpc_tab_128_180N, 128); + ldpc_bf(ldpc_tab_128_180N); } if (code_rate == C13_18) { - LDPC_BF(ldpc_tab_13_18N, 130); + ldpc_bf(ldpc_tab_13_18N); } if (code_rate == C132_180) { - LDPC_BF(ldpc_tab_132_180N, 132); + ldpc_bf(ldpc_tab_132_180N); } if (code_rate == C22_30) { - LDPC_BF(ldpc_tab_22_30N, 132); + ldpc_bf(ldpc_tab_22_30N); } if (code_rate == C135_180) { - LDPC_BF(ldpc_tab_135_180N, 135); + ldpc_bf(ldpc_tab_135_180N); } if (code_rate == C140_180) { - LDPC_BF(ldpc_tab_140_180N, 140); + ldpc_bf(ldpc_tab_140_180N); } if (code_rate == C7_9) { - LDPC_BF(ldpc_tab_7_9N, 140); + ldpc_bf(ldpc_tab_7_9N); } if (code_rate == C154_180) { - LDPC_BF(ldpc_tab_154_180N, 154); + ldpc_bf(ldpc_tab_154_180N); } } else if (frame_size_type == FECFRAME_SHORT) { if (code_rate == C1_4) { - LDPC_BF(ldpc_tab_1_4S, 9); + ldpc_bf(ldpc_tab_1_4S); } if (code_rate == C1_3) { - LDPC_BF(ldpc_tab_1_3S, 15); + ldpc_bf(ldpc_tab_1_3S); } if (code_rate == C2_5) { - LDPC_BF(ldpc_tab_2_5S, 18); + ldpc_bf(ldpc_tab_2_5S); } if (code_rate == C1_2) { - LDPC_BF(ldpc_tab_1_2S, 20); + ldpc_bf(ldpc_tab_1_2S); } if (code_rate == C3_5) { if (dvb_standard == STANDARD_DVBT2) { - LDPC_BF(ldpc_tab_3_5S_DVBT2, 27); + ldpc_bf(ldpc_tab_3_5S_DVBT2); } else { - LDPC_BF(ldpc_tab_3_5S_DVBS2, 27); + ldpc_bf(ldpc_tab_3_5S_DVBS2); } } if (code_rate == C2_3) { - LDPC_BF(ldpc_tab_2_3S, 30); + ldpc_bf(ldpc_tab_2_3S); } if (code_rate == C3_4) { - LDPC_BF(ldpc_tab_3_4S, 33); + ldpc_bf(ldpc_tab_3_4S); } if (code_rate == C4_5) { - LDPC_BF(ldpc_tab_4_5S, 35); + ldpc_bf(ldpc_tab_4_5S); } if (code_rate == C5_6) { - LDPC_BF(ldpc_tab_5_6S, 37); + ldpc_bf(ldpc_tab_5_6S); } if (code_rate == C8_9) { - LDPC_BF(ldpc_tab_8_9S, 40); + ldpc_bf(ldpc_tab_8_9S); } if (code_rate == C11_45) { - LDPC_BF(ldpc_tab_11_45S, 11); + ldpc_bf(ldpc_tab_11_45S); } if (code_rate == C4_15) { - LDPC_BF(ldpc_tab_4_15S, 12); + ldpc_bf(ldpc_tab_4_15S); } if (code_rate == C14_45) { - LDPC_BF(ldpc_tab_14_45S, 14); + ldpc_bf(ldpc_tab_14_45S); } if (code_rate == C7_15) { - LDPC_BF(ldpc_tab_7_15S, 21); + ldpc_bf(ldpc_tab_7_15S); } if (code_rate == C8_15) { - LDPC_BF(ldpc_tab_8_15S, 24); + ldpc_bf(ldpc_tab_8_15S); } if (code_rate == C26_45) { - LDPC_BF(ldpc_tab_26_45S, 26); + ldpc_bf(ldpc_tab_26_45S); } if (code_rate == C32_45) { - LDPC_BF(ldpc_tab_32_45S, 32); + ldpc_bf(ldpc_tab_32_45S); } if (code_rate == C1_5_VLSNR_SF2) { - LDPC_BF(ldpc_tab_1_4S, 9); + ldpc_bf(ldpc_tab_1_4S); } if (code_rate == C11_45_VLSNR_SF2) { - LDPC_BF(ldpc_tab_11_45S, 11); + ldpc_bf(ldpc_tab_11_45S); } if (code_rate == C1_5_VLSNR) { - LDPC_BF(ldpc_tab_1_4S, 9); + ldpc_bf(ldpc_tab_1_4S); } if (code_rate == C4_15_VLSNR) { - LDPC_BF(ldpc_tab_4_15S, 12); + ldpc_bf(ldpc_tab_4_15S); } if (code_rate == C1_3_VLSNR) { - LDPC_BF(ldpc_tab_1_3S, 15); + ldpc_bf(ldpc_tab_1_3S); } } else { if (code_rate == C1_5_MEDIUM) { - LDPC_BF(ldpc_tab_1_5M, 18); + ldpc_bf(ldpc_tab_1_5M); } if (code_rate == C11_45_MEDIUM) { - LDPC_BF(ldpc_tab_11_45M, 22); + ldpc_bf(ldpc_tab_11_45M); } if (code_rate == C1_3_MEDIUM) { - LDPC_BF(ldpc_tab_1_3M, 30); + ldpc_bf(ldpc_tab_1_3M); } } } @@ -713,7 +660,7 @@ int dvb_ldpc_bb_impl::general_work(int noutput_items, return noutput_items; } -const int dvb_ldpc_bb_impl::ldpc_tab_1_4N[45][13] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_1_4N[45][13] = { { 12, 23606, 36098, @@ -941,7 +888,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_1_4N[45][13] = { { 3, 46685, 20622, 32806, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_1_3N[60][13] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_1_3N[60][13] = { { 12, 34903, 20927, @@ -1232,7 +1179,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_1_3N[60][13] = { { 3, 25353, 4122, 39751, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_2_5N[72][13] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_2_5N[72][13] = { { 12, 31413, 18834, 28884, 947, 23050, 14484, 14809, 4968, 455, 33659, 16666, 19008 }, { 12, 13172, @@ -1559,7 +1506,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_2_5N[72][13] = { { 3, 30672, 16927, 14800, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_1_2N[90][9] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_1_2N[90][9] = { { 8, 54, 9318, 14392, 27561, 26909, 10219, 2534, 8597 }, { 8, 55, 7263, 4635, 2530, 28130, 3033, 23830, 3651 }, { 8, 56, 24731, 23583, 26036, 17299, 5750, 792, 9169 }, @@ -1652,7 +1599,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_1_2N[90][9] = { { 3, 53, 19267, 20113, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_3_5N[108][13] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_3_5N[108][13] = { { 12, 22422, 10282, 11626, 19997, 11161, 2922, 3122, 99, 5625, 17064, 8270, 179 }, { 12, 25087, @@ -1955,7 +1902,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_3_5N[108][13] = { { 3, 71, 3434, 7769, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_2_3N_DVBT2[120][14] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_2_3N_DVBT2[120][14] = { { 13, 317, 2255, @@ -2234,7 +2181,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_2_3N_DVBT2[120][14] = { { 3, 13115, 17259, 17332, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_2_3N_DVBS2[120][14] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_2_3N_DVBS2[120][14] = { { 13, 0, 10491, 16043, 506, 12826, 8065, 8226, 2767, 240, 18673, 9279, 10579, 20928 }, { 13, 1, @@ -2487,7 +2434,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_2_3N_DVBS2[120][14] = { { 3, 59, 3589, 14630, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_3_4N[135][13] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_3_4N[135][13] = { { 12, 0, 6385, 7901, 14611, 13389, 11200, 3252, 5243, 2504, 2722, 821, 7374 }, { 12, 1, 11359, 2698, 357, 13824, 12772, 7244, 6752, 15310, 852, 2001, 11417 }, { 12, 2, 7862, 7977, 6321, 13612, 12197, 14449, 15137, 13860, 1708, 6399, 13444 }, @@ -2625,7 +2572,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_3_4N[135][13] = { { 3, 44, 2883, 14521, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_4_5N[144][12] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_4_5N[144][12] = { { 11, 0, 149, 11212, 5575, 6360, 12559, 8108, 8505, 408, 10026, 12828 }, { 11, 1, 5237, 490, 10677, 4998, 3869, 3734, 3092, 3509, 7703, 10305 }, { 11, 2, 8742, 5553, 2820, 7085, 12116, 10485, 564, 7795, 2972, 2157 }, @@ -2772,7 +2719,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_4_5N[144][12] = { { 3, 35, 7108, 5553, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_5_6N[150][14] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_5_6N[150][14] = { { 13, 0, 4362, 416, 8909, 4156, 3216, 3112, 2560, 2912, 6405, 8593, 4969, 6723 }, { 13, 1, 2479, 1786, 8978, 3011, 4339, 9313, 6397, 2957, 7288, 5484, 6031, 10217 }, { 13, 2, 10175, 9009, 9889, 3091, 4985, 7267, 4092, 8874, 5671, 2777, 2189, 8716 }, @@ -2925,7 +2872,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_5_6N[150][14] = { { 3, 29, 7347, 8027, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_8_9N[160][5] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_8_9N[160][5] = { { 4, 0, 6235, 2848, 3222 }, { 4, 1, 5800, 3492, 5348 }, { 4, 2, 2757, 927, 90 }, { 4, 3, 6961, 4516, 4739 }, { 4, 4, 1172, 3237, 6264 }, { 4, 5, 1927, 2425, 3683 }, { 4, 6, 3714, 6309, 2495 }, { 4, 7, 3070, 6342, 7154 }, { 4, 8, 2428, 613, 3761 }, @@ -2982,7 +2929,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_8_9N[160][5] = { { 3, 19, 1696, 1459, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_9_10N[162][5] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_9_10N[162][5] = { { 4, 0, 5611, 2563, 2900 }, { 4, 1, 5220, 3143, 4813 }, { 4, 2, 2481, 834, 81 }, { 4, 3, 6265, 4064, 4265 }, { 4, 4, 1055, 2914, 5638 }, { 4, 5, 1734, 2182, 3315 }, { 4, 6, 3342, 5678, 2246 }, { 4, 7, 2185, 552, 3385 }, { 4, 8, 2615, 236, 5334 }, @@ -3039,7 +2986,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_9_10N[162][5] = { { 3, 15, 5078, 2687, 0 }, { 3, 16, 316, 1755, 0 }, { 3, 17, 3392, 1991, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_2_9N[40][12] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_2_9N[40][12] = { { 11, 5332, 8018, 35444, 13098, 9655, 41945, 44273, 22741, 9371, 8727, 43219 }, { 11, 41410, 43593, 14611, 46707, 16041, 1459, 29246, 12748, 32996, 676, 46909 }, { 11, 9340, 35072, 35640, 17537, 10512, 44339, 30965, 25175, 9918, 21079, 29835 }, @@ -3082,7 +3029,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_2_9N[40][12] = { { 3, 41497, 32023, 28688, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_13_45N[52][13] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_13_45N[52][13] = { { 12, 15210, 4519, @@ -3353,7 +3300,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_13_45N[52][13] = { { 3, 30362, 35769, 42608, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_9_20N[81][13] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_9_20N[81][13] = { { 12, 30649, 35117, @@ -3701,7 +3648,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_9_20N[81][13] = { { 3, 30507, 33307, 30783, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_11_20N[99][14] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_11_20N[99][14] = { { 13, 20834, 22335, @@ -4154,7 +4101,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_11_20N[99][14] = { { 3, 3821, 18349, 13846, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_26_45N[104][14] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_26_45N[104][14] = { { 13, 12918, 15296, @@ -4651,7 +4598,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_26_45N[104][14] = { { 3, 5794, 1239, 9934, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_28_45N[112][12] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_28_45N[112][12] = { { 11, 24402, 4786, 12678, 6376, 23965, 10003, 15376, 15164, 21366, 24252, 3353 }, { 11, 8189, 3297, 18493, 17994, 16296, 11970, 16168, 15911, 20683, 11930, 3119 }, { 11, 22463, 11744, 13833, 8279, 21652, 14679, 23663, 4389, 15110, 17254, 17498 }, @@ -4766,7 +4713,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_28_45N[112][12] = { { 3, 1253, 12068, 18813, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_23_36N[115][12] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_23_36N[115][12] = { { 11, 2475, 3722, 16456, 6081, 4483, 19474, 20555, 10558, 4351, 4052, 20066 }, { 11, 1547, 5612, 22269, 11685, 23297, 19891, 18996, 21694, 7927, 19412, 15951 }, { 11, 288, 15139, 7767, 3059, 1455, 12056, 12721, 7938, 19334, 3233, 5711 }, @@ -4884,7 +4831,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_23_36N[115][12] = { { 3, 18539, 26, 21487, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_25_36N[125][12] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_25_36N[125][12] = { { 11, 11863, 9493, 4143, 12695, 8706, 170, 4967, 798, 9856, 6015, 5125 }, { 11, 12288, 19567, 18233, 15430, 1671, 3787, 10133, 15709, 7883, 14260, 17039 }, { 11, 2066, 12269, 14620, 7577, 11525, 19519, 6181, 3850, 8893, 272, 12473 }, @@ -5012,7 +4959,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_25_36N[125][12] = { { 3, 15963, 6733, 11048, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_13_18N[130][11] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_13_18N[130][11] = { { 10, 2510, 12817, 11890, 13009, 5343, 1775, 10496, 13302, 13348, 17880 }, { 10, 6766, 16330, 2412, 7944, 2483, 7602, 12482, 6942, 3070, 9231 }, { 10, 16410, 1766, 1240, 10046, 12091, 14475, 7003, 202, 7733, 11237 }, @@ -5145,7 +5092,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_13_18N[130][11] = { { 3, 8814, 7277, 2678, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_7_9N[140][13] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_7_9N[140][13] = { { 12, 13057, 12620, 2789, 3553, 6763, 8329, 3333, 7822, 10490, 13943, 4101, 2556 }, { 12, 658, 11386, 2242, 7249, 5935, 2148, 5291, 11992, 3222, 2957, 6454, 3343 }, { 12, 93, 1205, 12706, 11406, 9017, 7834, 5358, 13700, 14295, 4152, 6287, 4249 }, @@ -5288,7 +5235,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_7_9N[140][13] = { { 3, 7220, 1062, 6871, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_90_180N[90][19] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_90_180N[90][19] = { { 18, 708, 1132, @@ -5723,7 +5670,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_90_180N[90][19] = { { 6, 1597, 1691, 10499, 13815, 18943, 27396, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_96_180N[96][21] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_96_180N[96][21] = { { 20, 551, 1039, 1564, 1910, 3126, 4986, 5636, 5661, 7079, 9384, 9971, 10460, 11259, 14150, 14389, 14568, 14681, 21772, 27818, 28671 }, { 20, 384, 1734, 1993, 3890, 4594, 6655, 7483, 8508, 8573, 8720, @@ -5842,7 +5789,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_96_180N[96][21] = { { 3, 9046, 16513, 22243, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_100_180N[100][17] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_100_180N[100][17] = { { 16, 690, 1366, @@ -6265,7 +6212,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_100_180N[100][17] = { { 3, 6605, 12623, 26774, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_104_180N[104][19] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_104_180N[104][19] = { { 18, 2087, 6318, @@ -6750,7 +6697,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_104_180N[104][19] = { { 3, 4120, 19101, 23719, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_116_180N[116][19] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_116_180N[116][19] = { { 18, 3880, 4377, @@ -7319,7 +7266,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_116_180N[116][19] = { { 3, 710, 4696, 18127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_124_180N[124][17] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_124_180N[124][17] = { { 16, 1083, 2862, @@ -7846,7 +7793,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_124_180N[124][17] = { { 3, 7791, 7800, 7809, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_128_180N[128][16] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_128_180N[128][16] = { { 15, 790, 1010, @@ -8352,7 +8299,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_128_180N[128][16] = { { 3, 1476, 8123, 8946, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_132_180N[132][16] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_132_180N[132][16] = { { 15, 214, 632, @@ -8862,7 +8809,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_132_180N[132][16] = { { 3, 1174, 8836, 13549, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_135_180N[135][15] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_135_180N[135][15] = { { 14, 15, 865, @@ -9210,7 +9157,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_135_180N[135][15] = { { 3, 9407, 12341, 16040, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_140_180N[140][16] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_140_180N[140][16] = { { 15, 66, 862, @@ -9728,7 +9675,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_140_180N[140][16] = { { 3, 6409, 9498, 10387, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_154_180N[154][14] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_154_180N[154][14] = { { 13, 726, 794, 1587, 2475, 3114, 3917, 4471, 6207, 7451, 8203, 8218, 8583, 8941 }, { 13, 418, 480, 1320, 1357, 1481, 2323, 3677, 5112, 7038, 7198, 8066, 9260, 9282 }, { 13, 1506, 2585, 3336, 4543, 4828, 5571, 5954, 6047, 6081, 7691, 8090, 8824, 9153 }, @@ -9885,7 +9832,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_154_180N[154][14] = { { 3, 6523, 6531, 9063, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_18_30N[108][20] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_18_30N[108][20] = { { 19, 113, 1557, 3316, 5680, 6241, 10407, 13404, 13947, 14040, 14353, 15522, 15698, 16079, 17363, 19374, 19543, 20530, 22833, 24339 }, { 19, 271, 1361, 6236, 7006, 7307, 7333, 12768, 15441, 15568, @@ -10015,7 +9962,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_18_30N[108][20] = { { 3, 19202, 22406, 24609, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_20_30N[120][17] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_20_30N[120][17] = { { 16, 692, 1779, @@ -10506,7 +10453,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_20_30N[120][17] = { { 3, 9689, 15537, 19733, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_22_30N[132][16] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_22_30N[132][16] = { { 15, 696, 989, @@ -10986,7 +10933,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_22_30N[132][16] = { { 3, 11514, 16605, 17255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_1_4S[9][13] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_1_4S[9][13] = { { 12, 6295, 9626, 304, 7695, 4839, 4936, 1660, 144, 11203, 5567, 6347, 12557 }, { 12, 10691, 4988, 3859, 3734, 3071, 3494, 7687, 10313, 5964, 8069, 8296, 11090 }, { 12, 10774, 3613, 5208, 11177, 7676, 3549, 8746, 6583, 7239, 12265, 2674, 4292 }, @@ -10998,7 +10945,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_1_4S[9][13] = { { 3, 9840, 12726, 4977, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_1_3S[15][13] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_1_3S[15][13] = { { 12, 416, 8909, 4156, 3216, 3112, 2560, 2912, 6405, 8593, 4969, 6723, 6912 }, { 12, 8978, 3011, 4339, 9312, 6396, 2957, 7288, 5485, 6031, 10218, 2226, 3575 }, { 12, 3383, 10059, 1114, 10008, 10147, 9384, 4290, 434, 5139, 3536, 1965, 2291 }, @@ -11016,7 +10963,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_1_3S[15][13] = { { 3, 10127, 3334, 8267, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_2_5S[18][13] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_2_5S[18][13] = { { 12, 5650, 4143, 8750, 583, 6720, 8071, 635, 1767, 1344, 6922, 738, 6658 }, { 12, 5696, 1685, 3207, 415, 7019, 5023, 5608, 2605, 857, 6915, 1770, 8016 }, { 12, 3992, 771, 2190, 7258, 8970, 7792, 1802, 1866, 6137, 8841, 886, 1931 }, @@ -11037,7 +10984,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_2_5S[18][13] = { { 3, 1387, 8910, 2660, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_1_2S[20][9] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_1_2S[20][9] = { { 8, 20, 712, 2386, 6354, 4061, 1062, 5045, 5158 }, { 8, 21, 2543, 5748, 4822, 2348, 3089, 6328, 5876 }, { 8, 22, 926, 5701, 269, 3693, 2438, 3190, 3507 }, @@ -11060,7 +11007,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_1_2S[20][9] = { { 3, 14, 7411, 3450, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_3_5S_DVBT2[27][13] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_3_5S_DVBT2[27][13] = { { 12, 71, 1478, 1901, 2240, 2649, 2725, 3592, 3708, 3965, 4080, 5733, 6198 }, { 12, 393, 1384, 1435, 1878, 2773, 3182, 3586, 5465, 6091, 6110, 6114, 6327 }, { 12, 160, 1149, 1281, 1526, 1566, 2129, 2929, 3095, 3223, 4250, 4276, 4612 }, @@ -11090,7 +11037,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_3_5S_DVBT2[27][13] = { { 3, 1005, 1675, 2062, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_3_5S_DVBS2[27][13] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_3_5S_DVBS2[27][13] = { { 12, 2765, 5713, 6426, 3596, 1374, 4811, 2182, 544, 3394, 2840, 4310, 771 }, { 12, 4951, 211, 2208, 723, 1246, 2928, 398, 5739, 265, 5601, 5993, 2615 }, { 12, 210, 4730, 5777, 3096, 4282, 6238, 4939, 1119, 6463, 5298, 6320, 4016 }, @@ -11120,7 +11067,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_3_5S_DVBS2[27][13] = { { 3, 17, 4908, 4177, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_2_3S[30][14] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_2_3S[30][14] = { { 13, 0, 2084, 1613, 1548, 1286, 1460, 3196, 4297, 2481, 3369, 3451, 4620, 2622 }, { 13, 1, 122, 1516, 3448, 2880, 1407, 1847, 3799, 3529, 373, 971, 4358, 3108 }, { 13, 2, 259, 3399, 929, 2650, 864, 3996, 3833, 107, 5287, 164, 3125, 2350 }, @@ -11153,7 +11100,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_2_3S[30][14] = { { 3, 14, 1129, 3894, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_3_4S[33][13] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_3_4S[33][13] = { { 12, 3, 3198, 478, 4207, 1481, 1009, 2616, 1924, 3437, 554, 683, 1801 }, { 3, 4, 2681, 2135, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 3, 5, 3107, 4027, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, @@ -11189,7 +11136,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_3_4S[33][13] = { { 3, 11, 1415, 2808, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_4_5S[35][4] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_4_5S[35][4] = { { 3, 5, 896, 1565 }, { 3, 6, 2493, 184 }, { 3, 7, 212, 3210 }, { 3, 8, 727, 1339 }, { 3, 9, 3428, 612 }, { 3, 0, 2663, 1947 }, { 3, 1, 230, 2695 }, { 3, 2, 2025, 2794 }, { 3, 3, 3039, 283 }, @@ -11204,7 +11151,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_4_5S[35][4] = { { 3, 8, 566, 1427 }, { 3, 9, 3545, 1168 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_5_6S[37][14] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_5_6S[37][14] = { { 13, 3, 2409, 499, 1481, 908, 559, 716, 1270, 333, 2508, 2264, 1702, 2805 }, { 3, 4, 2447, 1926, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 3, 5, 414, 1224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, @@ -11244,7 +11191,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_5_6S[37][14] = { { 3, 7, 2644, 1704, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_8_9S[40][5] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_8_9S[40][5] = { { 4, 0, 1558, 712, 805 }, { 4, 1, 1450, 873, 1337 }, { 4, 2, 1741, 1129, 1184 }, { 4, 3, 294, 806, 1566 }, { 4, 4, 482, 605, 923 }, { 3, 0, 926, 1578, 0 }, { 3, 1, 777, 1374, 0 }, { 3, 2, 608, 151, 0 }, { 3, 3, 1195, 210, 0 }, @@ -11261,7 +11208,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_8_9S[40][5] = { { 3, 4, 1104, 1172, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_11_45S[11][11] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_11_45S[11][11] = { { 10, 9054, 9186, 12155, 1000, 7383, 6459, 2992, 4723, 8135, 11250 }, { 10, 2624, 9237, 7139, 12238, 11962, 4361, 5292, 10967, 11036, 8105 }, { 10, 2044, 11996, 5654, 7568, 7002, 3549, 4767, 8767, 2872, 8345 }, @@ -11275,7 +11222,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_11_45S[11][11] = { { 3, 1873, 5634, 6383, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_4_15S[12][22] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_4_15S[12][22] = { { 21, 1953, 2331, 2545, 2623, 4653, 5012, 5700, 6458, 6875, 7605, 7694, 7881, 8416, 8758, 9181, 9555, 9578, 9932, 10068, 11479, 11699 }, { 21, 514, 784, 2059, 2129, 2386, 2454, 3396, 5184, 6624, 6825, @@ -11293,7 +11240,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_4_15S[12][22] = { { 3, 3131, 9964, 10480, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_14_45S[14][13] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_14_45S[14][13] = { { 12, 1606, 3617, 7973, 6737, 9495, 4209, 9209, 4565, 4250, 7823, 9384, 400 }, { 12, 4105, 991, 923, 3562, 3892, 10993, 5640, 8196, 6652, 4653, 9116, 7677 }, { 12, 6348, 1341, 5445, 1494, 7799, 831, 4952, 5106, 3011, 9921, 6537, 8476 }, @@ -11310,7 +11257,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_14_45S[14][13] = { { 3, 3260, 7897, 3809, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_7_15S +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_7_15S [21][25] = { { 24, 3, 137, 314, 327, 983, 1597, 2028, 3043, 3217, 4109, 6020, 6178, 6535, 6560, 7146, 7180, 7408, 7790, 7893, 8123, 8313, 8526, 8616, 8638 }, @@ -11358,7 +11305,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_7_15S { 3, 976, 2001, 5005, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_8_15S[24][22] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_8_15S[24][22] = { { 21, 32, 384, 430, 591, 1296, 1976, 1999, 2137, 2175, 3638, 4214, 4304, 4486, 4662, 4999, 5174, 5700, 6969, 7115, 7138, 7189 }, { 21, 1788, 1881, 1910, 2724, 4504, 4928, 4973, 5616, 5686, 5718, @@ -11390,7 +11337,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_8_15S[24][22] = { { 3, 272, 1015, 7464, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_26_45S[26][14] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_26_45S[26][14] = { { 13, 6106, 5389, 698, 6749, 6294, 1653, 1984, 2167, 6139, 6095, 3832, 2468, 6115 }, { 13, 4202, 2362, 1852, 1264, 3564, 6345, 498, 6137, 3908, 3302, 527, 2767, 6667 }, { 12, 3422, 1242, 1377, 2238, 2899, 1974, 1957, 261, 3463, 4994, 215, 2338, 0 }, @@ -11419,7 +11366,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_26_45S[26][14] = { { 3, 959, 5337, 2735, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_32_45S[32][13] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_32_45S[32][13] = { { 12, 2686, 655, 2308, 1603, 336, 1743, 2778, 1263, 3555, 185, 4212, 621 }, { 12, 286, 2994, 2599, 2265, 126, 314, 3992, 4560, 2845, 2764, 2540, 1476 }, { 12, 2670, 3599, 2900, 2281, 3597, 2768, 4423, 2805, 836, 130, 1204, 4162 }, @@ -11454,7 +11401,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_32_45S[32][13] = { { 3, 1523, 3311, 389, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_1_5M[18][14] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_1_5M[18][14] = { { 13, 18222, 6715, @@ -11592,7 +11539,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_1_5M[18][14] = { { 3, 22623, 8408, 17849, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_11_45M[22][11] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_11_45M[22][11] = { { 10, 20617, 6867, 14845, 11974, 22563, 190, 17207, 4052, 7406, 16007 }, { 10, 21448, 14846, 2543, 23380, 16633, 20365, 16869, 13411, 19853, 795 }, { 10, 5200, 2330, 2775, 23620, 20643, 10745, 14742, 6493, 14222, 20939 }, @@ -11617,7 +11564,7 @@ const int dvb_ldpc_bb_impl::ldpc_tab_11_45M[22][11] = { { 3, 3944, 13063, 5656, 0, 0, 0, 0, 0, 0, 0 } }; -const int dvb_ldpc_bb_impl::ldpc_tab_1_3M[30][13] = { +const uint16_t dvb_ldpc_bb_impl::ldpc_tab_1_3M[30][13] = { { 12, 7416, 4093, 16722, 1023, 20586, 12219, 9175, 16284, 1554, 10113, 19849, 17545 }, { 12, 13140, 3257, 2110, 13888, 3023, 1537, 1598, 15018, 18931, 13905, 10617, 1014 }, { 12, 339, 14366, 3309, 15360, 18358, 3196, 4412, 6023, 7070, 17380, 2777, 6691 }, diff --git a/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.h b/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.h index 96d510421..dafbcdf76 100644 --- a/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.h +++ b/gr-dtv/lib/dvb/dvb_ldpc_bb_impl.h @@ -49,69 +49,127 @@ private: int ldpc_lut_index[FRAME_SIZE_NORMAL]; void ldpc_lookup_generate(void); - int** ldpc_lut; - - const static int ldpc_tab_1_4N[45][13]; - const static int ldpc_tab_1_3N[60][13]; - const static int ldpc_tab_2_5N[72][13]; - const static int ldpc_tab_1_2N[90][9]; - const static int ldpc_tab_3_5N[108][13]; - const static int ldpc_tab_2_3N_DVBT2[120][14]; - const static int ldpc_tab_2_3N_DVBS2[120][14]; - const static int ldpc_tab_3_4N[135][13]; - const static int ldpc_tab_4_5N[144][12]; - const static int ldpc_tab_5_6N[150][14]; - const static int ldpc_tab_8_9N[160][5]; - const static int ldpc_tab_9_10N[162][5]; - - const static int ldpc_tab_1_4S[9][13]; - const static int ldpc_tab_1_3S[15][13]; - const static int ldpc_tab_2_5S[18][13]; - const static int ldpc_tab_1_2S[20][9]; - const static int ldpc_tab_3_5S_DVBT2[27][13]; - const static int ldpc_tab_3_5S_DVBS2[27][13]; - const static int ldpc_tab_2_3S[30][14]; - const static int ldpc_tab_3_4S[33][13]; - const static int ldpc_tab_4_5S[35][4]; - const static int ldpc_tab_5_6S[37][14]; - const static int ldpc_tab_8_9S[40][5]; - - const static int ldpc_tab_2_9N[40][12]; - const static int ldpc_tab_13_45N[52][13]; - const static int ldpc_tab_9_20N[81][13]; - const static int ldpc_tab_11_20N[99][14]; - const static int ldpc_tab_26_45N[104][14]; - const static int ldpc_tab_28_45N[112][12]; - const static int ldpc_tab_23_36N[115][12]; - const static int ldpc_tab_25_36N[125][12]; - const static int ldpc_tab_13_18N[130][11]; - const static int ldpc_tab_7_9N[140][13]; - const static int ldpc_tab_90_180N[90][19]; - const static int ldpc_tab_96_180N[96][21]; - const static int ldpc_tab_100_180N[100][17]; - const static int ldpc_tab_104_180N[104][19]; - const static int ldpc_tab_116_180N[116][19]; - const static int ldpc_tab_124_180N[124][17]; - const static int ldpc_tab_128_180N[128][16]; - const static int ldpc_tab_132_180N[132][16]; - const static int ldpc_tab_135_180N[135][15]; - const static int ldpc_tab_140_180N[140][16]; - const static int ldpc_tab_154_180N[154][14]; - const static int ldpc_tab_18_30N[108][20]; - const static int ldpc_tab_20_30N[120][17]; - const static int ldpc_tab_22_30N[132][16]; - - const static int ldpc_tab_11_45S[11][11]; - const static int ldpc_tab_4_15S[12][22]; - const static int ldpc_tab_14_45S[14][13]; - const static int ldpc_tab_7_15S[21][25]; - const static int ldpc_tab_8_15S[24][22]; - const static int ldpc_tab_26_45S[26][14]; - const static int ldpc_tab_32_45S[32][13]; - - const static int ldpc_tab_1_5M[18][14]; - const static int ldpc_tab_11_45M[22][11]; - const static int ldpc_tab_1_3M[30][13]; + uint16_t** ldpc_lut; + + template <typename entry_t, size_t rows, size_t cols> + void ldpc_bf(entry_t (&table)[rows][cols]) + { + size_t max_lut_arraysize = 0; + const unsigned int pbits = (frame_size_real + Xp) - nbch; + const unsigned int q = q_val; + for (auto& row : table) { /* count the entries in the table */ + max_lut_arraysize += row[0]; + } + + max_lut_arraysize *= 360; /* 360 bits per table entry */ + max_lut_arraysize /= pbits; /* spread over all parity bits */ + + for (auto& ldpc_lut_index_entry : ldpc_lut_index) { + ldpc_lut_index_entry = 1; + } + + uint16_t max_index = 0; + for (unsigned int row = 0; row < rows; row++) { + for (unsigned int n = 0; n < 360; n++) { + for (unsigned int col = 1; col <= table[row][0]; col++) { + unsigned int current_pbit = (table[row][col] + (n * q)) % pbits; + ldpc_lut_index[current_pbit]++; + if (ldpc_lut_index[current_pbit] > max_index) { + max_index = ldpc_lut_index[current_pbit]; + } + } + } + } + max_lut_arraysize += + 1 + (max_index - + max_lut_arraysize); /* 1 for the size at the start of the array */ + + /* Allocate a 2D Array with pbits * max_lut_arraysize + * while preserving two-subscript access + * see + * https://stackoverflow.com/questions/29375797/copy-2d-array-using-memcpy/29375830#29375830 + */ + ldpc_lut = new uint16_t*[pbits]; + ldpc_lut[0] = new uint16_t[pbits * max_lut_arraysize]; + ldpc_lut[0][0] = 1; + for (unsigned int i = 1; i < pbits; i++) { + ldpc_lut[i] = ldpc_lut[i - 1] + max_lut_arraysize; + ldpc_lut[i][0] = 1; + } + uint16_t im = 0; + for (unsigned int row = 0; row < rows; row++) { + for (unsigned int n = 0; n < 360; n++) { + for (unsigned int col = 1; col <= table[row][0]; col++) { + unsigned int current_pbit = (table[row][col] + (n * q)) % pbits; + ldpc_lut[current_pbit][ldpc_lut[current_pbit][0]] = im; + ldpc_lut[current_pbit][0]++; + } + im++; + } + } + } + + const static uint16_t ldpc_tab_1_4N[45][13]; + const static uint16_t ldpc_tab_1_3N[60][13]; + const static uint16_t ldpc_tab_2_5N[72][13]; + const static uint16_t ldpc_tab_1_2N[90][9]; + const static uint16_t ldpc_tab_3_5N[108][13]; + const static uint16_t ldpc_tab_2_3N_DVBT2[120][14]; + const static uint16_t ldpc_tab_2_3N_DVBS2[120][14]; + const static uint16_t ldpc_tab_3_4N[135][13]; + const static uint16_t ldpc_tab_4_5N[144][12]; + const static uint16_t ldpc_tab_5_6N[150][14]; + const static uint16_t ldpc_tab_8_9N[160][5]; + const static uint16_t ldpc_tab_9_10N[162][5]; + + const static uint16_t ldpc_tab_1_4S[9][13]; + const static uint16_t ldpc_tab_1_3S[15][13]; + const static uint16_t ldpc_tab_2_5S[18][13]; + const static uint16_t ldpc_tab_1_2S[20][9]; + const static uint16_t ldpc_tab_3_5S_DVBT2[27][13]; + const static uint16_t ldpc_tab_3_5S_DVBS2[27][13]; + const static uint16_t ldpc_tab_2_3S[30][14]; + const static uint16_t ldpc_tab_3_4S[33][13]; + const static uint16_t ldpc_tab_4_5S[35][4]; + const static uint16_t ldpc_tab_5_6S[37][14]; + const static uint16_t ldpc_tab_8_9S[40][5]; + + const static uint16_t ldpc_tab_2_9N[40][12]; + const static uint16_t ldpc_tab_13_45N[52][13]; + const static uint16_t ldpc_tab_9_20N[81][13]; + const static uint16_t ldpc_tab_11_20N[99][14]; + const static uint16_t ldpc_tab_26_45N[104][14]; + const static uint16_t ldpc_tab_28_45N[112][12]; + const static uint16_t ldpc_tab_23_36N[115][12]; + const static uint16_t ldpc_tab_25_36N[125][12]; + const static uint16_t ldpc_tab_13_18N[130][11]; + const static uint16_t ldpc_tab_7_9N[140][13]; + const static uint16_t ldpc_tab_90_180N[90][19]; + const static uint16_t ldpc_tab_96_180N[96][21]; + const static uint16_t ldpc_tab_100_180N[100][17]; + const static uint16_t ldpc_tab_104_180N[104][19]; + const static uint16_t ldpc_tab_116_180N[116][19]; + const static uint16_t ldpc_tab_124_180N[124][17]; + const static uint16_t ldpc_tab_128_180N[128][16]; + const static uint16_t ldpc_tab_132_180N[132][16]; + const static uint16_t ldpc_tab_135_180N[135][15]; + const static uint16_t ldpc_tab_140_180N[140][16]; + const static uint16_t ldpc_tab_154_180N[154][14]; + const static uint16_t ldpc_tab_18_30N[108][20]; + const static uint16_t ldpc_tab_20_30N[120][17]; + const static uint16_t ldpc_tab_22_30N[132][16]; + + const static uint16_t ldpc_tab_11_45S[11][11]; + const static uint16_t ldpc_tab_4_15S[12][22]; + const static uint16_t ldpc_tab_14_45S[14][13]; + const static uint16_t ldpc_tab_7_15S[21][25]; + const static uint16_t ldpc_tab_8_15S[24][22]; + const static uint16_t ldpc_tab_26_45S[26][14]; + const static uint16_t ldpc_tab_32_45S[32][13]; + + const static uint16_t ldpc_tab_1_5M[18][14]; + const static uint16_t ldpc_tab_11_45M[22][11]; + const static uint16_t ldpc_tab_1_3M[30][13]; public: dvb_ldpc_bb_impl(dvb_standard_t standard, diff --git a/gr-fec/include/gnuradio/fec/polar_decoder_sc_list.h b/gr-fec/include/gnuradio/fec/polar_decoder_sc_list.h index 608992927..8f02dc537 100644 --- a/gr-fec/include/gnuradio/fec/polar_decoder_sc_list.h +++ b/gr-fec/include/gnuradio/fec/polar_decoder_sc_list.h @@ -33,7 +33,6 @@ namespace code { namespace polar { class scl_list; -class path; } // namespace polar /*! diff --git a/gr-fec/lib/decoder_impl.cc b/gr-fec/lib/decoder_impl.cc index 5af897870..f4ad7a984 100644 --- a/gr-fec/lib/decoder_impl.cc +++ b/gr-fec/lib/decoder_impl.cc @@ -63,17 +63,17 @@ decoder_impl::decoder_impl(generic_decoder::sptr my_decoder, int decoder_impl::fixed_rate_ninput_to_noutput(int ninput) { - return (int)(0.5 + ninput * relative_rate()); + return std::lround(ninput * relative_rate()); } int decoder_impl::fixed_rate_noutput_to_ninput(int noutput) { - return (int)(0.5 + noutput / relative_rate()); + return std::lround(noutput / relative_rate()); } void decoder_impl::forecast(int noutput_items, gr_vector_int& ninput_items_required) { - ninput_items_required[0] = 0.5 + fixed_rate_noutput_to_ninput(noutput_items); + ninput_items_required[0] = std::lround(fixed_rate_noutput_to_ninput(noutput_items)); } int decoder_impl::general_work(int noutput_items, @@ -84,9 +84,9 @@ int decoder_impl::general_work(int noutput_items, const unsigned char* in = (unsigned char*)input_items[0]; unsigned char* out = (unsigned char*)output_items[0]; - int outnum = (int)(((1.0 / relative_rate()) * noutput_items) + 0.5); + int outnum = std::lround((1.0 / relative_rate()) * noutput_items); int innum = - (int)(relative_rate() * (ninput_items[0] - d_decoder->get_history()) + 0.5) / + std::lround(relative_rate() * (ninput_items[0] - d_decoder->get_history())) / (output_multiple() - d_decoder->get_history()); int items = (outnum <= ninput_items[0] - d_decoder->get_history()) @@ -106,8 +106,8 @@ int decoder_impl::general_work(int noutput_items, pmt::intern(alias())); } - int consumed = static_cast<int>( - items / relative_rate() * (output_multiple() - d_decoder->get_history()) + 0.5); + int consumed = std::lround( + items / relative_rate() * (output_multiple() - d_decoder->get_history())); int returned = items * (output_multiple() - d_decoder->get_history()); consume_each(consumed); diff --git a/gr-fec/lib/depuncture_bb_impl.cc b/gr-fec/lib/depuncture_bb_impl.cc index 27d00bb5b..3cb065102 100644 --- a/gr-fec/lib/depuncture_bb_impl.cc +++ b/gr-fec/lib/depuncture_bb_impl.cc @@ -81,18 +81,18 @@ depuncture_bb_impl::~depuncture_bb_impl() {} int depuncture_bb_impl::fixed_rate_ninput_to_noutput(int ninput) { - return (int)(((d_puncsize / (double)(d_puncsize - d_puncholes)) * ninput) + .5); + return std::lround((d_puncsize / (double)(d_puncsize - d_puncholes)) * ninput); } int depuncture_bb_impl::fixed_rate_noutput_to_ninput(int noutput) { - return (int)((((d_puncsize - d_puncholes) / (double)(d_puncsize)) * noutput) + .5); + return std::lround(((d_puncsize - d_puncholes) / (double)(d_puncsize)) * noutput); } void depuncture_bb_impl::forecast(int noutput_items, gr_vector_int& ninput_items_required) { ninput_items_required[0] = - (int)((((d_puncsize - d_puncholes) / (double)(d_puncsize)) * noutput_items) + .5); + std::lround(((d_puncsize - d_puncholes) / (double)(d_puncsize)) * noutput_items); } /* @@ -138,7 +138,7 @@ int depuncture_bb_impl::general_work(int noutput_items, % ((int)(((1.0/relative_rate()) * noutput_items) + .5))); */ - consume_each((int)(((1.0 / relative_rate()) * noutput_items) + .5)); + consume_each(std::lround((1.0 / relative_rate()) * noutput_items)); return noutput_items; } diff --git a/gr-fec/lib/encoder_impl.cc b/gr-fec/lib/encoder_impl.cc index 21b71e5e9..d99454a98 100644 --- a/gr-fec/lib/encoder_impl.cc +++ b/gr-fec/lib/encoder_impl.cc @@ -62,12 +62,12 @@ encoder_impl::~encoder_impl() {} int encoder_impl::fixed_rate_ninput_to_noutput(int ninput) { - return (int)(0.5 + ninput * relative_rate()); + return std::lround(ninput * relative_rate()); } int encoder_impl::fixed_rate_noutput_to_ninput(int noutput) { - return (int)(0.5 + noutput / relative_rate()); + return std::lround(noutput / relative_rate()); } void encoder_impl::forecast(int noutput_items, gr_vector_int& ninput_items_required) diff --git a/gr-fec/lib/puncture_bb_impl.cc b/gr-fec/lib/puncture_bb_impl.cc index a365d6a69..0bfc15518 100644 --- a/gr-fec/lib/puncture_bb_impl.cc +++ b/gr-fec/lib/puncture_bb_impl.cc @@ -79,18 +79,18 @@ puncture_bb_impl::~puncture_bb_impl() {} int puncture_bb_impl::fixed_rate_ninput_to_noutput(int ninput) { - return (int)((((d_puncsize - d_puncholes) / (double)(d_puncsize)) * ninput) + .5); + return std::lround(((d_puncsize - d_puncholes) / (double)(d_puncsize)) * ninput); } int puncture_bb_impl::fixed_rate_noutput_to_ninput(int noutput) { - return (int)(((d_puncsize / (double)(d_puncsize - d_puncholes)) * noutput) + .5); + return std::lround((d_puncsize / (double)(d_puncsize - d_puncholes)) * noutput); } void puncture_bb_impl::forecast(int noutput_items, gr_vector_int& ninput_items_required) { ninput_items_required[0] = - (int)(((d_puncsize / (double)(d_puncsize - d_puncholes)) * noutput_items) + .5); + std::lround((d_puncsize / (double)(d_puncsize - d_puncholes)) * noutput_items); } /* @@ -138,7 +138,7 @@ int puncture_bb_impl::general_work(int noutput_items, % ((int)(((1.0/relative_rate()) * noutput_items) + .5))); */ - consume_each((int)(((1.0 / relative_rate()) * noutput_items) + .5)); + consume_each(std::lround((1.0 / relative_rate()) * noutput_items)); return noutput_items; } diff --git a/gr-fec/lib/puncture_ff_impl.cc b/gr-fec/lib/puncture_ff_impl.cc index c95288d69..c2c9cb5ca 100644 --- a/gr-fec/lib/puncture_ff_impl.cc +++ b/gr-fec/lib/puncture_ff_impl.cc @@ -79,18 +79,18 @@ puncture_ff_impl::~puncture_ff_impl() {} int puncture_ff_impl::fixed_rate_ninput_to_noutput(int ninput) { - return (int)((((d_puncsize - d_puncholes) / (double)(d_puncsize)) * ninput) + .5); + return std::lround(((d_puncsize - d_puncholes) / (double)(d_puncsize)) * ninput); } int puncture_ff_impl::fixed_rate_noutput_to_ninput(int noutput) { - return (int)(((d_puncsize / (double)(d_puncsize - d_puncholes)) * noutput) + .5); + return std::lround((d_puncsize / (double)(d_puncsize - d_puncholes)) * noutput); } void puncture_ff_impl::forecast(int noutput_items, gr_vector_int& ninput_items_required) { ninput_items_required[0] = - (int)(((d_puncsize / (double)(d_puncsize - d_puncholes)) * noutput_items) + .5); + std::lround((d_puncsize / (double)(d_puncsize - d_puncholes)) * noutput_items); } /* @@ -138,7 +138,7 @@ int puncture_ff_impl::general_work(int noutput_items, % ((int)(((1.0/relative_rate()) * noutput_items) + .5))); */ - consume_each((int)(((1.0 / relative_rate()) * noutput_items) + .5)); + consume_each(std::lround((1.0 / relative_rate()) * noutput_items)); return noutput_items; } diff --git a/gr-fec/lib/tpc_decoder.cc b/gr-fec/lib/tpc_decoder.cc index b8a1e74e8..707442b1d 100644 --- a/gr-fec/lib/tpc_decoder.cc +++ b/gr-fec/lib/tpc_decoder.cc @@ -703,7 +703,7 @@ float tpc_decoder::constant_log_map(const float delta1, const float delta2) { // Return maximum of delta1 and delta2 // and in correction value if |delta1-delta2| < TVALUE - register float diff; + float diff; diff = delta2 - delta1; if (diff > TVALUE) diff --git a/gr-fft/include/gnuradio/fft/window.h b/gr-fft/include/gnuradio/fft/window.h index 6173b9f97..2cece9569 100644 --- a/gr-fft/include/gnuradio/fft/window.h +++ b/gr-fft/include/gnuradio/fft/window.h @@ -177,7 +177,7 @@ public: static std::vector<float> blackman_harris(int ntaps, int atten = 92); /*! - * Alias to gr::fft::window::blakcman_harris. + * Alias to gr::fft::window::blackman_harris. */ static std::vector<float> blackmanharris(int ntaps, int atten = 92); diff --git a/gr-fft/lib/qa_fft_shift.cc b/gr-fft/lib/qa_fft_shift.cc index fb587ec1d..d219ce0a6 100644 --- a/gr-fft/lib/qa_fft_shift.cc +++ b/gr-fft/lib/qa_fft_shift.cc @@ -39,12 +39,24 @@ BOOST_AUTO_TEST_CASE(t1) std::vector<int> y_even{ -4, -3, -2, -1, 0, 1, 2, 3 }; // expected result s.shift(x_even); - BOOST_TEST(x_even == y_even, boost::test_tools::per_element()); + if (x_even.size() == y_even.size()) { + for (unsigned int i = 0; i < x_even.size(); i++) { + BOOST_CHECK(x_even[i] == y_even[i]); + } + } else { + BOOST_CHECK(x_even.size() == y_even.size()); + } // two shifts should not change the result s.shift(x_even); s.shift(x_even); - BOOST_TEST(x_even == y_even, boost::test_tools::per_element()); + if (x_even.size() == y_even.size()) { + for (unsigned int i = 0; i < x_even.size(); i++) { + BOOST_CHECK(x_even[i] == y_even[i]); + } + } else { + BOOST_CHECK(x_even.size() == y_even.size()); + } } BOOST_AUTO_TEST_CASE(t2) @@ -55,7 +67,13 @@ BOOST_AUTO_TEST_CASE(t2) std::vector<int> y_odd{ -3, -2, -1, 0, 1, 2, 3 }; // expected result s.shift(x_odd); - BOOST_TEST(x_odd == y_odd, boost::test_tools::per_element()); + if (x_odd.size() == y_odd.size()) { + for (unsigned int i = 0; i < x_odd.size(); i++) { + BOOST_CHECK(x_odd[i] == y_odd[i]); + } + } else { + BOOST_CHECK(x_odd.size() == y_odd.size()); + } } } /* namespace fft */ diff --git a/gr-qtgui/CMakeLists.txt b/gr-qtgui/CMakeLists.txt index 41ac05232..8831f3ad9 100644 --- a/gr-qtgui/CMakeLists.txt +++ b/gr-qtgui/CMakeLists.txt @@ -22,8 +22,6 @@ ######################################################################## include(GrBoost) -find_package(PythonLibs 2) - include(GrPython) # Note: gr-qtgui requires Qt5. diff --git a/gr-qtgui/examples/c++/display_qt.cc b/gr-qtgui/examples/c++/display_qt.cc index dd3a7a0a0..21a299c93 100644 --- a/gr-qtgui/examples/c++/display_qt.cc +++ b/gr-qtgui/examples/c++/display_qt.cc @@ -30,11 +30,11 @@ mywindow::mywindow() : QWidget() tab0 = new QTabWidget(); tab1 = new QTabWidget(); - // Add the tab widgets to the layou + // Add the tab widgets to the layout layout->addWidget(tab0); layout->addWidget(tab1); - // Set the layout as the main widget's layou + // Set the layout as the main widget's layout setLayout(layout); // Simple resizing of the app diff --git a/gr-qtgui/grc/qtgui_edit_box_msg.block.yml b/gr-qtgui/grc/qtgui_edit_box_msg.block.yml index 45f17a3b0..c2ef05012 100644 --- a/gr-qtgui/grc/qtgui_edit_box_msg.block.yml +++ b/gr-qtgui/grc/qtgui_edit_box_msg.block.yml @@ -39,7 +39,7 @@ parameters: hide: part asserts: -- ${(is_pair and is_static and len(key) > 0) or not (is_pair and is_static)} +- ${(len(key) > 0) or not ((is_pair == 'True') and (is_static == 'True'))} inputs: - domain: message diff --git a/gr-qtgui/grc/qtgui_time_sink_x.block.yml b/gr-qtgui/grc/qtgui_time_sink_x.block.yml index 76b454e5c..e512f98e1 100644 --- a/gr-qtgui/grc/qtgui_time_sink_x.block.yml +++ b/gr-qtgui/grc/qtgui_time_sink_x.block.yml @@ -159,7 +159,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 1 or (type == "complex" and int(nconnections) >= 1) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 1 <= 1) + or (type == "msg_float" and 1 <= 1)) else 'all') } category: Config @@ -169,7 +170,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 1 or (type == "complex" and int(nconnections) >= 1) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 1 <= 1) + or (type == "msg_float" and 1 <= 1)) else 'all') } category: Config @@ -182,7 +184,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 1 or (type == "complex" and int(nconnections) >= 1) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 1 <= 1) + or (type == "msg_float" and 1 <= 1)) else 'all') } category: Config @@ -195,7 +198,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 1 or (type == "complex" and int(nconnections) >= 1) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 1 <= 1) + or (type == "msg_float" and 1 <= 1)) else 'all') } category: Config @@ -208,7 +212,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 1 or (type == "complex" and int(nconnections) >= 1) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 1 <= 1) + or (type == "msg_float" and 1 <= 1)) else 'all') } category: Config @@ -219,7 +224,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 1 or (type == "complex" and int(nconnections) >= 1) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 1 <= 1) + or (type == "msg_float" and 1 <= 1)) else 'all') } category: Config @@ -232,7 +238,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 2 or (type == "complex" and int(nconnections) >= 1) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 1 <= 1) + or (type == "msg_float" and 2 <= 1)) else 'all') } category: Config @@ -243,7 +250,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 2 or (type == "complex" and int(nconnections) >= 1) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 1 <= 1) + or (type == "msg_float" and 2 <= 1)) else 'all') } category: Config @@ -257,7 +265,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 2 or (type == "complex" and int(nconnections) >= 1) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 1 <= 1) + or (type == "msg_float" and 2 <= 1)) else 'all') } category: Config @@ -271,7 +280,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 2 or (type == "complex" and int(nconnections) >= 1) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 1 <= 1) + or (type == "msg_float" and 2 <= 1)) else 'all') } category: Config @@ -285,7 +295,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 2 or (type == "complex" and int(nconnections) >= 1) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 1 <= 1) + or (type == "msg_float" and 2 <= 1)) else 'all') } category: Config @@ -297,7 +308,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 2 or (type == "complex" and int(nconnections) >= 1) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 1 <= 1) + or (type == "msg_float" and 2 <= 1)) else 'all') } category: Config @@ -310,7 +322,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 3 or (type == "complex" and int(nconnections) >= 2) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 2 <= 1) + or (type == "msg_float" and 3 <= 1)) else 'all') } category: Config @@ -321,7 +334,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 3 or (type == "complex" and int(nconnections) >= 2) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 2 <= 1) + or (type == "msg_float" and 3 <= 1)) else 'all') } category: Config @@ -335,7 +349,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 3 or (type == "complex" and int(nconnections) >= 2) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 2 <= 1) + or (type == "msg_float" and 3 <= 1)) else 'all') } category: Config @@ -349,7 +364,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 3 or (type == "complex" and int(nconnections) >= 2) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 2 <= 1) + or (type == "msg_float" and 3 <= 1)) else 'all') } category: Config @@ -363,7 +379,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 3 or (type == "complex" and int(nconnections) >= 2) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 2 <= 1) + or (type == "msg_float" and 3 <= 1)) else 'all') } category: Config @@ -375,7 +392,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 3 or (type == "complex" and int(nconnections) >= 2) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 2 <= 1) + or (type == "msg_float" and 3 <= 1)) else 'all') } category: Config @@ -388,7 +406,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 4 or (type == "complex" and int(nconnections) >= 2) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 2 <= 1) + or (type == "msg_float" and 4 <= 1)) else 'all') } category: Config @@ -399,7 +418,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 4 or (type == "complex" and int(nconnections) >= 2) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 2 <= 1) + or (type == "msg_float" and 4 <= 1)) else 'all') } category: Config @@ -413,7 +433,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 4 or (type == "complex" and int(nconnections) >= 2) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 2 <= 1) + or (type == "msg_float" and 4 <= 1)) else 'all') } category: Config @@ -427,7 +448,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 4 or (type == "complex" and int(nconnections) >= 2) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 2 <= 1) + or (type == "msg_float" and 4 <= 1)) else 'all') } category: Config @@ -441,7 +463,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 4 or (type == "complex" and int(nconnections) >= 2) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 2 <= 1) + or (type == "msg_float" and 4 <= 1)) else 'all') } category: Config @@ -453,7 +476,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 4 or (type == "complex" and int(nconnections) >= 2) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 2 <= 1) + or (type == "msg_float" and 4 <= 1)) else 'all') } category: Config @@ -466,7 +490,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 5 or (type == "complex" and int(nconnections) >= 3) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 3 <= 1) + or (type == "msg_float" and 5 <= 1)) else 'all') } category: Config @@ -477,7 +502,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 5 or (type == "complex" and int(nconnections) >= 3) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 3 <= 1) + or (type == "msg_float" and 5 <= 1)) else 'all') } category: Config @@ -491,7 +517,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 5 or (type == "complex" and int(nconnections) >= 3) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 3 <= 1) + or (type == "msg_float" and 5 <= 1)) else 'all') } category: Config @@ -505,7 +532,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 5 or (type == "complex" and int(nconnections) >= 3) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 3 <= 1) + or (type == "msg_float" and 5 <= 1)) else 'all') } category: Config @@ -519,7 +547,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 5 or (type == "complex" and int(nconnections) >= 3) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 3 <= 1) + or (type == "msg_float" and 5 <= 1)) else 'all') } category: Config @@ -531,7 +560,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 5 or (type == "complex" and int(nconnections) >= 3) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 3 <= 1) + or (type == "msg_float" and 5 <= 1)) else 'all') } category: Config @@ -544,7 +574,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 6 or (type == "complex" and int(nconnections) >= 3) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 3 <= 1) + or (type == "msg_float" and 6 <= 1)) else 'all') } category: Config @@ -555,7 +586,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 6 or (type == "complex" and int(nconnections) >= 3) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 3 <= 1) + or (type == "msg_float" and 6 <= 1)) else 'all') } category: Config @@ -569,7 +601,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 6 or (type == "complex" and int(nconnections) >= 3) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 3 <= 1) + or (type == "msg_float" and 6 <= 1)) else 'all') } category: Config @@ -583,7 +616,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 6 or (type == "complex" and int(nconnections) >= 3) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 3 <= 1) + or (type == "msg_float" and 6 <= 1)) else 'all') } category: Config @@ -597,7 +631,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 6 or (type == "complex" and int(nconnections) >= 3) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 3 <= 1) + or (type == "msg_float" and 6 <= 1)) else 'all') } category: Config @@ -609,7 +644,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 6 or (type == "complex" and int(nconnections) >= 3) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 3 <= 1) + or (type == "msg_float" and 6 <= 1)) else 'all') } category: Config @@ -622,7 +658,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 7 or (type == "complex" and int(nconnections) >= 4) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 4 <= 1) + or (type == "msg_float" and 7 <= 1)) else 'all') } category: Config @@ -633,7 +670,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 7 or (type == "complex" and int(nconnections) >= 4) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 4 <= 1) + or (type == "msg_float" and 7 <= 1)) else 'all') } category: Config @@ -647,7 +685,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 7 or (type == "complex" and int(nconnections) >= 4) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 4 <= 1) + or (type == "msg_float" and 7 <= 1)) else 'all') } category: Config @@ -661,7 +700,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 7 or (type == "complex" and int(nconnections) >= 4) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 4 <= 1) + or (type == "msg_float" and 7 <= 1)) else 'all') } category: Config @@ -675,7 +715,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 7 or (type == "complex" and int(nconnections) >= 4) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 4 <= 1) + or (type == "msg_float" and 7 <= 1)) else 'all') } category: Config @@ -687,7 +728,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 7 or (type == "complex" and int(nconnections) >= 4) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 4 <= 1) + or (type == "msg_float" and 7 <= 1)) else 'all') } category: Config @@ -700,7 +742,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 8 or (type == "complex" and int(nconnections) >= 4) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 4 <= 1) + or (type == "msg_float" and 8 <= 1)) else 'all') } category: Config @@ -711,7 +754,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 8 or (type == "complex" and int(nconnections) >= 4) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 4 <= 1) + or (type == "msg_float" and 8 <= 1)) else 'all') } category: Config @@ -725,7 +769,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 8 or (type == "complex" and int(nconnections) >= 4) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 4 <= 1) + or (type == "msg_float" and 8 <= 1)) else 'all') } category: Config @@ -739,7 +784,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 8 or (type == "complex" and int(nconnections) >= 4) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 4 <= 1) + or (type == "msg_float" and 8 <= 1)) else 'all') } category: Config @@ -753,7 +799,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 8 or (type == "complex" and int(nconnections) >= 4) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 4 <= 1) + or (type == "msg_float" and 8 <= 1)) else 'all') } category: Config @@ -765,7 +812,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 8 or (type == "complex" and int(nconnections) >= 4) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 4 <= 1) + or (type == "msg_float" and 8 <= 1)) else 'all') } category: Config @@ -778,7 +826,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 9 or (type == "complex" and int(nconnections) >= 5) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 5 <= 1) + or (type == "msg_float" and 9 <= 1)) else 'all') } category: Config @@ -789,7 +838,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 9 or (type == "complex" and int(nconnections) >= 5) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 5 <= 1) + or (type == "msg_float" and 9 <= 1)) else 'all') } category: Config @@ -803,7 +853,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 9 or (type == "complex" and int(nconnections) >= 5) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 5 <= 1) + or (type == "msg_float" and 9 <= 1)) else 'all') } category: Config @@ -817,7 +868,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 9 or (type == "complex" and int(nconnections) >= 5) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 5 <= 1) + or (type == "msg_float" and 9 <= 1)) else 'all') } category: Config @@ -831,7 +883,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 9 or (type == "complex" and int(nconnections) >= 5) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 5 <= 1) + or (type == "msg_float" and 9 <= 1)) else 'all') } category: Config @@ -843,7 +896,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 9 or (type == "complex" and int(nconnections) >= 5) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 5 <= 1) + or (type == "msg_float" and 9 <= 1)) else 'all') } category: Config @@ -856,7 +910,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 10 or (type == "complex" and int(nconnections) >= 5) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 5 <= 1) + or (type == "msg_float" and 10 <= 1)) else 'all') } category: Config @@ -867,7 +922,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 10 or (type == "complex" and int(nconnections) >= 5) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 5 <= 1) + or (type == "msg_float" and 10 <= 1)) else 'all') } category: Config @@ -881,7 +937,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 10 or (type == "complex" and int(nconnections) >= 5) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 5 <= 1) + or (type == "msg_float" and 10 <= 1)) else 'all') } category: Config @@ -895,7 +952,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 10 or (type == "complex" and int(nconnections) >= 5) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 5 <= 1) + or (type == "msg_float" and 10 <= 1)) else 'all') } category: Config @@ -909,7 +967,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 10 or (type == "complex" and int(nconnections) >= 5) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 5 <= 1) + or (type == "msg_float" and 10 <= 1)) else 'all') } category: Config @@ -921,7 +980,8 @@ parameters: hide: ${ ('part' if ( int(nconnections) >= 10 or (type == "complex" and int(nconnections) >= 5) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and 5 <= 1) + or (type == "msg_float" and 10 <= 1)) else 'all') } category: Config diff --git a/gr-qtgui/grc/qtgui_time_sink_x.block.yml.py b/gr-qtgui/grc/qtgui_time_sink_x.block.yml.py index 271082dc8..05f206b95 100644 --- a/gr-qtgui/grc/qtgui_time_sink_x.block.yml.py +++ b/gr-qtgui/grc/qtgui_time_sink_x.block.yml.py @@ -167,7 +167,8 @@ LINE_PARAMS = """ hide: ${{ ('part' if ( int(nconnections) >= {i} or (type == "complex" and int(nconnections) >= {i_cplx}) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and {i_cplx} <= 1) + or (type == "msg_float" and {i} <= 1)) else 'all') }} category: Config @@ -178,7 +179,8 @@ LINE_PARAMS = """ hide: ${{ ('part' if ( int(nconnections) >= {i} or (type == "complex" and int(nconnections) >= {i_cplx}) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and {i_cplx} <= 1) + or (type == "msg_float" and {i} <= 1)) else 'all') }} category: Config @@ -192,7 +194,8 @@ LINE_PARAMS = """ hide: ${{ ('part' if ( int(nconnections) >= {i} or (type == "complex" and int(nconnections) >= {i_cplx}) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and {i_cplx} <= 1) + or (type == "msg_float" and {i} <= 1)) else 'all') }} category: Config @@ -206,7 +209,8 @@ LINE_PARAMS = """ hide: ${{ ('part' if ( int(nconnections) >= {i} or (type == "complex" and int(nconnections) >= {i_cplx}) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and {i_cplx} <= 1) + or (type == "msg_float" and {i} <= 1)) else 'all') }} category: Config @@ -220,7 +224,8 @@ LINE_PARAMS = """ hide: ${{ ('part' if ( int(nconnections) >= {i} or (type == "complex" and int(nconnections) >= {i_cplx}) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and {i_cplx} <= 1) + or (type == "msg_float" and {i} <= 1)) else 'all') }} category: Config @@ -232,7 +237,8 @@ LINE_PARAMS = """ hide: ${{ ('part' if ( int(nconnections) >= {i} or (type == "complex" and int(nconnections) >= {i_cplx}) - or (type == "msg_complex")) and (not type == "msg_float") + or (type == "msg_complex" and {i_cplx} <= 1) + or (type == "msg_float" and {i} <= 1)) else 'all') }} category: Config diff --git a/gr-qtgui/include/gnuradio/qtgui/form_menus.h b/gr-qtgui/include/gnuradio/qtgui/form_menus.h index dcb32fbc4..226adb514 100644 --- a/gr-qtgui/include/gnuradio/qtgui/form_menus.h +++ b/gr-qtgui/include/gnuradio/qtgui/form_menus.h @@ -700,7 +700,6 @@ public slots: private: QList<QAction*> d_act; - OtherAction* d_other; QActionGroup* d_grp; }; @@ -807,7 +806,6 @@ public slots: private: QList<QAction*> d_act; - OtherAction* d_other; QActionGroup* d_grp; float d_off, d_high, d_medium, d_low; }; @@ -929,7 +927,6 @@ public slots: private: QList<QAction*> d_act; QActionGroup* d_grp; - int d_which; }; @@ -1078,7 +1075,6 @@ public slots: private: QActionGroup* d_grp; QList<QAction*> d_act; - OtherDualAction* d_other; QColor d_max_value, d_min_value; int d_which; }; diff --git a/gr-qtgui/include/gnuradio/qtgui/plot_raster.h b/gr-qtgui/include/gnuradio/qtgui/plot_raster.h index 83165619b..c9718db5a 100644 --- a/gr-qtgui/include/gnuradio/qtgui/plot_raster.h +++ b/gr-qtgui/include/gnuradio/qtgui/plot_raster.h @@ -69,11 +69,6 @@ public: virtual int rtti() const; - virtual void draw(QPainter* p, - const QwtScaleMap& xMap, - const QwtScaleMap& yMap, - const QRect& rect) const; - protected: #if QWT_VERSION < 0x060000 QImage renderImage(const QwtScaleMap& xMap, diff --git a/gr-qtgui/include/gnuradio/qtgui/plot_waterfall.h b/gr-qtgui/include/gnuradio/qtgui/plot_waterfall.h index 22cd70835..df6dfe773 100644 --- a/gr-qtgui/include/gnuradio/qtgui/plot_waterfall.h +++ b/gr-qtgui/include/gnuradio/qtgui/plot_waterfall.h @@ -64,11 +64,6 @@ public: virtual int rtti() const; - virtual void draw(QPainter* p, - const QwtScaleMap& xMap, - const QwtScaleMap& yMap, - const QRect& rect) const; - protected: #if QWT_VERSION < 0x060000 QImage renderImage(const QwtScaleMap& xMap, diff --git a/gr-qtgui/lib/edit_box_msg_impl.cc b/gr-qtgui/lib/edit_box_msg_impl.cc index 67fa5e9b3..8713aa820 100644 --- a/gr-qtgui/lib/edit_box_msg_impl.cc +++ b/gr-qtgui/lib/edit_box_msg_impl.cc @@ -481,7 +481,6 @@ void edit_box_msg_impl::edit_finished() std::vector<gr_complex> xv; QStringList text_list = text.split(","); bool even = false; - gr_complex c; float re, im; for (int i = 0; i < text_list.size(); ++i) { QString s = text_list.at(i); diff --git a/gr-qtgui/lib/plot_raster.cc b/gr-qtgui/lib/plot_raster.cc index 8c5a33adb..312d344fb 100644 --- a/gr-qtgui/lib/plot_raster.cc +++ b/gr-qtgui/lib/plot_raster.cc @@ -238,7 +238,7 @@ QImage PlotTimeRaster::renderImage(const QwtScaleMap& xMap, const QwtInterval intensityRange = d_data->data->interval(Qt::ZAxis); #endif if (!intensityRange.isValid()) - return image; + return std::move(image); d_data->data->initRaster(area, rect.size()); @@ -282,7 +282,7 @@ QImage PlotTimeRaster::renderImage(const QwtScaleMap& xMap, image = image.mirrored(hInvert, vInvert); } - return image; + return std::move(image); } #if QWT_VERSION < 0x060000 @@ -299,22 +299,3 @@ QwtInterval PlotTimeRaster::interval(Qt::Axis ax) const } #endif -/*! - \brief Draw the raster - - \param painter Painter - \param xMap Maps x-values into pixel coordinates. - \param yMap Maps y-values into pixel coordinates. - \param canvasRect Contents rect of the canvas in painter coordinates - - \sa setDisplayMode, renderImage, - QwtPlotRasterItem::draw, drawContourLines -*/ - -void PlotTimeRaster::draw(QPainter* painter, - const QwtScaleMap& xMap, - const QwtScaleMap& yMap, - const QRect& canvasRect) const -{ - QwtPlotRasterItem::draw(painter, xMap, yMap, canvasRect); -} diff --git a/gr-qtgui/lib/plot_waterfall.cc b/gr-qtgui/lib/plot_waterfall.cc index eaee25628..6c1854431 100644 --- a/gr-qtgui/lib/plot_waterfall.cc +++ b/gr-qtgui/lib/plot_waterfall.cc @@ -235,7 +235,7 @@ QImage PlotWaterfall::renderImage(const QwtScaleMap& xMap, const QwtInterval intensityRange = d_data->data->interval(Qt::ZAxis); #endif if (!intensityRange.isValid()) - return image; + return std::move(image); d_data->data->initRaster(area, rect.size()); @@ -277,25 +277,6 @@ QImage PlotWaterfall::renderImage(const QwtScaleMap& xMap, image = image.mirrored(hInvert, vInvert); } - return image; + return std::move(image); } -/*! - \brief Draw the spectrogram - - \param painter Painter - \param xMap Maps x-values into pixel coordinates. - \param yMap Maps y-values into pixel coordinates. - \param canvasRect Contents rect of the canvas in painter coordinates - - \sa setDisplayMode, renderImage, - QwtPlotRasterItem::draw, drawContourLines -*/ - -void PlotWaterfall::draw(QPainter* painter, - const QwtScaleMap& xMap, - const QwtScaleMap& yMap, - const QRect& canvasRect) const -{ - QwtPlotRasterItem::draw(painter, xMap, yMap, canvasRect); -} diff --git a/gr-qtgui/lib/time_sink_c_impl.h b/gr-qtgui/lib/time_sink_c_impl.h index 9db9bcb39..9dfc66e33 100644 --- a/gr-qtgui/lib/time_sink_c_impl.h +++ b/gr-qtgui/lib/time_sink_c_impl.h @@ -65,7 +65,6 @@ private: pmt::pmt_t d_trigger_tag_key; bool d_triggered; int d_trigger_count; - int d_initial_delay; // used for limiting d_trigger_delay void _reset(); void _npoints_resize(); diff --git a/gr-qtgui/lib/time_sink_f_impl.h b/gr-qtgui/lib/time_sink_f_impl.h index 9669be447..f9b3a75a2 100644 --- a/gr-qtgui/lib/time_sink_f_impl.h +++ b/gr-qtgui/lib/time_sink_f_impl.h @@ -63,7 +63,6 @@ private: pmt::pmt_t d_trigger_tag_key; bool d_triggered; int d_trigger_count; - int d_initial_delay; // used for limiting d_trigger_delay void _reset(); void _npoints_resize(); diff --git a/gr-uhd/CMakeLists.txt b/gr-uhd/CMakeLists.txt index 0ce9299d0..bf017bde7 100644 --- a/gr-uhd/CMakeLists.txt +++ b/gr-uhd/CMakeLists.txt @@ -22,7 +22,7 @@ ######################################################################## include(GrBoost) -find_package(UHD "3.5.5") +find_package(UHD "3.9.7") ######################################################################## # Register component diff --git a/gr-uhd/apps/uhd_fft b/gr-uhd/apps/uhd_fft index eab9155df..c9607670c 100755 --- a/gr-uhd/apps/uhd_fft +++ b/gr-uhd/apps/uhd_fft @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python # # Copyright 2015-2016,2018 Free Software Foundation, Inc. # @@ -34,6 +34,8 @@ UHD FFT: Simple Spectrum Analyzer for UHD. # Note this is a heavily modified version of a # the uhd_fft.grc example. +from __future__ import print_function +from __future__ import division import ctypes import sys import sip @@ -244,9 +246,9 @@ class uhd_fft(UHDApp, gr.top_block, Qt.QWidget): self.qtgui_time_sink_x_0.disable_legend() for i in range(2*len(self.channels)): if(i % 2 == 0): - self.qtgui_time_sink_x_0.set_line_label(i, "Re{{Channel {0}}}".format(i/2)) + self.qtgui_time_sink_x_0.set_line_label(i, "Re{{Channel {0}}}".format(i//2)) else: - self.qtgui_time_sink_x_0.set_line_label(i, "Im{{Channel {0}}}".format(i/2)) + self.qtgui_time_sink_x_0.set_line_label(i, "Im{{Channel {0}}}".format(i//2)) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) @@ -510,4 +512,3 @@ if __name__ == '__main__': except: print("Warning: failed to XInitThreads()") main() - diff --git a/gr-uhd/apps/uhd_rx_cfile b/gr-uhd/apps/uhd_rx_cfile index d41027ff3..2b61597b0 100755 --- a/gr-uhd/apps/uhd_rx_cfile +++ b/gr-uhd/apps/uhd_rx_cfile @@ -26,6 +26,7 @@ outputs single precision complex float values or complex short values (interleaved 16 bit signed short integers). """ +from __future__ import print_function import sys import os import pmt @@ -179,13 +180,13 @@ class rx_cfile_block(gr.top_block): rx_serial = info["rx_serial"] rx_antenna = info["rx_antenna"] rx_subdev_spec = info["rx_subdev_spec"] - print "[UHD_RX] Motherboard: %s (%s)" % (mboard_id, mboard_serial) + print("[UHD_RX] Motherboard: %s (%s)" % (mboard_id, mboard_serial)) if "B200" in mboard_id or "B210" in mboard_id or "E310" in mboard_id: - print "[UHD_RX] Daughterboard: %s (%s, %s)" % (mboard_id, rx_antenna, rx_subdev_spec) + print("[UHD_RX] Daughterboard: %s (%s, %s)" % (mboard_id, rx_antenna, rx_subdev_spec)) else: - print "[UHD_RX] Daughterboard: %s (%s, %s, %s)" % (rx_id, rx_serial, rx_antenna, rx_subdev_spec) + print("[UHD_RX] Daughterboard: %s (%s, %s, %s)" % (rx_id, rx_serial, rx_antenna, rx_subdev_spec)) except KeyError: - print "[UHD_RX] Args: ", options.args + print("[UHD_RX] Args: ", options.args) print("[UHD_RX] Receiving on {} channels.".format(len(self.channels))) print("[UHD_RX] Rx gain: {gain}".format(gain=gain)) print("[UHD_RX] Rx frequency: {freq}".format(freq=freq)) diff --git a/gr-uhd/apps/uhd_rx_nogui b/gr-uhd/apps/uhd_rx_nogui index 946a82182..30c4a53f8 100755 --- a/gr-uhd/apps/uhd_rx_nogui +++ b/gr-uhd/apps/uhd_rx_nogui @@ -32,7 +32,7 @@ RFSQL - RF squelch zeroing output when input power below threshold AGC - Automatic gain control leveling signal at [-1.0, +1.0] DEMOD - Demodulation block appropriate to selected signal type. This converts the complex baseband to real audio frequencies, - and applies an appropriate low pass decimating filter. + and applies an appropriate low pass decimating filter. CTCSS - Optional tone squelch zeroing output when tone is not present. RSAMP - Resampler block to convert audio sample rate to user specified sound card output rate. @@ -40,8 +40,8 @@ AUDIO - Audio sink for playing final output to speakers. The following are required command line parameters: --f FREQ USRP receive frequency --m MOD Modulation type, select from AM, FM, or WFM +-f FREQ USRP receive frequency +-m MOD Modulation type, select from AM, FM, or WFM The following are optional command line parameters: @@ -51,8 +51,8 @@ The following are optional command line parameters: -g GAIN Daughterboard gain setting. Defaults to mid-range. -o RATE Sound card output rate. Defaults to 32000. Useful if your sound card only accepts particular sample rates. --r RFSQL RF squelch in db. Defaults to -50.0. --p FREQ CTCSS frequency. Opens squelch when tone is present. +-r RFSQL RF squelch in db. Defaults to -50.0. +-p FREQ CTCSS frequency. Opens squelch when tone is present. Once the program is running, ctrl-break (Ctrl-C) stops operation. @@ -61,6 +61,7 @@ blocks. """ from __future__ import print_function +from __future__ import division import sys from argparse import ArgumentParser from gnuradio import gr, gru, uhd, audio @@ -72,10 +73,10 @@ from gnuradio.eng_option import eng_option # (device_rate, channel_rate, audio_rate, channel_pass, channel_stop, demod) DEMOD_PARAMS = { - 'AM' : (256e3, 16e3, 16e3, 5000, 8000, analog.demod_10k0a3e_cf), - 'FM' : (256e3, 32e3, 8e3, 8000, 9000, analog.demod_20k0f3e_cf), - 'WFM' : (320e3, 320e3, 32e3, 80000, 115000, analog.demod_200kf3e_cf) - } + 'AM' : (256e3, 16e3, 16e3, 5000, 8000, analog.demod_10k0a3e_cf), + 'FM' : (256e3, 32e3, 8e3, 8000, 9000, analog.demod_20k0f3e_cf), + 'WFM' : (320e3, 320e3, 32e3, 80000, 115000, analog.demod_200kf3e_cf) + } class uhd_src(gr.hier_block2): """ @@ -140,37 +141,37 @@ class app_top_block(gr.top_block): dev = uhd_src(options.args, # UHD device address options.spec, # device subdev spec options.antenna, # device antenna - dev_rate, # device sample rate - options.gain, # Receiver gain + dev_rate, # device sample rate + options.gain, # Receiver gain options.calibration) # Frequency offset dev.tune(options.frequency) if_rate = dev.rate() - channel_decim = int(if_rate // channel_rate) - audio_decim = int(channel_rate // audio_rate) + channel_decim = if_rate // channel_rate + audio_decim = channel_rate // audio_rate chan_taps = filter.optfir.low_pass(1.0, # Filter gain - if_rate, # Sample rate + if_rate, # Sample rate channel_pass, # One sided modulation bandwidth channel_stop, # One sided channel bandwidth - 0.1, # Passband ripple - 60) # Stopband attenuation + 0.1, # Passband ripple + 60) # Stopband attenuation chan = filter.freq_xlating_fir_filter_ccf( channel_decim, # Decimation rate chan_taps, # Filter taps - 0.0, # Offset frequency + 0.0, # Offset frequency if_rate) # Sample rate rfsql = analog.pwr_squelch_cc( options.rf_squelch, # Power threshold 125.0/channel_rate, # Time constant int(channel_rate/20), # 50ms rise/fall - False) # Zero, not gate output + False) # Zero, not gate output agc = analog.agc_cc(1.0/channel_rate, # Time constant - 1.0, # Reference power - 1.0) # Gain + 1.0, # Reference power + 1.0) # Gain demod = demod(channel_rate, audio_decim) @@ -188,8 +189,8 @@ class app_top_block(gr.top_block): if options.output_rate != audio_rate: out_lcm = gru.lcm(audio_rate, options.output_rate) - out_interp = int(out_lcm // audio_rate) - out_decim = int(out_lcm // options.output_rate) + out_interp = out_lcm // audio_rate + out_decim = out_lcm // options.output_rate rsamp = filter.rational_resampler_fff(out_interp, out_decim) self.connect(tail, rsamp) tail = rsamp diff --git a/gr-uhd/examples/c++/tag_source_demo.h b/gr-uhd/examples/c++/tag_source_demo.h index 9211bf5f0..c16985138 100644 --- a/gr-uhd/examples/c++/tag_source_demo.h +++ b/gr-uhd/examples/c++/tag_source_demo.h @@ -109,10 +109,11 @@ public: _do_new_burst = false; _samps_left_in_burst = _samps_per_burst; - if (pmt::is_null(_length_tag_key)) + if (pmt::is_null(_length_tag_key)) { this->make_sob_tag(this->nitems_written(0)); - else + } else { #if 1 + (void)_samp_rate; // avoid unused variable warning this->make_length_tag(this->nitems_written(0), _samps_left_in_burst); #else // Test usrp_sink's ability to cancel remainder of burst if new length_tag @@ -123,6 +124,7 @@ public: this->make_length_tag(this->nitems_written(0), uint64_t(1.1 * _samp_rate * _cycle_duration)); #endif + } this->make_time_tag(this->nitems_written(0)); _time_fracs += _cycle_duration; diff --git a/gr-uhd/grc/gen_uhd_usrp_blocks.py b/gr-uhd/grc/gen_uhd_usrp_blocks.py index db83b4203..a24cec9a1 100644 --- a/gr-uhd/grc/gen_uhd_usrp_blocks.py +++ b/gr-uhd/grc/gen_uhd_usrp_blocks.py @@ -144,10 +144,10 @@ templates: ${'%'} if stream_args: args=${'$'}{stream_args}, ${'%'} endif - ${'%'} if stream_chans: + ${'%'} if eval(stream_chans): channels=${'$'}{stream_chans}, ${'%'} else: - channels=range(${'$'}{nchan}), + channels=list(range(0,${'$'}{nchan})), ${'%'} endif ), ${'%'} if len_tag_name: @@ -220,8 +220,10 @@ templates: % if sourk == 'source': - ${'$'}{'set_rx_agc(True, ${n})' if context.get('rx_agc${n}')() == 'Enabled' else ''} - ${'$'}{'set_rx_agc(False, ${n})' if context.get('rx_agc${n}')() == 'Disabled' else ''} - - ${'$'}{'set_gain(${'$'}{${'gain' + str(n)}}, ${n})' if not bool(eval(context.get('norm_gain${n}')())) and context.get('rx_agc${n}')() != 'Enabled' else ''} - - ${'$'}{'set_normalized_gain(${'$'}{${'gain' + str(n)}}, ${n})' if bool(eval(context.get('norm_gain${n}')())) and context.get('rx_agc${n}')() != 'Enabled' else ''} + - | + ${'%'} if context.get('rx_agc${n}')() != 'Enabled': + self.${'$'}{id}.set_${'$'}{'normalized_' if bool(eval(context.get('norm_gain${n}')())) else ''}gain(${'$'}{${'gain' + str(n)}}, ${n}) + ${'%'} endif % else: - self.${'$'}{id}.set_${'$'}{'normalized_' if bool(eval(context.get('norm_gain${n}')())) else ''}gain(${'$'}{${'gain' + str(n)}}, ${n}) % endif diff --git a/gr-utils/python/modtool/cli/add.py b/gr-utils/python/modtool/cli/add.py index 51a63ffc6..694d49f5f 100644 --- a/gr-utils/python/modtool/cli/add.py +++ b/gr-utils/python/modtool/cli/add.py @@ -127,7 +127,13 @@ def get_copyrightholder(self): def get_arglist(self): """ Get the argument list of the block to be added """ if self.info['arglist'] is not None: - self.info['arglist'] = click.prompt(click.style('Enter valid argument list, including default arguments: \n', fg='cyan'), prompt_suffix='') + self.info['arglist'] = click.prompt(click.style( + 'Enter valid argument list, including default arguments: \n', + fg='cyan'), + prompt_suffix='', + default='', + show_default=False) + def get_py_qa(self): """ Get a boolean value for addition of py_qa """ diff --git a/gr-vocoder/include/gnuradio/vocoder/freedv_api.h b/gr-vocoder/include/gnuradio/vocoder/freedv_api.h index b00cbbd42..c025432c5 100644 --- a/gr-vocoder/include/gnuradio/vocoder/freedv_api.h +++ b/gr-vocoder/include/gnuradio/vocoder/freedv_api.h @@ -25,11 +25,17 @@ #include <gnuradio/vocoder/api.h> +// version >=0.9.1 contains fixes that doesn't require "extern C" +// between 0.8.1 and 0.9.1 the build fail +#ifdef CODEC2_LEGACY extern "C" { +#endif #include <codec2/codec2.h> #include <codec2/freedv_api.h> #include <codec2/modem_stats.h> +#ifdef CODEC2_LEGACY } +#endif namespace gr { namespace vocoder { diff --git a/gr-zeromq/lib/pub_msg_sink_impl.cc b/gr-zeromq/lib/pub_msg_sink_impl.cc index 0fb26ada7..d8ec13043 100644 --- a/gr-zeromq/lib/pub_msg_sink_impl.cc +++ b/gr-zeromq/lib/pub_msg_sink_impl.cc @@ -73,7 +73,11 @@ void pub_msg_sink_impl::handler(pmt::pmt_t msg) zmq::message_t zmsg(s.size()); memcpy(zmsg.data(), s.c_str(), s.size()); +#if USE_NEW_CPPZMQ_SEND_RECV + d_socket->send(zmsg, zmq::send_flags::none); +#else d_socket->send(zmsg); +#endif } } /* namespace zeromq */ diff --git a/gr-zeromq/lib/pub_msg_sink_impl.h b/gr-zeromq/lib/pub_msg_sink_impl.h index cfd81ca39..b40a88cc8 100644 --- a/gr-zeromq/lib/pub_msg_sink_impl.h +++ b/gr-zeromq/lib/pub_msg_sink_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_ZEROMQ_PUB_MSG_SINK_IMPL_H #define INCLUDED_ZEROMQ_PUB_MSG_SINK_IMPL_H +#include "zmq_common_impl.h" #include <gnuradio/zeromq/pub_msg_sink.h> -#include <zmq.hpp> namespace gr { namespace zeromq { diff --git a/gr-zeromq/lib/pub_sink_impl.h b/gr-zeromq/lib/pub_sink_impl.h index 6e921d906..624b071a8 100644 --- a/gr-zeromq/lib/pub_sink_impl.h +++ b/gr-zeromq/lib/pub_sink_impl.h @@ -24,7 +24,6 @@ #define INCLUDED_ZEROMQ_PUB_SINK_IMPL_H #include <gnuradio/zeromq/pub_sink.h> -#include <zmq.hpp> #include "base_impl.h" @@ -43,7 +42,7 @@ public: int work(int noutput_items, gr_vector_const_void_star& input_items, - gr_vector_void_star& output_items); + gr_vector_void_star& output_items) override; std::string last_endpoint() override { return base_sink_impl::last_endpoint(); } }; diff --git a/gr-zeromq/lib/pull_msg_source_impl.h b/gr-zeromq/lib/pull_msg_source_impl.h index 293d98da7..7efd1a7b4 100644 --- a/gr-zeromq/lib/pull_msg_source_impl.h +++ b/gr-zeromq/lib/pull_msg_source_impl.h @@ -46,8 +46,8 @@ public: pull_msg_source_impl(char* address, int timeout); ~pull_msg_source_impl(); - bool start(); - bool stop(); + bool start() override; + bool stop() override; std::string last_endpoint() override { diff --git a/gr-zeromq/lib/pull_source_impl.h b/gr-zeromq/lib/pull_source_impl.h index a27b3f9c4..2b0fecc82 100644 --- a/gr-zeromq/lib/pull_source_impl.h +++ b/gr-zeromq/lib/pull_source_impl.h @@ -24,7 +24,6 @@ #define INCLUDED_ZEROMQ_PULL_SOURCE_IMPL_H #include <gnuradio/zeromq/pull_source.h> -#include <zmq.hpp> #include "base_impl.h" @@ -43,7 +42,7 @@ public: int work(int noutput_items, gr_vector_const_void_star& input_items, - gr_vector_void_star& output_items); + gr_vector_void_star& output_items) override; std::string last_endpoint() override { return base_source_impl::last_endpoint(); } }; diff --git a/gr-zeromq/lib/push_msg_sink_impl.cc b/gr-zeromq/lib/push_msg_sink_impl.cc index 5239a22e7..c2c6e3bf4 100644 --- a/gr-zeromq/lib/push_msg_sink_impl.cc +++ b/gr-zeromq/lib/push_msg_sink_impl.cc @@ -75,7 +75,11 @@ void push_msg_sink_impl::handler(pmt::pmt_t msg) zmq::message_t zmsg(s.size()); memcpy(zmsg.data(), s.c_str(), s.size()); +#if USE_NEW_CPPZMQ_SEND_RECV + d_socket->send(zmsg, zmq::send_flags::none); +#else d_socket->send(zmsg); +#endif } } /* namespace zeromq */ diff --git a/gr-zeromq/lib/push_msg_sink_impl.h b/gr-zeromq/lib/push_msg_sink_impl.h index 4d3017f78..ab453fc98 100644 --- a/gr-zeromq/lib/push_msg_sink_impl.h +++ b/gr-zeromq/lib/push_msg_sink_impl.h @@ -23,8 +23,8 @@ #ifndef INCLUDED_ZEROMQ_PUSH_MSG_SINK_IMPL_H #define INCLUDED_ZEROMQ_PUSH_MSG_SINK_IMPL_H +#include "zmq_common_impl.h" #include <gnuradio/zeromq/push_msg_sink.h> -#include <zmq.hpp> namespace gr { namespace zeromq { diff --git a/gr-zeromq/lib/push_sink_impl.h b/gr-zeromq/lib/push_sink_impl.h index bfa3dacdc..b66ff06fd 100644 --- a/gr-zeromq/lib/push_sink_impl.h +++ b/gr-zeromq/lib/push_sink_impl.h @@ -24,7 +24,6 @@ #define INCLUDED_ZEROMQ_PUSH_SINK_IMPL_H #include <gnuradio/zeromq/push_sink.h> -#include <zmq.hpp> #include "base_impl.h" @@ -43,7 +42,7 @@ public: int work(int noutput_items, gr_vector_const_void_star& input_items, - gr_vector_void_star& output_items); + gr_vector_void_star& output_items) override; std::string last_endpoint() override { return base_sink_impl::last_endpoint(); } }; diff --git a/gr-zeromq/lib/rep_msg_sink_impl.cc b/gr-zeromq/lib/rep_msg_sink_impl.cc index e1ac19e80..c2e187ff2 100644 --- a/gr-zeromq/lib/rep_msg_sink_impl.cc +++ b/gr-zeromq/lib/rep_msg_sink_impl.cc @@ -117,7 +117,11 @@ void rep_msg_sink_impl::readloop() std::string s = sb.str(); zmq::message_t zmsg(s.size()); memcpy(zmsg.data(), s.c_str(), s.size()); +#if USE_NEW_CPPZMQ_SEND_RECV + d_socket->send(zmsg, zmq::send_flags::none); +#else d_socket->send(zmsg); +#endif } // if req } // while !empty diff --git a/gr-zeromq/lib/rep_msg_sink_impl.h b/gr-zeromq/lib/rep_msg_sink_impl.h index 3042c4293..752acf0a6 100644 --- a/gr-zeromq/lib/rep_msg_sink_impl.h +++ b/gr-zeromq/lib/rep_msg_sink_impl.h @@ -46,8 +46,8 @@ public: rep_msg_sink_impl(char* address, int timeout); ~rep_msg_sink_impl(); - bool start(); - bool stop(); + bool start() override; + bool stop() override; std::string last_endpoint() override { diff --git a/gr-zeromq/lib/rep_sink_impl.h b/gr-zeromq/lib/rep_sink_impl.h index 3cca61db0..208caca28 100644 --- a/gr-zeromq/lib/rep_sink_impl.h +++ b/gr-zeromq/lib/rep_sink_impl.h @@ -41,7 +41,7 @@ public: int work(int noutput_items, gr_vector_const_void_star& input_items, - gr_vector_void_star& output_items); + gr_vector_void_star& output_items) override; std::string last_endpoint() override { return base_sink_impl::last_endpoint(); } }; diff --git a/gr-zeromq/lib/req_msg_source_impl.h b/gr-zeromq/lib/req_msg_source_impl.h index 828796037..ed4d307f2 100644 --- a/gr-zeromq/lib/req_msg_source_impl.h +++ b/gr-zeromq/lib/req_msg_source_impl.h @@ -46,8 +46,8 @@ public: req_msg_source_impl(char* address, int timeout); ~req_msg_source_impl(); - bool start(); - bool stop(); + bool start() override; + bool stop() override; std::string last_endpoint() override { diff --git a/gr-zeromq/lib/req_source_impl.cc b/gr-zeromq/lib/req_source_impl.cc index c7e87b742..f9f06362c 100644 --- a/gr-zeromq/lib/req_source_impl.cc +++ b/gr-zeromq/lib/req_source_impl.cc @@ -77,7 +77,11 @@ int req_source_impl::work(int noutput_items, uint32_t req_len = noutput_items - done; zmq::message_t request(sizeof(uint32_t)); memcpy((void*)request.data(), &req_len, sizeof(uint32_t)); +#if USE_NEW_CPPZMQ_SEND_RECV + d_socket->send(request, zmq::send_flags::none); +#else d_socket->send(request); +#endif d_req_pending = true; } diff --git a/gr-zeromq/lib/req_source_impl.h b/gr-zeromq/lib/req_source_impl.h index 6e2d71f56..eb95499b1 100644 --- a/gr-zeromq/lib/req_source_impl.h +++ b/gr-zeromq/lib/req_source_impl.h @@ -24,7 +24,6 @@ #define INCLUDED_ZEROMQ_REQ_SOURCE_IMPL_H #include <gnuradio/zeromq/req_source.h> -#include <zmq.hpp> #include "base_impl.h" @@ -43,7 +42,7 @@ public: int work(int noutput_items, gr_vector_const_void_star& input_items, - gr_vector_void_star& output_items); + gr_vector_void_star& output_items) override; std::string last_endpoint() override { return base_source_impl::last_endpoint(); } diff --git a/gr-zeromq/lib/sub_msg_source_impl.h b/gr-zeromq/lib/sub_msg_source_impl.h index 8d760c0ad..8228a0b45 100644 --- a/gr-zeromq/lib/sub_msg_source_impl.h +++ b/gr-zeromq/lib/sub_msg_source_impl.h @@ -46,8 +46,8 @@ public: sub_msg_source_impl(char* address, int timeout); ~sub_msg_source_impl(); - bool start(); - bool stop(); + bool start() override; + bool stop() override; std::string last_endpoint() override { diff --git a/gr-zeromq/lib/sub_source_impl.h b/gr-zeromq/lib/sub_source_impl.h index 890907b80..94eaac68f 100644 --- a/gr-zeromq/lib/sub_source_impl.h +++ b/gr-zeromq/lib/sub_source_impl.h @@ -24,7 +24,6 @@ #define INCLUDED_ZEROMQ_SUB_SOURCE_IMPL_H #include <gnuradio/zeromq/sub_source.h> -#include <zmq.hpp> #include "base_impl.h" @@ -43,7 +42,7 @@ public: int work(int noutput_items, gr_vector_const_void_star& input_items, - gr_vector_void_star& output_items); + gr_vector_void_star& output_items) override; std::string last_endpoint() override { return base_source_impl::last_endpoint(); } }; diff --git a/gr-zeromq/lib/tag_headers.cc b/gr-zeromq/lib/tag_headers.cc index 34d2dd701..2d8971919 100644 --- a/gr-zeromq/lib/tag_headers.cc +++ b/gr-zeromq/lib/tag_headers.cc @@ -20,9 +20,9 @@ * Boston, MA 02110-1301, USA. */ +#include "zmq_common_impl.h" #include <gnuradio/block.h> #include <gnuradio/io_signature.h> -#include <zmq.hpp> #include <cstring> #include <sstream> diff --git a/gr-zeromq/lib/tag_headers.h b/gr-zeromq/lib/tag_headers.h index b946f009a..c449f9cec 100644 --- a/gr-zeromq/lib/tag_headers.h +++ b/gr-zeromq/lib/tag_headers.h @@ -23,9 +23,9 @@ #ifndef ZEROMQ_TAG_HEADERS_H #define ZEROMQ_TAG_HEADERS_H +#include "zmq_common_impl.h" #include <gnuradio/block.h> #include <gnuradio/io_signature.h> -#include <zmq.hpp> #include <cstring> #include <sstream> diff --git a/grc/blocks/variable_config.block.yml b/grc/blocks/variable_config.block.yml index ba4d344f0..04a60e43f 100644 --- a/grc/blocks/variable_config.block.yml +++ b/grc/blocks/variable_config.block.yml @@ -34,8 +34,8 @@ parameters: value: ${ value } templates: - imports: import ConfigParser - var_make: 'self._${id}_config = ConfigParser.ConfigParser() + imports: import configparser + var_make: 'self._${id}_config = configparser.ConfigParser() self._${id}_config.read(${config_file}) @@ -46,7 +46,7 @@ templates: self.${id} = ${id}' callbacks: - self.set_${id}(${value}) - - "self._${id}_config = ConfigParser.ConfigParser()\nself._${id}_config.read(${config_file})\n\ + - "self._${id}_config = configparser.ConfigParser()\nself._${id}_config.read(${config_file})\n\ if not self._${id}_config.has_section(${section}):\n\tself._${id}_config.add_section(${section})\n\ self._${id}_config.set(${section}, ${option}, str(${writeback}))\nself._${id}_config.write(open(${config_file},\ \ 'w'))" diff --git a/grc/core/FlowGraph.py b/grc/core/FlowGraph.py index 6c549a46a..aff5f48bc 100644 --- a/grc/core/FlowGraph.py +++ b/grc/core/FlowGraph.py @@ -226,6 +226,7 @@ class FlowGraph(Element): variable_block.rewrite() value = eval(variable_block.value, namespace, variable_block.namespace) namespace[variable_block.name] = value + self.namespace.update(namespace) # rewrite on subsequent blocks depends on an updated self.namespace except TypeError: #Type Errors may happen, but that desn't matter as they are displayed in the gui pass except Exception: @@ -381,8 +382,7 @@ class FlowGraph(Element): block.import_data(**block_data) - self.rewrite() # TODO: Figure out why this has to be called twice to populate bus ports correctly - self.rewrite() # evaluate stuff like nports before adding connections + self.rewrite() # build the connections def verify_and_get_port(key, block, dir): diff --git a/grc/core/blocks/block.py b/grc/core/blocks/block.py index 6fd2c6866..5e46cece9 100644 --- a/grc/core/blocks/block.py +++ b/grc/core/blocks/block.py @@ -207,6 +207,7 @@ class Block(Element): def _rewrite_nports(self, ports): for port in ports: if hasattr(port, 'master_port'): # Not a master port and no left-over clones + port.dtype = port.master_port.dtype continue nports = port.multiplicity for clone in port.clones[nports-1:]: diff --git a/grc/core/blocks/embedded_python.py b/grc/core/blocks/embedded_python.py index 548739ed5..94b40580c 100644 --- a/grc/core/blocks/embedded_python.py +++ b/grc/core/blocks/embedded_python.py @@ -149,10 +149,10 @@ class EPyBlock(Block): def _update_params(self, params_in_src): param_factory = self.parent_platform.make_param params = {} - for param in list(self.params): - if hasattr(param, '__epy_param__'): - params[param.key] = param - del self.params[param.key] + for key, value in self.params.copy().items(): + if hasattr(value, '__epy_param__'): + params[key] = value + del self.params[key] for id_, value in params_in_src: try: @@ -230,12 +230,15 @@ class EPyModule(Block): to set parameters of other blocks in your flowgraph. """)} + epy_flags=Block.flags + epy_flags.set(epy_flags.SHOW_ID) + parameters_data = build_params( params_raw=[ dict(label='Code', id='source_code', dtype='_multiline_python_external', default='# this module will be imported in the into your flowgraph', hide='part') - ], have_inputs=False, have_outputs=False, flags=Block.flags, block_id=key + ], have_inputs=False, have_outputs=False, flags=epy_flags, block_id=key ) templates = MakoTemplates( diff --git a/grc/core/generator/cpp_templates/flow_graph.hpp.mako b/grc/core/generator/cpp_templates/flow_graph.hpp.mako index 9ddc0d0cb..b9f3ce60b 100644 --- a/grc/core/generator/cpp_templates/flow_graph.hpp.mako +++ b/grc/core/generator/cpp_templates/flow_graph.hpp.mako @@ -92,8 +92,8 @@ public: % if not generate_options.startswith('hb'): top_block_sptr tb; % endif - ${class_name}(${param_str}); - ~${class_name}(); + ${class_name}(${param_str}); + ~${class_name}(); % for var in parameters + variables: ${var.vtype} get_${var.name} () const; diff --git a/grc/core/generator/flow_graph.py.mako b/grc/core/generator/flow_graph.py.mako index 9b2e8478c..8da301174 100644 --- a/grc/core/generator/flow_graph.py.mako +++ b/grc/core/generator/flow_graph.py.mako @@ -190,18 +190,18 @@ gr.io_signaturev(${len(io_sigs)}, ${len(io_sigs)}, [${', '.join(size_strs)}])\ % if blk_make: ${ indent(blk_make.strip('\n')) } % endif -## % if 'alias' in blk.params and blk.params['alias'].get_evaluated(): -## (self.${blk.name}).set_block_alias("${blk.params['alias'].get_evaluated()}") -## % endif -## % if 'affinity' in blk.params and blk.params['affinity'].get_evaluated(): -## (self.${blk.name}).set_processor_affinity(${blk.params['affinity'].get_evaluated()}) -## % endif -## % if len(blk.sources) > 0 and 'minoutbuf' in blk.params and int(blk.params['minoutbuf'].get_evaluated()) > 0: -## (self.${blk.name}).set_min_output_buffer(${blk.params['minoutbuf'].get_evaluated()}) -## % endif -## % if len(blk.sources) > 0 and 'maxoutbuf' in blk.params and int(blk.params['maxoutbuf'].get_evaluated()) > 0: -## (self.${blk.name}).set_max_output_buffer(${blk.params['maxoutbuf'].get_evaluated()}) -## % endif + % if 'alias' in blk.params and blk.params['alias'].get_evaluated(): + self.${blk.name}.set_block_alias("${blk.params['alias'].get_evaluated()}") + % endif + % if 'affinity' in blk.params and blk.params['affinity'].get_evaluated(): + self.${blk.name}.set_processor_affinity(${blk.params['affinity'].get_evaluated()}) + % endif + % if len(blk.sources) > 0 and 'minoutbuf' in blk.params and int(blk.params['minoutbuf'].get_evaluated()) > 0: + self.${blk.name}.set_min_output_buffer(${blk.params['minoutbuf'].get_evaluated()}) + % endif + % if len(blk.sources) > 0 and 'maxoutbuf' in blk.params and int(blk.params['maxoutbuf'].get_evaluated()) > 0: + self.${blk.name}.set_max_output_buffer(${blk.params['maxoutbuf'].get_evaluated()}) + % endif % endfor ########################################################## @@ -209,13 +209,13 @@ gr.io_signaturev(${len(io_sigs)}, ${len(io_sigs)}, [${', '.join(size_strs)}])\ ########################################################## % if generate_options == 'bokeh_gui': if self.widget_lst: - input_t = bokehgui.BokehLayout.widgetbox(self.widget_lst) - widgetbox = bokehgui.BokehLayout.WidgetLayout(input_t) + input_t = bokehgui.bokeh_layout.widgetbox(self.widget_lst) + widgetbox = bokehgui.bokeh_layout.WidgetLayout(input_t) widgetbox.set_layout(*(${flow_graph.get_option('placement')})) list_obj = [widgetbox] + self.plot_lst else: list_obj = self.plot_lst - layout_t = bokehgui.BokehLayout.create_layout(list_obj, "${flow_graph.get_option('sizing_mode')}") + layout_t = bokehgui.bokeh_layout.create_layout(list_obj, "${flow_graph.get_option('sizing_mode')}") self.doc.add_root(layout_t) % endif diff --git a/grc/core/params/dtypes.py b/grc/core/params/dtypes.py index 093ca67dc..94a1a8d67 100644 --- a/grc/core/params/dtypes.py +++ b/grc/core/params/dtypes.py @@ -115,3 +115,10 @@ def validate_vector(param): if not all(isinstance(item, valid_types) for item in param.get_evaluated()): raise ValidateError('Expression {!r} is invalid for type {!r}.'.format( param.get_evaluated(), param.dtype)) + +@validates('gui_hint') +def validate_gui_hint(param): + try: + param.parse_gui_hint(param.value) + except Exception as e: + raise ValidateError(str(e))
\ No newline at end of file diff --git a/grc/core/utils/extract_docs.py b/grc/core/utils/extract_docs.py index 9daac3f36..606ec690f 100644 --- a/grc/core/utils/extract_docs.py +++ b/grc/core/utils/extract_docs.py @@ -198,7 +198,7 @@ class SubprocessLoader(object): """ Receive response from worker's stdout """ for line in iter(self._worker.stdout.readline, ''): try: - key, cmd, args = json.loads(line.decode('utf-8'), encoding='utf-8') + key, cmd, args = json.loads(line.decode('utf-8')) if key != self.AUTH_CODE: raise ValueError('Got wrong auth code') return cmd, args @@ -268,7 +268,7 @@ def worker_main(): # flush out to signal the main process we are ready for new commands sys.stdout.flush() for line in iter(sys.stdin.readline, ''): - code, cmd, args = json.loads(line, encoding='utf-8') + code, cmd, args = json.loads(line) try: if cmd == 'query': key, imports, make = args diff --git a/grc/gui/Actions.py b/grc/gui/Actions.py index 8497565b2..be157d90b 100644 --- a/grc/gui/Actions.py +++ b/grc/gui/Actions.py @@ -400,6 +400,12 @@ TOGGLE_HIDE_VARIABLES = actions.register("win.hide_variables", preference_name='hide_variables', default=False, ) +TOGGLE_SHOW_BLOCK_IDS = actions.register("win.show_block_ids", + label='Show All Block IDs', + tooltip='Show all the block IDs', + preference_name='show_block_ids', + default=False, +) TOGGLE_FLOW_GRAPH_VAR_EDITOR = actions.register("win.toggle_variable_editor", label='Show _Variable Editor', tooltip='Show the variable editor. Modify variables and imports in this flow graph', diff --git a/grc/gui/Application.py b/grc/gui/Application.py index 3fee7a001..a792549b3 100644 --- a/grc/gui/Application.py +++ b/grc/gui/Application.py @@ -204,6 +204,7 @@ class Application(Gtk.Application): Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR, Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR_SIDEBAR, Actions.TOGGLE_HIDE_VARIABLES, + Actions.TOGGLE_SHOW_BLOCK_IDS, ): action.set_enabled(True) if hasattr(action, 'load_from_preferences'): @@ -512,6 +513,12 @@ class Application(Gtk.Application): action.save_to_preferences() varedit.save_to_preferences() flow_graph_update() + elif action == Actions.TOGGLE_SHOW_BLOCK_IDS: + action.set_active(not action.get_active()) + active = action.get_active() + Actions.NOTHING_SELECT() + action.save_to_preferences() + flow_graph_update() elif action == Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR: # TODO: There may be issues at startup since these aren't triggered # the same was as Gtk.Actions when loading preferences. @@ -686,6 +693,7 @@ class Application(Gtk.Application): # Import the old data and mark the current as not saved new_flow_graph.import_data(previous.export_data()) flow_graph_update(new_flow_graph) + page.state_cache.save_new_state(new_flow_graph.export_data()) page.saved = False elif action == Actions.FLOW_GRAPH_SCREEN_CAPTURE: file_path, background_transparent = FileDialogs.SaveScreenShot(main, page.file_path).run() diff --git a/grc/gui/Bars.py b/grc/gui/Bars.py index 6fde43a4d..83edbb1cd 100644 --- a/grc/gui/Bars.py +++ b/grc/gui/Bars.py @@ -83,7 +83,7 @@ MENU_BAR_LIST = [ [Actions.TOGGLE_BLOCKS_WINDOW], [Actions.TOGGLE_CONSOLE_WINDOW, Actions.TOGGLE_SCROLL_LOCK, Actions.SAVE_CONSOLE, Actions.CLEAR_CONSOLE], [Actions.TOGGLE_HIDE_VARIABLES, Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR, Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR_SIDEBAR], - [Actions.TOGGLE_HIDE_DISABLED_BLOCKS, Actions.TOGGLE_AUTO_HIDE_PORT_LABELS, Actions.TOGGLE_SNAP_TO_GRID, Actions.TOGGLE_SHOW_BLOCK_COMMENTS], + [Actions.TOGGLE_HIDE_DISABLED_BLOCKS, Actions.TOGGLE_AUTO_HIDE_PORT_LABELS, Actions.TOGGLE_SNAP_TO_GRID, Actions.TOGGLE_SHOW_BLOCK_COMMENTS, Actions.TOGGLE_SHOW_BLOCK_IDS,], [Actions.TOGGLE_SHOW_CODE_PREVIEW_TAB], [Actions.ERRORS_WINDOW_DISPLAY, Actions.FIND_BLOCKS], ]), diff --git a/grc/gui/ParamWidgets.py b/grc/gui/ParamWidgets.py index 3701a7181..d168b62d7 100644 --- a/grc/gui/ParamWidgets.py +++ b/grc/gui/ParamWidgets.py @@ -230,23 +230,6 @@ class EnumParam(InputParam): def set_tooltip_text(self, text): self._input.set_tooltip_text(text) -class BoolParam(InputParam): - """Provide a switch button for Bool types.""" - - def __init__(self, *args, **kwargs): - InputParam.__init__(self, *args, **kwargs) - self._input = Gtk.Switch() - self._input.connect('state-set', self._apply_change) - self._input.connect('state-set', self._editing_callback) - self.pack_start(self._input, False, False, 0) - value = self.param.get_value() - self._input.set_active(eval(value)) - - def get_text(self): - return self._input.get_active() - - def set_tooltip_text(self, text): - self._input.set_tooltip_text(text) class EnumEntryParam(InputParam): """Provide an entry box and drop down menu for Raw Enum types.""" diff --git a/grc/gui/PropsDialog.py b/grc/gui/PropsDialog.py index 1e23e0413..6bf2745a4 100644 --- a/grc/gui/PropsDialog.py +++ b/grc/gui/PropsDialog.py @@ -180,7 +180,11 @@ class PropsDialog(Gtk.Dialog): # child.destroy() # disabled because it throws errors... # repopulate the params box box_all_valid = True + force_show_id = Actions.TOGGLE_SHOW_BLOCK_IDS.get_active() + for param in self._block.params.values(): + if force_show_id and param.dtype == 'id': + param.hide = 'none' # todo: why do we even rebuild instead of really hiding params? if param.category != category or param.hide == 'all': continue @@ -212,11 +216,12 @@ class PropsDialog(Gtk.Dialog): buf.delete(buf.get_start_iter(), buf.get_end_iter()) pos = buf.get_end_iter() - # Add link to wiki page for this block, at the top - note = "Wiki Page for this Block: " - prefix = self._config.wiki_block_docs_url_prefix - suffix = self._block.label.replace(" ", "_") - buf.insert(pos, note + prefix + suffix + '\n\n') + # Add link to wiki page for this block, at the top, as long as it's not an OOT block + if self._block.category[0] == "Core": + note = "Wiki Page for this Block: " + prefix = self._config.wiki_block_docs_url_prefix + suffix = self._block.label.replace(" ", "_") + buf.insert(pos, note + prefix + suffix + '\n\n') docstrings = self._block.documentation.copy() if not docstrings: diff --git a/grc/gui/canvas/block.py b/grc/gui/canvas/block.py index e55c76f2c..981077440 100644 --- a/grc/gui/canvas/block.py +++ b/grc/gui/canvas/block.py @@ -165,11 +165,13 @@ class Block(CoreBlock, Drawable): ) ) title_width, title_height = title_layout.get_size() + + force_show_id = Actions.TOGGLE_SHOW_BLOCK_IDS.get_active() # update the params layout if not self.is_dummy_block: markups = [param.format_block_surface_markup() - for param in self.params.values() if param.hide not in ('all', 'part')] + for param in self.params.values() if (param.hide not in ('all', 'part') or (param.dtype == 'id' and force_show_id))] else: markups = ['<span font_desc="{font}"><b>key: </b>{key}</span>'.format(font=PARAM_FONT, key=self.key)] @@ -327,6 +329,17 @@ class Block(CoreBlock, Drawable): )) return tuple(extent) + def get_extents_comment(self): + x, y = self.coordinate + if not self._comment_layout: + return x, y, x, y + if self.is_horizontal(): + y += self.height + BLOCK_LABEL_PADDING + else: + x += self.height + BLOCK_LABEL_PADDING + w, h = self._comment_layout.get_pixel_size() + return x, y, x + w, y + h + ############################################## # Controller Modify ############################################## diff --git a/grc/gui/canvas/flowgraph.py b/grc/gui/canvas/flowgraph.py index 248ea3ba2..9657930f1 100644 --- a/grc/gui/canvas/flowgraph.py +++ b/grc/gui/canvas/flowgraph.py @@ -804,9 +804,15 @@ class FlowGraph(CoreFlowgraph, Drawable): return redraw def get_extents(self): - extent = 100000, 100000, 0, 0 - for element in self._elements_to_draw: - extent = (min_or_max(xy, e_xy) for min_or_max, xy, e_xy in zip( - (min, min, max, max), extent, element.get_extents() - )) + show_comments = Actions.TOGGLE_SHOW_BLOCK_COMMENTS.get_active() + def sub_extents(): + for element in self._elements_to_draw: + yield element.get_extents() + if element.is_block and show_comments and element.enabled: + yield element.get_extents_comment() + + extent = 10000000, 10000000, 0, 0 + cmps = (min, min, max, max) + for sub_extent in sub_extents(): + extent = [cmp(xy, e_xy) for cmp, xy, e_xy in zip(cmps, extent, sub_extent)] return tuple(extent) diff --git a/grc/gui/canvas/param.py b/grc/gui/canvas/param.py index 2ff714c60..5777423c6 100644 --- a/grc/gui/canvas/param.py +++ b/grc/gui/canvas/param.py @@ -46,9 +46,6 @@ class Param(CoreParam): elif dtype == 'enum': input_widget_cls = ParamWidgets.EnumParam - elif dtype == 'bool': - input_widget_cls = ParamWidgets.BoolParam - elif self.options: input_widget_cls = ParamWidgets.EnumEntryParam diff --git a/grc/tests/test_block_flags.py b/grc/tests/test_block_flags.py index c3dea0374..9969eeb4e 100644 --- a/grc/tests/test_block_flags.py +++ b/grc/tests/test_block_flags.py @@ -26,4 +26,4 @@ def test_extend(): f.set(u'b') assert isinstance(f, Flags) - assert str(f) == 'a, b' + assert f.data == {'a', 'b'} diff --git a/volk b/volk -Subproject 1299d72c396a88fd2679adfd7a919ac00d2cf67 +Subproject f04a46f18308771b5ebf46292bf0fe6918578b3 |