commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r4542 - gnuradio/branches/developers/n4hy/ofdm/gnuradi


From: matt
Subject: [Commit-gnuradio] r4542 - gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general
Date: Tue, 20 Feb 2007 14:03:59 -0700 (MST)

Author: matt
Date: 2007-02-20 14:03:59 -0700 (Tue, 20 Feb 2007)
New Revision: 4542

Modified:
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_sampler.cc
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_sampler.h
   
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_sampler.i
Log:
reworked


Modified: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_sampler.cc
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_sampler.cc
     2007-02-20 20:49:54 UTC (rev 4541)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_sampler.cc
     2007-02-20 21:03:59 UTC (rev 4542)
@@ -30,28 +30,25 @@
 
 gr_ofdm_sampler_sptr
 gr_make_ofdm_sampler (unsigned int fft_length, 
-                     unsigned int symbol_length, 
-                     int delay)
+                     unsigned int symbol_length)
 {
-  return gr_ofdm_sampler_sptr (new gr_ofdm_sampler (fft_length, symbol_length, 
delay));
+  return gr_ofdm_sampler_sptr (new gr_ofdm_sampler (fft_length, 
symbol_length));
 }
 
 gr_ofdm_sampler::gr_ofdm_sampler (unsigned int fft_length, 
-                                 unsigned int symbol_length, 
-                                 int delay)
+                                 unsigned int symbol_length)
   : gr_block ("ofdm_sampler",
              gr_make_io_signature (3, 3, sizeof (gr_complex)),
              gr_make_io_signature (1, 1, sizeof (gr_complex)*fft_length)),
