summaryrefslogtreecommitdiff
path: root/libavfilter/dnn_interface.h
diff options
context:
space:
mode:
authorGuo, Yejun <yejun.guo@intel.com>2021-02-07 14:35:22 +0800
committerGuo, Yejun <yejun.guo@intel.com>2021-02-18 09:59:37 +0800
commit76fc6879e2c59929e7d81a72986bb4950053177e (patch)
tree62ac1a7bd345bfe6fd06f15113b1d46e466413ee /libavfilter/dnn_interface.h
parentbdce6361004b3a24082e00b6c0126e2694a65b50 (diff)
downloadffmpeg-76fc6879e2c59929e7d81a72986bb4950053177e.tar.gz
dnn: add function type for model
So the backend knows the usage of model is for frame processing, detect, classify, etc. Each function type has different behavior in backend when handling the input/output data of the model. Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Diffstat (limited to 'libavfilter/dnn_interface.h')
-rw-r--r--libavfilter/dnn_interface.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/libavfilter/dnn_interface.h b/libavfilter/dnn_interface.h
index ff338ea084..2fb9b15676 100644
--- a/libavfilter/dnn_interface.h
+++ b/libavfilter/dnn_interface.h
@@ -43,6 +43,13 @@ typedef enum {
DAST_SUCCESS // got a result frame successfully
} DNNAsyncStatusType;
+typedef enum {
+ DFT_NONE,
+ DFT_PROCESS_FRAME, // process the whole frame
+ DFT_ANALYTICS_DETECT, // detect from the whole frame
+ // we can add more such as detect_from_crop, classify_from_bbox, etc.
+}DNNFunctionType;
+
typedef struct DNNData{
void *data;
DNNDataType dt;
@@ -56,6 +63,8 @@ typedef struct DNNModel{
const char *options;
// Stores FilterContext used for the interaction between AVFrame and DNNData
AVFilterContext *filter_ctx;
+ // Stores function type of the model
+ DNNFunctionType func_type;
// Gets model input information
// Just reuse struct DNNData here, actually the DNNData.data field is not needed.
DNNReturnType (*get_input)(void *model, DNNData *input, const char *input_name);
@@ -73,7 +82,7 @@ typedef struct DNNModel{
// Stores pointers to functions for loading, executing, freeing DNN models for one of the backends.
typedef struct DNNModule{
// Loads model and parameters from given file. Returns NULL if it is not possible.
- DNNModel *(*load_model)(const char *model_filename, const char *options, AVFilterContext *filter_ctx);
+ DNNModel *(*load_model)(const char *model_filename, DNNFunctionType func_type, const char *options, AVFilterContext *filter_ctx);
// Executes model with specified input and output. Returns DNN_ERROR otherwise.
DNNReturnType (*execute_model)(const DNNModel *model, const char *input_name, AVFrame *in_frame,
const char **output_names, uint32_t nb_output, AVFrame *out_frame);