Skip to content

Commit 8f5ee92

Browse files
singalsulgirdwood
authored andcommitted
Audio: TDFB: Fix a mistake in sound direction updates filtering
Check for four least significant bits set means that four previous processes periods need to be high enough signal level over ambient. The value 0x15 is an obvious mistake and does not filter properly control events. The purpose of the filter is to prevent too frequent or unreliable control updates. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent 22c0e23 commit 8f5ee92

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/audio/tdfb/tdfb_direction.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@
4242
/* Threshold for notifying user space, no more often than every 200 ms */
4343
#define CONTROL_UPDATE_MIN_TIME Q_CONVERT_FLOAT(0.2, 16)
4444

45+
/* Another filter, a bit mask for controlling notifications to user space, at least four
46+
* periods with level over ambient
47+
*/
48+
#define CONTROL_UPDATE_MIN_MASK 0x0f
49+
4550
/* Emphasis filters for sound direction (IIR). These coefficients were
4651
* created with the script tools/tune/tdfb/example_direction_emphasis.m
4752
* from output files tdfb_iir_emphasis_48k.h and tdfb_iir_emphasis_16k.h.
@@ -556,7 +561,7 @@ void tdfb_direction_estimate(struct tdfb_comp_data *cd, int frames, int ch_count
556561
* to update user space.
557562
*/
558563
if (new_az_value != cd->az_value_estimate && time_since > CONTROL_UPDATE_MIN_TIME &&
559-
(cd->direction.trigger & 0x15) == 0x15) {
564+
(cd->direction.trigger & CONTROL_UPDATE_MIN_MASK) == CONTROL_UPDATE_MIN_MASK) {
560565
cd->az_value_estimate = new_az_value;
561566
cd->direction.frame_count_since_control = 0;
562567
cd->direction_change = true;

0 commit comments

Comments
 (0)