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

2019-12-10 Thread Song, Ruiling
> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Vittorio Giovara
> Sent: Tuesday, December 3, 2019 2:28 AM
> To: FFmpeg development discussions and patches 
> Cc: Sun, Xinpeng ; Zhou, Zachary
> 
> Subject: Re: [FFmpeg-devel] [PATCH v3] avfilter: Add tonemap vaapi filter for
> H2S
> 
> On Mon, Dec 2, 2019 at 2:19 AM Xinpeng Sun  wrote:
> 
> > 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 
> > Signed-off-by: Zachary Zhou 
> > ---
> >  configure  |   2 +
> >  doc/filters.texi   |  81 +++
> >  libavfilter/Makefile   |   1 +
> >  libavfilter/allfilters.c   |   1 +
> >  libavfilter/vf_tonemap_vaapi.c | 420
> +
> >  5 files changed, 505 insertions(+)
Is there any concern or objection? If no, I will make requested changes and 
apply this version.

Thanks!
Ruiling

[...]
___
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".

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

2019-12-02 Thread Sun, Xinpeng

> -Original Message-
> From: Song, Ruiling 
> Sent: Tuesday, December 3, 2019 1:37 PM
> To: FFmpeg development discussions and patches 
> Cc: Sun, Xinpeng ; Zhou, Zachary
> 
> Subject: RE: [FFmpeg-devel] [PATCH v3] avfilter: Add tonemap vaapi filter for
> H2S
> 
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of
> > Vittorio Giovara
> > Sent: Tuesday, December 3, 2019 2:28 AM
> > To: FFmpeg development discussions and patches  > de...@ffmpeg.org>
> > Cc: Sun, Xinpeng ; Zhou, Zachary
> > 
> > Subject: Re: [FFmpeg-devel] [PATCH v3] avfilter: Add tonemap vaapi
> > filter for H2S
> >
> > On Mon, Dec 2, 2019 at 2:19 AM Xinpeng Sun 
> > wrote:
> >
> > > 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 
> > > Signed-off-by: Zachary Zhou 
> > > ---
> > >  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
> > >
> [...]
> > > +static int tonemap_vaapi_save_metadata(AVFilterContext *avctx,
> > AVFrame
> > > *input_frame)
> > > +{
> > > +HDRVAAPIContext *ctx = avctx->priv;
> > > +AVMasteringDisplayMetadata *hdr_meta;
> > > +AVContentLightMetadata *light_meta;
> > > +
> > > +if (input_frame->color_trc != AVCOL_TRC_SMPTE2084) {
> > > +av_log(avctx, AV_LOG_WARNING, "Only support HDR10 as input
> > > + for
> > > vaapi tone-mapping\n");
> > > +input_frame->color_trc = AVCOL_TRC_SMPTE2084;
> I think we don't need to modify the input->color_trc here. I am not sure if 
> this
> has any side-effect, but may be misleading if you want to check that value 
> when
> debugging.
> Simply remove this single line would be ok.
> 
> [...]
> > > +err = av_frame_copy_props(output_frame, input_frame);
> > > +if (err < 0)
> > > +return err;
> > > +
> > > +if (ctx->color_primaries != AVCOL_PRI_UNSPECIFIED)
> > > +output_frame->color_primaries = ctx->color_primaries;
> > > +
> > > +if (ctx->color_transfer != AVCOL_TRC_UNSPECIFIED)
> > > +output_frame->color_trc = ctx->color_transfer;
> > > +else
> > > +output_frame->color_trc = AVCOL_TRC_BT709
> > >
> >
> > why does only this setting get special treatment?
> Basically for other properties we can copy from the source, but for color_trc,
> we cannot.
> And I guess bt709 is a widely used sdr format. So even if user does not give a
> target transfer characteristic, we use this default one.
> 
> [...]
> >
> > Overall this lgtm, I'd push it but I don't have a platform to test it on.
Thanks a lot. I confirmed with the iHD driver team and this feature is also 
supported
 on other Intel platforms (like kabylake, coffeelake, etc) other than icelake. 
However, this change has not been updated in the README.md on the github:
https://github.com/intel/media-driver

Xinpeng 

> Really appreciate that. I borrow an icelake from other team member and have a
> test on this patch, the tone-mapping result video basically looks good.
> 
> Ruiling
> > --
> > Vittorio
> > ___
> > 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".
___
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".

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

2019-12-02 Thread Song, Ruiling
> -Original Message-
> From: ffmpeg-devel  On Behalf Of Fu,
> Linjie
> Sent: Tuesday, December 3, 2019 11:23 AM
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Cc: Sun, Xinpeng ; Zhou, Zachary
> 
> Subject: Re: [FFmpeg-devel] [PATCH v3] avfilter: Add tonemap vaapi filter for
> H2S
> 
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of
> > Xinpeng Sun
> > Sent: Monday, December 2, 2019 15:17
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Sun, Xinpeng ; Zhou, Zachary
> > 
> > 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 
> > Signed-off-by: Zachary Zhou 
> > ---
> >  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
> >
> > +@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}.
> > +
> > +Running VAAPI filters requires you to initialize a hardware device and to
> > pass that device to all filters in any filter graph.
> > +@table @option
> > +
> > +@item -hwaccel vaapi
> > +Specify the hardware accelerator as @var{vaapi}.
> > +
> > +@item -vaapi_device @var{driver_path}
> > +Specify the vaapi driver path with @var{driver_path}.
> > +
> > +@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.
> > +
> > +@end table
> > +
> > +@itemize
> > +@item
> > +Example of running tonemap_vaapi filter with default parameters on it.
> > +@example
> > +-hwaccel vaapi -vaapi_device /dev/dri/renderD128 -
> > hwaccel_output_format vaapi -i INPUT -vf "tonemap_vaapi, hwdownload"
> > OUTPUT
> > +@end example
> > +@end itemize
> > +
> > +Since VAAPI filters are not able to access frame data in 

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

2019-12-02 Thread Song, Ruiling
> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Vittorio Giovara
> Sent: Tuesday, December 3, 2019 2:28 AM
> To: FFmpeg development discussions and patches  de...@ffmpeg.org>
> Cc: Sun, Xinpeng ; Zhou, Zachary
> 
> Subject: Re: [FFmpeg-devel] [PATCH v3] avfilter: Add tonemap vaapi filter for
> H2S
> 
> On Mon, Dec 2, 2019 at 2:19 AM Xinpeng Sun 
> wrote:
> 
> > 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 
> > Signed-off-by: Zachary Zhou 
> > ---
> >  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
> >
[...]
> > +static int tonemap_vaapi_save_metadata(AVFilterContext *avctx,
> AVFrame
> > *input_frame)
> > +{
> > +HDRVAAPIContext *ctx = avctx->priv;
> > +AVMasteringDisplayMetadata *hdr_meta;
> > +AVContentLightMetadata *light_meta;
> > +
> > +if (input_frame->color_trc != AVCOL_TRC_SMPTE2084) {
> > +av_log(avctx, AV_LOG_WARNING, "Only support HDR10 as input for
> > vaapi tone-mapping\n");
> > +input_frame->color_trc = AVCOL_TRC_SMPTE2084;
I think we don't need to modify the input->color_trc here. I am not sure if 
this has any side-effect, but may be misleading if you want to check that value 
when debugging.
Simply remove this single line would be ok.

[...]
> > +err = av_frame_copy_props(output_frame, input_frame);
> > +if (err < 0)
> > +return err;
> > +
> > +if (ctx->color_primaries != AVCOL_PRI_UNSPECIFIED)
> > +output_frame->color_primaries = ctx->color_primaries;
> > +
> > +if (ctx->color_transfer != AVCOL_TRC_UNSPECIFIED)
> > +output_frame->color_trc = ctx->color_transfer;
> > +else
> > +output_frame->color_trc = AVCOL_TRC_BT709
> >
> 
> why does only this setting get special treatment?
Basically for other properties we can copy from the source, but for color_trc, 
we cannot.
And I guess bt709 is a widely used sdr format. So even if user does not give a 
target transfer characteristic, we use this default one.

[...]
> 
> Overall this lgtm, I'd push it but I don't have a platform to test it on.
Really appreciate that. I borrow an icelake from other team member and have a 
test on this patch, the tone-mapping result video basically looks good.

Ruiling
> --
> Vittorio
> ___
> 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".
___
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".

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

2019-12-02 Thread Fu, Linjie
> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Xinpeng Sun
> Sent: Monday, December 2, 2019 15:17
> To: ffmpeg-devel@ffmpeg.org
> Cc: Sun, Xinpeng ; Zhou, Zachary
> 
> 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 
> Signed-off-by: Zachary Zhou 
> ---
>  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
> 
> +@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}.
> +
> +Running VAAPI filters requires you to initialize a hardware device and to
> pass that device to all filters in any filter graph.
> +@table @option
> +
> +@item -hwaccel vaapi
> +Specify the hardware accelerator as @var{vaapi}.
> +
> +@item -vaapi_device @var{driver_path}
> +Specify the vaapi driver path with @var{driver_path}.
> +
> +@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.
> +
> +@end table
> +
> +@itemize
> +@item
> +Example of running tonemap_vaapi filter with default parameters on it.
> +@example
> +-hwaccel vaapi -vaapi_device /dev/dri/renderD128 -
> hwaccel_output_format vaapi -i INPUT -vf "tonemap_vaapi, hwdownload"
> OUTPUT
> +@end example
> +@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?

___
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".

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

2019-12-02 Thread Vittorio Giovara
On Mon, Dec 2, 2019 at 2:19 AM Xinpeng Sun  wrote:

> 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 
> Signed-off-by: Zachary Zhou 
> ---
>  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
>
> +@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}.
> +
> +Running VAAPI filters requires you to initialize a hardware device and to
> pass that device to all filters in any filter graph.
> +@table @option
> +
> +@item -hwaccel vaapi
> +Specify the hardware accelerator as @var{vaapi}.
> +
> +@item -vaapi_device @var{driver_path}
> +Specify the vaapi driver path with @var{driver_path}.
> +
> +@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.
> +
> +@end table
> +
> +@itemize
> +@item
> +Example of running tonemap_vaapi filter with default parameters on it.
> +@example
> +-hwaccel vaapi -vaapi_device /dev/dri/renderD128 -hwaccel_output_format
> vaapi -i INPUT -vf "tonemap_vaapi, hwdownload" OUTPUT
> +@end example
> +@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, the hardware
> surfaces should be downloaded(@ref{hwdownload}) back to normal memory. Note
> that @ref{hwupload} will upload to a surface with the same layout as the
> software frame, so it may be necessary to add a @ref{format} filter
> immediately before to get the input into the right format and
> @ref{hwdownload} does not support all formats on the output - it may be
> necessary to insert an additional @ref{format} filter immediately following
> in the graph to get the output in a supported format.
> +
> +@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 only accepts HDR10 as input temporarily.
> +
> +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
> 

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

2019-12-01 Thread Xinpeng Sun
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 
Signed-off-by: Zachary Zhou 
---
 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
 
+@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}.
+
+Running VAAPI filters requires you to initialize a hardware device and to pass 
that device to all filters in any filter graph.
+@table @option
+
+@item -hwaccel vaapi
+Specify the hardware accelerator as @var{vaapi}.
+
+@item -vaapi_device @var{driver_path}
+Specify the vaapi driver path with @var{driver_path}.
+
+@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.
+
+@end table
+
+@itemize
+@item
+Example of running tonemap_vaapi filter with default parameters on it.
+@example
+-hwaccel vaapi -vaapi_device /dev/dri/renderD128 -hwaccel_output_format vaapi 
-i INPUT -vf "tonemap_vaapi, hwdownload" OUTPUT
+@end example
+@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, the hardware surfaces should be 
downloaded(@ref{hwdownload}) back to normal memory. Note that @ref{hwupload} 
will upload to a surface with the same layout as the software frame, so it may 
be necessary to add a @ref{format} filter immediately before to get the input 
into the right format and @ref{hwdownload} does not support all formats on the 
output - it may be necessary to insert an additional @ref{format} filter 
immediately following in the graph to get the output in a supported format.
+
+@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 only accepts HDR10 as input temporarily.
+
+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
+-i INPUT -vf "hwupload,tonemap_vaapi=format=p010:t=bt2020-10,hwdownload" OUTPUT
+@end example
+@end itemize
+
+@c man end VAAPI VIDEO FILTERS
+
 @chapter Video Sources
 @c man begin VIDEO SOURCES
 
diff 

Re: [FFmpeg-devel] [PATCH V3] avfilter: Add tonemap vaapi filter

2019-01-03 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Mark Thompson
> Sent: Monday, December 31, 2018 3:39 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH V3] avfilter: Add tonemap vaapi filter
> 
> On 29/12/2018 07:02, Zachary Zhou wrote:
> > It supports ICL platform.
> 
> When will this hardware be available?

currently, I am not sure about it, but I will keep watching it.

> 
> Is this a new fixed-function feature, or will it be available on current 
> hardware
> as well?

As I know, different platform may use different HW feature, some platform uses 
EUs, some use VEBOX.
The driver team may make this filter works on other platform in future, like 
KBL, CFL etc.

> 
> > H2H (HDR to HDR): P010 -> RGB10
> > H2S (HDR to SDR): P010 -> RGB8
> >
> > libva commit for HDR10
> >
> https://github.com/intel/libva/commit/cf11abe5e1b9c93ee75cf97407695716
> > 2c1605b9
> >
> > Signed-off-by: Zachary Zhou 
> > ---
> >  configure  |   2 +
> >  doc/filters.texi   |  63 
> >  libavfilter/Makefile   |   1 +
> >  libavfilter/allfilters.c   |   1 +
> >  libavfilter/vaapi_vpp.c|  29 ++
> >  libavfilter/vaapi_vpp.h|   8 +
> >  libavfilter/vf_tonemap_vaapi.c | 542
> +
> >  libavutil/hwcontext_vaapi.c|   3 +
> >  8 files changed, 649 insertions(+)
> >  create mode 100644 libavfilter/vf_tonemap_vaapi.c
> >
> > diff --git a/configure b/configure
> > index be49c19b88..baf70d03fc 100755
> > --- a/configure
> > +++ b/configure
> > @@ -3480,6 +3480,7 @@ tinterlace_merge_test_deps="tinterlace_filter"
> >  tinterlace_pad_test_deps="tinterlace_filter"
> >  tonemap_filter_deps="const_nan"
> >  tonemap_opencl_filter_deps="opencl const_nan"
> > +tonemap_vaapi_filter_deps="vaapi
> VAProcFilterParameterBufferHDRToneMapping"
> >  transpose_opencl_filter_deps="opencl"
> >  unsharp_opencl_filter_deps="opencl"
> >  uspp_filter_deps="gpl avcodec"
> > @@ -5984,6 +5985,7 @@ check_type "d3d9.h dxva2api.h"
> > DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
> >
> >  check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC"
> >  check_struct "va/va.h" "VADecPictureParameterBufferVP9" bit_depth
> > +check_type "va/va.h va/va_vpp.h"
> "VAProcFilterParameterBufferHDRToneMapping"
> >  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_vp8.h"  "VAEncPictureParameterBufferVP8"
> > diff --git a/doc/filters.texi b/doc/filters.texi index
> > ac4c9b44d8..9ed53a1008 100644
> > --- a/doc/filters.texi
> > +++ b/doc/filters.texi
> > @@ -19130,6 +19130,69 @@ Convert HDR(PQ/HLG) video to
> > bt2020-transfer-characteristic p010 format using li  @end example
> > @end itemize
> >
> > +@section tonemap_vappi
> > +
> > +Perform HDR(High Dynamic Range) to HDR and HDR to SDR conversion
> with tone-mapping.
> > +
> > +It accepts the following parameters:
> > +
> > +@table @option
> > +@item type
> > +Specify the tone-mapping operator to be used.
> > +
> > +Possible values are:
> > +@table @var
> > +@item h2h
> > +Perform H2H(HDR to HDR), convert from p010 to rgb10 @item h2s Perform
> > +H2S(HDR to SDR), convert from p010 to rgb8 @end table
> 
> What are RGB10 and RGB8?

RGB10 is R10G10B10A2
RGB8 is ARGB

I will add more to the document.

> 
> > +
> > +@item display
> > +Set mastering display metadata for H2H
> > +
> > +Can assume the following values:
> > +@table @var
> > +@item G
> > +Green primary G(x|y)
> > +@item B
> > +Blue primary B(x|y)
> > +@item R
> > +Red primary R(x|y)
> > +@item WP
> > +White point WP(x|y)
> > +@item L
> > +Display mastering luminance L(max|min) @end table
> > +
> > +@item light
> > +Set content light level for H2H
> > +
> > +Can assume the following values:
> > +@table @var
> > +@item CLL
> > +Max content light level
> > +@item FALL
> > +Max average light level per frame
> > +@end table
> 
> What units are all of these values in?

I will add units to document.

> 
> > +
> > +

Re: [FFmpeg-devel] [PATCH V3] avfilter: Add tonemap vaapi filter

2018-12-30 Thread Mark Thompson
On 29/12/2018 07:02, Zachary Zhou wrote:
> It supports ICL platform.

When will this hardware be available?

Is this a new fixed-function feature, or will it be available on current 
hardware as well?

> H2H (HDR to HDR): P010 -> RGB10
> H2S (HDR to SDR): P010 -> RGB8
> 
> libva commit for HDR10
> https://github.com/intel/libva/commit/cf11abe5e1b9c93ee75cf974076957162c1605b9
> 
> Signed-off-by: Zachary Zhou 
> ---
>  configure  |   2 +
>  doc/filters.texi   |  63 
>  libavfilter/Makefile   |   1 +
>  libavfilter/allfilters.c   |   1 +
>  libavfilter/vaapi_vpp.c|  29 ++
>  libavfilter/vaapi_vpp.h|   8 +
>  libavfilter/vf_tonemap_vaapi.c | 542 +
>  libavutil/hwcontext_vaapi.c|   3 +
>  8 files changed, 649 insertions(+)
>  create mode 100644 libavfilter/vf_tonemap_vaapi.c
> 
> diff --git a/configure b/configure
> index be49c19b88..baf70d03fc 100755
> --- a/configure
> +++ b/configure
> @@ -3480,6 +3480,7 @@ tinterlace_merge_test_deps="tinterlace_filter"
>  tinterlace_pad_test_deps="tinterlace_filter"
>  tonemap_filter_deps="const_nan"
>  tonemap_opencl_filter_deps="opencl const_nan"
> +tonemap_vaapi_filter_deps="vaapi VAProcFilterParameterBufferHDRToneMapping"
>  transpose_opencl_filter_deps="opencl"
>  unsharp_opencl_filter_deps="opencl"
>  uspp_filter_deps="gpl avcodec"
> @@ -5984,6 +5985,7 @@ check_type "d3d9.h dxva2api.h" 
> DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
>  
>  check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC"
>  check_struct "va/va.h" "VADecPictureParameterBufferVP9" bit_depth
> +check_type "va/va.h va/va_vpp.h" "VAProcFilterParameterBufferHDRToneMapping"
>  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_vp8.h"  "VAEncPictureParameterBufferVP8"
> diff --git a/doc/filters.texi b/doc/filters.texi
> index ac4c9b44d8..9ed53a1008 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -19130,6 +19130,69 @@ Convert HDR(PQ/HLG) video to 
> bt2020-transfer-characteristic p010 format using li
>  @end example
>  @end itemize
>  
> +@section tonemap_vappi
> +
> +Perform HDR(High Dynamic Range) to HDR and HDR to SDR conversion with 
> tone-mapping.
> +
> +It accepts the following parameters:
> +
> +@table @option
> +@item type
> +Specify the tone-mapping operator to be used.
> +
> +Possible values are:
> +@table @var
> +@item h2h
> +Perform H2H(HDR to HDR), convert from p010 to rgb10
> +@item h2s
> +Perform H2S(HDR to SDR), convert from p010 to rgb8
> +@end table

What are RGB10 and RGB8?

> +
> +@item display
> +Set mastering display metadata for H2H
> +
> +Can assume the following values:
> +@table @var
> +@item G
> +Green primary G(x|y)
> +@item B
> +Blue primary B(x|y)
> +@item R
> +Red primary R(x|y)
> +@item WP
> +White point WP(x|y)
> +@item L
> +Display mastering luminance L(max|min)
> +@end table
> +
> +@item light
> +Set content light level for H2H
> +
> +Can assume the following values:
> +@table @var
> +@item CLL
> +Max content light level
> +@item FALL
> +Max average light level per frame
> +@end table

What units are all of these values in?

> +
> +@end table
> +
> +@subsection Example
> +
> +@itemize
> +@item
> +Convert HDR video to HDR video from p010 format to rgb10 format.
> +@example
> +-i INPUT -vf 
> "tonemap_vaapi=h2h:display=G(13250|34500)B(7500|3000)R(34000|16000)WP(15635|16450)L(2000|2000):light=CLL(1)FALL(1000)"
>  OUTPUT 
> +@end example
> +@item
> +Convert HDR video to SDR video from p010 format to rgb8 format.
> +@example
> +-i INPUT -vf "tonemap_vaapi=h2s" OUTPUT
> +@end example
> +@end itemize
> +
>  @section unsharp_opencl
>  
>  Sharpen or blur the input video.
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 6e2658186d..f6894209d1 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -390,6 +390,7 @@ OBJS-$(CONFIG_TMIX_FILTER)   += vf_mix.o 
> framesync.o
>  OBJS-$(CONFIG_TONEMAP_FILTER)+= vf_tonemap.o colorspace.o
>  OBJS-$(CONFIG_TONEMAP_OPENCL_FILTER) += vf_tonemap_opencl.o 
> colorspace.o opencl.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_TRANSPOSE_FILTER)  += vf_transpose.o
>  OBJS-$(CONFIG_TRANSPOSE_NPP_FILTER)  += vf_transpose_npp.o 
> cuda_check.o
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index a600069500..754b84819d 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -369,6 +369,7 @@ extern AVFilter ff_vf_tlut2;
>  extern AVFilter ff_vf_tmix;
>  extern AVFilter ff_vf_tonemap;
>  extern AVFilter ff_vf_tonemap_opencl;
> +extern AVFilter 

