2019-04-26 12:27:38 -07:00
|
|
|
/*
|
2020-03-13 04:12:52 -07:00
|
|
|
* Copyright 2013-2020 Software Radio Systems Limited
|
2014-03-03 11:09:26 -08:00
|
|
|
*
|
2019-04-26 12:27:38 -07:00
|
|
|
* This file is part of srsLTE.
|
2014-03-03 11:09:26 -08:00
|
|
|
*
|
2015-03-18 05:31:13 -07:00
|
|
|
* srsLTE is free software: you can redistribute it and/or modify
|
2015-05-08 08:05:40 -07:00
|
|
|
* it under the terms of the GNU Affero General Public License as
|
2014-03-03 11:09:26 -08:00
|
|
|
* published by the Free Software Foundation, either version 3 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
2015-03-18 05:31:13 -07:00
|
|
|
* srsLTE is distributed in the hope that it will be useful,
|
2014-03-03 11:09:26 -08:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2015-05-08 08:05:40 -07:00
|
|
|
* GNU Affero General Public License for more details.
|
2014-03-03 11:09:26 -08:00
|
|
|
*
|
2015-05-08 08:05:40 -07:00
|
|
|
* A copy of the GNU Affero General Public License can be found in
|
2014-03-03 11:09:26 -08:00
|
|
|
* the LICENSE file in the top-level directory of this distribution
|
|
|
|
* and at http://www.gnu.org/licenses/.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2015-04-03 05:49:12 -07:00
|
|
|
/**********************************************************************************************
|
|
|
|
* File: ch_awgn.h
|
|
|
|
*
|
|
|
|
* Description: Additive white gaussian noise channel object
|
|
|
|
*
|
|
|
|
* Reference:
|
|
|
|
*********************************************************************************************/
|
2014-03-03 11:09:26 -08:00
|
|
|
|
2014-07-22 09:13:24 -07:00
|
|
|
#include <stdint.h>
|
2015-03-18 05:16:28 -07:00
|
|
|
#include "srslte/config.h"
|
2014-03-03 11:09:26 -08:00
|
|
|
|
2018-03-31 10:04:04 -07:00
|
|
|
#ifndef SRSLTE_CH_AWGN_H
|
|
|
|
#define SRSLTE_CH_AWGN_H
|
2014-03-03 11:09:26 -08:00
|
|
|
|
2020-03-22 15:42:34 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The srsLTE channel AWGN implements an efficient Box-Muller Method accelerated with SIMD.
|
|
|
|
*/
|
|
|
|
typedef struct {
|
2020-03-22 16:36:36 -07:00
|
|
|
float* table_cos;
|
2020-03-22 15:42:34 -07:00
|
|
|
float* table_log;
|
|
|
|
uint32_t rand_state;
|
|
|
|
float std_dev;
|
|
|
|
} srslte_channel_awgn_t;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialization function of the channel AWGN object
|
|
|
|
*
|
|
|
|
* @param q AWGN channel object
|
|
|
|
* @param seed random generator seed
|
|
|
|
*/
|
|
|
|
SRSLTE_API int srslte_channel_awgn_init(srslte_channel_awgn_t* q, uint32_t seed);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the noise level N0 in decibels full scale (dBfs)
|
|
|
|
*
|
|
|
|
* @param q AWGN channel object
|
|
|
|
* @param n0_dBfs noise level
|
|
|
|
*/
|
|
|
|
SRSLTE_API int srslte_channel_awgn_set_n0(srslte_channel_awgn_t* q, float n0_dBfs);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Runs the complex AWGN channel
|
|
|
|
*
|
|
|
|
* @param q AWGN channel object
|
|
|
|
* @param in complex input array
|
|
|
|
* @param out complex output array
|
|
|
|
* @param length number of samples
|
|
|
|
*/
|
|
|
|
SRSLTE_API void srslte_channel_awgn_run_c(srslte_channel_awgn_t* q, const cf_t* in, cf_t* out, uint32_t length);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Runs the real AWGN channel
|
|
|
|
*
|
|
|
|
* @param q AWGN channel object
|
|
|
|
* @param in real input array
|
|
|
|
* @param out real output array
|
|
|
|
* @param length number of samples
|
|
|
|
*/
|
|
|
|
SRSLTE_API void srslte_channel_awgn_run_f(srslte_channel_awgn_t* q, const float* in, float* out, uint32_t length);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Free AWGN channel generator data
|
|
|
|
*
|
|
|
|
* @param q AWGN channel object
|
|
|
|
*/
|
|
|
|
SRSLTE_API void srslte_channel_awgn_free(srslte_channel_awgn_t* q);
|
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_ch_awgn_c(const cf_t* input, cf_t* output, float variance, uint32_t len);
|
2014-06-29 10:51:25 -07:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API void srslte_ch_awgn_f(const float* x, float* y, float variance, uint32_t len);
|
2014-03-03 11:09:26 -08:00
|
|
|
|
2019-12-16 07:04:22 -08:00
|
|
|
SRSLTE_API float srslte_ch_awgn_get_variance(float ebno_db, float rate);
|
2014-03-03 11:09:26 -08:00
|
|
|
|
2020-03-22 15:42:34 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-03-31 10:04:04 -07:00
|
|
|
#endif // SRSLTE_CH_AWGN_H
|