diff options
author | Anton Khirnov <anton@khirnov.net> | 2016-06-22 20:57:28 +0300 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2016-07-22 20:08:13 +0300 |
commit | 37a9015ee84c15fec5247ba8f6577351a25fa8d2 (patch) | |
tree | f4d92949ca3d157584f09652b7e6a166f01ffc6f /libavcodec/qsvenc.c | |
parent | 21962261c74aed4df00ae8348a5e2d1ecb67c52d (diff) |
qsvenc: add support for p010
Diffstat (limited to 'libavcodec/qsvenc.c')
-rw-r--r-- | libavcodec/qsvenc.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 2bb7a1de75..e28f3545ec 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -385,7 +385,16 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) AVQSVFramesContext *frames_hwctx = frames_ctx->hwctx; q->param.mfx.FrameInfo = frames_hwctx->surfaces[0].Info; } else { - q->param.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12; + enum AVPixelFormat sw_format = avctx->pix_fmt == AV_PIX_FMT_QSV ? + avctx->sw_pix_fmt : avctx->pix_fmt; + const AVPixFmtDescriptor *desc; + + desc = av_pix_fmt_desc_get(sw_format); + if (!desc) + return AVERROR_BUG; + + ff_qsv_map_pixfmt(sw_format, &q->param.mfx.FrameInfo.FourCC); + q->param.mfx.FrameInfo.Width = FFALIGN(avctx->width, q->width_align); q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, 32); q->param.mfx.FrameInfo.CropX = 0; @@ -396,8 +405,9 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) q->param.mfx.FrameInfo.AspectRatioH = avctx->sample_aspect_ratio.den; q->param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE; q->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420; - q->param.mfx.FrameInfo.BitDepthLuma = 8; - q->param.mfx.FrameInfo.BitDepthChroma = 8; + q->param.mfx.FrameInfo.BitDepthLuma = desc->comp[0].depth; + q->param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth; + q->param.mfx.FrameInfo.Shift = desc->comp[0].depth > 8; } if (avctx->framerate.den > 0 && avctx->framerate.num > 0) { |