blob: 99b2770bf522deebaf00c16b5135d8687fa54b0f [file] [log] [blame]
Seppo Ingalsuoc46d66d2017-09-25 14:09:13 +03001/*
2 * Copyright (c) 2017, Intel Corporation
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the Intel Corporation nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 *
28 * Author: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
29 */
30
31#ifndef EQ_H
32#define EQ_H
33
34/* FIR EQ type */
35
36/* Component will reject non-matching configuration. The version number need
37 * to be incremented with any ABI changes in function fir_cmd().
38 */
Seppo Ingalsuo26aa4ae2017-10-20 20:15:57 +030039#define SOF_EQ_FIR_ABI_VERSION 1
40
41#define SOF_EQ_FIR_IDX_SWITCH 0
Seppo Ingalsuoc46d66d2017-09-25 14:09:13 +030042
43#define SOF_EQ_FIR_MAX_SIZE 4096 /* Max size allowed for coef data in bytes */
44
45/*
46 * eq_fir_configuration data structure contains this information
47 * uint16_t channels_in_config
48 * This describes the number of channels in this EQ config data. It
49 * can be different from PLATFORM_MAX_CHANNELS.
50 * uint16_t number_of_responses
51 * 0=no responses, 1=one response defined, 2=two responses defined, etc.
52 * int16_t data[]
53 * assign_response[STREAM_MAX_CHANNELS]
54 * -1 = not defined, 0 = use first response, 1 = use 2nd response, etc.
55 * E.g. {0, 0, 0, 0, -1, -1, -1, -1} would apply to channels 0-3 the
56 * same first defined response and leave channels 4-7 unequalized.
57 * coef_data[]
58 * Repeated data { filter_length, input_shift, output_shift, h[] }
59 * for every EQ response defined where vector h has filter_length
60 * number of coefficients. Coefficients in h[] are in Q1.15 format.
61 * E.g. 16384 (Q1.15) = 0.5. The shifts are number of right shifts.
62 */
63
64struct sof_eq_fir_config {
65 uint16_t channels_in_config;
66 uint16_t number_of_responses;
67 int16_t data[];
68};
69
70/* IIR EQ type */
71
72/* Component will reject non-matching configuration. The version number need
73 * to be incremented with any ABI changes in function fir_cmd().
74 */
Seppo Ingalsuo2b3f0ab2017-10-20 20:15:58 +030075#define SOF_EQ_FIR_ABI_VERSION 1
76
77#define SOF_EQ_IIR_IDX_SWITCH 0
Seppo Ingalsuoc46d66d2017-09-25 14:09:13 +030078
79#define SOF_EQ_IIR_MAX_SIZE 1024 /* Max size allowed for coef data in bytes */
80
81/* eq_iir_configuration
82 * uint32_t channels_in_config
83 * This describes the number of channels in this EQ config data. It
84 * can be different from PLATFORM_MAX_CHANNELS.
85 * uint32_t number_of_responses_defined
86 * 0=no responses, 1=one response defined, 2=two responses defined, etc.
87 * int32_t data[]
88 * Data consist of two parts. First is the response assign vector that
89 * has length of channels_in_config. The latter part is coefficient
90 * data.
91 * uint32_t assign_response[channels_in_config]
92 * -1 = not defined, 0 = use first response, 1 = use 2nd, etc.
93 * E.g. {0, 0, 0, 0, -1, -1, -1, -1} would apply to channels 0-3 the
94 * same first defined response and leave channels 4-7 unequalized.
95 * coefficient_data[]
96 * <1st EQ>
97 * uint32_t num_biquads
98 * uint32_t num_biquads_in_series
99 * <1st biquad>
100 * int32_t coef_a2 Q2.30 format
101 * int32_t coef_a1 Q2.30 format
102 * int32_t coef_b2 Q2.30 format
103 * int32_t coef_b1 Q2.30 format
104 * int32_t coef_b0 Q2.30 format
105 * int32_t output_shift number of shifts right, shift left is negative
106 * int32_t output_gain Q2.14 format
107 * <2nd biquad>
108 * ...
109 * <2nd EQ>
110 *
111 * Note: A flat response biquad can be made with a section set to
112 * b0 = 1.0, gain = 1.0, and other parameters set to 0
113 * {0, 0, 0, 0, 1073741824, 0, 16484}
114 */
115
116struct sof_eq_iir_config {
117 uint32_t channels_in_config;
118 uint32_t number_of_responses;
119 int32_t data[];
120};
121
122#endif /* EQ_H */