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
9#ifndef __SOF_FFT_H__
10#define __SOF_FFT_H__
11
13#include <sof/audio/format.h>
14#include <sof/math/icomplex32.h>
15#include <sof/common.h>
16#include <stdbool.h>
17#include <stdint.h>
18
19#define FFT_GENERIC
20#if defined(__XCC__)
21
22#include <xtensa/config/core-isa.h>
23#if XCHAL_HAVE_HIFI3 || XCHAL_HAVE_HIFI4
24#undef FFT_GENERIC
25#define FFT_HIFI3
26#endif
27
28#endif
29
30#define FFT_SIZE_MIN 1
31#define FFT_SIZE_MAX 1024
32#define FFT_MULTI_COUNT_MAX 3
33
34struct fft_plan {
35 uint32_t size; /* fft size */
36 uint32_t len; /* fft length in exponent of 2 */
37 uint16_t *bit_reverse_idx; /* pointer to bit reverse index array */
38 struct icomplex32 *inb32; /* pointer to input integer complex buffer */
39 struct icomplex32 *outb32; /* pointer to output integer complex buffer */
40 struct icomplex16 *inb16; /* pointer to input integer complex buffer */
41 struct icomplex16 *outb16; /* pointer to output integer complex buffer */
42};
43
46 struct icomplex32 *tmp_i32[FFT_MULTI_COUNT_MAX]; /* pointer to input buffer */
47 struct icomplex32 *tmp_o32[FFT_MULTI_COUNT_MAX]; /* pointer to output buffer */
48 struct icomplex32 *inb32; /* pointer to input integer complex buffer */
49 struct icomplex32 *outb32; /* pointer to output integer complex buffer */
50 uint16_t *bit_reverse_idx;
51 uint32_t total_size;
52 uint32_t fft_size;
54};
55
56/* interfaces of the library */
57struct fft_plan *mod_fft_plan_new(struct processing_module *mod, void *inb,
58 void *outb, uint32_t size, int bits);
59void fft_execute_16(struct fft_plan *plan, bool ifft);
60void fft_execute_32(struct fft_plan *plan, bool ifft);
61void mod_fft_plan_free(struct processing_module *mod, struct fft_plan *plan);
62
77
78struct fft_multi_plan *mod_fft_multi_plan_new(struct processing_module *mod, void *inb,
79 void *outb, uint32_t size, int bits);
87void fft_multi_execute_32(struct fft_multi_plan *plan, bool ifft);
88
97void mod_fft_multi_plan_free(struct processing_module *mod, struct fft_multi_plan *plan);
98
107void dft3_32(struct icomplex32 *input, struct icomplex32 *output);
108
109#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:32
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)
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)
struct fft_plan * mod_fft_plan_new(struct processing_module *mod, void *inb, void *outb, uint32_t size, int bits)
void fft_execute_16(struct fft_plan *plan, bool ifft)
Definition fft.h:44
struct icomplex32 * tmp_o32[FFT_MULTI_COUNT_MAX]
Definition fft.h:47
uint32_t fft_size
Definition fft.h:52
struct icomplex32 * tmp_i32[FFT_MULTI_COUNT_MAX]
Definition fft.h:46
struct icomplex32 * inb32
Definition fft.h:48
uint32_t total_size
Definition fft.h:51
int num_ffts
Definition fft.h:53
uint16_t * bit_reverse_idx
Definition fft.h:50
struct icomplex32 * outb32
Definition fft.h:49
struct fft_plan * fft_plan[FFT_MULTI_COUNT_MAX]
Definition fft.h:45
Definition fft.h:34
struct icomplex32 * outb32
Definition fft.h:39
uint16_t * bit_reverse_idx
Definition fft.h:37
struct icomplex16 * inb16
Definition fft.h:40
uint32_t len
Definition fft.h:36
struct icomplex32 * inb32
Definition fft.h:38
uint32_t size
Definition fft.h:35
struct icomplex16 * outb16
Definition fft.h:41
struct icomplex16 - Storage for a normal complex number.
Definition icomplex16.h:28
struct icomplex32 - Storage for a normal complex number.
Definition icomplex32.h:23