[FFmpeg-devel] [PATCH 1/2] avfilter/dnn/dnn_backend_trt: Update with master and sign-off

2021-07-25 Thread Xiaowei Wang
Signed-off-by: Xiaowei Wang 
---
 configure  |   6 +-
 libavfilter/dnn/Makefile   |   1 +
 libavfilter/dnn/dnn_backend_tensorrt.c |  77 +++
 libavfilter/dnn/dnn_backend_tensorrt.h |  72 +++
 libavfilter/dnn/dnn_interface.c|  10 +
 libavfilter/dnn/dnn_io_proc_trt.cu |  55 ++
 libavfilter/dnn/trt_class_wrapper.cpp  | 731 +
 libavfilter/dnn/trt_class_wrapper.h|  49 ++
 libavfilter/dnn_interface.h|   2 +-
 libavfilter/vf_dnn_processing.c|   3 +
 10 files changed, 1004 insertions(+), 2 deletions(-)
 create mode 100644 libavfilter/dnn/dnn_backend_tensorrt.c
 create mode 100644 libavfilter/dnn/dnn_backend_tensorrt.h
 create mode 100644 libavfilter/dnn/dnn_io_proc_trt.cu
 create mode 100644 libavfilter/dnn/trt_class_wrapper.cpp
 create mode 100644 libavfilter/dnn/trt_class_wrapper.h

diff --git a/configure b/configure
index b124411609..e496a66621 100755
--- a/configure
+++ b/configure
@@ -272,6 +272,8 @@ External library support:
   --enable-libsvtav1   enable AV1 encoding via SVT [no]
   --enable-libtensorflow   enable TensorFlow as a DNN module backend
for DNN based filters like sr [no]
+  --enable-libtensorrt enable TensorRT as a DNN module backend
+   for DNN based filters like sr [no]
   --enable-libtesseractenable Tesseract, needed for ocr filter [no]
   --enable-libtheora   enable Theora encoding via libtheora [no]
   --enable-libtls  enable LibreSSL (via libtls), needed for https 
support
@@ -1839,6 +1841,7 @@ EXTERNAL_LIBRARY_LIST="
 libssh
 libsvtav1
 libtensorflow
+libtensorrt
 libtesseract
 libtheora
 libtwolame
@@ -2660,7 +2663,7 @@ cbs_mpeg2_select="cbs"
 cbs_vp9_select="cbs"
 dct_select="rdft"
 dirac_parse_select="golomb"
-dnn_suggest="libtensorflow libopenvino"
+dnn_suggest="libtensorflow libopenvino libtensorrt"
 dnn_deps="avformat swscale"
 error_resilience_select="me_cmp"
 faandct_deps="faan"
@@ -6487,6 +6490,7 @@ enabled libspeex  && require_pkg_config libspeex 
speex speex/speex.h spe
 enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" 
srt/srt.h srt_socket
 enabled libsvtav1 && require_pkg_config libsvtav1 "SvtAv1Enc >= 0.8.4" 
EbSvtAv1Enc.h svt_av1_enc_init_handle
 enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h 
TF_Version -ltensorflow
+enabled libtensorrt   && require_cpp libtensorrt NvInfer.h nvinfer1::Dims2 
-lnvinfer -lcudart
 enabled libtesseract  && require_pkg_config libtesseract tesseract 
tesseract/capi.h TessBaseAPICreate
 enabled libtheora && require libtheora theora/theoraenc.h th_info_init 
-ltheoraenc -ltheoradec -logg
 enabled libtls&& require_pkg_config libtls libtls tls.h 
tls_configure
diff --git a/libavfilter/dnn/Makefile b/libavfilter/dnn/Makefile
index 4cfbce0efc..f9ea7ca386 100644
--- a/libavfilter/dnn/Makefile
+++ b/libavfilter/dnn/Makefile
@@ -16,5 +16,6 @@ OBJS-$(CONFIG_DNN)   += 
dnn/dnn_backend_native_layer_mat
 
 DNN-OBJS-$(CONFIG_LIBTENSORFLOW) += dnn/dnn_backend_tf.o
 DNN-OBJS-$(CONFIG_LIBOPENVINO)   += dnn/dnn_backend_openvino.o
+DNN-OBJS-$(CONFIG_LIBTENSORRT)   += dnn/dnn_backend_tensorrt.o 
dnn/trt_class_wrapper.o dnn/dnn_io_proc_trt.ptx.o
 
 OBJS-$(CONFIG_DNN)   += $(DNN-OBJS-yes)
diff --git a/libavfilter/dnn/dnn_backend_tensorrt.c 
b/libavfilter/dnn/dnn_backend_tensorrt.c
new file mode 100644
index 00..b45b770a77
--- /dev/null
+++ b/libavfilter/dnn/dnn_backend_tensorrt.c
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2021 NVIDIA CORPORATION. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+* DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * @file
+ * DNN TensorRT backend implementation.
+ */
+
+#include "trt_class_wrapper.h"
+#include "dnn_backend_tensorrt.h"
+
+#include "libavutil/mem.h"

[FFmpeg-devel] [PATCH 1/2] avfilter/dnn/dnn_backend_trt: Update with master and sign-off

2021-07-25 Thread Xiaowei Wang



0001-avfilter-dnn-dnn_backend_trt-Update-with-master-and-.patch
Description: 0001-avfilter-dnn-dnn_backend_trt-Update-with-master-and-.patch
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".