summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2016-06-22 11:57:36 +0200
committerAnton Khirnov <anton@khirnov.net>2016-06-29 12:15:14 +0200
commit9b02be05f65dc7c030c991fe6de12ce2e58fb467 (patch)
treef5900bcda78165019b6614b87709907c1e98e08a
parent645954328b73e73f2c5ca79ce7f142f4118b146f (diff)
qsvdec: when a frames ctx is supplied, use its frame dimensions
The allocated frame size may be larger than the coded dimensions.
-rw-r--r--libavcodec/qsvdec.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 855bfc05c5..accbad8a5f 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -91,6 +91,8 @@ static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q)
mfxSession session = NULL;
int iopattern = 0;
mfxVideoParam param = { { 0 } };
+ int frame_width = avctx->coded_width;
+ int frame_height = avctx->coded_height;
int ret;
desc = av_pix_fmt_desc_get(avctx->sw_pix_fmt);
@@ -122,6 +124,9 @@ static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q)
else if (frames_hwctx->frame_type & MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET)
iopattern = MFX_IOPATTERN_OUT_VIDEO_MEMORY;
}
+
+ frame_width = frames_hwctx->surfaces[0].Info.Width;
+ frame_height = frames_hwctx->surfaces[0].Info.Height;
}
if (!iopattern)
@@ -146,8 +151,8 @@ static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q)
param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth;
param.mfx.FrameInfo.Shift = 0;
param.mfx.FrameInfo.FourCC = q->fourcc;
- param.mfx.FrameInfo.Width = avctx->coded_width;
- param.mfx.FrameInfo.Height = avctx->coded_height;
+ param.mfx.FrameInfo.Width = frame_width;
+ param.mfx.FrameInfo.Height = frame_height;
param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420;
param.IOPattern = q->iopattern;