summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2015-08-05 13:27:38 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2015-08-05 13:27:38 -0700
commit71428c93bbfd7ad46084ca157e2a9d70eb848af0 (patch)
tree269e36026d1d0bffb115121f2514f01fcb5ef32d
parent7cbd94faf2463735f4826498120883095b767aed (diff)
parent8d336d2346c4933a124101af36ed88fc0f0ca58d (diff)
Merge remote-tracking branch 'garverp/corr_est_parabolicinterp'
-rw-r--r--gr-digital/lib/corr_est_cc_impl.cc21
1 files changed, 11 insertions, 10 deletions
diff --git a/gr-digital/lib/corr_est_cc_impl.cc b/gr-digital/lib/corr_est_cc_impl.cc
index 66645f6b5d..772fc780dc 100644
--- a/gr-digital/lib/corr_est_cc_impl.cc
+++ b/gr-digital/lib/corr_est_cc_impl.cc
@@ -262,17 +262,18 @@ namespace gr {
add_item_tag(0, nitems_written(0) + i, pmt::intern("corr_start"),
pmt::from_double(d_corr_mag[i]), d_src_id);
- // Peak detector using a "center of mass" approach center
- // holds the +/- fraction of a sample index from the found
- // peak index to the estimated actual peak index.
+ // Use Parabolic interpolation to estimate a fractional
+ // sample delay. There are more accurate methods as
+ // the sample delay estimate using this method is biased.
+ // But this method is simple and fast.
+ // center between [-0.5,0.5] units of samples
+ // Paper Reference: "Discrete Time Techniques for Time Delay
+ // Estimation" G. Jacovitti and G. Scarano
double center = 0.0;
- if (i > 0 && i < (noutput_items - 1)) {
- double nom = 0, den = 0;
- for(int s = 0; s < 3; s++) {
- nom += (s+1)*d_corr_mag[i+s-1];
- den += d_corr_mag[i+s-1];
- }
- center = nom / den - 2.0;
+ if( i > 0 && i < (noutput_items - 1 )){
+ double nom = d_corr_mag[i-1]-d_corr_mag[i+1];
+ double denom = 2*(d_corr_mag[i-1]-2*d_corr_mag[i]+d_corr_mag[i+1]);
+ center = nom/denom;
}
// Calculate the phase offset of the incoming signal.