summaryrefslogtreecommitdiff
path: root/libavfilter/dnn_interface.h
diff options
context:
space:
mode:
authorGuo, Yejun <yejun.guo@intel.com>2020-11-18 14:54:10 +0800
committerGuo, Yejun <yejun.guo@intel.com>2020-12-29 09:31:06 +0800
commit5024286465acc35ae005715e0152a135df30ad0a (patch)
treeb919d1411efcb9d5a58928fb6e495bb2cf0a1b36 /libavfilter/dnn_interface.h
parente67b5d0a247cc7c896c6c1042cf140c429866738 (diff)
downloadffmpeg-5024286465acc35ae005715e0152a135df30ad0a.tar.gz
dnn_interface: change from 'void *userdata' to 'AVFilterContext *filter_ctx'
'void *' is too flexible, since we can derive info from AVFilterContext*, so we just unify the interface with this data structure. Signed-off-by: Xie, Lin <lin.xie@intel.com> Signed-off-by: Wu Zhiwen <zhiwen.wu@intel.com> 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, 6 insertions, 5 deletions
diff --git a/libavfilter/dnn_interface.h b/libavfilter/dnn_interface.h
index 33d55703d2..1e2842425a 100644
--- a/libavfilter/dnn_interface.h
+++ b/libavfilter/dnn_interface.h
@@ -28,6 +28,7 @@
#include <stdint.h>
#include "libavutil/frame.h"
+typedef struct AVFilterContext AVFilterContext;
typedef enum {DNN_SUCCESS, DNN_ERROR} DNNReturnType;
@@ -53,8 +54,8 @@ typedef struct DNNModel{
void *model;
// Stores options when the model is executed by the backend
const char *options;
- // Stores userdata used for the interaction between AVFrame and DNNData
- void *userdata;
+ // Stores FilterContext used for the interaction between AVFrame and DNNData
+ AVFilterContext *filter_ctx;
// 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);
@@ -63,16 +64,16 @@ typedef struct DNNModel{
const char *output_name, int *output_width, int *output_height);
// set the pre process to transfer data from AVFrame to DNNData
// the default implementation within DNN is used if it is not provided by the filter
- int (*pre_proc)(AVFrame *frame_in, DNNData *model_input, void *user_data);
+ int (*pre_proc)(AVFrame *frame_in, DNNData *model_input, AVFilterContext *filter_ctx);
// set the post process to transfer data from DNNData to AVFrame
// the default implementation within DNN is used if it is not provided by the filter
- int (*post_proc)(AVFrame *frame_out, DNNData *model_output, void *user_data);
+ int (*post_proc)(AVFrame *frame_out, DNNData *model_output, AVFilterContext *filter_ctx);
} 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, void *userdata);
+ DNNModel *(*load_model)(const char *model_filename, 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);