Re: [FFmpeg-devel] [PATCH v4 2/2] avfilter: Add tonemap vaapi filter

2019-09-15 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel  On Behalf Of Moritz
> Barsnick
> Sent: Wednesday, September 11, 2019 3:56 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v4 2/2] avfilter: Add tonemap vaapi filter
> 
> On Wed, Sep 11, 2019 at 13:39:56 +0800, Zachary Zhou wrote:
> > +@section tonemap_vappi
> ^
> Typo - the filter has a different name.

Thank you for the review, will do the change.
- Zachary

> 
> 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 v4 1/2] libavuitl: add A2R10G10B10 & A2B10G10R10

2019-09-15 Thread Zhou, Zachary


> -Original Message-
> From: Fu, Linjie
> Sent: Wednesday, September 11, 2019 1:54 PM
> To: FFmpeg development discussions and patches 
> Cc: Zhou, Zachary 
> Subject: RE: [FFmpeg-devel] [PATCH v4 1/2] libavuitl: add A2R10G10B10 &
> A2B10G10R10
> 
> > -Original Message-
> > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> > Of Zachary Zhou
> > Sent: Wednesday, September 11, 2019 13:40
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Zhou, Zachary 
> > Subject: [FFmpeg-devel] [PATCH v4 1/2] libavuitl: add A2R10G10B10 &
> > A2B10G10R10
> >
> > ---
> >  libavutil/hwcontext_vaapi.c | 6 ++
> >  libavutil/pixfmt.h  | 3 +++
> >  2 files changed, 9 insertions(+)
> 
> Didn't see the difference compared with your V1 patch:
> https://patchwork.ffmpeg.org/patch/14998/
> 
> Is there something mixed up?

Thanks Linjie for the review, Yes, they are same.
only reason for the V1 here is I want to the V2 patch build get passed.

> 
> - linjie
___
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] libavutil: add A2R10G10B10 & A2B10G10R10

