Revert "Merge pull request #2993 from brittneysclark/enable_vdenc"

This reverts commit 636f0bfdfa, reversing
changes made to b9ea45e498.
master
jp9000 2020-06-01 13:40:18 -07:00
parent 636f0bfdfa
commit 72a94cb6f5
5 changed files with 31 additions and 76 deletions

View File

@ -320,8 +320,6 @@ enum qsv_cpu_platform qsv_get_cpu_platform()
case 0x8e:
case 0x9e:
return QSV_CPU_PLATFORM_KBL;
case 0x66:
return QSV_CPU_PLATFORM_CNL;
case 0x7d:
case 0x7e:
return QSV_CPU_PLATFORM_ICL;

View File

@ -78,8 +78,7 @@ static const char *const qsv_usage_names[] = {"quality", "balanced", "speed",
"veryslow", "slower", "slow",
"medium", "fast", "faster",
"veryfast", 0};
static const char *const qsv_latency_names[] = {"ultra-low", "low", "normal",
0};
typedef struct qsv_t qsv_t;
typedef struct {
@ -118,7 +117,6 @@ enum qsv_cpu_platform {
QSV_CPU_PLATFORM_BDW,
QSV_CPU_PLATFORM_SKL,
QSV_CPU_PLATFORM_KBL,
QSV_CPU_PLATFORM_CNL,
QSV_CPU_PLATFORM_ICL,
QSV_CPU_PLATFORM_INTEL
};

View File

@ -211,17 +211,6 @@ bool QSV_Encoder_Internal::InitParams(qsv_param_t *pParams)
m_mfxEncParams.mfx.FrameInfo.CropH = pParams->nHeight;
m_mfxEncParams.mfx.GopRefDist = pParams->nbFrames + 1;
enum qsv_cpu_platform qsv_platform = qsv_get_cpu_platform();
if ((qsv_platform >= QSV_CPU_PLATFORM_ICL) &&
(pParams->nbFrames == 0) &&
(m_ver.Major == 1 && m_ver.Minor >= 31)) {
m_mfxEncParams.mfx.LowPower = MFX_CODINGOPTION_ON;
if (pParams->nRateControl == MFX_RATECONTROL_LA_ICQ ||
pParams->nRateControl == MFX_RATECONTROL_LA_HRD ||
pParams->nRateControl == MFX_RATECONTROL_LA)
pParams->nRateControl = MFX_RATECONTROL_VBR;
}
m_mfxEncParams.mfx.RateControlMethod = pParams->nRateControl;
switch (pParams->nRateControl) {
@ -279,23 +268,10 @@ bool QSV_Encoder_Internal::InitParams(qsv_param_t *pParams)
m_co2.MBBRC = MFX_CODINGOPTION_ON;
if (pParams->nbFrames > 1)
m_co2.BRefType = MFX_B_REF_PYRAMID;
if (m_mfxEncParams.mfx.LowPower == MFX_CODINGOPTION_ON) {
m_co2.RepeatPPS = MFX_CODINGOPTION_OFF;
if (pParams->nRateControl == MFX_RATECONTROL_CBR ||
pParams->nRateControl == MFX_RATECONTROL_VBR) {
m_co2.LookAheadDepth = pParams->nLADEPTH;
}
}
extendedBuffers[iBuffers++] = (mfxExtBuffer *)&m_co2;
}
if (m_mfxEncParams.mfx.LowPower == MFX_CODINGOPTION_ON) {
memset(&m_co3, 0, sizeof(mfxExtCodingOption3));
m_co3.Header.BufferId = MFX_EXTBUFF_CODING_OPTION3;
m_co3.Header.BufferSz = sizeof(m_co3);
m_co3.ScenarioInfo = MFX_SCENARIO_GAME_STREAMING;
extendedBuffers[iBuffers++] = (mfxExtBuffer *)&m_co3;
} else if (pParams->bCQM) {
if (pParams->bCQM) {
if (m_ver.Major == 1 && m_ver.Minor >= 16) {
memset(&m_co3, 0, sizeof(mfxExtCodingOption3));
m_co3.Header.BufferId = MFX_EXTBUFF_CODING_OPTION3;
@ -321,11 +297,6 @@ bool QSV_Encoder_Internal::InitParams(qsv_param_t *pParams)
else
m_mfxEncParams.IOPattern = MFX_IOPATTERN_IN_SYSTEM_MEMORY;
mfxStatus sts = m_pmfxENC->Query(&m_mfxEncParams, &m_mfxEncParams);
if (sts == MFX_ERR_UNSUPPORTED || sts == MFX_ERR_UNDEFINED_BEHAVIOR) {
m_mfxEncParams.mfx.LowPower = MFX_CODINGOPTION_OFF;
}
return true;
}

View File

@ -642,10 +642,7 @@ enum {
MFX_SCENARIO_VIDEO_CONFERENCE = 2,
MFX_SCENARIO_ARCHIVE = 3,
MFX_SCENARIO_LIVE_STREAMING = 4,
MFX_SCENARIO_CAMERA_CAPTURE = 5,
MFX_SCENARIO_VIDEO_SURVEILLANCE = 6,
MFX_SCENARIO_GAME_STREAMING = 7,
MFX_SCENARIO_REMOTE_GAMING = 8
MFX_SCENARIO_CAMERA_CAPTURE = 5
};
/* ContentInfo */

View File

@ -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:");
}