diff options
author | Zhong Li <zhong.li@intel.com> | 2019-04-28 17:15:55 +0800 |
---|---|---|
committer | Zhong Li <zhong.li@intel.com> | 2019-05-07 11:00:14 +0800 |
commit | 94ab39ec78c536703f77821fc039fee649105aab (patch) | |
tree | 9cc4c7aaa94af6f8277ed634d6242b777e46420d | |
parent | 48627aaf646270a8c98337ee208574543e499bfd (diff) | |
download | ffmpeg-streaming-94ab39ec78c536703f77821fc039fee649105aab.zip ffmpeg-streaming-94ab39ec78c536703f77821fc039fee649105aab.tar.gz |
lavc/qsvdec: fix hevc level incorrectly map
libmfx hevc level defination is same as h264, not level_idc of SPEC.
Signed-off-by: Zhong Li <zhong.li@intel.com>
-rw-r--r-- | libavcodec/qsv.c | 13 | ||||
-rw-r--r-- | libavcodec/qsv_internal.h | 1 | ||||
-rw-r--r-- | libavcodec/qsvdec.c | 2 |
3 files changed, 15 insertions, 1 deletions
diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index bb0d795..4d3fbaf 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -83,6 +83,19 @@ int ff_qsv_profile_to_mfx(enum AVCodecID codec_id, int profile) return MFX_PROFILE_UNKNOWN; } +int ff_qsv_level_to_mfx(enum AVCodecID codec_id, int level) +{ + if (level == FF_LEVEL_UNKNOWN) + return MFX_LEVEL_UNKNOWN; + + switch (codec_id) { + case AV_CODEC_ID_HEVC: + return level / 3; + default: + return level; + } +} + static const struct { mfxStatus mfxerr; int averr; diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h index 57d861d..b63a7d6 100644 --- a/libavcodec/qsv_internal.h +++ b/libavcodec/qsv_internal.h @@ -90,6 +90,7 @@ int ff_qsv_print_warning(void *log_ctx, mfxStatus err, int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id); int ff_qsv_profile_to_mfx(enum AVCodecID codec_id, int profile); +int ff_qsv_level_to_mfx(enum AVCodecID codec_id, int level); int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc); enum AVPictureType ff_qsv_map_pictype(int mfx_pic_type); diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index 2a8a032..46aa2d6 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -203,7 +203,7 @@ static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q) param.mfx.CodecId = ret; param.mfx.CodecProfile = ff_qsv_profile_to_mfx(avctx->codec_id, avctx->profile); - param.mfx.CodecLevel = avctx->level == FF_LEVEL_UNKNOWN ? MFX_LEVEL_UNKNOWN : avctx->level; + param.mfx.CodecLevel = ff_qsv_level_to_mfx(avctx->codec_id, avctx->level); param.mfx.FrameInfo.BitDepthLuma = desc->comp[0].depth; param.mfx.FrameInfo.BitDepthChroma = desc->comp[0].depth; |