Skip to content

module: tflm: rework module to use sink/source api#10804

Open
softwarecki wants to merge 1 commit into
thesofproject:mainfrom
softwarecki:p20-tflm
Open

module: tflm: rework module to use sink/source api#10804
softwarecki wants to merge 1 commit into
thesofproject:mainfrom
softwarecki:p20-tflm

Conversation

@softwarecki
Copy link
Copy Markdown
Collaborator

Rework the tflm module to only use the sink/source api to prepare sof for the full transition to pipeline 2.0.

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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.c over to sink_api / source_api and updates the module interface to .process.
  • Replaces direct audio_stream pointer access with source_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]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants