[FFmpeg-cvslog] lavfi/dnn_backend_openvino.c: move the logic for batch mode earlier
Guo, Yejun
git at videolan.org
Thu May 6 06:08:52 EEST 2021
ffmpeg | branch: master | Guo, Yejun <yejun.guo at intel.com> | Tue Mar 16 13:17:34 2021 +0800| [7eb9accc376dca4f766d87d68c72aa167e4e9c7e] | committer: Guo, Yejun
lavfi/dnn_backend_openvino.c: move the logic for batch mode earlier
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7eb9accc376dca4f766d87d68c72aa167e4e9c7e
---
libavfilter/dnn/dnn_backend_openvino.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c
index a8a02d7589..9f3c696e0a 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -432,13 +432,6 @@ static DNNReturnType execute_model_ov(RequestItem *request, Queue *inferenceq)
ctx = &task->ov_model->ctx;
if (task->async) {
- if (ff_queue_size(inferenceq) < ctx->options.batch_size) {
- if (ff_safe_queue_push_front(task->ov_model->request_queue, request) < 0) {
- av_log(ctx, AV_LOG_ERROR, "Failed to push back request_queue.\n");
- return DNN_ERROR;
- }
- return DNN_SUCCESS;
- }
ret = fill_model_input_ov(task->ov_model, request);
if (ret != DNN_SUCCESS) {
return ret;
@@ -793,6 +786,11 @@ DNNReturnType ff_dnn_execute_model_async_ov(const DNNModel *model, const char *i
return DNN_ERROR;
}
+ if (ff_queue_size(ov_model->inference_queue) < ctx->options.batch_size) {
+ // not enough inference items queued for a batch
+ return DNN_SUCCESS;
+ }
+
request = ff_safe_queue_pop_front(ov_model->request_queue);
if (!request) {
av_log(ctx, AV_LOG_ERROR, "unable to get infer request.\n");
More information about the ffmpeg-cvslog
mailing list