2019-09-10 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel  On Behalf Of Carl
> Eugen Hoyos
> Sent: Wednesday, September 11, 2019 7:30 AM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v1] libavutil: add A2R10G10B10 &
> A2B10G10R10
> 
> Am Di., 10. Sept. 2019 um 11:35 Uhr schrieb Zachary Zhou
> :
> >
> > ---
> >  libavutil/hwcontext_vaapi.c | 6 ++
> >  libavutil/pixfmt.h  | 3 +++
> >  2 files changed, 9 insertions(+)
> >
> > diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
> > index cf117640f2..9838250b66 100644
> > --- a/libavutil/hwcontext_vaapi.c
> > +++ b/libavutil/hwcontext_vaapi.c
> > @@ -125,6 +125,12 @@ static const VAAPIFormatDescriptor
> > vaapi_format_map[] = {  #endif
> >  MAP(BGRA, RGB32,   BGRA, 0),
> >  MAP(BGRX, RGB32,   BGR0, 0),
> > +#ifdef VA_FOURCC_A2R10G10B10
> > +MAP(A2R10G10B10, RGB32_10, A2R10G10B10, 0), #endif #ifdef
> > +VA_FOURCC_A2B10G10R10
> > +MAP(A2B10G10R10, RGB32_10, A2B10G10R10, 0), #endif
> >  MAP(RGBA, RGB32,   RGBA, 0),
> >  MAP(RGBX, RGB32,   RGB0, 0),
> >  #ifdef VA_FOURCC_ABGR
> > diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index
> > d78e863d4b..e00f129b46 100644
> > --- a/libavutil/pixfmt.h
> > +++ b/libavutil/pixfmt.h
> > @@ -348,6 +348,9 @@ enum AVPixelFormat {
> >  AV_PIX_FMT_NV24,  ///< planar YUV 4:4:4, 24bpp, 1 plane for Y and 1
> plane for the UV components, which are interleaved (first byte U and the
> following byte V)
> >  AV_PIX_FMT_NV42,  ///< as above, but U and V bytes are swapped
> >
> > +AV_PIX_FMT_A2R10G10B10, ///< 10-bit Pixel RGB formats.
> > +AV_PIX_FMT_A2B10G10R10, ///< 10-bit Pixel BGR formats.
> 
> The patch looks insufficient, see the patch to add AYUV and other packed
> formats.

Thank you for the review, I will refer these patches.

> 
> The more important question imo is: Why are these formats needed, which
> hardware produces them for which input?

These formats target to Intel Ice Lake platform. will be use in HDR tone 
mapping filter.
input is P010.

welcome to review my HDR patch: https://patchwork.ffmpeg.org/patch/15018/
I appreciate any comments.

-Zachary

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

Re: [FFmpeg-devel] [PATCH v4] avfilter/vaapi: add overlay_vaapi filter

2019-08-28 Thread Zhou, Zachary


> -Original Message-
> From: Li, Zhong
> Sent: Wednesday, August 28, 2019 4:37 PM
> To: FFmpeg development discussions and patches 
> Cc: Zhou, Zachary 
> Subject: RE: [FFmpeg-devel] [PATCH v4] avfilter/vaapi: add overlay_vaapi 
> filter
> 
> > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> > Of Zachary Zhou
> > Sent: Thursday, July 11, 2019 5:30 PM
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Zhou, Zachary 
> > Subject: [FFmpeg-devel] [PATCH v4] avfilter/vaapi: add overlay_vaapi
> > filter
> >
> > ---
> >  configure  |   1 +
> >  libavfilter/Makefile   |   1 +
> >  libavfilter/allfilters.c   |   1 +
> >  libavfilter/vf_overlay_vaapi.c | 424
> 
> Would be good to update the filter doc when you add a new one.

will update the filter doc in the next version.

> 
> > +
> >  4 files changed, 427 insertions(+)
> >  create mode 100644 libavfilter/vf_overlay_vaapi.c
> >
> > diff --git a/configure b/configure
> > index 32fc26356c..f469e6a3b1 100755
> > --- a/configure
> > +++ b/configure
> > @@ -3478,6 +3478,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"
> > diff --git a/libavfilter/Makefile b/libavfilter/Makefile index
> > 07ea8d7edc..ccaad0d6a4 100644
> > --- a/libavfilter/Makefile
> > +++ b/libavfilter/Makefile
> > @@ -311,6 +311,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_OVERLAY_QSV_FILTER)+= vf_overlay_qsv.o
> > framesync.o
> > +OBJS-$(CONFIG_OVERLAY_VAAPI_FILTER)  +=
> > vf_overlay_vaapi.o framesync.o vaapi_vpp.o
> >  OBJS-$(CONFIG_OWDENOISE_FILTER)  += vf_owdenoise.o
> >  OBJS-$(CONFIG_PAD_FILTER)+= vf_pad.o
> >  OBJS-$(CONFIG_PALETTEGEN_FILTER) += vf_palettegen.o
> > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index
> > 9c846b1ddd..27ee1df78b 100644
> > --- a/libavfilter/allfilters.c
> > +++ b/libavfilter/allfilters.c
> > @@ -295,6 +295,7 @@ extern AVFilter ff_vf_oscilloscope;  extern
> > AVFilter ff_vf_overlay;  extern AVFilter ff_vf_overlay_opencl;  extern
> > AVFilter ff_vf_overlay_qsv;
> > +extern AVFilter ff_vf_overlay_vaapi;
> >  extern AVFilter ff_vf_owdenoise;
> >  extern AVFilter ff_vf_pad;
> >  extern AVFilter ff_vf_palettegen;
> > diff --git a/libavfilter/vf_overlay_vaapi.c
> > b/libavfilter/vf_overlay_vaapi.c new file mode 100644 index
> > 00..9fffa0fcb9
> > --- /dev/null
> > +++ b/libavfilter/vf_overlay_vaapi.c
> > @@ -0,0 +1,424 @@
> > +/*
> > + * 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 "framesync.h"
> > +#include "formats.h"
> > +#include "internal.h"
> > +#include "vaapi_vpp.h"
> > +
> > +typedef struct OverlayVAAPIContext {
> > +VAAPIVPPContext  vpp_ctx; // must be the first field
> > +FFFrameSync  fs;
> > +int  ov

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

2019-07-07 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Mark Thompson
> Sent: Sunday, July 7, 2019 8:56 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v3] avfilter/vaapi: add overlay_vaapi 
> filter
> 
> On 20/06/2019 08:42, Zachary Zhou wrote:
> > ---
> >  configure  |   1 +
> >  libavfilter/Makefile   |   1 +
> >  libavfilter/allfilters.c   |   1 +
> >  libavfilter/vaapi_vpp.c|  95 +
> >  libavfilter/vaapi_vpp.h|   5 +
> >  libavfilter/vf_overlay_vaapi.c | 365
> > +
> >  6 files changed, 468 insertions(+)
> >  create mode 100644 libavfilter/vf_overlay_vaapi.c
> >
> > diff --git a/configure b/configure
> > index 32fc26356c..f469e6a3b1 100755
> > --- a/configure
> > +++ b/configure
> > @@ -3478,6 +3478,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"
> > diff --git a/libavfilter/Makefile b/libavfilter/Makefile index
> > 07ea8d7edc..5cbf1a7e41 100644
> > --- a/libavfilter/Makefile
> > +++ b/libavfilter/Makefile
> > @@ -311,6 +311,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_OVERLAY_QSV_FILTER)+= vf_overlay_qsv.o
> framesync.o
> > +OBJS-$(CONFIG_OVERLAY_VAAPI_FILTER)  += vf_overlay_vaapi.o
> framesync.o
> 
> and vaapi_vpp.o?

will add vaapi_vpp.o to the Makefile

> 
> (Try building the filter on its own without anything else enabled.)
> 
> >  OBJS-$(CONFIG_OWDENOISE_FILTER)  += vf_owdenoise.o
> >  OBJS-$(CONFIG_PAD_FILTER)+= vf_pad.o
> >  OBJS-$(CONFIG_PALETTEGEN_FILTER) += vf_palettegen.o
> > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index
> > 9c846b1ddd..27ee1df78b 100644
> > --- a/libavfilter/allfilters.c
> > +++ b/libavfilter/allfilters.c
> > @@ -295,6 +295,7 @@ extern AVFilter ff_vf_oscilloscope;  extern
> > AVFilter ff_vf_overlay;  extern AVFilter ff_vf_overlay_opencl;  extern
> > AVFilter ff_vf_overlay_qsv;
> > +extern AVFilter ff_vf_overlay_vaapi;
> >  extern AVFilter ff_vf_owdenoise;
> >  extern AVFilter ff_vf_pad;
> >  extern AVFilter ff_vf_palettegen;
> > diff --git a/libavfilter/vaapi_vpp.c b/libavfilter/vaapi_vpp.c index
> > b5b245c8af..a8caa5b532 100644
> > --- a/libavfilter/vaapi_vpp.c
> > +++ b/libavfilter/vaapi_vpp.c
> > @@ -663,6 +663,101 @@ fail:
> >  return err;
> >  }
> >
> > +int ff_vaapi_vpp_render_overlay(AVFilterContext *avctx,
> > +VAProcPipelineParameterBuffer *params,
> > +VAProcPipelineParameterBuffer 
> > *subpic_params,
> > +VASurfaceID output_surface) {
> > +VABufferID params_id;
> > +VABufferID subpic_params_id;
> > +VAStatus vas;
> > +int err = 0;
> > +VAAPIVPPContext *ctx   = avctx->priv;
> > +
> > +vas = vaBeginPicture(ctx->hwctx->display,
> > + ctx->va_context, output_surface);
> > +if (vas != VA_STATUS_SUCCESS) {
> > +av_log(avctx, AV_LOG_ERROR, "Failed to attach new picture: "
> > +   "%d (%s).\n", vas, vaErrorStr(vas));
> > +err = AVERROR(EIO);
> > +goto fail;
> > +}
> > +
> > +vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context,
> > + VAProcPipelineParameterBufferType,
> > + sizeof(*params), 1, params, _id);
> > +if (vas != VA_STATUS_SUCCESS) {
> > +av_log(avctx, AV_LOG_ERROR, "Failed to create parameter buffer: "
> > +   "%d (%s).\n", vas, vaErrorStr(vas));
> > +err = AVERROR(EIO);
> > +goto fail_after_begin;
> > +}
> > +av_log(avctx, AV_LOG_DEBUG, "Pipeline parameter buffer is %#x.\n",
> > +   params_id);
> > +
> > +
> > +vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context,
> > + VAProcPipelineParameterBufferType,
> > + sizeof(*subpic_params), 1, subpic_params,
> _params_id);
> > +if (vas != VA_STATUS_SUCCESS) {
> > +av_log(avctx, AV_LOG_ERROR, "Failed to create parameter buffer: "
> > +   "%d (%s).\n", vas, vaErrorStr(vas));
> > +err = AVERROR(EIO);
> > +goto fail_after_begin;
> > +}
> > +av_log(avctx, AV_LOG_DEBUG, "Pipeline subpic parameter buffer
> is %#x.\n",
> > +   subpic_params_id);
> > +
> > +vas = vaRenderPicture(ctx->hwctx->display, ctx->va_context,
> > +  _id, 1);
> > +if (vas != VA_STATUS_SUCCESS) {

Re: [FFmpeg-devel] [PATCH 2/5] lavu/hwcontext_vaapi: add vaapi_format_map for Y210/AYUV/Y410

2019-06-27 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Linjie Fu
> Sent: Friday, June 28, 2019 10:27 AM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Fu, Linjie 
> Subject: [FFmpeg-devel] [PATCH 2/5] lavu/hwcontext_vaapi: add
> vaapi_format_map for Y210/AYUV/Y410
> 
> Signed-off-by: Linjie Fu 
> ---
>  libavutil/hwcontext_vaapi.c | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index
> 4227c3c..6378d0e 100644
> --- a/libavutil/hwcontext_vaapi.c
> +++ b/libavutil/hwcontext_vaapi.c
> @@ -116,6 +116,14 @@ static const VAAPIFormatDescriptor
> vaapi_format_map[] = {  #endif
>  MAP(UYVY, YUV422,  UYVY422, 0),
>  MAP(YUY2, YUV422,  YUYV422, 0),
> +#ifdef VA_FOURCC_Y210
> +MAP(Y210, YUV422_10,Y210LE, 0),
> +#endif
> +#define VA_RT_FORMAT_AYUV VA_FOURCC_AYUV
> +MAP(AYUV,   AYUV, AYUV, 0),
> +#ifdef VA_FOURCC_Y410
> +MAP(Y410, YUV444_10,Y410LE, 0),
> +#endif
>  MAP(411P, YUV411,  YUV411P, 0),
>  MAP(422V, YUV422,  YUV440P, 0),
>  MAP(444P, YUV444,  YUV444P, 0),
> --

are you also considering to add Y210/AYUV/Y410 support in vaapi_drm_format_map 
in libavutil/hwcontext_vaapi.c ?

Thanks,
Zachary

> 2.7.4
> 
> ___
> 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/vaapi: add overlay_vaapi filter

2019-06-20 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> myp...@gmail.com
> Sent: Wednesday, June 19, 2019 9:21 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v2] avfilter/vaapi: add overlay_vaapi 
> filter
> 
> On Wed, Jun 19, 2019 at 5:26 PM Zhou, Zachary 
> wrote:
> >
> >
> >
> > > -Original Message-
> > > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> > > Behalf Of myp...@gmail.com
> > > Sent: Wednesday, June 19, 2019 10:13 AM
> > > To: FFmpeg development discussions and patches
> > > 
> > > Subject: Re: [FFmpeg-devel] [PATCH v2] avfilter/vaapi: add
> > > overlay_vaapi filter
> > >
> > >  ?
> > > On Tue, Jun 11, 2019 at 10:52 AM Zachary Zhou
> > > 
> > > wrote:
> > > >
> > > > ---
> > > >  configure  |   1 +
> > > >  libavfilter/Makefile   |   1 +
> > > >  libavfilter/allfilters.c   |   1 +
> > > >  libavfilter/vaapi_vpp.c|  95 +
> > > >  libavfilter/vaapi_vpp.h|   5 +
> > > >  libavfilter/vf_overlay_vaapi.c | 357
> > > > +
> > > >  6 files changed, 460 insertions(+)  create mode 100644
> > > > libavfilter/vf_overlay_vaapi.c
> > > >
> > > > diff --git a/configure b/configure index 32fc26356c..f469e6a3b1
> > > > 100755
> > > > --- a/configure
> > > > +++ b/configure
> > > > @@ -3478,6 +3478,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"
> > > > diff --git a/libavfilter/Makefile b/libavfilter/Makefile index
> > > > 07ea8d7edc..5cbf1a7e41 100644
> > > > --- a/libavfilter/Makefile
> > > > +++ b/libavfilter/Makefile
> > > > @@ -311,6 +311,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_OVERLAY_QSV_FILTER)+= vf_overlay_qsv.o
> > > framesync.o
> > > > +OBJS-$(CONFIG_OVERLAY_VAAPI_FILTER)  += vf_overlay_vaapi.o
> > > framesync.o
> > > >  OBJS-$(CONFIG_OWDENOISE_FILTER)  += vf_owdenoise.o
> > > >  OBJS-$(CONFIG_PAD_FILTER)+= vf_pad.o
> > > >  OBJS-$(CONFIG_PALETTEGEN_FILTER) += vf_palettegen.o
> > > > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> > > > index 9c846b1ddd..27ee1df78b 100644
> > > > --- a/libavfilter/allfilters.c
> > > > +++ b/libavfilter/allfilters.c
> > > > @@ -295,6 +295,7 @@ extern AVFilter ff_vf_oscilloscope;  extern
> > > > AVFilter ff_vf_overlay;  extern AVFilter ff_vf_overlay_opencl;
> > > > extern AVFilter ff_vf_overlay_qsv;
> > > > +extern AVFilter ff_vf_overlay_vaapi;
> > > >  extern AVFilter ff_vf_owdenoise;
> > > >  extern AVFilter ff_vf_pad;
> > > >  extern AVFilter ff_vf_palettegen; diff --git
> > > > a/libavfilter/vaapi_vpp.c b/libavfilter/vaapi_vpp.c index
> > > > b5b245c8af..a8caa5b532 100644
> > > > --- a/libavfilter/vaapi_vpp.c
> > > > +++ b/libavfilter/vaapi_vpp.c
> > > > @@ -663,6 +663,101 @@ fail:
> > > >  return err;
> > > >  }
> > > >
> > > > +int ff_vaapi_vpp_render_overlay(AVFilterContext *avctx,
> > > > +VAProcPipelineParameterBuffer *params,
> > > > +VAProcPipelineParameterBuffer 
> > > > *subpic_params,
> > > > +VASurfaceID output_surface) {
> > > > +VABufferID params_id;
> > > > +VABufferID subpic_params_id;
> > > > +VAStatus vas;
> > > > +int err = 0;
> > > > +VAAPIVPPContext *ct

Re: [FFmpeg-devel] [PATCH v2] avfilter/vaapi: add overlay_vaapi filter

2019-06-19 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> myp...@gmail.com
> Sent: Wednesday, June 19, 2019 10:13 AM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v2] avfilter/vaapi: add overlay_vaapi 
> filter
> 
>  ?
> On Tue, Jun 11, 2019 at 10:52 AM Zachary Zhou 
> wrote:
> >
> > ---
> >  configure  |   1 +
> >  libavfilter/Makefile   |   1 +
> >  libavfilter/allfilters.c   |   1 +
> >  libavfilter/vaapi_vpp.c|  95 +
> >  libavfilter/vaapi_vpp.h|   5 +
> >  libavfilter/vf_overlay_vaapi.c | 357
> > +
> >  6 files changed, 460 insertions(+)
> >  create mode 100644 libavfilter/vf_overlay_vaapi.c
> >
> > diff --git a/configure b/configure
> > index 32fc26356c..f469e6a3b1 100755
> > --- a/configure
> > +++ b/configure
> > @@ -3478,6 +3478,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"
> > diff --git a/libavfilter/Makefile b/libavfilter/Makefile index
> > 07ea8d7edc..5cbf1a7e41 100644
> > --- a/libavfilter/Makefile
> > +++ b/libavfilter/Makefile
> > @@ -311,6 +311,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_OVERLAY_QSV_FILTER)+= vf_overlay_qsv.o
> framesync.o
> > +OBJS-$(CONFIG_OVERLAY_VAAPI_FILTER)  += vf_overlay_vaapi.o
> framesync.o
> >  OBJS-$(CONFIG_OWDENOISE_FILTER)  += vf_owdenoise.o
> >  OBJS-$(CONFIG_PAD_FILTER)+= vf_pad.o
> >  OBJS-$(CONFIG_PALETTEGEN_FILTER) += vf_palettegen.o
> > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index
> > 9c846b1ddd..27ee1df78b 100644
> > --- a/libavfilter/allfilters.c
> > +++ b/libavfilter/allfilters.c
> > @@ -295,6 +295,7 @@ extern AVFilter ff_vf_oscilloscope;  extern
> > AVFilter ff_vf_overlay;  extern AVFilter ff_vf_overlay_opencl;  extern
> > AVFilter ff_vf_overlay_qsv;
> > +extern AVFilter ff_vf_overlay_vaapi;
> >  extern AVFilter ff_vf_owdenoise;
> >  extern AVFilter ff_vf_pad;
> >  extern AVFilter ff_vf_palettegen;
> > diff --git a/libavfilter/vaapi_vpp.c b/libavfilter/vaapi_vpp.c index
> > b5b245c8af..a8caa5b532 100644
> > --- a/libavfilter/vaapi_vpp.c
> > +++ b/libavfilter/vaapi_vpp.c
> > @@ -663,6 +663,101 @@ fail:
> >  return err;
> >  }
> >
> > +int ff_vaapi_vpp_render_overlay(AVFilterContext *avctx,
> > +VAProcPipelineParameterBuffer *params,
> > +VAProcPipelineParameterBuffer 
> > *subpic_params,
> > +VASurfaceID output_surface) {
> > +VABufferID params_id;
> > +VABufferID subpic_params_id;
> > +VAStatus vas;
> > +int err = 0;
> > +VAAPIVPPContext *ctx   = avctx->priv;
> > +
> > +vas = vaBeginPicture(ctx->hwctx->display,
> > + ctx->va_context, output_surface);
> > +if (vas != VA_STATUS_SUCCESS) {
> > +av_log(avctx, AV_LOG_ERROR, "Failed to attach new picture: "
> > +   "%d (%s).\n", vas, vaErrorStr(vas));
> > +err = AVERROR(EIO);
> > +goto fail;
> > +}
> > +
> > +vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context,
> > + VAProcPipelineParameterBufferType,
> > + sizeof(*params), 1, params, _id);
> > +if (vas != VA_STATUS_SUCCESS) {
> > +av_log(avctx, AV_LOG_ERROR, "Failed to create parameter buffer: "
> > +   "%d (%s).\n", vas, vaErrorStr(vas));
> > +err = AVERROR(EIO);
> > +goto fail_after_begin;
> > +}
> > +av_log(avctx, AV_LOG_DEBUG, "Pipeline parameter buffer is %#x.\n",
> > +   params_id);
> > +
> > +
> > +vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context,
> > + VAProcPipelineParameterBufferType,
> > + sizeof(*subpic_params), 1, subpic_params,
> _params_id);
> > +if (vas != VA_STATUS_SUCCESS) {
> > +av_log(avctx, AV_LOG_ERROR, "Failed to create parameter buffer: "
> > +   "%d (%s).\n", vas, vaErrorStr(vas));
> > +err = AVERROR(EIO);
> > +goto fail_after_begin;
> > +}
> > +av_log(avctx, AV_LOG_DEBUG, "Pipeline subpic parameter buffer
> is %#x.\n",
> > +   subpic_params_id);
> > +
> > +vas = vaRenderPicture(ctx->hwctx->display, ctx->va_context,
> > +  _id, 1);
> > +if (vas != VA_STATUS_SUCCESS) {
> > +av_log(avctx, AV_LOG_ERROR, "Failed to render parameter buffer: "
> > + 

Re: [FFmpeg-devel] [PATCH v2] avfilter/vaapi: add overlay_vaapi filter

2019-06-18 Thread Zhou, Zachary
> -Original Message-
> From: Zhou, Zachary
> Sent: Tuesday, June 11, 2019 10:52 AM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Zhou, Zachary 
> Subject: [PATCH v2] avfilter/vaapi: add overlay_vaapi filter
> 
> ---
>  configure  |   1 +
>  libavfilter/Makefile   |   1 +
>  libavfilter/allfilters.c   |   1 +
>  libavfilter/vaapi_vpp.c|  95 +
>  libavfilter/vaapi_vpp.h|   5 +
>  libavfilter/vf_overlay_vaapi.c | 357 +
>  6 files changed, 460 insertions(+)
>  create mode 100644 libavfilter/vf_overlay_vaapi.c
> 

Hi Mark,

Can you help to review this patch ?

Thanks
Zachary
___
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/vaapi: add overlay_vaapi filter

2019-06-10 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Michael Niedermayer
> Sent: Tuesday, June 11, 2019 4:50 AM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v1] avfilter/vaapi: add overlay_vaapi 
> filter
> 
> On Mon, Jun 10, 2019 at 01:24:29PM +0800, Zachary Zhou wrote:
> > ---
> >  configure  |   1 +
> >  libavfilter/Makefile   |   1 +
> >  libavfilter/allfilters.c   |   1 +
> >  libavfilter/vaapi_vpp.c|  95 +
> >  libavfilter/vaapi_vpp.h|   5 +
> >  libavfilter/vf_overlay_vaapi.c | 352
> > +
> >  6 files changed, 455 insertions(+)
> >  create mode 100644 libavfilter/vf_overlay_vaapi.c
> 
> breaks build
> 
> CClibavfilter/vf_overlay_vaapi.o
> libavfilter/vf_overlay_vaapi.c:32:1: error: unknown type name ‘VABlendState’
>  static VABlendState blend_state = { /** \brief Video blending flags. */  ^
> libavfilter/vf_overlay_vaapi.c:33:5: error: field name not in record or union
> initializer
>  .flags= VA_BLEND_PREMULTIPLIED_ALPHA,
> //VA_BLEND_GLOBAL_ALPHA,
>  ^
> libavfilter/vf_overlay_vaapi.c:33:5: error: (near initialization for 
> ‘blend_state’)
> libavfilter/vf_overlay_vaapi.c:33:14: error:
> ‘VA_BLEND_PREMULTIPLIED_ALPHA’ undeclared here (not in a function)
>  .flags= VA_BLEND_PREMULTIPLIED_ALPHA,
> //VA_BLEND_GLOBAL_ALPHA,
>   ^
> libavfilter/vf_overlay_vaapi.c:34:5: error: field name not in record or union
> initializer
>  .global_alpha = 1,
>  ^
> libavfilter/vf_overlay_vaapi.c:34:5: error: (near initialization for 
> ‘blend_state’)
> libavfilter/vf_overlay_vaapi.c:34:5: warning: excess elements in scalar
> initializer [enabled by default]
> libavfilter/vf_overlay_vaapi.c:34:5: warning: (near initialization for
> ‘blend_state’) [enabled by default]
> libavfilter/vf_overlay_vaapi.c:35:5: error: field name not in record or union
> initializer
>  .min_luma = 0,
>  ^
> libavfilter/vf_overlay_vaapi.c:35:5: error: (near initialization for 
> ‘blend_state’)
> libavfilter/vf_overlay_vaapi.c:35:5: warning: excess elements in scalar
> initializer [enabled by default]
> libavfilter/vf_overlay_vaapi.c:35:5: warning: (near initialization for
> ‘blend_state’) [enabled by default]
> libavfilter/vf_overlay_vaapi.c:36:5: error: field name not in record or union
> initializer
>  .max_luma = 1
>  ^
> libavfilter/vf_overlay_vaapi.c:36:5: error: (near initialization for 
> ‘blend_state’)
> libavfilter/vf_overlay_vaapi.c:37:1: warning: excess elements in scalar
> initializer [enabled by default]  };  ^
> libavfilter/vf_overlay_vaapi.c:37:1: warning: (near initialization for
> ‘blend_state’) [enabled by default]
> libavfilter/vf_overlay_vaapi.c: In function ‘overlay_vaapi_blend’:
> libavfilter/vf_overlay_vaapi.c:186:16: error: request for member 
> ‘global_alpha’
> in something not a structure or union
>  blend_state.global_alpha = ctx->overlay_alpha;
> ^
> libavfilter/vf_overlay_vaapi.c:187:18: error: ‘VAProcPipelineParameterBuffer’
> has no member named ‘blend_state’
>  subpic_params.blend_state = _state;
>   ^
> make: *** [libavfilter/vf_overlay_vaapi.o] Error 1
> make: Target `all' not remade because of errors.

Thanks Michael for the check, added #if VA_CHECK_VERSION(2, 1, 0) in code, and 
sent out the v2 version of the patch.

Thanks,
Zachary

> 
> [...]
> --
> Michael GnuPG fingerprint:
> 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> I have often repented speaking, but never of holding my tongue.
> -- Xenocrates
___
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 RFC v2 2/3] libavcodec: Add thumbnail output to vaapi_h264 decoder

2019-04-11 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Li, Zhong
> Sent: Wednesday, April 10, 2019 10:14 AM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH RFC v2 2/3] libavcodec: Add thumbnail
> output to vaapi_h264 decoder
> 
> > As my investigation -
> > - This feature can save some power and memory bandwidth.
> > - This feature can save the ffmpeg filters code writing for end user.
> > it also support ARGB output for some AI use case, I think some AI
> > cases may need ARGB input.
> 
> IIUC, vaapi SFC scaling in libavfilter path should can support ARGB output 
> too,
> am I wrong?

Thanks Zhong,  ffmpeg should can do it. but iHD driver has an issue -
https://github.com/intel/media-driver/issues/500

and I think ffmpeg may do following changes or iHD support ARGB in vaPutimage 
and vaGetImage.

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index e60a8f4d34..caa6d02b15 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -855,7 +855,7 @@ static int vaapi_map_frame(AVHWFramesContext *hwfc,
 // assume for now that the user is not aware of that and would therefore
 // prefer not to be given direct-mapped memory if they request read access.
 if (ctx->derive_works && dst->format == hwfc->sw_format &&
-((flags & AV_HWFRAME_MAP_DIRECT) || !(flags & AV_HWFRAME_MAP_READ))) {
+((flags & AV_HWFRAME_MAP_DIRECT) || (flags & AV_HWFRAME_MAP_READ))) {
 vas = vaDeriveImage(hwctx->display, surface_id, >image);
 if (vas != VA_STATUS_SUCCESS) {
 av_log(hwfc, AV_LOG_ERROR, "Failed to derive image from "


-Zach


> 
> ___
> 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 RFC v2 2/3] libavcodec: Add thumbnail output to vaapi_h264 decoder

2019-04-09 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Mark Thompson
> Sent: Wednesday, April 10, 2019 6:27 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH RFC v2 2/3] libavcodec: Add thumbnail
> output to vaapi_h264 decoder
> 
> On 08/04/2019 09:53, Zachary Zhou wrote:
> > This is sample code for reference
> >
> > HW support for decode+scaling in a single HW command (VDBOX+SFC).
> > The primary target usage is video analytics, but can be used playback,
> > transcoding, etc.
> >
> > For VAAPI -
> > https://github.com/intel/libva
> > basically, it allows multiple outputs (in different resolutions) using the
> decode context in a single call (you can search for “additional_outputs” in
> va.h).
> >
> > VAAPI sample code -
> > https://github.com/intel/libva-utils/commit/957a269f02b00760b7e807643c
> > 821ee26abc529b
> > ---
> >  libavcodec/avcodec.h   |   8 +++
> >  libavcodec/decode.c|  16 +
> >  libavcodec/options_table.h |   4 ++
> >  libavcodec/vaapi_decode.c  | 122
> > ++---
> >  libavcodec/vaapi_decode.h  |  30 +
> >  libavcodec/vaapi_h264.c|  13 
> >  6 files changed, 185 insertions(+), 8 deletions(-)
> 
> This doesn't fit into the libavcodec API at all.  If it is desirable to have 
> some
> sort of generic multiple-output mechanism in libavcodec, please open a
> separate discussion considering that API specifically.
> 
> For the particular hardware instance you are talking about here, can you
> explain what this mechanism actually helps with?  My understanding was that
> the VDBOX / SFC chaining existed to save a small amount of power in
> restricted playback cases going directly to the display (that is, for 
> maximising
> playback time on battery devices).  Since you are writing everything back to
> memory immediately here anyway, I don't see how it helps compared to just
> doing the scale as a filter operation.
> 
> - Mark

Thanks Mark, I understand it doesn't fit the libavcodec API currently, and I 
will open a discussion regarding multiple-output mechanism in libavcodec.

you may already know following document -
https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-skl-vol15-sfc.pdf

As my investigation -
- This feature can save some power and memory bandwidth. 
- This feature can save the ffmpeg filters code writing for end user. it also 
support ARGB output for some AI use case, I think some AI cases may need ARGB 
input.

-Zach

> ___
> 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 RFC v2 3/3] libavutil: Add thumbnail output to vaapi_h264 decoder

2019-04-09 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Carl Eugen Hoyos
> Sent: Tuesday, April 9, 2019 9:27 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH RFC v2 3/3] libavutil: Add thumbnail
> output to vaapi_h264 decoder
> 
> 2019-04-08 10:53 GMT+02:00, Zachary Zhou :
> > This is sample code for reference
> >
> > HW support for decode+scaling in a single HW command (VDBOX+SFC).
> 
> > The primary target usage is video analytics, but can be used playback,
> > transcoding, etc.
> 
> Yes.
> So why is the feature called "thumbnail"?
> I understand that this is one use case, but this is actually about free 
> scaling, no?
> 
> Carl Eugen

Thanks Carl Eugen.
Yes, thumbnail is one use case, and I think it may be more common.
SFC fix function in GPU does the scaling, It supports both down scaling and up 
scaling.

To be honest, SFC scaling range is [0.125, 8] for both X and Y direction 
currently.
https://github.com/intel/media-driver/blob/master/media_driver/agnostic/common/codec/hal/codechal_decode_sfc.cpp#L823

-Zach

> ___
> 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 RFC v2 2/3] libavcodec: Add thumbnail output to vaapi_h264 decoder

2019-04-09 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Hendrik Leppkes
> Sent: Monday, April 8, 2019 5:27 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH RFC v2 2/3] libavcodec: Add thumbnail
> output to vaapi_h264 decoder
> 
> On Mon, Apr 8, 2019 at 10:54 AM Zachary Zhou 
> wrote:
> >
> > This is sample code for reference
> >
> > HW support for decode+scaling in a single HW command (VDBOX+SFC).
> > The primary target usage is video analytics, but can be used playback,
> > transcoding, etc.
> >
> > For VAAPI -
> > https://github.com/intel/libva
> > basically, it allows multiple outputs (in different resolutions) using the
> decode context in a single call (you can search for “additional_outputs” in
> va.h).
> >
> > VAAPI sample code -
> > https://github.com/intel/libva-utils/commit/957a269f02b00760b7e807643c
> > 821ee26abc529b
> > ---
> >  libavcodec/avcodec.h   |   8 +++
> >  libavcodec/decode.c|  16 +
> >  libavcodec/options_table.h |   4 ++
> >  libavcodec/vaapi_decode.c  | 122
> > ++---
> >  libavcodec/vaapi_decode.h  |  30 +
> >  libavcodec/vaapi_h264.c|  13 
> >  6 files changed, 185 insertions(+), 8 deletions(-)
> >
> > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index
> > 0ce22ec4fa..36db21c0a5 100644
> > --- a/libavcodec/avcodec.h
> > +++ b/libavcodec/avcodec.h
> > @@ -3357,6 +3357,14 @@ typedef struct AVCodecContext {
> >   * - encoding: unused
> >   */
> >  int discard_damaged_percentage;
> > +
> > +/*
> > + * Thumbnail options
> > + */
> > +int thumbnail_flags;
> > +int thumbnail_format;
> > +int thumbnail_width;
> > +int thumbnail_height;
> >  } AVCodecContext;
> >
> 
> Global fields for such a purpose seem not appropriate. We try to get away
> from fields that only serve a single purpose with a single decoder. Nevermind
> that they aren't even documented.
> 
> In general I must say I'm not sure I like this entire patchset. We have
> component seperation for a reason, so trying to add magic features like that 
> is
> generally a bad idea.
> 
> - Hendrik

Thanks Hendrik for the comments. 
currently I didn't find any good places to set input parameters for decoder, in 
this feature I think the end user may want to set the scaling size and out 
format. 
And I don't know if ffmpeg will add better decoder input parameters control in 
future.
This feature will also save the scaling filter code writing for the end user.

-Zach 

> ___
> 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 2/3] libavcodec: Add thumbnail output to vaapi_h264 decoder

2019-04-08 Thread Zhou, Zachary


> -Original Message-
> From: Zhou, Zachary
> Sent: Monday, April 8, 2019 3:10 PM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Zhou, Zachary 
> Subject: [PATCH v1 2/3] libavcodec: Add thumbnail output to vaapi_h264
> decoder
> 
> This is sample code for reference
> 
> HW support for decode+scaling in a single HW command (VDBOX+SFC).
> The primary target usage is video analytics, but can be used playback,
> transcoding, etc.
> 
> For VAAPI -
> https://github.com/intel/libva
> basically, it allows multiple outputs (in different resolutions) using the 
> decode
> context in a single call (you can search for “additional_outputs” in va.h).
> 
> VAAPI sample code -
> https://github.com/intel/libva-
> utils/commit/957a269f02b00760b7e807643c821ee26abc529b
> ---
>  libavcodec/avcodec.h   |   8 +++
>  libavcodec/decode.c|  16 +
>  libavcodec/options_table.h |   4 ++
>  libavcodec/vaapi_decode.c  | 122 ++---
>  libavcodec/vaapi_decode.h  |  30 +
>  libavcodec/vaapi_h264.c|  13 
>  6 files changed, 185 insertions(+), 8 deletions(-)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index
> 0ce22ec4fa..86ab18011c 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -3357,6 +3357,14 @@ typedef struct AVCodecContext {
>   * - encoding: unused
>   */
>  int discard_damaged_percentage;
> +
> +/*
> + * VDSFC options
> + */
> +int sfc_flags;
> +int sfc_format;
> +int sfc_width;
> +int sfc_height;
>  } AVCodecContext;
> 
>  #if FF_API_CODEC_GET_SET
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c index
> a32ff2fcd3..df5f5b6eed 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -1795,6 +1795,22 @@ FF_ENABLE_DEPRECATION_WARNINGS
>  frame->channels = avctx->channels;
>  break;
>  }
> +
> +//sfc side data
> +if (avctx->sfc_flags) {
> +AVFrameSideData *frame_sfc_sd = av_frame_new_side_data(frame,
> +   
> AV_FRAME_DATA_SFC_INFO,
> +   
> sizeof(AVSFCInfo));
> +if (frame_sfc_sd) {
> +av_dict_set_int(_sfc_sd->metadata, "sfc_flags", avctx-
> >sfc_flags, 0);
> +av_dict_set_int(_sfc_sd->metadata, "sfc_width", avctx-
> >sfc_width, 0);
> +av_dict_set_int(_sfc_sd->metadata, "sfc_height", avctx-
> >sfc_height, 0);
> +av_dict_set_int(_sfc_sd->metadata, "sfc_format",
> + avctx->sfc_format, 0);
> +
> +av_log(avctx, AV_LOG_DEBUG, "VDSFC new side data\n");
> +}
> +}
> +
>  return 0;
>  }
> 
> diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index
> a3235bcd57..c14ff08678 100644
> --- a/libavcodec/options_table.h
> +++ b/libavcodec/options_table.h
> @@ -480,6 +480,10 @@ static const AVOption avcodec_options[] =
> {  {"allow_profile_mismatch", "attempt to decode anyway if HW accelerated
> decoder's supported profiles do not exactly match the stream", 0,
> AV_OPT_TYPE_CONST, {.i64 =
> AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH }, INT_MIN, INT_MAX, V |
> D, "hwaccel_flags"},  {"extra_hw_frames", "Number of extra hardware frames
> to allocate for the user", OFFSET(extra_hw_frames), AV_OPT_TYPE_INT, { .i64
> = -1 }, -1, INT_MAX, V|D },  {"discard_damaged_percentage", "Percentage of
> damaged samples to discard a frame", OFFSET(discard_damaged_percentage),
> AV_OPT_TYPE_INT, {.i64 = 95 }, 0, 100, V|D },
> +{"sfc_flags", "set sfc flags", OFFSET(sfc_flags), AV_OPT_TYPE_INT, {
> +.i64 = 1 }, 0, 1, V|D, "sfc"}, {"sfc_format", "set sfc format",
> +OFFSET(sfc_format), AV_OPT_TYPE_PIXEL_FMT, {.i64=AV_PIX_FMT_ARGB}, -
> 1,
> +INT_MAX, V|D, "sfc"}, {"sfc_width", "set sfc width", OFFSET(sfc_width),
> +AV_OPT_TYPE_INT, {.i64 = 480}, 0, INT_MAX, V|D, "sfc"}, {"sfc_height",
> +"set sfc height", OFFSET(sfc_height), AV_OPT_TYPE_INT, {.i64 = 360}, 0,
> +INT_MAX, V|D, "sfc"},
>  {NULL},
>  };
> 
> diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c index
> 69512e1d45..2917ee951e 100644
> --- a/libavcodec/vaapi_decode.c
> +++ b/libavcodec/vaapi_decode.c
> @@ -145,6 +145,17 @@ static void
> ff_vaapi_decode_destroy_buffers(AVCodecContext *avctx,
> pic->slice_buffers[i], vas, vaErrorStr(vas));
>   

Re: [FFmpeg-devel] [PATCH v1 3/3] libavutil: Add thumbnail output to vaapi_h264 decoder

2019-04-08 Thread Zhou, Zachary


> -Original Message-
> From: Zhou, Zachary
> Sent: Monday, April 8, 2019 3:10 PM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Zhou, Zachary 
> Subject: [PATCH v1 3/3] libavutil: Add thumbnail output to vaapi_h264
> decoder
> 
> This is sample code for reference
> 
> HW support for decode+scaling in a single HW command (VDBOX+SFC).
> The primary target usage is video analytics, but can be used playback,
> transcoding, etc.
> 
> For VAAPI -
> https://github.com/intel/libva
> basically, it allows multiple outputs (in different resolutions) using the 
> decode
> context in a single call (you can search for “additional_outputs” in va.h).
> 
> VAAPI sample code -
> https://github.com/intel/libva-
> utils/commit/957a269f02b00760b7e807643c821ee26abc529b
> ---
>  libavutil/frame.c   |  1 +
>  libavutil/frame.h   | 13 +++
>  libavutil/hwcontext_vaapi.c | 73 -
>  libavutil/hwcontext_vaapi.h |  6 +++
>  4 files changed, 92 insertions(+), 1 deletion(-)
> 
> diff --git a/libavutil/frame.c b/libavutil/frame.c index 
> dcf1fc3d17..aa9cd744ae
> 100644
> --- a/libavutil/frame.c
> +++ b/libavutil/frame.c
> @@ -842,6 +842,7 @@ const char *av_frame_side_data_name(enum
> AVFrameSideDataType type)  #endif
>  case AV_FRAME_DATA_DYNAMIC_HDR_PLUS: return "HDR Dynamic
> Metadata SMPTE2094-40 (HDR10+)";
>  case AV_FRAME_DATA_REGIONS_OF_INTEREST: return "Regions Of
> Interest";
> +case AV_FRAME_DATA_SFC_INFO: return "SFC Information";
>  }
>  return NULL;
>  }
> diff --git a/libavutil/frame.h b/libavutil/frame.h index
> 8aa3e88367..616e7d9d4e 100644
> --- a/libavutil/frame.h
> +++ b/libavutil/frame.h
> @@ -179,6 +179,11 @@ enum AVFrameSideDataType {
>   * array element is implied by AVFrameSideData.size /
> AVRegionOfInterest.self_size.
>   */
>  AV_FRAME_DATA_REGIONS_OF_INTEREST,
> +
> +/**
> + * VDENC SFC information.
> + */
> +AV_FRAME_DATA_SFC_INFO,
>  };
> 
>  enum AVActiveFormatDescription {
> @@ -235,6 +240,14 @@ typedef struct AVRegionOfInterest {
>  AVRational qoffset;
>  } AVRegionOfInterest;
> 
> +/**
> + * Structure to hold Information of SFC.
> + *
> + */
> +typedef struct AVSFCInfo {
> +uint8_t *data;
> +} AVSFCInfo;
> +
>  /**
>   * This structure describes decoded (raw) audio or video data.
>   *
> diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index
> 8624369bb9..caa6d02b15 100644
> --- a/libavutil/hwcontext_vaapi.c
> +++ b/libavutil/hwcontext_vaapi.c
> @@ -642,8 +642,74 @@ static void
> vaapi_frames_uninit(AVHWFramesContext *hwfc)
>  av_freep(>attributes);
>  }
> 
> +static int vaapi_get_sfc_buffer(AVHWFramesContext *hwfc, AVFrame
> +*frame) {
> +AVVAAPIFramesContext *avfc = hwfc->hwctx;
> +AVFrameSideData *frame_sfc_sd = av_frame_get_side_data(frame,
> +   
> AV_FRAME_DATA_SFC_INFO);
> +if (frame_sfc_sd) {
> +AVVAAPIDeviceContext *hwctx = hwfc->device_ctx->hwctx;
> +VASurfaceID sfc_surface_id;
> +VASurfaceAttrib attrib;
> +unsigned int rt_format;
> +AVBufferRef *ref;
> +VAStatus vas;
> +
> +memset(, 0, sizeof(attrib));
> +attrib.type = VASurfaceAttribPixelFormat;
> +attrib.flags = VA_SURFACE_ATTRIB_SETTABLE;
> +attrib.value.type = VAGenericValueTypeInteger;
> +
> +switch (avfc->sfc_format) {
> +case AV_PIX_FMT_NV12:
> +attrib.value.value.i = VA_FOURCC_NV12;
> +rt_format = VA_RT_FORMAT_YUV420;
> +break;
> +case AV_PIX_FMT_ARGB:
> +attrib.value.value.i = VA_FOURCC_ARGB;
> +rt_format = VA_RT_FORMAT_RGB32;
> +break;
> +default:
> +av_log(hwfc, AV_LOG_ERROR, "Unknown sfc format: %d\n", avfc-
> >sfc_format);
> +return AVERROR(EINVAL);
> +}
> +
> +vas = vaCreateSurfaces(hwctx->display, rt_format,
> +   avfc->sfc_width, avfc->sfc_height,
> +   _surface_id, 1,
> +   , 1);
> +if (vas != VA_STATUS_SUCCESS) {
> +av_log(hwfc, AV_LOG_ERROR, "Failed to create sfc surface: "
> +   "%d (%s).\n", vas, vaErrorStr(vas));
> +return AVERROR(EIO);
> +}
> +
> +av_log(hwfc, AV_LOG_DEBUG, "Created sfc surface %#x. sfc_format(%d),
> w(%d), h(%d)\n",
> +   sfc_surfa

Re: [FFmpeg-devel] [PATCH v1 1/3] fftools: Add thumbnail output to vaapi_h264 decoder

2019-04-08 Thread Zhou, Zachary


> -Original Message-
> From: Zhou, Zachary
> Sent: Monday, April 8, 2019 3:10 PM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Zhou, Zachary 
> Subject: [PATCH v1 1/3] fftools: Add thumbnail output to vaapi_h264 decoder
> 
> This is sample code for reference
> 
> HW support for decode+scaling in a single HW command (VDBOX+SFC).
> The primary target usage is video analytics, but can be used playback,
> transcoding, etc.
> 
> For VAAPI -
> https://github.com/intel/libva
> basically, it allows multiple outputs (in different resolutions) using the 
> decode
> context in a single call (you can search for “additional_outputs” in va.h).
> 
> VAAPI sample code -
> https://github.com/intel/libva-
> utils/commit/957a269f02b00760b7e807643c821ee26abc529b
> ---
>  fftools/ffmpeg_opt.c | 28 
>  1 file changed, 28 insertions(+)
> 
> diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index
> 53d688b764..bfb0f882b5 100644
> --- a/fftools/ffmpeg_opt.c
> +++ b/fftools/ffmpeg_opt.c
> @@ -111,6 +111,10 @@ int filter_nbthreads = 0;  int
> filter_complex_nbthreads = 0;  int vstats_version = 2;
> 
> +int sfc_flags = 0;
> +int sfc_width = 0;
> +int sfc_height = 0;
> +char *sfc_format;
> 
>  static int intra_only = 0;
>  static int file_overwrite = 0;
> @@ -1100,6 +1104,13 @@ static int open_input_file(OptionsContext *o,
> const char *filename)
>  av_dict_set(>g->format_opts, "scan_all_pmts", "1",
> AV_DICT_DONT_OVERWRITE);
>  scan_all_pmts_set = 1;
>  }
> +
> +//sfc opt
> +av_dict_set_int(>g->codec_opts, "sfc_flags", sfc_flags,
> AV_DICT_DONT_OVERWRITE);
> +av_dict_set_int(>g->codec_opts, "sfc_width", sfc_width,
> AV_DICT_DONT_OVERWRITE);
> +av_dict_set_int(>g->codec_opts, "sfc_height", sfc_height,
> AV_DICT_DONT_OVERWRITE);
> +av_dict_set(>g->codec_opts, "sfc_format", sfc_format,
> + AV_DICT_DONT_OVERWRITE);
> +
>  /* open the input file with generic avformat function */
>  err = avformat_open_input(, filename, file_iformat, >g-
> >format_opts);
>  if (err < 0) {
> @@ -2898,6 +2909,13 @@ static int opt_vstats_file(void *optctx, const char
> *opt, const char *arg)
>  return 0;
>  }
> 
> +static int opt_sfc_format(void *optctx, const char *opt, const char
> +*arg) {
> +av_free (sfc_format);
> +sfc_format = av_strdup (arg);
> +return 0;
> +}
> +
>  static int opt_vstats(void *optctx, const char *opt, const char *arg)  {
>  char filename[40];
> @@ -3746,5 +3764,15 @@ const OptionDef options[] = {
>  { "filter_hw_device", HAS_ARG | OPT_EXPERT, { .func_arg =
> opt_filter_hw_device },
>  "set hardware device used when filtering", "device" },
> 
> +//sfc opt
> +{ "sfc_flags",OPT_VIDEO | HAS_ARG | OPT_INT | OPT_INPUT,
> { _flags },
> +  "set sfc flags", "sfc" },
> +{ "sfc_width",OPT_VIDEO | HAS_ARG | OPT_INT | OPT_INPUT,
> { _width },
> +  "set sfc width", "sfc" },
> +{ "sfc_height",   OPT_VIDEO | HAS_ARG | OPT_INT | OPT_INPUT,
> { _height },
> +  "set sfc height", "sfc" },
> +{ "sfc_format",  OPT_VIDEO | HAS_ARG | OPT_EXPERT ,  { .func_arg =
> opt_sfc_format },
> +"set sfc format", "sfc" },
> +
>  { NULL, },
>  };

Please ignore this patch, new version will be send out soon.
Sorry for inconvenience. 


> --
> 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 V9] libavfilter: add transpose_vaapi filter

2019-01-16 Thread Zhou, Zachary


> -Original Message-
> From: Guo, Yejun
> Sent: Thursday, January 17, 2019 9:29 AM
> To: FFmpeg development discussions and patches 
> Cc: Zhou, Zachary 
> Subject: RE: [FFmpeg-devel] [PATCH V9] libavfilter: add transpose_vaapi filter
> 
> 
> 
> > -Original Message-
> > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> > Of Zachary Zhou
> > Sent: Wednesday, January 16, 2019 3:05 PM
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Zhou, Zachary 
> > Subject: [FFmpeg-devel] [PATCH V9] libavfilter: add transpose_vaapi
> > filter
> >
> > Swap width and height when do clock/cclock rotation Add
> > reversal/hflip/vflip 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/transpose.h  |   3 +
> >  libavfilter/vf_transpose_vaapi.c | 334
> > +++
> >  5 files changed, 341 insertions(+)
> >  create mode 100644 libavfilter/vf_transpose_vaapi.c
> >
> > diff --git a/configure b/configure
> > index 2205751402..bf0e435b53 100755
> > --- a/configure
> > +++ b/configure
> > @@ -3482,6 +3482,7 @@ tinterlace_pad_test_deps="tinterlace_filter"
> >  tonemap_filter_deps="const_nan"
> >  tonemap_opencl_filter_deps="opencl const_nan"
> >  transpose_opencl_filter_deps="opencl"
> > +transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags"
> >  unsharp_opencl_filter_deps="opencl"
> >  uspp_filter_deps="gpl avcodec"
> >  vaguedenoiser_filter_deps="gpl"
> > @@ -5985,6 +5986,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
> > 6e2658186d..4246d3480f 100644
> > --- a/libavfilter/Makefile
> > +++ b/libavfilter/Makefile
> > @@ -394,6 +394,7 @@ 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_OPENCL_FILTER)   +=
> > vf_transpose_opencl.o opencl.o opencl/transpose.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
> > a600069500..0b82ff7ced 100644
> > --- a/libavfilter/allfilters.c
> > +++ b/libavfilter/allfilters.c
> > @@ -373,6 +373,7 @@ extern AVFilter ff_vf_tpad;  extern AVFilter
> > ff_vf_transpose;  extern AVFilter ff_vf_transpose_npp;  extern
> > AVFilter ff_vf_transpose_opencl;
> > +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/transpose.h b/libavfilter/transpose.h index
> > d4bb4da1ae..aa262b9487 100644
> > --- a/libavfilter/transpose.h
> > +++ b/libavfilter/transpose.h
> > @@ -29,6 +29,9 @@ enum TransposeDir {
> >  TRANSPOSE_CLOCK,
> >  TRANSPOSE_CCLOCK,
> >  TRANSPOSE_CLOCK_FLIP,
> > +TRANSPOSE_REVERSAL,// rotate by half-turn
> > +TRANSPOSE_HFLIP,
> > +TRANSPOSE_VFLIP,
> >  };
> >
> >  #endif
> > diff --git a/libavfilter/vf_transpose_vaapi.c
> > b/libavfilter/vf_transpose_vaapi.c
&

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

2019-01-03 Thread Zhou, Zachary


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

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

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

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

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

RGB10 is R10G10B10A2
RGB8 is ARGB

I will add more to the document.

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

I will add units to document.

> 
> > +
> > +@end table
> > +
> > +@subsection Example
> > +
> > +@itemize
> > +@item
> > +Convert HDR video to HDR video from p010 format to rgb10 format.
> > +@example
> > +-i INPUT -vf
> >
> +"tonemap_vaapi=h2h:display=G(13250|34500)B(7500|3000)R(34000|16000)
> WP
> > +(15635|16450)L(2000|2000):light=CLL(1)FALL(1000)" OUTPUT @end
> > +example @item Convert HDR video to SDR video from p010 format to rgb8
> format.
> > +@example
> > +-i INPUT -vf "tonemap_vaapi=h2s" OUTPUT @end example @end itemize
> > +
> >  @section unsharp_opencl
> >
> >  Sharpen or blur the input video.
> > diff --git a/libavfilter/Makefile b/libavfilter/Makefile index
> > 6e2658186d..f6894209d1 100644
> > --- a/libavfilter/Makefile
> > +++ b/libavfilter/Makefile
> > @@ -390,6 +390,7 @@ OBJS-$(CONFIG_TMIX_FILTER)   += vf_mix.o
> framesync.o
> >  OBJS-$(CONFIG_TONEMAP_FILTER) 

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

2019-01-02 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Mark Thompson
> Sent: Monday, December 31, 2018 2:06 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH V7] libavfilter: add transpose_vaapi filter
> 
> On 25/12/2018 06:16, Zachary Zhou wrote:
> > Swap width and height when do clock/cclock rotation Add
> > reversal/reversal_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/transpose.h  |   2 +
> >  libavfilter/vf_transpose_vaapi.c | 338
> > +++
> >  5 files changed, 344 insertions(+)
> >  create mode 100644 libavfilter/vf_transpose_vaapi.c
> >
> > diff --git a/configure b/configure
> > index be49c19b88..04ee671a60 100755
> > --- a/configure
> > +++ b/configure
> > @@ -3481,6 +3481,7 @@ tinterlace_pad_test_deps="tinterlace_filter"
> >  tonemap_filter_deps="const_nan"
> >  tonemap_opencl_filter_deps="opencl const_nan"
> >  transpose_opencl_filter_deps="opencl"
> > +transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags"
> >  unsharp_opencl_filter_deps="opencl"
> >  uspp_filter_deps="gpl avcodec"
> >  vaguedenoiser_filter_deps="gpl"
> > @@ -5984,6 +5985,7 @@ check_type "d3d9.h dxva2api.h"
> > DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
> >
> >  check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC"
> >  check_struct "va/va.h" "VADecPictureParameterBufferVP9" bit_depth
> > +check_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
> > 6e2658186d..4246d3480f 100644
> > --- a/libavfilter/Makefile
> > +++ b/libavfilter/Makefile
> > @@ -394,6 +394,7 @@ 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_OPENCL_FILTER)   += vf_transpose_opencl.o
> opencl.o opencl/transpose.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
> > a600069500..0b82ff7ced 100644
> > --- a/libavfilter/allfilters.c
> > +++ b/libavfilter/allfilters.c
> > @@ -373,6 +373,7 @@ extern AVFilter ff_vf_tpad;  extern AVFilter
> > ff_vf_transpose;  extern AVFilter ff_vf_transpose_npp;  extern
> > AVFilter ff_vf_transpose_opencl;
> > +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/transpose.h b/libavfilter/transpose.h index
> > d4bb4da1ae..87936d0512 100644
> > --- a/libavfilter/transpose.h
> > +++ b/libavfilter/transpose.h
> > @@ -29,6 +29,8 @@ enum TransposeDir {
> >  TRANSPOSE_CLOCK,
> >  TRANSPOSE_CCLOCK,
> >  TRANSPOSE_CLOCK_FLIP,
> > +TRANSPOSE_REVERSAL,
> > +TRANSPOSE_REVERSAL_FLIP,
> 
> Add the missing element of D_4 here.
> 
> It's not obvious that reversal is "rotate by half-turn" rather than some sort 
> of
> flip, maybe a comment.
> 
> I think calling the others "HFLIP"/"VFLIP" to match the standalone filters 
> would
> be clearer, too.

I am try to adding following -
enum TransposeDir {
  
+TRANSPOSE_REVERSAL,   // rotate by half-turn
+TRANSPOSE_HFLIP,
+TRANSPOSE_VFLIP,
}


> 
> >  };
> >
> >  #endif
> > diff --git a/libavfilter/vf_transpose_vaapi.c
> > b/libavfilter/vf_transpose_vaapi.c
> > new file mode 100644
> > index 00..1c7bb0c1a7
> > --- /dev/null
> > +++ b/libavfilter/vf_transpose_vaapi.c
> > @@ -0,0 +1,338 @@
> > +/*
> > + * 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
> > + * 

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

2018-12-28 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Moritz Barsnick
> Sent: Thursday, December 27, 2018 8:47 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH V2] avfilter: Add tonemap vaapi filter
> 
> On Thu, Dec 27, 2018 at 16:55:17 +0800, Zachary Zhou wrote:
> > +typedef enum {
> > +HDR_VAAPI_H2H,
> > +HDR_VAAPI_H2S,
> > +} HDRType;
> 
> > +static const AVOption tonemap_vaapi_options[] = {
> > +{ "type","hdr type",OFFSET(hdr_type), AV_OPT_TYPE_INT, 
> > { .i64
> = HDR_VAAPI_H2H }, 0, 2, FLAGS, "type" },
> > +{ "h2h", "vaapi P010 to RGB10", 0, AV_OPT_TYPE_CONST,
> {.i64=HDR_VAAPI_H2H}, INT_MIN, INT_MAX, FLAGS, "type" },
> > +{ "h2s", "vaapi P010 to RGB8",  0, AV_OPT_TYPE_CONST,
> > +{.i64=HDR_VAAPI_H2S}, INT_MIN, INT_MAX, FLAGS, "type" },
> 
> Is it intentional that specifying 2 is possible, but not documented? (I see
> there's code handling it as switch/case/default or
> if/else_if/else.)
> 
> By the way, did someone mention a required change to doc/filters.texi?

Thanks Moritz for the comments, I got it.
I am adding document to doc/filters.texi, I will resend the patch soon.
-Zach

> 
> Moritz
> ___
> 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 V2] avfilter: Add tonemap vaapi filter

2018-12-28 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Michael Niedermayer
> Sent: Thursday, December 27, 2018 9:06 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH V2] avfilter: Add tonemap vaapi filter
> 
> On Thu, Dec 27, 2018 at 04:55:17PM +0800, Zachary Zhou wrote:
> > It supports ICL platform.
> > H2H (HDR to HDR): P010 -> RGB10
> > H2S (HDR to SDR): P010 -> RGB8
> >
> > libva commit for HDR10
> >
> https://github.com/intel/libva/commit/cf11abe5e1b9c93ee75cf974076957162
> c1605b9
> >
> > Signed-off-by: Zachary Zhou 
> > ---
> >  configure  |   2 +
> >  libavfilter/Makefile   |   1 +
> >  libavfilter/allfilters.c   |   1 +
> >  libavfilter/vaapi_vpp.c|  29 ++
> >  libavfilter/vaapi_vpp.h|   8 +
> >  libavfilter/vf_tonemap_vaapi.c | 542
> +
> >  libavutil/hwcontext_vaapi.c|   1 +
> >  7 files changed, 584 insertions(+)
> >  create mode 100644 libavfilter/vf_tonemap_vaapi.c
> 
> breaks build
> CClibavutil/hwcontext_vaapi.o
> src/libavutil/hwcontext_vaapi.c:127:19: error: use of undeclared identifier
> 'VA_RT_FORMAT_RGB32_10'
> { 0x41424752, VA_RT_FORMAT_RGB32_10, AV_PIX_FMT_GBRP10LE, 0, },
>   ^
> src/libavutil/hwcontext_vaapi.c:143:28: error: invalid application of 
> 'sizeof' to
> an incomplete type 'const VAAPIFormatDescriptor []'
> for (i = 0; i < (sizeof(vaapi_format_map) / 
> sizeof((vaapi_format_map)[0]));
> i++)
>^~
> src/libavutil/hwcontext_vaapi.c:153:28: error: invalid application of 
> 'sizeof' to
> an incomplete type 'const VAAPIFormatDescriptor []'
> for (i = 0; i < (sizeof(vaapi_format_map) / 
> sizeof((vaapi_format_map)[0]));
> i++)
>^~
> 3 errors generated.
> make: *** [libavutil/hwcontext_vaapi.o] Error 1
> make: Target `all' not remade because of errors.
> 

