module: tflm: rework module to use sink/source api#10804
Conversation
Rework the tflm module to only use the sink/source api to prepare sof for the full transition to pipeline 2.0. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
There was a problem hiding this comment.
Pull request overview
Reworks the TensorFlow Lite Micro classifier module (tflm-classify) to use the sink/source processing API (module_interface.process) instead of the legacy process_audio_stream buffer API, as part of the Pipeline 2.0 transition.
Changes:
- Switches
tflm-classify.cover tosink_api/source_apiand updates the module interface to.process. - Replaces direct
audio_streampointer access withsource_get_data()/source_release_data()based consumption.
| static int tflm_process(struct processing_module *mod, | ||
| struct input_stream_buffer *input_buffers, | ||
| int num_input_buffers, | ||
| struct output_stream_buffer *output_buffers, | ||
| int num_output_buffers) | ||
| struct sof_source **sources, int num_of_sources, | ||
| struct sof_sink **sinks, int num_of_sinks) | ||
| { |
| const void *data_ptr, *buf_start; | ||
| size_t buf_size; |
| int features = source_get_data_frames_available(sources[0]); | ||
| const void *data_ptr, *buf_start; | ||
| size_t buf_size; | ||
| int ret; |
| ret = source_get_data(sources[0], TFLM_FEATURE_ELEM_COUNT * frame_bytes, | ||
| &data_ptr, &buf_start, &buf_size); | ||
| if (ret) | ||
| return ret; | ||
|
|
||
| cd->tfc.audio_features = data_ptr; | ||
| cd->tfc.audio_data_size = TFLM_FEATURE_ELEM_COUNT; |
| /* advance by one stride */ | ||
| source_release_data(sources[0], TFLM_FEATURE_SIZE * frame_bytes); | ||
| features = source_get_data_frames_available(sources[0]); |
|
Hmm, @softwarecki this is not failing a HDA chain-dma test with stream of GATEWAY_UNDERRUN_DETECTED events. @abonislawski @lyakh Have you seen this (test_05_hda_pass_through.py)? |
@kv2019i I have not checked specifically, but yesterday (potentially earlier too) multiple unrelated PRs were failing QB |
Passing now, so must have been CI issue. |
Rework the tflm module to only use the sink/source api to prepare sof for the full transition to pipeline 2.0.