-    d_fft_length(fft_length), d_symbol_length(symbol_length), d_delay(delay), 
-    d_phase(0), d_freq(0), d_avg(0)
+    d_fft_length(fft_length), d_symbol_length(symbol_length)
 {
 }
 
 void
 gr_ofdm_sampler::forecast (int noutput_items, gr_vector_int 
&ninput_items_required)
 {
-  // FIXME need more if we want to produce more than 1
-  int nreqd  = d_fft_length + d_symbol_length + 1;
+  // FIXME do we need more
+  int nreqd  = (noutput_items-1) * d_symbol_length + d_fft_length;
   unsigned ninputs = ninput_items_required.size ();
   for (unsigned i = 0; i < ninputs; i++)
     ninput_items_required[i] = nreqd;
@@ -63,74 +60,25 @@
                               gr_vector_const_void_star &input_items,
                               gr_vector_void_star &output_items)
 {
-  gr_complex *theta   = (gr_complex *) input_items[1];
-  gr_complex *epsilon = (gr_complex *) input_items[2];
   gr_complex *iptr = (gr_complex *) input_items[0];
+  gr_complex *trigger = (gr_complex *) input_items[1];
+
   gr_complex *optr = (gr_complex *) output_items[0];
 
   int found=0;
-  float alpha = 0.01;
-  
-  d_avg = 0;
-  for(unsigned int i=0;i<d_symbol_length+d_fft_length;i++) {
-    //d_avg = (alpha)*theta[i].real() + (1-alpha)*d_avg;
-    d_avg += theta[i].real();
-  }
-  d_avg /= (d_symbol_length+d_fft_length);
 
-  unsigned int i=d_fft_length;
+  unsigned int i=d_fft_length-1;
 
-  #if DEBUG
-  for(i = 0; i < d_fft_length; i++)
-    fprintf(stderr,"%d %f -2000 -1000\n",i, theta[i].real());
-  #endif
-
-  while(i<d_symbol_length+d_fft_length && (found==0)) {
-#if 1
-    if( (theta[i].real() > d_avg*0.25) &&
-       (theta[i].real() > theta[i+1].real()) ) {
+  while(!found && i<ninput_items[0])
+    if(trigger[i].real() > 0.5)
       found = 1;
-      for(unsigned int j=1; j < 10; j++) {
-       if(theta[i+j].real() > theta[i].real()) {
-         found = 0;
-         d_phase += d_freq;
-         printf("%f\n", epsilon[i].real());
-         i++;
-         break;
-       }
-      }
-#else
-    if(i == d_symbol_length-1) {
-      found = 1;
-#endif
+    else
+      i++;
 
-      if(found) {
-       //fprintf(stderr,"%d %f\n",i,theta[i].real()); 
-       #if DEBUG
-       if(i != d_symbol_length-1) {    
-         fprintf(stderr,"%d %f 0 0\n",i, theta[i].real());
-       }
-       else
-         fprintf(stderr,"%d %f 0 -1000\n",i, theta[i].real());
-       #endif
+  if(found) 
+    for(unsigned int j=i-d_fft_length+1;j<=i;j++)
+      *optr++ = iptr[j];
 
-       d_freq = epsilon[i].real() / d_fft_length;
-       for(unsigned int j=0;j<d_fft_length;j++) {
-         d_phase += d_freq;
-         gr_complex nco = gr_expj(-d_phase);
-         *optr++ = nco * iptr[i-d_fft_length+j+1];
-       }
-      }
-      i++;
-    }
-    else {
-      d_phase += d_freq;
-      i++;
-      #if DEBUG
-      fprintf(stderr,"%d %f -2000 -1000\n",i, theta[i].real());
-      #endif
-    }
-  }
-  consume_each(d_symbol_length);
+  consume_each(i-d_fft_length+2);
   return found;
 }

Modified: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_sampler.h
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_sampler.h
      2007-02-20 20:49:54 UTC (rev 4541)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_sampler.h
      2007-02-20 21:03:59 UTC (rev 4542)
@@ -29,8 +29,7 @@
 typedef boost::shared_ptr<gr_ofdm_sampler> gr_ofdm_sampler_sptr;
 
 gr_ofdm_sampler_sptr gr_make_ofdm_sampler (unsigned int fft_length, 
-                                          unsigned int symbol_length,
-                                          int delay);
+                                          unsigned int symbol_length);
 
 /*!
  * \brief does the rest of the OFDM stuff (fixme)
@@ -39,20 +38,14 @@
 class gr_ofdm_sampler : public gr_block
 {
   friend gr_ofdm_sampler_sptr gr_make_ofdm_sampler (unsigned int fft_length, 
-                                                   unsigned int symbol_length, 
-                                                   int delay);
+                                                   unsigned int symbol_length);
 
   gr_ofdm_sampler (unsigned int fft_length, 
-                  unsigned int symbol_length, 
-                  int delay);
+                  unsigned int symbol_length);
 
  private:
   unsigned int d_fft_length;
   unsigned int d_symbol_length;
-  int d_delay;
-  float d_phase;
-  float d_freq;
-  float d_avg;
 
  public:
   void forecast (int noutput_items, gr_vector_int &ninput_items_required);

Modified: 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_sampler.i
===================================================================
--- 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_sampler.i
      2007-02-20 20:49:54 UTC (rev 4541)
+++ 
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_ofdm_sampler.i
      2007-02-20 21:03:59 UTC (rev 4542)
@@ -22,10 +22,10 @@
 
 GR_SWIG_BLOCK_MAGIC(gr,ofdm_sampler)
 
-gr_ofdm_sampler_sptr gr_make_ofdm_sampler (unsigned int fft_length, unsigned 
int symbol_length, int delay);
+gr_ofdm_sampler_sptr gr_make_ofdm_sampler (unsigned int fft_length, unsigned 
int symbol_length);
 
 class gr_ofdm_sampler : public gr_sync_block
 {
  private:
-  gr_ofdm_sampler (unsigned int fft_length, unsigned int symbol_length, int 
delay);
+  gr_ofdm_sampler (unsigned int fft_length, unsigned int symbol_length);
 };





reply via email to

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