FFmpeg
dnn_interface.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Sergey Lavrushkin
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /**
22  * @file
23  * Implements DNN module initialization with specified backend.
24  */
25 
26 #include "../dnn_interface.h"
27 #include "libavutil/mem.h"
28 
30 extern const DNNModule ff_dnn_backend_tf;
31 extern const DNNModule ff_dnn_backend_torch;
32 
33 const DNNModule *ff_get_dnn_module(DNNBackendType backend_type, void *log_ctx)
34 {
35  switch(backend_type){
36  #if (CONFIG_LIBTENSORFLOW == 1)
37  case DNN_TF:
38  return &ff_dnn_backend_tf;
39  #endif
40  #if (CONFIG_LIBOPENVINO == 1)
41  case DNN_OV:
43  #endif
44  #if (CONFIG_LIBTORCH == 1)
45  case DNN_TH:
46  return &ff_dnn_backend_torch;
47  #endif
48  default:
49  av_log(log_ctx, AV_LOG_ERROR,
50  "Module backend_type %d is not supported or enabled.\n",
51  backend_type);
52  return NULL;
53  }
54 }
ff_dnn_backend_openvino
const DNNModule ff_dnn_backend_openvino
DNN_TF
@ DNN_TF
Definition: dnn_interface.h:35
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
DNN_OV
@ DNN_OV
Definition: dnn_interface.h:35
NULL
#define NULL
Definition: coverity.c:32
DNNBackendType
DNNBackendType
Definition: dnn_interface.h:35
ff_get_dnn_module
const DNNModule * ff_get_dnn_module(DNNBackendType backend_type, void *log_ctx)
Definition: dnn_interface.c:33
ff_dnn_backend_tf
const DNNModule ff_dnn_backend_tf
Definition: dnn_backend_tf.c:916
ff_dnn_backend_torch
const DNNModule ff_dnn_backend_torch
DNN_TH
@ DNN_TH
Definition: dnn_interface.h:35
mem.h
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
DNNModule
Definition: dnn_interface.h:121