Re: [FFmpeg-devel] [PATCH v4] libavfilter: add transpose_vaapi filter
Thank you for the review, my reply inline. new patch version will be sent out. > -Original Message- > From: Li, Zhong > Sent: Tuesday, December 18, 2018 2:52 PM > To: FFmpeg development discussions and patches > Cc: Zhou, Zachary > Subject: RE: [FFmpeg-devel] [PATCH v4] libavfilter: add transpose_vaapi filter > > > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf > > Of Zhou, Zachary > > Sent: Monday, December 3, 2018 6:56 PM > > To: FFmpeg development discussions and patches > > > > Cc: Zhou, Zachary > > Subject: Re: [FFmpeg-devel] [PATCH v4] libavfilter: add > > transpose_vaapi filter > > > > ping? any more comments ? > > > > > -Original Message- > > > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On > > Behalf > > > Of Zachary Zhou > > > Sent: Thursday, November 29, 2018 2:14 PM > > > To: ffmpeg-devel@ffmpeg.org > > > Cc: Zachary Zhou ; Zhou, Zachary > > > > > > Subject: [FFmpeg-devel] [PATCH v4] libavfilter: add transpose_vaapi > > > filter > > > > > > Swap width and height when do clock/cclock rotation Add 180/180_flip > > > options > > > > > > ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 - > > > hwaccel_output_format vaapi -i input.264 -vf > > "transpose_vaapi=clock_flip" > > > -c:v h264_vaapi output.h264 > > > > > > Signed-off-by: Zachary Zhou > > > --- > > > configure| 2 + > > > libavfilter/Makefile | 1 + > > > libavfilter/allfilters.c | 1 + > > > libavfilter/vf_transpose_vaapi.c | 356 > > > +++ > > > 4 files changed, 360 insertions(+) > > > create mode 100644 libavfilter/vf_transpose_vaapi.c > > > > > > diff --git a/configure b/configure > > > index 3e9222ed1b..9e3908ef61 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" > > > +transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags" > > > unsharp_opencl_filter_deps="opencl" > > > uspp_filter_deps="gpl avcodec" > > > vaguedenoiser_filter_deps="gpl" > > > @@ -5979,6 +5980,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_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" > > > check_type "va/va.h va/va_enc_vp8.h" > > "VAEncPictureParameterBufferVP8" > > > diff --git a/libavfilter/Makefile b/libavfilter/Makefile index > > > 1895fa2b0d..ccce4bbb2f 100644 > > > --- a/libavfilter/Makefile > > > +++ b/libavfilter/Makefile > > > @@ -393,6 +393,7 @@ OBJS-$(CONFIG_TONEMAP_OPENCL_FILTER) > > += > > > vf_tonemap_opencl.o colorspace.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 > > > +OBJS-$(CONFIG_TRANSPOSE_VAAPI_FILTER)+= > > vf_transpose_vaapi.o > > > vaapi_vpp.o > > > OBJS-$(CONFIG_TRIM_FILTER) += trim.o > > > OBJS-$(CONFIG_UNPREMULTIPLY_FILTER) += > > vf_premultiply.o > > > framesync.o > > > OBJS-$(CONFIG_UNSHARP_FILTER)+= vf_unsharp.o > > > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c > > > index > > > 837c99eb75..40e5d82b62 100644 > > > --- a/libavfilter/allfilters.c > > > +++ b/libavfilter/allfilters.c > > > @@ -372,6 +372,7 @@ extern AVFilter ff_vf_tonemap_opencl; extern > > > AVFilter ff_vf_tpad; extern AVFilte
Re: [FFmpeg-devel] [PATCH v4] libavfilter: add transpose_vaapi filter
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf > Of Zhou, Zachary > Sent: Monday, December 3, 2018 6:56 PM > To: FFmpeg development discussions and patches > > Cc: Zhou, Zachary > Subject: Re: [FFmpeg-devel] [PATCH v4] libavfilter: add transpose_vaapi filter > > ping? any more comments ? > > > -Original Message- > > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On > Behalf > > Of Zachary Zhou > > Sent: Thursday, November 29, 2018 2:14 PM > > To: ffmpeg-devel@ffmpeg.org > > Cc: Zachary Zhou ; Zhou, Zachary > > > > Subject: [FFmpeg-devel] [PATCH v4] libavfilter: add transpose_vaapi > > filter > > > > Swap width and height when do clock/cclock rotation Add 180/180_flip > > options > > > > ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 - > > hwaccel_output_format vaapi -i input.264 -vf > "transpose_vaapi=clock_flip" > > -c:v h264_vaapi output.h264 > > > > Signed-off-by: Zachary Zhou > > --- > > configure| 2 + > > libavfilter/Makefile | 1 + > > libavfilter/allfilters.c | 1 + > > libavfilter/vf_transpose_vaapi.c | 356 > > +++ > > 4 files changed, 360 insertions(+) > > create mode 100644 libavfilter/vf_transpose_vaapi.c > > > > diff --git a/configure b/configure > > index 3e9222ed1b..9e3908ef61 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" > > +transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags" > > unsharp_opencl_filter_deps="opencl" > > uspp_filter_deps="gpl avcodec" > > vaguedenoiser_filter_deps="gpl" > > @@ -5979,6 +5980,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_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" > > check_type "va/va.h va/va_enc_vp8.h" > "VAEncPictureParameterBufferVP8" > > diff --git a/libavfilter/Makefile b/libavfilter/Makefile index > > 1895fa2b0d..ccce4bbb2f 100644 > > --- a/libavfilter/Makefile > > +++ b/libavfilter/Makefile > > @@ -393,6 +393,7 @@ OBJS-$(CONFIG_TONEMAP_OPENCL_FILTER) > += > > vf_tonemap_opencl.o colorspace.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 > > +OBJS-$(CONFIG_TRANSPOSE_VAAPI_FILTER)+= > vf_transpose_vaapi.o > > vaapi_vpp.o > > OBJS-$(CONFIG_TRIM_FILTER) += trim.o > > OBJS-$(CONFIG_UNPREMULTIPLY_FILTER) += > vf_premultiply.o > > framesync.o > > OBJS-$(CONFIG_UNSHARP_FILTER)+= vf_unsharp.o > > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index > > 837c99eb75..40e5d82b62 100644 > > --- a/libavfilter/allfilters.c > > +++ b/libavfilter/allfilters.c > > @@ -372,6 +372,7 @@ extern AVFilter ff_vf_tonemap_opencl; extern > > AVFilter ff_vf_tpad; extern AVFilter ff_vf_transpose; extern > > AVFilter ff_vf_transpose_npp; > > +extern AVFilter ff_vf_transpose_vaapi; > > extern AVFilter ff_vf_trim; > > extern AVFilter ff_vf_unpremultiply; > > extern AVFilter ff_vf_unsharp; > > diff --git a/libavfilter/vf_transpose_vaapi.c > > b/libavfilter/vf_transpose_vaapi.c > > new file mode 100644 > > index 00..d0502b7944 > > --- /dev/null > > +++ b/libavfilter/vf_transpose_vaapi.c > > @@ -0,0 +1,356 @@ > > +/* > > + * This file is part of FFmpeg. > > + * > > + * FFmpeg is free software; you can redistribute it and/or > > + * modify it under the terms of the GNU Lesser General Public > > + * License as published by the Free Software Foundation; either > > + * ver
Re: [FFmpeg-devel] [PATCH v4] libavfilter: add transpose_vaapi filter
Hi Mark, Do you have any comments regarding this patch ? Best Regards, Zachary > -Original Message- > From: Zhou, Zachary > Sent: Monday, December 3, 2018 6:56 PM > To: FFmpeg development discussions and patches > Cc: Zhou, Zachary > Subject: RE: [FFmpeg-devel] [PATCH v4] libavfilter: add transpose_vaapi filter > > ping? any more comments ? > > > > > ___ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v4] libavfilter: add transpose_vaapi filter
ping? any more comments ? > -Original Message- > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of > Zachary Zhou > Sent: Thursday, November 29, 2018 2:14 PM > To: ffmpeg-devel@ffmpeg.org > Cc: Zachary Zhou ; Zhou, Zachary > > Subject: [FFmpeg-devel] [PATCH v4] libavfilter: add transpose_vaapi filter > > Swap width and height when do clock/cclock rotation Add 180/180_flip > options > > ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 - > hwaccel_output_format vaapi -i input.264 -vf "transpose_vaapi=clock_flip" > -c:v h264_vaapi output.h264 > > Signed-off-by: Zachary Zhou > --- > configure| 2 + > libavfilter/Makefile | 1 + > libavfilter/allfilters.c | 1 + > libavfilter/vf_transpose_vaapi.c | 356 +++ > 4 files changed, 360 insertions(+) > create mode 100644 libavfilter/vf_transpose_vaapi.c > > diff --git a/configure b/configure > index 3e9222ed1b..9e3908ef61 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" > +transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags" > unsharp_opencl_filter_deps="opencl" > uspp_filter_deps="gpl avcodec" > vaguedenoiser_filter_deps="gpl" > @@ -5979,6 +5980,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_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" > check_type "va/va.h va/va_enc_vp8.h" "VAEncPictureParameterBufferVP8" > diff --git a/libavfilter/Makefile b/libavfilter/Makefile index > 1895fa2b0d..ccce4bbb2f 100644 > --- a/libavfilter/Makefile > +++ b/libavfilter/Makefile > @@ -393,6 +393,7 @@ OBJS-$(CONFIG_TONEMAP_OPENCL_FILTER) += > vf_tonemap_opencl.o colorspace.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 > +OBJS-$(CONFIG_TRANSPOSE_VAAPI_FILTER)+= vf_transpose_vaapi.o > vaapi_vpp.o > OBJS-$(CONFIG_TRIM_FILTER) += trim.o > OBJS-$(CONFIG_UNPREMULTIPLY_FILTER) += vf_premultiply.o > framesync.o > OBJS-$(CONFIG_UNSHARP_FILTER)+= vf_unsharp.o > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index > 837c99eb75..40e5d82b62 100644 > --- a/libavfilter/allfilters.c > +++ b/libavfilter/allfilters.c > @@ -372,6 +372,7 @@ extern AVFilter ff_vf_tonemap_opencl; extern > AVFilter ff_vf_tpad; extern AVFilter ff_vf_transpose; extern AVFilter > ff_vf_transpose_npp; > +extern AVFilter ff_vf_transpose_vaapi; > extern AVFilter ff_vf_trim; > extern AVFilter ff_vf_unpremultiply; > extern AVFilter ff_vf_unsharp; > diff --git a/libavfilter/vf_transpose_vaapi.c > b/libavfilter/vf_transpose_vaapi.c > new file mode 100644 > index 00..d0502b7944 > --- /dev/null > +++ b/libavfilter/vf_transpose_vaapi.c > @@ -0,0 +1,356 @@ > +/* > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with FFmpeg; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > +02110-1301 USA */ #include > + > +#include "libavutil/avassert.h" > +#include "libavutil/mem.h" > +#include "libavutil/opt.h" > +#include "libavutil/pixdesc.h" > + > +#include &quo
[FFmpeg-devel] [PATCH v4] libavfilter: add transpose_vaapi filter
Swap width and height when do clock/cclock rotation Add 180/180_flip options ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i input.264 -vf "transpose_vaapi=clock_flip" -c:v h264_vaapi output.h264 Signed-off-by: Zachary Zhou --- configure| 2 + libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/vf_transpose_vaapi.c | 356 +++ 4 files changed, 360 insertions(+) create mode 100644 libavfilter/vf_transpose_vaapi.c diff --git a/configure b/configure index 3e9222ed1b..9e3908ef61 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" +transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags" unsharp_opencl_filter_deps="opencl" uspp_filter_deps="gpl avcodec" vaguedenoiser_filter_deps="gpl" @@ -5979,6 +5980,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_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" check_type "va/va.h va/va_enc_vp8.h" "VAEncPictureParameterBufferVP8" diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 1895fa2b0d..ccce4bbb2f 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -393,6 +393,7 @@ OBJS-$(CONFIG_TONEMAP_OPENCL_FILTER) += vf_tonemap_opencl.o colorspace.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 +OBJS-$(CONFIG_TRANSPOSE_VAAPI_FILTER)+= vf_transpose_vaapi.o vaapi_vpp.o OBJS-$(CONFIG_TRIM_FILTER) += trim.o OBJS-$(CONFIG_UNPREMULTIPLY_FILTER) += vf_premultiply.o framesync.o OBJS-$(CONFIG_UNSHARP_FILTER)+= vf_unsharp.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 837c99eb75..40e5d82b62 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -372,6 +372,7 @@ extern AVFilter ff_vf_tonemap_opencl; extern AVFilter ff_vf_tpad; extern AVFilter ff_vf_transpose; extern AVFilter ff_vf_transpose_npp; +extern AVFilter ff_vf_transpose_vaapi; extern AVFilter ff_vf_trim; extern AVFilter ff_vf_unpremultiply; extern AVFilter ff_vf_unsharp; diff --git a/libavfilter/vf_transpose_vaapi.c b/libavfilter/vf_transpose_vaapi.c new file mode 100644 index 00..d0502b7944 --- /dev/null +++ b/libavfilter/vf_transpose_vaapi.c @@ -0,0 +1,356 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#include + +#include "libavutil/avassert.h" +#include "libavutil/mem.h" +#include "libavutil/opt.h" +#include "libavutil/pixdesc.h" + +#include "avfilter.h" +#include "formats.h" +#include "internal.h" +#include "vaapi_vpp.h" + +typedef enum { +TRANSPOSE_PT_TYPE_NONE, +TRANSPOSE_PT_TYPE_LANDSCAPE, +TRANSPOSE_PT_TYPE_PORTRAIT, +} PassthroughType; + +enum TransposeDir { +TRANSPOSE_CCLOCK_FLIP, +TRANSPOSE_CLOCK, +TRANSPOSE_CCLOCK, +TRANSPOSE_CLOCK_FLIP, +TRANSPOSE_180, +TRANSPOSE_180_FLIP, +}; + +typedef struct TransposeVAAPIContext { +VAAPIVPPContext vpp_ctx; // must be the first field +int passthrough; // PassthroughType, landscape passthrough mode enabled +int dir; // TransposeDir + +int rotation_state; +int mirror_state; +} TransposeVAAPIContext; + +static int transpose_vaapi_build_filter_params(AVFilterContext *avctx) +{ +VAAPIVPPContext *vpp_ctx = avctx->priv; +TransposeVAAPIContext *ctx = avctx->priv; +VAStatus vas; +int support_flag; +VAProcPipelineCaps pipeline_caps; + +memset(_caps, 0, sizeof(pipeline_caps)); +vas = vaQueryVideoProcPipelineCaps(vpp_ctx->hwctx->display, +