Re: [FFmpeg-devel] [PATCH v3] avfilter: add overlay vaapi filter

2020-02-25 Thread Sun, Xinpeng
Rebase and resend this patch. Fix some typo and indentation errors, and change 
some ambiguous statements in the document to make it more clear.

-Xinpeng 

> -Original Message-
> From: Sun, Xinpeng 
> Sent: Wednesday, February 26, 2020 1:54 PM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Sun, Xinpeng ; Zhou, Zachary
> 
> Subject: [PATCH v3] avfilter: add overlay vaapi filter
> 
> Overlay one video on the top of another.
> 
> It takes two inputs and has one output. The first input is the "main" video on
> which the second input is overlaid. This filter requires same memory layout
> for all the inputs.
> 
> An example command to use this filter to overlay an image LOGO at the top-
> left corner of the INPUT video and both inputs are yuv420p format:
> FFMPEG -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -
> hwaccel_output_format vaapi \ -i INPUT -i LOGO -filter_complex \
> "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_vaapi,
> hwdownload" \ OUTPUT
> 
> Signed-off-by: Xinpeng Sun 
> Signed-off-by: Zachary Zhou 
> ---
>  configure  |   3 +
>  doc/filters.texi   |  51 
>  libavfilter/Makefile   |   1 +
>  libavfilter/allfilters.c   |   1 +
>  libavfilter/vf_overlay_vaapi.c | 426 +
>  5 files changed, 482 insertions(+)
>  create mode 100644 libavfilter/vf_overlay_vaapi.c
> 
[...]
> --
> 2.17.1

___
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] avfilter/tonemap_vaapi: pass filter parameters to VA parameter buffer

2020-02-10 Thread Sun, Xinpeng

> -Original Message-
> From: Sun, Xinpeng 
> Sent: Friday, January 17, 2020 11:57 AM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Sun, Xinpeng 
> Subject: [PATCH] avfilter/tonemap_vaapi: pass filter parameters to VA
> parameter buffer
> 
> Signed-off-by: Xinpeng Sun 
> ---
>  libavfilter/vf_tonemap_vaapi.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavfilter/vf_tonemap_vaapi.c b/libavfilter/vf_tonemap_vaapi.c
> index 2f41b90424..540d656dca 100644
> --- a/libavfilter/vf_tonemap_vaapi.c
> +++ b/libavfilter/vf_tonemap_vaapi.c
> @@ -296,6 +296,9 @@ static int tonemap_vaapi_filter_frame(AVFilterLink
> *inlink, AVFrame *input_frame
>  if (err < 0)
>  goto fail;
> 
> +params.filters = _ctx->filter_buffers[0];
> +params.num_filters = vpp_ctx->nb_filter_buffers;
> +
>  err = ff_vaapi_vpp_render_picture(avctx, , output_frame);
>  if (err < 0)
>  goto fail;
> --
> 2.17.1

Kindly Ping.

Thx.

___
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 v2 1/2] configure: Change the configure check for tonemap_vaapi

2020-01-16 Thread Sun, Xinpeng
Hi Mark,

> -Original Message-
> From: ffmpeg-devel  On Behalf Of Sun,
> Xinpeng
> Sent: Wednesday, January 8, 2020 8:02 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v2 1/2] configure: Change the configure
> check for tonemap_vaapi
> 
> 
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of Mark
> > Thompson
> > Sent: Tuesday, January 7, 2020 8:07 AM
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: Re: [FFmpeg-devel] [PATCH v2 1/2] configure: Change the
> > configure check for tonemap_vaapi
> >
> > On 30/12/2019 07:32, Xinpeng Sun wrote:
> > > "VAProcFilterParameterBufferHDRToneMapping" was defined in libva
> > > 2.4.1, which will lead to build failure for the filter tonemap_vaapi
> > > for libva 2.3.0 with current check. This patch is to fix this build error.
> > >
> > > Signed-off-by: Xinpeng Sun 
> > > ---
> > >  configure | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/configure b/configure
> > > index 43dc409fe6..01b4acd77e 100755
> > > --- a/configure
> > > +++ b/configure
> > > @@ -3579,7 +3579,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_vaapi_filter_deps="vaapi
> > VAProcFilterParameterBufferHDRToneMapping"
> > >  tonemap_opencl_filter_deps="opencl const_nan"
> > >  transpose_opencl_filter_deps="opencl"
> > >  transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags"
> > > @@ -6584,7 +6584,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_type   "va/va.h va/va_vpp.h"
> > "VAProcFilterParameterBufferHDRToneMapping"
> > >  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"
> > >
> >
> > Thanks, applied.
> >
> > Relatedly: can you explain how to get this filter to work?
> >
> > So far the only non-identity transformation I have managed to achieve
> > is to make the output entirely black (which happens if the set the
> > output colour matrix to anything other than the same as the input).
> >
> > E.g. given an input which is:
> >
> > Stream #0:0[0x101]: Video: hevc (Main 10) ([36][0][0][0] /
> > 0x0024), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x2160 [SAR
> > 1:1 DAR 16:9],
> > 25 fps, 25 tbr, 90k tbn, 25 tbc
> > [Parsed_showinfo_0 @ 0x5609cc1a6d00]   side data - mastering display:
> > has_primaries:1 has_luminance:1 r(0.6800,0.3200) g(0.2650,0.6900)
> > b(0.1500
> > 0.0600) wp(0.3127, 0.3290) min_luminance=0.05,
> > max_luminance=1200.00
> >
> > then doing:
> >
> > -vf tonemap_vaapi=format=nv12
> >
> > gives identical output to:
> >
> > -vf scale_vaapi=format=nv12
> >
> > while:
> >
> > -vf tonemap_vaapi=format=nv12:t=bt709:p=bt709:m=bt709
> >
> > gives output which is entirely black.
> >
> > (Hardware is Icelake 1065G7.)
> >
> > - Mark
> 
> Hi Mark,
> 
> For your first test(tonemap_vaapi has the same output with scale_vaapi), I am
> working with others to investigate the root-cause in iHD driver.
> 