Thanks Michael for the check, I am fixing the issue with -

+#ifdef VA_RT_FORMAT_RGB32_10
 MAP(RGBA, RGB32_10, GBRP10, 0),
+#endif

I will resend the patch soon.

-Zach

> 
> 
> [...]
> --
> Michael GnuPG fingerprint:
> 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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

2018-12-27 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Moritz Barsnick
> Sent: Tuesday, December 25, 2018 6:06 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH V1] avfilter: Add tonemap vaapi filter
> 
> On Tue, Dec 25, 2018 at 15:16:17 +0800, Zachary Zhou wrote:
> > It supports ICL platform.
> > H2H (HDR to HDR): P010 -> RGB10
> > H2S (HDR to SDR): P010 -> RGB8
> >
> > libva commit for HDR10
> >
> https://github.com/intel/libva/commit/cf11abe5e1b9c93ee75cf97407695716
> > 2c1605b9
> 
> BTW, there's a typo in your libva doxygen comments ("berief" <-> "brief"). Did
> doxygen even run successfully?

I am not send patches to libva, but I can report it to them.

> 
> [...]
> > +check_struct "va/va.h va/va_vpp.h" "VAProcPipelineParameterBuffer"
> > +output_hdr_metadata
> 
> Does libva really not do any micro version bumping or the likes when adding
> features?

