mbox series

[FFmpeg-devel,v2,00/11] Fixes and Enhancements for VAAPI Overlay

Message ID pull.42.v2.ffstaging.FFmpeg.1667197207.ffmpegagent@gmail.com
Headers show
Series Fixes and Enhancements for VAAPI Overlay | expand

Message

Aman Karmani Oct. 31, 2022, 6:19 a.m. UTC
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

softworkz (11):
  avfilter/overlay_vaapi: use FILTER_SINGLE_PIXFMT
  avfilter/overlay_vaapi: build filter params just once
  avfilter/overlay_vaapi: remove double framesync init
  avfilter/overlay_vaapi: handle secondary null input
  avfilter/overlay_vaapi: reformat options
  avfilter/overlay_vaapi: remove redundant .get_buffer assignments
  avfilter/overlay_vaapi: add framesync options
  avfilter/overlay_vaapi: precalculate blend_state, enable pixel alpha
  avfilter/overlay_vaapi: enable expressions for overlay parameters
  doc/filters.texi: remove incorrect statement
  doc/filters.texi: update overlay_vaapi documentation

 doc/filters.texi               |  52 ++++--
 libavfilter/vf_overlay_vaapi.c | 328 ++++++++++++++++++++++-----------
 2 files changed, 259 insertions(+), 121 deletions(-)


base-commit: f3b5277057ad84071721f01419fe4badeceaff08
Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-42%2Fsoftworkz%2Fsubmit_vaapi_overlay-v2
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-42/softworkz/submit_vaapi_overlay-v2
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/42

Range-diff vs v1:

  1:  6ec5e9960b =  1:  6ec5e9960b avfilter/overlay_vaapi: use FILTER_SINGLE_PIXFMT
  2:  3c1629de97 =  2:  3c1629de97 avfilter/overlay_vaapi: build filter params just once
  3:  2bd535abb5 =  3:  2bd535abb5 avfilter/overlay_vaapi: remove double framesync init
  4:  fb365de036 =  4:  fb365de036 avfilter/overlay_vaapi: handle secondary null input
  5:  6624c66688 =  5:  6624c66688 avfilter/overlay_vaapi: reformat options
  6:  989f16597e =  6:  989f16597e avfilter/overlay_vaapi: remove redundant .get_buffer assignments
  7:  5ff8f82002 =  7:  5ff8f82002 avfilter/overlay_vaapi: add framesync options
  8:  4fba07d9f9 =  8:  4fba07d9f9 avfilter/overlay_vaapi: precalculate blend_state, enable pixel alpha
  9:  36ed7b96eb !  9:  20b9e9c992 avfilter/overlay_vaapi: enable expressions for overlay parameters
     @@ libavfilter/vf_overlay_vaapi.c
      +#include "libavutil/eval.h"
      +
      +enum var_name {
     -+    VAR_MAIN_iW,     VAR_MW,
     -+    VAR_MAIN_iH,     VAR_MH,
     -+    VAR_OVERLAY_iW,
     -+    VAR_OVERLAY_iH,
     ++    VAR_MAIN_IW,     VAR_MW,
     ++    VAR_MAIN_IH,     VAR_MH,
     ++    VAR_OVERLAY_IW,
     ++    VAR_OVERLAY_IH,
      +    VAR_OVERLAY_X,  VAR_OX,
      +    VAR_OVERLAY_Y,  VAR_OY,
      +    VAR_OVERLAY_W,  VAR_OW,
     @@ libavfilter/vf_overlay_vaapi.c: static int have_alpha_planar(AVFilterLink *link)
      +    AVFilterContext  *avctx  = inlink->dst;
      +    OverlayVAAPIContext *ctx = avctx->priv;
      +
     -+    ctx->var_values[VAR_MAIN_iW] =
     ++    ctx->var_values[VAR_MAIN_IW] =
      +    ctx->var_values[VAR_MW]      = inlink->w;
     -+    ctx->var_values[VAR_MAIN_iH] =
     ++    ctx->var_values[VAR_MAIN_IH] =
      +    ctx->var_values[VAR_MH]      = inlink->h;
      +
      +    return ff_vaapi_vpp_config_input(inlink);
     @@ libavfilter/vf_overlay_vaapi.c: static int have_alpha_planar(AVFilterLink *link)
           OverlayVAAPIContext *ctx = avctx->priv;
      +    int ret;
      +
     -+    ctx->var_values[VAR_OVERLAY_iW] = inlink->w;
     -+    ctx->var_values[VAR_OVERLAY_iH] = inlink->h;
     ++    ctx->var_values[VAR_OVERLAY_IW] = inlink->w;
     ++    ctx->var_values[VAR_OVERLAY_IH] = inlink->h;
      +
      +    ret = eval_expr(avctx);
      +    if (ret < 0)
 10:  3618b3e941 = 10:  be57f70a9d doc/filters.texi: remove incorrect statement
 11:  675b5279c3 ! 11:  b3ea03e037 doc/filters.texi: update overlay_vaapi documentation
     @@ doc/filters.texi: It takes two inputs and has one output. The first input is the
      +Set expressions for the width and height the overlaid video
      +on the main video.
      +
     ++Default values are 'overlay_iw' for 'w' and 'overlay_ih*w/overlay_iw' for 'h'.
     ++
      +The expressions can contain the following parameters:
      +
      +@table @option