iHD driver didn't add VAProcColorStandardExplicit into the query list before, 
so ff_vaapi_vpp_init_params cannot 
query it from driver and set the color standard to VAProcColorStandardExplicit. 
Only when the color standard is 
VAProcColorStandardExplicit, the transfer characteristic can be set to SMPTE 
2084 in the driver. If the transfer of 
input is not SMPTE 2084, driver will process the input in the same way as 
scale_vaapi. I sent a patch to iHD driver 
to fix this query issue and 

Re: [FFmpeg-devel] [PATCH v2 1/2] configure: Change the configure check for tonemap_vaapi

2020-01-08 Thread Sun, Xinpeng

> -Original Message-
> From: ffmpeg-devel  On Behalf Of Mark
> Thompson
> Sent: Tuesday, January 7, 2020 8:07 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v2 1/2] configure: Change the configure
> check for tonemap_vaapi
> 
> On 30/12/2019 07:32, Xinpeng Sun wrote:
> > "VAProcFilterParameterBufferHDRToneMapping" was defined in libva
> > 2.4.1, which will lead to build failure for the filter tonemap_vaapi
> > for libva 2.3.0 with current check. This patch is to fix this build error.
> >
> > Signed-off-by: Xinpeng Sun 
> > ---
> >  configure | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/configure b/configure
> > index 43dc409fe6..01b4acd77e 100755
> > --- a/configure
> > +++ b/configure
> > @@ -3579,7 +3579,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_vaapi_filter_deps="vaapi
> VAProcFilterParameterBufferHDRToneMapping"
> >  tonemap_opencl_filter_deps="opencl const_nan"
> >  transpose_opencl_filter_deps="opencl"
> >  transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags"
> > @@ -6584,7 +6584,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_type   "va/va.h va/va_vpp.h"
> "VAProcFilterParameterBufferHDRToneMapping"
> >  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"
> >
> 
> Thanks, applied.
> 
> Relatedly: can you explain how to get this filter to work?
> 
> So far the only non-identity transformation I have managed to achieve is to
> make the output entirely black (which happens if the set the output colour
> matrix to anything other than the same as the input).
> 
> E.g. given an input which is:
> 
> Stream #0:0[0x101]: Video: hevc (Main 10) ([36][0][0][0] / 0x0024),
> yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x2160 [SAR 1:1 DAR 16:9],
> 25 fps, 25 tbr, 90k tbn, 25 tbc
> [Parsed_showinfo_0 @ 0x5609cc1a6d00]   side data - mastering display:
> has_primaries:1 has_luminance:1 r(0.6800,0.3200) g(0.2650,0.6900) b(0.1500
> 0.0600) wp(0.3127, 0.3290) min_luminance=0.05,
> max_luminance=1200.00
> 
> then doing:
> 
> -vf tonemap_vaapi=format=nv12
> 
> gives identical output to:
> 
> -vf scale_vaapi=format=nv12
> 
> while:
> 
> -vf tonemap_vaapi=format=nv12:t=bt709:p=bt709:m=bt709
> 
> gives output which is entirely black.
> 
> (Hardware is Icelake 1065G7.)
> 
> - Mark

Hi Mark,

For your first test(tonemap_vaapi has the same output with scale_vaapi), I am 
working with others to investigate the root-cause in iHD driver.

And for your second test(the output is black), scale_vaapi also has similar 
issue when performing bt2020 to bt709/bt601 on the color matrix for 4K 
resolution. 
It’s a driver issue and I think they may share the same root-cause.
The issue link is:  https://github.com/intel/media-driver/issues/760
Same issue from gstreamer-vaapi side: 
https://github.com/intel/media-driver/issues/763

I'm so sorry for forgetting to test the bt709-color-matrix for output when 
developing the patch.

Regards,
Xinpeng
> ___
> 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 v2] avfilter: add overlay vaapi filter

2020-01-06 Thread Sun, Xinpeng

> -Original Message-
> From: ffmpeg-devel  On Behalf Of Moritz
> Barsnick
> Sent: Monday, January 6, 2020 5:18 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v2] avfilter: add overlay vaapi filter
> 
> On Mon, Jan 06, 2020 at 15:48:21 +0800, Xinpeng Sun wrote:
> > +@item x
> > +Set the x coordinate of the overlaid video on the main video.
> > +Default value is @code{0}.
> > +
> > +@item y
> > +Set the x coordinate of the overlaid video on the main video.
> > +Default value is @code{0}.
> 
> Copy/paste error: "y coordinate", not "x coordinate".

Will fix in the next version.

> 
> > +Overlay an image LOGO at the top-left corner of the INPUT video. Both
> inputs are yuv420p format.
> > +@example
> > +-i INPUT -i LOGO -filter_complex "[0:v]hwupload[a],
> > +[1:v]format=yuv420p, hwupload[b], [a][b]overlay_vaapi" OUTPUT
> 
> "Both inputs are yuv420p format" is a bit misleading. I guess you mean the
> inputs to the filter, it could also be read as the two input files to ffmpeg? 
> You are
> converting LOGO to yuv420p, so it doesn't need to be yuv420p originally.
> 

