summaryrefslogtreecommitdiff
path: root/libavcodec/qsv.c
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2016-10-26 21:26:10 +0100
committerMark Thompson <sw@jkqxz.net>2016-11-14 19:38:19 +0000
commitcd1047f3911fa0d34c86f470537f343d23c8b956 (patch)
treebbc04c4d81d588b0e3d68927997def6efe950243 /libavcodec/qsv.c
parent3297577f3eac1c87d48dedd527942de2bd28e7a5 (diff)
qsvdec: Pass the correct profile to libmfx
This was correct for H.26[45], because libmfx uses the same values derived from profile_idc and the constraint_set flags, but it is wrong for other codecs. Also avoid passing FF_LEVEL_UNKNOWN (-99) as the level, as this is certainly invalid.
Diffstat (limited to 'libavcodec/qsv.c')
-rw-r--r--libavcodec/qsv.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index 6c53489373..f292082f42 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -55,6 +55,22 @@ int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id)
return AVERROR(ENOSYS);
}
+int ff_qsv_profile_to_mfx(enum AVCodecID codec_id, int profile)
+{
+ 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;
+ }
+ return MFX_PROFILE_UNKNOWN;
+}
+
static const struct {
mfxStatus mfxerr;
int averr;