mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-12 10:20:32 +00:00
Added direct_resampler files
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@171 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
parent
203ccbdffb
commit
9eac86f3f2
@ -0,0 +1,128 @@
|
||||
/*!
|
||||
* \file direct_resampler_conditioner.cc
|
||||
* \brief Implementation of an adapter of a direct resampler conditioner block
|
||||
* to a SignalConditionerInterface
|
||||
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (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 "direct_resampler_conditioner.h"
|
||||
#include <gnuradio/gr_file_sink.h>
|
||||
#include "direct_resampler_conditioner_cc.h"
|
||||
//#include "direct_resampler_conditioner_ss.h"
|
||||
#include "configuration_interface.h"
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
DirectResamplerConditioner::DirectResamplerConditioner(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_stream, unsigned int out_stream) :
|
||||
role_(role), in_stream_(in_stream), out_stream_(out_stream)
|
||||
{
|
||||
|
||||
std::string default_item_type = "short";
|
||||
std::string default_dump_file = "./data/signal_conditioner.dat";
|
||||
|
||||
sample_freq_in_ = configuration->property(role_ + ".sample_freq_in",
|
||||
(double)4000000.0);
|
||||
sample_freq_out_ = configuration->property(role_ + ".sample_freq_out",
|
||||
(double)2048000.0);
|
||||
item_type_ = configuration->property(role + ".item_type",
|
||||
default_item_type);
|
||||
dump_ = configuration->property(role + ".dump", false);
|
||||
dump_filename_ = configuration->property(role + ".dump_filename",
|
||||
default_dump_file);
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
resampler_ = direct_resampler_make_conditioner_cc(sample_freq_in_,
|
||||
sample_freq_out_);
|
||||
}
|
||||
// else if (item_type_.compare("short") == 0)
|
||||
// {
|
||||
// item_size_ = sizeof(short);
|
||||
// resampler_ = direct_resampler_make_conditioner_ss(sample_freq_in_,
|
||||
// sample_freq_out_);
|
||||
// }
|
||||
else
|
||||
{
|
||||
LOG_AT_LEVEL(WARNING) << item_type_
|
||||
<< " unrecognized item type. Using short";
|
||||
item_size_ = sizeof(short);
|
||||
}
|
||||
|
||||
if (dump_)
|
||||
{
|
||||
DLOG(INFO) << "Dumping output into file " << dump_filename_;
|
||||
file_sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str());
|
||||
}
|
||||
|
||||
DLOG(INFO) << "sample_freq_in " << sample_freq_in_;
|
||||
DLOG(INFO) << "sample_freq_out" << sample_freq_out_;
|
||||
DLOG(INFO) << "Item size " << item_size_;
|
||||
DLOG(INFO) << "resampler(" << resampler_->unique_id() << ")";
|
||||
if (dump_)
|
||||
{
|
||||
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
|
||||
}
|
||||
}
|
||||
DirectResamplerConditioner::~DirectResamplerConditioner() {}
|
||||
|
||||
void DirectResamplerConditioner::connect(gr_top_block_sptr top_block)
|
||||
{
|
||||
|
||||
if (dump_)
|
||||
{
|
||||
top_block->connect(resampler_, 0, file_sink_, 0);
|
||||
DLOG(INFO) << "connected resampler to file sink";
|
||||
}
|
||||
else
|
||||
{
|
||||
DLOG(INFO) << "nothing to connect internally";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void DirectResamplerConditioner::disconnect(gr_top_block_sptr top_block)
|
||||
{
|
||||
if (dump_)
|
||||
{
|
||||
top_block->disconnect(resampler_, 0, file_sink_, 0);
|
||||
}
|
||||
}
|
||||
|
||||
gr_basic_block_sptr DirectResamplerConditioner::get_left_block()
|
||||
{
|
||||
return resampler_;
|
||||
}
|
||||
|
||||
gr_basic_block_sptr DirectResamplerConditioner::get_right_block()
|
||||
{
|
||||
return resampler_;
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
/*!
|
||||
* \file direct_resampler_conditioner.h
|
||||
* \brief Interface of an adapter of a direct resampler conditioner block
|
||||
* to a SignalConditionerInterface
|
||||
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (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/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#ifndef GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_H_
|
||||
#define GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_H_
|
||||
|
||||
#include <gnuradio/gr_hier_block2.h>
|
||||
#include "gnss_block_interface.h"
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
class DirectResamplerConditioner: public GNSSBlockInterface
|
||||
{
|
||||
|
||||
public:
|
||||
DirectResamplerConditioner(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_stream,
|
||||
unsigned int out_stream);
|
||||
|
||||
virtual ~DirectResamplerConditioner();
|
||||
|
||||
std::string role()
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
std::string implementation()
|
||||
{
|
||||
return "DirectResamplerConditioner";
|
||||
}
|
||||
size_t item_size()
|
||||
{
|
||||
return item_size_;
|
||||
}
|
||||
|
||||
void connect(gr_top_block_sptr top_block);
|
||||
void disconnect(gr_top_block_sptr top_block);
|
||||
gr_basic_block_sptr get_left_block();
|
||||
gr_basic_block_sptr get_right_block();
|
||||
|
||||
private:
|
||||
|
||||
std::string role_;
|
||||
unsigned int in_stream_;
|
||||
unsigned int out_stream_;
|
||||
std::string item_type_;
|
||||
size_t item_size_;
|
||||
long samples_;
|
||||
bool dump_;
|
||||
std::string dump_filename_;
|
||||
double sample_freq_in_;
|
||||
double sample_freq_out_;
|
||||
gr_block_sptr resampler_;
|
||||
gr_block_sptr file_sink_;
|
||||
};
|
||||
|
||||
#endif /*GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_H_*/
|
@ -0,0 +1,141 @@
|
||||
/*!
|
||||
* \file direct_resampler_conditioner_cc.cc
|
||||
* \brief Nearest neighborhood resampler with
|
||||
* gr_complex input and gr_complex output
|
||||
* \author Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* Detailed description of the file here if needed.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (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 "direct_resampler_conditioner_cc.h"
|
||||
#include <iostream>
|
||||
#include <gnuradio/gr_io_signature.h>
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
direct_resampler_conditioner_cc_sptr direct_resampler_make_conditioner_cc(
|
||||
double sample_freq_in, double sample_freq_out)
|
||||
{
|
||||
|
||||
return direct_resampler_conditioner_cc_sptr(
|
||||
new direct_resampler_conditioner_cc(sample_freq_in,
|
||||
sample_freq_out));
|
||||
}
|
||||
|
||||
direct_resampler_conditioner_cc::direct_resampler_conditioner_cc(
|
||||
double sample_freq_in, double sample_freq_out) :
|
||||
gr_block("direct_resampler_conditioner_cc", gr_make_io_signature(1, 1,
|
||||
sizeof(gr_complex)), gr_make_io_signature(1, 1,
|
||||
sizeof(gr_complex))), d_sample_freq_in(sample_freq_in),
|
||||
d_sample_freq_out(sample_freq_out), d_phase(0), d_lphase(0),
|
||||
d_history(1)
|
||||
{
|
||||
|
||||
// Computes the phase step multiplying the resampling ratio by 2^32 = 4294967296
|
||||
if (d_sample_freq_in >= d_sample_freq_out)
|
||||
{
|
||||
d_phase_step = (unsigned int)floor((double)4294967296.0
|
||||
* sample_freq_out / sample_freq_in);
|
||||
}
|
||||
else
|
||||
{
|
||||
d_phase_step = (unsigned int)floor((double)4294967296.0
|
||||
* sample_freq_in / sample_freq_out);
|
||||
}
|
||||
|
||||
set_relative_rate(1.0 * sample_freq_out / sample_freq_in);
|
||||
set_output_multiple(1);
|
||||
}
|
||||
|
||||
direct_resampler_conditioner_cc::~direct_resampler_conditioner_cc()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void direct_resampler_conditioner_cc::forecast(int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
{
|
||||
|
||||
int nreqd = std::max((unsigned)1, (int)((double)(noutput_items + 1)
|
||||
* sample_freq_in() / sample_freq_out()) + history() - 1);
|
||||
unsigned ninputs = ninput_items_required.size();
|
||||
|
||||
for (unsigned i = 0; i < ninputs; i++)
|
||||
{
|
||||
ninput_items_required[i] = nreqd;
|
||||
}
|
||||
}
|
||||
|
||||
int direct_resampler_conditioner_cc::general_work(int noutput_items,
|
||||
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
|
||||
const gr_complex *in = (const gr_complex *)input_items[0];
|
||||
gr_complex *out = (gr_complex *)output_items[0];
|
||||
|
||||
int lcv = 0;
|
||||
int count = 0;
|
||||
|
||||
if (d_sample_freq_in >= d_sample_freq_out)
|
||||
{
|
||||
while ((lcv < noutput_items))
|
||||
{
|
||||
if (d_phase <= d_lphase)
|
||||
{
|
||||
out[lcv] = *in;
|
||||
lcv++;
|
||||
}
|
||||
|
||||
d_lphase = d_phase;
|
||||
d_phase += d_phase_step;
|
||||
in++;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while ((lcv < noutput_items))
|
||||
{
|
||||
d_lphase = d_phase;
|
||||
d_phase += d_phase_step;
|
||||
if (d_phase <= d_lphase)
|
||||
{
|
||||
in++;
|
||||
count++;
|
||||
}
|
||||
out[lcv] = *in;
|
||||
lcv++;
|
||||
}
|
||||
}
|
||||
|
||||
consume_each(std::min(count, ninput_items[0]));
|
||||
return lcv;
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
/*!
|
||||
* \file direct_resampler_conditioner_cc.h
|
||||
*
|
||||
* \brief Nearest neighborhood resampler with
|
||||
* gr_complex input and gr_complex output
|
||||
* \author Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* This block takes in a signal stream and performs direct
|
||||
* resampling.
|
||||
* The theory behind this block can be found in Chapter 7.5 of
|
||||
* the following book.
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (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/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_CC_H
|
||||
#define GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_CC_H
|
||||
|
||||
#include <gnuradio/gr_block.h>
|
||||
|
||||
class direct_resampler_conditioner_cc;
|
||||
typedef boost::shared_ptr<direct_resampler_conditioner_cc>
|
||||
direct_resampler_conditioner_cc_sptr;
|
||||
direct_resampler_conditioner_cc_sptr
|
||||
direct_resampler_make_conditioner_cc(double sample_freq_in,
|
||||
double sample_freq_out);
|
||||
|
||||
/*!
|
||||
* \brief This class implements a direct resampler conditioner for complex data
|
||||
*
|
||||
* Direct resampling without interpolation
|
||||
*/
|
||||
class direct_resampler_conditioner_cc: public gr_block
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
friend direct_resampler_conditioner_cc_sptr
|
||||
direct_resampler_make_conditioner_cc(double sample_freq_in,
|
||||
double sample_freq_out);
|
||||
|
||||
double d_sample_freq_in; //! Specifies the sampling frequency of the input signal
|
||||
double d_sample_freq_out; //! Specifies the sampling frequency of the output signal
|
||||
unsigned int d_phase;
|
||||
unsigned int d_lphase;
|
||||
unsigned int d_phase_step;
|
||||
unsigned int d_history;
|
||||
|
||||
direct_resampler_conditioner_cc(double sample_freq_in,
|
||||
double sample_freq_out);
|
||||
|
||||
public:
|
||||
|
||||
~direct_resampler_conditioner_cc();
|
||||
|
||||
unsigned int sample_freq_in() const
|
||||
{
|
||||
return d_sample_freq_in;
|
||||
}
|
||||
unsigned int sample_freq_out() const
|
||||
{
|
||||
return d_sample_freq_out;
|
||||
}
|
||||
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
|
||||
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items);
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_CC_H */
|
@ -0,0 +1,141 @@
|
||||
/*!
|
||||
* \file direct_resampler_conditioner_ss.cc
|
||||
* \brief Nearest neighborhood resampler with
|
||||
* short input and short output
|
||||
* \author Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* Detailed description of the file here if needed.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (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 "direct_resampler_conditioner_ss.h"
|
||||
#include "gps_sdr_signal_processing.h"
|
||||
#include <iostream>
|
||||
#include <gnuradio/gr_io_signature.h>
|
||||
#include <glog/log_severity.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
direct_resampler_conditioner_ss_sptr direct_resampler_make_conditioner_ss(
|
||||
double sample_freq_in, double sample_freq_out)
|
||||
{
|
||||
|
||||
return direct_resampler_conditioner_ss_sptr(
|
||||
new direct_resampler_conditioner_ss(sample_freq_in,
|
||||
sample_freq_out));
|
||||
}
|
||||
|
||||
direct_resampler_conditioner_ss::direct_resampler_conditioner_ss(
|
||||
double sample_freq_in, double sample_freq_out) :
|
||||
gr_block("direct_resampler_make_conditioner_ss", gr_make_io_signature(1,
|
||||
1, sizeof(short)), gr_make_io_signature(1, 1, sizeof(short))),
|
||||
d_sample_freq_in(sample_freq_in), d_sample_freq_out(
|
||||
sample_freq_out), d_phase(0), d_lphase(0), d_history(1)
|
||||
{
|
||||
|
||||
// Computes the phase step multiplying the resampling ratio by 2^32 = 4294967296
|
||||
if (d_sample_freq_in >= d_sample_freq_out)
|
||||
{
|
||||
d_phase_step = (unsigned int)floor((double)4294967296.0
|
||||
* sample_freq_out / sample_freq_in);
|
||||
}
|
||||
else
|
||||
{
|
||||
d_phase_step = (unsigned int)floor((double)4294967296.0
|
||||
* sample_freq_in / sample_freq_out);
|
||||
}
|
||||
|
||||
set_relative_rate(1.0 * sample_freq_out / sample_freq_in);
|
||||
set_output_multiple(1);
|
||||
}
|
||||
|
||||
direct_resampler_conditioner_ss::~direct_resampler_conditioner_ss()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void direct_resampler_conditioner_ss::forecast(int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
{
|
||||
|
||||
int nreqd = std::max((unsigned)1, (int)((double)(noutput_items + 1)
|
||||
* sample_freq_in() / sample_freq_out()) + history() - 1);
|
||||
unsigned ninputs = ninput_items_required.size();
|
||||
|
||||
for (unsigned i = 0; i < ninputs; i++)
|
||||
{
|
||||
ninput_items_required[i] = nreqd;
|
||||
}
|
||||
}
|
||||
|
||||
int direct_resampler_conditioner_ss::general_work(int noutput_items,
|
||||
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
|
||||
const CPX *in = (const CPX *)input_items[0];
|
||||
CPX *out = (CPX *)output_items[0];
|
||||
|
||||
int lcv = 0;
|
||||
int count = 0;
|
||||
|
||||
if (d_sample_freq_in >= d_sample_freq_out)
|
||||
{
|
||||
while ((lcv < noutput_items))
|
||||
{
|
||||
if (d_phase <= d_lphase)
|
||||
{
|
||||
out[lcv] = *in;
|
||||
lcv++;
|
||||
}
|
||||
|
||||
d_lphase = d_phase;
|
||||
d_phase += d_phase_step;
|
||||
in++;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while ((lcv < noutput_items))
|
||||
{
|
||||
d_lphase = d_phase;
|
||||
d_phase += d_phase_step;
|
||||
if (d_phase <= d_lphase)
|
||||
{
|
||||
in++;
|
||||
count++;
|
||||
}
|
||||
out[lcv] = *in;
|
||||
lcv++;
|
||||
}
|
||||
}
|
||||
|
||||
consume_each(std::min(count, ninput_items[0]));
|
||||
return lcv;
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
/*!
|
||||
* \file direct_resampler_conditioner_ss.h
|
||||
* \brief Nearest neighborhood resampler with
|
||||
* short input and short output
|
||||
* \author Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2011 (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/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_SS_H
|
||||
#define GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_SS_H
|
||||
|
||||
#include <gnuradio/gr_block.h>
|
||||
|
||||
class direct_resampler_conditioner_ss;
|
||||
typedef boost::shared_ptr<direct_resampler_conditioner_ss>
|
||||
direct_resampler_conditioner_ss_sptr;
|
||||
direct_resampler_conditioner_ss_sptr
|
||||
direct_resampler_make_conditioner_ss(double sample_freq_in,
|
||||
double sample_freq_out);
|
||||
/*!
|
||||
* \brief This class implements a direct resampler conditioner for shorts
|
||||
*
|
||||
* Direct resampling without interpolation
|
||||
*/
|
||||
class direct_resampler_conditioner_ss: public gr_block
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
friend direct_resampler_conditioner_ss_sptr
|
||||
direct_resampler_make_conditioner_ss(double sample_freq_in,
|
||||
double sample_freq_out);
|
||||
|
||||
double d_sample_freq_in;
|
||||
double d_sample_freq_out;
|
||||
unsigned int d_phase;
|
||||
unsigned int d_lphase;
|
||||
unsigned int d_phase_step;
|
||||
unsigned int d_history;
|
||||
|
||||
direct_resampler_conditioner_ss(double sample_freq_in,
|
||||
double sample_freq_out);
|
||||
|
||||
public:
|
||||
|
||||
~direct_resampler_conditioner_ss();
|
||||
|
||||
unsigned int sample_freq_in() const
|
||||
{
|
||||
return d_sample_freq_in;
|
||||
}
|
||||
unsigned int sample_freq_out() const
|
||||
{
|
||||
return d_sample_freq_out;
|
||||
}
|
||||
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
|
||||
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items);
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_SS_H */
|
Loading…
Reference in New Issue
Block a user