[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r8143 - gnuradio/branches/developers/trondeau/ofdm/gnu
From: |
trondeau |
Subject: |
[Commit-gnuradio] r8143 - gnuradio/branches/developers/trondeau/ofdm/gnuradio-core/src/lib/general |
Date: |
Mon, 31 Mar 2008 16:42:14 -0600 (MDT) |
Author: trondeau
Date: 2008-03-31 16:42:14 -0600 (Mon, 31 Mar 2008)
New Revision: 8143
Modified:
gnuradio/branches/developers/trondeau/ofdm/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc
gnuradio/branches/developers/trondeau/ofdm/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc
Log:
appropriately places subcarriers around the nulled DC carriers. Works for all
multiples of 4 occupied-tones, which is a restriction we placed in it from
another time.
Modified:
gnuradio/branches/developers/trondeau/ofdm/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc
===================================================================
---
gnuradio/branches/developers/trondeau/ofdm/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc
2008-03-31 18:22:13 UTC (rev 8142)
+++
gnuradio/branches/developers/trondeau/ofdm/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc
2008-03-31 22:42:14 UTC (rev 8143)
@@ -212,25 +212,39 @@
}
// if there's extras left to be processed
- // put the first carriers onto the end if there's at least 4 carriers
- if(diff >= 4) {
- carriers.insert(carriers.length(), "f");
- diff -= 4;
- }
- // if we still have carriers left, stick them in front
- if(diff) {
+ // divide remaining to put on either side of current map
+ // all of this is done to stick with the concept of a carrier map string that
+ // can be later passed by the user, even though it'd be cleaner to just do
this
+ // on the carrier map itself
+ int diff_left=0;
+ int diff_right=0;
+
+ // dictionary to convert from integers to ascii hex representation
+ char abc[16] = {'0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+ if(diff > 0) {
char c[2] = {0,0};
- c[0] = (pow(2,diff) - 1) + 0x30;
+
+ diff_left = (int)ceil((float)diff/2.0f); // number of carriers to put on
the left side
+ c[0] = abc[((1 << diff_left) - 1)]; // convert to bits and move to
ASCI integer
carriers.insert(0, c);
+
+ diff_right = diff - diff_left; // number of carriers to put on
the right side
+ c[0] = abc[(0xF^(1 << diff_left) - 1)]; // convert to bits and move to
ASCI integer
+ carriers.insert(carriers.length(), c);
}
- int i,j,k;
- for(i = 0; i < (int)(d_occupied_carriers/4); i++) {
+ // It seemed like such a good idea at the time...
+ // because we are only dealing with the occupied_carriers
+ // at this point, the diff_left in the following compensates
+ // for any offset from the 0th carrier introduced
+ unsigned int i,j,k;
+ for(i = 0; i < (d_occupied_carriers/4)+diff_left; i++) {
char c = carriers[i];
for(j = 0; j < 4; j++) {
k = (strtol(&c, NULL, 16) >> (3-j)) & 0x1;
if(k) {
- d_subcarrier_map.push_back(4*i + j);
+ d_subcarrier_map.push_back(4*i + j - diff_left);
}
}
}
Modified:
gnuradio/branches/developers/trondeau/ofdm/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc
===================================================================
---
gnuradio/branches/developers/trondeau/ofdm/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc
2008-03-31 18:22:13 UTC (rev 8142)
+++
gnuradio/branches/developers/trondeau/ofdm/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc
2008-03-31 22:42:14 UTC (rev 8143)
@@ -67,17 +67,28 @@
carriers.insert(carriers.length(), "f");
diff -= 8;
}
+
// if there's extras left to be processed
- // put the first carriers onto the end if there's at least 4 carriers
- if(diff >= 4) {
- carriers.insert(carriers.length(), "f");
- diff -= 4;
- }
- // if we still have carriers left, stick them in front
- if(diff) {
+ // divide remaining to put on either side of current map
+ // all of this is done to stick with the concept of a carrier map string that
+ // can be later passed by the user, even though it'd be cleaner to just do
this
+ // on the carrier map itself
+ int diff_left=0;
+ int diff_right=0;
+
+ // dictionary to convert from integers to ascii hex representation
+ char abc[16] = {'0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+ if(diff > 0) {
char c[2] = {0,0};
- c[0] = (pow(2,diff) - 1) + 0x30;
+
+ diff_left = (int)ceil((float)diff/2.0f); // number of carriers to put on
the left side
+ c[0] = abc[((1 << diff_left) - 1)]; // convert to bits and move to
ASCI integer
carriers.insert(0, c);
+
+ diff_right = diff - diff_left; // number of carriers to put on
the right side
+ c[0] = abc[(0xF^(1 << diff_left) - 1)]; // convert to bits and move to
ASCI integer
+ carriers.insert(carriers.length(), c);
}
// find out how many zeros to pad on the sides; the difference between the
fft length and the subcarrier
@@ -88,8 +99,8 @@
unsigned int i,j,k;
for(i = 0; i < carriers.length(); i++) {
char c = carriers[i]; // get the current hex
character from the string
- for(j = 0; j < 4; j++) { // walk through all four
bits
- k = (strtol(&c, NULL, 16) >> (3-j)) & 0x1; // convert to int
and extract next bit
+ for(j = 0; j < 4; j++) { // walk through all four
bits
+ k = (strtol(&c, NULL, 16) >> (3-j)) & 0x1; // convert to int and
extract next bit
if(k) { // if bit is a 1,
d_subcarrier_map.push_back(4*(i+diff) + j); // use this subcarrier
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r8143 - gnuradio/branches/developers/trondeau/ofdm/gnuradio-core/src/lib/general,
trondeau <=