forked from thesofproject/sof
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiir_df2t.c
More file actions
57 lines (47 loc) · 1.39 KB
/
iir_df2t.c
File metadata and controls
57 lines (47 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright(c) 2017 Intel Corporation. All rights reserved.
//
// Author: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
// Liam Girdwood <liam.r.girdwood@linux.intel.com>
// Keyon Jie <yang.jie@linux.intel.com>
#include <sof/common.h>
#include <sof/audio/format.h>
#include <sof/math/iir_df2t.h>
#include <user/eq.h>
#include <errno.h>
#include <stddef.h>
#include <stdint.h>
int iir_delay_size_df2t(struct sof_eq_iir_header *config)
{
int n = config->num_sections; /* One section uses two unit delays */
if (n > SOF_EQ_IIR_BIQUADS_MAX || n < 1)
return -EINVAL;
return 2 * n * sizeof(int64_t);
}
int iir_init_coef_df2t(struct iir_state_df2t *iir,
struct sof_eq_iir_header *config)
{
iir->biquads = config->num_sections;
iir->biquads_in_series = config->num_sections_in_series;
iir->coef = ASSUME_ALIGNED(&config->biquads[0], 4);
return 0;
}
void iir_init_delay_df2t(struct iir_state_df2t *iir, int64_t **delay)
{
/* Set delay line of this IIR */
iir->delay = *delay;
/* Point to next IIR delay line start. The DF2T biquad uses two
* memory elements.
*/
*delay += 2 * iir->biquads;
}
void iir_reset_df2t(struct iir_state_df2t *iir)
{
iir->biquads = 0;
iir->biquads_in_series = 0;
iir->coef = NULL;
/* Note: May need to know the beginning of dynamic allocation after so
* omitting setting iir->delay to NULL.
*/
}