The "inputs" here refers to the inputs for the filter. How about changing the 
description to 
" Both inputs for this filter are yuv420p format "?

> > +if (!support_flag) {
> > +  av_log(avctx, AV_LOG_ERROR, "VAAPI driver doesn't support global 
> > alpha
> blending\n");
> > +return AVERROR(EINVAL);
> 
> Still incorrect indentation.

Sorry about this. I will double check and prevent this from happening again.

> 
> > +output_surface = (VASurfaceID)(uintptr_t)output_frame->data[3];
> 
> Is this a double typecast? Just wondering.

Yes. IMHO, it mainly for safety to be compatible with each platform.

> 
> Cheers,
> Moritz
> ___
> 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 v2 1/2] configure: Change the configure check for tonemap_vaapi

2020-01-06 Thread Sun, Xinpeng

> -Original Message-
> From: Sun, Xinpeng 
> Sent: Monday, December 30, 2019 3:33 PM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Sun, Xinpeng 
> Subject: [PATCH v2 1/2] configure: Change the configure check for
> tonemap_vaapi
> 
> "VAProcFilterParameterBufferHDRToneMapping" was defined in libva 2.4.1,
> which will lead to build failure for the filter tonemap_vaapi for libva 2.3.0 
> with
> current check. This patch is to fix this build error.
> 
> Signed-off-by: Xinpeng Sun 
> ---
>  configure | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/configure b/configure
> index 43dc409fe6..01b4acd77e 100755
> --- a/configure
> +++ b/configure
> @@ -3579,7 +3579,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_vaapi_filter_deps="vaapi
> VAProcFilterParameterBufferHDRToneMapping"
>  tonemap_opencl_filter_deps="opencl const_nan"
>  transpose_opencl_filter_deps="opencl"
>  transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags"
> @@ -6584,7 +6584,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_type   "va/va.h va/va_vpp.h"
> "VAProcFilterParameterBufferHDRToneMapping"
>  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"
> --
> 2.17.1

Ping.

Thanks,
Xinpeng


___
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 v1] avfilter: add overlay vaapi filter

2020-01-01 Thread Sun, Xinpeng

