Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes and Enhancements for VAAPI Overlay #42

Closed
wants to merge 12 commits into from

Conversation

softworkz
Copy link
Collaborator

@softworkz softworkz commented Oct 10, 2022

This patchset resolves a number of issues in the current code:

  • Bogus doubles framesync initialization
  • Executing build_parameters on each input frame
  • Segfault when there's no secondary input (yet)

and adds a number of enhancements to bring this on-par with the other overlay filters:

  • Enable pixel alpha blending
  • Expose framesync parameters
  • Add support for expressions in overlay parameters (x, y, w, h)

v2 Changes:

  • Changed var names to all-caps
  • Added note about defaults for w/h to filters.texi

cc: Gyan Doshi ffmpeg@gyani.pro
cc: Soft Works softworkz@hotmail.com
cc: "Xiang, Haihao" haihao.xiang-at-intel.com@ffmpeg.org

Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: softworkz <softworkz@hotmail.com>
Currently segfaults in this case.

Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: softworkz <softworkz@hotmail.com>
@softworkz
Copy link
Collaborator Author

/submit

@ffmpeg-codebot
Copy link

Submitted as pull.42.ffstaging.FFmpeg.1665399281.ffmpegagent@gmail.com

To fetch this version into FETCH_HEAD:

git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-42/softworkz/submit_vaapi_overlay-v1

To fetch this version to local tag pr-ffstaging-42/softworkz/submit_vaapi_overlay-v1:

git fetch --no-tags https://github.com/ffstaging/FFmpeg tag pr-ffstaging-42/softworkz/submit_vaapi_overlay-v1

doc/filters.texi Outdated Show resolved Hide resolved
@ffmpeg-codebot
Copy link

User Gyan Doshi <ffmpeg@gyani.pro> has been added to the cc: list.

@ffmpeg-codebot
Copy link

User Soft Works <softworkz@hotmail.com> has been added to the cc: list.

@ffmpeg-codebot
Copy link

User "Xiang, Haihao" <haihao.xiang-at-intel.com@ffmpeg.org> has been added to the cc: list.

Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: softworkz <softworkz@hotmail.com>
@softworkz
Copy link
Collaborator Author

/submit

@ffmpeg-codebot
Copy link

Submitted as pull.42.v2.ffstaging.FFmpeg.1667197207.ffmpegagent@gmail.com

To fetch this version into FETCH_HEAD:

git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-42/softworkz/submit_vaapi_overlay-v2

To fetch this version to local tag pr-ffstaging-42/softworkz/submit_vaapi_overlay-v2:

git fetch --no-tags https://github.com/ffstaging/FFmpeg tag pr-ffstaging-42/softworkz/submit_vaapi_overlay-v2

