Merge pull request #2077 from brittneysclark/qsv_cust_quant_mat
obs-qsv: Enable option for Custom Quantization Matrix
This commit is contained in:
commit
61d959a095
@ -300,6 +300,12 @@ enum qsv_cpu_platform qsv_get_cpu_platform()
|
||||
case 0x4e:
|
||||
case 0x5e:
|
||||
return QSV_CPU_PLATFORM_SKL;
|
||||
case 0x8e:
|
||||
case 0x9e:
|
||||
return QSV_CPU_PLATFORM_KBL;
|
||||
case 0x7d:
|
||||
case 0x7e:
|
||||
return QSV_CPU_PLATFORM_ICL;
|
||||
}
|
||||
|
||||
//assume newer revisions are at least as capable as Haswell
|
||||
|
@ -101,6 +101,7 @@ typedef struct {
|
||||
mfxU16 nbFrames;
|
||||
mfxU16 nICQQuality;
|
||||
bool bMBBRC;
|
||||
bool bCQM;
|
||||
} qsv_param_t;
|
||||
|
||||
enum qsv_cpu_platform {
|
||||
@ -113,6 +114,8 @@ enum qsv_cpu_platform {
|
||||
QSV_CPU_PLATFORM_HSW,
|
||||
QSV_CPU_PLATFORM_BDW,
|
||||
QSV_CPU_PLATFORM_SKL,
|
||||
QSV_CPU_PLATFORM_KBL,
|
||||
QSV_CPU_PLATFORM_ICL,
|
||||
QSV_CPU_PLATFORM_INTEL
|
||||
};
|
||||
|
||||
|
@ -74,8 +74,8 @@ mfxU16 QSV_Encoder_Internal::g_numEncodersOpen = 0;
|
||||
QSV_Encoder_Internal::QSV_Encoder_Internal(mfxIMPL &impl, mfxVersion &version)
|
||||
: m_pmfxSurfaces(NULL),
|
||||
m_pmfxENC(NULL),
|
||||
m_nSPSBufferSize(100),
|
||||
m_nPPSBufferSize(100),
|
||||
m_nSPSBufferSize(1024),
|
||||
m_nPPSBufferSize(1024),
|
||||
m_nTaskPool(0),
|
||||
m_pTaskPool(NULL),
|
||||
m_nTaskIdx(0),
|
||||
@ -253,7 +253,7 @@ bool QSV_Encoder_Internal::InitParams(qsv_param_t *pParams)
|
||||
(mfxU16)(pParams->nKeyIntSec * pParams->nFpsNum /
|
||||
(float)pParams->nFpsDen);
|
||||
|
||||
static mfxExtBuffer *extendedBuffers[2];
|
||||
static mfxExtBuffer *extendedBuffers[3];
|
||||
int iBuffers = 0;
|
||||
|
||||
if (m_ver.Major == 1 && m_ver.Minor >= 8) {
|
||||
@ -270,6 +270,16 @@ bool QSV_Encoder_Internal::InitParams(qsv_param_t *pParams)
|
||||
extendedBuffers[iBuffers++] = (mfxExtBuffer *)&m_co2;
|
||||
}
|
||||
|
||||
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;
|
||||
m_co3.Header.BufferSz = sizeof(m_co3);
|
||||
m_co3.ScenarioInfo = 7; // MFX_SCENARIO_GAME_STREAMING
|
||||
extendedBuffers[iBuffers++] = (mfxExtBuffer *)&m_co3;
|
||||
}
|
||||
}
|
||||
|
||||
if (iBuffers > 0) {
|
||||
m_mfxEncParams.ExtParam = extendedBuffers;
|
||||
m_mfxEncParams.NumExtParam = (mfxU16)iBuffers;
|
||||
@ -365,8 +375,8 @@ mfxStatus QSV_Encoder_Internal::GetVideoParam()
|
||||
|
||||
opt.SPSBuffer = m_SPSBuffer;
|
||||
opt.PPSBuffer = m_PPSBuffer;
|
||||
opt.SPSBufSize = 100; // m_nSPSBufferSize;
|
||||
opt.PPSBufSize = 100; // m_nPPSBufferSize;
|
||||
opt.SPSBufSize = 1024; // m_nSPSBufferSize;
|
||||
opt.PPSBufSize = 1024; // m_nPPSBufferSize;
|
||||
|
||||
mfxStatus sts = m_pmfxENC->GetVideoParam(&m_parameter);
|
||||
MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
|
||||
|
@ -94,11 +94,12 @@ private:
|
||||
mfxFrameSurface1 **m_pmfxSurfaces;
|
||||
mfxU16 m_nSurfNum;
|
||||
MFXVideoENCODE *m_pmfxENC;
|
||||
mfxU8 m_SPSBuffer[100];
|
||||
mfxU8 m_PPSBuffer[100];
|
||||
mfxU8 m_SPSBuffer[1024];
|
||||
mfxU8 m_PPSBuffer[1024];
|
||||
mfxU16 m_nSPSBufferSize;
|
||||
mfxU16 m_nPPSBufferSize;
|
||||
mfxVideoParam m_parameter;
|
||||
mfxExtCodingOption3 m_co3;
|
||||
mfxExtCodingOption2 m_co2;
|
||||
mfxExtCodingOption m_co;
|
||||
mfxU16 m_nTaskPool;
|
||||
|
@ -240,6 +240,18 @@ static bool rate_control_modified(obs_properties_t *ppts, obs_property_t *p,
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool profile_modified(obs_properties_t *ppts, obs_property_t *p,
|
||||
obs_data_t *settings)
|
||||
{
|
||||
const char *profile = obs_data_get_string(settings, "profile");
|
||||
enum qsv_cpu_platform plat = qsv_get_cpu_platform();
|
||||
bool bVisible = ((astrcmpi(profile, "high") == 0) &&
|
||||
(plat >= QSV_CPU_PLATFORM_ICL));
|
||||
p = obs_properties_get(ppts, "CQM");
|
||||
obs_property_set_visible(p, bVisible);
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void add_rate_controls(obs_property_t *list,
|
||||
const struct qsv_rate_control_info *rc)
|
||||
{
|
||||
@ -268,6 +280,8 @@ static obs_properties_t *obs_qsv_props(void *unused)
|
||||
OBS_COMBO_FORMAT_STRING);
|
||||
add_strings(list, qsv_profile_names);
|
||||
|
||||
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);
|
||||
|
||||
@ -300,6 +314,8 @@ static obs_properties_t *obs_qsv_props(void *unused)
|
||||
if (is_skl_or_greater_platform())
|
||||
obs_properties_add_bool(props, "mbbrc", TEXT_MBBRC);
|
||||
|
||||
obs_properties_add_bool(props, "CQM", "Customized quantization matrix");
|
||||
|
||||
return props;
|
||||
}
|
||||
|
||||
@ -437,6 +453,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:");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user