> -Original Message-
> From: ffmpeg-devel  On Behalf Of Moritz
> Barsnick
> Sent: Thursday, January 2, 2020 6:30 AM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v1] avfilter: add overlay vaapi filter
> 
> On Fri, Dec 20, 2019 at 10:55:39 +0800, Xinpeng Sun wrote:
> > +Set blocking detection thresholds. Allowed range is 0.0 to 1.0, it
> > +need input video has alpha channel.
> 
> Incorrect grammar. I suggest ", it requires an input video with alpha 
> channel".
> 
> > +ret = ff_formats_ref(ff_make_format_list(main_in_fmts), 
> >inputs[MAIN]->out_formats);
> > +if (ret < 0)
> > +  return ret;
> > +
> > +ret = ff_formats_ref(ff_make_format_list(main_in_fmts), 
> >inputs[OVERLAY]->out_formats);
> > +if (ret < 0)
> > +  return ret;
> 
> Incorrect indentation (twice).
> 
> > +if (!support_flag) {
> > +  av_log(avctx, AV_LOG_ERROR, "VAAPI driver doesn't support global 
> > alpha
> blending\n");
> > +return AVERROR(EINVAL);
> 
> Incorrect indentation.
> 
> Moritz

Thanks for review. I will fix them in the next version.

Xinpeng
___
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 v1] avfilter: add overlay vaapi filter

2020-01-01 Thread Sun, Xinpeng

> -Original Message-
> From: Paul B Mahol 
> Sent: Tuesday, December 31, 2019 5:06 PM
> To: FFmpeg development discussions and patches 
> Cc: Sun, Xinpeng ; Zhou, Zachary
> 
> Subject: Re: [FFmpeg-devel] [PATCH v1] avfilter: add overlay vaapi filter
> 
> On 12/20/19, Xinpeng Sun  wrote:
> > Overlay one video on the top of another.
> >
> > It takes two inputs and has one output. The first input is the "main"
> > video on which the second input is overlaid. This filter requires same
> > memory layout for all the inputs.
> >
> > An example command to use this filter to overlay an image LOGO at the
> > top-left corner of the INPUT video and both inputs are yuv420p format:
> > FFMPEG -hwaccel vaapi -vaapi_device /dev/dri/renderD128
> > -hwaccel_output_format vaapi \ -i INPUT -i LOGO -filter_complex \
> > "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b],
> > [a][b]overlay_vaapi, hwdownload" \ OUTPUT
> >
> > Signed-off-by: Xinpeng Sun 
> > Signed-off-by: Zachary Zhou 
> > ---
> >  configure  |   3 +
> >  doc/filters.texi   |  51 
> >  libavfilter/Makefile   |   1 +
> >  libavfilter/allfilters.c   |   1 +
> >  libavfilter/vf_overlay_vaapi.c | 432
> > +
> >  5 files changed, 488 insertions(+)
> >  create mode 100644 libavfilter/vf_overlay_vaapi.c
> >
> > diff --git a/configure b/configure
> > index eec43c3b06..9969c9e984 100755
> > --- a/configure
> > +++ b/configure
> > @@ -3527,6 +3527,7 @@ openclsrc_filter_deps="opencl"
> >  overlay_opencl_filter_deps="opencl"
> >  overlay_qsv_filter_deps="libmfx"
> >  overlay_qsv_filter_select="qsvvpp"
> > +overlay_vaapi_filter_deps="vaapi"
> >  owdenoise_filter_deps="gpl"
> >  pan_filter_deps="swresample"
> >  perspective_filter_deps="gpl"
> > @@ -3584,6 +3585,7 @@ tonemap_vaapi_filter_deps="vaapi
> > VAProcPipelineParameterBuffer_output_hdr_metada
> >  tonemap_opencl_filter_deps="opencl const_nan"
> >  transpose_opencl_filter_deps="opencl"
> >  transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags"
> > +overlay_vaapi_filter_deps="vaapi VAProcPipelineCaps_blend_flags"
> >  unsharp_opencl_filter_deps="opencl"
> >  uspp_filter_deps="gpl avcodec"
> >  vaguedenoiser_filter_deps="gpl"
> > @@ -6587,6 +6589,7 @@ if enabled vaapi; then
> >  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"
> > + blend_flags
> >  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
> > 527c6a08b2..d391218529 100644
> > --- a/doc/filters.texi
> > +++ b/doc/filters.texi
> > @@ -21049,6 +21049,57 @@ To enable compilation of these filters you
> > need to configure FFmpeg with
> >
> >  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 overlay_vaapi
> > +
> > +Overlay one video on the top of another.
> > +
> > +It takes two inputs and has one output. The first input is the "main"
> > +video
> > on which the second input is overlaid.
> > +This filter requires same memory layout for all the inputs. So,
> > +format
> > conversion may be needed.
> > +
> > +The filter accepts the following options:
> > +
> > +@table @option
> > +
> > +@item x
> > +Set the x coordinate of the overlaid video on the main video.
> > +Default value is @code{0}.
> > +
> > +@item y
> > +Set the y coordinate of the overlaid video on the main video.
> > +Default value is @code{0}.
> > +
> > +@item w
> > +Set the width of the overlaid video on the main video.
> > +Default value is the width of

Re: [FFmpeg-devel] [PATCH v1] avfilter: add overlay vaapi filter

2019-12-30 Thread Sun, Xinpeng

> -Original Message-
> From: ffmpeg-devel  On Behalf Of Sun,
> Xinpeng
> Sent: Tuesday, December 24, 2019 6:18 PM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Zhou, Zachary 
> Subject: Re: [FFmpeg-devel] [PATCH v1] avfilter: add overlay vaapi filter
> 
> 
> > -Original Message-
> > From: Sun, Xinpeng 
> > Sent: Friday, December 20, 2019 10:56 AM
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Sun, Xinpeng ; Zhou, Zachary
> > 
> > Subject: [PATCH v1] avfilter: add overlay vaapi filter
> >
> > Overlay one video on the top of another.
> >
> > It takes two inputs and has one output. The first input is the "main"
> > video on which the second input is overlaid. This filter requires same
> > memory layout for all the inputs.
> >
> > An example command to use this filter to overlay an image LOGO at the
> > top-left corner of the INPUT video and both inputs are yuv420p format:
> > FFMPEG -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -
> > hwaccel_output_format vaapi \ -i INPUT -i LOGO -filter_complex \
> > "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b],
> > [a][b]overlay_vaapi, hwdownload" \ OUTPUT
> >
> > Signed-off-by: Xinpeng Sun 
> > Signed-off-by: Zachary Zhou 
> > ---
> >  configure  |   3 +
> >  doc/filters.texi   |  51 
> >  libavfilter/Makefile   |   1 +
> >  libavfilter/allfilters.c   |   1 +
> >  libavfilter/vf_overlay_vaapi.c | 432
> > +
> >  5 files changed, 488 insertions(+)
> >  create mode 100644 libavfilter/vf_overlay_vaapi.c
> >
> Ping for review.
> 
> Thanks,
> Xinpeng
> 
> [...]

Ping.

Thanks,
Xinpeng
___
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] configure: Change the configure check for tonemap_vaapi

2019-12-29 Thread Sun, Xinpeng

> -Original Message-
> From: ffmpeg-devel  On Behalf Of Mark
> Thompson
> Sent: Saturday, December 28, 2019 7:57 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH] configure: Change the configure check for
> tonemap_vaapi
> 
> On 24/12/2019 06:32, Xinpeng Sun wrote:
> > "VAProcFilterParameterBufferHDRToneMapping" was defined in libva
> > 2.4.1, which will lead to build failure for the filter tonemap_vaapi
> > for libva 2.3.0 with current check. This patch is to fix this build error.
> >
> > Signed-off-by: Xinpeng Sun 
> > ---
> >  configure | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/configure b/configure
> > index eec43c3b06..157dc30132 100755
> > --- a/configure
> > +++ b/configure
> > @@ -3580,7 +3580,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_vaapi_filter_deps="vaapi
> VAProcFilterParameterBufferHDRToneMapping_type"
> 
> This is out of order, you could fix that at the same time.

Fixed together in the v2 version.

> 
> >  tonemap_opencl_filter_deps="opencl const_nan"
> >  transpose_opencl_filter_deps="opencl"
> >  transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags"
> > @@ -6585,7 +6585,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"
> > + "VAProcFilterParameterBufferHDRToneMapping" type
> 
> You only want the structure itself rather than any particular member of it, 
> right?
> I think that means you want check_type rather than check_struct.

Exactly so. Changed in the v2 version.

Thanks,
Xinpeng

> 
> >  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"
> >
> 
> - Mark
> ___
> 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 v1] avfilter: add overlay vaapi filter

2019-12-24 Thread Sun, Xinpeng

