#ifndef __NPUARMPLUGIN_H__
#define __NPUARMPLUGIN_H__
+#include <stdint.h>
+
/**
* @brief To supply ARM-Postprocessor, fill this struct in and register.
- * @param[in] input_buf The input buffer. Even if it's "multi-tensor", they are packaed into a single buffer.
- * @param[in] input_size The size of input buffer.
- * @param[out] output_buf The output buffer, allocated by the caller (NPU-Engine). Fill this in!
- * @param[in] output_size The size of output buffer, allocated by the caller (NPU-Engine)
- * @param[in/out] p_data The private data that can be given statically with this plugin
- * @param[in] sequence The sequence number of the input frame.
- * @param[in] model_id ID of the given model, refer to npubinfmt.h
- * @param[in] model_version Version of the given model, refer to npubinfmt.h
*/
typedef struct {
+ uint64_t model_id; /**< ID of the given model, refer to npubinfmt.h */
+ uint64_t model_version; /**< Version of the given model, refer to npubinfmt.h */
+ /**
+ * @brief the registered post-process function
+ * @param[in] input_buf The input buffer. Even if it's "multi-tensor", they are packaed into a single buffer.
+ * @param[in] input_size The size of input buffer.
+ * @param[out] output_buf The output buffer, allocated by the caller (NPU-Engine). Fill this in!
+ * @param[in] output_size The size of output buffer, allocated by the caller (NPU-Engine)
+ * @param[in/out] p_data The private data that can be given statically with this plugin
+ * @param[in] sequence The sequence number of the input frame.
+ */
void (*process) (const char *input_buf, uint64_t input_size,
- char *output_buf, uint64_t output_size, void *p_data, uint64_t sequence,
- uint64_t model_id, uint64_t model_version);
+ char *output_buf, uint64_t output_size, void *p_data, uint64_t sequence);
+ /**
+ * @brief preempt (i.e., stop) the current processing by force.
+ * @note It's necessary to implement STOP_PREEMPT. When preempt() is called,
+ * the plugin should stop the current post-processing.
+ * Of course, do nothing if there is no active processing.
+ */
+ void (*preempt) (void);
} npu_arm_plugin;
/**
*/
extern int register_npu_arm_plugin (npu_arm_plugin *plugin, void *p_data);
+/**
+ * @brief The plugin author should call this with its fini function to deregister the plugin.
+ * @param[in] plugin The plugin itself.
+ * @return 0 if ok. negative error value if it fails.
+ */
+extern int deregister_npu_arm_plugin (npu_arm_plugin *plugin);
#endif /* __NPUARMPLUGIN_H__ */