currently I am not sure about the micro version changes in libva, but I will 
keep watch the version bumping.

> 
> > +int ff_vaapi_vpp_make_param_buffers2(AVFilterContext *avctx,
> 
> Shouldn't ff_vaapi_vpp_make_param_buffers() be converted to use this?
> Eventually?

ff_vaapi_vpp_make_param_buffers doesn't work for this filter. because this 
filter read metadata from input AVFrame, and ff_vaapi_vpp_make_param_buffers 
usually is used the filter buffer parameter doesn't change during the VPP.

> 
> > +#define LAV_UINT32(a) (a.num)
> > +in_metadata->max_display_mastering_luminance =
> > +LAV_UINT32(hdr_meta->max_luminance);
> > +in_metadata->min_display_mastering_luminance =
> > +LAV_UINT32(hdr_meta->min_luminance);
> > +#undef LAV_UINT16
> 
> What are you undefining here? Didn't you mean to undef LAV_UINT32?

Got it , I will fix this.

> 
> > +if (!metadata) {
> > +av_log(avctx, AV_LOG_ERROR, "Can't new side data
> > + for output\n");
> 
> "new" is not really a verb. ;-) "Can't create new ..."? ("Cannot"
> preferred, actually.)

Got it, I will fix this.

> 
> > +if (!metadata_lt) {
> > +av_log(avctx, AV_LOG_ERROR, "Can't new side data
> > + for output\n");
> 
> Ditto.

Got it, I will fix this.

> 
> > +if ((err = ff_formats_ref(ff_make_format_list(pix_in_fmts),
> > +  >inputs[0]->out_formats)) < 0)
> > +return err;
> 
> There was some discussion here that the style
> err = ff_formats_ref(ff_make_format_list(pix_in_fmts), >inputs[0]-
> >out_formats)
> if (err < 0)
> return err;
> 
> is preferred for readability.

Got it, I will do the change.

> 
> Sorry that some remarks are in form of questions. I'm not totally sure.
> 
> Cheers,
> Moritz

Thank you for the comments,
Zachary

> ___
> 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 V6] libavfilter: add transpose_vaapi filter

2018-12-23 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Mark Thompson
> Sent: Friday, December 21, 2018 5:46 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH V6] libavfilter: add transpose_vaapi filter
> 
> On 18/12/2018 09:54, Zachary Zhou wrote:
> > Swap width and height when do clock/cclock rotation Add
> > reveral/reveral_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/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,
> 
> "REVERAL"?  I guess that's meant to be "REVERSAL".  I'm not convinced it's
> quite the right word, though.  REVERSAL_FLIP is standalone as hflip - if you
> included vflip as well (the missing case from the eight possible transforms,
> excluding identity) then that name might be better?

Yes it should be "REVERSAL".
I added 180 degrees, just want to say VAAPI can easy do 180 agree in one time, 
will better than twice call in software solution. 

if remove "REVERSAL" options will make transpose vaapi has exactly same options 
with other transpose filters,  if add another two options (rotation, mirror) 
may best use VAAPI functions (covering all rotations and mirrors).  which one 
you prefer ?  

From my view, just remove "REVERSAL" options may make it simple.

> 
> Also, please use the enums in transpose.h directly rather than duplicating
> them.

Got it will reuse those enums.

> 
> > +};
> > +
> > +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,
> > +   vpp_ctx->va_context,
> > +   NULL, 0,
> > +   _caps);
> > +if (vas != VA_STATUS_SUCCESS) {
> > +av_log(avctx, AV_LOG_ERROR, "Failed to query pipeline "
> > +   "caps: %d (%s).\n", vas, vaErrorStr(vas));
> > +return AVERROR(EIO);
> > +}
> > +
> > +if (!pipeline_caps.rotation_flags) {
> 
> This condition doesn't guarantee that all possibly rotations are supported -
> .

I think I did such check in end of this function.

> 
> The mirror flags 

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 v4] libavfilter: add transpose_vaapi filter