> -Original Message-
> From: Sun, Xinpeng 
> Sent: Friday, December 20, 2019 10:56 AM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Sun, Xinpeng ; Zhou, Zachary
> 
> Subject: [PATCH v1] avfilter: add overlay vaapi filter
> 
> Overlay one video on the top of another.
> 
> It takes two inputs and has one output. The first input is the "main" video on
> which the second input is overlaid. This filter requires same memory layout 
> for
> all the inputs.
> 
> An example command to use this filter to overlay an image LOGO at the top-left
> corner of the INPUT video and both inputs are yuv420p format:
> FFMPEG -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -
> hwaccel_output_format vaapi \ -i INPUT -i LOGO -filter_complex \
> "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_vaapi,
> hwdownload" \ OUTPUT
> 
> Signed-off-by: Xinpeng Sun 
> Signed-off-by: Zachary Zhou 
> ---
>  configure  |   3 +
>  doc/filters.texi   |  51 
>  libavfilter/Makefile   |   1 +
>  libavfilter/allfilters.c   |   1 +
>  libavfilter/vf_overlay_vaapi.c | 432 +
>  5 files changed, 488 insertions(+)
>  create mode 100644 libavfilter/vf_overlay_vaapi.c
> 
Ping for review.

Thanks,
Xinpeng

[...]
___
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 V4] avfilter: Add tonemap vaapi filter for H2S

2019-12-23 Thread Sun, Xinpeng

> -Original Message-
> From: ffmpeg-devel  On Behalf Of Marton
> Balint
> Sent: Monday, December 23, 2019 5:15 AM
> To: FFmpeg development discussions and patches 
> Cc: Sun, Xinpeng 
> Subject: Re: [FFmpeg-devel] [PATCH V4] avfilter: Add tonemap vaapi filter for
> H2S
> 
> 
> 
> On Thu, 12 Dec 2019, Ruiling Song wrote:
> 
> > From: 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 
> > Signed-off-by: Ruiling Song 
> > ---
> > When I re-think about the document part. I find it is not necessary to
> > repeat how to set up vaapi device in this filter part. There is
> > already good explanation of it(https://trac.ffmpeg.org/wiki/Hardware/VAAPI),
> so I add a link to it.
> > I only make code changes requested by Vittoria and me. So if no
> > further comment, I am going to apply the patch next week. Thanks!
> >
> > Ruiling
> >
> > configure  |   2 +
> > doc/filters.texi   |  59 +
> > libavfilter/Makefile   |   1 +
> > libavfilter/allfilters.c   |   1 +
> > libavfilter/vf_tonemap_vaapi.c | 419 +
> > 5 files changed, 482 insertions(+)
> > create mode 100644 libavfilter/vf_tonemap_vaapi.c
> >
> > diff --git a/configure b/configure
> > index 42e7df3941..74f2d38317 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"
> > @@ -6577,6 +6578,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
> 
> This check does not seem to be enough, I am getting errors like this for libva
> 2.3.0:

Yes. I have reproduced this problem and sent a patch to fix it.

Thanks,
Xinpeng

> 
> libavfilter/vf_tonemap_vaapi.c: In function
> ‘tonemap_vaapi_set_filter_params’:
> libavfilter/vf_tonemap_vaapi.c:156:5: error: unknown type name
> ‘VAProcFilterParameterBufferHDRToneMapping’; did you mean
> ‘VAProcFilterParameterBufferDeinterlacing’?
>   VAProcFilterParameterBufferHDRToneMapping *hdrtm_param;
>   ^
>   VAProcFilterParameterBufferDeinterlacing
> 
> 
> Regards,
> Marton
> ___
> 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 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 v2] avfilter: Add tonemap vaapi filter for H2S

2019-12-01 Thread Sun, Xinpeng

