diff options
author | Guo, Yejun <yejun.guo@intel.com> | 2020-11-18 14:54:10 +0800 |
---|---|---|
committer | Guo, Yejun <yejun.guo@intel.com> | 2020-12-29 09:31:06 +0800 |
commit | 5024286465acc35ae005715e0152a135df30ad0a (patch) | |
tree | b919d1411efcb9d5a58928fb6e495bb2cf0a1b36 /libavfilter/dnn | |
parent | e67b5d0a247cc7c896c6c1042cf140c429866738 (diff) |
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')
-rw-r--r-- | libavfilter/dnn/dnn_backend_native.c | 8 | ||||
-rw-r--r-- | libavfilter/dnn/dnn_backend_native.h | 2 | ||||
-rw-r--r-- | libavfilter/dnn/dnn_backend_openvino.c | 8 | ||||
-rw-r--r-- | libavfilter/dnn/dnn_backend_openvino.h | 2 | ||||
-rw-r--r-- | libavfilter/dnn/dnn_backend_tf.c | 8 | ||||
-rw-r--r-- | libavfilter/dnn/dnn_backend_tf.h | 2 |
6 files changed, 15 insertions, 15 deletions
diff --git a/libavfilter/dnn/dnn_backend_native.c b/libavfilter/dnn/dnn_backend_native.c index 4fc3ba2044..5e7fc0f10c 100644 --- a/libavfilter/dnn/dnn_backend_native.c +++ b/libavfilter/dnn/dnn_backend_native.c @@ -112,7 +112,7 @@ static DNNReturnType get_output_native(void *model, const char *input_name, int // layers_num,layer_type,layer_parameterss,layer_type,layer_parameters... // For CONV layer: activation_function, input_num, output_num, kernel_size, kernel, biases // For DEPTH_TO_SPACE layer: block_size -DNNModel *ff_dnn_load_model_native(const char *model_filename, const char *options, void *userdata) +DNNModel *ff_dnn_load_model_native(const char *model_filename, const char *options, AVFilterContext *filter_ctx) { DNNModel *model = NULL; char header_expected[] = "FFMPEGDNNNATIVE"; @@ -255,7 +255,7 @@ DNNModel *ff_dnn_load_model_native(const char *model_filename, const char *optio model->get_input = &get_input_native; model->get_output = &get_output_native; - model->userdata = userdata; + model->filter_ctx = filter_ctx; return model; @@ -318,7 +318,7 @@ static DNNReturnType execute_model_native(const DNNModel *model, const char *inp input.dt = oprd->data_type; if (do_ioproc) { if (native_model->model->pre_proc != NULL) { - native_model->model->pre_proc(in_frame, &input, native_model->model->userdata); + native_model->model->pre_proc(in_frame, &input, native_model->model->filter_ctx); } else { proc_from_frame_to_dnn(in_frame, &input, ctx); } @@ -366,7 +366,7 @@ static DNNReturnType execute_model_native(const DNNModel *model, const char *inp if (do_ioproc) { if (native_model->model->post_proc != NULL) { - native_model->model->post_proc(out_frame, &output, native_model->model->userdata); + native_model->model->post_proc(out_frame, &output, native_model->model->filter_ctx); } else { proc_from_dnn_to_frame(out_frame, &output, ctx); } diff --git a/libavfilter/dnn/dnn_backend_native.h b/libavfilter/dnn/dnn_backend_native.h index 2d02c063d4..5acdbe0da7 100644 --- a/libavfilter/dnn/dnn_backend_native.h +++ b/libavfilter/dnn/dnn_backend_native.h @@ -128,7 +128,7 @@ typedef struct NativeModel{ int32_t operands_num; } NativeModel; -DNNModel *ff_dnn_load_model_native(const char *model_filename, const char *options, void *userdata); +DNNModel *ff_dnn_load_model_native(const char *model_filename, const char *options, AVFilterContext *filter_ctx); DNNReturnType ff_dnn_execute_model_native(const DNNModel *model, const char *input_name, AVFrame *in_frame, const char **output_names, uint32_t nb_output, AVFrame *out_frame); diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c index 8c3ba8a6a8..a35d72a38c 100644 --- a/libavfilter/dnn/dnn_backend_openvino.c +++ b/libavfilter/dnn/dnn_backend_openvino.c @@ -136,7 +136,7 @@ static DNNReturnType fill_model_input_ov(OVModel *ov_model, TaskItem *task, Requ input.dt = precision_to_datatype(precision); if (task->do_ioproc) { if (ov_model->model->pre_proc != NULL) { - ov_model->model->pre_proc(task->in_frame, &input, ov_model->model->userdata); + ov_model->model->pre_proc(task->in_frame, &input, ov_model->model->filter_ctx); } else { proc_from_frame_to_dnn(task->in_frame, &input, ctx); } @@ -196,7 +196,7 @@ static void infer_completion_callback(void *args) output.data = blob_buffer.buffer; if (task->do_ioproc) { if (task->ov_model->model->post_proc != NULL) { - task->ov_model->model->post_proc(task->out_frame, &output, task->ov_model->model->userdata); + task->ov_model->model->post_proc(task->out_frame, &output, task->ov_model->model->filter_ctx); } else { proc_from_dnn_to_frame(task->out_frame, &output, ctx); } @@ -350,7 +350,7 @@ static DNNReturnType get_output_ov(void *model, const char *input_name, int inpu return ret; } -DNNModel *ff_dnn_load_model_ov(const char *model_filename, const char *options, void *userdata) +DNNModel *ff_dnn_load_model_ov(const char *model_filename, const char *options, AVFilterContext *filter_ctx) { char *all_dev_names = NULL; DNNModel *model = NULL; @@ -447,7 +447,7 @@ DNNModel *ff_dnn_load_model_ov(const char *model_filename, const char *options, model->get_input = &get_input_ov; model->get_output = &get_output_ov; model->options = options; - model->userdata = userdata; + model->filter_ctx = filter_ctx; return model; diff --git a/libavfilter/dnn/dnn_backend_openvino.h b/libavfilter/dnn/dnn_backend_openvino.h index 2f88e49a08..1b70150040 100644 --- a/libavfilter/dnn/dnn_backend_openvino.h +++ b/libavfilter/dnn/dnn_backend_openvino.h @@ -29,7 +29,7 @@ #include "../dnn_interface.h" -DNNModel *ff_dnn_load_model_ov(const char *model_filename, const char *options, void *userdata); +DNNModel *ff_dnn_load_model_ov(const char *model_filename, const char *options, AVFilterContext *filter_ctx); DNNReturnType ff_dnn_execute_model_ov(const DNNModel *model, const char *input_name, AVFrame *in_frame, const char **output_names, uint32_t nb_output, AVFrame *out_frame); diff --git a/libavfilter/dnn/dnn_backend_tf.c b/libavfilter/dnn/dnn_backend_tf.c index 76cc037b94..b9fe01693b 100644 --- a/libavfilter/dnn/dnn_backend_tf.c +++ b/libavfilter/dnn/dnn_backend_tf.c @@ -664,7 +664,7 @@ static DNNReturnType load_native_model(TFModel *tf_model, const char *model_file return DNN_SUCCESS; } -DNNModel *ff_dnn_load_model_tf(const char *model_filename, const char *options, void *userdata) +DNNModel *ff_dnn_load_model_tf(const char *model_filename, const char *options, AVFilterContext *filter_ctx) { DNNModel *model = NULL; TFModel *tf_model = NULL; @@ -704,7 +704,7 @@ DNNModel *ff_dnn_load_model_tf(const char *model_filename, const char *options, model->get_input = &get_input_tf; model->get_output = &get_output_tf; model->options = options; - model->userdata = userdata; + model->filter_ctx = filter_ctx; return model; } @@ -741,7 +741,7 @@ static DNNReturnType execute_model_tf(const DNNModel *model, const char *input_n if (do_ioproc) { if (tf_model->model->pre_proc != NULL) { - tf_model->model->pre_proc(in_frame, &input, tf_model->model->userdata); + tf_model->model->pre_proc(in_frame, &input, tf_model->model->filter_ctx); } else { proc_from_frame_to_dnn(in_frame, &input, ctx); } @@ -798,7 +798,7 @@ static DNNReturnType execute_model_tf(const DNNModel *model, const char *input_n if (do_ioproc) { if (tf_model->model->post_proc != NULL) { - tf_model->model->post_proc(out_frame, &output, tf_model->model->userdata); + tf_model->model->post_proc(out_frame, &output, tf_model->model->filter_ctx); } else { proc_from_dnn_to_frame(out_frame, &output, ctx); } diff --git a/libavfilter/dnn/dnn_backend_tf.h b/libavfilter/dnn/dnn_backend_tf.h index 1e00669736..cac8936729 100644 --- a/libavfilter/dnn/dnn_backend_tf.h +++ b/libavfilter/dnn/dnn_backend_tf.h @@ -29,7 +29,7 @@ #include "../dnn_interface.h" -DNNModel *ff_dnn_load_model_tf(const char *model_filename, const char *options, void *userdata); +DNNModel *ff_dnn_load_model_tf(const char *model_filename, const char *options, AVFilterContext *filter_ctx); DNNReturnType ff_dnn_execute_model_tf(const DNNModel *model, const char *input_name, AVFrame *in_frame, const char **output_names, uint32_t nb_output, AVFrame *out_frame); |