2018-12-18 Thread Zhou, Zachary
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

2018-12-10 Thread Zhou, Zachary
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

2018-12-03 Thread Zhou, Zachary
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

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

2018-11-28 Thread Zhou, Zachary
Thanks for the comments, reply inline, and sent out new version of the patch.

> -Original Message-
> From: Guo, Yejun
> Sent: Wednesday, November 28, 2018 4:12 PM
> To: FFmpeg development discussions and patches 
> Cc: Zhou, Zachary 
> Subject: RE: [FFmpeg-devel] [PATCH v3] libavfilter: add transpose_vaapi filter
> 
> 
> 
> > -Original Message-
> > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> > Of Zachary Zhou
> > Sent: Wednesday, November 28, 2018 2:54 PM
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Zhou, Zachary 
> > Subject: [FFmpeg-devel] [PATCH v3] 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 ab3144e459..6e711bd9c6 100755
> > --- a/configure
> > +++ b/configure
> > @@ -3451,6 +3451,7 @@ scale_filter_deps="swscale"
> >  scale_qsv_filter_deps="libmfx"
> >  select_filter_select="scene_sad"
> >  sharpness_vaapi_filter_deps="vaapi"
> > +transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags"
> 
> it is better to be in alphabetical order. Just a few exceptions here and I 
> think
> original idea is in alphabetical order.

changed it.

> 
> >  showcqt_filter_deps="avcodec avformat swscale"
> >  showcqt_filter_suggest="libfontconfig libfreetype"
> >  showcqt_filter_select="fft"
> > @@ -5975,6 +5976,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..97e1786071 100644
> > --- a/libavfilter/Makefile
> > +++ b/libavfilter/Makefile
> > @@ -356,6 +356,7 @@ OBJS-$(CONFIG_SETRANGE_FILTER)   +=
> > vf_setparams.o
> >  OBJS-$(CONFIG_SETSAR_FILTER) += vf_aspect.o
> >  OBJS-$(CONFIG_SETTB_FILTER)  += settb.o
> >  OBJS-$(CONFIG_SHARPNESS_VAAPI_FILTER)+= vf_misc_vaapi.o
> > vaapi_vpp.o
> > +OBJS-$(CONFIG_TRANSPOSE_VAAPI_FILTER)+= vf_transpose_vaapi.o
> > vaapi_vpp.o
> >  OBJS-$(CONFIG_SHOWINFO_FILTER)   += vf_showinfo.o
> >  OBJS-$(CONFIG_SHOWPALETTE_FILTER)+= vf_showpalette.o
> >  OBJS-$(CONFIG_SHUFFLEFRAMES_FILTER)  += vf_shuffleframes.o
> > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index
> > 837c99eb75..f0c69e9c67 100644
> > --- a/libavfilter/allfilters.c
> > +++ b/libavfilter/allfilters.c
> > @@ -338,6 +338,7 @@ extern AVFilter ff_vf_setrange;  extern AVFilter
> > ff_vf_setsar;  extern AVFilter ff_vf_settb;  extern AVFilter
> > ff_vf_sharpness_vaapi;
> > +extern AVFilter ff_vf_transpose_vaapi;
> 
> need to be in alphabetical order.

Changed it.

> 
> >  extern AVFilter ff_vf_showinfo;
> >  extern AVFilter ff_vf_showpalette;
> >  extern AVFilter ff_vf_shuffleframes;
> > diff --git a/libavfilter/vf_transpose_vaapi.c
> > b/libavfilter/vf_transpose_vaapi.c
> > new file mode 100644
> > index 00..ca7203e880
> > --- /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
> > + * mod

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

2018-11-19 Thread Zhou, Zachary
The patch optimized the ffmpeg transcode pipeline, it saves hwdownload/hwupload 
filters in the pipeline. It can get about 2.7x performance against software 
transpose filter as my test on 1080P.

time ffmpeg -loglevel verbose -hwaccel vaapi -vaapi_device /dev/dri/renderD128 
-hwaccel_output_format vaapi -i crowd_run_1080p.264 -vf 
transpose_vaapi=rotate=90:vflip -c:v h264_vaapi -y out-a.h264
real0m3.326s
user0m1.225s
sys 0m0.744s
 
time ffmpeg -loglevel verbose -hwaccel vaapi -vaapi_device /dev/dri/renderD128 
-hwaccel_output_format vaapi -i crowd_run_1080p.264 -vf 
hwdownload,transpose=clock_flip,format=nv12,hwupload -c:v h264_vaapi -y 
out-b.h264
real0m4.132s
user0m4.815s
sys0m0.534s
 
(/ (+ 4.815 0.534) (+ 1.225 0.744)) 
= 2.7166074149314374


