66//
77
88#include <sof/audio/rtnr/rtklib/include/RTK_MA_API.h>
9+ #include <sof/audio/audio_stream.h>
910#include <rtos/alloc.h>
1011
12+ #define RTNR_STUB_CONTEXT_SIZE 42 /* Just some random size to allocate */
13+
1114void RTKMA_API_S16_Default (void * Context , struct audio_stream_rtnr * * sources ,
1215 struct audio_stream_rtnr * sink , int frames ,
1316 _Bool ref_active , int in_idx , int ref_idx ,
1417 int ref_32bits , int ref_shift )
15- {}
18+ {
19+ struct audio_stream sof_source ;
20+ struct audio_stream sof_sink ;
21+
22+ rtnr_copy_to_sof_stream (& sof_source , sources [0 ]);
23+ rtnr_copy_to_sof_stream (& sof_sink , sink );
24+ audio_stream_copy (& sof_source , 0 , & sof_sink , 0 ,
25+ frames * audio_stream_get_channels (& sof_sink ));
26+ rtnr_copy_from_sof_stream (sources [0 ], & sof_source );
27+ rtnr_copy_from_sof_stream (sink , & sof_sink );
28+ }
1629
1730void RTKMA_API_S24_Default (void * Context , struct audio_stream_rtnr * * sources ,
1831 struct audio_stream_rtnr * sink , int frames ,
1932 _Bool ref_active , int in_idx , int ref_idx ,
2033 int ref_32bits , int ref_shift )
21- {}
34+ {
35+ struct audio_stream sof_source ;
36+ struct audio_stream sof_sink ;
37+
38+ rtnr_copy_to_sof_stream (& sof_source , sources [0 ]);
39+ rtnr_copy_to_sof_stream (& sof_sink , sink );
40+ audio_stream_copy (& sof_source , 0 , & sof_sink , 0 ,
41+ frames * audio_stream_get_channels (& sof_sink ));
42+ rtnr_copy_from_sof_stream (sources [0 ], & sof_source );
43+ rtnr_copy_from_sof_stream (sink , & sof_sink );
44+ }
2245
2346void RTKMA_API_S32_Default (void * Context , struct audio_stream_rtnr * * sources ,
2447 struct audio_stream_rtnr * sink , int frames ,
2548 _Bool ref_active , int in_idx , int ref_idx ,
2649 int ref_32bits , int ref_shift )
27- {}
50+ {
51+ struct audio_stream sof_source ;
52+ struct audio_stream sof_sink ;
53+
54+ rtnr_copy_to_sof_stream (& sof_source , sources [0 ]);
55+ rtnr_copy_to_sof_stream (& sof_sink , sink );
56+ audio_stream_copy (& sof_source , 0 , & sof_sink , 0 ,
57+ frames * audio_stream_get_channels (& sof_sink ));
58+ rtnr_copy_from_sof_stream (sources [0 ], & sof_source );
59+ rtnr_copy_from_sof_stream (sink , & sof_sink );
60+ }
2861
2962void RTKMA_API_First_Copy (void * Context , int SampleRate , int MicCh )
3063{}
@@ -40,7 +73,7 @@ void *RTKMA_API_Context_Create(int sample_rate)
4073 /* Allocate something, to avoid return NULL and cause error
4174 * in check of success of this.
4275 */
43- return rzalloc (SOF_MEM_ZONE_RUNTIME , 0 , SOF_MEM_CAPS_RAM , 42 );
76+ return rzalloc (SOF_MEM_ZONE_RUNTIME , 0 , SOF_MEM_CAPS_RAM , RTNR_STUB_CONTEXT_SIZE );
4477}
4578
4679void RTKMA_API_Context_Free (void * Context )
0 commit comments