|
|
|
@@ -148,6 +148,7 @@ static void obs_qsv_defaults(obs_data_t *settings)
|
|
|
|
|
obs_data_set_default_int(settings, "bitrate", 2500);
|
|
|
|
|
obs_data_set_default_int(settings, "max_bitrate", 3000);
|
|
|
|
|
obs_data_set_default_string(settings, "profile", "high");
|
|
|
|
|
obs_data_set_default_int(settings, "async_depth", 4);
|
|
|
|
|
obs_data_set_default_string(settings, "rate_control", "CBR");
|
|
|
|
|
|
|
|
|
|
obs_data_set_default_int(settings, "accuracy", 1000);
|
|
|
|
@@ -156,11 +157,11 @@ static void obs_qsv_defaults(obs_data_t *settings)
|
|
|
|
|
obs_data_set_default_int(settings, "qpp", 23);
|
|
|
|
|
obs_data_set_default_int(settings, "qpb", 23);
|
|
|
|
|
obs_data_set_default_int(settings, "icq_quality", 23);
|
|
|
|
|
obs_data_set_default_int(settings, "la_depth", 15);
|
|
|
|
|
|
|
|
|
|
obs_data_set_default_int(settings, "keyint_sec", 3);
|
|
|
|
|
obs_data_set_default_string(settings, "latency", "normal");
|
|
|
|
|
obs_data_set_default_int(settings, "bframes", 3);
|
|
|
|
|
obs_data_set_default_bool(settings, "enhancements", false);
|
|
|
|
|
obs_data_set_default_bool(settings, "mbbrc", true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void add_strings(obs_property_t *list, const char *const *strings)
|
|
|
|
@@ -175,15 +176,15 @@ static inline void add_strings(obs_property_t *list, const char *const *strings)
|
|
|
|
|
#define TEXT_TARGET_BITRATE obs_module_text("Bitrate")
|
|
|
|
|
#define TEXT_MAX_BITRATE obs_module_text("MaxBitrate")
|
|
|
|
|
#define TEXT_PROFILE obs_module_text("Profile")
|
|
|
|
|
#define TEXT_LATENCY obs_module_text("Latency")
|
|
|
|
|
#define TEXT_ASYNC_DEPTH obs_module_text("AsyncDepth")
|
|
|
|
|
#define TEXT_RATE_CONTROL obs_module_text("RateControl")
|
|
|
|
|
#define TEXT_ACCURACY obs_module_text("Accuracy")
|
|
|
|
|
#define TEXT_CONVERGENCE obs_module_text("Convergence")
|
|
|
|
|
#define TEXT_ICQ_QUALITY obs_module_text("ICQQuality")
|
|
|
|
|
#define TEXT_LA_DEPTH obs_module_text("LookAheadDepth")
|
|
|
|
|
#define TEXT_KEYINT_SEC obs_module_text("KeyframeIntervalSec")
|
|
|
|
|
#define TEXT_BFRAMES obs_module_text("B Frames")
|
|
|
|
|
#define TEXT_SUBJECTIVE_ENHANCEMENTS \
|
|
|
|
|
obs_module_text("Subjective Video Enhancements")
|
|
|
|
|
#define TEXT_MBBRC obs_module_text("Content Adaptive Quantization")
|
|
|
|
|
|
|
|
|
|
static inline bool is_skl_or_greater_platform()
|
|
|
|
|
{
|
|
|
|
@@ -226,9 +227,16 @@ static bool rate_control_modified(obs_properties_t *ppts, obs_property_t *p,
|
|
|
|
|
p = obs_properties_get(ppts, "icq_quality");
|
|
|
|
|
obs_property_set_visible(p, bVisible);
|
|
|
|
|
|
|
|
|
|
bVisible = astrcmpi(rate_control, "LA_ICQ") == 0 ||
|
|
|
|
|
astrcmpi(rate_control, "LA_CBR") == 0 ||
|
|
|
|
|
astrcmpi(rate_control, "LA_VBR") == 0;
|
|
|
|
|
p = obs_properties_get(ppts, "la_depth");
|
|
|
|
|
obs_property_set_visible(p, bVisible);
|
|
|
|
|
|
|
|
|
|
bVisible = astrcmpi(rate_control, "CBR") == 0 ||
|
|
|
|
|
astrcmpi(rate_control, "VBR") == 0;
|
|
|
|
|
p = obs_properties_get(ppts, "enhancements");
|
|
|
|
|
astrcmpi(rate_control, "VBR") == 0 ||
|
|
|
|
|
astrcmpi(rate_control, "AVBR") == 0;
|
|
|
|
|
p = obs_properties_get(ppts, "mbbrc");
|
|
|
|
|
obs_property_set_visible(p, bVisible);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
@@ -277,6 +285,7 @@ static obs_properties_t *obs_qsv_props(void *unused)
|
|
|
|
|
obs_property_set_modified_callback(list, profile_modified);
|
|
|
|
|
|
|
|
|
|
obs_properties_add_int(props, "keyint_sec", TEXT_KEYINT_SEC, 1, 20, 1);
|
|
|
|
|
obs_properties_add_int(props, "async_depth", TEXT_ASYNC_DEPTH, 1, 7, 1);
|
|
|
|
|
|
|
|
|
|
list = obs_properties_add_list(props, "rate_control", TEXT_RATE_CONTROL,
|
|
|
|
|
OBS_COMBO_TYPE_LIST,
|
|
|
|
@@ -301,16 +310,13 @@ static obs_properties_t *obs_qsv_props(void *unused)
|
|
|
|
|
obs_properties_add_int(props, "qpb", "QPB", 1, 51, 1);
|
|
|
|
|
obs_properties_add_int(props, "icq_quality", TEXT_ICQ_QUALITY, 1, 51,
|
|
|
|
|
1);
|
|
|
|
|
list = obs_properties_add_list(props, "latency", TEXT_LATENCY,
|
|
|
|
|
OBS_COMBO_TYPE_LIST,
|
|
|
|
|
OBS_COMBO_FORMAT_STRING);
|
|
|
|
|
add_strings(list, qsv_latency_names);
|
|
|
|
|
|
|
|
|
|
obs_properties_add_int(props, "la_depth", TEXT_LA_DEPTH, 10, 100, 1);
|
|
|
|
|
obs_properties_add_int(props, "bframes", TEXT_BFRAMES, 0, 3, 1);
|
|
|
|
|
|
|
|
|
|
if (is_skl_or_greater_platform())
|
|
|
|
|
obs_properties_add_bool(props, "enhancements",
|
|
|
|
|
TEXT_SUBJECTIVE_ENHANCEMENTS);
|
|
|
|
|
obs_properties_add_bool(props, "mbbrc", TEXT_MBBRC);
|
|
|
|
|
|
|
|
|
|
obs_properties_add_bool(props, "CQM", "Customized quantization matrix");
|
|
|
|
|
|
|
|
|
|
return props;
|
|
|
|
|
}
|
|
|
|
@@ -325,7 +331,7 @@ static void update_params(struct obs_qsv *obsqsv, obs_data_t *settings)
|
|
|
|
|
const char *profile = obs_data_get_string(settings, "profile");
|
|
|
|
|
const char *rate_control =
|
|
|
|
|
obs_data_get_string(settings, "rate_control");
|
|
|
|
|
const char *latency = obs_data_get_string(settings, "latency");
|
|
|
|
|
int async_depth = (int)obs_data_get_int(settings, "async_depth");
|
|
|
|
|
int target_bitrate = (int)obs_data_get_int(settings, "bitrate");
|
|
|
|
|
int max_bitrate = (int)obs_data_get_int(settings, "max_bitrate");
|
|
|
|
|
int accuracy = (int)obs_data_get_int(settings, "accuracy");
|
|
|
|
@@ -334,10 +340,11 @@ static void update_params(struct obs_qsv *obsqsv, obs_data_t *settings)
|
|
|
|
|
int qpp = (int)obs_data_get_int(settings, "qpp");
|
|
|
|
|
int qpb = (int)obs_data_get_int(settings, "qpb");
|
|
|
|
|
int icq_quality = (int)obs_data_get_int(settings, "icq_quality");
|
|
|
|
|
int la_depth = (int)obs_data_get_int(settings, "la_depth");
|
|
|
|
|
int keyint_sec = (int)obs_data_get_int(settings, "keyint_sec");
|
|
|
|
|
bool cbr_override = obs_data_get_bool(settings, "cbr");
|
|
|
|
|
int bFrames = (int)obs_data_get_int(settings, "bframes");
|
|
|
|
|
bool enhancements = obs_data_get_bool(settings, "enhancements");
|
|
|
|
|
bool mbbrc = obs_data_get_bool(settings, "mbbrc");
|
|
|
|
|
|
|
|
|
|
if (obs_data_has_user_value(settings, "bf"))
|
|
|
|
|
bFrames = (int)obs_data_get_int(settings, "bf");
|
|
|
|
@@ -406,30 +413,13 @@ static void update_params(struct obs_qsv *obsqsv, obs_data_t *settings)
|
|
|
|
|
else if (astrcmpi(rate_control, "LA_CBR") == 0)
|
|
|
|
|
obsqsv->params.nRateControl = MFX_RATECONTROL_LA_HRD;
|
|
|
|
|
|
|
|
|
|
if (astrcmpi(latency, "ultra-low") == 0) {
|
|
|
|
|
obsqsv->params.nAsyncDepth = 1;
|
|
|
|
|
obsqsv->params.nLADEPTH = (mfxU16)0;
|
|
|
|
|
} else if (astrcmpi(latency, "low") == 0) {
|
|
|
|
|
obsqsv->params.nAsyncDepth = 4;
|
|
|
|
|
obsqsv->params.nLADEPTH =
|
|
|
|
|
(mfxU16)(voi->fps_num / voi->fps_den / 2);
|
|
|
|
|
} else if (astrcmpi(latency, "normal") == 0) {
|
|
|
|
|
obsqsv->params.nAsyncDepth = 4;
|
|
|
|
|
obsqsv->params.nLADEPTH = (mfxU16)(voi->fps_num / voi->fps_den);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obsqsv->params.nLADEPTH > 0) {
|
|
|
|
|
if (obsqsv->params.nLADEPTH > 100)
|
|
|
|
|
obsqsv->params.nLADEPTH = 100;
|
|
|
|
|
else if (obsqsv->params.nLADEPTH < 10)
|
|
|
|
|
obsqsv->params.nLADEPTH = 10;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
obsqsv->params.nAsyncDepth = (mfxU16)async_depth;
|
|
|
|
|
obsqsv->params.nAccuracy = (mfxU16)accuracy;
|
|
|
|
|
obsqsv->params.nConvergence = (mfxU16)convergence;
|
|
|
|
|
obsqsv->params.nQPI = (mfxU16)qpi;
|
|
|
|
|
obsqsv->params.nQPP = (mfxU16)qpp;
|
|
|
|
|
obsqsv->params.nQPB = (mfxU16)qpb;
|
|
|
|
|
obsqsv->params.nLADEPTH = (mfxU16)la_depth;
|
|
|
|
|
obsqsv->params.nTargetBitRate = (mfxU16)target_bitrate;
|
|
|
|
|
obsqsv->params.nMaxBitRate = (mfxU16)max_bitrate;
|
|
|
|
|
obsqsv->params.nWidth = (mfxU16)width;
|
|
|
|
@@ -439,8 +429,7 @@ static void update_params(struct obs_qsv *obsqsv, obs_data_t *settings)
|
|
|
|
|
obsqsv->params.nbFrames = (mfxU16)bFrames;
|
|
|
|
|
obsqsv->params.nKeyIntSec = (mfxU16)keyint_sec;
|
|
|
|
|
obsqsv->params.nICQQuality = (mfxU16)icq_quality;
|
|
|
|
|
obsqsv->params.bMBBRC = enhancements;
|
|
|
|
|
obsqsv->params.bCQM = enhancements;
|
|
|
|
|
obsqsv->params.bMBBRC = mbbrc;
|
|
|
|
|
|
|
|
|
|
info("settings:\n\trate_control: %s", rate_control);
|
|
|
|
|
|
|
|
|
@@ -480,6 +469,8 @@ static void update_params(struct obs_qsv *obsqsv, obs_data_t *settings)
|
|
|
|
|
"\theight: %d",
|
|
|
|
|
voi->fps_num, voi->fps_den, width, height);
|
|
|
|
|
|
|
|
|
|
obsqsv->params.bCQM = (bool)obs_data_get_bool(settings, "CQM");
|
|
|
|
|
|
|
|
|
|
info("debug info:");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|