commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 07/14: blocks: add vector output option par


From: git
Subject: [Commit-gnuradio] [gnuradio] 07/14: blocks: add vector output option param to complex_to_interleaved_short to match interleaved_short_to_complex
Date: Fri, 9 May 2014 22:28:43 +0000 (UTC)

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

jcorgan pushed a commit to branch master
in repository gnuradio.

commit eb4602a727bcb9874ebd7666438fb3eebb244e8b
Author: Tim O'Shea <address@hidden>
Date:   Thu May 8 09:32:53 2014 -0400

    blocks: add vector output option param to complex_to_interleaved_short to 
match interleaved_short_to_complex
---
 gr-blocks/grc/blocks_complex_to_interleaved_short.xml | 19 ++++++++++++++++++-
 .../gnuradio/blocks/complex_to_interleaved_short.h    |  2 +-
 gr-blocks/lib/complex_to_interleaved_short_impl.cc    | 18 ++++++++++--------
 gr-blocks/lib/complex_to_interleaved_short_impl.h     |  4 +++-
 4 files changed, 32 insertions(+), 11 deletions(-)

diff --git a/gr-blocks/grc/blocks_complex_to_interleaved_short.xml 
b/gr-blocks/grc/blocks_complex_to_interleaved_short.xml
index 43b55f3..7f69d6b 100644
--- a/gr-blocks/grc/blocks_complex_to_interleaved_short.xml
+++ b/gr-blocks/grc/blocks_complex_to_interleaved_short.xml
@@ -8,7 +8,23 @@
        <name>Complex To IShort</name>
        <key>blocks_complex_to_interleaved_short</key>
        <import>from gnuradio import blocks</import>
-       <make>blocks.complex_to_interleaved_short()</make>
+       <make>blocks.complex_to_interleaved_short($vector_output)</make>
+    <param>
+        <name>Vector Output</name>
+        <key>vector_output</key>
+        <value>False</value>
+        <type>enum</type>
+        <option>
+            <name>No</name>
+            <key>False</key>
+            <opt>vlen:1</opt>
+        </option>
+        <option>
+            <name>Yes</name>
+            <key>True</key>
+            <opt>vlen:2</opt>
+        </option>
+    </param>
        <sink>
                <name>in</name>
                <type>complex</type>
@@ -16,5 +32,6 @@
        <source>
                <name>out</name>
                <type>short</type>
+        <vlen>$vector_output.vlen</vlen>
        </source>
 </block>
diff --git a/gr-blocks/include/gnuradio/blocks/complex_to_interleaved_short.h 
b/gr-blocks/include/gnuradio/blocks/complex_to_interleaved_short.h
index 69b88e5..d68482c 100644
--- a/gr-blocks/include/gnuradio/blocks/complex_to_interleaved_short.h
+++ b/gr-blocks/include/gnuradio/blocks/complex_to_interleaved_short.h
@@ -51,7 +51,7 @@ namespace gr {
       /*!
        * Build a complex to interleaved shorts block.
        */
-      static sptr make();
+      static sptr make(bool vector=false);
     };
 
   } /* namespace blocks */
diff --git a/gr-blocks/lib/complex_to_interleaved_short_impl.cc 
b/gr-blocks/lib/complex_to_interleaved_short_impl.cc
index 8714636..7b8ac90 100644
--- a/gr-blocks/lib/complex_to_interleaved_short_impl.cc
+++ b/gr-blocks/lib/complex_to_interleaved_short_impl.cc
@@ -30,16 +30,17 @@
 namespace gr {
   namespace blocks {
 
-    complex_to_interleaved_short::sptr complex_to_interleaved_short::make()
+    complex_to_interleaved_short::sptr complex_to_interleaved_short::make(bool 
vector)
     {
-      return gnuradio::get_initial_sptr(new 
complex_to_interleaved_short_impl());
+      return gnuradio::get_initial_sptr(new 
complex_to_interleaved_short_impl(vector));
     }
 
-    complex_to_interleaved_short_impl::complex_to_interleaved_short_impl()
+    complex_to_interleaved_short_impl::complex_to_interleaved_short_impl(bool 
vector)
       : sync_interpolator("complex_to_interleaved_short",
                             io_signature::make (1, 1, sizeof(gr_complex)),
-                            io_signature::make (1, 1, sizeof(short)),
-                            2)
+                            io_signature::make (1, 1, 
vector?2*sizeof(short):sizeof(short)),
+                            vector?1:2),
+        d_vector(vector)
     {
     }
 
@@ -51,9 +52,10 @@ namespace gr {
       const gr_complex *in = (const gr_complex *) input_items[0];
       short *out = (short *) output_items[0];
       
-      for (int i = 0; i < noutput_items/2; i++){
-       *out++ = (short) lrintf(in[i].real());  // FIXME saturate?
-       *out++ = (short) lrintf(in[i].imag());
+      int npairs = (d_vector?noutput_items:noutput_items/2);
+      for (int i = 0; i < npairs; i++){
+        *out++ = (short) lrintf(in[i].real()); // FIXME saturate?
+        *out++ = (short) lrintf(in[i].imag());
       }
       
       return noutput_items;
diff --git a/gr-blocks/lib/complex_to_interleaved_short_impl.h 
b/gr-blocks/lib/complex_to_interleaved_short_impl.h
index 7bcea95..d166c56 100644
--- a/gr-blocks/lib/complex_to_interleaved_short_impl.h
+++ b/gr-blocks/lib/complex_to_interleaved_short_impl.h
@@ -30,8 +30,10 @@ namespace gr {
 
     class BLOCKS_API complex_to_interleaved_short_impl : public 
complex_to_interleaved_short
     {
+    private:
+      bool d_vector;
     public:
-      complex_to_interleaved_short_impl();
+      complex_to_interleaved_short_impl(bool vector);
 
       int work(int noutput_items,
               gr_vector_const_void_star &input_items,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]