History

lavfi/dnn_backend_openvino: Return Specific Error Codes

Switch to returning specific error codes or DNN_GENERIC_ERROR when an error is encountered. For OpenVINO API errors, currently DNN_GENERIC_ERROR is returned.

Shubhanshu Saxena committed 4 years ago

Commit 91af38f1 parent d0587da3 files · +89 −63Browse files

Showing the changes to libavfilter (3 of 3 files). Show all

Unified · Split

3 files
  1. libavfilter/dnn/dnn_backend_openvino.c +82 −56
  2. libavfilter/dnn/dnn_backend_openvino.h +2 −2
  3. libavfilter/dnn_interface.h +5 −5
libavfilter/dnn/dnn_backend_openvino.c+82−56
@@ -112,7 +112,7 @@ static int get_datatype_size(DNNDataType dt) · 111 unmodified lines
112112 }
113113 }
114114
115−static DNNReturnType fill_model_input_ov(OVModel *ov_model, OVRequestItem *request)
115+static int fill_model_input_ov(OVModel *ov_model, OVRequestItem *request)
116116 {
117117 dimensions_t dims;
118118 precision_e precision;
@@ -131,7 +131,7 @@ static DNNReturnType fill_model_input_ov(OVModel *ov_model, OVRequestItem *reque · 12 unmodified lines
131131 status = ie_infer_request_get_blob(request->infer_request, task->input_name, &input_blob);
132132 if (status != OK) {
133133 av_log(ctx, AV_LOG_ERROR, "Failed to get input blob with name %s\n", task->input_name);
134− return DNN_ERROR;
134+ return DNN_GENERIC_ERROR;
135135 }
136136
137137 status |= ie_blob_get_dims(input_blob, &dims);
@@ -139,14 +139,14 @@ static DNNReturnType fill_model_input_ov(OVModel *ov_model, OVRequestItem *reque · 1 unmodified line
139139 if (status != OK) {
140140 ie_blob_free(&input_blob);
141141 av_log(ctx, AV_LOG_ERROR, "Failed to get input blob dims/precision\n");
142− return DNN_ERROR;
142+ return DNN_GENERIC_ERROR;
143143 }
144144
145145 status = ie_blob_get_buffer(input_blob, &blob_buffer);
146146 if (status != OK) {
147147 ie_blob_free(&input_blob);
148148 av_log(ctx, AV_LOG_ERROR, "Failed to get input blob buffer\n");
149− return DNN_ERROR;
149+ return DNN_GENERIC_ERROR;
150150 }
151151
152152 input.height = dims.dims[2];
@@ -301,8 +301,9 @@ static void infer_completion_callback(void *args) · 148 unmodified lines
301301 }
302302 }
303303
304−static DNNReturnType init_model_ov(OVModel *ov_model, const char *input_name, const char *output_name)
304+static int init_model_ov(OVModel *ov_model, const char *input_name, const char *output_name)
305305 {
306+ int ret = DNN_SUCCESS;
306307 OVContext *ctx = &ov_model->ctx;
307308 IEStatusCode status;
308309 ie_available_devices_t a_dev;
@@ -317,14 +318,18 @@ static DNNReturnType init_model_ov(OVModel *ov_model, const char *input_name, co · 8 unmodified lines
317318 if (ctx->options.batch_size > 1) {
318319 input_shapes_t input_shapes;
319320 status = ie_network_get_input_shapes(ov_model->network, &input_shapes);
320− if (status != OK)
321+ if (status != OK) {
322+ ret = DNN_GENERIC_ERROR;
321323 goto err;
324+ }
322325 for (int i = 0; i < input_shapes.shape_num; i++)
323326 input_shapes.shapes[i].shape.dims[0] = ctx->options.batch_size;
324327 status = ie_network_reshape(ov_model->network, input_shapes);
325328 ie_network_input_shapes_free(&input_shapes);
326− if (status != OK)
329+ if (status != OK) {
330+ ret = DNN_GENERIC_ERROR;
327331 goto err;
332+ }
328333 }
329334
330335 // The order of dims in the openvino is fixed and it is always NCHW for 4-D data.
@@ -332,11 +337,13 @@ static DNNReturnType init_model_ov(OVModel *ov_model, const char *input_name, co · 1 unmodified line
332337 status = ie_network_set_input_layout(ov_model->network, input_name, NHWC);
333338 if (status != OK) {
334339 av_log(ctx, AV_LOG_ERROR, "Failed to set layout as NHWC for input %s\n", input_name);
340+ ret = DNN_GENERIC_ERROR;
335341 goto err;
336342 }
337343 status = ie_network_set_output_layout(ov_model->network, output_name, NHWC);
338344 if (status != OK) {
339345 av_log(ctx, AV_LOG_ERROR, "Failed to set layout as NHWC for output %s\n", output_name);
346+ ret = DNN_GENERIC_ERROR;
340347 goto err;
341348 }
342349
@@ -350,6 +357,7 @@ static DNNReturnType init_model_ov(OVModel *ov_model, const char *input_name, co · 7 unmodified lines
350357 status = ie_network_set_input_precision(ov_model->network, input_name, U8);
351358 if (status != OK) {
352359 av_log(ctx, AV_LOG_ERROR, "Failed to set input precision as U8 for %s\n", input_name);
360+ ret = DNN_GENERIC_ERROR;
353361 goto err;
354362 }
355363 }
@@ -360,6 +368,7 @@ static DNNReturnType init_model_ov(OVModel *ov_model, const char *input_name, co · 4 unmodified lines
360368 status = ie_core_get_available_devices(ov_model->core, &a_dev);
361369 if (status != OK) {
362370 av_log(ctx, AV_LOG_ERROR, "Failed to get available devices\n");
371+ ret = DNN_GENERIC_ERROR;
363372 goto err;
364373 }
365374 for (int i = 0; i < a_dev.num_devices; i++) {
@@ -367,6 +376,7 @@ static DNNReturnType init_model_ov(OVModel *ov_model, const char *input_name, co · 1 unmodified line
367376 }
368377 av_log(ctx, AV_LOG_ERROR,"device %s may not be supported, all available devices are: \"%s\"\n",
369378 ctx->options.device_type, all_dev_names);
379+ ret = AVERROR(ENODEV);
370380 goto err;
371381 }
372382
@@ -378,12 +388,14 @@ static DNNReturnType init_model_ov(OVModel *ov_model, const char *input_name, co · 5 unmodified lines
378388
379389 ov_model->request_queue = ff_safe_queue_create();
380390 if (!ov_model->request_queue) {
391+ ret = AVERROR(ENOMEM);
381392 goto err;
382393 }
383394
384395 for (int i = 0; i < ctx->options.nireq; i++) {
385396 OVRequestItem *item = av_mallocz(sizeof(*item));
386397 if (!item) {
398+ ret = AVERROR(ENOMEM);
387399 goto err;
388400 }
389401
@@ -391,16 +403,19 @@ static DNNReturnType init_model_ov(OVModel *ov_model, const char *input_name, co · 1 unmodified line
391403 item->callback.args = item;
392404 if (ff_safe_queue_push_back(ov_model->request_queue, item) < 0) {
393405 av_freep(&item);
406+ ret = AVERROR(ENOMEM);
394407 goto err;
395408 }
396409
397410 status = ie_exec_network_create_infer_request(ov_model->exe_network, &item->infer_request);
398411 if (status != OK) {
412+ ret = DNN_GENERIC_ERROR;
399413 goto err;
400414 }
401415
402416 item->lltasks = av_malloc_array(ctx->options.batch_size, sizeof(*item->lltasks));
403417 if (!item->lltasks) {
418+ ret = AVERROR(ENOMEM);
404419 goto err;
405420 }
406421 item->lltask_count = 0;
@@ -408,11 +423,13 @@ static DNNReturnType init_model_ov(OVModel *ov_model, const char *input_name, co · 1 unmodified line
408423
409424 ov_model->task_queue = ff_queue_create();
410425 if (!ov_model->task_queue) {
426+ ret = AVERROR(ENOMEM);
411427 goto err;
412428 }
413429
414430 ov_model->lltask_queue = ff_queue_create();
415431 if (!ov_model->lltask_queue) {
432+ ret = AVERROR(ENOMEM);
416433 goto err;
417434 }
418435
@@ -420,14 +437,14 @@ static DNNReturnType init_model_ov(OVModel *ov_model, const char *input_name, co · 1 unmodified line
420437
421438 err:
422439 ff_dnn_free_model_ov(&ov_model->model);
423− return DNN_ERROR;
440+ return ret;
424441 }
425442
426−static DNNReturnType execute_model_ov(OVRequestItem *request, Queue *inferenceq)
443+static int execute_model_ov(OVRequestItem *request, Queue *inferenceq)
427444 {
428445 IEStatusCode status;
429− DNNReturnType ret;
430446 LastLevelTaskItem *lltask;
447+ int ret = DNN_SUCCESS;
431448 TaskItem *task;
432449 OVContext *ctx;
433450 OVModel *ov_model;
@@ -451,11 +468,13 @@ static DNNReturnType execute_model_ov(OVRequestItem *request, Queue *inferenceq) · 17 unmodified lines
451468 status = ie_infer_set_completion_callback(request->infer_request, &request->callback);
452469 if (status != OK) {
453470 av_log(ctx, AV_LOG_ERROR, "Failed to set completion callback for inference\n");
471+ ret = DNN_GENERIC_ERROR;
454472 goto err;
455473 }
456474 status = ie_infer_request_infer_async(request->infer_request);
457475 if (status != OK) {
458476 av_log(ctx, AV_LOG_ERROR, "Failed to start async inference\n");
477+ ret = DNN_GENERIC_ERROR;
459478 goto err;
460479 }
461480 return DNN_SUCCESS;
@@ -467,20 +486,21 @@ static DNNReturnType execute_model_ov(OVRequestItem *request, Queue *inferenceq) · 5 unmodified lines
467486 status = ie_infer_request_infer(request->infer_request);
468487 if (status != OK) {
469488 av_log(ctx, AV_LOG_ERROR, "Failed to start synchronous model inference\n");
489+ ret = DNN_GENERIC_ERROR;
470490 goto err;
471491 }
472492 infer_completion_callback(request);
473− return (task->inference_done == task->inference_todo) ? DNN_SUCCESS : DNN_ERROR;
493+ return (task->inference_done == task->inference_todo) ? DNN_SUCCESS : DNN_GENERIC_ERROR;
474494 }
475495 err:
476496 if (ff_safe_queue_push_back(ov_model->request_queue, request) < 0) {
477497 ie_infer_request_free(&request->infer_request);
478498 av_freep(&request);
479499 }
480− return DNN_ERROR;
500+ return ret;
481501 }
482502
483−static DNNReturnType get_input_ov(void *model, DNNData *input, const char *input_name)
503+static int get_input_ov(void *model, DNNData *input, const char *input_name)
484504 {
485505 OVModel *ov_model = model;
486506 OVContext *ctx = &ov_model->ctx;
@@ -495,14 +515,14 @@ static DNNReturnType get_input_ov(void *model, DNNData *input, const char *input · 8 unmodified lines
495515 status = ie_network_get_inputs_number(ov_model->network, &model_input_count);
496516 if (status != OK) {
497517 av_log(ctx, AV_LOG_ERROR, "Failed to get input count\n");
498− return DNN_ERROR;
518+ return DNN_GENERIC_ERROR;
499519 }
500520
501521 for (size_t i = 0; i < model_input_count; i++) {
502522 status = ie_network_get_input_name(ov_model->network, i, &model_input_name);
503523 if (status != OK) {
504524 av_log(ctx, AV_LOG_ERROR, "Failed to get No.%d input's name\n", (int)i);
505− return DNN_ERROR;
525+ return DNN_GENERIC_ERROR;
506526 }
507527 if (strcmp(model_input_name, input_name) == 0) {
508528 ie_network_name_free(&model_input_name);
@@ -510,7 +530,7 @@ static DNNReturnType get_input_ov(void *model, DNNData *input, const char *input · 1 unmodified line
510530 status |= ie_network_get_input_precision(ov_model->network, input_name, &precision);
511531 if (status != OK) {
512532 av_log(ctx, AV_LOG_ERROR, "Failed to get No.%d input's dims or precision\n", (int)i);
513− return DNN_ERROR;
533+ return DNN_GENERIC_ERROR;
514534 }
515535
516536 input->channels = dims.dims[1];
@@ -527,7 +547,7 @@ static DNNReturnType get_input_ov(void *model, DNNData *input, const char *input · 10 unmodified lines
527547 }
528548
529549 av_log(ctx, AV_LOG_ERROR, "Could not find \"%s\" in model, all input(s) are: \"%s\"\n", input_name, all_input_names);
530− return DNN_ERROR;
550+ return AVERROR(EINVAL);
531551 }
532552
533553 static int contain_valid_detection_bbox(AVFrame *frame)
@@ -567,7 +587,7 @@ static int contain_valid_detection_bbox(AVFrame *frame) · 33 unmodified lines
567587 return 1;
568588 }
569589
570−static DNNReturnType extract_lltask_from_task(DNNFunctionType func_type, TaskItem *task, Queue *lltask_queue, DNNExecBaseParams *exec_params)
590+static int extract_lltask_from_task(DNNFunctionType func_type, TaskItem *task, Queue *lltask_queue, DNNExecBaseParams *exec_params)
571591 {
572592 switch (func_type) {
573593 case DFT_PROCESS_FRAME:
@@ -575,14 +595,14 @@ static DNNReturnType extract_lltask_from_task(DNNFunctionType func_type, TaskIte · 1 unmodified line
575595 {
576596 LastLevelTaskItem *lltask = av_malloc(sizeof(*lltask));
577597 if (!lltask) {
578− return DNN_ERROR;
598+ return AVERROR(ENOMEM);
579599 }
580600 task->inference_todo = 1;
581601 task->inference_done = 0;
582602 lltask->task = task;
583603 if (ff_queue_push_back(lltask_queue, lltask) < 0) {
584604 av_freep(&lltask);
585− return DNN_ERROR;
605+ return AVERROR(ENOMEM);
586606 }
587607 return DNN_SUCCESS;
588608 }
@@ -615,28 +635,28 @@ static DNNReturnType extract_lltask_from_task(DNNFunctionType func_type, TaskIte · 26 unmodified lines
615635
616636 lltask = av_malloc(sizeof(*lltask));
617637 if (!lltask) {
618− return DNN_ERROR;
638+ return AVERROR(ENOMEM);
619639 }
620640 task->inference_todo++;
621641 lltask->task = task;
622642 lltask->bbox_index = i;
623643 if (ff_queue_push_back(lltask_queue, lltask) < 0) {
624644 av_freep(&lltask);
625− return DNN_ERROR;
645+ return AVERROR(ENOMEM);
626646 }
627647 }
628648 return DNN_SUCCESS;
629649 }
630650 default:
631651 av_assert0(!"should not reach here");
632− return DNN_ERROR;
652+ return AVERROR(EINVAL);
633653 }
634654 }
635655
636−static DNNReturnType get_output_ov(void *model, const char *input_name, int input_width, int input_height,
656+static int get_output_ov(void *model, const char *input_name, int input_width, int input_height,
637657 const char *output_name, int *output_width, int *output_height)
638658 {
639− DNNReturnType ret;
659+ int ret;
640660 OVModel *ov_model = model;
641661 OVContext *ctx = &ov_model->ctx;
642662 TaskItem task;
@@ -653,7 +673,7 @@ static DNNReturnType get_output_ov(void *model, const char *input_name, int inpu · 10 unmodified lines
653673
654674 if (ov_model->model->func_type != DFT_PROCESS_FRAME) {
655675 av_log(ctx, AV_LOG_ERROR, "Get output dim only when processing frame.\n");
656− return DNN_ERROR;
676+ return AVERROR(EINVAL);
657677 }
658678
659679 if (ctx->options.input_resizable) {
@@ -664,31 +684,33 @@ static DNNReturnType get_output_ov(void *model, const char *input_name, int inpu · 4 unmodified lines
664684 ie_network_input_shapes_free(&input_shapes);
665685 if (status != OK) {
666686 av_log(ctx, AV_LOG_ERROR, "Failed to reshape input size for %s\n", input_name);
667− return DNN_ERROR;
687+ return DNN_GENERIC_ERROR;
668688 }
669689 }
670690
671691 if (!ov_model->exe_network) {
672− if (init_model_ov(ov_model, input_name, output_name) != DNN_SUCCESS) {
692+ ret = init_model_ov(ov_model, input_name, output_name);
693+ if (ret != DNN_SUCCESS) {
673694 av_log(ctx, AV_LOG_ERROR, "Failed init OpenVINO exectuable network or inference request\n");
674− return DNN_ERROR;
695+ return ret;
675696 }
676697 }
677698
678− if (ff_dnn_fill_gettingoutput_task(&task, &exec_params, ov_model, input_height, input_width, ctx) != DNN_SUCCESS) {
679− return DNN_ERROR;
699+ ret = ff_dnn_fill_gettingoutput_task(&task, &exec_params, ov_model, input_height, input_width, ctx);
700+ if (ret != DNN_SUCCESS) {
701+ goto err;
680702 }
681703
682− if (extract_lltask_from_task(ov_model->model->func_type, &task, ov_model->lltask_queue, NULL) != DNN_SUCCESS) {
683− av_log(ctx, AV_LOG_ERROR, "unable to extract last level task from task.\n");
684− ret = DNN_ERROR;
704+ ret = extract_lltask_from_task(ov_model->model->func_type, &task, ov_model->lltask_queue, NULL);
705+ if (ret != DNN_SUCCESS) {
706+ av_log(ctx, AV_LOG_ERROR, "unable to extract inference from task.\n");
685707 goto err;
686708 }
687709
688710 request = ff_safe_queue_pop_front(ov_model->request_queue);
689711 if (!request) {
690712 av_log(ctx, AV_LOG_ERROR, "unable to get infer request.\n");
691− ret = DNN_ERROR;
713+ ret = AVERROR(EINVAL);
692714 goto err;
693715 }
694716
@@ -758,45 +780,49 @@ err: · 63 unmodified lines
758780 return NULL;
759781 }
760782
761−DNNReturnType ff_dnn_execute_model_ov(const DNNModel *model, DNNExecBaseParams *exec_params)
783+int ff_dnn_execute_model_ov(const DNNModel *model, DNNExecBaseParams *exec_params)
762784 {
763785 OVModel *ov_model = model->model;
764786 OVContext *ctx = &ov_model->ctx;
765787 OVRequestItem *request;
766788 TaskItem *task;
767− DNNReturnType ret;
789+ int ret;
768790
769− if (ff_check_exec_params(ctx, DNN_OV, model->func_type, exec_params) != 0) {
770− return DNN_ERROR;
791+ ret = ff_check_exec_params(ctx, DNN_OV, model->func_type, exec_params);
792+ if (ret != 0) {
793+ return ret;
771794 }
772795
773796 if (!ov_model->exe_network) {
774− if (init_model_ov(ov_model, exec_params->input_name, exec_params->output_names[0]) != DNN_SUCCESS) {
797+ ret = init_model_ov(ov_model, exec_params->input_name, exec_params->output_names[0]);
798+ if (ret != DNN_SUCCESS) {
775799 av_log(ctx, AV_LOG_ERROR, "Failed init OpenVINO exectuable network or inference request\n");
776− return DNN_ERROR;
800+ return ret;
777801 }
778802 }
779803
780804 task = av_malloc(sizeof(*task));
781805 if (!task) {
782806 av_log(ctx, AV_LOG_ERROR, "unable to alloc memory for task item.\n");
783− return DNN_ERROR;
807+ return AVERROR(ENOMEM);
784808 }
785809
786− if (ff_dnn_fill_task(task, exec_params, ov_model, ctx->options.async, 1) != DNN_SUCCESS) {
810+ ret = ff_dnn_fill_task(task, exec_params, ov_model, ctx->options.async, 1);
811+ if (ret != DNN_SUCCESS) {
787812 av_freep(&task);
788− return DNN_ERROR;
813+ return ret;
789814 }
790815
791816 if (ff_queue_push_back(ov_model->task_queue, task) < 0) {
792817 av_freep(&task);
793818 av_log(ctx, AV_LOG_ERROR, "unable to push back task_queue.\n");
794− return DNN_ERROR;
819+ return AVERROR(ENOMEM);
795820 }
796821
797− if (extract_lltask_from_task(model->func_type, task, ov_model->lltask_queue, exec_params) != DNN_SUCCESS) {
822+ ret = extract_lltask_from_task(model->func_type, task, ov_model->lltask_queue, exec_params);
823+ if (ret != DNN_SUCCESS) {
798824 av_log(ctx, AV_LOG_ERROR, "unable to extract inference from task.\n");
799− return DNN_ERROR;
825+ return ret;
800826 }
801827
802828 if (ctx->options.async) {
@@ -804,7 +830,7 @@ DNNReturnType ff_dnn_execute_model_ov(const DNNModel *model, DNNExecBaseParams * · 1 unmodified line
804830 request = ff_safe_queue_pop_front(ov_model->request_queue);
805831 if (!request) {
806832 av_log(ctx, AV_LOG_ERROR, "unable to get infer request.\n");
807− return DNN_ERROR;
833+ return AVERROR(EINVAL);
808834 }
809835
810836 ret = execute_model_ov(request, ov_model->lltask_queue);
@@ -820,18 +846,18 @@ DNNReturnType ff_dnn_execute_model_ov(const DNNModel *model, DNNExecBaseParams * · 9 unmodified lines
820846 // Classification filter has not been completely
821847 // tested with the sync mode. So, do not support now.
822848 avpriv_report_missing_feature(ctx, "classify for sync execution");
823− return DNN_ERROR;
849+ return AVERROR(ENOSYS);
824850 }
825851
826852 if (ctx->options.batch_size > 1) {
827853 avpriv_report_missing_feature(ctx, "batch mode for sync execution");
828− return DNN_ERROR;
854+ return AVERROR(ENOSYS);
829855 }
830856
831857 request = ff_safe_queue_pop_front(ov_model->request_queue);
832858 if (!request) {
833859 av_log(ctx, AV_LOG_ERROR, "unable to get infer request.\n");
834− return DNN_ERROR;
860+ return AVERROR(EINVAL);
835861 }
836862 return execute_model_ov(request, ov_model->lltask_queue);
837863 }
@@ -843,13 +869,13 @@ DNNAsyncStatusType ff_dnn_get_result_ov(const DNNModel *model, AVFrame **in, AVF · 5 unmodified lines
843869 return ff_dnn_get_result_common(ov_model->task_queue, in, out);
844870 }
845871
846−DNNReturnType ff_dnn_flush_ov(const DNNModel *model)
872+int ff_dnn_flush_ov(const DNNModel *model)
847873 {
848874 OVModel *ov_model = model->model;
849875 OVContext *ctx = &ov_model->ctx;
850876 OVRequestItem *request;
851877 IEStatusCode status;
852− DNNReturnType ret;
878+ int ret;
853879
854880 if (ff_queue_size(ov_model->lltask_queue) == 0) {
855881 // no pending task need to flush
@@ -859,7 +885,7 @@ DNNReturnType ff_dnn_flush_ov(const DNNModel *model) · 3 unmodified lines
859885 request = ff_safe_queue_pop_front(ov_model->request_queue);
860886 if (!request) {
861887 av_log(ctx, AV_LOG_ERROR, "unable to get infer request.\n");
862− return DNN_ERROR;
888+ return AVERROR(EINVAL);
863889 }
864890
865891 ret = fill_model_input_ov(ov_model, request);
@@ -870,12 +896,12 @@ DNNReturnType ff_dnn_flush_ov(const DNNModel *model) · 4 unmodified lines
870896 status = ie_infer_set_completion_callback(request->infer_request, &request->callback);
871897 if (status != OK) {
872898 av_log(ctx, AV_LOG_ERROR, "Failed to set completion callback for inference\n");
873− return DNN_ERROR;
899+ return DNN_GENERIC_ERROR;
874900 }
875901 status = ie_infer_request_infer_async(request->infer_request);
876902 if (status != OK) {
877903 av_log(ctx, AV_LOG_ERROR, "Failed to start async inference\n");
878− return DNN_ERROR;
904+ return DNN_GENERIC_ERROR;
879905 }
880906
881907 return DNN_SUCCESS;
libavfilter/dnn/dnn_backend_openvino.h+2−2
@@ -31,9 +31,9 @@ · 30 unmodified lines
3131
3232 DNNModel *ff_dnn_load_model_ov(const char *model_filename, DNNFunctionType func_type, const char *options, AVFilterContext *filter_ctx);
3333
34−DNNReturnType ff_dnn_execute_model_ov(const DNNModel *model, DNNExecBaseParams *exec_params);
34+int ff_dnn_execute_model_ov(const DNNModel *model, DNNExecBaseParams *exec_params);
3535 DNNAsyncStatusType ff_dnn_get_result_ov(const DNNModel *model, AVFrame **in, AVFrame **out);
36−DNNReturnType ff_dnn_flush_ov(const DNNModel *model);
36+int ff_dnn_flush_ov(const DNNModel *model);
3737
3838 void ff_dnn_free_model_ov(DNNModel **model);
3939
libavfilter/dnn_interface.h+5−5
@@ -94,9 +94,9 @@ typedef struct DNNModel{ · 93 unmodified lines
9494 DNNFunctionType func_type;
9595 // Gets model input information
9696 // Just reuse struct DNNData here, actually the DNNData.data field is not needed.
97− DNNReturnType (*get_input)(void *model, DNNData *input, const char *input_name);
97+ int (*get_input)(void *model, DNNData *input, const char *input_name);
9898 // Gets model output width/height with given input w/h
99− DNNReturnType (*get_output)(void *model, const char *input_name, int input_width, int input_height,
99+ int (*get_output)(void *model, const char *input_name, int input_width, int input_height,
100100 const char *output_name, int *output_width, int *output_height);
101101 // set the pre process to transfer data from AVFrame to DNNData
102102 // the default implementation within DNN is used if it is not provided by the filter
@@ -114,12 +114,12 @@ typedef struct DNNModel{ · 11 unmodified lines
114114 typedef struct DNNModule{
115115 // Loads model and parameters from given file. Returns NULL if it is not possible.
116116 DNNModel *(*load_model)(const char *model_filename, DNNFunctionType func_type, const char *options, AVFilterContext *filter_ctx);
117− // Executes model with specified input and output. Returns DNN_ERROR otherwise.
118− DNNReturnType (*execute_model)(const DNNModel *model, DNNExecBaseParams *exec_params);
117+ // Executes model with specified input and output. Returns the error code otherwise.
118+ int (*execute_model)(const DNNModel *model, DNNExecBaseParams *exec_params);
119119 // Retrieve inference result.
120120 DNNAsyncStatusType (*get_result)(const DNNModel *model, AVFrame **in, AVFrame **out);
121121 // Flush all the pending tasks.
122− DNNReturnType (*flush)(const DNNModel *model);
122+ int (*flush)(const DNNModel *model);
123123 // Frees memory allocated for model.
124124 void (*free_model)(DNNModel **model);
125125 } DNNModule;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t