[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 03/08: channels: generate fading taps in bl
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 03/08: channels: generate fading taps in blocks for minor speedup |
Date: |
Fri, 10 Jun 2016 20:45:12 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch next
in repository gnuradio.
commit 5fb584806c62b4c4a441068ae8b8d5fad3703deb
Author: Tim O'Shea <address@hidden>
Date: Sun Mar 27 11:11:40 2016 -0400
channels: generate fading taps in blocks for minor speedup
---
gr-channels/lib/fading_model_impl.cc | 5 ++-
gr-channels/lib/flat_fader_impl.cc | 48 ++++++++++++++++----------
gr-channels/lib/flat_fader_impl.h | 1 +
gr-channels/lib/selective_fading_model_impl.cc | 10 +++++-
4 files changed, 43 insertions(+), 21 deletions(-)
diff --git a/gr-channels/lib/fading_model_impl.cc
b/gr-channels/lib/fading_model_impl.cc
index 721a43f..8e88efc 100644
--- a/gr-channels/lib/fading_model_impl.cc
+++ b/gr-channels/lib/fading_model_impl.cc
@@ -105,8 +105,11 @@ namespace gr {
{
const gr_complex* in = (const gr_complex*) input_items[0];
gr_complex* out = (gr_complex*) output_items[0];
+ std::vector<gr_complex> ftaps;
+ d_fader.next_samples(ftaps, noutput_items);
for(int i=0; i<noutput_items; i++){
- out[i] = in[i] * d_fader.next_sample();
+ out[i] = in[i] * ftaps[i];
+ //out[i] = in[i] * d_fader.next_sample();
}
return noutput_items;
}
diff --git a/gr-channels/lib/flat_fader_impl.cc
b/gr-channels/lib/flat_fader_impl.cc
index f33ca22..b53e1da 100644
--- a/gr-channels/lib/flat_fader_impl.cc
+++ b/gr-channels/lib/flat_fader_impl.cc
@@ -70,26 +70,36 @@ namespace gr {
#define _GRFASTCOS(x) cos(x)
#endif
- gr_complex flat_fader_impl::next_sample(){
- gr_complex H(0,0);
- for(int n=1; n<d_N; n++){
- float alpha_n = (2*M_PI*n - M_PI + d_theta)/(4*d_N);
- d_psi[n+1] = fmod(d_psi[n+1] + 2*M_PI*d_fDTs*_GRFASTCOS(alpha_n),
2*M_PI);
- d_phi[n+1] = fmod(d_phi[n+1] + 2*M_PI*d_fDTs*_GRFASTCOS(alpha_n),
2*M_PI);
- float s_i = scale_sin*_GRFASTCOS(d_psi[n+1]);
- float s_q = scale_sin*_GRFASTSIN(d_phi[n+1]);
- H += gr_complex(s_i, s_q);
- }
-
- if(d_LOS){
- d_psi[0] = fmod(d_psi[0] + 2*M_PI*d_fDTs*_GRFASTCOS(d_theta_los),
2*M_PI);
- float los_i = scale_los*_GRFASTCOS(d_psi[0]);
- float los_q = scale_los*_GRFASTSIN(d_psi[0]);
- H = H*scale_nlos + gr_complex(los_i,los_q);
- }
+ void flat_fader_impl::next_samples(std::vector<gr_complex> &Hvec, int
n_samples){
+ Hvec.resize(n_samples);
+ for(int i = 0; i < n_samples; i++){
+ gr_complex H(0,0);
+ for(int n=1; n<d_N; n++){
+ float alpha_n = (2*M_PI*n - M_PI + d_theta)/(4*d_N);
+ d_psi[n+1] = fmod(d_psi[n+1] +
2*M_PI*d_fDTs*_GRFASTCOS(alpha_n), 2*M_PI);
+ d_phi[n+1] = fmod(d_phi[n+1] +
2*M_PI*d_fDTs*_GRFASTCOS(alpha_n), 2*M_PI);
+ float s_i = scale_sin*_GRFASTCOS(d_psi[n+1]);
+ float s_q = scale_sin*_GRFASTSIN(d_phi[n+1]);
+ H += gr_complex(s_i, s_q);
+ }
+
+ if(d_LOS){
+ d_psi[0] = fmod(d_psi[0] +
2*M_PI*d_fDTs*_GRFASTCOS(d_theta_los), 2*M_PI);
+ float los_i = scale_los*_GRFASTCOS(d_psi[0]);
+ float los_q = scale_los*_GRFASTSIN(d_psi[0]);
+ H = H*scale_nlos + gr_complex(los_i,los_q);
+ }
+
+ update_theta();
+ Hvec[i] = H;
+ }
+
+ }
- update_theta();
- return H;
+ gr_complex flat_fader_impl::next_sample(){
+ std::vector<gr_complex> v(1);
+ next_samples(v,1);
+ return v[0];
}
void flat_fader_impl::update_theta()
diff --git a/gr-channels/lib/flat_fader_impl.h
b/gr-channels/lib/flat_fader_impl.h
index ae782ff..3a086f3 100644
--- a/gr-channels/lib/flat_fader_impl.h
+++ b/gr-channels/lib/flat_fader_impl.h
@@ -75,6 +75,7 @@ namespace gr {
flat_fader_impl(unsigned int N, float fDTs, bool LOS, float K, int
seed);
gr_complex next_sample();
+ void next_samples(std::vector<gr_complex> &HVec, int n_samples);
}; /* class flat_fader_impl */
} /* namespace channels */
diff --git a/gr-channels/lib/selective_fading_model_impl.cc
b/gr-channels/lib/selective_fading_model_impl.cc
index dfd7b74..be9c0b1 100644
--- a/gr-channels/lib/selective_fading_model_impl.cc
+++ b/gr-channels/lib/selective_fading_model_impl.cc
@@ -82,6 +82,13 @@ namespace gr {
const gr_complex* in = (const gr_complex*) input_items[0];
gr_complex* out = (gr_complex*) output_items[0];
+ // pregenerate fading components
+ std::vector<std::vector<gr_complex> > fading_taps;
+ for(size_t j=0; j<d_faders.size(); j++){
+ fading_taps.push_back( std::vector<gr_complex>() );
+ d_faders[j]->next_samples(fading_taps[j], noutput_items);
+ }
+
// loop over each output sample
for(int i=0; i<noutput_items; i++){
@@ -92,7 +99,8 @@ namespace gr {
// add each flat fading component to the taps
for(size_t j=0; j<d_faders.size(); j++){
- gr_complex ff_H(d_faders[j]->next_sample());
+ gr_complex ff_H(fading_taps[j][i]);
+ //gr_complex ff_H(d_faders[j]->next_sample());
for(size_t k=0; k<d_taps.size(); k++){
float dist = k-d_delays[j];
float interpmag = d_sintable.sinc(2*M_PI*dist);
- [Commit-gnuradio] [gnuradio] branch next updated (06a7c93 -> 0dc8072), git, 2016/06/10
- [Commit-gnuradio] [gnuradio] 02/08: channels: update LOS model to reflect NLOS changes to long term models, git, 2016/06/10
- [Commit-gnuradio] [gnuradio] 08/08: Merge branch 'master' into next, git, 2016/06/10
- [Commit-gnuradio] [gnuradio] 07/08: Merge remote-tracking branch 'osh/flat_fader_testing_next' into next, git, 2016/06/10
- [Commit-gnuradio] [gnuradio] 05/08: channels: provide CSI via message ports optionally, git, 2016/06/10
- [Commit-gnuradio] [gnuradio] 04/08: channels: adding selective fading model 2 (PDP slowly changes without bounds as well so fades move ...), git, 2016/06/10
- [Commit-gnuradio] [gnuradio] 03/08: channels: generate fading taps in blocks for minor speedup,
git <=
- [Commit-gnuradio] [gnuradio] 01/08: channels: ensure flat fader behaves appropriately on long runs, git, 2016/06/10
- [Commit-gnuradio] [gnuradio] 06/08: channels: clean up some of the fader normalization values and storage sizes, git, 2016/06/10