diff options
author | Anton Khirnov <anton@khirnov.net> | 2016-06-22 11:53:00 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2016-07-03 09:13:29 +0200 |
commit | 92736c74fb1633e36f7134a880422a9b7db14d3f (patch) | |
tree | c9d02427bf74cf19dc5d12064fb4d1feb997e9e3 /libavcodec/qsvdec.c | |
parent | ce320cf1c4daab3e2e3726ed7d2e879d10f7b991 (diff) | |
download | ffmpeg-92736c74fb1633e36f7134a880422a9b7db14d3f.tar.gz |
qsvdec: add support for P010 (10-bit 420) decoding
Diffstat (limited to 'libavcodec/qsvdec.c')
-rw-r--r-- | libavcodec/qsvdec.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index 02d5e282ea..929b9af426 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -31,6 +31,7 @@ #include "libavutil/hwcontext_qsv.h" #include "libavutil/mem.h" #include "libavutil/log.h" +#include "libavutil/pixdesc.h" #include "libavutil/pixfmt.h" #include "libavutil/time.h" @@ -86,11 +87,16 @@ static int qsv_init_session(AVCodecContext *avctx, QSVContext *q, mfxSession ses static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q) { + const AVPixFmtDescriptor *desc; mfxSession session = NULL; int iopattern = 0; mfxVideoParam param = { { 0 } }; int ret; + desc = av_pix_fmt_desc_get(avctx->sw_pix_fmt); + if (!desc) + return AVERROR_BUG; + if (!q->async_fifo) { q->async_fifo = av_fifo_alloc((1 + q->async_depth) * (sizeof(mfxSyncPoint*) + sizeof(QSVFrame*))); @@ -136,9 +142,9 @@ static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q) param.mfx.CodecProfile = avctx->profile; param.mfx.CodecLevel = avctx->level; - param.mfx.FrameInfo.BitDepthLuma = 8; - param.mfx.FrameInfo.BitDepthChroma = 8; - param.mfx.FrameInfo.Shift = 0; + param.mfx.FrameInfo.BitDepthLuma = desc->comp[0].depth; + param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth; + param.mfx.FrameInfo.Shift = desc->comp[0].depth > 8; param.mfx.FrameInfo.FourCC = q->fourcc; param.mfx.FrameInfo.Width = avctx->coded_width; param.mfx.FrameInfo.Height = avctx->coded_height; @@ -452,7 +458,8 @@ int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q, qsv_format = ff_qsv_map_pixfmt(q->parser->format, &q->fourcc); if (qsv_format < 0) { av_log(avctx, AV_LOG_ERROR, - "Only 8-bit YUV420 streams are supported.\n"); + "Decoding pixel format '%s' is not supported\n", + av_get_pix_fmt_name(q->parser->format)); ret = AVERROR(ENOSYS); goto reinit_fail; } |