diff mbox series

[FFmpeg-devel,5/8] lavfi/vf_vpp_qsv: add has_passthrough flag in VPPContext

Message ID 20230109071210.1829699-5-haihao.xiang@intel.com
State Accepted
Commit dc5369144b824ee6d14086b06759b291a8213646
Headers show
Series [FFmpeg-devel,1/8] lavfi/vf_vpp_qsv: add "a", "dar" and "sar" variables | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Xiang, Haihao Jan. 9, 2023, 7:12 a.m. UTC
From: Haihao Xiang <haihao.xiang@intel.com>

QSV filters may set this flag in preinit callback to turn on / off pass
through mode

This is in preparation for reusing the code for other QSV filters. E.g.
scale_qsv filter doesn't support pass through mode.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
---
 libavfilter/vf_vpp_qsv.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Andreas Rheinhardt Jan. 12, 2023, 4:31 a.m. UTC | #1
Xiang, Haihao:
> From: Haihao Xiang <haihao.xiang@intel.com>
> 
> QSV filters may set this flag in preinit callback to turn on / off pass
> through mode
> 
> This is in preparation for reusing the code for other QSV filters. E.g.
> scale_qsv filter doesn't support pass through mode.
> 
> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
> ---
>  libavfilter/vf_vpp_qsv.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
> index 2a7b06fa33..b04307b644 100644
> --- a/libavfilter/vf_vpp_qsv.c
> +++ b/libavfilter/vf_vpp_qsv.c
> @@ -102,6 +102,7 @@ typedef struct VPPContext{
>  
>      int async_depth;
>      int eof;
> +    int has_passthrough;        /* apply pass through mode if possible */
>  } VPPContext;
>  
>  static const AVOption options[] = {
> @@ -269,6 +270,8 @@ static av_cold int vpp_preinit(AVFilterContext *ctx)
>      vpp->contrast = 1.0;
>      vpp->transpose = -1;
>  
> +    vpp->has_passthrough = 1;
> +
>      return 0;
>  }
>  
> @@ -552,7 +555,8 @@ static int config_output(AVFilterLink *outlink)
>  
>      if (vpp->use_frc || vpp->use_crop || vpp->deinterlace || vpp->denoise ||
>          vpp->detail || vpp->procamp || vpp->rotate || vpp->hflip ||
> -        inlink->w != outlink->w || inlink->h != outlink->h || in_format != vpp->out_format)
> +        inlink->w != outlink->w || inlink->h != outlink->h || in_format != vpp->out_format ||
> +        !vpp->has_passthrough)
>          return ff_qsvvpp_create(ctx, &vpp->qsv, &param);
>      else {
>          av_log(ctx, AV_LOG_VERBOSE, "qsv vpp pass through mode.\n");

I don't get how this patch either. In the current patchset,
has_passthrough is always 1 (after the preinit callback) for the vpp_qsv
filter. The code here is only used by said filter and no other filter at
all, so has_passthrough is always 1 in config_output(), i.e. this whole
change is pointless.

- Andreas
Xiang, Haihao Jan. 12, 2023, 4:53 a.m. UTC | #2
On Do, 2023-01-12 at 05:31 +0100, Andreas Rheinhardt wrote:
> Xiang, Haihao:
> > From: Haihao Xiang <haihao.xiang@intel.com>
> > 
> > QSV filters may set this flag in preinit callback to turn on / off pass
> > through mode
> > 
> > This is in preparation for reusing the code for other QSV filters. E.g.
> > scale_qsv filter doesn't support pass through mode.
> > 
> > Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
> > ---
> >  libavfilter/vf_vpp_qsv.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
> > index 2a7b06fa33..b04307b644 100644
> > --- a/libavfilter/vf_vpp_qsv.c
> > +++ b/libavfilter/vf_vpp_qsv.c
> > @@ -102,6 +102,7 @@ typedef struct VPPContext{
> >  
> >      int async_depth;
> >      int eof;
> > +    int has_passthrough;        /* apply pass through mode if possible */
> >  } VPPContext;
> >  
> >  static const AVOption options[] = {
> > @@ -269,6 +270,8 @@ static av_cold int vpp_preinit(AVFilterContext *ctx)
> >      vpp->contrast = 1.0;
> >      vpp->transpose = -1;
> >  
> > +    vpp->has_passthrough = 1;
> > +
> >      return 0;
> >  }
> >  
> > @@ -552,7 +555,8 @@ static int config_output(AVFilterLink *outlink)
> >  
> >      if (vpp->use_frc || vpp->use_crop || vpp->deinterlace || vpp->denoise
> > ||
> >          vpp->detail || vpp->procamp || vpp->rotate || vpp->hflip ||
> > -        inlink->w != outlink->w || inlink->h != outlink->h || in_format !=
> > vpp->out_format)
> > +        inlink->w != outlink->w || inlink->h != outlink->h || in_format !=
> > vpp->out_format ||
> > +        !vpp->has_passthrough)
> >          return ff_qsvvpp_create(ctx, &vpp->qsv, &param);
> >      else {
> >          av_log(ctx, AV_LOG_VERBOSE, "qsv vpp pass through mode.\n");
> 
> I don't get how this patch either. In the current patchset,
> has_passthrough is always 1 (after the preinit callback) for the vpp_qsv
> filter. The code here is only used by said filter and no other filter at
> all, so has_passthrough is always 1 in config_output(), i.e. this whole
> change is pointless.

I'll reuse the above code for scale_qsv filter where pass through is not
supported (a qsv session is always created in scale_qsv filter).

Thanks
Haihao

> 
> - Andreas
> 
> _______________________________________________
> 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".
diff mbox series

Patch

diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
index 2a7b06fa33..b04307b644 100644
--- a/libavfilter/vf_vpp_qsv.c
+++ b/libavfilter/vf_vpp_qsv.c
@@ -102,6 +102,7 @@  typedef struct VPPContext{
 
     int async_depth;
     int eof;
+    int has_passthrough;        /* apply pass through mode if possible */
 } VPPContext;
 
 static const AVOption options[] = {
@@ -269,6 +270,8 @@  static av_cold int vpp_preinit(AVFilterContext *ctx)
     vpp->contrast = 1.0;
     vpp->transpose = -1;
 
+    vpp->has_passthrough = 1;
+
     return 0;
 }
 
@@ -552,7 +555,8 @@  static int config_output(AVFilterLink *outlink)
 
     if (vpp->use_frc || vpp->use_crop || vpp->deinterlace || vpp->denoise ||
         vpp->detail || vpp->procamp || vpp->rotate || vpp->hflip ||
-        inlink->w != outlink->w || inlink->h != outlink->h || in_format != vpp->out_format)
+        inlink->w != outlink->w || inlink->h != outlink->h || in_format != vpp->out_format ||
+        !vpp->has_passthrough)
         return ff_qsvvpp_create(ctx, &vpp->qsv, &param);
     else {
         av_log(ctx, AV_LOG_VERBOSE, "qsv vpp pass through mode.\n");