[hamradio-commits] [gnss-sdr] 10/44: Adding missing files

Carles Fernandez carles_fernandez-guest at moszumanska.debian.org
Sun Feb 15 15:32:19 UTC 2015


This is an automated email from the git hooks/post-receive script.

carles_fernandez-guest pushed a commit to branch next
in repository gnss-sdr.

commit f29c0c2467a3af3865e8b3926ec8d6688247f450
Author: Carles Fernandez <carles.fernandez at gmail.com>
Date:   Tue Feb 3 19:41:47 2015 +0100

    Adding missing files
---
 .../data_type_adapter/adapters/ishort_to_cshort.cc | 113 +++++++++++++++++++++
 .../data_type_adapter/adapters/ishort_to_cshort.h  |  92 +++++++++++++++++
 .../interleaved_short_to_complex_short.cc          |  71 +++++++++++++
 .../interleaved_short_to_complex_short.h           |  61 +++++++++++
 4 files changed, 337 insertions(+)

diff --git a/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc b/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc
new file mode 100644
index 0000000..9219775
--- /dev/null
+++ b/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc
@@ -0,0 +1,113 @@
+/*!
+ * \file ishort_to_cshort.cc
+ * \brief Adapts an I/Q interleaved short integer (16 bits) sample stream
+ * to a gr_complex (float) stream
+ * \author Carles Fernandez-Prades, cfernandez(at)cttc.es
+ *
+ * -------------------------------------------------------------------------
+ *
+ * Copyright (C) 2010-2015  (see AUTHORS file for a list of contributors)
+ *
+ * GNSS-SDR is a software defined Global Navigation
+ *          Satellite Systems receiver
+ *
+ * This file is part of GNSS-SDR.
+ *
+ * GNSS-SDR 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 of the License, or
+ * (at your option) any later version.
+ *
+ * GNSS-SDR 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 GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * -------------------------------------------------------------------------
+ */
+
+#include "ishort_to_cshort.h"
+#include <glog/logging.h>
+#include <volk/volk.h>
+#include "configuration_interface.h"
+
+using google::LogMessage;
+
+IshortToCshort::IshortToCshort(ConfigurationInterface* configuration, std::string role,
+        unsigned int in_streams, unsigned int out_streams,
+        boost::shared_ptr<gr::msg_queue> queue) :
+                config_(configuration), role_(role), in_streams_(in_streams),
+                out_streams_(out_streams), queue_(queue)
+{
+
+    std::string default_input_item_type = "short";
+    std::string default_output_item_type = "cshort";
+    std::string default_dump_filename = "../data/input_filter.dat";
+
+    DLOG(INFO) << "role " << role_;
+
+    input_item_type_ = config_->property(role_ + ".input_item_type",
+                                         default_input_item_type);
+
+    dump_ = config_->property(role_ + ".dump", false);
+    dump_filename_ = config_->property(role_ + ".dump_filename",
+                                       default_dump_filename);
+
+    size_t item_size = sizeof(lv_16sc_t);
+
+    interleaved_short_to_complex_short_ = make_interleaved_short_to_complex_short();
+
+    DLOG(INFO) << "data_type_adapter_(" << interleaved_short_to_complex_short_->unique_id() << ")";
+
+    if (dump_)
+        {
+            DLOG(INFO) << "Dumping output into file " << dump_filename_;
+            file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str());
+        }
+
+}
+
+
+IshortToCshort::~IshortToCshort()
+{}
+
+
+void IshortToCshort::connect(gr::top_block_sptr top_block)
+{
+    if (dump_)
+        {
+            top_block->connect(interleaved_short_to_complex_short_, 0, file_sink_, 0);
+        }
+    else
+        {
+            DLOG(INFO) << "Nothing to connect internally";
+        }
+}
+
+
+void IshortToCshort::disconnect(gr::top_block_sptr top_block)
+{
+    if (dump_)
+        {
+            top_block->disconnect(interleaved_short_to_complex_short_, 0, file_sink_, 0);
+        }
+}
+
+
+
+gr::basic_block_sptr IshortToCshort::get_left_block()
+{
+    return interleaved_short_to_complex_short_;
+}
+
+
+
+gr::basic_block_sptr IshortToCshort::get_right_block()
+{
+    return interleaved_short_to_complex_short_;
+}
+
+
diff --git a/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.h b/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.h
new file mode 100644
index 0000000..0fb07ef
--- /dev/null
+++ b/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.h
@@ -0,0 +1,92 @@
+/*!
+ * \file ishort_to_cshort.h
+ * \brief Adapts a short interleaved sample stream into a std::complex<short> stream
+ * \author Carles Fernandez-Prades, cfernandez(at)cttc.es
+ *
+ * -------------------------------------------------------------------------
+ *
+ * Copyright (C) 2010-2015  (see AUTHORS file for a list of contributors)
+ *
+ * GNSS-SDR is a software defined Global Navigation
+ *          Satellite Systems receiver
+ *
+ * This file is part of GNSS-SDR.
+ *
+ * GNSS-SDR 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 of the License, or
+ * (at your option) any later version.
+ *
+ * GNSS-SDR 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 GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * -------------------------------------------------------------------------
+ */
+
+#ifndef GNSS_SDR_ISHORT_TO_CSHORT_H_
+#define GNSS_SDR_ISHORT_TO_CSHORT_H_
+
+#include <string>
+#include <gnuradio/blocks/file_sink.h>
+#include <gnuradio/msg_queue.h>
+#include "gnss_synchro.h"
+#include "gnss_block_interface.h"
+#include "interleaved_short_to_complex_short.h"
+
+
+
+class ConfigurationInterface;
+
+/*!
+ * \brief Adapts a short integer (16 bits) interleaved sample stream into a std::complex<short> stream
+ *
+ */
+class IshortToCshort: public GNSSBlockInterface
+{
+public:
+    IshortToCshort(ConfigurationInterface* configuration,
+            std::string role, unsigned int in_streams,
+            unsigned int out_streams, boost::shared_ptr<gr::msg_queue> queue);
+
+    virtual ~IshortToCshort();
+
+    std::string role()
+    {
+        return role_;
+    }
+    //! Returns "IshortToCshort"
+    std::string implementation()
+    {
+        return "IshortToCshort";
+    }
+    size_t item_size()
+    {
+        return 0;
+    }
+
+    void connect(gr::top_block_sptr top_block);
+    void disconnect(gr::top_block_sptr top_block);
+    gr::basic_block_sptr get_left_block();
+    gr::basic_block_sptr get_right_block();
+
+private:
+    interleaved_short_to_complex_short_sptr interleaved_short_to_complex_short_;
+    ConfigurationInterface* config_;
+    bool dump_;
+    std::string dump_filename_;
+    std::string input_item_type_;
+    std::string output_item_type_;
+    std::string role_;
+    unsigned int in_streams_;
+    unsigned int out_streams_;
+    boost::shared_ptr<gr::msg_queue> queue_;
+    gr::blocks::file_sink::sptr file_sink_;
+};
+
+#endif
+
diff --git a/src/algorithms/data_type_adapter/gnuradio_blocks/interleaved_short_to_complex_short.cc b/src/algorithms/data_type_adapter/gnuradio_blocks/interleaved_short_to_complex_short.cc
new file mode 100644
index 0000000..5b09b8f
--- /dev/null
+++ b/src/algorithms/data_type_adapter/gnuradio_blocks/interleaved_short_to_complex_short.cc
@@ -0,0 +1,71 @@
+/*!
+ * \file interleaved_short_to_complex_short.cc
+ * \brief Adapts a short (16-bits) interleaved sample stream into a std::complex<short> stream
+ * \author Carles Fernandez Prades, cfernandez(at)cttc.es
+ *
+ * -------------------------------------------------------------------------
+ *
+ * Copyright (C) 2010-2015  (see AUTHORS file for a list of contributors)
+ *
+ * GNSS-SDR is a software defined Global Navigation
+ *          Satellite Systems receiver
+ *
+ * This file is part of GNSS-SDR.
+ *
+ * GNSS-SDR 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 of the License, or
+ * (at your option) any later version.
+ *
+ * GNSS-SDR 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 GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * -------------------------------------------------------------------------
+ */
+
+
+#include "interleaved_short_to_complex_short.h"
+#include <gnuradio/io_signature.h>
+#include <volk/volk.h>
+
+
+interleaved_short_to_complex_short_sptr make_interleaved_short_to_complex_short()
+{
+    return interleaved_short_to_complex_short_sptr(new interleaved_short_to_complex_short());
+}
+
+
+
+interleaved_short_to_complex_short::interleaved_short_to_complex_short() : sync_decimator("interleaved_short_to_complex_short",
+                        gr::io_signature::make (1, 1, sizeof(int16_t)),
+                        gr::io_signature::make (1, 1, sizeof(lv_16sc_t)), // lv_16sc_t is a Volk's typedef for std::complex<short int>
+                        2)
+{
+    const int alignment_multiple = volk_get_alignment() / sizeof(lv_16sc_t);
+    set_alignment(std::max(1, alignment_multiple));
+}
+
+
+int interleaved_short_to_complex_short::work(int noutput_items,
+        gr_vector_const_void_star &input_items,
+        gr_vector_void_star &output_items)
+{
+    const int16_t *in = (const int16_t *) input_items[0];
+    lv_16sc_t *out = (lv_16sc_t *) output_items[0];
+    // This could be put into a Volk kernel
+    int16_t real_part;
+    int16_t imag_part;
+    for(unsigned int number = 0; number < 2 * noutput_items; number++)
+        {
+            // lv_cmake(r, i) defined at volk/volk_complex.h
+            real_part = *in++;
+            imag_part = *in++;
+            *out++ = lv_cmake(real_part, imag_part);
+        }
+    return noutput_items;
+}
diff --git a/src/algorithms/data_type_adapter/gnuradio_blocks/interleaved_short_to_complex_short.h b/src/algorithms/data_type_adapter/gnuradio_blocks/interleaved_short_to_complex_short.h
new file mode 100644
index 0000000..f3f92b9
--- /dev/null
+++ b/src/algorithms/data_type_adapter/gnuradio_blocks/interleaved_short_to_complex_short.h
@@ -0,0 +1,61 @@
+/*!
+ * \file interleaved_short_to_complex_short.h
+ * \brief Adapts a short (16-bits) interleaved sample stream into a std::complex<short> stream
+ * \author Carles Fernandez Prades, cfernandez(at)cttc.es
+ *
+ * -------------------------------------------------------------------------
+ *
+ * Copyright (C) 2010-2015  (see AUTHORS file for a list of contributors)
+ *
+ * GNSS-SDR is a software defined Global Navigation
+ *          Satellite Systems receiver
+ *
+ * This file is part of GNSS-SDR.
+ *
+ * GNSS-SDR 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 of the License, or
+ * (at your option) any later version.
+ *
+ * GNSS-SDR 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 GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * -------------------------------------------------------------------------
+ */
+
+#ifndef GNSS_SDR_INTERLEAVED_SHORT_TO_COMPLEX_SHORT_H_
+#define GNSS_SDR_INTERLEAVED_SHORT_TO_COMPLEX_SHORT_H_
+
+
+#include <string>
+#include <boost/shared_ptr.hpp>
+#include <gnuradio/sync_decimator.h>
+
+class interleaved_short_to_complex_short;
+
+typedef boost::shared_ptr<interleaved_short_to_complex_short> interleaved_short_to_complex_short_sptr;
+
+interleaved_short_to_complex_short_sptr make_interleaved_short_to_complex_short();
+
+/*!
+ * \brief This class adapts a short (16-bits) interleaved sample stream
+ * into a std::complex<short> stream
+ */
+class interleaved_short_to_complex_short : public gr::sync_decimator
+{
+private:
+    friend interleaved_short_to_complex_short_sptr make_interleaved_short_to_complex_short();
+public:
+    interleaved_short_to_complex_short();
+
+    int work(int noutput_items,
+            gr_vector_const_void_star &input_items,
+            gr_vector_void_star &output_items);
+};
+
+#endif

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/gnss-sdr.git



More information about the pkg-hamradio-commits mailing list