aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/qsvdec.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2016-06-22 11:44:09 +0200
committerAnton Khirnov <anton@khirnov.net>2016-07-03 09:13:29 +0200
commitce320cf1c4daab3e2e3726ed7d2e879d10f7b991 (patch)
tree553458c6a57c2909ef88230eef5e4713dc37ab9a /libavcodec/qsvdec.c
parent536bb17e9659c5ed7576a218d4085cdd6d5742fa (diff)
downloadffmpeg-ce320cf1c4daab3e2e3726ed7d2e879d10f7b991.tar.gz
qsvdec: use the same mfxFrameInfo for allocating frames that was passed to DECODE_Init
Stop duplicating this information.
Diffstat (limited to 'libavcodec/qsvdec.c')
-rw-r--r--libavcodec/qsvdec.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 2b01d34624..02d5e282ea 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -155,10 +155,12 @@ static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q)
return ff_qsv_error(ret);
}
+ q->frame_info = param.mfx.FrameInfo;
+
return 0;
}
-static int alloc_frame(AVCodecContext *avctx, QSVFrame *frame)
+static int alloc_frame(AVCodecContext *avctx, QSVContext *q, QSVFrame *frame)
{
int ret;
@@ -169,12 +171,7 @@ static int alloc_frame(AVCodecContext *avctx, QSVFrame *frame)
if (frame->frame->format == AV_PIX_FMT_QSV) {
frame->surface = (mfxFrameSurface1*)frame->frame->data[3];
} else {
- frame->surface_internal.Info.BitDepthLuma = 8;
- frame->surface_internal.Info.BitDepthChroma = 8;
- frame->surface_internal.Info.FourCC = MFX_FOURCC_NV12;
- frame->surface_internal.Info.Width = avctx->coded_width;
- frame->surface_internal.Info.Height = avctx->coded_height;
- frame->surface_internal.Info.ChromaFormat = MFX_CHROMAFORMAT_YUV420;
+ frame->surface_internal.Info = q->frame_info;
frame->surface_internal.Data.PitchLow = frame->frame->linesize[0];
frame->surface_internal.Data.Y = frame->frame->data[0];
@@ -209,7 +206,7 @@ static int get_surface(AVCodecContext *avctx, QSVContext *q, mfxFrameSurface1 **
last = &q->work_frames;
while (frame) {
if (!frame->surface) {
- ret = alloc_frame(avctx, frame);
+ ret = alloc_frame(avctx, q, frame);
if (ret < 0)
return ret;
*surf = frame->surface;
@@ -230,7 +227,7 @@ static int get_surface(AVCodecContext *avctx, QSVContext *q, mfxFrameSurface1 **
}
*last = frame;
- ret = alloc_frame(avctx, frame);
+ ret = alloc_frame(avctx, q, frame);
if (ret < 0)
return ret;