module: tflm: rework module to use sink/source api#10804
Open
softwarecki wants to merge 1 commit into
Open
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>
Contributor
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.
Comment on lines
177
to
180
| 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) | ||
| { |
Comment on lines
+185
to
+186
| 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; |
Comment on lines
+195
to
201
| 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; |
Comment on lines
+216
to
+218
| /* advance by one stride */ | ||
| source_release_data(sources[0], TFLM_FEATURE_SIZE * frame_bytes); | ||
| features = source_get_data_frames_available(sources[0]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rework the tflm module to only use the sink/source api to prepare sof for the full transition to pipeline 2.0.