[FFmpeg-devel] lavu/hwcontext_qsv: Fix the realign check for hwupload

Submitted by Linjie Fu on April 10, 2019, 11:26 a.m.

Details

Message ID 20190410112634.18597-1-linjie.fu@intel.com
State New
Headers show

Commit Message

Linjie Fu April 10, 2019, 11:26 a.m.
Fix the aligned check in hwupload, input surface should be 16 aligned
too.

Fix #7830.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
---
 libavutil/hwcontext_qsv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Carl Eugen Hoyos April 10, 2019, 11:35 a.m.
2019-04-10 13:26 GMT+02:00, Linjie Fu <linjie.fu@intel.com>:
> Fix the aligned check in hwupload, input surface should be 16 aligned
> too.
>
> Fix #7830.
>
> Signed-off-by: Linjie Fu <linjie.fu@intel.com>
> ---
>  libavutil/hwcontext_qsv.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
> index b6d8bfe2bf..bc6236f25d 100644
> --- a/libavutil/hwcontext_qsv.c
> +++ b/libavutil/hwcontext_qsv.c
> @@ -892,7 +892,8 @@ static int qsv_transfer_data_to(AVHWFramesContext *ctx,
> AVFrame *dst,
>          return ret;
>
>
> -    if (src->height & 16 || src->linesize[0] & 16) {
> +    if (src->height % 16 || src->width % 16 ||
> +                            src->linesize[0] % 16) {

& 15?

Carl Eugen
Linjie Fu April 10, 2019, 11:40 a.m.
> -----Original Message-----

> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf

> Of Carl Eugen Hoyos

> Sent: Wednesday, April 10, 2019 19:35

> To: FFmpeg development discussions and patches <ffmpeg-

> devel@ffmpeg.org>

> Subject: Re: [FFmpeg-devel] [PATCH] lavu/hwcontext_qsv: Fix the realign

> check for hwupload

> 

> 2019-04-10 13:26 GMT+02:00, Linjie Fu <linjie.fu@intel.com>:

> > Fix the aligned check in hwupload, input surface should be 16 aligned

> > too.

> >

> > Fix #7830.

> >

> > Signed-off-by: Linjie Fu <linjie.fu@intel.com>

> > ---

> >  libavutil/hwcontext_qsv.c | 3 ++-

> >  1 file changed, 2 insertions(+), 1 deletion(-)

> >

> > diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c

> > index b6d8bfe2bf..bc6236f25d 100644

> > --- a/libavutil/hwcontext_qsv.c

> > +++ b/libavutil/hwcontext_qsv.c

> > @@ -892,7 +892,8 @@ static int

> qsv_transfer_data_to(AVHWFramesContext *ctx,

> > AVFrame *dst,

> >          return ret;

> >

> >

> > -    if (src->height & 16 || src->linesize[0] & 16) {

> > +    if (src->height % 16 || src->width % 16 ||

> > +                            src->linesize[0] % 16) {

> 

> & 15?


& 15 seems to be better, thanks.

Linjie

Patch hide | download patch | download mbox

diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
index b6d8bfe2bf..bc6236f25d 100644
--- a/libavutil/hwcontext_qsv.c
+++ b/libavutil/hwcontext_qsv.c
@@ -892,7 +892,8 @@  static int qsv_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst,
         return ret;
 
 
-    if (src->height & 16 || src->linesize[0] & 16) {
+    if (src->height % 16 || src->width % 16 ||
+                            src->linesize[0] % 16) {
         realigned = 1;
         memset(&tmp_frame, 0, sizeof(tmp_frame));
         tmp_frame.format         = src->format;