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

2020-06-29 Thread Fei Wang
From: Xinpeng Sun 

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 h264 file:

ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 \
-hwaccel_output_format vaapi -i INPUT.h264 -hwaccel vaapi \
-vaapi_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i \
LOGO.h264 -filter_complex "[0:v][1:v]overlay_vaapi=w=50:h=50:alpha=0.5" \
-c:v h264_vaapi -y OUTPUT.h264

Signed-off-by: Xinpeng Sun 
Signed-off-by: Zachary Zhou 
Signed-off-by: Fei Wang 
---
 Changelog  |   1 +
 configure  |   3 +
 doc/filters.texi   |  51 
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/version.h  |   2 +-
 libavfilter/vf_overlay_vaapi.c | 426 +
 7 files changed, 484 insertions(+), 1 deletion(-)
 create mode 100644 libavfilter/vf_overlay_vaapi.c

diff --git a/Changelog b/Changelog
index a60e7d2eb8..f745f6f52a 100644
--- a/Changelog
+++ b/Changelog
@@ -4,6 +4,7 @@ releases are sorted from youngest to oldest.
 version :
 - AudioToolbox output device
 - MacCaption demuxer
+- overlay_vaapi filter
 
 
 version 4.3:
diff --git a/configure b/configure
index 7495f35faa..c930b261a2 100755
--- a/configure
+++ b/configure
@@ -3560,6 +3560,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"
 overlay_vulkan_filter_deps="vulkan libglslang"
 owdenoise_filter_deps="gpl"
 pad_opencl_filter_deps="opencl"
@@ -3620,6 +3621,7 @@ 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"
+overlay_vaapi_filter_deps="vaapi VAProcPipelineCaps_blend_flags"
 unsharp_opencl_filter_deps="opencl"
 uspp_filter_deps="gpl avcodec"
 vaguedenoiser_filter_deps="gpl"
@@ -6643,6 +6645,7 @@ if enabled vaapi; then
 check_struct "va/va.h" "VADecPictureParameterBufferVP9" bit_depth
 check_type   "va/va.h va/va_vpp.h" 
"VAProcFilterParameterBufferHDRToneMapping"
 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 67892e0afb..c53fe37bae 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -22128,6 +22128,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 input overlay video.
+
+@item h
+Set the height of the overlaid video on the main video.
+Default value is the height of input overlay video.
+
+@item alpha
+Set blocking detection thresholds. Allowed range is 0.0 to 1.0, it
+requires an input video with alpha channel.
+Default value is @code{0.0}.
+
+@end table
+
+@subsection Examples
+
+@itemize
+@item
+Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs 
for this filter 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
+@end example
+@item
+Overlay an image LOGO at the offset (200, 100) from the top-left corner of the 
INPUT video.
+The inputs have same memory layout for color channels, the overlay has 
additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
+@example
+-i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, 
hwupload[b], [a][b]overlay_vaapi=x=200:y=100:w=400:h=300:alpha=1.0, hwdownload, 
format=nv12" OUTPUT
+@end example
+
+@end itemize
+
 @section tonemap_vaapi
 
 Pe

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

2019-12-19 Thread Xinpeng Sun
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 input overlay video.
+
+@item h
+Set the height of the overlaid video on the main video.
+Default value is the height of input overlay video.
+
+@item alpha
+Set blocking detection thresholds. Allowed range is 0.0 to 1.0, it
+need input video has alpha channel.
+Default value is @code{0.0}.
+
+@end table
+
+@subsection Examples
+
+@itemize
+@item
+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, hwdownload" OUTPUT
+@end example
+@item
+Overlay an image LOGO at the offset (200, 100) from the top-left corner of the 
INPUT video.
+The inputs have same memory layout for color channels, the overlay has 
additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
+@example
+-i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, 
hwupload[b], [a][b]overlay_vaapi=x=200:y=100:w=400:h=300:alpha=1.0, hwdownload" 
OUTPUT
+@end example
+
+@end itemize
+
 @section tonemap_vappi
 
 Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with 
