2015-02-04 20:45:16 +00:00
|
|
|
/*!
|
|
|
|
* \file complex_float_to_complex_byte.cc
|
|
|
|
* \brief Adapts a gr_complex stream into a std::complex<signed char> stream
|
|
|
|
* \author Carles Fernandez Prades, cfernandez(at)cttc.es
|
|
|
|
*
|
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
|
2015-02-04 20:45:16 +00:00
|
|
|
*
|
|
|
|
* GNSS-SDR is a software defined Global Navigation
|
|
|
|
* Satellite Systems receiver
|
|
|
|
*
|
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
2020-02-08 00:20:02 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2015-02-04 20:45:16 +00:00
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2015-02-04 20:45:16 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "complex_float_to_complex_byte.h"
|
|
|
|
#include <gnuradio/io_signature.h>
|
2018-02-26 02:15:53 +00:00
|
|
|
#include <volk_gnsssdr/volk_gnsssdr.h>
|
2019-03-05 11:33:54 +00:00
|
|
|
#include <algorithm> // for max
|
2015-02-04 20:45:16 +00:00
|
|
|
|
|
|
|
complex_float_to_complex_byte_sptr make_complex_float_to_complex_byte()
|
|
|
|
{
|
|
|
|
return complex_float_to_complex_byte_sptr(new complex_float_to_complex_byte());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
complex_float_to_complex_byte::complex_float_to_complex_byte() : sync_block("complex_float_to_complex_byte",
|
2018-03-03 01:03:39 +00:00
|
|
|
gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
|
|
|
gr::io_signature::make(1, 1, sizeof(lv_8sc_t))) // lv_8sc_t is a Volk's typedef for std::complex<signed char>
|
2015-02-04 20:45:16 +00:00
|
|
|
{
|
2020-07-10 20:06:29 +00:00
|
|
|
const auto alignment_multiple = static_cast<int>(volk_gnsssdr_get_alignment() / sizeof(lv_8sc_t));
|
2015-02-04 20:45:16 +00:00
|
|
|
set_alignment(std::max(1, alignment_multiple));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int complex_float_to_complex_byte::work(int noutput_items,
|
2018-03-03 01:03:39 +00:00
|
|
|
gr_vector_const_void_star &input_items,
|
|
|
|
gr_vector_void_star &output_items)
|
2015-02-04 20:45:16 +00:00
|
|
|
{
|
2018-12-03 15:25:11 +00:00
|
|
|
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]);
|
|
|
|
auto *out = reinterpret_cast<lv_8sc_t *>(output_items[0]);
|
2015-02-04 20:45:16 +00:00
|
|
|
volk_gnsssdr_32fc_convert_8ic(out, in, noutput_items);
|
|
|
|
return noutput_items;
|
|
|
|
}
|