ffmpeg | branch: master | Zhong Li <zhong...@intel.com> | Sun Apr 28 20:27:48 2019 +0800| [5b318ce68df6cb4939b0be68e22853621e1e3aab] | committer: Zhong Li
lavc/qsv: extactly map profile Currently profile mapping is hard-coded, and not flexible to do extactly map (E.g: libmfx treats H264 constrained baseline to be baseline profile). vaapi profile mapping funtion provides a better soultion than current qsv mapping. Signed-off-by: Zhong Li <zhong...@intel.com> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5b318ce68df6cb4939b0be68e22853621e1e3aab --- libavcodec/qsv.c | 52 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index 4d3fbafe04..986d4f6022 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -67,19 +67,55 @@ int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id) return AVERROR(ENOSYS); } + +static const struct { + enum AVCodecID codec_id; + int codec_profile; + int mfx_profile; +} qsv_profile_map[] = { +#define MAP(c, p, v) { AV_CODEC_ID_ ## c, FF_PROFILE_ ## p, MFX_PROFILE_ ## v } + MAP(MPEG2VIDEO, MPEG2_SIMPLE, MPEG2_SIMPLE ), + MAP(MPEG2VIDEO, MPEG2_MAIN, MPEG2_MAIN ), + MAP(MPEG2VIDEO, MPEG2_HIGH, MPEG2_HIGH ), + + MAP(H264, H264_BASELINE, AVC_BASELINE ), + MAP(H264, H264_CONSTRAINED_BASELINE, AVC_BASELINE), +#if QSV_VERSION_ATLEAST(1, 3) + MAP(H264, H264_EXTENDED, AVC_EXTENDED ), +#endif + MAP(H264, H264_MAIN, AVC_MAIN ), + MAP(H264, H264_HIGH, AVC_HIGH ), + MAP(H264, H264_HIGH_422, AVC_HIGH_422 ), + +#if QSV_VERSION_ATLEAST(1, 8) + MAP(HEVC, HEVC_MAIN, HEVC_MAIN ), + MAP(HEVC, HEVC_MAIN_10, HEVC_MAIN10 ), + MAP(HEVC, HEVC_MAIN_STILL_PICTURE, HEVC_MAINSP ), +#endif +#if QSV_VERSION_ATLEAST(1, 16) + MAP(HEVC, HEVC_REXT, HEVC_REXT ), +#endif + + MAP(VC1, VC1_SIMPLE, VC1_SIMPLE ), + MAP(VC1, VC1_MAIN, VC1_MAIN ), + MAP(VC1, VC1_COMPLEX, VC1_ADVANCED ), + MAP(VC1, VC1_ADVANCED, VC1_ADVANCED ), +#undef MAP +}; + int ff_qsv_profile_to_mfx(enum AVCodecID codec_id, int profile) { + int i; if (profile == FF_PROFILE_UNKNOWN) return MFX_PROFILE_UNKNOWN; - switch (codec_id) { - case AV_CODEC_ID_H264: - case AV_CODEC_ID_HEVC: - return profile; - case AV_CODEC_ID_VC1: - return 4 * profile + 1; - case AV_CODEC_ID_MPEG2VIDEO: - return 0x10 * profile; + + for (i = 0; i < FF_ARRAY_ELEMS(qsv_profile_map); i++) { + if (qsv_profile_map[i].codec_id != codec_id) + continue; + if (qsv_profile_map[i].codec_profile == profile) + return qsv_profile_map[i].mfx_profile; } + return MFX_PROFILE_UNKNOWN; } _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".