diff options
author | Thomas Habets <thomas@habets.se> | 2020-08-30 15:27:22 +0100 |
---|---|---|
committer | mormj <34754695+mormj@users.noreply.github.com> | 2020-10-23 09:43:30 -0400 |
commit | 7b44a7fe8d216c8e2698493ee40bd11dce016360 (patch) | |
tree | f293a52648b12fe1cb9601a62429014ce14c9983 | |
parent | 2f8f8b56f62bdfd547e83f5586521d6f602e3db3 (diff) |
dtv: Remove manual memory management
All removed except some tricky stuff in dvb_ldpc_bb_impl.
26 files changed, 368 insertions, 791 deletions
diff --git a/gr-dtv/lib/atsc/atsc_deinterleaver_impl.cc b/gr-dtv/lib/atsc/atsc_deinterleaver_impl.cc index fcc5931365..616a4c2688 100644 --- a/gr-dtv/lib/atsc/atsc_deinterleaver_impl.cc +++ b/gr-dtv/lib/atsc/atsc_deinterleaver_impl.cc @@ -33,7 +33,7 @@ atsc_deinterleaver_impl::atsc_deinterleaver_impl() m_fifo.reserve(s_interleavers); for (int i = 0; i < s_interleavers; i++) - m_fifo.emplace_back((52 - 1 - i) * 4); + m_fifo.emplace_back((s_interleavers - 1 - i) * 4); sync(); } @@ -64,8 +64,8 @@ int atsc_deinterleaver_impl::work(int noutput_items, if (in[i].pli.first_regular_seg_p()) sync(); - // remap OUTPUT pipeline info to reflect 52 data segment end-to-end delay - plinfo::delay(out[i].pli, in[i].pli, 52); + // remap OUTPUT pipeline info to reflect all data segment end-to-end delay + plinfo::delay(out[i].pli, in[i].pli, s_interleavers); // now do the actual deinterleaving for (unsigned int j = 0; j < sizeof(in[i].data); j++) { diff --git a/gr-dtv/lib/dvbt/dvbt_bit_inner_deinterleaver_impl.cc b/gr-dtv/lib/dvbt/dvbt_bit_inner_deinterleaver_impl.cc index 0f3db068c8..38847ce16c 100644 --- a/gr-dtv/lib/dvbt/dvbt_bit_inner_deinterleaver_impl.cc +++ b/gr-dtv/lib/dvbt/dvbt_bit_inner_deinterleaver_impl.cc @@ -49,18 +49,10 @@ dvbt_bit_inner_deinterleaver_impl::dvbt_bit_inner_deinterleaver_impl( gr::dtv::GI_1_32, transmission), d_nsize(nsize), - d_hierarchy(hierarchy) + d_hierarchy(config.d_hierarchy), + d_v(config.d_m), + d_perm(d_v * d_bsize) { - d_v = config.d_m; - d_hierarchy = config.d_hierarchy; - - d_perm = (unsigned char*)new (std::nothrow) unsigned char[d_v * d_bsize]; - if (d_perm == NULL) { - GR_LOG_FATAL(d_logger, - "Bit Inner Deinterleaver, cannot allocate memory for d_perm."); - throw std::bad_alloc(); - } - // Init permutation table (used for b[e][do]) for (int i = 0; i < d_bsize * d_v; i++) { if (d_hierarchy == NH) { @@ -82,10 +74,7 @@ dvbt_bit_inner_deinterleaver_impl::dvbt_bit_inner_deinterleaver_impl( /* * Our virtual destructor. */ -dvbt_bit_inner_deinterleaver_impl::~dvbt_bit_inner_deinterleaver_impl() -{ - delete[] d_perm; -} +dvbt_bit_inner_deinterleaver_impl::~dvbt_bit_inner_deinterleaver_impl() {} void dvbt_bit_inner_deinterleaver_impl::forecast(int noutput_items, gr_vector_int& ninput_items_required) diff --git a/gr-dtv/lib/dvbt/dvbt_bit_inner_deinterleaver_impl.h b/gr-dtv/lib/dvbt/dvbt_bit_inner_deinterleaver_impl.h index 133423d3af..98f618544c 100644 --- a/gr-dtv/lib/dvbt/dvbt_bit_inner_deinterleaver_impl.h +++ b/gr-dtv/lib/dvbt/dvbt_bit_inner_deinterleaver_impl.h @@ -22,16 +22,16 @@ private: static const int d_lookup_H[126][6]; - int d_nsize; + const int d_nsize; dvbt_hierarchy_t d_hierarchy; // constellation - int d_v; + const int d_v; // Bit interleaver block size static const int d_bsize; // Table to keep interleaved indices - unsigned char* d_perm; + std::vector<unsigned char> d_perm; public: dvbt_bit_inner_deinterleaver_impl(int nsize, diff --git a/gr-dtv/lib/dvbt/dvbt_bit_inner_interleaver_impl.cc b/gr-dtv/lib/dvbt/dvbt_bit_inner_interleaver_impl.cc index f984dd5f15..8ad0f23c0e 100644 --- a/gr-dtv/lib/dvbt/dvbt_bit_inner_interleaver_impl.cc +++ b/gr-dtv/lib/dvbt/dvbt_bit_inner_interleaver_impl.cc @@ -50,18 +50,10 @@ dvbt_bit_inner_interleaver_impl::dvbt_bit_inner_interleaver_impl( gr::dtv::GI_1_32, transmission), d_nsize(nsize), - d_hierarchy(hierarchy) + d_hierarchy(config.d_hierarchy), + d_v(config.d_m), + d_perm(d_v * d_bsize) { - d_v = config.d_m; - d_hierarchy = config.d_hierarchy; - - d_perm = (unsigned char*)new (std::nothrow) unsigned char[d_v * d_bsize]; - if (d_perm == NULL) { - GR_LOG_FATAL(d_logger, - "Bit Inner Interleaver, cannot allocate memory for d_perm."); - throw std::bad_alloc(); - } - // Init permutation table (used for b[e][do]) for (int i = 0; i < d_bsize * d_v; i++) { if (d_hierarchy == NH) { @@ -83,7 +75,7 @@ dvbt_bit_inner_interleaver_impl::dvbt_bit_inner_interleaver_impl( /* * Our virtual destructor. */ -dvbt_bit_inner_interleaver_impl::~dvbt_bit_inner_interleaver_impl() { delete[] d_perm; } +dvbt_bit_inner_interleaver_impl::~dvbt_bit_inner_interleaver_impl() {} void dvbt_bit_inner_interleaver_impl::forecast(int noutput_items, gr_vector_int& ninput_items_required) diff --git a/gr-dtv/lib/dvbt/dvbt_bit_inner_interleaver_impl.h b/gr-dtv/lib/dvbt/dvbt_bit_inner_interleaver_impl.h index cc7730b508..367b1f3ba5 100644 --- a/gr-dtv/lib/dvbt/dvbt_bit_inner_interleaver_impl.h +++ b/gr-dtv/lib/dvbt/dvbt_bit_inner_interleaver_impl.h @@ -22,16 +22,16 @@ private: static const int d_lookup_H[126][6]; - int d_nsize; + const int d_nsize; dvbt_hierarchy_t d_hierarchy; // constellation - int d_v; + const int d_v; // Bit interleaver block size static const int d_bsize; // Table to keep interleaved indices - unsigned char* d_perm; + std::vector<unsigned char> d_perm; public: dvbt_bit_inner_interleaver_impl(int nsize, diff --git a/gr-dtv/lib/dvbt/dvbt_convolutional_deinterleaver_impl.cc b/gr-dtv/lib/dvbt/dvbt_convolutional_deinterleaver_impl.cc index 17867ca458..eb60932e3e 100644 --- a/gr-dtv/lib/dvbt/dvbt_convolutional_deinterleaver_impl.cc +++ b/gr-dtv/lib/dvbt/dvbt_convolutional_deinterleaver_impl.cc @@ -43,8 +43,9 @@ dvbt_convolutional_deinterleaver_impl::dvbt_convolutional_deinterleaver_impl(int set_output_multiple(2); // The positions are shift registers (FIFOs) // of length i*M + d_shift.reserve(d_I); for (int i = (d_I - 1); i >= 0; i--) { - d_shift.push_back(new std::deque<unsigned char>(d_M * i, 0)); + d_shift.emplace_back(d_M * i, 0); } // There are 8 mux packets @@ -54,13 +55,7 @@ dvbt_convolutional_deinterleaver_impl::dvbt_convolutional_deinterleaver_impl(int /* * Our virtual destructor. */ -dvbt_convolutional_deinterleaver_impl::~dvbt_convolutional_deinterleaver_impl() -{ - for (unsigned int i = 0; i < d_shift.size(); i++) { - delete d_shift.back(); - d_shift.pop_back(); - } -} +dvbt_convolutional_deinterleaver_impl::~dvbt_convolutional_deinterleaver_impl() {} void dvbt_convolutional_deinterleaver_impl::forecast(int noutput_items, gr_vector_int& ninput_items_required) @@ -112,9 +107,9 @@ int dvbt_convolutional_deinterleaver_impl::general_work( for (int mux_pkt = 0; mux_pkt < d_MUX_PKT; mux_pkt++) { // This is actually the deinterleaver for (int k = 0; k < (d_M * d_I); k++) { - d_shift[k % d_I]->push_back(in[count]); - out[count++] = d_shift[k % d_I]->front(); - d_shift[k % d_I]->pop_front(); + d_shift[k % d_I].push_back(in[count]); + out[count++] = d_shift[k % d_I].front(); + d_shift[k % d_I].pop_front(); } } } diff --git a/gr-dtv/lib/dvbt/dvbt_convolutional_deinterleaver_impl.h b/gr-dtv/lib/dvbt/dvbt_convolutional_deinterleaver_impl.h index 5a7d1ef540..955c655d68 100644 --- a/gr-dtv/lib/dvbt/dvbt_convolutional_deinterleaver_impl.h +++ b/gr-dtv/lib/dvbt/dvbt_convolutional_deinterleaver_impl.h @@ -21,10 +21,10 @@ private: static const int d_NSYNC; static const int d_MUX_PKT; - int d_blocks; - int d_I; - int d_M; - std::vector<std::deque<unsigned char>*> d_shift; + const int d_blocks; + const int d_I; + const int d_M; + std::vector<std::deque<unsigned char>> d_shift; public: dvbt_convolutional_deinterleaver_impl(int nsize, int I, int M); diff --git a/gr-dtv/lib/dvbt/dvbt_convolutional_interleaver_impl.cc b/gr-dtv/lib/dvbt/dvbt_convolutional_interleaver_impl.cc index 37b8769d4f..811550b2e2 100644 --- a/gr-dtv/lib/dvbt/dvbt_convolutional_interleaver_impl.cc +++ b/gr-dtv/lib/dvbt/dvbt_convolutional_interleaver_impl.cc @@ -38,21 +38,16 @@ dvbt_convolutional_interleaver_impl::dvbt_convolutional_interleaver_impl(int blo { // Positions are shift registers (FIFOs) // of length i*M + d_shift.reserve(d_I); for (int i = 0; i < d_I; i++) { - d_shift.push_back(new std::deque<unsigned char>(d_M * i, 0)); + d_shift.emplace_back(d_M * i, 0); } } /* * Our virtual destructor. */ -dvbt_convolutional_interleaver_impl::~dvbt_convolutional_interleaver_impl() -{ - for (unsigned int i = 0; i < d_shift.size(); i++) { - delete d_shift.back(); - d_shift.pop_back(); - } -} +dvbt_convolutional_interleaver_impl::~dvbt_convolutional_interleaver_impl() {} int dvbt_convolutional_interleaver_impl::work(int noutput_items, gr_vector_const_void_star& input_items, @@ -64,9 +59,9 @@ int dvbt_convolutional_interleaver_impl::work(int noutput_items, for (int i = 0; i < (noutput_items / d_I); i++) { // Process one block of I symbols for (unsigned int j = 0; j < d_shift.size(); j++) { - d_shift[j]->push_front(in[(d_I * i) + j]); - out[(d_I * i) + j] = d_shift[j]->back(); - d_shift[j]->pop_back(); + d_shift[j].push_front(in[(d_I * i) + j]); + out[(d_I * i) + j] = d_shift[j].back(); + d_shift[j].pop_back(); } } diff --git a/gr-dtv/lib/dvbt/dvbt_convolutional_interleaver_impl.h b/gr-dtv/lib/dvbt/dvbt_convolutional_interleaver_impl.h index 3182449de1..aa107b9b7a 100644 --- a/gr-dtv/lib/dvbt/dvbt_convolutional_interleaver_impl.h +++ b/gr-dtv/lib/dvbt/dvbt_convolutional_interleaver_impl.h @@ -19,9 +19,9 @@ namespace dtv { class dvbt_convolutional_interleaver_impl : public dvbt_convolutional_interleaver { private: - int d_I; - int d_M; - std::vector<std::deque<unsigned char>*> d_shift; + const int d_I; + const int d_M; + std::vector<std::deque<unsigned char>> d_shift; public: dvbt_convolutional_interleaver_impl(int nsize, int I, int M); diff --git a/gr-dtv/lib/dvbt/dvbt_demap_impl.cc b/gr-dtv/lib/dvbt/dvbt_demap_impl.cc index 3eaa98a024..f2f36f9f3a 100644 --- a/gr-dtv/lib/dvbt/dvbt_demap_impl.cc +++ b/gr-dtv/lib/dvbt/dvbt_demap_impl.cc @@ -45,45 +45,21 @@ dvbt_demap_impl::dvbt_demap_impl(int nsize, gr::dtv::GI_1_32, transmission), d_nsize(nsize), - d_constellation_size(0), - d_step(0), - d_alpha(0), - d_gain(0.0) + d_constellation_size(config.d_constellation_size), + d_transmission_mode(config.d_transmission_mode), + d_step(config.d_step), + d_alpha(config.d_alpha), + d_gain(gain * config.d_norm), + d_constellation_points(d_constellation_size), + d_sq_dist(d_constellation_size) { - // Get parameters from config object - d_constellation_size = config.d_constellation_size; - d_transmission_mode = config.d_transmission_mode; - d_step = config.d_step; - d_alpha = config.d_alpha; - d_gain = gain * config.d_norm; - - d_constellation_points = (gr_complex*)volk_malloc( - sizeof(gr_complex) * d_constellation_size, volk_get_alignment()); - if (d_constellation_points == NULL) { - GR_LOG_FATAL(d_logger, - "DVB-T Demap, cannot allocate memory for d_constellation_points."); - throw std::bad_alloc(); - } - - d_sq_dist = - (float*)volk_malloc(sizeof(float) * d_constellation_size, volk_get_alignment()); - if (d_sq_dist == NULL) { - GR_LOG_FATAL(d_logger, "DVB-T Demap, cannot allocate memory for d_sq_dist."); - volk_free(d_constellation_points); - throw std::bad_alloc(); - } - make_constellation_points(d_constellation_size, d_step, d_alpha); } /* * Our virtual destructor. */ -dvbt_demap_impl::~dvbt_demap_impl() -{ - volk_free(d_sq_dist); - volk_free(d_constellation_points); -} +dvbt_demap_impl::~dvbt_demap_impl() {} void dvbt_demap_impl::make_constellation_points(int size, int step, int alpha) { diff --git a/gr-dtv/lib/dvbt/dvbt_demap_impl.h b/gr-dtv/lib/dvbt/dvbt_demap_impl.h index cf5a21e1b0..c7422ec7f5 100644 --- a/gr-dtv/lib/dvbt/dvbt_demap_impl.h +++ b/gr-dtv/lib/dvbt/dvbt_demap_impl.h @@ -11,6 +11,7 @@ #include "dvbt_configure.h" #include <gnuradio/dtv/dvbt_demap.h> +#include <volk/volk_alloc.hh> namespace gr { namespace dtv { @@ -23,7 +24,7 @@ private: int d_nsize; // Constellation size - unsigned char d_constellation_size; + const unsigned char d_constellation_size; // Transmission mode dvbt_transmission_mode_t d_transmission_mode; // Step on each axis of the constellation @@ -33,8 +34,8 @@ private: // Gain for the complex values float d_gain; - gr_complex* d_constellation_points; - float* d_sq_dist; + volk::vector<gr_complex> d_constellation_points; + volk::vector<float> d_sq_dist; void make_constellation_points(int size, int step, int alpha); int find_constellation_value(gr_complex val); diff --git a/gr-dtv/lib/dvbt/dvbt_inner_coder_impl.cc b/gr-dtv/lib/dvbt/dvbt_inner_coder_impl.cc index 6e2d989e88..231cd9756d 100644 --- a/gr-dtv/lib/dvbt/dvbt_inner_coder_impl.cc +++ b/gr-dtv/lib/dvbt/dvbt_inner_coder_impl.cc @@ -131,15 +131,14 @@ dvbt_inner_coder_impl::dvbt_inner_coder_impl(int ninput, config(constellation, hierarchy, coderate, coderate), d_ninput(ninput), d_noutput(noutput), - d_reg(0) + d_k(config.d_cr_k), // input of encoder + d_n(config.d_cr_n), // output of encoder + d_m(config.d_m), // constellation symbol size + d_in_bs((d_k * d_m) / 2), + d_in_buff(8 * d_in_bs), + d_out_bs(4 * d_n), + d_out_buff(8 * d_in_bs * d_n / d_k) { - // Determine k - input of encoder - d_k = config.d_cr_k; - // Determine n - output of encoder - d_n = config.d_cr_n; - // Determine m - constellation symbol size - d_m = config.d_m; - // In order to accommodate all constalations (m=2,4,6) // and rates (1/2, 2/3, 3/4, 5/6, 7/8) // We need the following things to happen: @@ -153,39 +152,16 @@ dvbt_inner_coder_impl::dvbt_inner_coder_impl(int ninput, // We output nm bits // We output one byte for a symbol of m bits // The out/in rate in bytes is: 8n/km (Bytes) - assert(d_noutput % 1512 == 0); // Set output items multiple of 4 set_output_multiple(4); - - // calculate in and out block sizes - d_in_bs = (d_k * d_m) / 2; - d_out_bs = 4 * d_n; - - // allocate bit buffers - d_in_buff = new (std::nothrow) unsigned char[8 * d_in_bs]; - if (d_in_buff == NULL) { - GR_LOG_FATAL(d_logger, "Inner Coder, cannot allocate memory for d_in_buff."); - throw std::bad_alloc(); - } - - d_out_buff = new (std::nothrow) unsigned char[8 * d_in_bs * d_n / d_k]; - if (d_out_buff == NULL) { - GR_LOG_FATAL(d_logger, "Inner Coder, cannot allocate memory for d_out_buff."); - delete[] d_in_buff; - throw std::bad_alloc(); - } } /* * Our virtual destructor. */ -dvbt_inner_coder_impl::~dvbt_inner_coder_impl() -{ - delete[] d_out_buff; - delete[] d_in_buff; -} +dvbt_inner_coder_impl::~dvbt_inner_coder_impl() {} void dvbt_inner_coder_impl::forecast(int noutput_items, gr_vector_int& ninput_items_required) diff --git a/gr-dtv/lib/dvbt/dvbt_inner_coder_impl.h b/gr-dtv/lib/dvbt/dvbt_inner_coder_impl.h index 1d51400885..5baea7e85e 100644 --- a/gr-dtv/lib/dvbt/dvbt_inner_coder_impl.h +++ b/gr-dtv/lib/dvbt/dvbt_inner_coder_impl.h @@ -26,23 +26,23 @@ private: int d_ninput; int d_noutput; - int d_reg; + int d_reg = 0; // Code rate k/n - int d_k; - int d_n; + const int d_k; + const int d_n; // Constellation with m - int d_m; + const int d_m; // input block size in bytes - int d_in_bs; + const int d_in_bs; // bit input buffer - unsigned char* d_in_buff; + std::vector<unsigned char> d_in_buff; // output block size in bytes - int d_out_bs; + const int d_out_bs; // bit output buffer - unsigned char* d_out_buff; + std::vector<unsigned char> d_out_buff; inline void generate_codeword(unsigned char in, int& x, int& y); inline void generate_punctured_code(dvb_code_rate_t coderate, diff --git a/gr-dtv/lib/dvbt/dvbt_map_impl.cc b/gr-dtv/lib/dvbt/dvbt_map_impl.cc index 48afea560e..53fe80f6bb 100644 --- a/gr-dtv/lib/dvbt/dvbt_map_impl.cc +++ b/gr-dtv/lib/dvbt/dvbt_map_impl.cc @@ -46,32 +46,20 @@ dvbt_map_impl::dvbt_map_impl(int nsize, gr::dtv::GI_1_32, transmission), d_nsize(nsize), - d_constellation_size(0), - d_step(0), - d_alpha(0), - d_gain(0.0) + d_constellation_size(config.d_constellation_size), + d_transmission_mode(config.d_transmission_mode), + d_step(config.d_step), + d_alpha(config.d_alpha), + d_gain(gain * config.d_norm), + d_constellation_points(d_constellation_size) { - // Get parameters from config object - d_constellation_size = config.d_constellation_size; - d_transmission_mode = config.d_transmission_mode; - d_step = config.d_step; - d_alpha = config.d_alpha; - d_gain = gain * config.d_norm; - - d_constellation_points = new (std::nothrow) gr_complex[d_constellation_size]; - if (d_constellation_points == NULL) { - GR_LOG_FATAL(d_logger, - "DVB-T Map, cannot allocate memory for d_constellation_points."); - throw std::bad_alloc(); - } - make_constellation_points(d_constellation_size, d_step, d_alpha); } /* * Our virtual destructor. */ -dvbt_map_impl::~dvbt_map_impl() { delete[] d_constellation_points; } +dvbt_map_impl::~dvbt_map_impl() {} unsigned int dvbt_map_impl::bin_to_gray(unsigned int val) { return (val >> 1) ^ val; } diff --git a/gr-dtv/lib/dvbt/dvbt_map_impl.h b/gr-dtv/lib/dvbt/dvbt_map_impl.h index 7d338d2165..913171d52f 100644 --- a/gr-dtv/lib/dvbt/dvbt_map_impl.h +++ b/gr-dtv/lib/dvbt/dvbt_map_impl.h @@ -20,20 +20,20 @@ class dvbt_map_impl : public dvbt_map private: const dvbt_configure config; - int d_nsize; + const int d_nsize; // Constellation size - unsigned char d_constellation_size; + const unsigned char d_constellation_size; // Keeps transmission mode - dvbt_transmission_mode_t d_transmission_mode; + const dvbt_transmission_mode_t d_transmission_mode; // Step on each axis of the constellation - unsigned char d_step; + const unsigned char d_step; // Keep Alpha internally - unsigned char d_alpha; + const unsigned char d_alpha; // Gain for the complex values - float d_gain; + const float d_gain; - gr_complex* d_constellation_points; + std::vector<gr_complex> d_constellation_points; void make_constellation_points(int size, int step, int alpha); gr_complex find_constellation_point(int val); 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 ad0166e6c4..ff3ea33c6d 100644 --- a/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc +++ b/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc @@ -21,6 +21,14 @@ namespace gr { namespace dtv { +namespace { +float calculate_rho(float snr) +{ + snr = pow(10, snr / 10.0); + return snr / (snr + 1.0); +} +} // namespace + int dvbt_ofdm_sym_acquisition_impl::peak_detect_init(float threshold_factor_rise, float alpha) { @@ -230,101 +238,22 @@ dvbt_ofdm_sym_acquisition_impl::dvbt_ofdm_sym_acquisition_impl( io_signature::make(1, 1, sizeof(gr_complex) * blocks * fft_length)), d_fft_length(fft_length), d_cp_length(cp_length), - d_snr(snr), - d_phase(0.0), - d_phaseinc(0.0), - d_cp_found(0), - d_nextphaseinc(0), - d_nextpos(0), - d_initial_acquisition(0), - d_cp_start(0), - d_to_consume(0), - d_to_out(0), - d_consumed(0), - d_out(0) + d_rho(calculate_rho(snr)), + d_conj(2 * d_fft_length + d_cp_length), + d_norm(2 * d_fft_length + d_cp_length), + d_corr(2 * d_fft_length + d_cp_length), + d_gamma(d_fft_length), + d_lambda(d_fft_length), + d_derot(d_fft_length + d_cp_length) { set_relative_rate(1, (uint64_t)(d_cp_length + d_fft_length)); - - d_snr = pow(10, d_snr / 10.0); - d_rho = d_snr / (d_snr + 1.0); - - d_gamma = - (gr_complex*)volk_malloc(sizeof(gr_complex) * d_fft_length, volk_get_alignment()); - if (d_gamma == NULL) { - GR_LOG_FATAL(d_logger, - "OFDM Symbol Acquisition, cannot allocate memory for d_gamma."); - throw std::bad_alloc(); - } - - d_lambda = (float*)volk_malloc(sizeof(float) * d_fft_length, volk_get_alignment()); - if (d_lambda == NULL) { - GR_LOG_FATAL(d_logger, - "OFDM Symbol Acquisition, cannot allocate memory for d_lambda."); - volk_free(d_gamma); - throw std::bad_alloc(); - } - - d_derot = (gr_complex*)volk_malloc(sizeof(gr_complex) * (d_fft_length + d_cp_length), - volk_get_alignment()); - if (d_derot == NULL) { - GR_LOG_FATAL(d_logger, - "OFDM Symbol Acquisition, cannot allocate memory for d_derot."); - volk_free(d_lambda); - volk_free(d_gamma); - throw std::bad_alloc(); - } - - d_conj = (gr_complex*)volk_malloc( - sizeof(gr_complex) * (2 * d_fft_length + d_cp_length), volk_get_alignment()); - if (d_conj == NULL) { - GR_LOG_FATAL(d_logger, - "OFDM Symbol Acquisition, cannot allocate memory for d_conj."); - volk_free(d_derot); - volk_free(d_lambda); - volk_free(d_gamma); - throw std::bad_alloc(); - } - - d_norm = (float*)volk_malloc(sizeof(float) * (2 * d_fft_length + d_cp_length), - volk_get_alignment()); - if (d_norm == NULL) { - GR_LOG_FATAL(d_logger, - "OFDM Symbol Acquisition, cannot allocate memory for d_norm."); - volk_free(d_conj); - volk_free(d_derot); - volk_free(d_lambda); - volk_free(d_gamma); - throw std::bad_alloc(); - } - - d_corr = (gr_complex*)volk_malloc( - sizeof(gr_complex) * (2 * d_fft_length + d_cp_length), volk_get_alignment()); - if (d_corr == NULL) { - GR_LOG_FATAL(d_logger, - "OFDM Symbol Acquisition, cannot allocate memory for d_corr."); - volk_free(d_norm); - volk_free(d_conj); - volk_free(d_derot); - volk_free(d_lambda); - volk_free(d_gamma); - throw std::bad_alloc(); - } - peak_detect_init(0.3, 0.9); } /* * Our virtual destructor. */ -dvbt_ofdm_sym_acquisition_impl::~dvbt_ofdm_sym_acquisition_impl() -{ - volk_free(d_corr); - volk_free(d_norm); - volk_free(d_conj); - volk_free(d_derot); - volk_free(d_lambda); - volk_free(d_gamma); -} +dvbt_ofdm_sym_acquisition_impl::~dvbt_ofdm_sym_acquisition_impl() {} void dvbt_ofdm_sym_acquisition_impl::forecast(int noutput_items, gr_vector_int& ninput_items_required) 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 deb73673c3..b72d48c259 100644 --- a/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.h +++ b/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.h @@ -10,6 +10,7 @@ #define INCLUDED_DTV_DVBT_OFDM_SYM_ACQUISITION_IMPL_H #include <gnuradio/dtv/dvbt_ofdm_sym_acquisition.h> +#include <volk/volk_alloc.hh> namespace gr { namespace dtv { @@ -17,37 +18,36 @@ namespace dtv { class dvbt_ofdm_sym_acquisition_impl : public dvbt_ofdm_sym_acquisition { private: - int d_fft_length; - int d_cp_length; - float d_snr; - float d_rho; + const int d_fft_length; + const int d_cp_length; + const float d_rho; - gr_complex* d_conj; - float* d_norm; - gr_complex* d_corr; - gr_complex* d_gamma; - float* d_lambda; + volk::vector<gr_complex> d_conj; + volk::vector<float> d_norm; + volk::vector<gr_complex> d_corr; + volk::vector<gr_complex> d_gamma; + volk::vector<float> d_lambda; // For peak detector float d_threshold_factor_rise; float d_avg_alpha; float d_avg_min; float d_avg_max; - float d_phase; - double d_phaseinc; - int d_cp_found; - double d_nextphaseinc; - int d_nextpos; + float d_phase = 0.0; + double d_phaseinc = 0.0; + int d_cp_found = 0; + double d_nextphaseinc = 0; + int d_nextpos = 0; - int d_initial_acquisition; + int d_initial_acquisition = 0; - int d_cp_start; + int d_cp_start = 0; - gr_complex* d_derot; - int d_to_consume; - int d_to_out; - int d_consumed; - int d_out; + volk::vector<gr_complex> d_derot; + int d_to_consume = 0; + int d_to_out = 0; + int d_consumed = 0; + int d_out = 0; int ml_sync(const gr_complex* in, int lookup_start, diff --git a/gr-dtv/lib/dvbt/dvbt_reference_signals_impl.cc b/gr-dtv/lib/dvbt/dvbt_reference_signals_impl.cc index 2ef1ff53ca..0efc890715 100644 --- a/gr-dtv/lib/dvbt/dvbt_reference_signals_impl.cc +++ b/gr-dtv/lib/dvbt/dvbt_reference_signals_impl.cc @@ -88,30 +88,22 @@ const int dvbt_pilot_gen::d_tps_sync_odd[d_tps_sync_size] = { 1, 1, 0, 0, 1, 0, */ dvbt_pilot_gen::dvbt_pilot_gen(const dvbt_configure& c) : config(c), - d_spilot_index(0), - d_cpilot_index(0), - d_tpilot_index(0), - d_symbol_index(0), - d_symbol_index_known(0), - d_frame_index(0), - d_superframe_index(0), - d_freq_offset_max(8), - d_trigger_index(0), - d_payload_index(0), - d_chanestim_index(0), - d_prev_mod_symbol_index(0), - d_mod_symbol_index(0) + d_Kmin(config.d_Kmin), + d_Kmax(config.d_Kmax), + d_fft_length(config.d_fft_length), + d_payload_length(config.d_payload_length), + d_zeros_on_left(config.d_zeros_on_left), + d_zeros_on_right(config.d_zeros_on_right), + d_cp_length(config.d_cp_length), + d_spilot_carriers_val(d_Kmax - d_Kmin + 1), + d_channel_gain(d_Kmax - d_Kmin + 1), + d_derot_in(d_fft_length), + d_chanestim_carriers(d_Kmax - d_Kmin + 1), + d_payload_carriers(d_Kmax - d_Kmin + 1), + d_wk(d_Kmax - d_Kmin + 1) { - gr::configure_default_loggers(d_logger, d_debug_logger, "dvbt_pilot_gen"); // Determine parameters from config file - d_Kmin = config.d_Kmin; - d_Kmax = config.d_Kmax; - d_fft_length = config.d_fft_length; - d_payload_length = config.d_payload_length; - d_zeros_on_left = config.d_zeros_on_left; - d_zeros_on_right = config.d_zeros_on_right; - d_cp_length = config.d_cp_length; // Set-up pilot data depending on transmission mode if (config.d_transmission_mode == T2k) { @@ -134,45 +126,11 @@ dvbt_pilot_gen::dvbt_pilot_gen(const dvbt_configure& c) d_tps_carriers = d_tps_carriers_2k; } - d_freq_offset = 0; - d_carrier_freq_correction = 0.0; - d_sampling_freq_correction = 0.0; - - // allocate PRBS buffer - d_wk = new (std::nothrow) char[d_Kmax - d_Kmin + 1]; - if (d_wk == NULL) { - GR_LOG_ERROR(d_logger, "cannot allocate memory for d_wk."); - throw std::bad_alloc(); - } // Generate wk sequence generate_prbs(); - // allocate buffer for scattered pilots - d_spilot_carriers_val = new (std::nothrow) gr_complex[d_Kmax - d_Kmin + 1]; - if (d_spilot_carriers_val == NULL) { - GR_LOG_ERROR(d_logger, "cannot allocate memory for d_spilot_carriers_val."); - delete[] d_wk; - throw std::bad_alloc(); - } - - // allocate buffer for channel gains (for each useful carrier) - d_channel_gain = new (std::nothrow) gr_complex[d_Kmax - d_Kmin + 1]; - if (d_channel_gain == NULL) { - GR_LOG_ERROR(d_logger, "cannot allocate memory for d_channel_gain."); - delete[] d_spilot_carriers_val; - delete[] d_wk; - throw std::bad_alloc(); - } - // Allocate buffer for continual pilots phase diffs - d_known_phase_diff = new (std::nothrow) float[d_cpilot_carriers_size - 1]; - if (d_known_phase_diff == NULL) { - GR_LOG_ERROR(d_logger, "cannot allocate memory for d_known_phase_diff."); - delete[] d_channel_gain; - delete[] d_spilot_carriers_val; - delete[] d_wk; - throw std::bad_alloc(); - } + d_known_phase_diff.resize(d_cpilot_carriers_size - 1); // Obtain phase diff for all continual pilots for (int i = 0; i < (d_cpilot_carriers_size - 1); i++) { @@ -180,85 +138,17 @@ dvbt_pilot_gen::dvbt_pilot_gen(const dvbt_configure& c) get_cpilot_value(d_cpilot_carriers[i])); } - d_cpilot_phase_diff = new (std::nothrow) float[d_cpilot_carriers_size - 1]; - if (d_cpilot_phase_diff == NULL) { - GR_LOG_ERROR(d_logger, "cannot allocate memory for d_cpilot_phase_diff."); - delete[] d_known_phase_diff; - delete[] d_channel_gain; - delete[] d_spilot_carriers_val; - delete[] d_wk; - throw std::bad_alloc(); - } - - // Allocate buffer for derotated input symbol - d_derot_in = new (std::nothrow) gr_complex[d_fft_length]; - if (d_derot_in == NULL) { - GR_LOG_ERROR(d_logger, "cannot allocate memory for d_derot_in."); - delete[] d_cpilot_phase_diff; - delete[] d_known_phase_diff; - delete[] d_channel_gain; - delete[] d_spilot_carriers_val; - delete[] d_wk; - throw std::bad_alloc(); - } + d_cpilot_phase_diff.resize(d_cpilot_carriers_size - 1); // allocate buffer for first tps symbol constellation - d_tps_carriers_val = new (std::nothrow) gr_complex[d_tps_carriers_size]; - if (d_tps_carriers_val == NULL) { - GR_LOG_ERROR(d_logger, "cannot allocate memory for d_tps_carriers_val."); - delete[] d_derot_in; - delete[] d_cpilot_phase_diff; - delete[] d_known_phase_diff; - delete[] d_channel_gain; - delete[] d_spilot_carriers_val; - delete[] d_wk; - throw std::bad_alloc(); - } + d_tps_carriers_val.resize(d_tps_carriers_size); // allocate tps data buffer - d_tps_data = new (std::nothrow) unsigned char[d_symbols_per_frame]; - if (d_tps_data == NULL) { - GR_LOG_ERROR(d_logger, "cannot allocate memory for d_tps_data."); - delete[] d_tps_carriers_val; - delete[] d_derot_in; - delete[] d_cpilot_phase_diff; - delete[] d_known_phase_diff; - delete[] d_channel_gain; - delete[] d_spilot_carriers_val; - delete[] d_wk; - throw std::bad_alloc(); - } + d_tps_data.resize(d_symbols_per_frame); - d_prev_tps_symbol = new (std::nothrow) gr_complex[d_tps_carriers_size]; - if (d_prev_tps_symbol == NULL) { - GR_LOG_ERROR(d_logger, "cannot allocate memory for d_prev_tps_symbol."); - delete[] d_tps_data; - delete[] d_tps_carriers_val; - delete[] d_derot_in; - delete[] d_cpilot_phase_diff; - delete[] d_known_phase_diff; - delete[] d_channel_gain; - delete[] d_spilot_carriers_val; - delete[] d_wk; - throw std::bad_alloc(); - } - std::fill_n(d_prev_tps_symbol, d_tps_carriers_size, 0); - - d_tps_symbol = new (std::nothrow) gr_complex[d_tps_carriers_size]; - if (d_tps_symbol == NULL) { - GR_LOG_ERROR(d_logger, "cannot allocate memory for d_tps_symbol."); - delete[] d_prev_tps_symbol; - delete[] d_tps_data; - delete[] d_tps_carriers_val; - delete[] d_derot_in; - delete[] d_cpilot_phase_diff; - delete[] d_known_phase_diff; - delete[] d_channel_gain; - delete[] d_spilot_carriers_val; - delete[] d_wk; - throw std::bad_alloc(); - } - std::fill_n(d_tps_symbol, d_tps_carriers_size, 0); + d_prev_tps_symbol.resize(d_tps_carriers_size); + + d_tps_symbol.resize(d_tps_carriers_size); // Init receive TPS data vector for (int i = 0; i < d_symbols_per_frame; i++) { @@ -271,41 +161,6 @@ dvbt_pilot_gen::dvbt_pilot_gen(const dvbt_configure& c) d_tps_sync_oddv.push_back(d_tps_sync_odd[i]); } - // Allocate buffer for channel estimation carriers - d_chanestim_carriers = new (std::nothrow) int[d_Kmax - d_Kmin + 1]; - if (d_chanestim_carriers == NULL) { - GR_LOG_ERROR(d_logger, "cannot allocate memory for d_chanestim_carriers."); - delete[] d_tps_symbol; - delete[] d_prev_tps_symbol; - delete[] d_tps_data; - delete[] d_tps_carriers_val; - delete[] d_derot_in; - delete[] d_cpilot_phase_diff; - delete[] d_known_phase_diff; - delete[] d_channel_gain; - delete[] d_spilot_carriers_val; - delete[] d_wk; - throw std::bad_alloc(); - } - - // Allocate buffer for payload carriers - d_payload_carriers = new (std::nothrow) int[d_Kmax - d_Kmin + 1]; - if (d_payload_carriers == NULL) { - GR_LOG_ERROR(d_logger, "cannot allocate memory for d_payload_carriers."); - delete[] d_chanestim_carriers; - delete[] d_tps_symbol; - delete[] d_prev_tps_symbol; - delete[] d_tps_data; - delete[] d_tps_carriers_val; - delete[] d_derot_in; - delete[] d_cpilot_phase_diff; - delete[] d_known_phase_diff; - delete[] d_channel_gain; - delete[] d_spilot_carriers_val; - delete[] d_wk; - throw std::bad_alloc(); - } - // Reset the pilot generator reset_pilot_generator(); // Format TPS data with current values @@ -315,21 +170,7 @@ dvbt_pilot_gen::dvbt_pilot_gen(const dvbt_configure& c) /* * Destructor of class */ -dvbt_pilot_gen::~dvbt_pilot_gen() -{ - delete[] d_payload_carriers; - delete[] d_chanestim_carriers; - delete[] d_tps_symbol; - delete[] d_prev_tps_symbol; - delete[] d_tps_data; - delete[] d_tps_carriers_val; - delete[] d_derot_in; - delete[] d_cpilot_phase_diff; - delete[] d_known_phase_diff; - delete[] d_channel_gain; - delete[] d_spilot_carriers_val; - delete[] d_wk; -} +dvbt_pilot_gen::~dvbt_pilot_gen() {} /* * Generate PRBS sequence @@ -1114,11 +955,11 @@ int dvbt_pilot_gen::parse_input(const gr_complex* in, // - integer frequency correction (post-FFT) // - fractional frequency (carrier and sampling) corrections (post-FFT) // TODO - use PI to update the corrections - frequency_correction(in, d_derot_in); + frequency_correction(in, d_derot_in.data()); // Process spilot data // This is channel estimation function - int diff_symbol_index = process_spilot_data(d_derot_in); + int diff_symbol_index = process_spilot_data(d_derot_in.data()); // Correct symbol index so that all subsequent processing // use correct symbol index @@ -1131,7 +972,7 @@ int dvbt_pilot_gen::parse_input(const gr_complex* in, // Process TPS data // If a frame is recognized then signal end of frame - int frame_end = process_tps_data(d_derot_in, diff_symbol_index); + int frame_end = process_tps_data(d_derot_in.data(), diff_symbol_index); // We are just at the end of a frame if (frame_end) { @@ -1139,7 +980,7 @@ int dvbt_pilot_gen::parse_input(const gr_complex* in, } // Process payload data with correct symbol index - process_payload_data(d_derot_in, out); + process_payload_data(d_derot_in.data(), out); // noutput_items should be 1 in this case return 1; diff --git a/gr-dtv/lib/dvbt/dvbt_reference_signals_impl.h b/gr-dtv/lib/dvbt/dvbt_reference_signals_impl.h index 8db618f1c5..fb5e45247f 100644 --- a/gr-dtv/lib/dvbt/dvbt_reference_signals_impl.h +++ b/gr-dtv/lib/dvbt/dvbt_reference_signals_impl.h @@ -37,13 +37,13 @@ private: // this should be first in order to be initialized first const dvbt_configure& config; - int d_Kmin; - int d_Kmax; - int d_fft_length; - int d_payload_length; - int d_zeros_on_left; - int d_zeros_on_right; - int d_cp_length; + const int d_Kmin; + const int d_Kmax; + const int d_fft_length; + const int d_payload_length; + const int d_zeros_on_left; + const int d_zeros_on_right; + const int d_cp_length; static const int d_symbols_per_frame; static const int d_frames_per_superframe; @@ -79,30 +79,30 @@ private: // Variables to keep data for 2k, 8k, 4k int d_spilot_carriers_size; - gr_complex* d_spilot_carriers_val; - gr_complex* d_channel_gain; + volk::vector<gr_complex> d_spilot_carriers_val; + volk::vector<gr_complex> d_channel_gain; int d_cpilot_carriers_size; const int* d_cpilot_carriers; - float* d_known_phase_diff; - float* d_cpilot_phase_diff; - int d_freq_offset; - float d_carrier_freq_correction; - float d_sampling_freq_correction; + volk::vector<float> d_known_phase_diff; + volk::vector<float> d_cpilot_phase_diff; + int d_freq_offset = 0; + float d_carrier_freq_correction = 0.0; + float d_sampling_freq_correction = 0.0; // Variable to keep corrected OFDM symbol - gr_complex* d_derot_in; + volk::vector<gr_complex> d_derot_in; int d_tps_carriers_size; const int* d_tps_carriers; - gr_complex* d_tps_carriers_val; + volk::vector<gr_complex> d_tps_carriers_val; // Keeps TPS data - unsigned char* d_tps_data; + volk::vector<unsigned char> d_tps_data; // Keep TPS carriers values from previous symbol - gr_complex* d_prev_tps_symbol; + volk::vector<gr_complex> d_prev_tps_symbol; // Keep TPS carriers values from current symbol - gr_complex* d_tps_symbol; + volk::vector<gr_complex> d_tps_symbol; // Keeps the rcv TPS data, is a FIFO std::deque<char> d_rcv_tps_data; // Keeps the TPS sync sequence @@ -111,29 +111,29 @@ private: // Keeps channel estimation carriers // we use both continual and scattered carriers - int* d_chanestim_carriers; + volk::vector<int> d_chanestim_carriers; // Keeps paload carriers - int* d_payload_carriers; + volk::vector<int> d_payload_carriers; // Indexes for all carriers - int d_spilot_index; - int d_cpilot_index; - int d_tpilot_index; - int d_symbol_index; - int d_symbol_index_known; - int d_frame_index; - int d_superframe_index; - int d_freq_offset_max; - int d_trigger_index; - int d_payload_index; - int d_chanestim_index; - int d_prev_mod_symbol_index; - int d_mod_symbol_index; + int d_spilot_index = 0; + int d_cpilot_index = 0; + int d_tpilot_index = 0; + int d_symbol_index = 0; + int d_symbol_index_known = 0; + int d_frame_index = 0; + int d_superframe_index = 0; + int d_freq_offset_max = 8; + int d_trigger_index = 0; + int d_payload_index = 0; + int d_chanestim_index = 0; + int d_prev_mod_symbol_index = 0; + int d_mod_symbol_index = 0; int d_equalizer_ready; // PRPS generator data buffer - char* d_wk; + std::vector<char> d_wk; // Generate PRBS void generate_prbs(); diff --git a/gr-dtv/lib/dvbt/dvbt_symbol_inner_interleaver_impl.cc b/gr-dtv/lib/dvbt/dvbt_symbol_inner_interleaver_impl.cc index 2bccc258bd..221afa2e60 100644 --- a/gr-dtv/lib/dvbt/dvbt_symbol_inner_interleaver_impl.cc +++ b/gr-dtv/lib/dvbt/dvbt_symbol_inner_interleaver_impl.cc @@ -96,29 +96,17 @@ dvbt_symbol_inner_interleaver_impl::dvbt_symbol_inner_interleaver_impl( gr::dtv::C1_2, gr::dtv::GI_1_32, transmission), + d_symbols_per_frame(config.d_symbols_per_frame), + d_transmission_mode(config.d_transmission_mode), d_nsize(nsize), d_direction(direction), - d_fft_length(0), - d_payload_length(0), - d_symbol_index(0) + d_fft_length(config.d_fft_length), + d_payload_length(config.d_payload_length), + d_h(d_fft_length) { - d_symbols_per_frame = config.d_symbols_per_frame; - d_transmission_mode = config.d_transmission_mode; - d_fft_length = config.d_fft_length; - d_payload_length = config.d_payload_length; - d_direction = direction; - // Verify if transmission mode matches with size of block assert(d_payload_length == d_nsize); - // Allocate memory for h vector - d_h = new (std::nothrow) int[d_fft_length]; - if (d_h == NULL) { - GR_LOG_FATAL(d_logger, - "Symbol Inner Interleaver, cannot allocate memory for d_h."); - throw std::bad_alloc(); - } - // Setup bit permutation vectors if (d_transmission_mode == T2k) { d_bit_perm = d_bit_perm_2k; @@ -135,10 +123,7 @@ dvbt_symbol_inner_interleaver_impl::dvbt_symbol_inner_interleaver_impl( /* * Our virtual destructor. */ -dvbt_symbol_inner_interleaver_impl::~dvbt_symbol_inner_interleaver_impl() -{ - delete[] d_h; -} +dvbt_symbol_inner_interleaver_impl::~dvbt_symbol_inner_interleaver_impl() {} void dvbt_symbol_inner_interleaver_impl::forecast(int noutput_items, gr_vector_int& ninput_items_required) diff --git a/gr-dtv/lib/dvbt/dvbt_symbol_inner_interleaver_impl.h b/gr-dtv/lib/dvbt/dvbt_symbol_inner_interleaver_impl.h index 2e57d4d293..b9f7f430b0 100644 --- a/gr-dtv/lib/dvbt/dvbt_symbol_inner_interleaver_impl.h +++ b/gr-dtv/lib/dvbt/dvbt_symbol_inner_interleaver_impl.h @@ -20,20 +20,20 @@ class dvbt_symbol_inner_interleaver_impl : public dvbt_symbol_inner_interleaver private: const dvbt_configure config; - int d_symbols_per_frame; - dvbt_transmission_mode_t d_transmission_mode; - int d_nsize; - int d_direction; - int d_fft_length; - int d_payload_length; - - int* d_h; + const int d_symbols_per_frame; + const dvbt_transmission_mode_t d_transmission_mode; + const int d_nsize; + const int d_direction; + const int d_fft_length; + const int d_payload_length; + + std::vector<int> d_h; const char* d_bit_perm; static const char d_bit_perm_2k[]; static const char d_bit_perm_8k[]; // Keeps the symbol index - unsigned int d_symbol_index; + unsigned int d_symbol_index = 0; void generate_H(); int H(int q); diff --git a/gr-dtv/lib/dvbt/dvbt_viterbi_decoder_impl.cc b/gr-dtv/lib/dvbt/dvbt_viterbi_decoder_impl.cc index c32ac47688..b2d528ba53 100644 --- a/gr-dtv/lib/dvbt/dvbt_viterbi_decoder_impl.cc +++ b/gr-dtv/lib/dvbt/dvbt_viterbi_decoder_impl.cc @@ -518,17 +518,15 @@ dvbt_viterbi_decoder_impl::dvbt_viterbi_decoder_impl(dvb_constellation_t constel io_signature::make(1, 1, sizeof(unsigned char)), io_signature::make(1, 1, sizeof(unsigned char))), config(constellation, hierarchy, coderate, coderate), + d_k(config.d_cr_k), + d_n(config.d_cr_n), + d_m(config.d_m), d_bsize(bsize), - d_init(0), - store_pos(0) + d_nsymbols(d_bsize * d_n / d_m), + d_nbits(2 * d_k * d_bsize), + d_nout(d_nbits / 2 / 8), + d_inbits(d_nbits) { - // Determine k - input of encoder - d_k = config.d_cr_k; - // Determine n - output of encoder - d_n = config.d_cr_n; - // Determine m - constellation symbol size - d_m = config.d_m; - // Determine puncturing vector and traceback if (config.d_code_rate_HP == C1_2) { d_puncture = d_puncture_1_2; d_ntraceback = 5; @@ -559,25 +557,6 @@ dvbt_viterbi_decoder_impl::dvbt_viterbi_decoder_impl(dvb_constellation_t constel assert((d_bsize * d_n) % d_m == 0); set_output_multiple(d_bsize * d_k / 8); - /* - * Calculate process variables: - * Number of symbols (d_m bits) in all blocks - * It is also the number of input bytes since - * one byte always contains just one symbol. - */ - d_nsymbols = d_bsize * d_n / d_m; - // Number of bits after depuncturing a block (before decoding) - d_nbits = 2 * d_k * d_bsize; - // Number of output bytes after decoding - d_nout = d_nbits / 2 / 8; - - // Allocate the buffer for the bits - d_inbits = new (std::nothrow) unsigned char[d_nbits]; - if (d_inbits == NULL) { - GR_LOG_FATAL(d_logger, "Viterbi Decoder, cannot allocate memory for d_inbits."); - throw std::bad_alloc(); - } - mettab[0][0] = 1; mettab[0][1] = 0; mettab[1][0] = 0; @@ -593,7 +572,7 @@ dvbt_viterbi_decoder_impl::dvbt_viterbi_decoder_impl(dvb_constellation_t constel /* * Our virtual destructor. */ -dvbt_viterbi_decoder_impl::~dvbt_viterbi_decoder_impl() { delete[] d_inbits; } +dvbt_viterbi_decoder_impl::~dvbt_viterbi_decoder_impl() {} void dvbt_viterbi_decoder_impl::forecast(int noutput_items, gr_vector_int& ninput_items_required) diff --git a/gr-dtv/lib/dvbt/dvbt_viterbi_decoder_impl.h b/gr-dtv/lib/dvbt/dvbt_viterbi_decoder_impl.h index c1d6889b39..a80b4061a2 100644 --- a/gr-dtv/lib/dvbt/dvbt_viterbi_decoder_impl.h +++ b/gr-dtv/lib/dvbt/dvbt_viterbi_decoder_impl.h @@ -80,19 +80,21 @@ private: const unsigned char* d_puncture; // Code rate k/n - int d_k; - int d_n; + const int d_k; + const int d_n; // Constellation with m - int d_m; + const int d_m; // Block size - int d_bsize; - // Symbols to consume on decoding from one block - int d_nsymbols; - // Number of bits after depuncturing a block - int d_nbits; + const int d_bsize; + // Symbols to consume on decoding from one block. + // It is also the number of input bytes since + // one byte always contains just one symbol. + const int d_nsymbols; + // Number of bits after depuncturing a block (before decoding) + const int d_nbits; // Number of full packed out bytes - int d_nout; + const int d_nout; // Traceback (in bytes) int d_ntraceback; @@ -101,13 +103,13 @@ private: int mettab[2][256]; // Buffer to keep the input bits - unsigned char* d_inbits; + std::vector<unsigned char> d_inbits; // This is used to get rid of traceback on the first frame - int d_init; + int d_init = 0; // Position in circular buffer where the current decoded byte is stored - int store_pos; + int store_pos = 0; #ifdef DTV_SSE2 void dvbt_viterbi_chunks_init_sse2(__m128i* mm0, __m128i* pp0); diff --git a/gr-dtv/lib/dvbt2/dvbt2_interleaver_bb_impl.cc b/gr-dtv/lib/dvbt2/dvbt2_interleaver_bb_impl.cc index 8bc61eba61..f1881252e0 100644 --- a/gr-dtv/lib/dvbt2/dvbt2_interleaver_bb_impl.cc +++ b/gr-dtv/lib/dvbt2/dvbt2_interleaver_bb_impl.cc @@ -171,15 +171,13 @@ inline void dvbt2_interleaver_bb_impl::twist_interleave_columns( void dvbt2_interleaver_bb_impl::generate_lookup() { int rows, index = 0; - int* tempv; - int* tempu; + // vectors instead of arrays because they're fairly big. + std::vector<int> tempv2(FRAME_SIZE_NORMAL); + std::vector<int> tempu2(FRAME_SIZE_NORMAL); const int* twist; const int *c1, *c2, *c3, *c4, *c5, *c6, *c7, *c8; const int *c9, *c10, *c11, *c12, *c13, *c14, *c15, *c16; - tempv = new int[FRAME_SIZE_NORMAL]; - tempu = new int[FRAME_SIZE_NORMAL]; - for (int i = 0; i < FRAME_SIZE_NORMAL; i++) { lookup_table[i] = i; } @@ -197,28 +195,28 @@ void dvbt2_interleaver_bb_impl::generate_lookup() twist = &twist16s[0]; } - interleave_parity_bits(tempu, in); + interleave_parity_bits(tempu2.data(), in); - c1 = &tempv[0]; - c2 = &tempv[rows]; - c3 = &tempv[rows * 2]; - c4 = &tempv[rows * 3]; - c5 = &tempv[rows * 4]; - c6 = &tempv[rows * 5]; - c7 = &tempv[rows * 6]; - c8 = &tempv[rows * 7]; + c1 = &tempv2[0]; + c2 = &tempv2[rows]; + c3 = &tempv2[rows * 2]; + c4 = &tempv2[rows * 3]; + c5 = &tempv2[rows * 4]; + c6 = &tempv2[rows * 5]; + c7 = &tempv2[rows * 6]; + c8 = &tempv2[rows * 7]; - twist_interleave_columns(tempv, tempu, rows, mod * 2, twist); + twist_interleave_columns(tempv2.data(), tempu2.data(), rows, mod * 2, twist); for (int j = 0; j < rows; j++) { - tempu[index++] = c1[j]; - tempu[index++] = c2[j]; - tempu[index++] = c3[j]; - tempu[index++] = c4[j]; - tempu[index++] = c5[j]; - tempu[index++] = c6[j]; - tempu[index++] = c7[j]; - tempu[index++] = c8[j]; + tempu2[index++] = c1[j]; + tempu2[index++] = c2[j]; + tempu2[index++] = c3[j]; + tempu2[index++] = c4[j]; + tempu2[index++] = c5[j]; + tempu2[index++] = c6[j]; + tempu2[index++] = c7[j]; + tempu2[index++] = c8[j]; } break; @@ -231,36 +229,36 @@ void dvbt2_interleaver_bb_impl::generate_lookup() twist = twist64s; } - interleave_parity_bits(tempu, in); + interleave_parity_bits(tempu2.data(), in); - c1 = &tempv[0]; - c2 = &tempv[rows]; - c3 = &tempv[rows * 2]; - c4 = &tempv[rows * 3]; - c5 = &tempv[rows * 4]; - c6 = &tempv[rows * 5]; - c7 = &tempv[rows * 6]; - c8 = &tempv[rows * 7]; - c9 = &tempv[rows * 8]; - c10 = &tempv[rows * 9]; - c11 = &tempv[rows * 10]; - c12 = &tempv[rows * 11]; + c1 = &tempv2[0]; + c2 = &tempv2[rows]; + c3 = &tempv2[rows * 2]; + c4 = &tempv2[rows * 3]; + c5 = &tempv2[rows * 4]; + c6 = &tempv2[rows * 5]; + c7 = &tempv2[rows * 6]; + c8 = &tempv2[rows * 7]; + c9 = &tempv2[rows * 8]; + c10 = &tempv2[rows * 9]; + c11 = &tempv2[rows * 10]; + c12 = &tempv2[rows * 11]; - twist_interleave_columns(tempv, tempu, rows, mod * 2, twist); + twist_interleave_columns(tempv2.data(), tempu2.data(), rows, mod * 2, twist); for (int j = 0; j < rows; j++) { - tempu[index++] = c1[j]; - tempu[index++] = c2[j]; - tempu[index++] = c3[j]; - tempu[index++] = c4[j]; - tempu[index++] = c5[j]; - tempu[index++] = c6[j]; - tempu[index++] = c7[j]; - tempu[index++] = c8[j]; - tempu[index++] = c9[j]; - tempu[index++] = c10[j]; - tempu[index++] = c11[j]; - tempu[index++] = c12[j]; + tempu2[index++] = c1[j]; + tempu2[index++] = c2[j]; + tempu2[index++] = c3[j]; + tempu2[index++] = c4[j]; + tempu2[index++] = c5[j]; + tempu2[index++] = c6[j]; + tempu2[index++] = c7[j]; + tempu2[index++] = c8[j]; + tempu2[index++] = c9[j]; + tempu2[index++] = c10[j]; + tempu2[index++] = c11[j]; + tempu2[index++] = c12[j]; } break; @@ -268,79 +266,77 @@ void dvbt2_interleaver_bb_impl::generate_lookup() if (frame_size == FRAME_SIZE_NORMAL) { rows = frame_size / (mod * 2); - interleave_parity_bits(tempu, in); - - c1 = &tempv[0]; - c2 = &tempv[rows]; - c3 = &tempv[rows * 2]; - c4 = &tempv[rows * 3]; - c5 = &tempv[rows * 4]; - c6 = &tempv[rows * 5]; - c7 = &tempv[rows * 6]; - c8 = &tempv[rows * 7]; - c9 = &tempv[rows * 8]; - c10 = &tempv[rows * 9]; - c11 = &tempv[rows * 10]; - c12 = &tempv[rows * 11]; - c13 = &tempv[rows * 12]; - c14 = &tempv[rows * 13]; - c15 = &tempv[rows * 14]; - c16 = &tempv[rows * 15]; - - twist_interleave_columns(tempv, tempu, rows, mod * 2, twist256n); + interleave_parity_bits(tempu2.data(), in); + + c1 = &tempv2[0]; + c2 = &tempv2[rows]; + c3 = &tempv2[rows * 2]; + c4 = &tempv2[rows * 3]; + c5 = &tempv2[rows * 4]; + c6 = &tempv2[rows * 5]; + c7 = &tempv2[rows * 6]; + c8 = &tempv2[rows * 7]; + c9 = &tempv2[rows * 8]; + c10 = &tempv2[rows * 9]; + c11 = &tempv2[rows * 10]; + c12 = &tempv2[rows * 11]; + c13 = &tempv2[rows * 12]; + c14 = &tempv2[rows * 13]; + c15 = &tempv2[rows * 14]; + c16 = &tempv2[rows * 15]; + + twist_interleave_columns( + tempv2.data(), tempu2.data(), rows, mod * 2, twist256n); for (int j = 0; j < rows; j++) { - tempu[index++] = c1[j]; - tempu[index++] = c2[j]; - tempu[index++] = c3[j]; - tempu[index++] = c4[j]; - tempu[index++] = c5[j]; - tempu[index++] = c6[j]; - tempu[index++] = c7[j]; - tempu[index++] = c8[j]; - tempu[index++] = c9[j]; - tempu[index++] = c10[j]; - tempu[index++] = c11[j]; - tempu[index++] = c12[j]; - tempu[index++] = c13[j]; - tempu[index++] = c14[j]; - tempu[index++] = c15[j]; - tempu[index++] = c16[j]; + tempu2[index++] = c1[j]; + tempu2[index++] = c2[j]; + tempu2[index++] = c3[j]; + tempu2[index++] = c4[j]; + tempu2[index++] = c5[j]; + tempu2[index++] = c6[j]; + tempu2[index++] = c7[j]; + tempu2[index++] = c8[j]; + tempu2[index++] = c9[j]; + tempu2[index++] = c10[j]; + tempu2[index++] = c11[j]; + tempu2[index++] = c12[j]; + tempu2[index++] = c13[j]; + tempu2[index++] = c14[j]; + tempu2[index++] = c15[j]; + tempu2[index++] = c16[j]; } } else { // frame_size == FRAME_SIZE_SHORT rows = frame_size / mod; - interleave_parity_bits(tempu, in); + interleave_parity_bits(tempu2.data(), in); - c1 = &tempv[0]; - c2 = &tempv[rows]; - c3 = &tempv[rows * 2]; - c4 = &tempv[rows * 3]; - c5 = &tempv[rows * 4]; - c6 = &tempv[rows * 5]; - c7 = &tempv[rows * 6]; - c8 = &tempv[rows * 7]; + c1 = &tempv2[0]; + c2 = &tempv2[rows]; + c3 = &tempv2[rows * 2]; + c4 = &tempv2[rows * 3]; + c5 = &tempv2[rows * 4]; + c6 = &tempv2[rows * 5]; + c7 = &tempv2[rows * 6]; + c8 = &tempv2[rows * 7]; - twist_interleave_columns(tempv, tempu, rows, mod, twist256s); + twist_interleave_columns(tempv2.data(), tempu2.data(), rows, mod, twist256s); for (int j = 0; j < rows; j++) { - tempu[index++] = c1[j]; - tempu[index++] = c2[j]; - tempu[index++] = c3[j]; - tempu[index++] = c4[j]; - tempu[index++] = c5[j]; - tempu[index++] = c6[j]; - tempu[index++] = c7[j]; - tempu[index++] = c8[j]; + tempu2[index++] = c1[j]; + tempu2[index++] = c2[j]; + tempu2[index++] = c3[j]; + tempu2[index++] = c4[j]; + tempu2[index++] = c5[j]; + tempu2[index++] = c6[j]; + tempu2[index++] = c7[j]; + tempu2[index++] = c8[j]; } } } - // tempu now has the input indices interleaved correctly, so save it - memcpy(lookup_table, tempu, frame_size * sizeof(int)); - - delete[] tempu; - delete[] tempv; + // tempu2 now has the input indices interleaved correctly, so save it + memcpy(lookup_table, tempu2.data(), frame_size * sizeof(int)); } /* diff --git a/gr-dtv/lib/dvbt2/dvbt2_paprtr_cc_impl.cc b/gr-dtv/lib/dvbt2/dvbt2_paprtr_cc_impl.cc index 33672fd632..adf4821d47 100644 --- a/gr-dtv/lib/dvbt2/dvbt2_paprtr_cc_impl.cc +++ b/gr-dtv/lib/dvbt2/dvbt2_paprtr_cc_impl.cc @@ -62,14 +62,19 @@ dvbt2_paprtr_cc_impl::dvbt2_paprtr_cc_impl(dvbt2_extended_carrier_t carriermode, : gr::sync_block("dvbt2_paprtr_cc", gr::io_signature::make(1, 1, sizeof(gr_complex) * vlength), gr::io_signature::make(1, 1, sizeof(gr_complex) * vlength)), + papr_fft_size(vlength), + papr_fft(vlength, false, 1), fft_size(fftsize), carrier_mode(carriermode), papr_mode(paprmode), version_num(version), v_clip(vclip), num_iterations(iterations), - papr_fft(vlength, false, 1), - papr_fft_size(vlength) + ones_freq(papr_fft_size), + ones_time(papr_fft_size), + c(papr_fft_size), + ctemp(papr_fft_size), + magnitude(papr_fft_size) { switch (fftsize) { case FFTSIZE_1K: @@ -526,82 +531,9 @@ dvbt2_paprtr_cc_impl::dvbt2_paprtr_cc_impl(dvbt2_extended_carrier_t carriermode, } left_nulls = ((vlength - C_PS) / 2) + 1; right_nulls = (vlength - C_PS) / 2; - ones_freq = (gr_complex*)volk_malloc(sizeof(gr_complex) * papr_fft_size, - volk_get_alignment()); - if (ones_freq == NULL) { - GR_LOG_FATAL(d_logger, - "Tone Reservation PAPR, cannot allocate memory for ones_freq."); - throw std::bad_alloc(); - } - ones_time = (gr_complex*)volk_malloc(sizeof(gr_complex) * papr_fft_size, - volk_get_alignment()); - if (ones_time == NULL) { - GR_LOG_FATAL(d_logger, - "Tone Reservation PAPR, cannot allocate memory for ones_time."); - volk_free(ones_freq); - throw std::bad_alloc(); - } - c = (gr_complex*)volk_malloc(sizeof(gr_complex) * papr_fft_size, - volk_get_alignment()); - if (c == NULL) { - GR_LOG_FATAL(d_logger, "Tone Reservation PAPR, cannot allocate memory for c."); - volk_free(ones_time); - volk_free(ones_freq); - throw std::bad_alloc(); - } - ctemp = (gr_complex*)volk_malloc(sizeof(gr_complex) * papr_fft_size, - volk_get_alignment()); - if (ctemp == NULL) { - GR_LOG_FATAL(d_logger, - "Tone Reservation PAPR, cannot allocate memory for ctemp."); - volk_free(c); - volk_free(ones_time); - volk_free(ones_freq); - throw std::bad_alloc(); - } - magnitude = (float*)volk_malloc(sizeof(float) * papr_fft_size, volk_get_alignment()); - if (magnitude == NULL) { - GR_LOG_FATAL(d_logger, - "Tone Reservation PAPR, cannot allocate memory for magnitude."); - volk_free(ctemp); - volk_free(c); - volk_free(ones_time); - volk_free(ones_freq); - throw std::bad_alloc(); - } - r = (gr_complex*)volk_malloc(sizeof(gr_complex) * N_TR, volk_get_alignment()); - if (r == NULL) { - GR_LOG_FATAL(d_logger, "Tone Reservation PAPR, cannot allocate memory for r."); - volk_free(magnitude); - volk_free(ctemp); - volk_free(c); - volk_free(ones_time); - volk_free(ones_freq); - throw std::bad_alloc(); - } - rNew = (gr_complex*)volk_malloc(sizeof(gr_complex) * N_TR, volk_get_alignment()); - if (rNew == NULL) { - GR_LOG_FATAL(d_logger, "Tone Reservation PAPR, cannot allocate memory for rNew."); - volk_free(r); - volk_free(magnitude); - volk_free(ctemp); - volk_free(c); - volk_free(ones_time); - volk_free(ones_freq); - throw std::bad_alloc(); - } - v = (gr_complex*)volk_malloc(sizeof(gr_complex) * N_TR, volk_get_alignment()); - if (v == NULL) { - GR_LOG_FATAL(d_logger, "Tone Reservation PAPR, cannot allocate memory for v."); - volk_free(rNew); - volk_free(r); - volk_free(magnitude); - volk_free(ctemp); - volk_free(c); - volk_free(ones_time); - volk_free(ones_freq); - throw std::bad_alloc(); - } + r.resize(N_TR); + rNew.resize(N_TR); + v.resize(N_TR); num_symbols = numdatasyms + N_P2; set_output_multiple(num_symbols); } @@ -609,17 +541,7 @@ dvbt2_paprtr_cc_impl::dvbt2_paprtr_cc_impl(dvbt2_extended_carrier_t carriermode, /* * Our virtual destructor. */ -dvbt2_paprtr_cc_impl::~dvbt2_paprtr_cc_impl() -{ - volk_free(v); - volk_free(rNew); - volk_free(r); - volk_free(magnitude); - volk_free(ctemp); - volk_free(c); - volk_free(ones_time); - volk_free(ones_freq); -} +dvbt2_paprtr_cc_impl::~dvbt2_paprtr_cc_impl() {} void dvbt2_paprtr_cc_impl::init_pilots(int symbol) { @@ -746,18 +668,21 @@ int dvbt2_paprtr_cc_impl::work(int noutput_items, &ones_freq[papr_fft_size / 2], sizeof(gr_complex) * papr_fft_size / 2); papr_fft.execute(); - memcpy(ones_time, + memcpy(ones_time.data(), papr_fft.get_outbuf(), sizeof(gr_complex) * papr_fft_size); volk_32fc_s32fc_multiply_32fc( - ones_time, ones_time, normalization, papr_fft_size); + ones_time.data(), ones_time.data(), normalization, papr_fft_size); std::fill_n(&r[0], N_TR, 0); std::fill_n(&c[0], papr_fft_size, 0); for (int k = 1; k <= num_iterations; k++) { y = 0.0; - volk_32f_x2_add_32f( - (float*)ctemp, (float*)in, (float*)c, papr_fft_size * 2); - volk_32fc_magnitude_32f(magnitude, ctemp, papr_fft_size); + volk_32f_x2_add_32f((float*)ctemp.data(), + (float*)in, + (float*)c.data(), + papr_fft_size * 2); + volk_32fc_magnitude_32f( + magnitude.data(), ctemp.data(), papr_fft_size); for (int n = 0; n < papr_fft_size; n++) { if (magnitude[n] > y) { y = magnitude[n]; @@ -781,19 +706,22 @@ int dvbt2_paprtr_cc_impl::work(int noutput_items, papr_fft_size; ctemp[n] = std::exp(gr_complexd(0.0, vtemp)); } - volk_32fc_s32fc_multiply_32fc(v, ctemp, u, N_TR); + volk_32fc_s32fc_multiply_32fc(v.data(), ctemp.data(), u, N_TR); volk_32f_s32f_multiply_32f( - (float*)rNew, (float*)v, alpha, N_TR * 2); - volk_32f_x2_subtract_32f( - (float*)rNew, (float*)r, (float*)rNew, N_TR * 2); - volk_32fc_x2_multiply_conjugate_32fc(ctemp, r, v, N_TR); + (float*)rNew.data(), (float*)v.data(), alpha, N_TR * 2); + volk_32f_x2_subtract_32f((float*)rNew.data(), + (float*)r.data(), + (float*)rNew.data(), + N_TR * 2); + volk_32fc_x2_multiply_conjugate_32fc( + ctemp.data(), r.data(), v.data(), N_TR); for (int n = 0; n < N_TR; n++) { alphaLimit[n] = std::sqrt((aMax * aMax) - (ctemp[n].imag() * ctemp[n].imag())) + ctemp[n].real(); } index = 0; - volk_32fc_magnitude_32f(magnitude, rNew, N_TR); + volk_32fc_magnitude_32f(magnitude.data(), rNew.data(), N_TR); for (int n = 0; n < N_TR; n++) { if (magnitude[n] > aMax) { alphaLimitMax[index++] = alphaLimit[n]; @@ -808,22 +736,26 @@ int dvbt2_paprtr_cc_impl::work(int noutput_items, } alpha = a; volk_32f_s32f_multiply_32f( - (float*)rNew, (float*)v, alpha, N_TR * 2); - volk_32f_x2_subtract_32f( - (float*)rNew, (float*)r, (float*)rNew, N_TR * 2); + (float*)rNew.data(), (float*)v.data(), alpha, N_TR * 2); + volk_32f_x2_subtract_32f((float*)rNew.data(), + (float*)r.data(), + (float*)rNew.data(), + N_TR * 2); } for (int n = 0; n < papr_fft_size; n++) { ones_freq[(n + m) % papr_fft_size] = ones_time[n]; } result = u * alpha; volk_32fc_s32fc_multiply_32fc( - ctemp, ones_freq, result, papr_fft_size); - volk_32f_x2_subtract_32f( - (float*)c, (float*)c, (float*)ctemp, papr_fft_size * 2); - memcpy(r, rNew, sizeof(gr_complex) * N_TR); + ctemp.data(), ones_freq.data(), result, papr_fft_size); + volk_32f_x2_subtract_32f((float*)c.data(), + (float*)c.data(), + (float*)ctemp.data(), + papr_fft_size * 2); + std::copy(std::begin(rNew), std::end(rNew), std::begin(r)); } volk_32f_x2_add_32f( - (float*)out, (float*)in, (float*)c, papr_fft_size * 2); + (float*)out, (float*)in, (float*)c.data(), papr_fft_size * 2); in = in + papr_fft_size; out = out + papr_fft_size; } else { diff --git a/gr-dtv/lib/dvbt2/dvbt2_paprtr_cc_impl.h b/gr-dtv/lib/dvbt2/dvbt2_paprtr_cc_impl.h index 01a5499891..f57781809a 100644 --- a/gr-dtv/lib/dvbt2/dvbt2_paprtr_cc_impl.h +++ b/gr-dtv/lib/dvbt2/dvbt2_paprtr_cc_impl.h @@ -33,6 +33,9 @@ namespace dtv { class dvbt2_paprtr_cc_impl : public dvbt2_paprtr_cc { private: + const int papr_fft_size; + fft::fft_complex papr_fft; + int num_symbols; int fft_size; int left_nulls; @@ -47,14 +50,14 @@ private: int p2_carrier_map[MAX_CARRIERS]; int data_carrier_map[MAX_CARRIERS]; int fc_carrier_map[MAX_CARRIERS]; - gr_complex* ones_freq; - gr_complex* ones_time; - gr_complex* c; - gr_complex* ctemp; - float* magnitude; - gr_complex* r; - gr_complex* rNew; - gr_complex* v; + volk::vector<gr_complex> ones_freq; + volk::vector<gr_complex> ones_time; + volk::vector<gr_complex> c; + volk::vector<gr_complex> ctemp; + volk::vector<float> magnitude; + volk::vector<gr_complex> r; + volk::vector<gr_complex> rNew; + volk::vector<gr_complex> v; float alphaLimit[MAX_PAPRTONES]; float alphaLimitMax[MAX_PAPRTONES]; int N_P2; @@ -67,9 +70,6 @@ private: int shift; void init_pilots(int); - fft::fft_complex papr_fft; - int papr_fft_size; - const static int p2_papr_map_1k[10]; const static int p2_papr_map_2k[18]; const static int p2_papr_map_4k[36]; @@ -94,6 +94,7 @@ public: float vclip, int iterations, unsigned int vlength); + ~dvbt2_paprtr_cc_impl(); int work(int noutput_items, |