diff options
author | Guo, Yejun <yejun.guo@intel.com> | 2021-05-17 10:31:16 +0800 |
---|---|---|
committer | Guo, Yejun <yejun.guo@intel.com> | 2021-05-24 09:09:34 +0800 |
commit | 4c705a2775afca7eadc40835bfaafb29a9c5c38a (patch) | |
tree | 5c62ca48eb87c7140072e0734ac4dc3d6cb4c38b /libavfilter/dnn/dnn_backend_tf.c | |
parent | cde6d0288fc9bd2238b5078b4d998569ba65b2b7 (diff) |
lavfi/dnn: refine code to separate processing and detection in backends
Diffstat (limited to 'libavfilter/dnn/dnn_backend_tf.c')
-rw-r--r-- | libavfilter/dnn/dnn_backend_tf.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/libavfilter/dnn/dnn_backend_tf.c b/libavfilter/dnn/dnn_backend_tf.c index 5908aeb359..4c16c2bdb0 100644 --- a/libavfilter/dnn/dnn_backend_tf.c +++ b/libavfilter/dnn/dnn_backend_tf.c @@ -763,12 +763,22 @@ static DNNReturnType execute_model_tf(const DNNModel *model, const char *input_n } input.data = (float *)TF_TensorData(input_tensor); - if (do_ioproc) { - if (tf_model->model->frame_pre_proc != NULL) { - tf_model->model->frame_pre_proc(in_frame, &input, tf_model->model->filter_ctx); - } else { - ff_proc_from_frame_to_dnn(in_frame, &input, tf_model->model->func_type, ctx); + switch (tf_model->model->func_type) { + case DFT_PROCESS_FRAME: + if (do_ioproc) { + if (tf_model->model->frame_pre_proc != NULL) { + tf_model->model->frame_pre_proc(in_frame, &input, tf_model->model->filter_ctx); + } else { + ff_proc_from_frame_to_dnn(in_frame, &input, ctx); + } } + break; + case DFT_ANALYTICS_DETECT: + ff_frame_to_dnn_detect(in_frame, &input, ctx); + break; + default: + avpriv_report_missing_feature(ctx, "model function type %d", tf_model->model->func_type); + break; } tf_outputs = av_malloc_array(nb_output, sizeof(*tf_outputs)); |