[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r7845 - gnuradio/branches/developers/trondeau/ofdmtimi
From: |
trondeau |
Subject: |
[Commit-gnuradio] r7845 - gnuradio/branches/developers/trondeau/ofdmtiming/gnuradio-core/src/lib/general |
Date: |
Tue, 26 Feb 2008 13:08:16 -0700 (MST) |
Author: trondeau
Date: 2008-02-26 13:08:16 -0700 (Tue, 26 Feb 2008)
New Revision: 7845
Modified:
gnuradio/branches/developers/trondeau/ofdmtiming/gnuradio-core/src/lib/general/gr_ofdm_frame_acquisition.cc
gnuradio/branches/developers/trondeau/ofdmtiming/gnuradio-core/src/lib/general/gr_ofdm_frame_acquisition.h
Log:
switching correlation decision since we know the preamble is here we just need
to find the peak and not test if it meets some criteria.
Modified:
gnuradio/branches/developers/trondeau/ofdmtiming/gnuradio-core/src/lib/general/gr_ofdm_frame_acquisition.cc
===================================================================
---
gnuradio/branches/developers/trondeau/ofdmtiming/gnuradio-core/src/lib/general/gr_ofdm_frame_acquisition.cc
2008-02-26 20:05:35 UTC (rev 7844)
+++
gnuradio/branches/developers/trondeau/ofdmtiming/gnuradio-core/src/lib/general/gr_ofdm_frame_acquisition.cc
2008-02-26 20:08:16 UTC (rev 7845)
@@ -101,63 +101,34 @@
//return d_phase_lut[MAX_NUM_SYMBOLS * (d_freq_shift_len + freq_delta) +
symbol_count];
}
-bool
+void
gr_ofdm_frame_acquisition::correlate(const gr_complex *symbol, int
zeros_on_left)
{
- unsigned int i = 0;
- int search_delta = 0;
- bool found = false;
+ unsigned int i,j;
- gr_complex h_sqrd = gr_complex(0.0,0.0);
- float power = 0.0F;
-
std::fill(d_symbol_phase_diff.begin(), d_symbol_phase_diff.end(), 0);
for(i = 0; i < d_fft_length-2; i++) {
d_symbol_phase_diff[i] = fabs(gr_fast_atan2f(symbol[i]) -
gr_fast_atan2f(symbol[i+2]));
}
-
- while(!found && ((unsigned)abs(search_delta) <= d_freq_shift_len)) {
- h_sqrd = gr_complex(0.0,0.0);
- power = 0.0F;
-
- //FIXME: power calculation doesn't really make sense
- for(i = 0; i < d_occupied_carriers; i++) {
- h_sqrd += (d_known_phase_diff[i] *
d_symbol_phase_diff[i+zeros_on_left+search_delta]);
- power += d_known_phase_diff[i]*d_known_phase_diff[i];
+ // sweep through all possible/allowed frequency offsets and select the best
+ int index = 0;
+ float max = 0, sum=0;
+ for(i = zeros_on_left - d_freq_shift_len; i < zeros_on_left +
d_freq_shift_len; i++) {
+ sum = 0;
+ for(j = 0; j < d_occupied_carriers; j++) {
+ sum += (d_known_phase_diff[j] * d_symbol_phase_diff[i+j]);
}
-
- if(VERBOSE) {
- printf("bin %d\th_sqrd = ( %f, %f )\t power = %f\t real(h)/p = %f\t
angle = %f\n",
- search_delta, h_sqrd.real(), h_sqrd.imag(), power,
h_sqrd.real()/power, arg(h_sqrd));
+ if(fabs(sum) > max) {
+ max = sum;
+ index = i;
}
-
- //FIXME: these threshold values are arbitrary
- if((h_sqrd.real() > 0.80*power) && (h_sqrd.real() < 1.2*power)) {
- found = true;
- d_coarse_freq = search_delta;
- d_phase_count = 1;
-
- //printf("bin %d\th_sqrd = ( %f, %f )\t power = %f\t real(h)/p = %f\t
angle = %f\n",
- // search_delta, h_sqrd.real(), h_sqrd.imag(), power,
h_sqrd.real()/power, arg(h_sqrd));
-
- if(VERBOSE) {
- printf("CORR: Found, bin %d\tdB\tcorr power fraction %f\n",
- search_delta, h_sqrd.real()/power);
- }
- break;
- }
- else {
- if(search_delta <= 0)
- search_delta = (-search_delta) + 2;
- else
- search_delta = -search_delta;
- }
}
- return found;
+
+ // set the coarse frequency offset relative to the edge of the occupied tones
+ d_coarse_freq = index - zeros_on_left;
}
-
void
gr_ofdm_frame_acquisition::calculate_equalizer(const gr_complex *symbol, int
zeros_on_left)
{
Modified:
gnuradio/branches/developers/trondeau/ofdmtiming/gnuradio-core/src/lib/general/gr_ofdm_frame_acquisition.h
===================================================================
---
gnuradio/branches/developers/trondeau/ofdmtiming/gnuradio-core/src/lib/general/gr_ofdm_frame_acquisition.h
2008-02-26 20:05:35 UTC (rev 7844)
+++
gnuradio/branches/developers/trondeau/ofdmtiming/gnuradio-core/src/lib/general/gr_ofdm_frame_acquisition.h
2008-02-26 20:08:16 UTC (rev 7845)
@@ -81,7 +81,7 @@
private:
unsigned char slicer(gr_complex x);
- bool correlate(const gr_complex *symbol, int zeros_on_left);
+ void correlate(const gr_complex *symbol, int zeros_on_left);
void calculate_equalizer(const gr_complex *symbol, int zeros_on_left);
gr_complex coarse_freq_comp(int freq_delta, int count);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r7845 - gnuradio/branches/developers/trondeau/ofdmtiming/gnuradio-core/src/lib/general,
trondeau <=