[FFmpeg-devel] [PATCH V3] avfilter: Add tonemap vaapi filter

2018-12-28 Thread Zachary Zhou
It supports ICL platform.
H2H (HDR to HDR): P010 -> RGB10
H2S (HDR to SDR): P010 -> RGB8

libva commit for HDR10
https://github.com/intel/libva/commit/cf11abe5e1b9c93ee75cf974076957162c1605b9

Signed-off-by: Zachary Zhou 
---
 configure  |   2 +
 doc/filters.texi   |  63 
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/vaapi_vpp.c|  29 ++
 libavfilter/vaapi_vpp.h|   8 +
 libavfilter/vf_tonemap_vaapi.c | 542 +
 libavutil/hwcontext_vaapi.c|   3 +
 8 files changed, 649 insertions(+)
 create mode 100644 libavfilter/vf_tonemap_vaapi.c

diff --git a/configure b/configure
index be49c19b88..baf70d03fc 100755
--- a/configure
+++ b/configure
@@ -3480,6 +3480,7 @@ tinterlace_merge_test_deps="tinterlace_filter"
 tinterlace_pad_test_deps="tinterlace_filter"
 tonemap_filter_deps="const_nan"
 tonemap_opencl_filter_deps="opencl const_nan"
+tonemap_vaapi_filter_deps="vaapi VAProcFilterParameterBufferHDRToneMapping"
 transpose_opencl_filter_deps="opencl"
 unsharp_opencl_filter_deps="opencl"
 uspp_filter_deps="gpl avcodec"
