diff mbox series

[FFmpeg-devel,1/4] lavfi/qsvvpp: change the output frame's width and height

Message ID 20221124091930.558046-1-haihao.xiang@intel.com
State New
Headers show
Series [FFmpeg-devel,1/4] lavfi/qsvvpp: change the output frame's width and height | 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 Nov. 24, 2022, 9:19 a.m. UTC
From: "Chen,Wenbin" <wenbin.chen@intel.com>

Make sure the size of the output frame always matches the agreed upon
image size.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
---
 libavfilter/qsvvpp.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Soft Works Nov. 24, 2022, 6:57 p.m. UTC | #1
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Xiang, Haihao
> Sent: Thursday, November 24, 2022 10:19 AM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Chen,Wenbin <wenbin.chen@intel.com>
> Subject: [FFmpeg-devel] [PATCH 1/4] lavfi/qsvvpp: change the output
> frame's width and height
> 
> From: "Chen,Wenbin" <wenbin.chen@intel.com>
> 
> Make sure the size of the output frame always matches the agreed upon
> image size.
> 
> Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
> ---
>  libavfilter/qsvvpp.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
> index 8428ee89ab..bf719b2a29 100644
> --- a/libavfilter/qsvvpp.c
> +++ b/libavfilter/qsvvpp.c
> @@ -487,15 +487,14 @@ static QSVFrame *query_frame(QSVVPPContext *s,
> AVFilterLink *outlink)
>          if (!out_frame->frame)
>              return NULL;
> 
> -        out_frame->frame->width  = outlink->w;
> -        out_frame->frame->height = outlink->h;
> -
>          ret = map_frame_to_surface(out_frame->frame,
>                                     &out_frame->surface);
>          if (ret < 0)
>              return NULL;
>      }
> 
> +    out_frame->frame->width  = outlink->w;
> +    out_frame->frame->height = outlink->h;
>      out_frame->surface.Info = s->vpp_param.vpp.Out;
> 
>      return out_frame;
> --

Which problem case does this address?

Thanks,
sw
Xiang, Haihao Nov. 25, 2022, 1:52 a.m. UTC | #2
On Thu, 2022-11-24 at 18:57 +0000, Soft Works wrote:
> > -----Original Message-----
> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > Xiang, Haihao
> > Sent: Thursday, November 24, 2022 10:19 AM
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Chen,Wenbin <wenbin.chen@intel.com>
> > Subject: [FFmpeg-devel] [PATCH 1/4] lavfi/qsvvpp: change the output
> > frame's width and height
> > 
> > From: "Chen,Wenbin" <wenbin.chen@intel.com>
> > 
> > Make sure the size of the output frame always matches the agreed upon
> > image size.
> > 
> > Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
> > ---
> >  libavfilter/qsvvpp.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
> > index 8428ee89ab..bf719b2a29 100644
> > --- a/libavfilter/qsvvpp.c
> > +++ b/libavfilter/qsvvpp.c
> > @@ -487,15 +487,14 @@ static QSVFrame *query_frame(QSVVPPContext *s,
> > AVFilterLink *outlink)
> >          if (!out_frame->frame)
> >              return NULL;
> > 
> > -        out_frame->frame->width  = outlink->w;
> > -        out_frame->frame->height = outlink->h;
> > -
> >          ret = map_frame_to_surface(out_frame->frame,
> >                                     &out_frame->surface);
> >          if (ret < 0)
> >              return NULL;
> >      }
> > 
> > +    out_frame->frame->width  = outlink->w;
> > +    out_frame->frame->height = outlink->h;
> >      out_frame->surface.Info = s->vpp_param.vpp.Out;
> > 
> >      return out_frame;
> > --
> 
> Which problem case does this address?

av_hwframe_get_buffer() gets a frame with aligned dimension, the filtered_frame
dimension might not be the expected one if don't reset width and height to the
agreed image width and height. E.g. the filtered frame is 1920x1088, not
1920x1080 in the following command

$ ffmpeg -hwaccel qsv -i input.mp4 -vf "vpp_qsv=w=1920:h=1080" -f null -

Thanks
Haihao
diff mbox series

Patch

diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index 8428ee89ab..bf719b2a29 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -487,15 +487,14 @@  static QSVFrame *query_frame(QSVVPPContext *s, AVFilterLink *outlink)
         if (!out_frame->frame)
             return NULL;
 
-        out_frame->frame->width  = outlink->w;
-        out_frame->frame->height = outlink->h;
-
         ret = map_frame_to_surface(out_frame->frame,
                                    &out_frame->surface);
         if (ret < 0)
             return NULL;
     }
 
+    out_frame->frame->width  = outlink->w;
+    out_frame->frame->height = outlink->h;
     out_frame->surface.Info = s->vpp_param.vpp.Out;
 
     return out_frame;