Lines Matching refs:fir
83 static inline const int16_t *fir16_create(struct fir16_state_t *fir, in fir16_create() argument
86 fir->taps = taps; in fir16_create()
87 fir->curr_pos = taps - 1; in fir16_create()
88 fir->coeffs = coeffs; in fir16_create()
89 fir->history = kcalloc(taps, sizeof(int16_t), GFP_KERNEL); in fir16_create()
90 return fir->history; in fir16_create()
93 static inline void fir16_flush(struct fir16_state_t *fir) in fir16_flush() argument
95 memset(fir->history, 0, fir->taps * sizeof(int16_t)); in fir16_flush()
98 static inline void fir16_free(struct fir16_state_t *fir) in fir16_free() argument
100 kfree(fir->history); in fir16_free()
103 static inline int16_t fir16(struct fir16_state_t *fir, int16_t sample) in fir16() argument
110 fir->history[fir->curr_pos] = sample; in fir16()
112 offset2 = fir->curr_pos; in fir16()
113 offset1 = fir->taps - offset2; in fir16()
115 for (i = fir->taps - 1; i >= offset1; i--) in fir16()
116 y += fir->coeffs[i] * fir->history[i - offset1]; in fir16()
118 y += fir->coeffs[i] * fir->history[i + offset2]; in fir16()
119 if (fir->curr_pos <= 0) in fir16()
120 fir->curr_pos = fir->taps; in fir16()
121 fir->curr_pos--; in fir16()
125 static inline const int16_t *fir32_create(struct fir32_state_t *fir, in fir32_create() argument
128 fir->taps = taps; in fir32_create()
129 fir->curr_pos = taps - 1; in fir32_create()
130 fir->coeffs = coeffs; in fir32_create()
131 fir->history = kcalloc(taps, sizeof(int16_t), GFP_KERNEL); in fir32_create()
132 return fir->history; in fir32_create()
135 static inline void fir32_flush(struct fir32_state_t *fir) in fir32_flush() argument
137 memset(fir->history, 0, fir->taps * sizeof(int16_t)); in fir32_flush()
140 static inline void fir32_free(struct fir32_state_t *fir) in fir32_free() argument
142 kfree(fir->history); in fir32_free()
145 static inline int16_t fir32(struct fir32_state_t *fir, int16_t sample) in fir32() argument
152 fir->history[fir->curr_pos] = sample; in fir32()
153 offset2 = fir->curr_pos; in fir32()
154 offset1 = fir->taps - offset2; in fir32()
156 for (i = fir->taps - 1; i >= offset1; i--) in fir32()
157 y += fir->coeffs[i] * fir->history[i - offset1]; in fir32()
159 y += fir->coeffs[i] * fir->history[i + offset2]; in fir32()
160 if (fir->curr_pos <= 0) in fir32()
161 fir->curr_pos = fir->taps; in fir32()
162 fir->curr_pos--; in fir32()