sp500/log_mel.h Source File

sp500/log_mel.h Source File#

Mobilint REGULUS: sp500/log_mel.h Source File
Mobilint REGULUS v4.1
SP500 DSP API
log_mel.h
Go to the documentation of this file.
1
44#ifndef SP500_LOG_MEL_H
45#define SP500_LOG_MEL_H
46
47#include <sp500/dsp.h>
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
54#define SP500_LOG_MEL_MAX_MELS 256
55
57#define SP500_LOG_MEL_MAX_FFT 2048
58
67{
68 int32_t n_samples;
69 int32_t sample_rate;
70 int32_t n_fft;
72 int32_t hop_length;
73 int32_t n_mels;
76 uint8_t normalize;
78 uint8_t reserved0[3];
79
84 const float* mel_filters;
89
90 uint32_t reserved[5];
92
95
98SP500_API int32_t sp500_log_mel_num_frames(int32_t n_samples, int32_t hop_length);
99
102SP500_API int32_t sp500_log_mel_num_freq(int32_t n_fft);
103
106{
107 int32_t n_frames;
108 float max_log;
110 uint32_t reserved[4];
112
135 const sp500_log_mel_params* params,
136 sp500_buffer* features,
137 sp500_log_mel_result* result);
138
158SP500_API sp500_status sp500_log_mel_cpu(const float* audio,
159 const sp500_log_mel_params* params,
160 float* features, int32_t features_count,
161 sp500_log_mel_result* result);
162
163#ifdef __cplusplus
164} /* extern "C" */
165#endif
166
167#endif /* SP500_LOG_MEL_H */
Mobilint SP500 DSP offload - status codes, lifecycle and shared memory.
int32_t sp500_status
Result of every sp500 call.
Definition dsp.h:83
void sp500_log_mel_params_init(sp500_log_mel_params *params)
Fill params with the Whisper defaults documented above.
sp500_status sp500_log_mel(const sp500_buffer *audio, const sp500_log_mel_params *params, sp500_buffer *features, sp500_log_mel_result *result)
Compute the log-mel spectrogram of float32 PCM on the DSP.
int32_t sp500_log_mel_num_freq(int32_t n_fft)
Frequency bins for n_fft: n_fft / 2 + 1, or 0 if n_fft is not supported. Use it to size a custom mel_...
sp500_status sp500_log_mel_cpu(const float *audio, const sp500_log_mel_params *params, float *features, int32_t features_count, sp500_log_mel_result *result)
Host CPU reference for sp500_log_mel(): same tables, same per-frame maths, no DSP involved.
int32_t sp500_log_mel_num_frames(int32_t n_samples, int32_t hop_length)
Frames produced for n_samples: n_samples / hop_length, or 0 for non-positive arguments....
A tensor handed to or received from the DSP.
Definition dsp.h:261
Front-end parameters.
Definition log_mel.h:67
uint32_t mel_filters_count
Definition log_mel.h:88
uint32_t reserved[5]
Definition log_mel.h:90
uint8_t reserved0[3]
Definition log_mel.h:78
const float * mel_filters
Definition log_mel.h:84
int32_t sample_rate
Definition log_mel.h:69
Values reported by a log-mel call.
Definition log_mel.h:106
uint32_t reserved[4]
Definition log_mel.h:110