[FFmpeg-devel] [PATCH] avfilter/vf_xcam: add xcam video filter

2020-07-30 Thread zongwave
From: Yinhang Liu 

xcam filter is a wrapper of libxcam project which supports 360 video stitching,
automotive surround view stitching, digital video stabilization (DVS),
Wide dynamic range (WDR), wavelet noise reduction, 3D noise reduction, etc.

libxcam library optimized algorithms by AVX, GLES and Vulkan depends on
hardware configuration to get good performance.

libxcam project is hosted at https://github.com/intel/libxcam
please refer to https://github.com/intel/libxcam/wiki/Build to build libxcam 
library.

To enable xcam video filter, configure FFmpeg with option
--enable-libxcam.

Here are the features provided by xcam video filter:
- stitch CPU|GLES|Vulkan stitching
- stitchcl   OpenCL stitching
- fisheyeFisheye calibration
- 3dnr   3D denoising
- waveletnr  Wavelet denoising
- dvsDigital video stabilization
- defog  Fog removal

Use 'ffmpeg -h filter=xcam' to get the common parameters, stitch and
stitchcl have private parameters, use 'params=help=1' to get the private
parameters. For more detailed test cases posted at:
https://github.com/intel/libxcam/wiki/Tests#1-ffmpeg-xcam.

Reviewed-by: Zong Wei 
+---
+ Changelog|   1 +
+ configure|   5 +
+ doc/filters.texi |  79 ++
+ libavfilter/Makefile |   1 +
+ libavfilter/allfilters.c |   1 +
+ libavfilter/vf_xcam.c| 326 +++
+ 6 files changed, 413 insertions(+)
+ create mode 100644 libavfilter/vf_xcam.c
+
+diff --git a/Changelog b/Changelog
+index 6f648bff2b..1d5872e216 100644
+--- a/Changelog
 b/Changelog
+@@ -10,6 +10,7 @@ version :
+ - ADPCM IMA Ubisoft APM encoder
+ - Rayman 2 APM muxer
+ - AV1 encoding support SVT-AV1
++- xcam filter
+
+
+ version 4.3:
+diff --git a/configure b/configure
+index 169f23e17f..7664a077b3 100755
+--- a/configure
 b/configure
