LiteASR-ONNX-DLL / include /liteasr_ffi.h
zukky's picture
Upload folder using huggingface_hub
27a58dc verified
#ifndef LITEASR_FFI_H
#define LITEASR_FFI_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct LiteAsrF32Buffer {
float* data;
size_t len;
size_t cap;
size_t rows;
size_t cols;
} LiteAsrF32Buffer;
typedef struct LiteAsrI64Buffer {
int64_t* data;
size_t len;
size_t cap;
} LiteAsrI64Buffer;
typedef struct LiteAsrUtf8Buffer {
uint8_t* data;
size_t len;
size_t cap;
} LiteAsrUtf8Buffer;
const char* liteasr_last_error_message(void);
int32_t liteasr_preprocess_wav(
const char* wav_path,
uint32_t target_sr,
size_t n_mels,
LiteAsrF32Buffer* out
);
int32_t liteasr_build_prompt_ids(
const char* tokenizer_json_path,
const char* language,
const char* task,
bool with_timestamps,
bool omit_language_token,
bool omit_notimestamps_token,
LiteAsrI64Buffer* out
);
int32_t liteasr_decode_tokens(
const char* tokenizer_json_path,
const int64_t* token_ids,
size_t token_ids_len,
bool skip_special_tokens,
LiteAsrUtf8Buffer* out
);
int32_t liteasr_apply_suppression(
float* logits,
size_t logits_len,
const int64_t* suppress_ids,
size_t suppress_len,
const int64_t* begin_suppress_ids,
size_t begin_suppress_len,
size_t step
);
void liteasr_free_f32_buffer(LiteAsrF32Buffer* buffer);
void liteasr_free_i64_buffer(LiteAsrI64Buffer* buffer);
void liteasr_free_utf8_buffer(LiteAsrUtf8Buffer* buffer);
#ifdef __cplusplus
}
#endif
#endif