Commit 220e7739 authored by Hendrik Leppkes's avatar Hendrik Leppkes

Merge commit 'ce320cf1'

* commit 'ce320cf1':
  qsvdec: use the same mfxFrameInfo for allocating frames that was passed to DECODE_Init
Merged-by: 's avatarHendrik Leppkes <h.leppkes@gmail.com>
parents 1bc6cdf2 ce320cf1
...@@ -176,10 +176,12 @@ static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q) ...@@ -176,10 +176,12 @@ static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q)
return ff_qsv_error(ret); return ff_qsv_error(ret);
} }
q->frame_info = param.mfx.FrameInfo;
return 0; return 0;
} }
static int alloc_frame(AVCodecContext *avctx, QSVFrame *frame) static int alloc_frame(AVCodecContext *avctx, QSVContext *q, QSVFrame *frame)
{ {
int ret; int ret;
...@@ -190,12 +192,7 @@ static int alloc_frame(AVCodecContext *avctx, QSVFrame *frame) ...@@ -190,12 +192,7 @@ static int alloc_frame(AVCodecContext *avctx, QSVFrame *frame)
if (frame->frame->format == AV_PIX_FMT_QSV) { if (frame->frame->format == AV_PIX_FMT_QSV) {
frame->surface = (mfxFrameSurface1*)frame->frame->data[3]; frame->surface = (mfxFrameSurface1*)frame->frame->data[3];
} else { } else {
frame->surface_internal.Info.BitDepthLuma = 8; frame->surface_internal.Info = q->frame_info;
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.Data.PitchLow = frame->frame->linesize[0]; frame->surface_internal.Data.PitchLow = frame->frame->linesize[0];
frame->surface_internal.Data.Y = frame->frame->data[0]; frame->surface_internal.Data.Y = frame->frame->data[0];
...@@ -230,7 +227,7 @@ static int get_surface(AVCodecContext *avctx, QSVContext *q, mfxFrameSurface1 ** ...@@ -230,7 +227,7 @@ static int get_surface(AVCodecContext *avctx, QSVContext *q, mfxFrameSurface1 **
last = &q->work_frames; last = &q->work_frames;
while (frame) { while (frame) {
if (!frame->surface) { if (!frame->surface) {
ret = alloc_frame(avctx, frame); ret = alloc_frame(avctx, q, frame);
if (ret < 0) if (ret < 0)
return ret; return ret;
*surf = frame->surface; *surf = frame->surface;
...@@ -251,7 +248,7 @@ static int get_surface(AVCodecContext *avctx, QSVContext *q, mfxFrameSurface1 ** ...@@ -251,7 +248,7 @@ static int get_surface(AVCodecContext *avctx, QSVContext *q, mfxFrameSurface1 **
} }
*last = frame; *last = frame;
ret = alloc_frame(avctx, frame); ret = alloc_frame(avctx, q, frame);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -57,6 +57,7 @@ typedef struct QSVContext { ...@@ -57,6 +57,7 @@ typedef struct QSVContext {
AVCodecContext *avctx_internal; AVCodecContext *avctx_internal;
enum AVPixelFormat orig_pix_fmt; enum AVPixelFormat orig_pix_fmt;
uint32_t fourcc; uint32_t fourcc;
mfxFrameInfo frame_info;
// options set by the caller // options set by the caller
int async_depth; int async_depth;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment