diff mbox series

[FFmpeg-devel] libavfilter/qsvvpp: change the output frame's width and height

Message ID 20210322064346.2272438-1-wenbin.chen@intel.com
State New
Headers show
Series [FFmpeg-devel] libavfilter/qsvvpp: change the output frame's width and height
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Chen, Wenbin March 22, 2021, 6:43 a.m. UTC
From: "Chen,Wenbin" <wenbin.chen@intel.com>

qsvvpp align the width and height with 16, and that may lead to error.
For example, when we use qsvvpp to resize frame to 1080p, qsvvpp will
align frame to 1088 which is different from the height of
encoder (1080) and this will be treated as resolution change. Now I 
assign the out_link's w/h to output
frame to overwrite the w/h got from hw_frame_ctx.

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

Comments

Xiang, Haihao March 23, 2021, 5:44 a.m. UTC | #1
On Mon, 2021-03-22 at 14:43 +0800, wenbin.chen@intel.com wrote:
> From: "Chen,Wenbin" <wenbin.chen@intel.com>
> 
> qsvvpp align the width and height with 16, and that may lead to error.
> For example, when we use qsvvpp to resize frame to 1080p, qsvvpp will
> align frame to 1088 which is different from the height of
> encoder (1080) and this will be treated as resolution change. Now I 
> assign the out_link's w/h to output
> frame to overwrite the w/h got from hw_frame_ctx.
> 
> Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
> ---
>  libavfilter/qsvvpp.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
> index f216b3f248..8658a70083 100644
> --- a/libavfilter/qsvvpp.c
> +++ b/libavfilter/qsvvpp.c
> @@ -476,6 +476,9 @@ static QSVFrame *query_frame(QSVVPPContext *s,
> AVFilterLink *outlink)
>              return NULL;
>          }
>  
> +        out_frame->frame->width  = outlink->w;
> +        out_frame->frame->height = outlink->h;

So the above code is needed for both system and video memory, could you factor
the common code out?

> +
>          out_frame->surface = (mfxFrameSurface1 *)out_frame->frame->data[3];
>      } else {
>          /* Get a frame with aligned dimensions.
Chen, Wenbin March 23, 2021, 7:13 a.m. UTC | #2
> -----Original Message-----
> From: Xiang, Haihao <haihao.xiang@intel.com>
> Sent: Tuesday, March 23, 2021 1:44 PM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Chen, Wenbin <wenbin.chen@intel.com>
> Subject: Re: [FFmpeg-devel] [PATCH] libavfilter/qsvvpp: change the output
> frame's width and height
> 
> On Mon, 2021-03-22 at 14:43 +0800, wenbin.chen@intel.com wrote:
> > From: "Chen,Wenbin" <wenbin.chen@intel.com>
> >
> > qsvvpp align the width and height with 16, and that may lead to error.
> > For example, when we use qsvvpp to resize frame to 1080p, qsvvpp will
> > align frame to 1088 which is different from the height of
> > encoder (1080) and this will be treated as resolution change. Now I
> > assign the out_link's w/h to output
> > frame to overwrite the w/h got from hw_frame_ctx.
> >
> > Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
> > ---
> >  libavfilter/qsvvpp.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
> > index f216b3f248..8658a70083 100644
> > --- a/libavfilter/qsvvpp.c
> > +++ b/libavfilter/qsvvpp.c
> > @@ -476,6 +476,9 @@ static QSVFrame *query_frame(QSVVPPContext *s,
> > AVFilterLink *outlink)
> >              return NULL;
> >          }
> >
> > +        out_frame->frame->width  = outlink->w;
> > +        out_frame->frame->height = outlink->h;
> 
> So the above code is needed for both system and video memory, could you
> factor
> the common code out?

Ok, I will do it. Thanks for your advice.

> 
> > +
> >          out_frame->surface = (mfxFrameSurface1 *)out_frame->frame-
> >data[3];
> >      } else {
> >          /* Get a frame with aligned dimensions.
diff mbox series

Patch

diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index f216b3f248..8658a70083 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -476,6 +476,9 @@  static QSVFrame *query_frame(QSVVPPContext *s, AVFilterLink *outlink)
             return NULL;
         }
 
+        out_frame->frame->width  = outlink->w;
+        out_frame->frame->height = outlink->h;
+
         out_frame->surface = (mfxFrameSurface1 *)out_frame->frame->data[3];
     } else {
         /* Get a frame with aligned dimensions.