diff options
Diffstat (limited to 'libhb/qsv_common.h')
-rw-r--r-- | libhb/qsv_common.h | 78 |
1 files changed, 53 insertions, 25 deletions
diff --git a/libhb/qsv_common.h b/libhb/qsv_common.h index c79cd2aa1..da879e548 100644 --- a/libhb/qsv_common.h +++ b/libhb/qsv_common.h @@ -11,6 +11,7 @@ #define HB_QSV_COMMON_H #include "msdk/mfxvideo.h" +#include "msdk/mfxplugin.h" #include "libavcodec/avcodec.h" /* Minimum Intel Media SDK version (currently 1.3, for Sandy Bridge support) */ @@ -28,34 +29,53 @@ */ typedef struct hb_qsv_info_s { - // supported version-specific or hardware-specific capabilities - int capabilities; -#define HB_QSV_CAP_H264_BPYRAMID (1 << 0) // H.264: reference B-frames -#define HB_QSV_CAP_MSDK_API_1_6 (1 << 1) // Support for API 1.6 or later -#define HB_QSV_CAP_OPTION2_EXTBRC (1 << 2) // mfxExtCodingOption2: ExtBRC -#define HB_QSV_CAP_OPTION2_MBBRC (1 << 3) // mfxExtCodingOption2: MBBRC -#define HB_QSV_CAP_OPTION2_LOOKAHEAD (1 << 4) // mfxExtCodingOption2: LookAhead -#define HB_QSV_CAP_OPTION2_TRELLIS (1 << 5) // mfxExtCodingOption2: Trellis -// mfxCoreInterface: CopyFrame has a bug which prevents us from using it, but -// the bug is fixed in newer drivers, we can use this cap to determine usability -#define HB_QSV_CAP_CORE_COPYFRAME (1 << 6) - - // TODO: add available decoders, filters, encoders, - // maximum decode and encode resolution, etc. + // each info struct only corresponds to one CodecId and implementation combo + const mfxU32 codec_id; + const mfxIMPL implementation; + + // whether the encoder is available for this implementation + int available; + + // version-specific or hardware-specific capabilities + uint64_t capabilities; + // support for API 1.6 or later +#define HB_QSV_CAP_MSDK_API_1_6 (1LL << 0) + // H.264, H.265: B-frames can be used as references +#define HB_QSV_CAP_B_REF_PYRAMID (1LL << 1) + // optional rate control methods +#define HB_QSV_CAP_RATECONTROL_LA (1LL << 10) +#define HB_QSV_CAP_RATECONTROL_LAi (1LL << 11) +#define HB_QSV_CAP_RATECONTROL_ICQ (1LL << 12) + // mfxExtCodingOption2 fields +#define HB_QSV_CAP_OPTION2_MBBRC (1LL << 20) +#define HB_QSV_CAP_OPTION2_EXTBRC (1LL << 21) +#define HB_QSV_CAP_OPTION2_TRELLIS (1LL << 22) +#define HB_QSV_CAP_OPTION2_BREFTYPE (1LL << 23) +#define HB_QSV_CAP_OPTION2_IB_ADAPT (1LL << 24) +#define HB_QSV_CAP_OPTION2_LA_DOWNS (1LL << 25) +#define HB_QSV_CAP_OPTION2_NMBSLICE (1LL << 26) + + // TODO: add maximum encode resolution, etc. } hb_qsv_info_t; -/* Global Intel QSV information for use by the UIs */ -extern hb_qsv_info_t *hb_qsv_info; - /* Intel Quick Sync Video utilities */ -int hb_qsv_available(); -int hb_qsv_info_init(); -void hb_qsv_info_print(); +int hb_qsv_available(); +int hb_qsv_video_encoder_is_enabled(int encoder); +int hb_qsv_audio_encoder_is_enabled(int encoder); +int hb_qsv_info_init(); +void hb_qsv_info_print(); +hb_qsv_info_t* hb_qsv_info_get(int encoder); /* Intel Quick Sync Video DECODE utilities */ const char* hb_qsv_decode_get_codec_name(enum AVCodecID codec_id); int hb_qsv_decode_is_enabled(hb_job_t *job); +/* + * mfxCoreInterface::CopyFrame had a bug preventing us from using it, but + * it was fixed in newer drivers - we can use this to determine usability + */ +int hb_qsv_copyframe_is_slow(int encoder); + /* Media SDK parameters handling */ enum { @@ -99,6 +119,7 @@ typedef struct } gop; struct { + int icq; int lookahead; int cqp_offsets[3]; int vbv_max_bitrate; @@ -110,9 +131,14 @@ typedef struct mfxVideoParam *videoParam; } hb_qsv_param_t; -const char* const* hb_qsv_preset_get_names(); static const char* const hb_qsv_preset_names1[] = { "speed", "balanced", NULL, }; static const char* const hb_qsv_preset_names2[] = { "speed", "balanced", "quality", NULL, }; +const char* const* hb_qsv_preset_get_names(); +const char* const* hb_qsv_profile_get_names(int encoder); +const char* const* hb_qsv_level_get_names(int encoder); + +const char* hb_qsv_video_quality_get_name(uint32_t codec); +void hb_qsv_video_quality_get_limits(uint32_t codec, float *low, float *high, float *granularity, int *direction); #define HB_QSV_CLIP3(min, max, val) ((val < min) ? min : (val > max) ? max : val) int hb_qsv_codingoption_xlat (int val); @@ -124,14 +150,16 @@ int hb_qsv_atobool (const char *str, int *err); int hb_qsv_atoi (const char *str, int *err); float hb_qsv_atof (const char *str, int *err); -int hb_qsv_param_default_preset(hb_qsv_param_t *param, mfxVideoParam *videoParam, const char *preset); -int hb_qsv_param_default (hb_qsv_param_t *param, mfxVideoParam *videoParam); -int hb_qsv_param_parse (hb_qsv_param_t *param, const char *key, const char *value, int vcodec); +int hb_qsv_param_default_preset(hb_qsv_param_t *param, mfxVideoParam *videoParam, hb_qsv_info_t *info, const char *preset); +int hb_qsv_param_default (hb_qsv_param_t *param, mfxVideoParam *videoParam, hb_qsv_info_t *info); +int hb_qsv_param_parse (hb_qsv_param_t *param, hb_qsv_info_t *info, const char *key, const char *value); const char* hb_qsv_frametype_name(uint16_t qsv_frametype); uint8_t hb_qsv_frametype_xlat(uint16_t qsv_frametype, uint16_t *out_flags); -mfxIMPL hb_qsv_impl_get_preferred(); +int hb_qsv_impl_set_preferred(const char *name); const char* hb_qsv_impl_get_name(int impl); +void hb_qsv_force_workarounds(); // for developers only + #endif |