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.
123 lines
4.8 KiB
C
123 lines
4.8 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
|
*
|
||
11 years ago
|
*/
|
||
|
|
||
4 years ago
|
#ifndef SRSRAN_DFT_H
|
||
|
#define SRSRAN_DFT_H
|
||
5 years ago
|
|
||
4 years ago
|
#include "srsran/config.h"
|
||
5 years ago
|
#include <stdbool.h>
|
||
11 years ago
|
|
||
10 years ago
|
/**********************************************************************************************
|
||
|
* File: dft.h
|
||
|
*
|
||
|
* Description: Generic DFT module.
|
||
|
* Supports one-dimensional complex and real transforms. Options are set
|
||
|
* using the dft_plan_set_x functions.
|
||
|
*
|
||
|
* Options (default is false):
|
||
|
*
|
||
|
* mirror - Rearranges negative and positive frequency bins. Swaps after
|
||
|
* transform for FORWARD, swaps before transform for BACKWARD.
|
||
|
* db - Provides output in dB (10*log10(x)).
|
||
|
* norm - Normalizes output (by sqrt(len) for complex, len for real).
|
||
|
* dc - Handles insertion and removal of null DC carrier internally.
|
||
|
*
|
||
|
* Reference:
|
||
|
*********************************************************************************************/
|
||
11 years ago
|
|
||
5 years ago
|
#ifdef __cplusplus
|
||
|
extern "C" {
|
||
|
#endif
|
||
|
|
||
4 years ago
|
typedef enum { SRSRAN_DFT_COMPLEX, SRSRAN_REAL } srsran_dft_mode_t;
|
||
11 years ago
|
|
||
4 years ago
|
typedef enum { SRSRAN_DFT_FORWARD, SRSRAN_DFT_BACKWARD } srsran_dft_dir_t;
|
||
11 years ago
|
|
||
4 years ago
|
typedef struct SRSRAN_API {
|
||
5 years ago
|
int init_size; // DFT length used in the first initialization
|
||
|
int size; // DFT length
|
||
|
void* in; // Input buffer
|
||
|
void* out; // Output buffer
|
||
|
void* p; // DFT plan
|
||
|
bool is_guru;
|
||
|
bool forward; // Forward transform?
|
||
|
bool mirror; // Shift negative and positive frequencies?
|
||
|
bool db; // Provide output in dB?
|
||
|
bool norm; // Normalize output?
|
||
|
bool dc; // Handle insertion/removal of null DC carrier internally?
|
||
4 years ago
|
srsran_dft_dir_t dir; // Forward/Backward
|
||
|
srsran_dft_mode_t mode; // Complex/Real
|
||
|
} srsran_dft_plan_t;
|
||
11 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_dft_plan(srsran_dft_plan_t* plan, int dft_points, srsran_dft_dir_t dir, srsran_dft_mode_t type);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_dft_plan_c(srsran_dft_plan_t* plan, int dft_points, srsran_dft_dir_t dir);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_dft_plan_guru_c(srsran_dft_plan_t* plan,
|
||
5 years ago
|
int dft_points,
|
||
4 years ago
|
srsran_dft_dir_t dir,
|
||
5 years ago
|
cf_t* in_buffer,
|
||
|
cf_t* out_buffer,
|
||
|
int istride,
|
||
|
int ostride,
|
||
|
int how_many,
|
||
|
int idist,
|
||
|
int odist);
|
||
7 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_dft_plan_r(srsran_dft_plan_t* plan, int dft_points, srsran_dft_dir_t dir);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_dft_replan(srsran_dft_plan_t* plan, const int new_dft_points);
|
||
7 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_dft_replan_guru_c(srsran_dft_plan_t* plan,
|
||
5 years ago
|
const int new_dft_points,
|
||
|
cf_t* in_buffer,
|
||
|
cf_t* out_buffer,
|
||
|
int istride,
|
||
|
int ostride,
|
||
|
int how_many,
|
||
|
int idist,
|
||
|
int odist);
|
||
7 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_dft_replan_c(srsran_dft_plan_t* plan, int new_dft_points);
|
||
7 years ago
|
|
||
4 years ago
|
SRSRAN_API int srsran_dft_replan_r(srsran_dft_plan_t* plan, int new_dft_points);
|
||
7 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_dft_plan_free(srsran_dft_plan_t* plan);
|
||
11 years ago
|
|
||
11 years ago
|
/* Set options */
|
||
11 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_dft_plan_set_mirror(srsran_dft_plan_t* plan, bool val);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_dft_plan_set_db(srsran_dft_plan_t* plan, bool val);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_dft_plan_set_norm(srsran_dft_plan_t* plan, bool val);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_dft_plan_set_dc(srsran_dft_plan_t* plan, bool val);
|
||
11 years ago
|
|
||
|
/* Compute DFT */
|
||
|
|
||
4 years ago
|
SRSRAN_API void srsran_dft_run(srsran_dft_plan_t* plan, const void* in, void* out);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_dft_run_c_zerocopy(srsran_dft_plan_t* plan, const cf_t* in, cf_t* out);
|
||
9 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_dft_run_c(srsran_dft_plan_t* plan, const cf_t* in, cf_t* out);
|
||
10 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_dft_run_guru_c(srsran_dft_plan_t* plan);
|
||
7 years ago
|
|
||
4 years ago
|
SRSRAN_API void srsran_dft_run_r(srsran_dft_plan_t* plan, const float* in, float* out);
|
||
11 years ago
|
|
||
5 years ago
|
#ifdef __cplusplus
|
||
|
}
|
||
|
#endif
|
||
|
|
||
4 years ago
|
#endif // SRSRAN_DFT_H
|