@@ -38,34 +38,6 @@ typedef struct OverlayVAAPIContext {
float alpha;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the FFmpeg mailing list, "Xiang, Haihao" wrote (reply to this):

On Mon, 2022-10-31 at 06:19 +0000, softworkz wrote:
> From: softworkz <softworkz@hotmail.com>
> 
> Signed-off-by: softworkz <softworkz@hotmail.com>
> ---
>  libavfilter/vf_overlay_vaapi.c | 30 +-----------------------------
>  1 file changed, 1 insertion(+), 29 deletions(-)
> 
> diff --git a/libavfilter/vf_overlay_vaapi.c b/libavfilter/vf_overlay_vaapi.c
> index 3e6a0de13f..218daf571f 100644
> --- a/libavfilter/vf_overlay_vaapi.c
> +++ b/libavfilter/vf_overlay_vaapi.c
> @@ -38,34 +38,6 @@ typedef struct OverlayVAAPIContext {
>      float            alpha;
>  } OverlayVAAPIContext;
>  
> -static int overlay_vaapi_query_formats(AVFilterContext *ctx)
> -{
> -    int ret;
> -    enum {
> -        MAIN    = 0,
> -        OVERLAY = 1,
> -    };
> -
> -    static const enum AVPixelFormat pix_fmts[] = {
> -        AV_PIX_FMT_VAAPI,
> -        AV_PIX_FMT_NONE
> -    };
> -
> -    ret = ff_formats_ref(ff_make_format_list(pix_fmts), &ctx->inputs[MAIN]-
> >outcfg.formats);
> -    if (ret < 0)
> -        return ret;
> -
> -    ret = ff_formats_ref(ff_make_format_list(pix_fmts), &ctx-
> >inputs[OVERLAY]->outcfg.formats);
> -    if (ret < 0)
> -        return ret;
> -
> -    ret = ff_formats_ref(ff_make_format_list(pix_fmts), &ctx->outputs[0]-
> >incfg.formats);
> -    if (ret < 0)
> -        return ret;
> -
> -    return 0;
> -}
> -
>  static int overlay_vaapi_build_filter_params(AVFilterContext *avctx)
>  {
>      VAAPIVPPContext *vpp_ctx   = avctx->priv;
> @@ -418,6 +390,6 @@ const AVFilter ff_vf_overlay_vaapi = {
>      .activate        = &overlay_vaapi_activate,
>      FILTER_INPUTS(overlay_vaapi_inputs),
>      FILTER_OUTPUTS(overlay_vaapi_outputs),
> -    FILTER_QUERY_FUNC(overlay_vaapi_query_formats),
> +    FILTER_SINGLE_PIXFMT(AV_PIX_FMT_VAAPI),
>      .flags_internal  = FF_FILTER_FLAG_HWFRAME_AWARE,
>  };

Patchset LGTM, will apply

-Haihao

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the FFmpeg mailing list, "Xiang, Haihao" wrote (reply to this):

On Fri, 2022-11-04 at 02:07 +0000, Xiang, Haihao wrote:
> On Mon, 2022-10-31 at 06:19 +0000, softworkz wrote:
> > From: softworkz <softworkz@hotmail.com>
> > 
> > Signed-off-by: softworkz <softworkz@hotmail.com>
> > ---
> >  libavfilter/vf_overlay_vaapi.c | 30 +-----------------------------
> >  1 file changed, 1 insertion(+), 29 deletions(-)
> > 
> > diff --git a/libavfilter/vf_overlay_vaapi.c b/libavfilter/vf_overlay_vaapi.c
> > index 3e6a0de13f..218daf571f 100644
> > --- a/libavfilter/vf_overlay_vaapi.c
> > +++ b/libavfilter/vf_overlay_vaapi.c
> > @@ -38,34 +38,6 @@ typedef struct OverlayVAAPIContext {
> >      float            alpha;
> >  } OverlayVAAPIContext;
> >  
> > -static int overlay_vaapi_query_formats(AVFilterContext *ctx)
> > -{
> > -    int ret;
> > -    enum {
> > -        MAIN    = 0,
> > -        OVERLAY = 1,
> > -    };
> > -
> > -    static const enum AVPixelFormat pix_fmts[] = {
> > -        AV_PIX_FMT_VAAPI,
> > -        AV_PIX_FMT_NONE
> > -    };
> > -
> > -    ret = ff_formats_ref(ff_make_format_list(pix_fmts), &ctx->inputs[MAIN]-
> > > outcfg.formats);
> > -    if (ret < 0)
> > -        return ret;
> > -
> > -    ret = ff_formats_ref(ff_make_format_list(pix_fmts), &ctx-
> > > inputs[OVERLAY]->outcfg.formats);
> > -    if (ret < 0)
> > -        return ret;
> > -
> > -    ret = ff_formats_ref(ff_make_format_list(pix_fmts), &ctx->outputs[0]-
> > > incfg.formats);
> > -    if (ret < 0)
> > -        return ret;
> > -
> > -    return 0;
> > -}
> > -
> >  static int overlay_vaapi_build_filter_params(AVFilterContext *avctx)
> >  {
> >      VAAPIVPPContext *vpp_ctx   = avctx->priv;
> > @@ -418,6 +390,6 @@ const AVFilter ff_vf_overlay_vaapi = {
> >      .activate        = &overlay_vaapi_activate,
> >      FILTER_INPUTS(overlay_vaapi_inputs),
> >      FILTER_OUTPUTS(overlay_vaapi_outputs),
> > -    FILTER_QUERY_FUNC(overlay_vaapi_query_formats),
> > +    FILTER_SINGLE_PIXFMT(AV_PIX_FMT_VAAPI),
> >      .flags_internal  = FF_FILTER_FLAG_HWFRAME_AWARE,
> >  };
> 
> Patchset LGTM, will apply
> 

Pushed,

-Haihao

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

@softworkz
Copy link
Collaborator Author

This has been merged already.

@softworkz softworkz closed this Dec 11, 2022
@ffmpeg-codebot
Copy link

Invalid author email in a064193: "4985349+softworkz@users.noreply.github.com"

@ffmpeg-codebot
Copy link

There is a merge commit in this Pull Request:

a064193038d91b1171de4db961f2100742e8381a

Please rebase the branch and force-push.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant