[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 01/08: channels: ensure flat fader behaves
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 01/08: channels: ensure flat fader behaves appropriately on long runs |
Date: |
Fri, 10 Jun 2016 20:45:11 +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 5cf34f170afbc81346c561fb2c1ba178749ab64f
Author: Tim O'Shea <address@hidden>
Date: Sun Mar 27 01:39:48 2016 -0400
channels: ensure flat fader behaves appropriately on long runs
---
gr-channels/lib/flat_fader_impl.cc | 44 +++++++++++++++-----------------------
1 file changed, 17 insertions(+), 27 deletions(-)
diff --git a/gr-channels/lib/flat_fader_impl.cc
b/gr-channels/lib/flat_fader_impl.cc
index 729e5d5..b749eb3 100644
--- a/gr-channels/lib/flat_fader_impl.cc
+++ b/gr-channels/lib/flat_fader_impl.cc
@@ -48,7 +48,7 @@ namespace gr {
d_table(8*1024),
- scale_sin(sqrtf(1.0/d_N)),
+ scale_sin(sqrtf(2.0/d_N)),
scale_los(sqrtf(d_K)/sqrtf(d_K+1)),
scale_nlos(1/sqrtf(d_K+1))
{
@@ -59,39 +59,31 @@ namespace gr {
}
}
-
- 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);
#if FASTSINCOS == 1
- float s_i =
scale_sin*gr::fxpt::cos(gr::fxpt::float_to_fixed(2*M_PI*d_fDTs*d_m*gr::fxpt::cos(gr::fxpt::float_to_fixed(alpha_n))+d_psi[n]));
- float s_q =
scale_sin*gr::fxpt::cos(gr::fxpt::float_to_fixed(2*M_PI*d_fDTs*d_m*gr::fxpt::sin(gr::fxpt::float_to_fixed(alpha_n))+d_phi[n]));
+#define _GRFASTSIN(x) gr::fxpt::sin(gr::fxpt::float_to_fixed(x))
+#define _GRFASTCOS(x) gr::fxpt::cos(gr::fxpt::float_to_fixed(x))
#elif FASTSINCOS == 2
- float s_i =
scale_sin*d_table.cos(2*M_PI*d_fDTs*d_m*d_table.cos(alpha_n)+d_psi[n]);
- float s_q =
scale_sin*d_table.cos(2*M_PI*d_fDTs*d_m*d_table.sin(alpha_n)+d_phi[n]);
-
+#define _GRFASTSIN(x) d_table.sin(x)
+#define _GRFASTCOS(x) d_table.cos(x)
#else
- float s_i = scale_sin*cos(2*M_PI*d_fDTs*d_m*cos(alpha_n)+d_psi[n]);
- float s_q = scale_sin*cos(2*M_PI*d_fDTs*d_m*sin(alpha_n)+d_phi[n]);
+#define _GRFASTSIN(x) sin(x)
+#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){
-#if FASTSINCOS == 1
- float los_i =
gr::fxpt::cos(gr::fxpt::float_to_fixed(2*M_PI*d_fDTs*d_m*gr::fxpt::cos(gr::fxpt::float_to_fixed(d_theta_los))
+ d_psi[0]));
- float los_q =
gr::fxpt::sin(gr::fxpt::float_to_fixed(2*M_PI*d_fDTs*d_m*gr::fxpt::cos(gr::fxpt::float_to_fixed(d_theta_los))
+ d_psi[0]));
-#elif FASTSINCOS == 2
- float los_i =
d_table.cos(2*M_PI*d_fDTs*d_m*d_table.cos(d_theta_los) + d_psi[0]);
- float los_q =
d_table.sin(2*M_PI*d_fDTs*d_m*d_table.cos(d_theta_los) + d_psi[0]);
-#else
- float los_i = cos(2*M_PI*d_fDTs*d_m*cos(d_theta_los) + d_psi[0]);
- float los_q = sin(2*M_PI*d_fDTs*d_m*cos(d_theta_los) + d_psi[0]);
-#endif
-
+ float los_i = _GRFASTCOS(2*M_PI*d_fDTs*d_m*_GRFASTCOS(d_theta_los)
+ d_psi[0]);
+ float los_q = _GRFASTSIN(2*M_PI*d_fDTs*d_m*_GRFASTCOS(d_theta_los)
+ d_psi[0]);
H = H*scale_nlos + gr_complex(los_i,los_q)*scale_los;
}
@@ -99,7 +91,6 @@ namespace gr {
d_m++;
update_theta();
return H;
-
}
void flat_fader_impl::update_theta()
@@ -114,4 +105,3 @@ namespace gr {
} /* namespace channels */
} /* namespace gr */
-
- [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, 2016/06/10
- [Commit-gnuradio] [gnuradio] 01/08: channels: ensure flat fader behaves appropriately on long runs,
git <=
- [Commit-gnuradio] [gnuradio] 06/08: channels: clean up some of the fader normalization values and storage sizes, git, 2016/06/10