@@ -5984,6 +5985,7 @@ check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode 
-D_WIN32_WINNT=0x0602
 
 check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC"
 check_struct "va/va.h" "VADecPictureParameterBufferVP9" bit_depth
+check_type "va/va.h va/va_vpp.h" "VAProcFilterParameterBufferHDRToneMapping"
 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_vp8.h"  "VAEncPictureParameterBufferVP8"
diff --git a/doc/filters.texi b/doc/filters.texi
index ac4c9b44d8..9ed53a1008 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -19130,6 +19130,69 @@ Convert HDR(PQ/HLG) video to 
bt2020-transfer-characteristic p010 format using li
 @end example
 @end itemize
 
+@section tonemap_vappi
+
+Perform HDR(High Dynamic Range) to HDR and HDR to SDR conversion with 
tone-mapping.
+
+It accepts the following parameters:
+
+@table @option
+@item type
+Specify the tone-mapping operator to be used.
+
+Possible values are:
+@table @var
+@item h2h
+Perform H2H(HDR to HDR), convert from p010 to rgb10
+@item h2s
+Perform H2S(HDR to SDR), convert from p010 to rgb8
+@end table
+
+@item display
+Set mastering display metadata for H2H
+
+Can assume the following values:
+@table @var
+@item G
+Green primary G(x|y)
+@item B
+Blue primary B(x|y)
+@item R
+Red primary R(x|y)
+@item WP
+White point WP(x|y)
+@item L
+Display mastering luminance L(max|min)
+@end table
+
+@item light
+Set content light level for H2H
+
+Can assume the following values:
+@table @var
+@item CLL
+Max content light level
+@item FALL
+Max average light level per frame
+@end table
+
+@end table
+
+@subsection Example
+
+@itemize
+@item
+Convert HDR video to HDR video from p010 format to rgb10 format.
+@example
+-i INPUT -vf 
"tonemap_vaapi=h2h:display=G(13250|34500)B(7500|3000)R(34000|16000)WP(15635|16450)L(2000|2000):light=CLL(1)FALL(1000)"
 OUTPUT 
