Skip to content

Commit 661d373

Browse files
committed
lavc/qsvdec: provide crop_w/h for mfx frame_info
some decoding cases failed with garbage due to without setting cropW/H It can be reproduced when decoding some mpeg2 videos in system memory. see ./ffmpeg -c:v mpeg2_qsv -i kitchen_720x480_2.mpg -pix_fmt nv12 -pix_fmt yuv420p test_720x480.yuv Signed-off-by: Zhong Li <zhong.li@intel.com>
1 parent eb8f298 commit 661d373

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

libavcodec/qsvdec.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,6 @@ static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q)
103103
mfxSession session = NULL;
104104
int iopattern = 0;
105105
mfxVideoParam param = { 0 };
106-
int frame_width = avctx->coded_width;
107-
int frame_height = avctx->coded_height;
108106
int ret;
109107

110108
desc = av_pix_fmt_desc_get(avctx->sw_pix_fmt);
@@ -160,8 +158,10 @@ static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q)
160158
param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth;
161159
param.mfx.FrameInfo.Shift = desc->comp[0].depth > 8;
162160
param.mfx.FrameInfo.FourCC = q->fourcc;
163-
param.mfx.FrameInfo.Width = frame_width;
164-
param.mfx.FrameInfo.Height = frame_height;
161+
param.mfx.FrameInfo.Width = avctx->coded_width;
162+
param.mfx.FrameInfo.Height = avctx->coded_height;
163+
param.mfx.FrameInfo.CropW = avctx->width;
164+
param.mfx.FrameInfo.CropH = avctx->height;
165165
param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420;
166166

167167
switch (avctx->field_order) {

0 commit comments

Comments
 (0)