> -Original Message-
> From: ffmpeg-devel  On Behalf Of Sun,
> Xinpeng
> Sent: Friday, November 29, 2019 3:50 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v2] avfilter: Add tonemap vaapi filter for
> H2S
> 
> 
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of
> > Song, Ruiling
> > Sent: Thursday, November 28, 2019 5:39 PM
> > To: FFmpeg development discussions and patches
> > 
> > Subject: Re: [FFmpeg-devel] [PATCH v2] avfilter: Add tonemap vaapi
> > filter for H2S
> >
> > > -Original Message-
> > > From: ffmpeg-devel  On Behalf Of
> > > Carl Eugen Hoyos
> > > Sent: Thursday, November 28, 2019 5:16 PM
> > > To: FFmpeg development discussions and patches  > > de...@ffmpeg.org>
> > > Subject: Re: [FFmpeg-devel] [PATCH v2] avfilter: Add tonemap vaapi
> > > filter for H2S
> > >
> > > Am Do., 28. Nov. 2019 um 07:56 Uhr schrieb Song, Ruiling
> > > :
> > >
> > > > > > Am 28.11.2019 um 06:37 schrieb Sun, Xinpeng
> > > :
> > > > > >
> > > > > >>>
> > > > > >>> +if (input_frame->color_trc != AVCOL_TRC_SMPTE2084) {
> > > > > >>> +av_log(avctx, AV_LOG_ERROR, "Only support HDR10 as
> > > > > >>> + input
> > > for
> > > > > vaapi tone-mapping\n");
> > > > > >>> +return AVERROR(EINVAL);
> > > > > >>
> > > > > >> Shouldn't this also accept unknown trc?
> > > > > >> (With a warning)
> > > > > >
> > > > > > Sorry if I misunderstand "unknown trc". Did you mean the trc
> > > undefined by
> > > > > ffmpeg or the trc unsupported by the driver?
> > > > >
> > > > > My question is:
> > > > > If input_frame->color_trc is AVCOL_TRC_UNSPECIFIED, will the above
> fail?
> > > > > But shouldn’t the user be able to use the filter in this case?
> > > >
> > > > I am not sure if assuming the input is using SMPTE2084 sounds more
> > > acceptable
> > > > in case of unspecified? If yes, I think we can change as you suggested.
> > >
> > > (Me neither.)
> > > A warning could be shown instead of failing.
> 
> Prompt the user that the input could only be HDR10 with a warning instead of
> failing, which sounds good and makes sense.
> I will fix it in the next version.
> 
> Thanks,
> Xinpeng
> 
> > Adding a warning sound good idea. But in order to proceed the
> > tone-mapping, a default input transfer-function need to be chosen,
> > which I think we can use
> > SMPTE2084 here.
> 
> Without any other comments on it, I will use SMPTE2084 as default input
> transfer-function if input_frame->color_trc is AVCOL_TRC_UNSPECIFIED.
> 
> >
> > Ruiling
> > >
> > > Carl Eugen
> > > ___
> > > 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".
> ___
> 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".

Kindly ping.

___
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 v2] avfilter: Add tonemap vaapi filter for H2S

2019-11-28 Thread Sun, Xinpeng

> -Original Message-
> From: ffmpeg-devel  On Behalf Of Song,
> Ruiling
> Sent: Thursday, November 28, 2019 5:39 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v2] avfilter: Add tonemap vaapi filter for
> H2S
> 
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of Carl
> > Eugen Hoyos
> > Sent: Thursday, November 28, 2019 5:16 PM
> > To: FFmpeg development discussions and patches  > de...@ffmpeg.org>
> > Subject: Re: [FFmpeg-devel] [PATCH v2] avfilter: Add tonemap vaapi
> > filter for H2S
> >
> > Am Do., 28. Nov. 2019 um 07:56 Uhr schrieb Song, Ruiling
> > :
> >
> > > > > Am 28.11.2019 um 06:37 schrieb Sun, Xinpeng
> > :
> > > > >
> > > > >>>
> > > > >>> +if (input_frame->color_trc != AVCOL_TRC_SMPTE2084) {
> > > > >>> +av_log(avctx, AV_LOG_ERROR, "Only support HDR10 as
> > > > >>> + input
> > for
> > > > vaapi tone-mapping\n");
> > > > >>> +return AVERROR(EINVAL);
> > > > >>
> > > > >> Shouldn't this also accept unknown trc?
> > > > >> (With a warning)
> > > > >
> > > > > Sorry if I misunderstand "unknown trc". Did you mean the trc
> > undefined by
> > > > ffmpeg or the trc unsupported by the driver?
> > > >
> > > > My question is:
> > > > If input_frame->color_trc is AVCOL_TRC_UNSPECIFIED, will the above fail?
> > > > But shouldn’t the user be able to use the filter in this case?
> > >
> > > I am not sure if assuming the input is using SMPTE2084 sounds more
> > acceptable
> > > in case of unspecified? If yes, I think we can change as you suggested.
> >
> > (Me neither.)
> > A warning could be shown instead of failing.

Prompt the user that the input could only be HDR10 with a warning instead of 
failing, which sounds good and makes sense. 
I will fix it in the next version.

Thanks,
Xinpeng

> Adding a warning sound good idea. But in order to proceed the tone-mapping, a
> default input transfer-function need to be chosen, which I think we can use
> SMPTE2084 here.

Without any other comments on it, I will use SMPTE2084 as default input 
transfer-function if input_frame->color_trc is AVCOL_TRC_UNSPECIFIED.

> 
> Ruiling
> >
> > Carl Eugen
> > ___
> > 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".
___
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 v2] avfilter: Add tonemap vaapi filter for H2S

2019-11-27 Thread Sun, Xinpeng
Hi Carl,

> -Original Message-
> From: ffmpeg-devel  On Behalf Of Carl
> Eugen Hoyos
> Sent: Wednesday, November 27, 2019 6:14 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v2] avfilter: Add tonemap vaapi filter for
> H2S
> 
> Am Mi., 27. Nov. 2019 um 10:51 Uhr schrieb 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
> 
> Why is HDR10 -> P010 (10bit -> 10 bit) called H2S?

It is P010 SDR here. SDR is not necessarily related to 8bit or 10bit. 
Here is a reference you might be interested in: 
https://www.itu.int/pub/R-REP-BT.2390

> 
> [...]
> 
> > +if (input_frame->color_trc != AVCOL_TRC_SMPTE2084) {
> > +av_log(avctx, AV_LOG_ERROR, "Only support HDR10 as input for vaapi
> tone-mapping\n");
> > +return AVERROR(EINVAL);
> 
> Shouldn't this also accept unknown trc?
> (With a warning)

Sorry if I misunderstand "unknown trc". Did you mean the trc undefined by 
ffmpeg or the trc unsupported by the driver?
If it is the former,  it has been checked in tonemap_vaapi_init().

> 
> [...]
> 
> > +{ "format", "Output pixel format set",
> > + OFFSET(output_format_string), AV_OPT_TYPE_STRING, .flags = FLAGS,
> > + "format" },
> 
> Sorry if I misremember how this is done for other filters:
> Shouldn't the output format be set by the filter chain or the format filter?
> 
> Carl Eugen

If I got it correctly, what you mean is setting the filter parameters by 
-vf"tonemap_vaapi, format=p010" instead of -vf"tonemap_vaapi=format=p010"?
In my opinion, from the perspective of transcoding, it is better to finish the 
complete pipeline in hw. This "format" option is used to set hw output surface 
format 
for the tonemap_vaapi filter, so that the trancode pipeline can work in video 
memory without any sw color space convertion.

Thanks,
Xinpeng

> ___
> 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 v1] avfilter: Add tonemap vaapi filter for H2S

2019-11-15 Thread Sun, Xinpeng

> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Michael Niedermayer
> Sent: Thursday, November 14, 2019 1:12 AM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v1] avfilter: Add tonemap vaapi filter for
> H2S
> 
> On Tue, Nov 12, 2019 at 04:59:48PM +0800, Xinpeng Sun wrote:
> > It performs HDR(High Dynamic Range) to SDR(Standard Dynamic Range)
> > conversion with tone-mapping. It supports HDR10 only as input temporarily.
> >
> > H2S: P010 -> NV12
> >
> > 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=h2s,hwdownload,format=nv12' -pix_fmt nv12 \ -f rawvideo
> > -y OUTPUT
> >
> > Signed-off-by: Xinpeng Sun 
> > Signed-off-by: Zachary Zhou 
> 
> i hope i didnt miss any dependant patches but fails to build
> 