tone-mapping.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 37d4eee858..ea73fef9aa 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -322,6 +322,7 @@ OBJS-$(CONFIG_OVERLAY_FILTER)+= 
vf_overlay.o framesync.o
 OBJS-$(CONFIG_OVERLAY_OPENCL_FILTER) += vf_overlay_opencl.o opencl.o \
 opencl/overlay.o framesync.o
 OBJS-$(CONFIG_O

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

2021-11-18 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of Fei
> Wang
> Sent: Tuesday, June 30, 2020 5:58 AM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Xinpeng Sun ; Zachary Zhou
> ; Fei Wang 
> Subject: [FFmpeg-devel] [PATCH v1] avfilter: add overlay vaapi filter
> 
> From: Xinpeng Sun 
> 
> 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 h264 file:
> 
> ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 \
> -hwaccel_output_format vaapi -i INPUT.h264 -hwaccel vaapi \
> -vaapi_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i \
> LOGO.h264 -filter_complex
> "[0:v][1:v]overlay_vaapi=w=50:h=50:alpha=0.5" \
> -c:v h264_vaapi -y OUTPUT.h264
> 
> Signed-off-by: Xinpeng Sun 
> Signed-off-by: Zachary Zhou 
> Signed-off-by: Fei Wang 
> ---


Does anybody know why this filter hasn't been merged?
I always thought it would have been included for quite a while.

Is there any problem with it?

Thanks,
softworkz
___
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

2021-11-18 Thread Wang, Fei W
On Thu, 2021-11-18 at 21:55 +, Soft Works wrote:
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of
> > Fei
> > Wang
> > Sent: Tuesday, June 30, 2020 5:58 AM
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Xinpeng Sun ; Zachary Zhou
> > ; Fei Wang 
> > Subject: [FFmpeg-devel] [PATCH v1] avfilter: add overlay vaapi
> > filter
> > 
> > From: Xinpeng Sun 
> > 
> > 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 h264 file:
> > 
> > ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 \
> > -hwaccel_output_format vaapi -i INPUT.h264 -hwaccel vaapi \
> > -vaapi_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i \
> > LOGO.h264 -filter_complex
> > "[0:v][1:v]overlay_vaapi=w=50:h=50:alpha=0.5" \
> > -c:v h264_vaapi -y OUTPUT.h264
> > 
> > Signed-off-by: Xinpeng Sun 
> > Signed-off-by: Zachary Zhou 
> > Signed-off-by: Fei Wang 
> > ---
> 
> Does anybody know why this filter hasn't been merged?
> I always thought it would have been included for quite a while.
> 
> Is there any problem with it?

Because nobody helped to review/apply it. It works base on our local
test. If anybody can help to apply it, I will submit a new version to
port it to latest mater.

Thanks
Fei

> 
> Thanks,
> softworkz
> ___
> 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

2021-11-19 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of
> Wang, Fei W
> Sent: Friday, November 19, 2021 2:15 AM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Sun, Xinpeng ; Zhou, Zachary
> 
> Subject: Re: [FFmpeg-devel] [PATCH v1] avfilter: add overlay vaapi
> filter
> 
> On Thu, 2021-11-18 at 21:55 +, Soft Works wrote:
> > > -Original Message-
> > > From: ffmpeg-devel  On Behalf Of
> > > Fei
> > > Wang
> > > Sent: Tuesday, June 30, 2020 5:58 AM
> > > To: ffmpeg-devel@ffmpeg.org
> > > Cc: Xinpeng Sun ; Zachary Zhou
> > > ; Fei Wang 
> > > Subject: [FFmpeg-devel] [PATCH v1] avfilter: add overlay vaapi
> > > filter
> > >
> > > From: Xinpeng Sun 
> > >
> > > 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 h264 file:
> > >
> > > ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 \
> > > -hwaccel_output_format vaapi -i INPUT.h264 -hwaccel vaapi \
> > > -vaapi_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i
> \
> > > LOGO.h264 -filter_complex
> > > "[0:v][1:v]overlay_vaapi=w=50:h=50:alpha=0.5" \
> > > -c:v h264_vaapi -y OUTPUT.h264
> > >
> > > Signed-off-by: Xinpeng Sun 
> > > Signed-off-by: Zachary Zhou 
> > > Signed-off-by: Fei Wang 
> > > ---
> >
> > Does anybody know why this filter hasn't been merged?
> > I always thought it would have been included for quite a while.
> >
> > Is there any problem with it?
> 
> Because nobody helped to review/apply it. It works base on our local
> test. If anybody can help to apply it, I will submit a new version to
> port it to latest mater.

I can't merge but I'm ready to review it. The patch from cartwheel
doesn't apply either, so when you could supply an updated patch, that
would be great.

Thanks,
softworkz
___
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

2021-11-22 Thread Wang, Fei W
On Fri, 2021-11-19 at 15:14 +, Soft Works wrote:
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of
> > Wang, Fei W
> > Sent: Friday, November 19, 2021 2:15 AM
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Sun, Xinpeng ; Zhou, Zachary
> > 
> > Subject: Re: [FFmpeg-devel] [PATCH v1] avfilter: add overlay vaapi
> > filter
> > 
> > On Thu, 2021-11-18 at 21:55 +, Soft Works wrote:
> > > > -Original Message-
> > > > From: ffmpeg-devel  On Behalf
> > > > Of
> > > > Fei
> > > > Wang
> > > > Sent: Tuesday, June 30, 2020 5:58 AM
> > > > To: ffmpeg-devel@ffmpeg.org
> > > > Cc: Xinpeng Sun ; Zachary Zhou
> > > > ; Fei Wang 
> > > > Subject: [FFmpeg-devel] [PATCH v1] avfilter: add overlay vaapi
> > > > filter
> > > > 
> > > > From: Xinpeng Sun 
> > > > 
> > > > 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 h264 file:
> > > > 
> > > > ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 \
> > > > -hwaccel_output_format vaapi -i INPUT.h264 -hwaccel vaapi \
> > > > -vaapi_device /dev/dri/renderD128 -hwaccel_output_format vaapi
> > > > -i
> > \
> > > > LOGO.h264 -filter_complex
> > > > "[0:v][1:v]overlay_vaapi=w=50:h=50:alpha=0.5" \
> > > > -c:v h264_vaapi -y OUTPUT.h264
> > > > 
> > > > Signed-off-by: Xinpeng Sun 
> > > > Signed-off-by: Zachary Zhou 
> > > > Signed-off-by: Fei Wang 
> > > > ---
> > > 
> > > Does anybody know why this filter hasn't been merged?
> > > I always thought it would have been included for quite a while.
> > > 
> > > Is there any problem with it?
> > 
> > Because nobody helped to review/apply it. It works base on our
> > local
> > test. If anybody can help to apply it, I will submit a new version
> > to
> > port it to latest mater.
> 
> I can't merge but I'm ready to review it. The patch from cartwheel
> doesn't apply either, so when you could supply an updated patch, that
> would be great.

Thanks Softworkz! New version V2 base on master already submitted,
please help to review. 

Also Ping anyone who can help to apply this patch after review.

Thanks
Fei

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

2019-12-31 Thread Paul B Mahol
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 input overlay video.
> +
> +@item h
> +Set the height of the overlaid video on the main video.
> +Default value is the height of input overlay video.
> +
> +@item alpha
> +Set blocking detection thresholds. Allowed range is 0.0 to 1.0, it
> +need input video has alpha channel.

needs input video that have alpha channel.

> +Default value is @code{0.0}.
> +
> +@end table
> +
> +@subsection Examples
> +
> +@itemize
> +@item
> +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, hwdownload" OUTPUT
> +@end example
> +@item
> +Overlay an image LOGO at the offset (200, 100) from the top-left corner of
> the INPUT video.
> +The inputs have same memory layout for color channels, the overlay has
> additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
> +@example
> +-i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p,
> hwupload[b], [a][b]overlay_vaapi=x=200:y=100:w=400:h=300:alpha=1.0,
> hwdownload" OUTPUT
> +@end example
> +
> +@end itemize
> +
>  @section tonemap_vappi
>
>  Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion
> with tone-mapping.
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 37d4eee858..ea73fef9aa 100644
> --

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

2020-01-01 Thread Moritz Barsnick
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), 
> &ctx->inputs[MAIN]->out_formats);
> +if (ret < 0)
> +  return ret;
> +
> +ret = ff_formats_ref(ff_make_format_list(main_in_fmts), 
> &ctx->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
___
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

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), &ctx-
> >inputs[MAIN]->out_formats);
> > +if (ret < 0)
> > +  return ret;
> > +
> > +ret = ff_formats_ref(ff_make_format_list(main_in_fmts), &ctx-
> >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".