Re: [FFmpeg-devel] [PATCH V5] libavfilter: add transpose_vaapi filter

2018-12-18 Thread Zhou, Zachary
Thanks and resent patch version V6

> -Original Message-
> From: Li, Zhong
> Sent: Tuesday, December 18, 2018 5:30 PM
> To: FFmpeg development discussions and patches 
> Cc: Zhou, Zachary 
> Subject: RE: [FFmpeg-devel] [PATCH V5] libavfilter: add transpose_vaapi filter
> 
> > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> > Of Zachary Zhou
> > Sent: Tuesday, December 18, 2018 5:01 PM
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Zhou, Zachary 
> > Subject: [FFmpeg-devel] [PATCH V5] 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 | 360
> > +++
> >  4 files changed, 364 insertions(+)
> >  create mode 100644 libavfilter/vf_transpose_vaapi.c
> >
> 
> Appling patch failed. I guess you may need to rebase your patch based on
> latest master branch:
> 
> pwclient git-am 11457
> Applying patch #11457 using 'git am'
> Description: [FFmpeg-devel,V5] libavfilter: add transpose_vaapi filter
> Applying: libavfilter: add transpose_vaapi filter
> .git/rebase-apply/patch:122: indent with spaces.
>vpp_ctx->va_context,
> .git/rebase-apply/patch:123: indent with spaces.
>NULL, 0,
> .git/rebase-apply/patch:124: indent with spaces.
>_caps);
> .git/rebase-apply/patch:126: indent with spaces.
> av_log(avctx, AV_LOG_ERROR, "Failed to query pipeline "
> .git/rebase-apply/patch:127: indent with spaces.
>"caps: %d (%s).\n", vas, vaErrorStr(vas));
> error: patch failed: configure:3480
> error: configure: patch does not apply
> error: patch failed: libavfilter/Makefile:393
> error: libavfilter/Makefile: patch does not apply
> error: patch failed: libavfilter/allfilters.c:372
> error: libavfilter/allfilters.c: patch does not apply Patch failed at 0001
> libavfilter: add transpose_vaapi filter Use 'git am --show-current-patch' to 
> see
> the failed patch When you have resolved this problem, run "git am --continue".
> If you prefer to skip this patch, run "git am --skip" instead.
> To restore the original branch and stop patching, run "git am --abort".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH V5] libavfilter: add transpose_vaapi filter

2018-12-18 Thread Li, Zhong
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Zachary Zhou
> Sent: Tuesday, December 18, 2018 5:01 PM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Zhou, Zachary 
> Subject: [FFmpeg-devel] [PATCH V5] 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 | 360
> +++
>  4 files changed, 364 insertions(+)
>  create mode 100644 libavfilter/vf_transpose_vaapi.c
> 

Appling patch failed. I guess you may need to rebase your patch based on latest 
master branch:

pwclient git-am 11457
Applying patch #11457 using 'git am'
Description: [FFmpeg-devel,V5] libavfilter: add transpose_vaapi filter
Applying: libavfilter: add transpose_vaapi filter
.git/rebase-apply/patch:122: indent with spaces.
   vpp_ctx->va_context,
.git/rebase-apply/patch:123: indent with spaces.
   NULL, 0,
.git/rebase-apply/patch:124: indent with spaces.
   _caps);
.git/rebase-apply/patch:126: indent with spaces.
av_log(avctx, AV_LOG_ERROR, "Failed to query pipeline "
.git/rebase-apply/patch:127: indent with spaces.
   "caps: %d (%s).\n", vas, vaErrorStr(vas));
error: patch failed: configure:3480
error: configure: patch does not apply
error: patch failed: libavfilter/Makefile:393
error: libavfilter/Makefile: patch does not apply
error: patch failed: libavfilter/allfilters.c:372
error: libavfilter/allfilters.c: patch does not apply
Patch failed at 0001 libavfilter: add transpose_vaapi filter
Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH V5] libavfilter: add transpose_vaapi filter

2018-12-18 Thread Zachary Zhou
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 | 360 +++
 4 files changed, 364 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..a2bf245da9
--- /dev/null
+++ b/libavfilter/vf_transpose_vaapi.c
@@ -0,0 +1,360 @@
+/*
+ * 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_REVERAL,
+TRANSPOSE_REVERAL_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,
+