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

Li, Zhong zhong.li at intel.com
Thu Apr 11 05:51:18 EEST 2019


> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf
> Of Linjie Fu
> Sent: Wednesday, April 10, 2019 7:56 PM
> To: ffmpeg-devel at ffmpeg.org
> Cc: Fu, Linjie <linjie.fu at intel.com>
> Subject: [FFmpeg-devel] [PATCH, v2] lavu/hwcontext_qsv: Fix the realign
> check for hwupload
> 
> Fix the aligned check in hwupload, input surface should be 16 aligned too.
> 
> Fix #7830.
> 
> Signed-off-by: Linjie Fu <linjie.fu at 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..8b000fe636 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 & 15 || src->width & 15 ||
> +                            src->linesize[0] & 15) {

Should be better to use FFALIGN()

Another question is it really necessary to check width alignment if we already checked linesize to fix this issue?
(I guess it it not necessary, and if it is needed, many other places probably needed to be changed too.)


More information about the ffmpeg-devel mailing list