summaryrefslogtreecommitdiff
path: root/libavfilter/dnn
diff options
context:
space:
mode:
authorGuo, Yejun <yejun.guo@intel.com>2021-03-09 14:51:42 +0800
committerGuo, Yejun <yejun.guo@intel.com>2021-04-08 09:23:02 +0800
commit13bf797ced0b527fa770d4b29884a5b0b8f19898 (patch)
treee7ea6390670e4d124c7beaa344074184d5d009d0 /libavfilter/dnn
parent59021d79a24e28434f57376276625bc44eff340c (diff)
lavfi/dnn: add post process for detection
Diffstat (limited to 'libavfilter/dnn')
-rw-r--r--libavfilter/dnn/dnn_backend_openvino.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c
index 3bea2d526a..0757727a9c 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -236,16 +236,32 @@ static void infer_completion_callback(void *args)
av_assert0(request->task_count >= 1);
for (int i = 0; i < request->task_count; ++i) {
task = request->tasks[i];
- if (task->do_ioproc) {
- if (task->ov_model->model->frame_post_proc != NULL) {
- task->ov_model->model->frame_post_proc(task->out_frame, &output, task->ov_model->model->filter_ctx);
+
+ switch (task->ov_model->model->func_type) {
+ case DFT_PROCESS_FRAME:
+ if (task->do_ioproc) {
+ if (task->ov_model->model->frame_post_proc != NULL) {
+ task->ov_model->model->frame_post_proc(task->out_frame, &output, task->ov_model->model->filter_ctx);
+ } else {
+ ff_proc_from_dnn_to_frame(task->out_frame, &output, ctx);
+ }
} else {
- ff_proc_from_dnn_to_frame(task->out_frame, &output, ctx);
+ task->out_frame->width = output.width;
+ task->out_frame->height = output.height;
}
- } else {
- task->out_frame->width = output.width;
- task->out_frame->height = output.height;
+ break;
+ case DFT_ANALYTICS_DETECT:
+ if (!task->ov_model->model->detect_post_proc) {
+ av_log(ctx, AV_LOG_ERROR, "detect filter needs to provide post proc\n");
+ return;
+ }
+ task->ov_model->model->detect_post_proc(task->out_frame, &output, 1, task->ov_model->model->filter_ctx);
+ break;
+ default:
+ av_assert0(!"should not reach here");
+ break;
}
+
task->done = 1;
output.data = (uint8_t *)output.data
+ output.width * output.height * output.channels * get_datatype_size(output.dt);