summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2015-12-05 17:27:56 -0800
committerJohnathan Corgan <johnathan@corganlabs.com>2015-12-05 17:27:56 -0800
commitd55fde354f257a1dd615a66c4ca98e3b6c6a5854 (patch)
tree715de45eb26ddfa2710f722c403663f57a645ba6
parent7a0e28f2f0ba509119690e7f4f0a4e9adb21edf5 (diff)
dtv: fix segfault in DVB-T demod OFDM symbol acquisition
* Fix indexing error in calculating bounds for correlation * Fix search range for correlation peak
-rw-r--r--gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc42
-rw-r--r--gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.h16
2 files changed, 10 insertions, 48 deletions
diff --git a/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc b/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc
index 202757431b..84b20f9ad4 100644
--- a/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc
+++ b/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc
@@ -1,17 +1,17 @@
/* -*- c++ -*- */
-/*
+/*
* Copyright 2015 Free Software Foundation, Inc.
- *
+ *
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -119,13 +119,9 @@ namespace gr {
volk_32fc_magnitude_squared_32f(&d_norm[low], &in[low], size);
// Calculate gamma on each point
-#ifdef SEGFAULT_FIX
low = lookup_stop - d_cp_length + 1;
- size = lookup_start - (lookup_stop - d_cp_length + 1) + 1;
-#else
- low = lookup_stop - d_cp_length - 1;
- size = lookup_start - (lookup_stop - d_cp_length - 1) + 1;
-#endif
+ size = lookup_start - low + 1;
+
volk_32fc_x2_multiply_conjugate_32fc(&d_corr[low - d_fft_length], &in[low], &in[low - d_fft_length], size);
// Calculate time delay and frequency correction
@@ -349,10 +345,6 @@ namespace gr {
d_initial_acquisition = ml_sync(in, 2 * d_fft_length + d_cp_length - 1, d_fft_length + d_cp_length - 1, \
&d_cp_start, &d_derot[0], &d_to_consume, &d_to_out);
-#ifdef SEGFAULT_FIX
- d_cp_start_initial = d_cp_start;
- d_cp_start_slip = 0;
-#endif
// Send sync_start downstream
send_sync_start();
}
@@ -360,33 +352,12 @@ namespace gr {
// This is fractional frequency correction (pre FFT)
// It is also called coarse frequency correction
if (d_initial_acquisition) {
-#ifdef SEGFAULT_FIX
d_cp_found = ml_sync(in, d_cp_start + 16, d_cp_start, \
&d_cp_start, &d_derot[0], &d_to_consume, &d_to_out);
-#else
- d_cp_found = ml_sync(in, d_cp_start + 8, d_cp_start - 8, \
- &d_cp_start, &d_derot[0], &d_to_consume, &d_to_out);
-#endif
if (d_cp_found) {
d_freq_correction_count = 0;
-#ifdef SEGFAULT_FIX
- // detect and ignore false peaks
- if (d_cp_start != d_cp_start_initial) {
- d_cp_start_slip++;
- if (d_cp_start_slip == 2) {
- d_cp_start_slip = 0;
- }
- else {
- d_cp_start = d_cp_start_initial;
- }
- }
- else {
- d_cp_start_slip = 0;
- }
-#endif
-
// Derotate the signal and out
low = d_cp_start - d_fft_length + 1;
size = d_cp_start - (d_cp_start - d_fft_length + 1) + 1;
@@ -415,4 +386,3 @@ namespace gr {
}
} /* namespace dtv */
} /* namespace gr */
-
diff --git a/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.h b/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.h
index 2cc1017581..e7b92cbd41 100644
--- a/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.h
+++ b/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.h
@@ -1,17 +1,17 @@
/* -*- c++ -*- */
-/*
+/*
* Copyright 2015 Free Software Foundation, Inc.
- *
+ *
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -23,8 +23,6 @@
#include <gnuradio/dtv/dvbt_ofdm_sym_acquisition.h>
-#undef SEGFAULT_FIX
-
namespace gr {
namespace dtv {
@@ -67,11 +65,6 @@ namespace gr {
int d_cp_start;
-#ifdef SEGFAULT_FIX
- int d_cp_start_initial;
- int d_cp_start_slip;
-#endif
-
gr_complex * d_derot;
int d_to_consume;
int d_to_out;
@@ -99,4 +92,3 @@ namespace gr {
} // namespace gr
#endif /* INCLUDED_DTV_DVBT_OFDM_SYM_ACQUISITION_IMPL_H */
-