Commit 2e2dfe66 authored by Xinpeng Sun's avatar Xinpeng Sun Committed by Ruiling Song

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: 's avatarXinpeng Sun <xinpeng.sun@intel.com>
Signed-off-by: 's avatarZachary Zhou <zachary.zhou@intel.com>
Signed-off-by: 's avatarRuiling Song <ruiling.song@intel.com>
parent 9f6a06d9
...@@ -3578,6 +3578,7 @@ tinterlace_filter_deps="gpl" ...@@ -3578,6 +3578,7 @@ tinterlace_filter_deps="gpl"
tinterlace_merge_test_deps="tinterlace_filter" tinterlace_merge_test_deps="tinterlace_filter"
tinterlace_pad_test_deps="tinterlace_filter" tinterlace_pad_test_deps="tinterlace_filter"
tonemap_filter_deps="const_nan" tonemap_filter_deps="const_nan"
tonemap_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer_output_hdr_metadata"
tonemap_opencl_filter_deps="opencl const_nan" tonemap_opencl_filter_deps="opencl const_nan"
transpose_opencl_filter_deps="opencl" transpose_opencl_filter_deps="opencl"
transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags" transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags"
...@@ -6581,6 +6582,7 @@ if enabled vaapi; then ...@@ -6581,6 +6582,7 @@ if enabled vaapi; then
check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC" check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC"
check_struct "va/va.h" "VADecPictureParameterBufferVP9" bit_depth 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_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_hevc.h" "VAEncPictureParameterBufferHEVC"
check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG" check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG"
......
...@@ -21039,6 +21039,65 @@ Apply a strong blur of both luma and chroma parameters: ...@@ -21039,6 +21039,65 @@ Apply a strong blur of both luma and chroma parameters:
@c man end OPENCL VIDEO FILTERS @c man end OPENCL VIDEO FILTERS
@chapter VAAPI Video Filters
@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
@code{--enable-vaapi}.
To use vaapi filters, you need to setup the vaapi device correctly. For more information, please read @url{https://trac.ffmpeg.org/wiki/Hardware/VAAPI}
@section tonemap_vappi
Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
It maps the dynamic range of HDR10 content to the SDR content.
It currently only accepts HDR10 as input.
It accepts the following parameters:
@table @option
@item format
Specify the output pixel format.
Currently supported formats are:
@table @var
@item p010
@item nv12
@end table
Default is nv12.
@item primaries, p
Set the output color primaries.
Default is same as input.
@item transfer, t
Set the output transfer characteristics.
Default is bt709.
@item matrix, m
Set the output colorspace matrix.
Default is same as input.
@end table
@subsection Example
@itemize
@item
Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
@example
tonemap_vaapi=format=p010:t=bt2020-10
@end example
@end itemize
@c man end VAAPI VIDEO FILTERS
@chapter Video Sources @chapter Video Sources
@c man begin VIDEO SOURCES @c man begin VIDEO SOURCES
......
...@@ -411,6 +411,7 @@ OBJS-$(CONFIG_TMIX_FILTER) += vf_mix.o framesync.o ...@@ -411,6 +411,7 @@ OBJS-$(CONFIG_TMIX_FILTER) += vf_mix.o framesync.o
OBJS-$(CONFIG_TONEMAP_FILTER) += vf_tonemap.o colorspace.o OBJS-$(CONFIG_TONEMAP_FILTER) += vf_tonemap.o colorspace.o
OBJS-$(CONFIG_TONEMAP_OPENCL_FILTER) += vf_tonemap_opencl.o colorspace.o opencl.o \ OBJS-$(CONFIG_TONEMAP_OPENCL_FILTER) += vf_tonemap_opencl.o colorspace.o opencl.o \
opencl/tonemap.o opencl/colorspace_common.o opencl/tonemap.o opencl/colorspace_common.o
OBJS-$(CONFIG_TONEMAP_VAAPI_FILTER) += vf_tonemap_vaapi.o vaapi_vpp.o
OBJS-$(CONFIG_TPAD_FILTER) += vf_tpad.o OBJS-$(CONFIG_TPAD_FILTER) += vf_tpad.o
OBJS-$(CONFIG_TRANSPOSE_FILTER) += vf_transpose.o OBJS-$(CONFIG_TRANSPOSE_FILTER) += vf_transpose.o
OBJS-$(CONFIG_TRANSPOSE_NPP_FILTER) += vf_transpose_npp.o OBJS-$(CONFIG_TRANSPOSE_NPP_FILTER) += vf_transpose_npp.o
......
...@@ -391,6 +391,7 @@ extern AVFilter ff_vf_tlut2; ...@@ -391,6 +391,7 @@ extern AVFilter ff_vf_tlut2;
extern AVFilter ff_vf_tmix; extern AVFilter ff_vf_tmix;
extern AVFilter ff_vf_tonemap; extern AVFilter ff_vf_tonemap;
extern AVFilter ff_vf_tonemap_opencl; extern AVFilter ff_vf_tonemap_opencl;
extern AVFilter ff_vf_tonemap_vaapi;
extern AVFilter ff_vf_tpad; extern AVFilter ff_vf_tpad;
extern AVFilter ff_vf_transpose; extern AVFilter ff_vf_transpose;
extern AVFilter ff_vf_transpose_npp; extern AVFilter ff_vf_transpose_npp;
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "libavutil/version.h" #include "libavutil/version.h"
#define LIBAVFILTER_VERSION_MAJOR 7 #define LIBAVFILTER_VERSION_MAJOR 7
#define LIBAVFILTER_VERSION_MINOR 68 #define LIBAVFILTER_VERSION_MINOR 69
#define LIBAVFILTER_VERSION_MICRO 101 #define LIBAVFILTER_VERSION_MICRO 101
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment