pub unsafe extern "C" fn aic_model_create_from_buffer(
model: *mut *mut AicModel,
buffer: *const u8,
buffer_len: usize,
) -> TypeExpand description
Creates a new model instance from a memory buffer.
The buffer must remain valid and unchanged for the lifetime of the model.
§Note
Processor instances retain a shared reference to the model data. It is safe to destroy the model handle after creating the desired processors. The memory used by the model will be automatically freed after all processors using that model have been destroyed.
§Parameters
model: Receives the handle to the newly created model. Must not be NULL.buffer: Pointer to the model bytes. Must not be NULL and must be aligned to 64 bytes.buffer_len: Length of the model buffer in bytes.
§Returns
AIC_ERROR_CODE_SUCCESS: Model created successfullyAIC_ERROR_CODE_NULL_POINTER:modelorbufferis NULLAIC_ERROR_CODE_MODEL_INVALID: Model buffer is invalid or corrupted.AIC_ERROR_CODE_MODEL_VERSION_UNSUPPORTED: Model version is not compatible with the SDK version.AIC_ERROR_CODE_MODEL_DATA_UNALIGNED: Model data is not aligned to 64 bytes.
§Safety
- This function is not thread-safe. Ensure no other threads are using the model handle.