commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r5024 - in gnuradio/branches/features/inband-usb: gnur


From: eb
Subject: [Commit-gnuradio] r5024 - in gnuradio/branches/features/inband-usb: gnuradio-core/src/lib/gengen gr-atsc/src/lib mblock/src/lib pmt/src/lib
Date: Mon, 16 Apr 2007 15:37:52 -0600 (MDT)

Author: eb
Date: 2007-04-16 15:37:52 -0600 (Mon, 16 Apr 2007)
New Revision: 5024

Modified:
   
gnuradio/branches/features/inband-usb/gnuradio-core/src/lib/gengen/gr_sig_source_X.cc.t
   gnuradio/branches/features/inband-usb/gr-atsc/src/lib/atsc_bit_timing_loop.cc
   
gnuradio/branches/features/inband-usb/gr-atsc/src/lib/atsc_field_sync_demux.cc
   gnuradio/branches/features/inband-usb/gr-atsc/src/lib/atsc_viterbi_decoder.cc
   gnuradio/branches/features/inband-usb/mblock/src/lib/mb_message.cc
   gnuradio/branches/features/inband-usb/mblock/src/lib/mb_message.h
   gnuradio/branches/features/inband-usb/pmt/src/lib/pmt.cc
   gnuradio/branches/features/inband-usb/pmt/src/lib/pmt.h
   gnuradio/branches/features/inband-usb/pmt/src/lib/pmt_int.h
   gnuradio/branches/features/inband-usb/pmt/src/lib/pmt_serialize.cc
Log:
merged eb/ibu -r4994:5023 into features/inband

Modified: 
gnuradio/branches/features/inband-usb/gnuradio-core/src/lib/gengen/gr_sig_source_X.cc.t
===================================================================
--- 
gnuradio/branches/features/inband-usb/gnuradio-core/src/lib/gengen/gr_sig_source_X.cc.t
     2007-04-16 21:30:25 UTC (rev 5023)
+++ 
gnuradio/branches/features/inband-usb/gnuradio-core/src/lib/gengen/gr_sig_source_X.cc.t
     2007-04-16 21:37:52 UTC (rev 5024)
@@ -181,19 +181,19 @@
   /* The triangle wave rises from -PI to 0 and falls from 0 to PI.     */ 
   case GR_TRI_WAVE:    
     for (int i = 0; i < noutput_items; i++){
-      t = (@TYPE@) d_ampl*d_nco.get_phase()/M_PI;
-        if (d_nco.get_phase() < 0)
-          optr[i] = t + d_ampl + d_offset;
-        else
-          optr[i] = -1*t + d_ampl + d_offset;
-        d_nco.step();
+      double t = d_ampl*d_nco.get_phase()/M_PI;
+      if (d_nco.get_phase() < 0)
+       optr[i] = static_cast<@TYPE@>(t + d_ampl + d_offset);
+      else
+       optr[i] = static_cast<@TYPE@>(-1*t + d_ampl + d_offset);
+      d_nco.step();
     }
     break;
        
   /* The saw tooth wave rises from -PI to PI.  */
   case GR_SAW_WAVE:    
     for (int i = 0; i < noutput_items; i++){
-      t = (@TYPE@) d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/2 + d_offset;
+      t = static_cast<@TYPE@>(d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/2 + 
d_offset);
       optr[i] = t;             
       d_nco.step();
     }

Modified: 
gnuradio/branches/features/inband-usb/gr-atsc/src/lib/atsc_bit_timing_loop.cc
===================================================================
--- 
gnuradio/branches/features/inband-usb/gr-atsc/src/lib/atsc_bit_timing_loop.cc   
    2007-04-16 21:30:25 UTC (rev 5023)
+++ 
gnuradio/branches/features/inband-usb/gr-atsc/src/lib/atsc_bit_timing_loop.cc   
    2007-04-16 21:37:52 UTC (rev 5024)
