[FFmpeg-devel] [PATCH] lavu/hwcontext_qsv: update crop width/height when mapping frames
Rodger Combs
rodger.combs at gmail.com
Thu Sep 12 06:59:23 EEST 2019
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
More information about the ffmpeg-devel
mailing list