> -Original Message-
> From: Zhou, Zachary
> Sent: Wednesday, November 14, 2018 9:37 AM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Zhou, Zachary 
> Subject: [PATCH v2] libavfilter: add transpose_vaapi filter
> 
> It supports clockwise rotation by 0/90/180/270 degrees and mirroring by
> horizontal/vertical. video size is changed when rotation by 90/270.
> 
> ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -
> hwaccel_output_format vaapi -i input.264 -vf
> "transpose_vaapi=rotate=90:mirror=1"
> -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 | 337 +++
>  4 files changed, 341 insertions(+)
>  create mode 100644 libavfilter/vf_transpose_vaapi.c
> 
> diff --git a/configure b/configure
> index 85d5dd5962..f62d2a27ca 100755
> --- a/configure
> +++ b/configure
> @@ -3439,6 +3439,7 @@ scale_filter_deps="swscale"
>  scale_qsv_filter_deps="libmfx"
>  select_filter_select="pixelutils"
>  sharpness_vaapi_filter_deps="vaapi"
> +transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags"
>  showcqt_filter_deps="avcodec avformat swscale"
>  showcqt_filter_suggest="libfontconfig libfreetype"
>  showcqt_filter_select="fft"
> @@ -5961,6 +5962,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" "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
> 62cc2f561f..813b174ddd 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -346,6 +346,7 @@ OBJS-$(CONFIG_SETRANGE_FILTER)   +=
> vf_setparams.o
>  OBJS-$(CONFIG_SETSAR_FILTER) += vf_aspect.o
>  OBJS-$(CONFIG_SETTB_FILTER)  += settb.o
>  OBJS-$(CONFIG_SHARPNESS_VAAPI_FILTER)+= vf_misc_vaapi.o
> vaapi_vpp.o
> +OBJS-$(CONFIG_TRANSPOSE_VAAPI_FILTER)+= vf_transpose_vaapi.o
> vaapi_vpp.o
>  OBJS-$(CONFIG_SHOWINFO_FILTER)   += vf_showinfo.o
>  OBJS-$(CONFIG_SHOWPALETTE_FILTER)+= vf_showpalette.o
>  OBJS-$(CONFIG_SHUFFLEFRAMES_FILTER)  += vf_shuffleframes.o
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index
> 5e72803b13..e5b0571aa8 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -330,6 +330,7 @@ extern AVFilter ff_vf_setrange;  extern AVFilter
> ff_vf_setsar;  extern AVFilter ff_vf_settb;  extern AVFilter
> ff_vf_sharpness_vaapi;
> +extern AVFilter ff_vf_transpose_vaapi;
>  extern AVFilter ff_vf_showinfo;
>  extern AVFilter ff_vf_showpalette;
>  extern AVFilter ff_vf_shuffleframes;
> diff --git a/libavfilter/vf_transpose_vaapi.c 
> b/libavfilter/vf_transpose_vaapi.c
> new file mode 100644
> index 00..fcb99fc866
> --- /dev/null
> +++ b/libavfilter/vf_transpose_vaapi.c
> @@ -0,0 +1,337 @@
> +/*
> + * 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 u

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

2018-11-13 Thread Zhou, Zachary
Thanks for your comments. I updated in v2 of the patch.
And, I changed the error message from "VAAPI driver doesn't support rotation" to
" VAAPI driver doesn't support transpose"


> -Original Message-
> From: Zhou, Zachary
> Sent: Wednesday, November 14, 2018 9:25 AM
> To: myp...@gmail.com; FFmpeg development discussions and patches
> 
> Cc: Zhou, Zachary 
> Subject: RE: [FFmpeg-devel] [PATCH V1] libavfilter: add transpose_vaapi filter
> 
> 
> 
> > -Original Message-
> > From: myp...@gmail.com [mailto:myp...@gmail.com]
> > Sent: Wednesday, November 14, 2018 8:46 AM
> > To: FFmpeg development discussions and patches
> > 
> > Cc: zachary.z...@hotmail.com; Zhou, Zachary 
> > Subject: Re: [FFmpeg-devel] [PATCH V1] libavfilter: add
> > transpose_vaapi filter
> >
> > On Wed, Nov 14, 2018 at 4:00 AM Zachary Zhou
> > 
> > wrote:
> > >
> > > From: Zachary Zhou 
> > >
> > > It supports clockwise rotation by 0/90/180/270 degrees and mirroring
> > > by horizontal/vertical. video size is changed when rotation by 90/270.
> > >
> > > ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128
> > > -hwaccel_output_format vaapi -i input.264 -vf
> > "transpose_vaapi=rotate=90:mirror=1"
> > > -c:v h264_vaapi output.h264
> > >
> > > Signed-off-by: Zachary Zhou 
> > > Signed-off-by: Zachary Zhou 
> > > ---
> > >  configure|   2 +
> > >  libavfilter/Makefile |   1 +
> > >  libavfilter/allfilters.c |   1 +
> > >  libavfilter/vf_transpose_vaapi.c | 337
> > > +++
> > >  4 files changed, 341 insertions(+)
> > >  create mode 100644 libavfilter/vf_transpose_vaapi.c
> > >
> > > diff --git a/configure b/configure
> > > index 85d5dd5962..f62d2a27ca 100755
> > > --- a/configure
> > > +++ b/configure
> > > @@ -3439,6 +3439,7 @@ scale_filter_deps="swscale"
> > >  scale_qsv_filter_deps="libmfx"
> > >  select_filter_select="pixelutils"
> > >  sharpness_vaapi_filter_deps="vaapi"
> > > +transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags"
> > >  showcqt_filter_deps="avcodec avformat swscale"
> > >  showcqt_filter_suggest="libfontconfig libfreetype"
> > >  showcqt_filter_select="fft"
> > > @@ -5961,6 +5962,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" "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
> > > 62cc2f561f..813b174ddd 100644
> > > --- a/libavfilter/Makefile
> > > +++ b/libavfilter/Makefile
> > > @@ -346,6 +346,7 @@ OBJS-$(CONFIG_SETRANGE_FILTER)   +=
> > vf_setparams.o
> > >  OBJS-$(CONFIG_SETSAR_FILTER) += vf_aspect.o
> > >  OBJS-$(CONFIG_SETTB_FILTER)  += settb.o
> > >  OBJS-$(CONFIG_SHARPNESS_VAAPI_FILTER)+= vf_misc_vaapi.o
> > vaapi_vpp.o
> > > +OBJS-$(CONFIG_TRANSPOSE_VAAPI_FILTER)+= vf_transpose_vaapi.o
> > vaapi_vpp.o
> > >  OBJS-$(CONFIG_SHOWINFO_FILTER)   += vf_showinfo.o
> > >  OBJS-$(CONFIG_SHOWPALETTE_FILTER)+= vf_showpalette.o
> > >  OBJS-$(CONFIG_SHUFFLEFRAMES_FILTER)  += vf_shuffleframes.o
> > > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> > > index
> > > 5e72803b13..e5b0571aa8 100644
> > > --- a/libavfilter/allfilters.c
> > > +++ b/libavfilter/allfilters.c
> > > @@ -330,6 +330,7 @@ extern AVFilter ff_vf_setrange;  extern AVFilter
> > > ff_vf_setsar;  extern AVFilter ff_vf_settb;  extern AVFilter
> > > ff_vf_sharpness_vaapi;
> > > +extern AVFilter ff_vf_transpose_vaapi;
> > >  extern AVFilter ff_vf_showinfo;
> > >  extern AVFilter

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

2018-11-13 Thread Zhou, Zachary


> -Original Message-
> From: myp...@gmail.com [mailto:myp...@gmail.com]
> Sent: Wednesday, November 14, 2018 8:46 AM
> To: FFmpeg development discussions and patches 
> Cc: zachary.z...@hotmail.com; Zhou, Zachary 
> Subject: Re: [FFmpeg-devel] [PATCH V1] libavfilter: add transpose_vaapi filter
> 
> On Wed, Nov 14, 2018 at 4:00 AM Zachary Zhou 
> wrote:
> >
> > From: Zachary Zhou 
> >
> > It supports clockwise rotation by 0/90/180/270 degrees and mirroring
> > by horizontal/vertical. video size is changed when rotation by 90/270.
> >
> > ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128
> > -hwaccel_output_format vaapi -i input.264 -vf
> "transpose_vaapi=rotate=90:mirror=1"
> > -c:v h264_vaapi output.h264
> >
> > Signed-off-by: Zachary Zhou 
> > Signed-off-by: Zachary Zhou 
> > ---
> >  configure|   2 +
> >  libavfilter/Makefile |   1 +
> >  libavfilter/allfilters.c |   1 +
> >  libavfilter/vf_transpose_vaapi.c | 337
> > +++
> >  4 files changed, 341 insertions(+)
> >  create mode 100644 libavfilter/vf_transpose_vaapi.c
> >
> > diff --git a/configure b/configure
> > index 85d5dd5962..f62d2a27ca 100755
> > --- a/configure
> > +++ b/configure
> > @@ -3439,6 +3439,7 @@ scale_filter_deps="swscale"
> >  scale_qsv_filter_deps="libmfx"
> >  select_filter_select="pixelutils"
> >  sharpness_vaapi_filter_deps="vaapi"
> > +transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags"
> >  showcqt_filter_deps="avcodec avformat swscale"
> >  showcqt_filter_suggest="libfontconfig libfreetype"
> >  showcqt_filter_select="fft"
> > @@ -5961,6 +5962,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" "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
> > 62cc2f561f..813b174ddd 100644
> > --- a/libavfilter/Makefile
> > +++ b/libavfilter/Makefile
> > @@ -346,6 +346,7 @@ OBJS-$(CONFIG_SETRANGE_FILTER)   +=
> vf_setparams.o
> >  OBJS-$(CONFIG_SETSAR_FILTER) += vf_aspect.o
> >  OBJS-$(CONFIG_SETTB_FILTER)  += settb.o
> >  OBJS-$(CONFIG_SHARPNESS_VAAPI_FILTER)+= vf_misc_vaapi.o
> vaapi_vpp.o
> > +OBJS-$(CONFIG_TRANSPOSE_VAAPI_FILTER)+= vf_transpose_vaapi.o
> vaapi_vpp.o
> >  OBJS-$(CONFIG_SHOWINFO_FILTER)   += vf_showinfo.o
> >  OBJS-$(CONFIG_SHOWPALETTE_FILTER)+= vf_showpalette.o
> >  OBJS-$(CONFIG_SHUFFLEFRAMES_FILTER)  += vf_shuffleframes.o
> > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index
> > 5e72803b13..e5b0571aa8 100644
> > --- a/libavfilter/allfilters.c
> > +++ b/libavfilter/allfilters.c
> > @@ -330,6 +330,7 @@ extern AVFilter ff_vf_setrange;  extern AVFilter
> > ff_vf_setsar;  extern AVFilter ff_vf_settb;  extern AVFilter
> > ff_vf_sharpness_vaapi;
> > +extern AVFilter ff_vf_transpose_vaapi;
> >  extern AVFilter ff_vf_showinfo;
> >  extern AVFilter ff_vf_showpalette;
> >  extern AVFilter ff_vf_shuffleframes;
> > diff --git a/libavfilter/vf_transpose_vaapi.c
> > b/libavfilter/vf_transpose_vaapi.c
> > new file mode 100644
> > index 00..dc58982688
> > --- /dev/null
> > +++ b/libavfilter/vf_transpose_vaapi.c
> > @@ -0,0 +1,337 @@
> > +/*
> > + * 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 PU

Re: [FFmpeg-devel] [PATCH V3] libavfilter/vaapi: enable vaapi rotation feature via call Intel iHD driver

2018-11-02 Thread Zhou, Zachary
Thanks Mark, I am considering it.
I will send a new patch including  both vaapi rotation and mirroring.

> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Mark Thompson
> Sent: Thursday, November 1, 2018 7:36 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH V3] libavfilter/vaapi: enable vaapi
> rotation feature via call Intel iHD driver
> 
> On 31/10/18 02:43, Zachary Zhou wrote:
> > libavfilter/vaapi: enable vaapi rotation feature via call Intel iHD
> > driver
> 
> I'd make the title something like "libavfilter: add rotate_vaapi filter".  
> There is
> no reason to mention a particular implementation - anyone can implement
> this API.
> 
> > It supports clockwise rotation by 0/90/180/270 degrees defined in
> > va/va_vpp.h, tested following command line on SKL platform
> >
> > ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128
> > -hwaccel_output_format vaapi -i input.264 -vf "rotation_vaapi=angle=180"
> > -c:v h264_vaapi output.h264
> >
> > Signed-off-by: Zachary Zhou 
> > ---
> >  configure |   4 +
> >  libavfilter/Makefile  |   1 +
> >  libavfilter/allfilters.c  |   1 +
> >  libavfilter/vaapi_vpp.h   |   1 +
> >  libavfilter/vf_rotate_vaapi.c | 252
> > ++
> >  5 files changed, 259 insertions(+)
> >  create mode 100644 libavfilter/vf_rotate_vaapi.c
> 
> Referencing other discussion, I think this filter should do both the rotation 
> and
> mirroring features.  I don't know what the filter should be called, though -
> matching the transpose filter as transpose_vaapi seems the most logical
> choice to me, but I admit the exact options aren't quite right.
> 
> The effect of rotating by one or three right angles surprised me - I would
> expect the size to be changed as well, so a 1280x720 input becomes a
> 720x1280 output rather than squishing the video.
> 
> > diff --git a/configure b/configure
> > index 85d5dd5962..4b5718135e 100755
> > --- a/configure
> > +++ b/configure
> > @@ -3439,6 +3439,7 @@ scale_filter_deps="swscale"
> >  scale_qsv_filter_deps="libmfx"
> >  select_filter_select="pixelutils"
> >  sharpness_vaapi_filter_deps="vaapi"
> > +rotation_vaapi_filter_deps="vaapi"
> >  showcqt_filter_deps="avcodec avformat swscale"
> >  showcqt_filter_suggest="libfontconfig libfreetype"
> >  showcqt_filter_select="fft"
> > @@ -6390,6 +6391,9 @@ if enabled vaapi; then
> >  fi
> >
> >  check_cpp_condition vaapi_1 "va/va.h" "VA_CHECK_VERSION(1, 0, 0)"
> > +if ! check_struct "va/va.h" "struct _VAProcPipelineCaps" 
> > rotation_flags;
> then
> > +disable rotation_vaapi_filter
> > +fi
> 
> Use the dependencies instead like other components.  (See
> vp9_vaapi_hwaccel for a check_struct like this one.)
> 
> >  fi
> >
> >  if enabled_all opencl libdrm ; then
> > diff --git a/libavfilter/Makefile b/libavfilter/Makefile index
> > 108a2f87d7..534650364a 100644
> > --- a/libavfilter/Makefile
> > +++ b/libavfilter/Makefile
> > @@ -349,6 +349,7 @@ OBJS-$(CONFIG_SETRANGE_FILTER)   +=
> vf_setparams.o
> >  OBJS-$(CONFIG_SETSAR_FILTER) += vf_aspect.o
> >  OBJS-$(CONFIG_SETTB_FILTER)  += settb.o
> >  OBJS-$(CONFIG_SHARPNESS_VAAPI_FILTER)+= vf_misc_vaapi.o
> vaapi_vpp.o
> > +OBJS-$(CONFIG_ROTATION_VAAPI_FILTER) += vf_rotate_vaapi.o
> vaapi_vpp.o
> >  OBJS-$(CONFIG_SHOWINFO_FILTER)   += vf_showinfo.o
> >  OBJS-$(CONFIG_SHOWPALETTE_FILTER)+= vf_showpalette.o
> >  OBJS-$(CONFIG_SHUFFLEFRAMES_FILTER)  += vf_shuffleframes.o
> > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index
> > 557590850b..4b90a7f440 100644
> > --- a/libavfilter/allfilters.c
> > +++ b/libavfilter/allfilters.c
> > @@ -333,6 +333,7 @@ extern AVFilter ff_vf_setrange;  extern AVFilter
> > ff_vf_setsar;  extern AVFilter ff_vf_settb;  extern AVFilter
> > ff_vf_sharpness_vaapi;
> > +extern AVFilter ff_vf_rotation_vaapi;
> >  extern AVFilter ff_vf_showinfo;
> >  extern AVFilter ff_vf_showpalette;
> >  extern AVFilter ff_vf_shuffleframes;
> > diff --git a/libavfilter/vaapi_vpp.h b/libavfilter/vaapi_vpp.h index
> > 0bc31018d4..cfe19b689f 100644
> > --- a/libavfilter/vaapi_vpp.h
> > +++ b/libavfilter/vaapi_vpp.h
> > @@ -44,6 +44,7 @@ typedef struct VAAPIVPPContext {
> >  int output_width;   // computed width
> >  int output_height;  // computed height
> >
> > +int rotation_state;
> 
> No reason to put this in the common context, it can be in the rotate-specific
> one.

I put int rotation_state here, just because of the share code between this 
filter and vf_misc_vaapi.c,
I will consider move it.

> 
> >  VABufferID filter_buffers[VAProcFilterCount];
> >  intnb_filter_buffers;
> >
> > diff --git a/libavfilter/vf_rotate_vaapi.c
> > b/libavfilter/vf_rotate_vaapi.c new file mode 100644 index
> > 00..82e2a0fce4
> > --- /dev/null
> > +++ 

Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi rotation feature via call Intel iHD driver

2018-10-30 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Michael Niedermayer
> Sent: Wednesday, October 31, 2018 3:53 AM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi
> rotation feature via call Intel iHD driver
> 
> On Mon, Oct 29, 2018 at 01:42:55AM +, Zhou, Zachary wrote:
> >
> >
> > > -Original Message-
> > > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> > > Behalf Of Michael Niedermayer
> > > Sent: Saturday, October 27, 2018 5:16 AM
> > > To: FFmpeg development discussions and patches
> > > 
> > > Subject: Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable
> > > vaapi rotation feature via call Intel iHD driver
> > >
> > > On Thu, Oct 25, 2018 at 02:52:01PM +0800, Zachary Zhou wrote:
> > > > It supports clockwise rotation by 0/90/180/270 degrees defined in
> > > > va/va_vpp.h, tested following command line on SKL platform
> > > >
> > > > dir=0 for 0   degree
> > > > dir=1 for 90  degree
> > > > dir=2 for 180 degree
> > > > dir=3 for 270 degree
> > > >
> > > > ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128
> > > > -hwaccel_output_format vaapi -i input.264 -vf "rotation_vaapi=dir=1"
> > > > -c:v h264_vaapi output.h264
> > > >
> > > > Signed-off-by: Zachary Zhou 
> > > > ---
> > > >  configure |   3 +
> > > >  libavfilter/Makefile  |   1 +
> > > >  libavfilter/allfilters.c  |   1 +
> > > >  libavfilter/vaapi_vpp.h   |   1 +
> > > >  libavfilter/vf_rotate_vaapi.c | 252
> > > > ++
> > > >  5 files changed, 258 insertions(+)  create mode 100644
> > > > libavfilter/vf_rotate_vaapi.c
> > >
> > > still fails to build on 32bit x86
> > >
> > > src/libavfilter/vf_rotate_vaapi.c: In function
> > > ‘rotation_vaapi_build_filter_params’:
> > > src/libavfilter/vf_rotate_vaapi.c:69:23: error: ‘VAProcPipelineCaps’
> > > has no member named ‘rotation_flags’
> > >  if (!pipeline_caps.rotation_flags) {
> > >^
> > > src/libavfilter/vf_rotate_vaapi.c:95:33: error: ‘VAProcPipelineCaps’
> > > has no member named ‘rotation_flags’
> > >  support_flag = pipeline_caps.rotation_flags &
> > >  ^
> > > src/libavfilter/vf_rotate_vaapi.c: In function 
> > > ‘rotation_vaapi_filter_frame’:
> > > src/libavfilter/vf_rotate_vaapi.c:152:15: error:
> > > ‘VAProcPipelineParameterBuffer’ has no member named ‘rotation_state’
> > >  params.rotation_state = vpp_ctx->rotation_state;
> > >^
> > > make: *** [libavfilter/vf_rotate_vaapi.o] Error 1
> > > make: *** Waiting for unfinished jobs
> > >
> > > grep VAAPI ffbuild/config.mak
> > > !HAVE_VAAPI_DRM=yes
> > > !HAVE_VAAPI_X11=yes
> > > !HAVE_OPENCL_VAAPI_BEIGNET=yes
> > > !HAVE_OPENCL_VAAPI_INTEL_MEDIA=yes
> > > !CONFIG_VAAPI_ENCODE_EXAMPLE=yes
> > > !CONFIG_VAAPI_TRANSCODE_EXAMPLE=yes
> > > !CONFIG_VAAPI=yes
> > > !CONFIG_VAAPI_1=yes
> > > !CONFIG_VAAPI_ENCODE=yes
> > > !CONFIG_H264_VAAPI_ENCODER=yes
> > > !CONFIG_HEVC_VAAPI_ENCODER=yes
> > > !CONFIG_MJPEG_VAAPI_ENCODER=yes
> > > !CONFIG_MPEG2_VAAPI_ENCODER=yes
> > > !CONFIG_VP8_VAAPI_ENCODER=yes
> > > !CONFIG_VP9_VAAPI_ENCODER=yes
> > > !CONFIG_H263_VAAPI_HWACCEL=yes
> > > !CONFIG_H264_VAAPI_HWACCEL=yes
> > > !CONFIG_HEVC_VAAPI_HWACCEL=yes
> > > !CONFIG_MJPEG_VAAPI_HWACCEL=yes
> > > !CONFIG_MPEG2_VAAPI_HWACCEL=yes
> > > !CONFIG_MPEG4_VAAPI_HWACCEL=yes
> > > !CONFIG_VC1_VAAPI_HWACCEL=yes
> > > !CONFIG_VP8_VAAPI_HWACCEL=yes
> > > !CONFIG_VP9_VAAPI_HWACCEL=yes
> > > !CONFIG_WMV3_VAAPI_HWACCEL=yes
> > > !CONFIG_DEINTERLACE_VAAPI_FILTER=yes
> > > !CONFIG_DENOISE_VAAPI_FILTER=yes
> > > !CONFIG_PROCAMP_VAAPI_FILTER=yes
> > > !CONFIG_SCALE_VAAPI_FILTER=yes
> > > !CONFIG_SHARPNESS_VAAPI_FILTER=yes
> > > CONFIG_ROTATION_VAAPI_FILTER=yes
> > >
> > > [...]
> >
> > Thanks Michael, Can you share your command line for the build script
> configure ?
> > Do I need more setting on the configure file ?
> 
>

Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi rotation feature via call Intel iHD driver

2018-10-29 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> myp...@gmail.com
> Sent: Monday, October 29, 2018 9:58 AM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi
> rotation feature via call Intel iHD driver
> 
> On Fri, Oct 26, 2018 at 11:26 PM Paul B Mahol  wrote:
> >
> > On 10/26/18, Zhou, Zachary  wrote:
> > >
> > >
> > >> -Original Message-
> > >> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> > >> Behalf Of Rostislav Pehlivanov
> > >> Sent: Friday, October 26, 2018 9:02 PM
> > >> To: FFmpeg development discussions and patches
> > >> 
> > >> Subject: Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable
> > >> vaapi rotation feature via call Intel iHD driver
> > >>
> > >> On Fri, 26 Oct 2018 at 04:10, Zhou, Zachary
> > >> 
> > >> wrote:
> > >>
> > >> >
> > >> >
> > >> > > -Original Message-
> > >> > > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> > >> > > Behalf Of sean darcy
> > >> > > Sent: Thursday, October 25, 2018 11:51 PM
> > >> > > To: ffmpeg-devel@ffmpeg.org
> > >> > > Subject: Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi:
> > >> > > enable vaapi rotation feature via call Intel iHD driver
> > >> > >
> > >> > > On 10/25/18 2:52 AM, Zachary Zhou wrote:
> > >> > > > It supports clockwise rotation by 0/90/180/270 degrees
> > >> > > > defined in va/va_vpp.h, tested following command line on SKL
> > >> > > > platform
> > >> > > >
> > >> > > > dir=0 for 0   degree
> > >> > > > dir=1 for 90  degree
> > >> > > > dir=2 for 180 degree
> > >> > > > dir=3 for 270 degree
> > >> > > >
> > >> > > > ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128
> > >> > > > -hwaccel_output_format vaapi -i input.264 -vf
> > >> > > > "rotation_vaapi=dir=1"
> > >> > > > -c:v h264_vaapi output.h264
> > >> > > >
> > >> > > > Signed-off-by: Zachary Zhou 
> > >> > > > ---
> > >> > > >   configure |   3 +
> > >> > > >   libavfilter/Makefile  |   1 +
> > >> > > >   libavfilter/allfilters.c  |   1 +
> > >> > > >   libavfilter/vaapi_vpp.h   |   1 +
> > >> > > >   libavfilter/vf_rotate_vaapi.c | 252
> > >> > ++
> > >> > > >   5 files changed, 258 insertions(+)
> > >> > > >   create mode 100644 libavfilter/vf_rotate_vaapi.c
> > >> > > >
> > >> > > > diff --git a/configure b/configure index
> > >> > > > 85d5dd5962..33aced3d78
> > >> > > > 100755
> > >> > > > --- a/configure
> > >> > > > +++ b/configure
> > >> > > > @@ -6390,6 +6390,9 @@ if enabled vaapi; then
> > >> > > >   fi
> > >> > > >
> > >> > > >   check_cpp_condition vaapi_1 "va/va.h"
> > >> > > > "VA_CHECK_VERSION(1, 0,
> > >> 0)"
> > >> > > > +if ! check_struct "va/va.h" "struct _VAProcPipelineCaps"
> > >> > rotation_flags;
> > >> > > then
> > >> > > > +disable rotation_vaapi_filter
> > >> > > > +fi
> > >> > > >   fi
> > >> > > >
> > >> > > >   if enabled_all opencl libdrm ; then diff --git
> > >> > > > a/libavfilter/Makefile b/libavfilter/Makefile index
> > >> > > > 108a2f87d7..534650364a 100644
> > >> > > > --- a/libavfilter/Makefile
> > >> > > > +++ b/libavfilter/Makefile
> > >> > > > @@ -349,6 +349,7 @@ OBJS-$(CONFIG_SETRANGE_FILTER)
> +=
> > >> > > vf_setparams.o
> > >> > > >   OBJS-$(CONFIG_SETSAR_FILTER) += vf_aspect.o
> > >> > > >   OBJS-$(CONFIG_SETT

Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi rotation feature via call Intel iHD driver

2018-10-28 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> sean darcy
> Sent: Saturday, October 27, 2018 3:07 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi
> rotation feature via call Intel iHD driver
> 
> On 10/26/18 11:18 AM, Paul B Mahol wrote:
> > On 10/26/18, Zhou, Zachary  wrote:
> >>
> >>
> >>> -Original Message-
> >>> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> >>> Behalf Of Rostislav Pehlivanov
> >>> Sent: Friday, October 26, 2018 9:02 PM
> >>> To: FFmpeg development discussions and patches
> >>> 
> >>> Subject: Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable
> >>> vaapi rotation feature via call Intel iHD driver
> >>>
> >>> On Fri, 26 Oct 2018 at 04:10, Zhou, Zachary 
> >>> wrote:
> >>>
> >>>>
> >>>>
> >>>>> -Original Message-
> >>>>> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> >>>>> Behalf Of sean darcy
> >>>>> Sent: Thursday, October 25, 2018 11:51 PM
> >>>>> To: ffmpeg-devel@ffmpeg.org
> >>>>> Subject: Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable
> >>>>> vaapi rotation feature via call Intel iHD driver
> >>>>>
> >>>>> On 10/25/18 2:52 AM, Zachary Zhou wrote:
> >>>>>> It supports clockwise rotation by 0/90/180/270 degrees defined in
> >>>>>> va/va_vpp.h, tested following command line on SKL platform
> >>>>>>
> >>>>>> dir=0 for 0   degree
> >>>>>> dir=1 for 90  degree
> >>>>>> dir=2 for 180 degree
> >>>>>> dir=3 for 270 degree
> >>>>>>
> >>>>>> ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128
> >>>>>> -hwaccel_output_format vaapi -i input.264 -vf
> >>>>>> "rotation_vaapi=dir=1"
> >>>>>> -c:v h264_vaapi output.h264
> >>>>>>
> >>>>>> Signed-off-by: Zachary Zhou 
> >>>>>> ---
> >>>>>>configure |   3 +
> >>>>>>libavfilter/Makefile  |   1 +
> >>>>>>libavfilter/allfilters.c  |   1 +
> >>>>>>libavfilter/vaapi_vpp.h   |   1 +
> >>>>>>libavfilter/vf_rotate_vaapi.c | 252
> >>>> ++
> >>>>>>5 files changed, 258 insertions(+)
> >>>>>>create mode 100644 libavfilter/vf_rotate_vaapi.c
> >>>>>>
> >>>>>> diff --git a/configure b/configure index 85d5dd5962..33aced3d78
> >>>>>> 100755
> >>>>>> --- a/configure
> >>>>>> +++ b/configure
> >>>>>> @@ -6390,6 +6390,9 @@ if enabled vaapi; then
> >>>>>>fi
> >>>>>>
> >>>>>>check_cpp_condition vaapi_1 "va/va.h" "VA_CHECK_VERSION(1,
> >>>>>> 0,
> >>> 0)"
> >>>>>> +if ! check_struct "va/va.h" "struct _VAProcPipelineCaps"
> >>>> rotation_flags;
> >>>>> then
> >>>>>> +disable rotation_vaapi_filter
> >>>>>> +fi
> >>>>>>fi
> >>>>>>
> >>>>>>if enabled_all opencl libdrm ; then diff --git
> >>>>>> a/libavfilter/Makefile b/libavfilter/Makefile index
> >>>>>> 108a2f87d7..534650364a 100644
> >>>>>> --- a/libavfilter/Makefile
> >>>>>> +++ b/libavfilter/Makefile
> >>>>>> @@ -349,6 +349,7 @@ OBJS-$(CONFIG_SETRANGE_FILTER)   +=
> >>>>> vf_setparams.o
> >>>>>>OBJS-$(CONFIG_SETSAR_FILTER) += vf_aspect.o
> >>>>>>OBJS-$(CONFIG_SETTB_FILTER)  += settb.o
> >>>>>>OBJS-$(CONFIG_SHARPNESS_VAAPI_FILTER)+= vf_misc_vaapi.o
> >>>>> vaapi_vpp.o
> >>>>>> +OBJS-$(CONFIG_ROTATION_VAAPI_FILTER) += vf_rotate_vaapi.o
> >>>>> vaapi_vpp.o
> >>>>>>OBJS-$(CONFIG_SHOWINFO_FILTER) 

Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi rotation feature via call Intel iHD driver

2018-10-28 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Michael Niedermayer
> Sent: Saturday, October 27, 2018 5:16 AM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi
> rotation feature via call Intel iHD driver
> 
> On Thu, Oct 25, 2018 at 02:52:01PM +0800, Zachary Zhou wrote:
> > It supports clockwise rotation by 0/90/180/270 degrees defined in
> > va/va_vpp.h, tested following command line on SKL platform
> >
> > dir=0 for 0   degree
> > dir=1 for 90  degree
> > dir=2 for 180 degree
> > dir=3 for 270 degree
> >
> > ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128
> > -hwaccel_output_format vaapi -i input.264 -vf "rotation_vaapi=dir=1"
> > -c:v h264_vaapi output.h264
> >
> > Signed-off-by: Zachary Zhou 
> > ---
> >  configure |   3 +
> >  libavfilter/Makefile  |   1 +
> >  libavfilter/allfilters.c  |   1 +
> >  libavfilter/vaapi_vpp.h   |   1 +
> >  libavfilter/vf_rotate_vaapi.c | 252
> > ++
> >  5 files changed, 258 insertions(+)
> >  create mode 100644 libavfilter/vf_rotate_vaapi.c
> 
> still fails to build on 32bit x86
> 
> src/libavfilter/vf_rotate_vaapi.c: In function
> ‘rotation_vaapi_build_filter_params’:
> src/libavfilter/vf_rotate_vaapi.c:69:23: error: ‘VAProcPipelineCaps’ has no
> member named ‘rotation_flags’
>  if (!pipeline_caps.rotation_flags) {
>^
> src/libavfilter/vf_rotate_vaapi.c:95:33: error: ‘VAProcPipelineCaps’ has no
> member named ‘rotation_flags’
>  support_flag = pipeline_caps.rotation_flags &
>  ^
> src/libavfilter/vf_rotate_vaapi.c: In function ‘rotation_vaapi_filter_frame’:
> src/libavfilter/vf_rotate_vaapi.c:152:15: error:
> ‘VAProcPipelineParameterBuffer’ has no member named ‘rotation_state’
>  params.rotation_state = vpp_ctx->rotation_state;
>^
> make: *** [libavfilter/vf_rotate_vaapi.o] Error 1
> make: *** Waiting for unfinished jobs
> 
> grep VAAPI ffbuild/config.mak
> !HAVE_VAAPI_DRM=yes
> !HAVE_VAAPI_X11=yes
> !HAVE_OPENCL_VAAPI_BEIGNET=yes
> !HAVE_OPENCL_VAAPI_INTEL_MEDIA=yes
> !CONFIG_VAAPI_ENCODE_EXAMPLE=yes
> !CONFIG_VAAPI_TRANSCODE_EXAMPLE=yes
> !CONFIG_VAAPI=yes
> !CONFIG_VAAPI_1=yes
> !CONFIG_VAAPI_ENCODE=yes
> !CONFIG_H264_VAAPI_ENCODER=yes
> !CONFIG_HEVC_VAAPI_ENCODER=yes
> !CONFIG_MJPEG_VAAPI_ENCODER=yes
> !CONFIG_MPEG2_VAAPI_ENCODER=yes
> !CONFIG_VP8_VAAPI_ENCODER=yes
> !CONFIG_VP9_VAAPI_ENCODER=yes
> !CONFIG_H263_VAAPI_HWACCEL=yes
> !CONFIG_H264_VAAPI_HWACCEL=yes
> !CONFIG_HEVC_VAAPI_HWACCEL=yes
> !CONFIG_MJPEG_VAAPI_HWACCEL=yes
> !CONFIG_MPEG2_VAAPI_HWACCEL=yes
> !CONFIG_MPEG4_VAAPI_HWACCEL=yes
> !CONFIG_VC1_VAAPI_HWACCEL=yes
> !CONFIG_VP8_VAAPI_HWACCEL=yes
> !CONFIG_VP9_VAAPI_HWACCEL=yes
> !CONFIG_WMV3_VAAPI_HWACCEL=yes
> !CONFIG_DEINTERLACE_VAAPI_FILTER=yes
> !CONFIG_DENOISE_VAAPI_FILTER=yes
> !CONFIG_PROCAMP_VAAPI_FILTER=yes
> !CONFIG_SCALE_VAAPI_FILTER=yes
> !CONFIG_SHARPNESS_VAAPI_FILTER=yes
> CONFIG_ROTATION_VAAPI_FILTER=yes
> 
> [...]

Thanks Michael, Can you share your command line for the build script configure ?
Do I need more setting on the configure file ?

> --
> Michael GnuPG fingerprint:
> 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> If you drop bombs on a foreign country and kill a hundred thousand innocent
> people, expect your government to call the consequence "unprovoked
> inhuman terrorist attacks" and use it to justify dropping more bombs and
> killing more people. The technology changed, the idea is old.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi rotation feature via call Intel iHD driver

2018-10-26 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Rostislav Pehlivanov
> Sent: Friday, October 26, 2018 9:02 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi
> rotation feature via call Intel iHD driver
> 
> On Fri, 26 Oct 2018 at 04:10, Zhou, Zachary  wrote:
> 
> >
> >
> > > -Original Message-
> > > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> > > Behalf Of sean darcy
> > > Sent: Thursday, October 25, 2018 11:51 PM
> > > To: ffmpeg-devel@ffmpeg.org
> > > Subject: Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable
> > > vaapi rotation feature via call Intel iHD driver
> > >
> > > On 10/25/18 2:52 AM, Zachary Zhou wrote:
> > > > It supports clockwise rotation by 0/90/180/270 degrees defined in
> > > > va/va_vpp.h, tested following command line on SKL platform
> > > >
> > > > dir=0 for 0   degree
> > > > dir=1 for 90  degree
> > > > dir=2 for 180 degree
> > > > dir=3 for 270 degree
> > > >
> > > > ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128
> > > > -hwaccel_output_format vaapi -i input.264 -vf "rotation_vaapi=dir=1"
> > > > -c:v h264_vaapi output.h264
> > > >
> > > > Signed-off-by: Zachary Zhou 
> > > > ---
> > > >   configure |   3 +
> > > >   libavfilter/Makefile  |   1 +
> > > >   libavfilter/allfilters.c  |   1 +
> > > >   libavfilter/vaapi_vpp.h   |   1 +
> > > >   libavfilter/vf_rotate_vaapi.c | 252
> > ++
> > > >   5 files changed, 258 insertions(+)
> > > >   create mode 100644 libavfilter/vf_rotate_vaapi.c
> > > >
> > > > diff --git a/configure b/configure index 85d5dd5962..33aced3d78
> > > > 100755
> > > > --- a/configure
> > > > +++ b/configure
> > > > @@ -6390,6 +6390,9 @@ if enabled vaapi; then
> > > >   fi
> > > >
> > > >   check_cpp_condition vaapi_1 "va/va.h" "VA_CHECK_VERSION(1, 0,
> 0)"
> > > > +if ! check_struct "va/va.h" "struct _VAProcPipelineCaps"
> > rotation_flags;
> > > then
> > > > +disable rotation_vaapi_filter
> > > > +fi
> > > >   fi
> > > >
> > > >   if enabled_all opencl libdrm ; then diff --git
> > > > a/libavfilter/Makefile b/libavfilter/Makefile index
> > > > 108a2f87d7..534650364a 100644
> > > > --- a/libavfilter/Makefile
> > > > +++ b/libavfilter/Makefile
> > > > @@ -349,6 +349,7 @@ OBJS-$(CONFIG_SETRANGE_FILTER)   +=
> > > vf_setparams.o
> > > >   OBJS-$(CONFIG_SETSAR_FILTER) += vf_aspect.o
> > > >   OBJS-$(CONFIG_SETTB_FILTER)  += settb.o
> > > >   OBJS-$(CONFIG_SHARPNESS_VAAPI_FILTER)+= vf_misc_vaapi.o
> > > vaapi_vpp.o
> > > > +OBJS-$(CONFIG_ROTATION_VAAPI_FILTER) += vf_rotate_vaapi.o
> > > vaapi_vpp.o
> > > >   OBJS-$(CONFIG_SHOWINFO_FILTER)   += vf_showinfo.o
> > > >   OBJS-$(CONFIG_SHOWPALETTE_FILTER)+= vf_showpalette.o
> > > >   OBJS-$(CONFIG_SHUFFLEFRAMES_FILTER)  += vf_shuffleframes.o
> > > > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> > > > index
> > > > 557590850b..4b90a7f440 100644
> > > > --- a/libavfilter/allfilters.c
> > > > +++ b/libavfilter/allfilters.c
> > > > @@ -333,6 +333,7 @@ extern AVFilter ff_vf_setrange;
> > > >   extern AVFilter ff_vf_setsar;
> > > >   extern AVFilter ff_vf_settb;
> > > >   extern AVFilter ff_vf_sharpness_vaapi;
> > > > +extern AVFilter ff_vf_rotation_vaapi;
> > > >   extern AVFilter ff_vf_showinfo;
> > > >   extern AVFilter ff_vf_showpalette;
> > > >   extern AVFilter ff_vf_shuffleframes; diff --git
> > > > a/libavfilter/vaapi_vpp.h b/libavfilter/vaapi_vpp.h index
> > > > 0bc31018d4..cfe19b689f 100644
> > > > --- a/libavfilter/vaapi_vpp.h
> > > > +++ b/libavfilter/vaapi_vpp.h
> > > > @@ -44,6 +44,7 @@ typedef struct VAAPIVPPContext {
> > > >   int output_width;   // computed width
> > > >   int output_height;  // c

Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi rotation feature via call Intel iHD driver

2018-10-25 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> sean darcy
> Sent: Thursday, October 25, 2018 11:51 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH V2] libavfilter/vaapi: enable vaapi
> rotation feature via call Intel iHD driver
> 
> On 10/25/18 2:52 AM, Zachary Zhou wrote:
> > It supports clockwise rotation by 0/90/180/270 degrees defined in
> > va/va_vpp.h, tested following command line on SKL platform
> >
> > dir=0 for 0   degree
> > dir=1 for 90  degree
> > dir=2 for 180 degree
> > dir=3 for 270 degree
> >
> > ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128
> > -hwaccel_output_format vaapi -i input.264 -vf "rotation_vaapi=dir=1"
> > -c:v h264_vaapi output.h264
> >
> > Signed-off-by: Zachary Zhou 
> > ---
> >   configure |   3 +
> >   libavfilter/Makefile  |   1 +
> >   libavfilter/allfilters.c  |   1 +
> >   libavfilter/vaapi_vpp.h   |   1 +
> >   libavfilter/vf_rotate_vaapi.c | 252 ++
> >   5 files changed, 258 insertions(+)
> >   create mode 100644 libavfilter/vf_rotate_vaapi.c
> >
> > diff --git a/configure b/configure
> > index 85d5dd5962..33aced3d78 100755
> > --- a/configure
> > +++ b/configure
> > @@ -6390,6 +6390,9 @@ if enabled vaapi; then
> >   fi
> >
> >   check_cpp_condition vaapi_1 "va/va.h" "VA_CHECK_VERSION(1, 0, 0)"
> > +if ! check_struct "va/va.h" "struct _VAProcPipelineCaps" 
> > rotation_flags;
> then
> > +disable rotation_vaapi_filter
> > +fi
> >   fi
> >
> >   if enabled_all opencl libdrm ; then
> > diff --git a/libavfilter/Makefile b/libavfilter/Makefile index
> > 108a2f87d7..534650364a 100644
> > --- a/libavfilter/Makefile
> > +++ b/libavfilter/Makefile
> > @@ -349,6 +349,7 @@ OBJS-$(CONFIG_SETRANGE_FILTER)   +=
> vf_setparams.o
> >   OBJS-$(CONFIG_SETSAR_FILTER) += vf_aspect.o
> >   OBJS-$(CONFIG_SETTB_FILTER)  += settb.o
> >   OBJS-$(CONFIG_SHARPNESS_VAAPI_FILTER)+= vf_misc_vaapi.o
> vaapi_vpp.o
> > +OBJS-$(CONFIG_ROTATION_VAAPI_FILTER) += vf_rotate_vaapi.o
> vaapi_vpp.o
> >   OBJS-$(CONFIG_SHOWINFO_FILTER)   += vf_showinfo.o
> >   OBJS-$(CONFIG_SHOWPALETTE_FILTER)+= vf_showpalette.o
> >   OBJS-$(CONFIG_SHUFFLEFRAMES_FILTER)  += vf_shuffleframes.o
> > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index
> > 557590850b..4b90a7f440 100644
> > --- a/libavfilter/allfilters.c
> > +++ b/libavfilter/allfilters.c
> > @@ -333,6 +333,7 @@ extern AVFilter ff_vf_setrange;
> >   extern AVFilter ff_vf_setsar;
> >   extern AVFilter ff_vf_settb;
> >   extern AVFilter ff_vf_sharpness_vaapi;
> > +extern AVFilter ff_vf_rotation_vaapi;
> >   extern AVFilter ff_vf_showinfo;
> >   extern AVFilter ff_vf_showpalette;
> >   extern AVFilter ff_vf_shuffleframes; diff --git
> > a/libavfilter/vaapi_vpp.h b/libavfilter/vaapi_vpp.h index
> > 0bc31018d4..cfe19b689f 100644
> > --- a/libavfilter/vaapi_vpp.h
> > +++ b/libavfilter/vaapi_vpp.h
> > @@ -44,6 +44,7 @@ typedef struct VAAPIVPPContext {
> >   int output_width;   // computed width
> >   int output_height;  // computed height
> >
> > +int rotation_state;
> >   VABufferID filter_buffers[VAProcFilterCount];
> >   intnb_filter_buffers;
> >
> > diff --git a/libavfilter/vf_rotate_vaapi.c
> > b/libavfilter/vf_rotate_vaapi.c new file mode 100644 index
> > 00..34c270e9c7
> > --- /dev/null
> > +++ b/libavfilter/vf_rotate_vaapi.c
> > @@ -0,0 +1,252 @@
> > +/*
> > + * 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"
> > +
> > +// Rotation angle values
> > +enum RotationAngle {
> > +ROTATION_0   = 0,
> > +ROTATION_90  = 1,
> > +ROTATION_180 = 2,
> > +ROTATION_270 = 3,
> > +
> > +ROTATION_MIN = ROTATION_0,
> > +ROTATION_MAX = ROTATION_270,
> > +ROTATION_DEFAULT = 

Re: [FFmpeg-devel] [PATCH] libavfilter/vaapi: enable vaapi rotation feature via call Intel iHD driver

2018-10-25 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Zhou, Zachary
> Sent: Thursday, October 25, 2018 12:34 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH] libavfilter/vaapi: enable vaapi rotation
> feature via call Intel iHD driver
> 
> 
> 
> > -Original Message-
> > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> > Of Mark Thompson
> > Sent: Thursday, October 25, 2018 7:08 AM
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: Re: [FFmpeg-devel] [PATCH] libavfilter/vaapi: enable vaapi
> > rotation feature via call Intel iHD driver
> >
> > On 23/10/18 22:05, Eoff, Ullysses A wrote:
> > >
> > >> -Original Message-
> > >> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> > >> Behalf Of Eoff, Ullysses A
> > >> Sent: Tuesday, October 23, 2018 1:50 PM
> > >> To: FFmpeg development discussions and patches
> > >> 
> > >> Subject: Re: [FFmpeg-devel] [PATCH] libavfilter/vaapi: enable vaapi
> > >> rotation feature via call Intel iHD driver
> > >>
> > >>> -Original Message-
> > >>> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> > >>> Behalf Of Michael Niedermayer
> > >>> Sent: Tuesday, October 23, 2018 10:06 AM
> > >>> To: FFmpeg development discussions and patches
> > >>> 
> > >>> Subject: Re: [FFmpeg-devel] [PATCH] libavfilter/vaapi: enable
> > >>> vaapi rotation feature via call Intel iHD driver
> > >>>
> > >>> On Tue, Oct 23, 2018 at 03:52:40PM +0800, Zachary Zhou wrote:
> > >>>> It supports clockwise rotation by 0/90/180/270 degrees defined in
> > >>>> va/va_vpp.h, tested following command line on SKL platform
> > >>>>
> > >>>> ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128
> > >>>> -hwaccel_output_format vaapi -i input.264 -vf
> > "rotation_vaapi=angle=90"
> > >>>> -c:v h264_vaapi output.h264
> > >>>> ---
> > >>>>  libavfilter/Makefile|   1 +
> > >>>>  libavfilter/allfilters.c|   1 +
> > >>>>  libavfilter/vaapi_vpp.h |   1 +
> > >>>>  libavfilter/vf_misc_vaapi.c | 122
> > >>>> 
> > >>>>  4 files changed, 125 insertions(+)
> > >>>
> > >>> breaks build
> > >>> make distclean ; ./configure && make -j12 ...
> > >>> libavfilter/vf_misc_vaapi.c: In function
> > ‘rotation_vaapi_build_filter_params’:
> > >>> libavfilter/vf_misc_vaapi.c:165:23: error: ‘VAProcPipelineCaps’
> > >>> has no
> > member named ‘rotation_flags’
> > >>>  if (!pipeline_caps.rotation_flags) {
> > >>>^
> > >>> libavfilter/vf_misc_vaapi.c:191:33: error: ‘VAProcPipelineCaps’
> > >>> has no
> > member named ‘rotation_flags’
> > >>>  support_flag = pipeline_caps.rotation_flags &
> > >>>  ^
> > >>> libavfilter/vf_misc_vaapi.c: In function ‘misc_vaapi_filter_frame’:
> > >>> libavfilter/vf_misc_vaapi.c:248:15: error:
> ‘VAProcPipelineParameterBuffer’
> > has no member named ‘rotation_state’
> > >>>  params.rotation_state = vpp_ctx->rotation_state;
> > >>>^
> > >>> make: *** [libavfilter/vf_misc_vaapi.o] Error 1
> > >>> make: *** Waiting for unfinished jobs
> > >>>
> > >>>
> > >>
> > >> Looks like VPP rotation caps weren't introduced until libva 2.1.0
> > >> (in commit
> > cff70165e08ab).
> > >> Perhaps, compilation of this feature should be guarded by
> > VA_CHECK_VERSION macro?
> > >>
> > >
> > > That is, VA-API 1.1.0... VA_CHECK_VERSION(1, 1, 0)
> >
> > I think this wants to be a configure option, because the filter will
> > be enabled or not based on it - maybe look for the rotation_state
> > field in VAProcPipelineParameterBuffer with check_struct?
> 
> Good idea to use check_struct, I am ramping up the build script configure.
> Is that possible for following steps -
> 1. use check_struct for rotation_state in configure file.
> 2. push !CONFIG_ROTATION_VAAPI_FILTER=yes to config.mak 3. separate
> rotation from denoise and sharpness from vf_misc_vaapi.c in a new c source
> file.
> 
> if anyone can give a hint for step 2 will save me a little time.

In patch v2 add following in configure file

+if ! check_struct "va/va.h" "struct _VAProcPipelineCaps" rotation_flags; 
then
+disable rotation_vaapi_filter
+fi

> 
> >
> > - Mark
> > ___
> > 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
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavfilter/vaapi: enable vaapi rotation feature via call Intel iHD driver

2018-10-24 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Mark Thompson
> Sent: Thursday, October 25, 2018 7:08 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH] libavfilter/vaapi: enable vaapi rotation
> feature via call Intel iHD driver
> 
> On 23/10/18 22:05, Eoff, Ullysses A wrote:
> >
> >> -Original Message-
> >> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> >> Of Eoff, Ullysses A
> >> Sent: Tuesday, October 23, 2018 1:50 PM
> >> To: FFmpeg development discussions and patches
> >> 
> >> Subject: Re: [FFmpeg-devel] [PATCH] libavfilter/vaapi: enable vaapi
> >> rotation feature via call Intel iHD driver
> >>
> >>> -Original Message-
> >>> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> >>> Behalf Of Michael Niedermayer
> >>> Sent: Tuesday, October 23, 2018 10:06 AM
> >>> To: FFmpeg development discussions and patches
> >>> 
> >>> Subject: Re: [FFmpeg-devel] [PATCH] libavfilter/vaapi: enable vaapi
> >>> rotation feature via call Intel iHD driver
> >>>
> >>> On Tue, Oct 23, 2018 at 03:52:40PM +0800, Zachary Zhou wrote:
>  It supports clockwise rotation by 0/90/180/270 degrees defined in
>  va/va_vpp.h, tested following command line on SKL platform
> 
>  ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128
>  -hwaccel_output_format vaapi -i input.264 -vf
> "rotation_vaapi=angle=90"
>  -c:v h264_vaapi output.h264
>  ---
>   libavfilter/Makefile|   1 +
>   libavfilter/allfilters.c|   1 +
>   libavfilter/vaapi_vpp.h |   1 +
>   libavfilter/vf_misc_vaapi.c | 122
>  
>   4 files changed, 125 insertions(+)
> >>>
> >>> breaks build
> >>> make distclean ; ./configure && make -j12 ...
> >>> libavfilter/vf_misc_vaapi.c: In function
> ‘rotation_vaapi_build_filter_params’:
> >>> libavfilter/vf_misc_vaapi.c:165:23: error: ‘VAProcPipelineCaps’ has no
> member named ‘rotation_flags’
> >>>  if (!pipeline_caps.rotation_flags) {
> >>>^
> >>> libavfilter/vf_misc_vaapi.c:191:33: error: ‘VAProcPipelineCaps’ has no
> member named ‘rotation_flags’
> >>>  support_flag = pipeline_caps.rotation_flags &
> >>>  ^
> >>> libavfilter/vf_misc_vaapi.c: In function ‘misc_vaapi_filter_frame’:
> >>> libavfilter/vf_misc_vaapi.c:248:15: error: ‘VAProcPipelineParameterBuffer’
> has no member named ‘rotation_state’
> >>>  params.rotation_state = vpp_ctx->rotation_state;
> >>>^
> >>> make: *** [libavfilter/vf_misc_vaapi.o] Error 1
> >>> make: *** Waiting for unfinished jobs
> >>>
> >>>
> >>
> >> Looks like VPP rotation caps weren't introduced until libva 2.1.0 (in 
> >> commit
> cff70165e08ab).
> >> Perhaps, compilation of this feature should be guarded by
> VA_CHECK_VERSION macro?
> >>
> >
> > That is, VA-API 1.1.0... VA_CHECK_VERSION(1, 1, 0)
> 
> I think this wants to be a configure option, because the filter will be 
> enabled
> or not based on it - maybe look for the rotation_state field in
> VAProcPipelineParameterBuffer with check_struct?

Good idea to use check_struct, I am ramping up the build script configure. 
Is that possible for following steps - 
1. use check_struct for rotation_state in configure file.
2. push !CONFIG_ROTATION_VAAPI_FILTER=yes to config.mak
3. separate rotation from denoise and sharpness from vf_misc_vaapi.c in a new c 
source file.

if anyone can give a hint for step 2 will save me a little time.

> 
> - Mark
> ___
> 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] tests/checkasm/Makefile: fix 'make fate' error when enable vaapi

2018-10-24 Thread Zhou, Zachary


> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of
> Mark Thompson
> Sent: Thursday, October 25, 2018 7:03 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH] tests/checkasm/Makefile: fix 'make fate'
> error when enable vaapi
> 
> On 24/10/18 06:15, Zachary Zhou wrote:
> > Reproduce the issue:
> >
> > $ ./configure --enable-libmfx --enable-vaapi --enable-shared
> > --samples=fate-suite/ $ make fate
> > LD  tests/checkasm/checkasm
> > /usr/bin/x86_64-linux-gnu-ld: libavutil/libavutil.a(hwcontext_vaapi.o):
> undefined reference to symbol 'XDisplayName'
> > //usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO
> > missing from command line
> > collect2: error: ld returned 1 exit status
> > tests/checkasm/Makefile:71: recipe for target
> > 'tests/checkasm/checkasm' failed
> > make: *** [tests/checkasm/checkasm] Error 1
> > ---
> >  configure | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/configure b/configure
> > index 85d5dd5962..f3e27cea10 100755
> > --- a/configure
> > +++ b/configure
> > @@ -6387,6 +6387,7 @@ if enabled vaapi; then
> >
> >  if enabled xlib; then
> >  check_pkg_config vaapi_x11 "libva-x11" "va/va_x11.h"
> > vaGetDisplay
> > +check_pkg_config vaapi_x11 "libX11" "X11/Xlib.h" XDisplayName
> >  fi
> >
> >  check_cpp_condition vaapi_1 "va/va.h" "VA_CHECK_VERSION(1, 0, 0)"
> >
> 
> This seems wrong - since xlib is enabled when you get here the xlib check on
> line 5891 should already have included the relevant X library options.
> 
> I think your build setup is incorrect somehow - note that to test a build 
> with --
> enable-shared you need to either run the install (+ ldconfig) or pass a 
> suitable
> LD_LIBRARY_PATH option.

I tried three PCs, and got the same build error, I also think EXTRALIBS-avutil 
should be a good place to add "-lX11". But after run build script configure, 
"-lX11" cannot be found in EXTRALIBS-avutil.

Yes, I read the line 5891, it is including "-lX11", but I think it is worked 
for run "make", not work for "make fate" in my test, I try to fix it, but looks 
like the script configure is a little complex.  

 It looks like in compile time mostly depend on LDFLAGS, not LD_LIBRARY_PATH. 
LD_LIBRARY_PATH is for the runtime.


> 
> Thanks,
> 
> - Mark
> ___
> 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] tests/checkasm/Makefile: fix 'make fate' error when enable vaapi

2018-10-23 Thread Zhou, Zachary
Good point, and I find in the build script configure can do function 
"XDisplayName" check when checking to enable vaapi. 

resent the patch. 

-Original Message-
From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of 
Hendrik Leppkes
Sent: Tuesday, October 23, 2018 8:56 PM
To: FFmpeg development discussions and patches 
Subject: Re: [FFmpeg-devel] [PATCH] tests/checkasm/Makefile: fix 'make fate' 
error when enable vaapi

On Tue, Oct 23, 2018 at 2:00 PM Zachary Zhou  wrote:
>
> Reproduce the issue:
>
> $ ./configure --enable-libmfx --enable-vaapi --enable-shared 
> --samples=fate-suite/ $ make fate
> LD  tests/checkasm/checkasm
> /usr/bin/x86_64-linux-gnu-ld: libavutil/libavutil.a(hwcontext_vaapi.o): 
> undefined reference to symbol 'XDisplayName'
> //usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO 
> missing from command line
> collect2: error: ld returned 1 exit status
> tests/checkasm/Makefile:71: recipe for target 
> 'tests/checkasm/checkasm' failed
> make: *** [tests/checkasm/checkasm] Error 1
> ---
>  tests/checkasm/Makefile | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index 
> 9484acbbd7..d4827dc816 100644
> --- a/tests/checkasm/Makefile
> +++ b/tests/checkasm/Makefile
> @@ -66,6 +66,7 @@ OBJDIRS += $(CHECKASMDIRS)
>  tests/checkasm/checkasm.o: CFLAGS += -Umain
>
>  CHECKASM := tests/checkasm/checkasm$(EXESUF)
> +EXTRALIBS += -lX11
>
>  $(CHECKASM): $(CHECKASMOBJS) $(FF_STATIC_DEP_LIBS)
> $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(CHECKASMOBJS) 
> $(FF_STATIC_DEP_LIBS) $(EXTRALIBS-avcodec) $(EXTRALIBS-avfilter) 
> $(EXTRALIBS-avformat) $(EXTRALIBS-avutil) $(EXTRALIBS-swresample) 
> $(EXTRALIBS)
> --
> 2.17.1
>

Shouldn't this be automatically coming in through EXTRALIBS-avutil?

- Hendrik
___
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] libavfilter/vaapi: enable vaapi rotation feature via call Intel iHD driver

2018-10-23 Thread Zhou, Zachary
I was planning to enable VAAPI rotation and mirroring as two features in two 
patches.
I am checking VAProcPipelineParameterBuffer::mirror_state, it looks like iHD 
driver doesn’t support to query mirror_flags via vaQueryVideoProcPipelineCaps 
currently.


-Original Message-
From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of Li, 
Zhong
Sent: Tuesday, October 23, 2018 8:56 PM
To: FFmpeg development discussions and patches 
Subject: Re: [FFmpeg-devel] [PATCH] libavfilter/vaapi: enable vaapi rotation 
feature via call Intel iHD driver

> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf 
> Of Moritz Barsnick
> Sent: Tuesday, October 23, 2018 8:32 PM
> To: FFmpeg development discussions and patches 
> 
> Subject: Re: [FFmpeg-devel] [PATCH] libavfilter/vaapi: enable vaapi 
> rotation feature via call Intel iHD driver
> 
> On Tue, Oct 23, 2018 at 09:56:04 +, Li, Zhong wrote:
> > Not sure vaapi can expose more angles or not.
> 
> VAAPI's rotation_state only supports those four "angles":
> http://01org.github.io/libva_staging_doxygen/struct__VAProcPipelinePar
> am eterBuffer.html#ae05cc1f2189c9e85339f7c63e9a61e1c

Yup, I know. I mean vaapi is kept in evolution. I am not sure future version 
VAAPI will introduce more angles or not.

> 
> > But using similar options/suboptions should be a good idea.
> 
> Great.
> 
> BTW, you could also introduce filters similar to hflip/vflip by using 
> VAProcPipelineParameterBuffer::mirror_state.

Good suggestion, :). 
> 
> Moritz

___
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