Sound Open Firmware
Loading...
Searching...
No Matches
fft.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 *
3 * Copyright(c) 2017 Intel Corporation. All rights reserved.
4 *
5 * Author: Amery Song <chao.song@intel.com>
6 * Keyon Jie <yang.jie@linux.intel.com>
7 */
8
15#ifndef __SOF_FFT_H__
16#define __SOF_FFT_H__
17
19#include <sof/audio/format.h>
20#include <sof/math/icomplex32.h>
21#include <sof/common.h>
22#include <stdbool.h>
23#include <stdint.h>
24
25#define FFT_GENERIC
26#if defined(__XCC__)
27
28#include <xtensa/config/core-isa.h>
29#if XCHAL_HAVE_HIFI3 || XCHAL_HAVE_HIFI4
30#undef FFT_GENERIC
31#define FFT_HIFI3
32#endif
33
34#endif
35
36#define FFT_SIZE_MIN 1
37#define FFT_SIZE_MAX 1024
38#define FFT_MULTI_COUNT_MAX 3
39
40struct fft_plan {
41 uint32_t size; /* fft size */
42 uint32_t len; /* fft length in exponent of 2 */
43 uint16_t *bit_reverse_idx; /* pointer to bit reverse index array */
44 struct icomplex32 *inb32; /* pointer to input integer complex buffer */
45 struct icomplex32 *outb32; /* pointer to output integer complex buffer */
46 struct icomplex16 *inb16; /* pointer to input integer complex buffer */
47 struct icomplex16 *outb16; /* pointer to output integer complex buffer */
48};
49
52 struct icomplex32 *tmp_i32[FFT_MULTI_COUNT_MAX]; /* pointer to input buffer */
53 struct icomplex32 *tmp_o32[FFT_MULTI_COUNT_MAX]; /* pointer to output buffer */
54 struct icomplex32 *inb32; /* pointer to input integer complex buffer */
55 struct icomplex32 *outb32; /* pointer to output integer complex buffer */
56 uint16_t *bit_reverse_idx;
57 uint32_t total_size;
58 uint32_t fft_size;
60};
61
71struct fft_plan *mod_fft_plan_new(struct processing_module *mod, void *inb,
72 void *outb, uint32_t size, int bits);
73
79void fft_execute_16(struct fft_plan *plan, bool ifft);
80
86void fft_execute_32(struct fft_plan *plan, bool ifft);
87
93void mod_fft_plan_free(struct processing_module *mod, struct fft_plan *plan);
94
111 void *outb, uint32_t size, int bits);
119void fft_multi_execute_32(struct fft_multi_plan *plan, bool ifft);
120
130
139void dft3_32(struct icomplex32 *input, struct icomplex32 *output);
140
141#endif /* __SOF_FFT_H__ */
void mod_fft_multi_plan_free(struct processing_module *mod, struct fft_multi_plan *plan)
mod_fft_multi_plan_free() - Free the FFT plan
#define FFT_MULTI_COUNT_MAX
Definition fft.h:38
void fft_multi_execute_32(struct fft_multi_plan *plan, bool ifft)
fft_multi_execute_32() - Calculate Fast Fourier Transform (FFT) for 2^size and other
void mod_fft_plan_free(struct processing_module *mod, struct fft_plan *plan)
Free an allocated FFT execution plan and its internal buffers.
struct fft_multi_plan * mod_fft_multi_plan_new(struct processing_module *mod, void *inb, void *outb, uint32_t size, int bits)
mod_fft_multi_plan_new() - Prepare FFT for 2^N size and some other FFT sizes
void dft3_32(struct icomplex32 *input, struct icomplex32 *output)
dft3_32() - Discrete Fourier Transform (DFT) for size 3.
void fft_execute_32(struct fft_plan *plan, bool ifft)
Execute a 32-bit complex FFT or IFFT according to an initialized plan.
struct fft_plan * mod_fft_plan_new(struct processing_module *mod, void *inb, void *outb, uint32_t size, int bits)
Allocate and initialize an FFT execution plan.
void fft_execute_16(struct fft_plan *plan, bool ifft)
Execute a 16-bit complex FFT or IFFT according to an initialized plan.
Definition fft.h:50
struct icomplex32 * tmp_o32[FFT_MULTI_COUNT_MAX]
Definition fft.h:53
uint32_t fft_size
Definition fft.h:58
struct icomplex32 * tmp_i32[FFT_MULTI_COUNT_MAX]
Definition fft.h:52
struct icomplex32 * inb32
Definition fft.h:54
uint32_t total_size
Definition fft.h:57
int num_ffts
Definition fft.h:59
uint16_t * bit_reverse_idx
Definition fft.h:56
struct icomplex32 * outb32
Definition fft.h:55
Definition fft.h:40
struct icomplex32 * outb32
Definition fft.h:45
uint16_t * bit_reverse_idx
Definition fft.h:43
struct icomplex16 * inb16
Definition fft.h:46
uint32_t len
Definition fft.h:42
struct icomplex32 * inb32
Definition fft.h:44
uint32_t size
Definition fft.h:41
struct icomplex16 * outb16
Definition fft.h:47
struct icomplex16 - Storage for a normal complex number.
Definition icomplex16.h:28
struct icomplex32 - Storage for a normal complex number.
Definition icomplex32.h:23
Definition base.h:103