diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-07-09 11:52:05 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-07-09 11:53:14 +0200 |
commit | 7871eb43616776626ec9f9075b6d0a8cf73d159e (patch) | |
tree | f9a88703414cd33e32c5f682974d8b4f96837b92 /libavcodec/qsvenc.c | |
parent | 587980eb7a1f4b0228204aa846b72dc761e49779 (diff) | |
parent | 66acb76bb0492b263215ca9b4d927a7be39ace02 (diff) | |
download | ffmpeg-7871eb43616776626ec9f9075b6d0a8cf73d159e.tar.gz |
Merge commit '66acb76bb0492b263215ca9b4d927a7be39ace02'
* commit '66acb76bb0492b263215ca9b4d927a7be39ace02':
lavc: add Intel libmfx-based HEVC encoder
Conflicts:
Changelog
configure
libavcodec/Makefile
libavcodec/allcodecs.c
libavcodec/qsv.c
libavcodec/qsvenc.c
libavcodec/version.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/qsvenc.c')
-rw-r--r-- | libavcodec/qsvenc.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 2e147b75c0..29f0386d46 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -49,6 +49,8 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) return AVERROR_BUG; q->param.mfx.CodecId = ret; + q->width_align = avctx->codec_id == AV_CODEC_ID_HEVC ? 32 : 16; + if (avctx->level > 0) q->param.mfx.CodecLevel = avctx->level; @@ -74,7 +76,7 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) q->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420; q->param.mfx.FrameInfo.BitDepthLuma = 8; q->param.mfx.FrameInfo.BitDepthChroma = 8; - q->param.mfx.FrameInfo.Width = FFALIGN(avctx->width, 16); + q->param.mfx.FrameInfo.Width = FFALIGN(avctx->width, q->width_align); if (avctx->flags & CODEC_FLAG_INTERLACED_DCT) { /* A true field layout (TFF or BFF) is not important here, @@ -86,7 +88,7 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, 32); } else { q->param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE; - q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, 16); + q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, avctx->codec_id == AV_CODEC_ID_HEVC ? 32 : 16); } if (avctx->framerate.den > 0 && avctx->framerate.num > 0) { @@ -135,15 +137,19 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) break; } - q->extco.Header.BufferId = MFX_EXTBUFF_CODING_OPTION; - q->extco.Header.BufferSz = sizeof(q->extco); - q->extco.CAVLC = avctx->coder_type == FF_CODER_TYPE_VLC ? - MFX_CODINGOPTION_ON : MFX_CODINGOPTION_UNKNOWN; + // the HEVC encoder plugin currently fails if coding options + // are provided + if (avctx->codec_id != AV_CODEC_ID_HEVC) { + q->extco.Header.BufferId = MFX_EXTBUFF_CODING_OPTION; + q->extco.Header.BufferSz = sizeof(q->extco); + q->extco.CAVLC = avctx->coder_type == FF_CODER_TYPE_VLC ? + MFX_CODINGOPTION_ON : MFX_CODINGOPTION_UNKNOWN; - q->extparam[0] = (mfxExtBuffer *)&q->extco; + q->extparam[0] = (mfxExtBuffer *)&q->extco; - q->param.ExtParam = q->extparam; - q->param.NumExtParam = FF_ARRAY_ELEMS(q->extparam); + q->param.ExtParam = q->extparam; + q->param.NumExtParam = FF_ARRAY_ELEMS(q->extparam); + } return 0; } @@ -210,7 +216,8 @@ int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q) } if (!q->session) { - ret = ff_qsv_init_internal_session(avctx, &q->internal_session); + ret = ff_qsv_init_internal_session(avctx, &q->internal_session, + q->load_plugins); if (ret < 0) return ret; @@ -316,9 +323,9 @@ static int submit_frame(QSVEncContext *q, const AVFrame *frame, } /* make a copy if the input is not padded as libmfx requires */ - if (frame->height & 31 || frame->linesize[0] & 15) { + if (frame->height & 31 || frame->linesize[0] & (q->width_align - 1)) { qf->frame->height = FFALIGN(frame->height, 32); - qf->frame->width = FFALIGN(frame->width, 16); + qf->frame->width = FFALIGN(frame->width, q->width_align); ret = ff_get_buffer(q->avctx, qf->frame, AV_GET_BUFFER_FLAG_REF); if (ret < 0) |