diff options
Diffstat (limited to 'libhb/qsv_common.c')
-rw-r--r-- | libhb/qsv_common.c | 107 |
1 files changed, 92 insertions, 15 deletions
diff --git a/libhb/qsv_common.c b/libhb/qsv_common.c index e383b806e..60d371f82 100644 --- a/libhb/qsv_common.c +++ b/libhb/qsv_common.c @@ -18,6 +18,7 @@ #include "hb_dict.h" #include "qsv_common.h" #include "h264_common.h" +#include "h265_common.h" // QSV info for each codec static hb_qsv_info_t *hb_qsv_info_avc = NULL; @@ -45,6 +46,13 @@ static hb_triplet_t hb_qsv_h264_profiles[] = { "Progressive High", "high|set4", MFX_PROFILE_AVC_PROGRESSIVE_HIGH, }, { NULL, }, }; +static hb_triplet_t hb_qsv_h265_profiles[] = +{ + { "Main", "main", MFX_PROFILE_HEVC_MAIN, }, + { "Main 10", "main10", MFX_PROFILE_HEVC_MAIN10, }, + { "Main Still Picture", "mainstillpicture", MFX_PROFILE_HEVC_MAINSP, }, + { NULL, }, +}; static hb_triplet_t hb_qsv_h264_levels[] = { { "1.0", "1.0", MFX_LEVEL_AVC_1, }, @@ -66,6 +74,23 @@ static hb_triplet_t hb_qsv_h264_levels[] = { "5.2", "5.2", MFX_LEVEL_AVC_52, }, { NULL, }, }; +static hb_triplet_t hb_qsv_h265_levels[] = +{ + { "1.0", "1.0", MFX_LEVEL_HEVC_1, }, + { "2.0", "2.0", MFX_LEVEL_HEVC_2, }, + { "2.1", "2.1", MFX_LEVEL_HEVC_21, }, + { "3.0", "3.0", MFX_LEVEL_HEVC_3, }, + { "3.1", "3.1", MFX_LEVEL_HEVC_31, }, + { "4.0", "4.0", MFX_LEVEL_HEVC_4, }, + { "4.1", "4.1", MFX_LEVEL_HEVC_41, }, + { "5.0", "5.0", MFX_LEVEL_HEVC_5, }, + { "5.1", "5.1", MFX_LEVEL_HEVC_51, }, + { "5.2", "5.2", MFX_LEVEL_HEVC_52, }, + { "6.0", "6.0", MFX_LEVEL_HEVC_6, }, + { "6.1", "6.1", MFX_LEVEL_HEVC_61, }, + { "6.2", "6.2", MFX_LEVEL_HEVC_62, }, + { NULL, }, +}; // check available Intel Media SDK version against a minimum #define HB_CHECK_MFX_VERSION(MFX_VERSION, MAJOR, MINOR) \ @@ -114,7 +139,8 @@ static int qsv_implementation_is_hardware(mfxIMPL implementation) int hb_qsv_available() { - return hb_qsv_video_encoder_is_enabled(HB_VCODEC_QSV_H264); + return (hb_qsv_video_encoder_is_enabled(HB_VCODEC_QSV_H264) || + hb_qsv_video_encoder_is_enabled(HB_VCODEC_QSV_H265)); } int hb_qsv_video_encoder_is_enabled(int encoder) @@ -123,6 +149,8 @@ int hb_qsv_video_encoder_is_enabled(int encoder) { case HB_VCODEC_QSV_H264: return hb_qsv_info_avc != NULL && hb_qsv_info_avc->available; + case HB_VCODEC_QSV_H265: + return hb_qsv_info_hevc != NULL && hb_qsv_info_hevc->available; default: return 0; } @@ -773,23 +801,23 @@ void hb_qsv_info_print() } if (hb_qsv_info_hevc != NULL && hb_qsv_info_hevc->available) { - hb_deep_log(2, " - H.265 encoder: yes (unsupported)"); - hb_deep_log(2, " - preferred implementation: %s", - hb_qsv_impl_get_name(hb_qsv_info_hevc->implementation)); + hb_log(" - H.265 encoder: yes"); + hb_log(" - preferred implementation: %s", + hb_qsv_impl_get_name(hb_qsv_info_hevc->implementation)); if (qsv_hardware_info_hevc.available) { - log_capabilities(2, qsv_hardware_info_hevc.capabilities, + log_capabilities(1, qsv_hardware_info_hevc.capabilities, " - capabilities (hardware): "); } if (qsv_software_info_hevc.available) { - log_capabilities(2, qsv_software_info_hevc.capabilities, + log_capabilities(1, qsv_software_info_hevc.capabilities, " - capabilities (software): "); } } else { - hb_deep_log(2, " - H.265 encoder: no"); + hb_log(" - H.265 encoder: no"); } } } @@ -800,6 +828,8 @@ hb_qsv_info_t* hb_qsv_info_get(int encoder) { case HB_VCODEC_QSV_H264: return hb_qsv_info_avc; + case HB_VCODEC_QSV_H265: + return hb_qsv_info_hevc; default: return NULL; } @@ -1220,6 +1250,9 @@ int hb_qsv_param_parse(hb_qsv_param_t *param, hb_qsv_info_t *info, case MFX_CODEC_AVC: ivalue = hb_qsv_atoindex(hb_h264_vidformat_names, value, &error); break; + case MFX_CODEC_HEVC: + ivalue = hb_qsv_atoindex(hb_h265_vidformat_names, value, &error); + break; default: return HB_QSV_PARAM_UNSUPPORTED; } @@ -1242,6 +1275,9 @@ int hb_qsv_param_parse(hb_qsv_param_t *param, hb_qsv_info_t *info, case MFX_CODEC_AVC: ivalue = hb_qsv_atoindex(hb_h264_fullrange_names, value, &error); break; + case MFX_CODEC_HEVC: + ivalue = hb_qsv_atoindex(hb_h265_fullrange_names, value, &error); + break; default: return HB_QSV_PARAM_UNSUPPORTED; } @@ -1264,6 +1300,9 @@ int hb_qsv_param_parse(hb_qsv_param_t *param, hb_qsv_info_t *info, case MFX_CODEC_AVC: ivalue = hb_qsv_atoindex(hb_h264_colorprim_names, value, &error); break; + case MFX_CODEC_HEVC: + ivalue = hb_qsv_atoindex(hb_h265_colorprim_names, value, &error); + break; default: return HB_QSV_PARAM_UNSUPPORTED; } @@ -1287,6 +1326,9 @@ int hb_qsv_param_parse(hb_qsv_param_t *param, hb_qsv_info_t *info, case MFX_CODEC_AVC: ivalue = hb_qsv_atoindex(hb_h264_transfer_names, value, &error); break; + case MFX_CODEC_HEVC: + ivalue = hb_qsv_atoindex(hb_h265_transfer_names, value, &error); + break; default: return HB_QSV_PARAM_UNSUPPORTED; } @@ -1310,6 +1352,9 @@ int hb_qsv_param_parse(hb_qsv_param_t *param, hb_qsv_info_t *info, case MFX_CODEC_AVC: ivalue = hb_qsv_atoindex(hb_h264_colmatrix_names, value, &error); break; + case MFX_CODEC_HEVC: + ivalue = hb_qsv_atoindex(hb_h265_colmatrix_names, value, &error); + break; default: return HB_QSV_PARAM_UNSUPPORTED; } @@ -1479,6 +1524,11 @@ int hb_qsv_profile_parse(hb_qsv_param_t *param, hb_qsv_info_t *info, const char case MFX_CODEC_AVC: profile = hb_triplet4key(hb_qsv_h264_profiles, profile_key); break; + + case MFX_CODEC_HEVC: + profile = hb_triplet4key(hb_qsv_h265_profiles, profile_key); + break; + default: break; } @@ -1501,6 +1551,11 @@ int hb_qsv_level_parse(hb_qsv_param_t *param, hb_qsv_info_t *info, const char *l case MFX_CODEC_AVC: level = hb_triplet4key(hb_qsv_h264_levels, level_key); break; + + case MFX_CODEC_HEVC: + level = hb_triplet4key(hb_qsv_h265_levels, level_key); + break; + default: break; } @@ -1546,6 +1601,8 @@ const char* const* hb_qsv_profile_get_names(int encoder) { case HB_VCODEC_QSV_H264: return hb_h264_profile_names; + case HB_VCODEC_QSV_H265: + return hb_h265_profile_names; default: return NULL; } @@ -1557,6 +1614,8 @@ const char* const* hb_qsv_level_get_names(int encoder) { case HB_VCODEC_QSV_H264: return hb_h264_level_names; + case HB_VCODEC_QSV_H265: + return hb_h265_level_names; default: return NULL; } @@ -1564,36 +1623,43 @@ const char* const* hb_qsv_level_get_names(int encoder) const char* hb_qsv_video_quality_get_name(uint32_t codec) { - uint64_t caps; + uint64_t caps = 0; switch (codec) { case HB_VCODEC_QSV_H264: - caps = hb_qsv_info_avc != NULL ? hb_qsv_info_avc->capabilities : 0; - return (caps & HB_QSV_CAP_RATECONTROL_ICQ) ? "ICQ" : "QP"; + if (hb_qsv_info_avc != NULL) caps = hb_qsv_info_avc->capabilities; + break; + + case HB_VCODEC_QSV_H265: + if (hb_qsv_info_hevc != NULL) caps = hb_qsv_info_hevc->capabilities; + break; default: - return "QP"; + break; } + return (caps & HB_QSV_CAP_RATECONTROL_ICQ) ? "ICQ" : "QP"; } void hb_qsv_video_quality_get_limits(uint32_t codec, float *low, float *high, float *granularity, int *direction) { - uint64_t caps; + uint64_t caps = 0; switch (codec) { - case HB_VCODEC_QSV_H264: - caps = hb_qsv_info_avc != NULL ? hb_qsv_info_avc->capabilities : 0; + case HB_VCODEC_QSV_H265: + if (hb_qsv_info_hevc != NULL) caps = hb_qsv_info_hevc->capabilities; *direction = 1; *granularity = 1.; *low = (caps & HB_QSV_CAP_RATECONTROL_ICQ) ? 1. : 0.; *high = 51.; break; + case HB_VCODEC_QSV_H264: default: + if (hb_qsv_info_avc != NULL) caps = hb_qsv_info_avc->capabilities; *direction = 1; *granularity = 1.; - *low = 0.; + *low = (caps & HB_QSV_CAP_RATECONTROL_ICQ) ? 1. : 0.; *high = 51.; break; } @@ -1893,6 +1959,9 @@ const char* hb_qsv_codec_name(uint32_t codec_id) case MFX_CODEC_AVC: return "H.264/AVC"; + case MFX_CODEC_HEVC: + return "H.265/HEVC"; + default: return NULL; } @@ -1907,6 +1976,10 @@ const char* hb_qsv_profile_name(uint32_t codec_id, uint16_t profile_id) profile = hb_triplet4value(hb_qsv_h264_profiles, profile_id); break; + case MFX_CODEC_HEVC: + profile = hb_triplet4value(hb_qsv_h265_profiles, profile_id); + break; + default: break; } @@ -1922,6 +1995,10 @@ const char* hb_qsv_level_name(uint32_t codec_id, uint16_t level_id) level = hb_triplet4value(hb_qsv_h264_levels, level_id); break; + case MFX_CODEC_HEVC: + level = hb_triplet4value(hb_qsv_h265_levels, level_id); + break; + default: break; } |