Sorry, I forgot to run fate on my updated patch. (I run it previously and the 
fate passed, but I removed the version check in the updated patch and sent it 
in the rush.)
The main reason is missing the check of libva version, I will addressed it next 
time and make sure the fate passes in CI before submission.

> libavfilter/vf_tonemap_vaapi.c:43:5: error: unknown type name
> ‘VAHdrMetaDataHDR10’
>  VAHdrMetaDataHDR10  in_metadata;
>  ^
> libavfilter/vf_tonemap_vaapi.c: In function ‘tonemap_vaapi_set_filter_params’:
> libavfilter/vf_tonemap_vaapi.c:54:5: error: unknown type name
> ‘VAProcFilterParameterBufferHDRToneMapping’
>  VAProcFilterParameterBufferHDRToneMapping *hdrtm_param;
>  ^
> libavfilter/vf_tonemap_vaapi.c:65:23: error: request for member ‘data’ in
> something not a structure or union
>  memcpy(hdrtm_param->data.metadata, >in_metadata,
> sizeof(VAHdrMetaDataHDR10));
>^
> libavfilter/vf_tonemap_vaapi.c:65:66: error: ‘VAHdrMetaDataHDR10’
> undeclared (first use in this function)
>  memcpy(hdrtm_param->data.metadata, >in_metadata,
> sizeof(VAHdrMetaDataHDR10));
>   ^
> libavfilter/vf_tonemap_vaapi.c:65:66: note: each undeclared identifier is
> reported only once for each function it appears in
> libavfilter/vf_tonemap_vaapi.c: In function
> ‘tonemap_vaapi_build_filter_params’:
> libavfilter/vf_tonemap_vaapi.c:82:5: error: unknown type name
> ‘VAProcFilterCapHighDynamicRange’
>  VAProcFilterCapHighDynamicRange hdr_cap;
>  ^
> libavfilter/vf_tonemap_vaapi.c:84:5: error: unknown type name
> ‘VAProcFilterParameterBufferHDRToneMapping’
>  VAProcFilterParameterBufferHDRToneMapping hdrtm_param;
>  ^
> libavfilter/vf_tonemap_vaapi.c:88:38: error:
> ‘VAProcFilterHighDynamicRangeToneMapping’ undeclared (first use in this
> function)
>   VAProcFilterHighDynamicRangeToneMapping,
>   ^
> libavfilter/vf_tonemap_vaapi.c:96:16: error: request for member
> ‘metadata_type’ in something not a structure or union
>  if (hdr_cap.metadata_type == VAProcHighDynamicRangeMetadataNone) {
> ^
> libavfilter/vf_tonemap_vaapi.c:96:34: error:
> ‘VAProcHighDynamicRangeMetadataNone’ undeclared (first use in this function)
>  if (hdr_cap.metadata_type == VAProcHighDynamicRangeMetadataNone) {
>   ^
> libavfilter/vf_tonemap_vaapi.c:103:15: error:
> ‘VA_TONE_MAPPING_HDR_TO_SDR’ undeclared (first use in this function)
>  if (!(VA_TONE_MAPPING_HDR_TO_SDR & hdr_cap.caps_flag)) {
>^
> libavfilter/vf_tonemap_vaapi.c:103:51: error: request for member ‘caps_flag’ 
> in
> something not a structure or union
>  if (!(VA_TONE_MAPPING_HDR_TO_SDR & hdr_cap.caps_flag)) {
>^
> libavfilter/vf_tonemap_vaapi.c:115:16: error: request for member ‘type’ in
> something not a structure or union
>  hdrtm_param.type = VAProcFilterHighDynamicRangeToneMapping;
> ^
> libavfilter/vf_tonemap_vaapi.c:116:16: error: request for member ‘data’ in
> something not a structure or union
>  hdrtm_param.data.metadata_type =
> VAProcHighDynamicRangeMetadataHDR10;
> ^
> libavfilter/vf_tonemap_vaapi.c:116:38: error:
> ‘VAProcHighDynamicRangeMetadataHDR10’ undeclared (first use in this
> function)
>  hdrtm_param.data.metadata_type =
> VAProcHighDynamicRangeMetadataHDR10;
>   ^
> libavfilter/vf_tonemap_vaapi.c:117:16: error: request for member ‘data’ in
> something not a structure or union
>  hdrtm_param.data.metadata  = >in_metadata;
> ^
> libavfilter/vf_tonemap_vaapi.c:118:16: error: request for member ‘data’ in
> something not a structure or union
>  hdrtm_param.data.metadata_size = sizeof(VAHdrMetaDataHDR10);
> ^
> libavfilter/vf_tonemap_vaapi.c:118:45: error: ‘VAHdrMetaDataHDR10’
> undeclared (first use in this function)
>  

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

2019-11-12 Thread Sun, Xinpeng

> -Original Message-
> From: Song, Ruiling 
> Sent: Wednesday, November 13, 2019 9:05 AM
> To: FFmpeg development discussions and patches 
> Cc: Sun, Xinpeng ; Zhou, Zachary
> 
> Subject: RE: [FFmpeg-devel] [PATCH v1] avfilter: Add tonemap vaapi filter for
> H2S
> 
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of
> > Xinpeng Sun
> > Sent: Tuesday, November 12, 2019 5:00 PM
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Sun, Xinpeng ; Zhou, Zachary
> > 
> > Subject: [FFmpeg-devel] [PATCH v1] avfilter: Add tonemap vaapi filter
> > for H2S
> >
> > It performs HDR(High Dynamic Range) to SDR(Standard Dynamic Range)
> > conversion with tone-mapping. It supports HDR10 only as input
> > temporarily.
> >
> > H2S: P010 -> NV12
> Have you tried P010 HDR to P010 SDR? Does it work? I think people may like use
> 10bit SDR because it has more color details.
> 
I will check if it works in the driver. If yes, I can add P010 HDR to P010 SDR 
in the next version.

> >
> > 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=h2s,hwdownload,format=nv12' -pix_fmt nv12 \ -f rawvideo
> > -y OUTPUT
> >
> > Signed-off-by: Xinpeng Sun 
> > Signed-off-by: Zachary Zhou 
> > ---
> >  doc/filters.texi   |  30 
> >  libavfilter/Makefile   |   1 +
> >  libavfilter/allfilters.c   |   1 +
> >  libavfilter/vaapi_vpp.c|   5 +
> >  libavfilter/vf_tonemap_vaapi.c | 272
> > +
> >  5 files changed, 309 insertions(+)
> >  create mode 100644 libavfilter/vf_tonemap_vaapi.c
> >
> > diff --git a/doc/filters.texi b/doc/filters.texi index
> > 6800124574..b1c466ba24 100644
> > --- a/doc/filters.texi
> > +++ b/doc/filters.texi
> > @@ -20754,6 +20754,36 @@ Convert HDR(PQ/HLG) video to bt2020-transfer-
> > characteristic p010 format using li  @end example  @end itemize
> >
> This should not be here. Please move above opencl video filters or start 
> another
> chapter dedicated for vaapi accelerated video filters somewhere.
I will fix it in the next version.

> > +@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 temporarilly.
> > +
> > +It accepts the following parameters:
> > +
> > +@table @option
> > +@item type
> > +Specify the tone-mapping operator to be used.
> > +
> > +Possible values are:
> > +@table @var
> > +@item h2s
> > +Perform H2S(HDR to SDR), convert from p010 to nv12 @end table
> > +
> > +@end table
> > +
> > +@subsection Example
> > +
> > +@itemize
> > +@item
> > +Convert HDR video to SDR video from p010 format to nv12 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
> > fce930360d..90a0e9945e 100644
> > --- a/libavfilter/Makefile
> > +++ b/libavfilter/Makefile
> > @@ -410,6 +410,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
> > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index
> > 7c1e19e1da..b2fb1f8a98 100644
> > --- a/libavfilter/allfilters.c
> > +++ b/libavfilter/allfilters.c
> > @@ -390,6 +390,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;
> &g

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

2019-11-12 Thread Sun, Xinpeng

> -Original Message-
> From: ffmpeg-devel  On Behalf Of Carl
> Eugen Hoyos
> Sent: Tuesday, November 12, 2019 5:52 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v1] avfilter: Add tonemap vaapi filter for
> H2S
> 
> Hi!
> 
> > Am 12.11.2019 um 17:59 schrieb Xinpeng Sun :
> >
> > It performs HDR(High Dynamic Range) to SDR(Standard Dynamic Range)
> > conversion with tone-mapping. It supports HDR10 only as input temporarily.
> >
> > H2S: P010 -> NV12
> 
> No objection here but could you tell us if you (Intel) already have a plan 
> how to
> deal with H2H?
> 
> Thank you for your effort, Carl Eugen

Thanks for your quick feedback!
H2H is under development. In our new plan, P010->P010 will take place of 
P010->A2R10G10B10.

> ___
> 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 v1 1/2] lavu/pixfmt: add new pixel format a2r10g10b10/a2b10g10r10

2019-09-27 Thread Sun, Xinpeng

> -Original Message-
> From: ffmpeg-devel  On Behalf Of Carl
> Eugen Hoyos
> Sent: Wednesday, September 25, 2019 4:53 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v1 1/2] lavu/pixfmt: add new pixel format
> a2r10g10b10/a2b10g10r10
> 
> Am Mi., 25. Sept. 2019 um 04:46 Uhr schrieb Xinpeng Sun
> :
> 
> > Add two 10 bit RGBA pixel format for hardware color space conversion
> > support in VAAPI and QSV:
> >
> > 2:10:10:10 10 bit: A2R10G10B10
> > 2:10:10:10 10 bit: A2B10G10R10
> 
> Without more explanation, this patch is not ok.
> 
> Carl Eugen

 Thanks for review. The main reasons for adding these two format are as follows:
1. For most HDR monitors, A2R10G10B10 is used for display format for rendering. 
So this format is important to do 10bit RGB rendering support in ffmpeg.
2. HW VPP can do both p010->a2r10g10b10 and a2r10g10b10->p010 with this patch, 
which can provide support for hw encode pipeline using a2r10g10b10 as input.

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