diff options
author | Mark Thompson <sw@jkqxz.net> | 2017-03-30 22:00:03 +0100 |
---|---|---|
committer | Mark Thompson <sw@jkqxz.net> | 2017-03-30 22:00:03 +0100 |
commit | 2f18e452f88fc6ed7b0e308d4de5c386ee1b3a12 (patch) | |
tree | d46ae6e853bc8837cb691269d6c4cb4a0ee14a00 /libavcodec/qsvenc.c | |
parent | e3f9c5826ace91bf8d933bd924df2eb4081da6c6 (diff) | |
parent | 404e51478ecad060249d5b9bee6ab39a8a9d8c1c (diff) |
Merge commit '404e51478ecad060249d5b9bee6ab39a8a9d8c1c'
* commit '404e51478ecad060249d5b9bee6ab39a8a9d8c1c':
qsv{dec,enc}: always use an internal mfxFrameSurface1
Minor fixups for differences in the QSV encoder because of a53cc.
Merged-by: Mark Thompson <sw@jkqxz.net>
Diffstat (limited to 'libavcodec/qsvenc.c')
-rw-r--r-- | libavcodec/qsvenc.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 2e591507a2..496a032f31 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -814,10 +814,10 @@ static void clear_unused_frames(QSVEncContext *q) { QSVFrame *cur = q->work_frames; while (cur) { - if (cur->surface && !cur->surface->Data.Locked) { - cur->surface = NULL; + if (cur->used && !cur->surface.Data.Locked) { free_encoder_ctrl_payloads(&cur->enc_ctrl); av_frame_unref(cur->frame); + cur->used = 0; } cur = cur->next; } @@ -832,8 +832,9 @@ static int get_free_frame(QSVEncContext *q, QSVFrame **f) frame = q->work_frames; last = &q->work_frames; while (frame) { - if (!frame->surface) { + if (!frame->used) { *f = frame; + frame->used = 1; return 0; } @@ -857,6 +858,7 @@ static int get_free_frame(QSVEncContext *q, QSVFrame **f) *last = frame; *f = frame; + frame->used = 1; return 0; } @@ -876,7 +878,7 @@ static int submit_frame(QSVEncContext *q, const AVFrame *frame, if (ret < 0) return ret; - qf->surface = (mfxFrameSurface1*)qf->frame->data[3]; + qf->surface = *(mfxFrameSurface1*)qf->frame->data[3]; } else { /* make a copy if the input is not padded as libmfx requires */ if (frame->height & 31 || frame->linesize[0] & (q->width_align - 1)) { @@ -900,27 +902,25 @@ static int submit_frame(QSVEncContext *q, const AVFrame *frame, return ret; } - qf->surface_internal.Info = q->param.mfx.FrameInfo; + qf->surface.Info = q->param.mfx.FrameInfo; - qf->surface_internal.Info.PicStruct = + qf->surface.Info.PicStruct = !frame->interlaced_frame ? MFX_PICSTRUCT_PROGRESSIVE : frame->top_field_first ? MFX_PICSTRUCT_FIELD_TFF : MFX_PICSTRUCT_FIELD_BFF; if (frame->repeat_pict == 1) - qf->surface_internal.Info.PicStruct |= MFX_PICSTRUCT_FIELD_REPEATED; + qf->surface.Info.PicStruct |= MFX_PICSTRUCT_FIELD_REPEATED; else if (frame->repeat_pict == 2) - qf->surface_internal.Info.PicStruct |= MFX_PICSTRUCT_FRAME_DOUBLING; + qf->surface.Info.PicStruct |= MFX_PICSTRUCT_FRAME_DOUBLING; else if (frame->repeat_pict == 4) - qf->surface_internal.Info.PicStruct |= MFX_PICSTRUCT_FRAME_TRIPLING; + qf->surface.Info.PicStruct |= MFX_PICSTRUCT_FRAME_TRIPLING; - qf->surface_internal.Data.PitchLow = qf->frame->linesize[0]; - qf->surface_internal.Data.Y = qf->frame->data[0]; - qf->surface_internal.Data.UV = qf->frame->data[1]; - - qf->surface = &qf->surface_internal; + qf->surface.Data.PitchLow = qf->frame->linesize[0]; + qf->surface.Data.Y = qf->frame->data[0]; + qf->surface.Data.UV = qf->frame->data[1]; } - qf->surface->Data.TimeStamp = av_rescale_q(frame->pts, q->avctx->time_base, (AVRational){1, 90000}); + qf->surface.Data.TimeStamp = av_rescale_q(frame->pts, q->avctx->time_base, (AVRational){1, 90000}); *new_frame = qf; @@ -959,7 +959,7 @@ static int encode_frame(AVCodecContext *avctx, QSVEncContext *q, } } if (qsv_frame) { - surf = qsv_frame->surface; + surf = &qsv_frame->surface; enc_ctrl = &qsv_frame->enc_ctrl; } |