Commit 5b318ce6 authored by Zhong Li's avatar 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: 's avatarZhong Li <zhong.li@intel.com>
parent 94ab39ec
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment