Sound Open Firmware
Loading...
Searching...
No Matches
fir_hifi3.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: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
6 */
7
8#ifndef __SOF_MATH_FIR_HIFI3_H__
9#define __SOF_MATH_FIR_HIFI3_H__
10
11#include <sof/math/fir_config.h>
12#include <sof/common.h>
13
14#if SOF_USE_MIN_HIFI(3, FILTER)
15
17#include <sof/audio/buffer.h>
18#include <user/fir.h>
19#include <xtensa/config/defs.h>
20#include <xtensa/tie/xt_hifi3.h>
21
22struct sof_eq_fir_coef_data;
23
24struct fir_state_32x16 {
25 ae_int32 *rwp; /* Circular read and write pointer */
26 ae_int32 *delay; /* Pointer to FIR delay line */
27 ae_int32 *delay_end; /* Pointer to FIR delay line end */
28 ae_f16x4 *coef; /* Pointer to FIR coefficients */
29 int taps; /* Number of FIR taps */
30 int length; /* Number of FIR taps plus input length (even) */
31 int out_shift; /* Amount of right shifts at output */
32};
33
34void fir_reset(struct fir_state_32x16 *fir);
35
36int fir_delay_size(struct sof_fir_coef_data *config);
37
38int fir_init_coef(struct fir_state_32x16 *fir,
39 struct sof_fir_coef_data *config);
40
41void fir_init_delay(struct fir_state_32x16 *fir, int32_t **data);
42
43/* Setup circular buffer for FIR input data delay */
44static inline void fir_core_setup_circular(struct fir_state_32x16 *fir)
45{
46 AE_SETCBEGIN0(fir->delay);
47 AE_SETCEND0(fir->delay_end);
48}
49
50/* Setup circular for component buffer */
51static inline void fir_comp_setup_circular(const struct audio_stream *buffer)
52{
53 AE_SETCBEGIN0(audio_stream_get_addr(buffer));
54 AE_SETCEND0(audio_stream_get_end_addr(buffer));
55}
56
57void fir_get_lrshifts(struct fir_state_32x16 *fir, int *lshift, int *rshift);
58
59void fir_32x16(struct fir_state_32x16 *fir, ae_int32 x, ae_int32 *y, int shift);
60
61void fir_32x16_2x(struct fir_state_32x16 *fir, ae_int32 x0, ae_int32 x1,
62 ae_int32 *y0, ae_int32 *y1, int shift);
63
64#endif
65#endif /* __SOF_MATH_FIR_HIFI3_H__ */
Audio Stream API definition.
uint32_t data[]
Definition debug_stream_slot.h:2
static void * audio_stream_get_addr(const struct audio_stream *buf)
Definition audio_stream.h:95
static void * audio_stream_get_end_addr(const struct audio_stream *buf)
Definition audio_stream.h:90
Audio stream is a circular buffer aware of audio format of the data in the buffer so provides API for...
Definition audio_stream.h:52
Definition fir.h:15
uint32_t length
Definition tlv.h:1