mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 12:10:34 +00:00
Rational_Resampler renamed to Mmse_Resampler
Following its renaming in GNU Radio 3.8 (see https://github.com/gnuradio/gnuradio/issues/1428)
This commit is contained in:
parent
199b1a9cff
commit
891d6b80df
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
set(RESAMPLER_ADAPTER_SOURCES
|
set(RESAMPLER_ADAPTER_SOURCES
|
||||||
direct_resampler_conditioner.cc
|
direct_resampler_conditioner.cc
|
||||||
fractional_resampler_conditioner.cc
|
mmse_resampler_conditioner.cc
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*!
|
/*!
|
||||||
* \file fractional_resampler_conditioner.cc
|
* \file mmse_resampler_conditioner.cc
|
||||||
* \brief Implementation of an adapter of a fractional resampler conditioner block
|
* \brief Implementation of an adapter of a MMSE resampler conditioner block
|
||||||
* to a SignalConditionerInterface
|
* to a SignalConditionerInterface
|
||||||
* \author Antonio Ramos, 2018. antonio.ramos(at)cttc.es
|
* \author Antonio Ramos, 2018. antonio.ramos(at)cttc.es
|
||||||
*
|
*
|
||||||
@ -29,7 +29,7 @@
|
|||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fractional_resampler_conditioner.h"
|
#include "mmse_resampler_conditioner.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
using google::LogMessage;
|
using google::LogMessage;
|
||||||
|
|
||||||
FractionalResamplerConditioner::FractionalResamplerConditioner(
|
MmseResamplerConditioner::MmseResamplerConditioner(
|
||||||
ConfigurationInterface* configuration, std::string role,
|
ConfigurationInterface* configuration, std::string role,
|
||||||
unsigned int in_stream, unsigned int out_stream) :
|
unsigned int in_stream, unsigned int out_stream) :
|
||||||
role_(role), in_stream_(in_stream), out_stream_(out_stream)
|
role_(role), in_stream_(in_stream), out_stream_(out_stream)
|
||||||
@ -89,11 +89,11 @@ FractionalResamplerConditioner::FractionalResamplerConditioner(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FractionalResamplerConditioner::~FractionalResamplerConditioner() {}
|
MmseResamplerConditioner::~MmseResamplerConditioner() {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void FractionalResamplerConditioner::connect(gr::top_block_sptr top_block)
|
void MmseResamplerConditioner::connect(gr::top_block_sptr top_block)
|
||||||
{
|
{
|
||||||
if (dump_)
|
if (dump_)
|
||||||
{
|
{
|
||||||
@ -107,7 +107,7 @@ void FractionalResamplerConditioner::connect(gr::top_block_sptr top_block)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FractionalResamplerConditioner::disconnect(gr::top_block_sptr top_block)
|
void MmseResamplerConditioner::disconnect(gr::top_block_sptr top_block)
|
||||||
{
|
{
|
||||||
if (dump_)
|
if (dump_)
|
||||||
{
|
{
|
||||||
@ -116,13 +116,13 @@ void FractionalResamplerConditioner::disconnect(gr::top_block_sptr top_block)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gr::basic_block_sptr FractionalResamplerConditioner::get_left_block()
|
gr::basic_block_sptr MmseResamplerConditioner::get_left_block()
|
||||||
{
|
{
|
||||||
return resampler_;
|
return resampler_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gr::basic_block_sptr FractionalResamplerConditioner::get_right_block()
|
gr::basic_block_sptr MmseResamplerConditioner::get_right_block()
|
||||||
{
|
{
|
||||||
return resampler_;
|
return resampler_;
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
/*!
|
/*!
|
||||||
* \file fractional_resampler_conditioner.h
|
* \file mmse_resampler_conditioner.h
|
||||||
* \brief Interface of an adapter of a fractional resampler conditioner block
|
* \brief Interface of an adapter of a mmse resampler conditioner block
|
||||||
* to a SignalConditionerInterface
|
* to a SignalConditionerInterface
|
||||||
* \author Antonio Ramos, 2018. antonio.ramos(at)cttc.es
|
* \author Antonio Ramos, 2018. antonio.ramos(at)cttc.es
|
||||||
*
|
*
|
||||||
@ -30,8 +30,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef GNSS_SDR_FRACTIONAL_RESAMPLER_CONDITIONER_H_
|
#ifndef GNSS_SDR_MMSE_RESAMPLER_CONDITIONER_H_
|
||||||
#define GNSS_SDR_FRACTIONAL_RESAMPLER_CONDITIONER_H_
|
#define GNSS_SDR_MMSE_RESAMPLER_CONDITIONER_H_
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#ifdef GR_GREATER_38
|
#ifdef GR_GREATER_38
|
||||||
@ -44,17 +44,17 @@
|
|||||||
class ConfigurationInterface;
|
class ConfigurationInterface;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Interface of an adapter of a fractional resampler conditioner block
|
* \brief Interface of a MMSE resampler block adapter
|
||||||
* to a SignalConditionerInterface
|
* to a SignalConditionerInterface
|
||||||
*/
|
*/
|
||||||
class FractionalResamplerConditioner: public GNSSBlockInterface
|
class MmseResamplerConditioner: public GNSSBlockInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FractionalResamplerConditioner(ConfigurationInterface* configuration,
|
MmseResamplerConditioner(ConfigurationInterface* configuration,
|
||||||
std::string role, unsigned int in_stream,
|
std::string role, unsigned int in_stream,
|
||||||
unsigned int out_stream);
|
unsigned int out_stream);
|
||||||
|
|
||||||
virtual ~FractionalResamplerConditioner();
|
virtual ~MmseResamplerConditioner();
|
||||||
|
|
||||||
inline std::string role() override
|
inline std::string role() override
|
||||||
{
|
{
|
||||||
@ -63,7 +63,7 @@ public:
|
|||||||
|
|
||||||
inline std::string implementation() override
|
inline std::string implementation() override
|
||||||
{
|
{
|
||||||
return "Fractional_Resampler";
|
return "Mmse_Resampler";
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t item_size() override
|
inline size_t item_size() override
|
@ -62,7 +62,7 @@
|
|||||||
#include "ishort_to_cshort.h"
|
#include "ishort_to_cshort.h"
|
||||||
#include "ishort_to_complex.h"
|
#include "ishort_to_complex.h"
|
||||||
#include "direct_resampler_conditioner.h"
|
#include "direct_resampler_conditioner.h"
|
||||||
#include "fractional_resampler_conditioner.h"
|
#include "mmse_resampler_conditioner.h"
|
||||||
#include "fir_filter.h"
|
#include "fir_filter.h"
|
||||||
#include "freq_xlating_fir_filter.h"
|
#include "freq_xlating_fir_filter.h"
|
||||||
#include "beamformer_filter.h"
|
#include "beamformer_filter.h"
|
||||||
@ -1171,9 +1171,9 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetBlock(
|
|||||||
block = std::move(block_);
|
block = std::move(block_);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (implementation.compare("Fractional_Resampler") == 0)
|
else if ((implementation.compare("Fractional_Resampler") == 0) || (implementation.compare("Mmse_Resampler") == 0))
|
||||||
{
|
{
|
||||||
std::unique_ptr<GNSSBlockInterface> block_(new FractionalResamplerConditioner(configuration.get(), role,
|
std::unique_ptr<GNSSBlockInterface> block_(new MmseResamplerConditioner(configuration.get(), role,
|
||||||
in_streams, out_streams));
|
in_streams, out_streams));
|
||||||
block = std::move(block_);
|
block = std::move(block_);
|
||||||
}
|
}
|
||||||
|
@ -161,6 +161,10 @@ if(GNUPLOT_FOUND)
|
|||||||
add_definitions(-DGNUPLOT_EXECUTABLE="${GNUPLOT_EXECUTABLE}")
|
add_definitions(-DGNUPLOT_EXECUTABLE="${GNUPLOT_EXECUTABLE}")
|
||||||
endif(GNUPLOT_FOUND)
|
endif(GNUPLOT_FOUND)
|
||||||
|
|
||||||
|
if(${PC_GNURADIO_RUNTIME_VERSION} VERSION_GREATER "3.7.13" )
|
||||||
|
add_definitions( -DGR_GREATER_38=1 )
|
||||||
|
endif(${PC_GNURADIO_RUNTIME_VERSION} VERSION_GREATER "3.7.13" )
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Optional generator
|
# Optional generator
|
||||||
@ -298,6 +302,7 @@ include_directories(
|
|||||||
${CMAKE_SOURCE_DIR}/src/algorithms/libs
|
${CMAKE_SOURCE_DIR}/src/algorithms/libs
|
||||||
${CMAKE_SOURCE_DIR}/src/algorithms/data_type_adapter/adapters
|
${CMAKE_SOURCE_DIR}/src/algorithms/data_type_adapter/adapters
|
||||||
${CMAKE_SOURCE_DIR}/src/algorithms/data_type_adapter/gnuradio_blocks
|
${CMAKE_SOURCE_DIR}/src/algorithms/data_type_adapter/gnuradio_blocks
|
||||||
|
${CMAKE_SOURCE_DIR}/src/algorithms/resampler/adapters
|
||||||
${CMAKE_SOURCE_DIR}/src/algorithms/resampler/gnuradio_blocks
|
${CMAKE_SOURCE_DIR}/src/algorithms/resampler/gnuradio_blocks
|
||||||
${CMAKE_SOURCE_DIR}/src/algorithms/channel/adapters
|
${CMAKE_SOURCE_DIR}/src/algorithms/channel/adapters
|
||||||
${CMAKE_SOURCE_DIR}/src/algorithms/channel/libs
|
${CMAKE_SOURCE_DIR}/src/algorithms/channel/libs
|
||||||
|
@ -97,6 +97,7 @@ DECLARE_string(log_dir);
|
|||||||
#include "unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc"
|
#include "unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc"
|
||||||
|
|
||||||
#include "unit-tests/signal-processing-blocks/resampler/direct_resampler_conditioner_cc_test.cc"
|
#include "unit-tests/signal-processing-blocks/resampler/direct_resampler_conditioner_cc_test.cc"
|
||||||
|
#include "unit-tests/signal-processing-blocks/resampler/mmse_resampler_test.cc"
|
||||||
|
|
||||||
#include "unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc"
|
#include "unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc"
|
||||||
#include "unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc"
|
#include "unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc"
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \file direct_resampler_conditioner_cc_test.cc
|
* \file direct_resampler_conditioner_cc_test.cc
|
||||||
* \brief Executes a resampler based on some input parameters.
|
* \brief Executes a resampler based on some input parameters.
|
||||||
|
@ -0,0 +1,122 @@
|
|||||||
|
/*!
|
||||||
|
* \file mmse_resampler_test.cc
|
||||||
|
* \brief Executes a resampler based on some input parameters.
|
||||||
|
* \author Carles Fernandez-Prades 2018 cfernandez (at) cttc.cat
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR 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 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR 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 GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <iostream>
|
||||||
|
#include <gnuradio/top_block.h>
|
||||||
|
#include <gnuradio/analog/sig_source_waveform.h>
|
||||||
|
#include <gnuradio/analog/sig_source_c.h>
|
||||||
|
#include <gnuradio/msg_queue.h>
|
||||||
|
#include <gnuradio/blocks/null_sink.h>
|
||||||
|
#include "gnss_sdr_valve.h"
|
||||||
|
#include "mmse_resampler_conditioner.h"
|
||||||
|
|
||||||
|
TEST(MmseResamplerTest, InstantiationAndRunTestWarning)
|
||||||
|
{
|
||||||
|
double fs_in = 8000000.0; // Input sampling frequency in Hz
|
||||||
|
double fs_out = 4000000.0; // sampling freuqncy of the resampled signal in Hz
|
||||||
|
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||||
|
std::chrono::duration<double> elapsed_seconds(0);
|
||||||
|
int nsamples = 1000000; //Number of samples to be computed
|
||||||
|
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
|
||||||
|
gr::top_block_sptr top_block = gr::make_top_block("mmse_resampler_conditioner_cc_test");
|
||||||
|
boost::shared_ptr<gr::analog::sig_source_c> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0));
|
||||||
|
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||||
|
|
||||||
|
std::shared_ptr<InMemoryConfiguration> config;
|
||||||
|
config = std::make_shared<InMemoryConfiguration>();
|
||||||
|
|
||||||
|
config->set_property("Resampler.sample_freq_in", std::to_string(fs_in));
|
||||||
|
config->set_property("Resampler.sample_freq_out", std::to_string(fs_out));
|
||||||
|
|
||||||
|
std::shared_ptr<MmseResamplerConditioner> resampler = std::make_shared<MmseResamplerConditioner>(config.get(), "Resampler", 1, 1);
|
||||||
|
|
||||||
|
gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(gr_complex));
|
||||||
|
|
||||||
|
EXPECT_NO_THROW( {
|
||||||
|
resampler->connect(top_block);
|
||||||
|
top_block->connect(source, 0, valve, 0);
|
||||||
|
top_block->connect(valve, 0, resampler->get_left_block(), 0);
|
||||||
|
top_block->connect(resampler->get_right_block(), 0, sink, 0);
|
||||||
|
}) << "Connection failure of direct_resampler_conditioner.";
|
||||||
|
|
||||||
|
EXPECT_NO_THROW( {
|
||||||
|
start = std::chrono::system_clock::now();
|
||||||
|
top_block->run(); // Start threads and wait
|
||||||
|
end = std::chrono::system_clock::now();
|
||||||
|
elapsed_seconds = end - start;
|
||||||
|
top_block->stop();
|
||||||
|
}) << "Failure running direct_resampler_conditioner.";
|
||||||
|
|
||||||
|
std::cout << "Resampled " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST(MmseResamplerTest, InstantiationAndRunTest2)
|
||||||
|
{
|
||||||
|
double fs_in = 8000000.0; // Input sampling frequency in Hz
|
||||||
|
double fs_out = 4000000.0; // sampling freuqncy of the resampled signal in Hz
|
||||||
|
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||||
|
std::chrono::duration<double> elapsed_seconds(0);
|
||||||
|
int nsamples = 1000000; //Number of samples to be computed
|
||||||
|
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
|
||||||
|
gr::top_block_sptr top_block = gr::make_top_block("mmse_resampler_conditioner_cc_test");
|
||||||
|
boost::shared_ptr<gr::analog::sig_source_c> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0));
|
||||||
|
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||||
|
|
||||||
|
std::shared_ptr<InMemoryConfiguration> config;
|
||||||
|
config = std::make_shared<InMemoryConfiguration>();
|
||||||
|
|
||||||
|
config->set_property("Resampler.sample_freq_in", std::to_string(fs_in));
|
||||||
|
config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(fs_out));
|
||||||
|
|
||||||
|
std::shared_ptr<MmseResamplerConditioner> resampler = std::make_shared<MmseResamplerConditioner>(config.get(), "Resampler", 1, 1);
|
||||||
|
|
||||||
|
gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(gr_complex));
|
||||||
|
|
||||||
|
EXPECT_NO_THROW( {
|
||||||
|
resampler->connect(top_block);
|
||||||
|
top_block->connect(source, 0, valve, 0);
|
||||||
|
top_block->connect(valve, 0, resampler->get_left_block(), 0);
|
||||||
|
top_block->connect(resampler->get_right_block(), 0, sink, 0);
|
||||||
|
}) << "Connection failure of direct_resampler_conditioner.";
|
||||||
|
|
||||||
|
EXPECT_NO_THROW( {
|
||||||
|
start = std::chrono::system_clock::now();
|
||||||
|
top_block->run(); // Start threads and wait
|
||||||
|
end = std::chrono::system_clock::now();
|
||||||
|
elapsed_seconds = end - start;
|
||||||
|
top_block->stop();
|
||||||
|
}) << "Failure running direct_resampler_conditioner.";
|
||||||
|
|
||||||
|
std::cout << "Resampled " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user