mirror of https://github.com/pvnis/srsRAN_4G.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
2.3 KiB
C
95 lines
2.3 KiB
C
4 years ago
|
/**
|
||
11 years ago
|
*
|
||
4 years ago
|
* \section COPYRIGHT
|
||
11 years ago
|
*
|
||
4 years ago
|
* Copyright 2013-2021 Software Radio Systems Limited
|
||
11 years ago
|
*
|
||
4 years ago
|
* By using this file, you agree to the terms and conditions set
|
||
|
* forth in the LICENSE file which can be found at the top level of
|
||
|
* the distribution.
|
||
11 years ago
|
*
|
||
|
*/
|
||
|
|
||
10 years ago
|
/**********************************************************************************************
|
||
|
* File: ch_awgn.h
|
||
|
*
|
||
|
* Description: Additive white gaussian noise channel object
|
||
|
*
|
||
|
* Reference:
|
||
|
*********************************************************************************************/
|
||
11 years ago
|
|
||
4 years ago
|
#include "srsran/config.h"
|
||
11 years ago
|
#include <stdint.h>
|
||
11 years ago
|
|
||
4 years ago
|
#ifndef SRSRAN_CH_AWGN_H
|
||
|
#define SRSRAN_CH_AWGN_H
|
||
11 years ago
|
|
||
5 years ago
|
#ifdef __cplusplus
|
||
|
extern "C" {
|
||
|
#endif
|
||
|
|
||
|
/**
|
||
4 years ago
|
* The srsRAN channel AWGN implements an efficient Box-Muller Method accelerated with SIMD.
|
||
5 years ago
|
*/
|
||
|
typedef struct {
|
||
5 years ago
|
float* table_cos;
|
||
5 years ago
|
float* table_log;
|
||
|
uint32_t rand_state;
|
||
|
float std_dev;
|
||
4 years ago
|
} srsran_channel_awgn_t;
|
||
5 years ago
|
|
||
|
/**
|
||
|
* Initialization function of the channel AWGN object
|
||
|
*
|
||
|
* @param q AWGN channel object
|
||
|
* @param seed random generator seed
|
||
|
*/
|
||
4 years ago
|
SRSRAN_API int srsran_channel_awgn_init(srsran_channel_awgn_t* q, uint32_t seed);
|
||
5 years ago
|
|
||
|
/**
|
||
|
* Sets the noise level N0 in decibels full scale (dBfs)
|
||
|
*
|
||
|
* @param q AWGN channel object
|
||
|
* @param n0_dBfs noise level
|
||
|
*/
|
||
4 years ago
|
SRSRAN_API int srsran_channel_awgn_set_n0(srsran_channel_awgn_t* q, float n0_dBfs);
|
||
5 years ago
|
|
||
|
/**
|
||
|
* 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
|
||
|
*/
|
||
4 years ago
|
SRSRAN_API void srsran_channel_awgn_run_c(srsran_channel_awgn_t* q, const cf_t* in, cf_t* out, uint32_t length);
|
||
5 years ago
|
|
||
|
/**
|
||
|
* 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
|
||
|
*/
|
||
4 years ago
|
SRSRAN_API void srsran_channel_awgn_run_f(srsran_channel_awgn_t* q, const float* in, float* out, uint32_t length);
|
||
5 years ago
|
|
||
|
/**
|
||
|
* Free AWGN channel generator data
|
||
|
*
|
||
|
* @param q AWGN channel object
|
||
|
*/
|
||
4 years ago
|
SRSRAN_API void srsran_channel_awgn_free(srsran_channel_awgn_t* q);
|
||
5 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_ch_awgn_c(const cf_t* input, cf_t* output, float variance, uint32_t len);
|
||
11 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_ch_awgn_f(const float* x, float* y, float variance, uint32_t len);
|
||
11 years ago
|
|
||
4 years ago
|
SRSRAN_API float srsran_ch_awgn_get_variance(float ebno_db, float rate);
|
||
11 years ago
|
|
||
5 years ago
|
#ifdef __cplusplus
|
||
|
}
|
||
|
#endif
|
||
|
|
||
4 years ago
|
#endif // SRSRAN_CH_AWGN_H
|