summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib/general
diff options
context:
space:
mode:
authorn4hy2007-11-08 22:43:26 +0000
committern4hy2007-11-08 22:43:26 +0000
commita6adc4cc6d35860a8b9b6b2cb1e3abb17b74552b (patch)
tree7c8785d947c635dc61dc9ba2ddb0d9b474547a68 /gnuradio-core/src/lib/general
parent28edd49f3d5c1e7eb2f3f2826726bf688f037b1f (diff)
downloadgnuradio-a6adc4cc6d35860a8b9b6b2cb1e3abb17b74552b.tar.gz
gnuradio-a6adc4cc6d35860a8b9b6b2cb1e3abb17b74552b.tar.bz2
gnuradio-a6adc4cc6d35860a8b9b6b2cb1e3abb17b74552b.zip
attempting to use branchless clipping to prevent pipeline dumping, fabs needs to be intrinsic for speed
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@6840 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gnuradio-core/src/lib/general')
-rw-r--r--gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.cc9
-rw-r--r--gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.h1
-rw-r--r--gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.cc4
-rw-r--r--gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.h5
-rw-r--r--gnuradio-core/src/lib/general/gr_math.h9
5 files changed, 24 insertions, 4 deletions
diff --git a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.cc b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.cc
index 6761392e6..df7865166 100644
--- a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.cc
+++ b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.cc
@@ -151,17 +151,22 @@ gr_clock_recovery_mm_cc::general_work (int noutput_items,
out[oo++] = d_p_0T;
// limit mm_val
+#if 0
if (mm_val > 1.0)
mm_val = 1.0;
else if (mm_val < -1.0)
mm_val = -1.0;
-
+#endif
+ gr_branchless_clip(mm_val,1.0);
d_omega = d_omega + d_gain_omega * mm_val;
+
+#if 0
if (d_omega > d_max_omega)
d_omega = d_max_omega;
else if (d_omega < d_min_omega)
d_omega = d_min_omega;
-
+#endif
+ d_omega = 1.0+gr_branchless_clip(d_omega,d_omega_relative_limit);
d_mu = d_mu + d_omega + d_gain_mu * mm_val;
ii += (int)floor(d_mu);
d_mu -= floor(d_mu);
diff --git a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.h b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.h
index 453bafbe1..fc8447f80 100644
--- a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.h
+++ b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.h
@@ -25,6 +25,7 @@
#include <gr_block.h>
#include <gr_complex.h>
+#include <gr_math.h>
class gri_mmse_fir_interpolator_cc;
diff --git a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.cc b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.cc
index d27ab9d65..e77b5e4a0 100644
--- a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.cc
+++ b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.cc
@@ -118,11 +118,13 @@ gr_clock_recovery_mm_ff::general_work (int noutput_items,
d_last_sample = out[oo];
d_omega = d_omega + d_gain_omega * mm_val;
+#if 0
if (d_omega > d_max_omega)
d_omega = d_max_omega;
else if (d_omega < d_min_omega)
d_omega = d_min_omega;
-
+#endif
+ d_omega = gr_branchless_clip(d_omega-d_omega_mid,d_omega_relative_limit);
d_mu = d_mu + d_omega + d_gain_mu * mm_val;
ii += (int) floor(d_mu);
diff --git a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.h b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.h
index 87823c44e..a121fe821 100644
--- a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.h
+++ b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_ff.h
@@ -24,6 +24,7 @@
#define INCLUDED_GR_CLOCK_RECOVERY_MM_FF_H
#include <gr_block.h>
+#include <gr_math.h>
#include <stdio.h>
class gri_mmse_fir_interpolator;
@@ -67,6 +68,7 @@ class gr_clock_recovery_mm_ff : public gr_block
d_omega = omega;
d_min_omega = omega*(1.0 - d_omega_relative_limit);
d_max_omega = omega*(1.0 + d_omega_relative_limit);
+ d_omega_mid = 0.5*(d_min_omega+d_max_omega);
}
protected:
@@ -76,7 +78,8 @@ protected:
private:
float d_mu; // fractional sample position [0.0, 1.0]
float d_omega; // nominal frequency
- float d_min_omega; // minimum allowed omega
+ float d_min_omega; // minimum allowed omega
+ float d_omega_mid; // average omega
float d_max_omega; // maximum allowed omega
float d_gain_omega; // gain for adjusting omega
float d_gain_mu; // gain for adjusting mu
diff --git a/gnuradio-core/src/lib/general/gr_math.h b/gnuradio-core/src/lib/general/gr_math.h
index 439e5f4b9..547560650 100644
--- a/gnuradio-core/src/lib/general/gr_math.h
+++ b/gnuradio-core/src/lib/general/gr_math.h
@@ -64,4 +64,13 @@ static inline float gr_fast_atan2f(gr_complex z)
return gr_fast_atan2f(z.imag(), z.real());
}
+static inline float gr_branchless_clip(float x, float clip)
+{
+ float x1 = fabs(x+clip);
+ float x2 = fabs(x-clip);
+ x1 -= x2;
+ return 0.5*x1;
+}
+
+
#endif /* _GR_MATH_H_ */