3030 * Keyon Jie <yang.jie@linux.intel.com>
3131 */
3232
33- #include <sof/audio/format.h>
33+ #ifndef FIR_H
34+ #define FIR_H
3435
35- #define MAX_FIR_LENGTH 192
36+ #include "fir_config.h"
3637
37- #define NHEADER_FIR_COEF_32x16 3
38+ #if FIR_GENERIC
3839
39- struct fir_coef_32x16 {
40- int16_t length ; /* Number of FIR taps */
41- int16_t in_shift ; /* Amount of right shifts at input */
42- int16_t out_shift ; /* Amount of right shifts at output */
43- int16_t coef ; /* FIR coefficients */
44- };
40+ #include <sof/audio/format.h>
4541
4642struct fir_state_32x16 {
47- int mute ; /* Set to 1 to mute EQ output, 0 otherwise */
4843 int rwi ; /* Circular read and write index */
4944 int length ; /* Number of FIR taps */
5045 int delay_size ; /* Actual delay lentgh, must be >= length */
51- int in_shift ; /* Amount of right shifts at input */
5246 int out_shift ; /* Amount of right shifts at output */
5347 int16_t * coef ; /* Pointer to FIR coefficients */
5448 int32_t * delay ; /* Pointer to FIR delay line */
@@ -60,17 +54,8 @@ int fir_init_coef(struct fir_state_32x16 *fir, int16_t config[]);
6054
6155void fir_init_delay (struct fir_state_32x16 * fir , int32_t * * data );
6256
63- /* The next trivial functions are inlined */
64-
65- static inline void fir_mute (struct fir_state_32x16 * fir )
66- {
67- fir -> mute = 1 ;
68- }
69-
70- static inline void fir_unmute (struct fir_state_32x16 * fir )
71- {
72- fir -> mute = 0 ;
73- }
57+ void eq_fir_s32 (struct fir_state_32x16 fir [], struct comp_buffer * source ,
58+ struct comp_buffer * sink , int frames , int nch );
7459
7560/* The next functions are inlined to optmize execution speed */
7661
@@ -81,7 +66,7 @@ static inline void fir_part_32x16(int64_t *y, int taps, const int16_t c[],
8166
8267 /* Data is Q8.24, coef is Q1.15, product is Q9.39 */
8368 for (n = 0 ; n < taps ; n ++ ) {
84- * y += (int64_t ) c [* ic ] * d [* id ];
69+ * y += (int64_t )c [* ic ] * d [* id ];
8570 (* ic )++ ;
8671 (* id )-- ;
8772 }
@@ -96,7 +81,7 @@ static inline int32_t fir_32x16(struct fir_state_32x16 *fir, int32_t x)
9681 int tmp_ri ;
9782
9883 /* Write sample to delay */
99- fir -> delay [fir -> rwi ] = x >> fir -> in_shift ;
84+ fir -> delay [fir -> rwi ] = x ;
10085
10186 /* Start FIR calculation. Calculate first number of taps possible to
10287 * calculate before circular wrap need.
@@ -125,8 +110,8 @@ static inline int32_t fir_32x16(struct fir_state_32x16 *fir, int32_t x)
125110 /* Q9.39 -> Q9.24, saturate to Q8.24 */
126111 y = sat_int32 (y >> (15 + fir -> out_shift ));
127112
128- if (fir -> mute )
129- return 0 ;
130- else
131- return (int32_t )y ;
113+ return (int32_t )y ;
132114}
115+
116+ #endif
117+ #endif
0 commit comments