+@end example
+@item
+Convert HDR video to SDR video from p010 format to rgb8 format.
+@example
+-i INPUT -vf "tonemap_vaapi=h2s" OUTPUT
+@end example
+@end itemize
+
 @section unsharp_opencl
 
 Sharpen or blur the input video.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 6e2658186d..f6894209d1 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -390,6 +390,7 @@ OBJS-$(CONFIG_TMIX_FILTER)   += vf_mix.o 
framesync.o
 OBJS-$(CONFIG_TONEMAP_FILTER)+= vf_tonemap.o colorspace.o
 OBJS-$(CONFIG_TONEMAP_OPENCL_FILTER) += vf_tonemap_opencl.o 
colorspace.o opencl.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_TRANSPOSE_FILTER)  += vf_transpose.o
 OBJS-$(CONFIG_TRANSPOSE_NPP_FILTER)  += vf_transpose_npp.o cuda_check.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index a600069500..754b84819d 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -369,6 +369,7 @@ extern AVFilter ff_vf_tlut2;
 extern AVFilter ff_vf_tmix;
 extern AVFilter ff_vf_tonemap;
 extern AVFilter ff_vf_tonemap_opencl;
+extern AVFilter ff_vf_tonemap_vaapi;
 extern AVFilter ff_vf_tpad;
 extern AVFilter ff_vf_transpose;
 extern AVFilter ff_vf_transpose_npp;
diff --git a/libavfilter/vaapi_vpp.c b/libavfilter/vaapi_vpp.c
index c5bbc3b85b..7389ebd9d5 100644
--- a/libavfilter/vaapi_vpp.c
+++ b/libavfilter/vaapi_vpp.c
@@ -276,6 +276,35 @@ int ff_vaapi_vpp_make_param_buffers(AVFilterContext *avctx,
 return 0;
 }
 
+int ff_vaapi_vpp_make_param_buffers2(AVFilterContext *avctx,
+ int type,
+ const