+@@ -290,6 +290,7 @@ External library support:
+   --enable-libx265 enable HEVC encoding via x265 [no]
+   --enable-libxavs enable AVS encoding via xavs [no]
+   --enable-libxavs2enable AVS2 encoding via xavs2 [no]
++  --enable-libxcam enable image processing via xcam [no]
+   --enable-libxcb  enable X11 grabbing using XCB [autodetect]
+   --enable-libxcb-shm  enable X11 grabbing shm communication [autodetect]
+   --enable-libxcb-xfixes   enable X11 grabbing mouse rendering [autodetect]
+@@ -1817,6 +1818,7 @@ EXTERNAL_LIBRARY_LIST="
+ libvpx
+ libwavpack
+ libwebp
++libxcam
+ libxml2
+ libzimg
+ libzmq
+@@ -3639,6 +3641,7 @@ scale_vaapi_filter_deps="vaapi"
+ scale_vulkan_filter_deps="vulkan libglslang"
+ vpp_qsv_filter_deps="libmfx"
+ vpp_qsv_filter_select="qsvvpp"
++xcam_filter_deps="libxcam"
+ xfade_opencl_filter_deps="opencl"
+ yadif_cuda_filter_deps="ffnvcodec"
+ yadif_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
+@@ -6451,6 +6454,8 @@ enabled libx265   && require_pkg_config libx265 
x265 x265.h x265_api_get
+  require_cpp_condition libx265 x265.h "X265_BUILD 
>= 70"
+ enabled libxavs   && require libxavs "stdint.h xavs.h" 
xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
+ enabled libxavs2  && require_pkg_config libxavs2 "xavs2 >= 1.3.0" 
"stdint.h xavs2.h" xavs2_api_get
++enabled libxcam   && { check_pkg_config libxcam "libxcam >= 1.4.0" 
"capi/xcam_handle.h" xcam_create_handle ||
++   die "ERROR: libXCam must be installed and 
version must be >= 1.4.0"; }
+ enabled libxvid   && require libxvid xvid.h xvid_global -lxvidcore
+ enabled libzimg   && require_pkg_config libzimg "zimg >= 2.7.0" 
zimg.h zimg_get_api_version
+ enabled libzmq&& require_pkg_config libzmq "libzmq >= 4.2.1" 
zmq.h zmq_ctx_new
+diff --git a/doc/filters.texi b/doc/filters.texi
+index 561aa98a9d..ab6f231025 100644
+--- a/doc/filters.texi
 b/doc/filters.texi
+@@ -20399,6 +20399,85 @@ Set the scaling dimension: @code{2} for @code{2xBR}, 
@code{3} for
+ Default is @code{3}.
+ @end table
+
++@section xcam
++Image processing supported through libXCam.
++
++libXCam supports automotive surround view stitching, 360 video stitching,
++digital video stabilization, noise reduction and so on. For more information
++about libxcam see @url{https://github.com/intel/libxcam}.
++
++Please refer to @url{https://github.com/intel/libxcam/wiki/Build} to build
++libxcam.
++
++To enable compilation of @var{xcam} video filter you need to configure FFmpeg
++with @code{--enable-libxcam}.
++
++@subsection Options
++
++@table @option
++
++@item inputs
++The number of inputs. Default is @code{1}. @b{stitch} and @b{stitchcl}
++handlers support dynamic inputs, @b{fisheye}, @b{3dnr}, @b{waveletnr},
++@b{dvs} and @b{defog} handlers support one input.
++
++@item w
++Output video width. Default is @code{0}.
++If the value is 0, the corresponding input width is used for the output.
++
++@item h
++Output video height. Default is @code{0}.

[FFmpeg-devel] [PATCH] avfilter/vf_xcam: add xcam video filter

2020-07-31 Thread zongwave
From: Yinhang Liu 

xcam filter is a wrapper of libxcam project which supports 360 video stitching,
automotive surround view stitching, digital video stabilization (DVS),
wavelet noise reduction, 3D noise reduction, etc.

libxcam library optimized algorithms by AVX, GLES and Vulkan depends on
hardware configuration to get good performance.

Here are demos of xcam filter
 * video stitching:
  https://github.com/intel/libxcam/wiki#libxcam-stitch-processing-flow
  https://www.youtube.com/watch?v=J2Cr09KfIQ0
  https://www.youtube.com/watch?v=z5MvzhRKcE8

 * digital video stabilization:
  https://www.youtube.com/watch?v=f5JFhZPa4Xc

libxcam project is hosted at: https://github.com/intel/libxcam

Build instruction is at: https://github.com/intel/libxcam/wiki/Build

To enable xcam video filter, configure FFmpeg with option
--enable-libxcam

Here are features provided by xcam video filter:
- stitch CPU|GLES|Vulkan stitching
- stitchcl   OpenCL stitching
- fisheyeFisheye calibration
- 3dnr   3D denoising
- waveletnr  Wavelet denoising
- dvsDigital video stabilization
- defog  Fog removal

Use 'ffmpeg -h filter=xcam' to get the common parameters,
use 'params=help=1' to get the private parameters.
Detailed test cases at:
https://github.com/intel/libxcam/wiki/Tests#1-ffmpeg-xcam

Signed-off-by: Yinhang Liu 
Signed-off-by: Zong Wei 
Reviewed-by: Zong Wei 
---
 Changelog|   1 +
 configure|   5 +
 doc/filters.texi |  79 ++
 libavfilter/Makefile |   1 +
 libavfilter/allfilters.c |   1 +
 libavfilter/vf_xcam.c| 326 +++
 6 files changed, 413 insertions(+)
 create mode 100644 libavfilter/vf_xcam.c

diff --git a/Changelog b/Changelog
index 6f648bff2b..1d5872e216 100644
--- a/Changelog
+++ b/Changelog
@@ -10,6 +10,7 @@ version :
 - ADPCM IMA Ubisoft APM encoder
 - Rayman 2 APM muxer
 - AV1 encoding support SVT-AV1
+- xcam filter
 
 
 version 4.3:
diff --git a/configure b/configure
index 169f23e17f..7664a077b3 100755
--- a/configure
+++ b/configure
@@ -290,6 +290,7 @@ External library support:
   --enable-libx265 enable HEVC encoding via x265 [no]
   --enable-libxavs enable AVS encoding via xavs [no]
   --enable-libxavs2enable AVS2 encoding via xavs2 [no]
+  --enable-libxcam enable image processing via xcam [no]
   --enable-libxcb  enable X11 grabbing using XCB [autodetect]
   --enable-libxcb-shm  enable X11 grabbing shm communication [autodetect]
   --enable-libxcb-xfixes   enable X11 grabbing mouse rendering [autodetect]
@@ -1817,6 +1818,7 @@ EXTERNAL_LIBRARY_LIST="
 libvpx
 libwavpack
 libwebp
+libxcam
 libxml2
 libzimg
 libzmq
@@ -3639,6 +3641,7 @@ scale_vaapi_filter_deps="vaapi"
 scale_vulkan_filter_deps="vulkan libglslang"
 vpp_qsv_filter_deps="libmfx"
 vpp_qsv_filter_select="qsvvpp"
+xcam_filter_deps="libxcam"
 xfade_opencl_filter_deps="opencl"
 yadif_cuda_filter_deps="ffnvcodec"
 yadif_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
@@ -6451,6 +6454,8 @@ enabled libx265   && require_pkg_config libx265 
x265 x265.h x265_api_get
  require_cpp_condition libx265 x265.h "X265_BUILD 
>= 70"
 enabled libxavs   && require libxavs "stdint.h xavs.h" 
xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
 enabled libxavs2  && require_pkg_config libxavs2 "xavs2 >= 1.3.0" 
"stdint.h xavs2.h" xavs2_api_get
+enabled libxcam   && { check_pkg_config libxcam "libxcam >= 1.4.0" 
"capi/xcam_handle.h" xcam_create_handle ||
+   die "ERROR: libXCam must be installed and 
version must be >= 1.4.0"; }
 enabled libxvid   && require libxvid xvid.h xvid_global -lxvidcore
 enabled libzimg   && require_pkg_config libzimg "zimg >= 2.7.0" zimg.h 
zimg_get_api_version
 enabled libzmq&& require_pkg_config libzmq "libzmq >= 4.2.1" zmq.h 
zmq_ctx_new
diff --git a/doc/filters.texi b/doc/filters.texi
index 561aa98a9d..ab6f231025 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -20399,6 +20399,85 @@ Set the scaling dimension: @code{2} for @code{2xBR}, 
@code{3} for
 Default is @code{3}.
 @end table
 
+@section xcam
+Image processing supported through libXCam.
+
+libXCam supports automotive surround view stitching, 360 video stitching,
+digital video stabilization, noise reduction and so on. For more information
+about libxcam see @url{https://github.com/intel/libxcam}.
+
+Please refer to @url{https://github.com/intel/libxcam/wiki/Build} to build
+libxcam.
+
+To enable compilation of @var{xcam} video filter you need to configure FFmpeg
+with @code{--enable-libxcam}.
+
+@subsection Options
+
+@table @option
+
+@item inputs
+The number of inputs. Default is @code{1}. @b{stitch} and @b{stitchcl}
+handlers support dynamic inputs, @b{fisheye}, @b{3dnr}, @b{waveletnr},
+@b{dvs} and @b{defog} handlers support one input.
+
+@item w
+Output video width. Def