Sound Open Firmware
Loading...
Searching...
No Matches
iir_df1_generic.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 *
3 * Copyright(c) 2022 Intel Corporation. All rights reserved.
4 *
5 * Author: Andrula Song <andrula.song@intel.com>
6 */
7
8#ifndef __IIR_DF1_GENERIC_H__
9#define __IIR_DF1_GENERIC_H__
10
11#include <stdint.h>
12
13static inline int16_t iir_df1_s16(struct iir_state_df1 *iir, int16_t x)
14{
15 return sat_int16(Q_SHIFT_RND(iir_df1(iir, ((int32_t)x) << 16), 31, 15));
16}
17
18static inline int32_t iir_df1_s24(struct iir_state_df1 *iir, int32_t x)
19{
20 return sat_int24(Q_SHIFT_RND(iir_df1(iir, x << 8), 31, 23));
21}
22
23static inline int16_t iir_df1_s32_s16(struct iir_state_df1 *iir, int32_t x)
24{
25 return sat_int16(Q_SHIFT_RND(iir_df1(iir, x), 31, 15));
26}
27
28static inline int32_t iir_df1_s32_s24(struct iir_state_df1 *iir, int32_t x)
29{
30 return sat_int24(Q_SHIFT_RND(iir_df1(iir, x), 31, 23));
31}
32
33#endif /* __IIR_DF1_GENERIC_H__ */
34
#define Q_SHIFT_RND(x, src_q, dst_q)
Definition format.h:78
static int16_t sat_int16(int32_t x)
Definition format_generic.h:33
static int32_t sat_int24(int32_t x)
Definition format_generic.h:23
int32_t iir_df1(struct iir_state_df1 *iir, int32_t x)
Calculate IIR filter consisting of biquads.
static int16_t iir_df1_s32_s16(struct iir_state_df1 *iir, int32_t x)
Definition iir_df1_generic.h:23
static int32_t iir_df1_s24(struct iir_state_df1 *iir, int32_t x)
Definition iir_df1_generic.h:18
static int32_t iir_df1_s32_s24(struct iir_state_df1 *iir, int32_t x)
Definition iir_df1_generic.h:28
static int16_t iir_df1_s16(struct iir_state_df1 *iir, int16_t x)
Definition iir_df1_generic.h:13
Definition iir_df1.h:18