[FFmpeg-devel] [PATCH v3] avfilter: Add tonemap vaapi filter for H2S

Fu, Linjie linjie.fu at intel.com
Tue Dec 3 05:23:13 EET 2019


> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of
> Xinpeng Sun
> Sent: Monday, December 2, 2019 15:17
> To: ffmpeg-devel at ffmpeg.org
> Cc: Sun, Xinpeng <xinpeng.sun at intel.com>; Zhou, Zachary
> <zachary.zhou at intel.com>
> Subject: [FFmpeg-devel] [PATCH v3] avfilter: Add tonemap vaapi filter for
> H2S
> 
> It performs HDR(High Dynamic Range) to SDR(Standard Dynamic Range)
> conversion
> with tone-mapping. It only supports HDR10 as input temporarily.
> 
> An example command to use this filter with vaapi codecs:
> FFMPEG -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -
> hwaccel_output_format vaapi \
> -i INPUT -vf 'tonemap_vaapi=format=p010' -c:v hevc_vaapi -profile 2
> OUTPUT
> 
> Signed-off-by: Xinpeng Sun <xinpeng.sun at intel.com>
> Signed-off-by: Zachary Zhou <zachary.zhou at intel.com>
> ---
>  configure                      |   2 +
>  doc/filters.texi               |  81 +++++++
>  libavfilter/Makefile           |   1 +
>  libavfilter/allfilters.c       |   1 +
>  libavfilter/vf_tonemap_vaapi.c | 420
> +++++++++++++++++++++++++++++++++
>  5 files changed, 505 insertions(+)
>  create mode 100644 libavfilter/vf_tonemap_vaapi.c
> 
> diff --git a/configure b/configure
> index ca7137f341..5272fb2a57 100755
> --- a/configure
> +++ b/configure
> @@ -3576,6 +3576,7 @@ tinterlace_filter_deps="gpl"
>  tinterlace_merge_test_deps="tinterlace_filter"
>  tinterlace_pad_test_deps="tinterlace_filter"
>  tonemap_filter_deps="const_nan"
> +tonemap_vaapi_filter_deps="vaapi
> VAProcPipelineParameterBuffer_output_hdr_metadata"
>  tonemap_opencl_filter_deps="opencl const_nan"
>  transpose_opencl_filter_deps="opencl"
>  transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags"
> @@ -6576,6 +6577,7 @@ if enabled vaapi; then
> 
>      check_type "va/va.h va/va_dec_hevc.h"
> "VAPictureParameterBufferHEVC"
>      check_struct "va/va.h" "VADecPictureParameterBufferVP9" bit_depth
> +    check_struct "va/va.h va/va_vpp.h" "VAProcPipelineParameterBuffer"
> output_hdr_metadata
>      check_struct "va/va.h va/va_vpp.h" "VAProcPipelineCaps" rotation_flags
>      check_type "va/va.h va/va_enc_hevc.h"
> "VAEncPictureParameterBufferHEVC"
>      check_type "va/va.h va/va_enc_jpeg.h"
> "VAEncPictureParameterBufferJPEG"
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 5fdec6f015..7223ab89a3 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -20972,6 +20972,87 @@ Apply a strong blur of both luma and chroma
> parameters:
> 
>  @c man end OPENCL VIDEO FILTERS
> 
> + at chapter VAAPI Video Filters
> + at c man begin VAAPI VIDEO FILTERS
> +
> +VAAPI Video filters are usually used with VAAPI decoder and VAAPI
> encoder. Below is a description of VAAPI video filters.
> +
> +To enable compilation of these filters you need to configure FFmpeg with
> + at code{--enable-vaapi}.
> +
> +Running VAAPI filters requires you to initialize a hardware device and to
> pass that device to all filters in any filter graph.
> + at table @option
> +
> + at item -hwaccel vaapi
> +Specify the hardware accelerator as @var{vaapi}.
> +
> + at item -vaapi_device @var{driver_path}
> +Specify the vaapi driver path with @var{driver_path}.
> +
> + at item -hwaccel_output_format @var{vaapi}
> +Specify the output format of hardware accelerator as @var{vaapi}. All
> VAAPI hardware surfaces in ffmpeg are represented by the @var{vaapi}
> pixfmt.
> +
> + at end table
> +
> + at itemize
> + at item
> +Example of running tonemap_vaapi filter with default parameters on it.
> + at example
> +-hwaccel vaapi -vaapi_device /dev/dri/renderD128 -
> hwaccel_output_format vaapi -i INPUT -vf "tonemap_vaapi, hwdownload"
> OUTPUT
> + at end example
> + at end itemize
> +
> +Since VAAPI filters are not able to access frame data in arbitrary memory, so
> if you use a decoder other than VAAPI decoder before VAAPI filters, all
> frame data needs to be uploaded(@ref{hwupload}) to hardware surfaces
> connected to the appropriate device before being used. Also if you add a
> encoder other than VAAPI encoder after VAAPI filters,

How about VAAPI decoder/filter + QSV encoder?



More information about the ffmpeg-devel mailing list