@@ -54,7 +54,7 @@
 {
   unsigned ninputs = ninput_items_required.size();
   for (unsigned i = 0; i < ninputs; i++)
-    ninput_items_required[i] = noutput_items * d_rx_clock_to_symbol_freq + 
1500 - 1;
+    ninput_items_required[i] = static_cast<int>(noutput_items * 
d_rx_clock_to_symbol_freq) + 1500 - 1;
 
   inputs0_size = noutput_items * d_rx_clock_to_symbol_freq + 1500 - 1;
   inputs0_index = d_next_input;

Modified: 
gnuradio/branches/features/inband-usb/gr-atsc/src/lib/atsc_field_sync_demux.cc
===================================================================
--- 
gnuradio/branches/features/inband-usb/gr-atsc/src/lib/atsc_field_sync_demux.cc  
    2007-04-16 21:30:25 UTC (rev 5023)
+++ 
gnuradio/branches/features/inband-usb/gr-atsc/src/lib/atsc_field_sync_demux.cc  
    2007-04-16 21:37:52 UTC (rev 5024)
@@ -32,10 +32,12 @@
 #include <atsci_syminfo.h>
 #include <stdio.h>
 #include <assert.h>
-#include <iostream.h>
+#include <iostream>
 
-using std::abs;
+using std::cerr;
+using std::endl;
 
+
 static const int        DEC = ATSC_DATA_SEGMENT_LENGTH; // nominal decimation 
factor
 
 

Modified: 
gnuradio/branches/features/inband-usb/gr-atsc/src/lib/atsc_viterbi_decoder.cc
===================================================================
--- 
gnuradio/branches/features/inband-usb/gr-atsc/src/lib/atsc_viterbi_decoder.cc   
    2007-04-16 21:30:25 UTC (rev 5023)
+++ 
gnuradio/branches/features/inband-usb/gr-atsc/src/lib/atsc_viterbi_decoder.cc   
    2007-04-16 21:37:52 UTC (rev 5024)
@@ -27,8 +27,10 @@
 #include <atsc_viterbi_decoder.h>
 #include <gr_io_signature.h>
 #include <atsc_consts.h>
-#include <iostream.h>
+#include <iostream>
 
+using std::cerr;
+using std::endl;
 
 atsc_viterbi_decoder_sptr
 atsc_make_viterbi_decoder()

Modified: gnuradio/branches/features/inband-usb/mblock/src/lib/mb_message.cc
===================================================================
--- gnuradio/branches/features/inband-usb/mblock/src/lib/mb_message.cc  
2007-04-16 21:30:25 UTC (rev 5023)
+++ gnuradio/branches/features/inband-usb/mblock/src/lib/mb_message.cc  
2007-04-16 21:37:52 UTC (rev 5024)
@@ -23,7 +23,20 @@
 #include <config.h>
 #endif
 #include <mb_message.h>
+#include <boost/pool/pool.hpp>
+#include <boost/pool/singleton_pool.hpp>
+#include <stdio.h>
 
+static const int CACHE_LINE_SIZE = 64;         // good guess
+
+#define ROUNDUP(x, stride) ((((x) + (stride) - 1)/(stride)) * (stride))
+
+struct msg_pool_tag {};
+
+typedef boost::singleton_pool<msg_pool_tag,
+                             ROUNDUP(sizeof(mb_message), CACHE_LINE_SIZE)> 
msg_pool;
+
+
 mb_message_sptr
 mb_make_message(pmt_t signal, pmt_t data, pmt_t metadata, mb_pri_t priority)
 {
@@ -53,3 +66,23 @@
   
   return os;
 }
+
+
+#if 1
+void *
+mb_message::operator new(size_t size)
+{
+  void *p = msg_pool::malloc();
+
+  // FIXME fix alignment.
+  // fprintf(stderr, "mb_message::new p = %p\n", p);
+  // assert((reinterpret_cast<intptr_t>(p) & (CACHE_LINE_SIZE - 1)) == 0);
+  return p;
+}
+
+void
+mb_message::operator delete(void *p, size_t size)
+{
+  msg_pool::free(p);
+}
+#endif

Modified: gnuradio/branches/features/inband-usb/mblock/src/lib/mb_message.h
===================================================================
--- gnuradio/branches/features/inband-usb/mblock/src/lib/mb_message.h   
2007-04-16 21:30:25 UTC (rev 5023)
+++ gnuradio/branches/features/inband-usb/mblock/src/lib/mb_message.h   
2007-04-16 21:37:52 UTC (rev 5024)
@@ -67,6 +67,10 @@
   pmt_t port_id() const { return d_port_id; }
 
   void set_port_id(pmt_t port_id){ d_port_id = port_id; }
+
+  void *operator new(size_t);
+  void operator delete(void *, size_t);
+
 };
 
 std::ostream& operator<<(std::ostream& os, const mb_message &msg);

Modified: gnuradio/branches/features/inband-usb/pmt/src/lib/pmt.cc
===================================================================
--- gnuradio/branches/features/inband-usb/pmt/src/lib/pmt.cc    2007-04-16 
21:30:25 UTC (rev 5023)
+++ gnuradio/branches/features/inband-usb/pmt/src/lib/pmt.cc    2007-04-16 
21:37:52 UTC (rev 5024)
@@ -26,7 +26,41 @@
 #include <vector>
 #include <pmt.h>
 #include "pmt_int.h"
+#include <boost/pool/pool.hpp>
+#include <boost/pool/singleton_pool.hpp>
+#include <stdio.h>
 
