forked from thesofproject/sof
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdcblock.h
More file actions
75 lines (60 loc) · 1.96 KB
/
Copy pathdcblock.h
File metadata and controls
75 lines (60 loc) · 1.96 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2020 Google LLC. All rights reserved.
*
* Author: Sebastiano Carlucci <scarlucci@google.com>
*/
#ifndef __SOF_AUDIO_DCBLOCK_DCBLOCK_H__
#define __SOF_AUDIO_DCBLOCK_DCBLOCK_H__
#include <stdint.h>
#include <sof/platform.h>
#include <ipc/stream.h>
struct audio_stream;
struct comp_dev;
struct dcblock_state {
int32_t x_prev; /**< state variable referring to x[n-1] */
int32_t y_prev; /**< state variable referring to y[n-1] */
};
/**
* \brief Type definition for the processing function for the
* DC Blocking Filter.
*/
typedef void (*dcblock_func)(const struct comp_dev *dev,
const struct audio_stream *source,
const struct audio_stream *sink,
uint32_t frames);
/* DC Blocking Filter component private data */
struct comp_data {
/**< filters state */
struct dcblock_state state[PLATFORM_MAX_CHANNELS];
/** coefficients for the processing function */
int32_t R_coeffs[PLATFORM_MAX_CHANNELS];
enum sof_ipc_frame source_format;
enum sof_ipc_frame sink_format;
dcblock_func dcblock_func; /**< processing function */
};
/** \brief DC Blocking Filter processing functions map item. */
struct dcblock_func_map {
enum sof_ipc_frame src_fmt; /**< source frame format */
dcblock_func func; /**< processing function */
};
/** \brief Map of formats with dedicated processing functions. */
extern const struct dcblock_func_map dcblock_fnmap[];
/** \brief Number of processing functions. */
extern const size_t dcblock_fncount;
/**
* \brief Retrieves a DC Blocking processing function matching
* the source buffer's frame format.
* \param src_fmt the frames' format of the source buffer
*/
static inline dcblock_func dcblock_find_func(enum sof_ipc_frame src_fmt)
{
int i;
/* Find suitable processing function from map */
for (i = 0; i < dcblock_fncount; i++) {
if (src_fmt == dcblock_fnmap[i].src_fmt)
return dcblock_fnmap[i].func;
}
return NULL;
}
#endif /* __SOF_AUDIO_DCBLOCK_DCBLOCK_H__ */