[FFmpeg-devel] [PATCH] lavu/hwcontext_qsv: update crop width/height when mapping frames

Li, Zhong zhong.li at intel.com
Thu Sep 12 15:59:08 EEST 2019


> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of Rodger
> Combs
> Sent: Thursday, September 12, 2019 11:59 AM
> To: ffmpeg-devel at ffmpeg.org
> Subject: [FFmpeg-devel] [PATCH] lavu/hwcontext_qsv: update crop width/height
> when mapping frames
> 
> This fixes an issue where the context could be configured with one resolution, but
> incoming frames could have another, and our output AVFrames wouldn't match
> the underlying surfaces' resolution, which is usually the value that MFX code uses.
> 
> In particular, this would happen when mapping from DXVA2 decoders, since
> DXVA2 aligns the width/height fields in its context to the required alignment for
> the particular codec being used, and those values are then propagated into the
> QSV context, rather than the crop dimensions.
> ---
>  libavutil/hwcontext_qsv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index
> 8f9838d7d8..fe5a705c19 100644
> --- a/libavutil/hwcontext_qsv.c
> +++ b/libavutil/hwcontext_qsv.c
> @@ -1031,8 +1031,8 @@ static int qsv_map_to(AVHWFramesContext *dst_ctx,
>      if (err)
>          return err;
> 
> -    dst->width   = src->width;
> -    dst->height  = src->height;
> +    hwctx->surfaces[i].Info.CropW = dst->width  = src->width;
> +    hwctx->surfaces[i].Info.CropH = dst->height = src->height;
>      dst->data[3] = (uint8_t*)&hwctx->surfaces[i];
> 
>      return 0;
> --
> 2.21.0

Patch looks good. 
Could you please share detailed command line and clip to reproduce the issue?



More information about the ffmpeg-devel mailing list