+
+static const int CACHE_LINE_SIZE = 64;         // good guess
+
+#define ROUNDUP(x, stride) ((((x) + (stride) - 1)/(stride)) * (stride))
+
+struct pmt_pool_tag {};
+
+typedef boost::singleton_pool<pmt_pool_tag,
+                             ROUNDUP(sizeof(pmt_pair), CACHE_LINE_SIZE)> 
msg_pool;
+
+
+#if 1
+void *
+pmt_base::operator new(size_t size)
+{
+  void *p = msg_pool::malloc();
+
+  // FIXME fix alignment.
+  // fprintf(stderr, "pmt_base::new p = %p\n", p);
+  // assert((reinterpret_cast<intptr_t>(p) & (CACHE_LINE_SIZE - 1)) == 0);
+  return p;
+}
+
+void
+pmt_base::operator delete(void *p, size_t size)
+{
+  msg_pool::free(p);
+}
+#endif
+
+
 pmt_base::~pmt_base()
 {
   // nop -- out of line virtual destructor
@@ -911,3 +945,20 @@
 {
   return pmt_eq(obj, PMT_EOF);
 }
+
+void
+pmt_dump_sizeof()
+{
+  printf("sizeof(pmt_t)              = %3zd\n", sizeof(pmt_t));
+  printf("sizeof(pmt_base)           = %3zd\n", sizeof(pmt_base));
+  printf("sizeof(pmt_bool)           = %3zd\n", sizeof(pmt_bool));
+  printf("sizeof(pmt_symbol)         = %3zd\n", sizeof(pmt_symbol));
+  printf("sizeof(pmt_integer)        = %3zd\n", sizeof(pmt_integer));
+  printf("sizeof(pmt_real)           = %3zd\n", sizeof(pmt_real));
+  printf("sizeof(pmt_complex)        = %3zd\n", sizeof(pmt_complex));
+  printf("sizeof(pmt_null)           = %3zd\n", sizeof(pmt_null));
+  printf("sizeof(pmt_pair)           = %3zd\n", sizeof(pmt_pair));
+  printf("sizeof(pmt_vector)         = %3zd\n", sizeof(pmt_vector));
+  printf("sizeof(pmt_dict)           = %3zd\n", sizeof(pmt_dict));
+  printf("sizeof(pmt_uniform_vector) = %3zd\n", sizeof(pmt_uniform_vector));
+}

Modified: gnuradio/branches/features/inband-usb/pmt/src/lib/pmt.h
===================================================================
--- gnuradio/branches/features/inband-usb/pmt/src/lib/pmt.h     2007-04-16 
21:30:25 UTC (rev 5023)
+++ gnuradio/branches/features/inband-usb/pmt/src/lib/pmt.h     2007-04-16 
21:37:52 UTC (rev 5024)
@@ -632,4 +632,7 @@
  */
 pmt_t pmt_deserialize(std::streambuf &source);
 
+
+void pmt_dump_sizeof();        // debugging
+
 #endif /* INCLUDED_PMT_H */

Modified: gnuradio/branches/features/inband-usb/pmt/src/lib/pmt_int.h
===================================================================
--- gnuradio/branches/features/inband-usb/pmt/src/lib/pmt_int.h 2007-04-16 
21:30:25 UTC (rev 5023)
+++ gnuradio/branches/features/inband-usb/pmt/src/lib/pmt_int.h 2007-04-16 
21:37:52 UTC (rev 5024)
@@ -62,6 +62,8 @@
   virtual bool is_c32vector() const { return false; }
   virtual bool is_c64vector() const { return false; }
 
+  void *operator new(size_t);
+  void operator delete(void *, size_t);
 };
 
 class pmt_bool : public pmt_base

Modified: gnuradio/branches/features/inband-usb/pmt/src/lib/pmt_serialize.cc
===================================================================
--- gnuradio/branches/features/inband-usb/pmt/src/lib/pmt_serialize.cc  
2007-04-16 21:30:25 UTC (rev 5023)
+++ gnuradio/branches/features/inband-usb/pmt/src/lib/pmt_serialize.cc  
2007-04-16 21:37:52 UTC (rev 5024)
@@ -57,6 +57,7 @@
   return sb.sputc((i >> 0) & 0xff) != std::streambuf::traits_type::eof();
 }
 
+#if 0
 // always writes big-endian
 static bool
 serialize_untagged_u64(uint64_t i, std::streambuf &sb)
@@ -70,6 +71,7 @@
   sb.sputc((i >>  8) & 0xff);
   return sb.sputc((i >> 0) & 0xff) != std::streambuf::traits_type::eof();
 }
+#endif
 
 // ----------------------------------------------------------------
 // input primitives
@@ -128,6 +130,7 @@
   return t != std::streambuf::traits_type::eof();
 }
 
+#if 0
 // always reads big-endian
 static bool
 deserialize_untagged_u64(uint64_t *ip, std::streambuf &sb)
@@ -156,6 +159,7 @@
   *ip = i;
   return t != std::streambuf::traits_type::eof();
 }
+#endif
 
 /*
  * Write portable byte-serial representation of \p obj to \p sb
@@ -203,7 +207,7 @@
     if (pmt_is_integer(obj)){
       long i = pmt_to_long(obj);
       if (sizeof(long) > 4){
-       if (i < -2147483648 || i > 2147483647)
+       if (i < -2147483647 || i > 2147483647)
          throw pmt_notimplemented("pmt_serialize (64-bit integers)", obj);
       }
       ok = serialize_untagged_u8(PST_INT32, sb);
@@ -241,10 +245,10 @@
 pmt_deserialize(std::streambuf &sb)
 {
   uint8_t      tag;
-  uint8_t      u8;
+  //uint8_t    u8;
   uint16_t     u16;
   uint32_t     u32;
-  uint32_t     u64;
+  //uint32_t   u64;
   static char   tmpbuf[1024];
 
   if (!deserialize_untagged_u8(&tag, sb))





reply via email to

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