Add QSV encoder settings pane
Allows selecting new modes via the settings instead of ini onlymaster
parent
0b0b5d28e6
commit
eaac477207
58
OBS.rc
58
OBS.rc
|
@ -1080,6 +1080,56 @@ BEGIN
|
||||||
LTEXT "LogUpload.SuccessDialog.CopySuccess",IDC_COPIED,7,43,176,8,NOT WS_VISIBLE
|
LTEXT "LogUpload.SuccessDialog.CopySuccess",IDC_COPIED,7,43,176,8,NOT WS_VISIBLE
|
||||||
END
|
END
|
||||||
|
|
||||||
|
IDD_SETTINGS_QSV DIALOGEX 0, 0, 429, 385
|
||||||
|
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
|
||||||
|
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||||
|
BEGIN
|
||||||
|
GROUPBOX "Settings.QSV.RateControlMethod",IDC_STATIC,7,22,413,59
|
||||||
|
CONTROL "CBR",IDC_QSVCBR,"Button",BS_AUTORADIOBUTTON,98,36,29,10
|
||||||
|
CONTROL "VCM",IDC_QSVVCM,"Button",BS_AUTORADIOBUTTON,177,36,30,10
|
||||||
|
CONTROL "VBR",IDC_QSVVBR,"Button",BS_AUTORADIOBUTTON,98,50,29,10
|
||||||
|
CONTROL "AVBR",IDC_QSVAVBR,"Button",BS_AUTORADIOBUTTON,177,50,33,10
|
||||||
|
CONTROL "LA (VBR)",IDC_QSVLA,"Button",BS_AUTORADIOBUTTON,256,50,44,10
|
||||||
|
CONTROL "CQP",IDC_QSVCQP,"Button",BS_AUTORADIOBUTTON,98,64,30,10
|
||||||
|
CONTROL "ICQ",IDC_QSVICQ,"Button",BS_AUTORADIOBUTTON,177,64,29,10
|
||||||
|
CONTROL "LA ICQ",IDC_QSVLAICQ,"Button",BS_AUTORADIOBUTTON,256,64,39,10
|
||||||
|
GROUPBOX "Settings.QSV.BitrateParameters",IDC_STATIC,7,85,413,192
|
||||||
|
RTEXT "Settings.QSV.TargetKbps",IDC_STATIC,10,98,155,8
|
||||||
|
EDITTEXT IDC_TARGETKBPS,166,96,67,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||||
|
RTEXT "Settings.QSV.MaxKbps",IDC_STATIC,10,113,155,8
|
||||||
|
EDITTEXT IDC_MAXKBPS,166,112,67,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||||
|
RTEXT "Settings.QSV.BufferSizeInKB",IDC_STATIC,10,129,155,8
|
||||||
|
EDITTEXT IDC_BUFFERSIZE,166,128,67,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||||
|
RTEXT "Settings.QSV.Accuracy",IDC_STATIC,10,149,155,8
|
||||||
|
EDITTEXT IDC_ACCURACY_EDIT,166,148,67,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||||
|
CONTROL "",IDC_ACCURACY,"msctls_updown32",UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,233,148,10,14
|
||||||
|
RTEXT "Settings.QSV.Convergence",IDC_STATIC,10,165,155,8
|
||||||
|
EDITTEXT IDC_CONVERGENCE_EDIT,166,164,67,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||||
|
CONTROL "",IDC_CONVERGENCE,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,234,164,10,14
|
||||||
|
RTEXT "Settings.QSV.LookAheadDepth",IDC_STATIC,10,185,155,8
|
||||||
|
EDITTEXT IDC_LADEPTH_EDIT,166,184,67,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||||
|
CONTROL "",IDC_LADEPTH,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,234,184,10,14
|
||||||
|
RTEXT "Settings.QSV.QPI",IDC_STATIC,10,205,155,8
|
||||||
|
EDITTEXT IDC_QPI_EDIT,166,204,67,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||||
|
CONTROL "",IDC_QPI,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,234,204,10,14
|
||||||
|
RTEXT "Settings.QSV.QPP",IDC_STATIC,10,221,155,8
|
||||||
|
EDITTEXT IDC_QPP_EDIT,166,220,67,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||||
|
CONTROL "",IDC_QPP,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,234,220,10,14
|
||||||
|
RTEXT "Settings.QSV.QPB",IDC_STATIC,10,237,155,8
|
||||||
|
EDITTEXT IDC_QPB_EDIT,166,236,67,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||||
|
CONTROL "",IDC_QPB,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,234,236,10,14
|
||||||
|
RTEXT "Settings.QSV.ICQQuality",IDC_STATIC,10,257,155,8
|
||||||
|
EDITTEXT IDC_ICQQUALITY_EDIT,166,256,67,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||||
|
CONTROL "",IDC_ICQQUALITY,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,234,256,10,14
|
||||||
|
LTEXT "Settings.Info",IDC_INFO,7,365,408,11,NOT WS_VISIBLE
|
||||||
|
CONTROL "Settings.QSV.UseCustomParams",IDC_USECUSTOMPARAMS,
|
||||||
|
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,300,10
|
||||||
|
CONTROL "Settings.QSV.UseGlobalBitrate",IDC_USEGLOBALBITRATE,
|
||||||
|
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,239,98,174,10
|
||||||
|
CONTROL "Settings.QSV.UseGlobalBufferSize",IDC_USEGLOBALBUFFERSIZE,
|
||||||
|
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,239,130,174,10
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
@ -1095,6 +1145,14 @@ BEGIN
|
||||||
RIGHTMARGIN, 302
|
RIGHTMARGIN, 302
|
||||||
TOPMARGIN, 7
|
TOPMARGIN, 7
|
||||||
END
|
END
|
||||||
|
|
||||||
|
IDD_SETTINGS_QSV, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 420
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 376
|
||||||
|
END
|
||||||
END
|
END
|
||||||
#endif // APSTUDIO_INVOKED
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
|
@ -305,6 +305,7 @@
|
||||||
<ClCompile Include="Source\SettingsGeneral.cpp" />
|
<ClCompile Include="Source\SettingsGeneral.cpp" />
|
||||||
<ClCompile Include="Source\SettingsHotkeys.cpp" />
|
<ClCompile Include="Source\SettingsHotkeys.cpp" />
|
||||||
<ClCompile Include="Source\SettingsPublish.cpp" />
|
<ClCompile Include="Source\SettingsPublish.cpp" />
|
||||||
|
<ClCompile Include="Source\SettingsQSV.cpp" />
|
||||||
<ClCompile Include="Source\SettingsVideo.cpp" />
|
<ClCompile Include="Source\SettingsVideo.cpp" />
|
||||||
<ClCompile Include="Source\TextOutputSource.cpp" />
|
<ClCompile Include="Source\TextOutputSource.cpp" />
|
||||||
<ClCompile Include="Source\Updater.cpp" />
|
<ClCompile Include="Source\Updater.cpp" />
|
||||||
|
|
|
@ -157,6 +157,9 @@
|
||||||
<ClCompile Include="Source\ReplayBuffer.cpp">
|
<ClCompile Include="Source\ReplayBuffer.cpp">
|
||||||
<Filter>Source</Filter>
|
<Filter>Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="Source\SettingsQSV.cpp">
|
||||||
|
<Filter>Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="Source\D3D10System.h">
|
<ClInclude Include="Source\D3D10System.h">
|
||||||
|
@ -281,4 +284,4 @@
|
||||||
<Filter>Resources</Filter>
|
<Filter>Resources</Filter>
|
||||||
</ResourceCompile>
|
</ResourceCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -155,6 +155,13 @@ void OBS::AddBuiltInSettingsPanes()
|
||||||
|
|
||||||
void OBS::AddEncoderSettingsPanes()
|
void OBS::AddEncoderSettingsPanes()
|
||||||
{
|
{
|
||||||
|
SettingsPane *panes[] = {
|
||||||
|
new SettingsQSV(),
|
||||||
|
};
|
||||||
|
|
||||||
|
for (auto pane : panes)
|
||||||
|
AddSettingsPane(pane);
|
||||||
|
saturate(numberOfEncoderSettingsPanes, std::distance(std::begin(panes), std::end(panes)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBS::SetChangedSettings(bool bChanged)
|
void OBS::SetChangedSettings(bool bChanged)
|
||||||
|
|
|
@ -262,3 +262,32 @@ public:
|
||||||
virtual bool HasDefaults() const override;
|
virtual bool HasDefaults() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
// SettingsQSV class
|
||||||
|
|
||||||
|
class SettingsQSV : public SettingsPane
|
||||||
|
{
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// Constructor/destructor
|
||||||
|
|
||||||
|
public:
|
||||||
|
SettingsQSV();
|
||||||
|
virtual ~SettingsQSV() override;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// Methods
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Interface
|
||||||
|
virtual CTSTR GetCategory() const override;
|
||||||
|
virtual HWND CreatePane(HWND parentHwnd) override;
|
||||||
|
virtual void DestroyPane() override;
|
||||||
|
virtual INT_PTR ProcMessage(UINT message, WPARAM wParam, LPARAM lParam) override;
|
||||||
|
virtual void ApplySettings() override;
|
||||||
|
virtual void CancelSettings() override;
|
||||||
|
virtual bool HasDefaults() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void RateControlMethodChanged();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,350 @@
|
||||||
|
/********************************************************************************
|
||||||
|
Copyright (C) 2014 Ruwen Hahn <palana@stunned.de>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
#include "Settings.h"
|
||||||
|
|
||||||
|
#include "mfxstructures.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include "../QSVHelper/Utilities.h"
|
||||||
|
|
||||||
|
bool QSVMethodAvailable(decltype(mfxInfoMFX::RateControlMethod) method);
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
using ratecontrol_t = decltype(mfxInfoMFX::RateControlMethod);
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
int id;
|
||||||
|
ratecontrol_t method;
|
||||||
|
} id_method_map[] = {
|
||||||
|
{ IDC_QSVCBR, MFX_RATECONTROL_CBR },
|
||||||
|
{ IDC_QSVVCM, MFX_RATECONTROL_VCM },
|
||||||
|
{ IDC_QSVVBR, MFX_RATECONTROL_VBR },
|
||||||
|
{ IDC_QSVAVBR, MFX_RATECONTROL_AVBR },
|
||||||
|
{ IDC_QSVLA, MFX_RATECONTROL_LA },
|
||||||
|
{ IDC_QSVCQP, MFX_RATECONTROL_CQP },
|
||||||
|
{ IDC_QSVICQ, MFX_RATECONTROL_ICQ },
|
||||||
|
{ IDC_QSVLAICQ, MFX_RATECONTROL_LA_ICQ },
|
||||||
|
};
|
||||||
|
|
||||||
|
int parameter_control_ids[] = {
|
||||||
|
IDC_TARGETKBPS,
|
||||||
|
IDC_USEGLOBALBITRATE,
|
||||||
|
IDC_MAXKBPS,
|
||||||
|
IDC_BUFFERSIZE,
|
||||||
|
IDC_USEGLOBALBUFFERSIZE,
|
||||||
|
IDC_ACCURACY_EDIT,
|
||||||
|
IDC_ACCURACY,
|
||||||
|
IDC_CONVERGENCE_EDIT,
|
||||||
|
IDC_CONVERGENCE,
|
||||||
|
IDC_QPI_EDIT,
|
||||||
|
IDC_QPI,
|
||||||
|
IDC_QPP_EDIT,
|
||||||
|
IDC_QPP,
|
||||||
|
IDC_QPB_EDIT,
|
||||||
|
IDC_QPB,
|
||||||
|
IDC_LADEPTH_EDIT,
|
||||||
|
IDC_LADEPTH,
|
||||||
|
IDC_ICQQUALITY_EDIT,
|
||||||
|
IDC_ICQQUALITY,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
ratecontrol_t method;
|
||||||
|
std::initializer_list<int> enabled_ids;
|
||||||
|
} method_enabled_ids[] = {
|
||||||
|
{ MFX_RATECONTROL_CBR, { IDC_TARGETKBPS, IDC_USEGLOBALBITRATE, IDC_BUFFERSIZE, IDC_USEGLOBALBUFFERSIZE } },
|
||||||
|
{ MFX_RATECONTROL_VCM, { IDC_TARGETKBPS, IDC_USEGLOBALBITRATE, IDC_MAXKBPS, IDC_BUFFERSIZE, IDC_USEGLOBALBUFFERSIZE } }, //TODO: find settings that are actually used
|
||||||
|
{ MFX_RATECONTROL_VBR, { IDC_TARGETKBPS, IDC_USEGLOBALBITRATE, IDC_MAXKBPS, IDC_BUFFERSIZE, IDC_USEGLOBALBUFFERSIZE } },
|
||||||
|
{ MFX_RATECONTROL_AVBR, { IDC_TARGETKBPS, IDC_USEGLOBALBITRATE, IDC_ACCURACY, IDC_CONVERGENCE, IDC_ACCURACY_EDIT, IDC_CONVERGENCE_EDIT } },
|
||||||
|
{ MFX_RATECONTROL_LA, { IDC_TARGETKBPS, IDC_USEGLOBALBITRATE, IDC_LADEPTH, IDC_LADEPTH_EDIT } },
|
||||||
|
{ MFX_RATECONTROL_CQP, { IDC_QPI_EDIT, IDC_QPI, IDC_QPP_EDIT, IDC_QPP, IDC_QPB_EDIT, IDC_QPB } },
|
||||||
|
{ MFX_RATECONTROL_ICQ, { IDC_ICQQUALITY, IDC_ICQQUALITY_EDIT } },
|
||||||
|
{ MFX_RATECONTROL_LA_ICQ, { IDC_LADEPTH, IDC_LADEPTH_EDIT, IDC_ICQQUALITY, IDC_ICQQUALITY_EDIT } }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
// SettingsQSV class
|
||||||
|
|
||||||
|
SettingsQSV::SettingsQSV()
|
||||||
|
: SettingsPane()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingsQSV::~SettingsQSV()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CTSTR SettingsQSV::GetCategory() const
|
||||||
|
{
|
||||||
|
static CTSTR name = Str("Settings.QSV");
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
HWND SettingsQSV::CreatePane(HWND parentHwnd)
|
||||||
|
{
|
||||||
|
hwnd = OBSCreateDialog(hinstMain, MAKEINTRESOURCE(IDD_SETTINGS_QSV), parentHwnd, (DLGPROC)DialogProc, (LPARAM)this);
|
||||||
|
return hwnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsQSV::DestroyPane()
|
||||||
|
{
|
||||||
|
DestroyWindow(hwnd);
|
||||||
|
hwnd = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ratecontrol_t get_method(HWND hwnd)
|
||||||
|
{
|
||||||
|
for (auto mapping : id_method_map)
|
||||||
|
if (SendMessage(GetDlgItem(hwnd, mapping.id), BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||||
|
return mapping.method;
|
||||||
|
|
||||||
|
return MFX_RATECONTROL_VBR;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsQSV::ApplySettings()
|
||||||
|
{
|
||||||
|
auto checked = [&](int id) { return SendMessage(GetDlgItem(hwnd, id), BM_GETCHECK, 0, 0) == BST_CHECKED; };
|
||||||
|
|
||||||
|
AppConfig->SetInt(L"QSV (Advanced)", L"UseCustomParams", checked(IDC_USECUSTOMPARAMS));
|
||||||
|
|
||||||
|
ratecontrol_t method = get_method(hwnd);
|
||||||
|
AppConfig->SetInt(L"QSV (Advanced)", L"RateControlMethod", method);
|
||||||
|
|
||||||
|
AppConfig->SetInt(L"QSV (Advanced)", L"TargetKbps", GetEditText(GetDlgItem(hwnd, IDC_TARGETKBPS)).ToInt());
|
||||||
|
AppConfig->SetInt(L"QSV (Advanced)", L"UseGlobalBitrate", checked(IDC_USEGLOBALBITRATE));
|
||||||
|
AppConfig->SetInt(L"QSV (Advanced)", L"MaxKbps", GetEditText(GetDlgItem(hwnd, IDC_MAXKBPS)).ToInt());
|
||||||
|
AppConfig->SetInt(L"QSV (Advanced)", L"BufferSizeInKB", GetEditText(GetDlgItem(hwnd, IDC_BUFFERSIZE)).ToInt());
|
||||||
|
AppConfig->SetInt(L"QSV (Advanced)", L"UseGlobalBufferSize", checked(IDC_USEGLOBALBUFFERSIZE));
|
||||||
|
|
||||||
|
auto save_range = [&](int id, CTSTR name)
|
||||||
|
{
|
||||||
|
AppConfig->SetInt(L"QSV (Advanced)", name, (UINT)SendMessage(GetDlgItem(hwnd, id), UDM_GETPOS32, 0, 0));
|
||||||
|
};
|
||||||
|
|
||||||
|
save_range(IDC_ACCURACY, L"Accuracy");
|
||||||
|
|
||||||
|
save_range(IDC_CONVERGENCE, L"Convergence");
|
||||||
|
|
||||||
|
save_range(IDC_LADEPTH, L"LADepth");
|
||||||
|
|
||||||
|
save_range(IDC_QPI, L"QPI");
|
||||||
|
save_range(IDC_QPP, L"QPP");
|
||||||
|
save_range(IDC_QPB, L"QPB");
|
||||||
|
|
||||||
|
save_range(IDC_ICQQUALITY, L"ICQQuality");
|
||||||
|
|
||||||
|
RateControlMethodChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsQSV::CancelSettings()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SettingsQSV::HasDefaults() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsQSV::RateControlMethodChanged()
|
||||||
|
{
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
auto checked = [&](int id) { return SendMessage(GetDlgItem(hwnd, id), BM_GETCHECK, 0, 0) == BST_CHECKED; };
|
||||||
|
auto enable = [&](int id, bool enable) { EnableWindow(GetDlgItem(hwnd, id), enable); };
|
||||||
|
|
||||||
|
bool enabled = checked(IDC_USECUSTOMPARAMS);
|
||||||
|
|
||||||
|
//--------------------------------------------
|
||||||
|
|
||||||
|
ratecontrol_t config_method = AppConfig->GetInt(L"QSV (Advanced)", L"RateControlMethod", MFX_RATECONTROL_CBR);
|
||||||
|
if (!valid_method(config_method))
|
||||||
|
config_method = MFX_RATECONTROL_CBR;
|
||||||
|
|
||||||
|
ratecontrol_t method = get_method(hwnd);
|
||||||
|
|
||||||
|
for (auto mapping : id_method_map)
|
||||||
|
EnableWindow(GetDlgItem(hwnd, mapping.id), enabled && (config_method == mapping.method || QSVMethodAvailable(mapping.method)));
|
||||||
|
|
||||||
|
//--------------------------------------------
|
||||||
|
|
||||||
|
auto mapping = find_if(begin(method_enabled_ids), end(method_enabled_ids), [method](const decltype(method_enabled_ids[0]) &item) { return item.method == method; });
|
||||||
|
if (mapping == end(method_enabled_ids))
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (auto id : parameter_control_ids)
|
||||||
|
EnableWindow(GetDlgItem(hwnd, id), enabled && find(begin(mapping->enabled_ids), end(mapping->enabled_ids), id) != end(mapping->enabled_ids));
|
||||||
|
|
||||||
|
enable(IDC_TARGETKBPS, !checked(IDC_USEGLOBALBITRATE));
|
||||||
|
enable(IDC_BUFFERSIZE, !checked(IDC_USEGLOBALBUFFERSIZE));
|
||||||
|
}
|
||||||
|
|
||||||
|
INT_PTR SettingsQSV::ProcMessage(UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
switch (message)
|
||||||
|
{
|
||||||
|
case WM_INITDIALOG:
|
||||||
|
{
|
||||||
|
LocalizeWindow(hwnd);
|
||||||
|
|
||||||
|
//--------------------------------------------
|
||||||
|
|
||||||
|
auto check = [&](int item, bool checked)
|
||||||
|
{
|
||||||
|
SendMessage(GetDlgItem(hwnd, item), BM_SETCHECK, checked ? BST_CHECKED : BST_UNCHECKED, 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------
|
||||||
|
|
||||||
|
bool enabled = !!AppConfig->GetInt(L"QSV (Advanced)", L"UseCustomParams");
|
||||||
|
check(IDC_USECUSTOMPARAMS, enabled);
|
||||||
|
|
||||||
|
//--------------------------------------------
|
||||||
|
|
||||||
|
ratecontrol_t method = AppConfig->GetInt(L"QSV (Advanced)", L"RateControlMethod", MFX_RATECONTROL_CBR);
|
||||||
|
if (!valid_method(method))
|
||||||
|
method = MFX_RATECONTROL_CBR;
|
||||||
|
|
||||||
|
for (auto mapping : id_method_map)
|
||||||
|
check(mapping.id, method == mapping.method);
|
||||||
|
|
||||||
|
//--------------------------------------------
|
||||||
|
|
||||||
|
bool use_global_bitrate = !!AppConfig->GetInt(L"QSV (Advanced)", L"UseGlobalBitrate", true);
|
||||||
|
check(IDC_USEGLOBALBITRATE, use_global_bitrate);
|
||||||
|
|
||||||
|
//--------------------------------------------
|
||||||
|
|
||||||
|
bool use_global_buffer = !!AppConfig->GetInt(L"QSV (Advanced)", L"UseGlobalBufferSize", true);
|
||||||
|
check(IDC_USEGLOBALBUFFERSIZE, use_global_buffer);
|
||||||
|
|
||||||
|
//--------------------------------------------
|
||||||
|
|
||||||
|
LoadSettingEditInt(GetDlgItem(hwnd, IDC_TARGETKBPS), L"QSV (Advanced)", L"TargetKbps", 1000);
|
||||||
|
LoadSettingEditInt(GetDlgItem(hwnd, IDC_MAXKBPS), L"QSV (Advanced)", L"MaxKbps", 0);
|
||||||
|
LoadSettingEditInt(GetDlgItem(hwnd, IDC_BUFFERSIZE), L"QSV (Advanced)", L"BufferSizeInKB", 0);
|
||||||
|
|
||||||
|
//--------------------------------------------
|
||||||
|
|
||||||
|
auto load_range = [&](int id, CTSTR name, int def, int min, int max)
|
||||||
|
{
|
||||||
|
HWND dlg = GetDlgItem(hwnd, id);
|
||||||
|
int val = clamp(AppConfig->GetInt(L"QSV (Advanced)", name, def), min, max);
|
||||||
|
SendMessage(dlg, UDM_SETRANGE32, min, max);
|
||||||
|
SendMessage(dlg, UDM_SETPOS32, 0, val);
|
||||||
|
return val;
|
||||||
|
};
|
||||||
|
|
||||||
|
int accuracy = load_range(IDC_ACCURACY, L"Accuracy", 1000, 0, 1000);
|
||||||
|
|
||||||
|
load_range(IDC_CONVERGENCE, L"Convergence", 0, 0, 1000);
|
||||||
|
|
||||||
|
load_range(IDC_LADEPTH, L"LADepth", 40, 10, 100);
|
||||||
|
|
||||||
|
load_range(IDC_QPI, L"QPI", 23, 1, 51);
|
||||||
|
load_range(IDC_QPP, L"QPP", 23, 1, 51);
|
||||||
|
load_range(IDC_QPB, L"QPB", 23, 1, 51);
|
||||||
|
|
||||||
|
load_range(IDC_ICQQUALITY, L"ICQQuality", 23, 1, 51);
|
||||||
|
|
||||||
|
//--------------------------------------------
|
||||||
|
|
||||||
|
SetWindowText(GetDlgItem(hwnd, IDC_ACCURACY_EDIT), FloatString(accuracy / 10.).Array());
|
||||||
|
|
||||||
|
//--------------------------------------------
|
||||||
|
|
||||||
|
RateControlMethodChanged();
|
||||||
|
|
||||||
|
//--------------------------------------------
|
||||||
|
|
||||||
|
//need this as some of the dialog item sets above trigger the notifications
|
||||||
|
SetChangedSettings(false);
|
||||||
|
ShowWindow(GetDlgItem(hwnd, IDC_INFO), SW_HIDE);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_COMMAND:
|
||||||
|
switch (LOWORD(wParam))
|
||||||
|
{
|
||||||
|
case IDC_USECUSTOMPARAMS:
|
||||||
|
case IDC_QSVCBR:
|
||||||
|
case IDC_QSVVCM:
|
||||||
|
case IDC_QSVVBR:
|
||||||
|
case IDC_QSVAVBR:
|
||||||
|
case IDC_QSVLA:
|
||||||
|
case IDC_QSVCQP:
|
||||||
|
case IDC_QSVICQ:
|
||||||
|
case IDC_QSVLAICQ:
|
||||||
|
case IDC_USEGLOBALBITRATE:
|
||||||
|
case IDC_USEGLOBALBUFFERSIZE:
|
||||||
|
if (HIWORD(wParam) == BN_CLICKED)
|
||||||
|
{
|
||||||
|
SetChangedSettings(true);
|
||||||
|
if (App->GetVideoEncoder())
|
||||||
|
ShowWindow(GetDlgItem(hwnd, IDC_INFO), SW_SHOW);
|
||||||
|
RateControlMethodChanged();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IDC_TARGETKBPS:
|
||||||
|
case IDC_MAXKBPS:
|
||||||
|
case IDC_CUSTOMBUFFER:
|
||||||
|
case IDC_ACCURACY_EDIT:
|
||||||
|
case IDC_CONVERGENCE_EDIT:
|
||||||
|
case IDC_LADEPTH_EDIT:
|
||||||
|
case IDC_QPI_EDIT:
|
||||||
|
case IDC_QPP_EDIT:
|
||||||
|
case IDC_QPB_EDIT:
|
||||||
|
case IDC_ICQQUALITY_EDIT:
|
||||||
|
if (HIWORD(wParam) == EN_CHANGE)
|
||||||
|
{
|
||||||
|
SetChangedSettings(true);
|
||||||
|
if (App->GetVideoEncoder())
|
||||||
|
ShowWindow(GetDlgItem(hwnd, IDC_INFO), SW_SHOW);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_NOTIFY:
|
||||||
|
auto foo = (LPNMHDR)lParam;
|
||||||
|
switch (foo->code)
|
||||||
|
{
|
||||||
|
case UDN_DELTAPOS:
|
||||||
|
{
|
||||||
|
auto lpnmud = (LPNMUPDOWN)lParam;
|
||||||
|
if (lpnmud->hdr.hwndFrom != GetDlgItem(hwnd, IDC_ACCURACY))
|
||||||
|
break;
|
||||||
|
|
||||||
|
int newpos = lpnmud->iPos + lpnmud->iDelta;
|
||||||
|
if (newpos < 0 || newpos > 1000)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
SetWindowText(GetDlgItem(hwnd, IDC_ACCURACY_EDIT), FloatString(newpos/10.).Array());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
33
resource.h
33
resource.h
|
@ -40,6 +40,7 @@
|
||||||
#define IDD_STATS 145
|
#define IDD_STATS 145
|
||||||
#define IDD_LOGUPLOADED 147
|
#define IDD_LOGUPLOADED 147
|
||||||
#define IDD_SETTINGS_HOTKEYS 149
|
#define IDD_SETTINGS_HOTKEYS 149
|
||||||
|
#define IDD_SETTINGS_QSV 150
|
||||||
#define IDC_SETTINGSLIST 1006
|
#define IDC_SETTINGSLIST 1006
|
||||||
#define IDC_SUBDIALOG 1007
|
#define IDC_SUBDIALOG 1007
|
||||||
#define IDC_MODE 1008
|
#define IDC_MODE 1008
|
||||||
|
@ -270,6 +271,7 @@
|
||||||
#define IDC_PRIORITY 1132
|
#define IDC_PRIORITY 1132
|
||||||
#define IDC_USECBR 1133
|
#define IDC_USECBR 1133
|
||||||
#define IDC_PADCBR 1134
|
#define IDC_PADCBR 1134
|
||||||
|
#define IDC_QSVLA 1135
|
||||||
#define IDC_NVENCPRESET 1139
|
#define IDC_NVENCPRESET 1139
|
||||||
#define IDC_DISABLECTSADJUST 1140
|
#define IDC_DISABLECTSADJUST 1140
|
||||||
#define IDC_USECFR 1141
|
#define IDC_USECFR 1141
|
||||||
|
@ -325,6 +327,33 @@
|
||||||
#define IDC_FILEOUTPUTREPLAYBUFFER 1180
|
#define IDC_FILEOUTPUTREPLAYBUFFER 1180
|
||||||
#define IDC_REPLAYBUFFERMEMORY_STATIC 1181
|
#define IDC_REPLAYBUFFERMEMORY_STATIC 1181
|
||||||
#define IDC_REPLAYBUFFERMEMORY 1182
|
#define IDC_REPLAYBUFFERMEMORY 1182
|
||||||
|
#define IDC_QSVCBR 1183
|
||||||
|
#define IDC_QSVVBR 1184
|
||||||
|
#define IDC_QSVAVBR 1185
|
||||||
|
#define IDC_TARGETKBPS 1186
|
||||||
|
#define IDC_QSVCQP 1187
|
||||||
|
#define IDC_QSVICQ 1188
|
||||||
|
#define IDC_QSVLAICQ 1189
|
||||||
|
#define IDC_QSVVCM 1190
|
||||||
|
#define IDC_QSVMAXKBPS 1191
|
||||||
|
#define IDC_MAXKBPS 1191
|
||||||
|
#define IDC_ACCURACY_EDIT 1193
|
||||||
|
#define IDC_ACCURACY 1194
|
||||||
|
#define IDC_CONVERGENCE_EDIT 1195
|
||||||
|
#define IDC_CONVERGENCE 1196
|
||||||
|
#define IDC_QPI_EDIT 1197
|
||||||
|
#define IDC_QPI 1198
|
||||||
|
#define IDC_QPP_EDIT 1199
|
||||||
|
#define IDC_QPP 1200
|
||||||
|
#define IDC_QPB_EDIT 1201
|
||||||
|
#define IDC_QPB 1202
|
||||||
|
#define IDC_LADEPTH_EDIT 1203
|
||||||
|
#define IDC_LADEPTH 1204
|
||||||
|
#define IDC_ICQQUALITY_EDIT 1205
|
||||||
|
#define IDC_ICQQUALITY 1206
|
||||||
|
#define IDC_USECUSTOMPARAMS 1207
|
||||||
|
#define IDC_USEGLOBALBITRATE 1208
|
||||||
|
#define IDC_USEGLOBALBUFFERSIZE 1209
|
||||||
#define IDA_SOURCE_MOVEUP 40018
|
#define IDA_SOURCE_MOVEUP 40018
|
||||||
#define IDA_SOURCE_MOVEDOWN 40019
|
#define IDA_SOURCE_MOVEDOWN 40019
|
||||||
#define IDA_SOURCE_MOVETOTOP 40020
|
#define IDA_SOURCE_MOVETOTOP 40020
|
||||||
|
@ -391,9 +420,9 @@
|
||||||
//
|
//
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 150
|
#define _APS_NEXT_RESOURCE_VALUE 151
|
||||||
#define _APS_NEXT_COMMAND_VALUE 40081
|
#define _APS_NEXT_COMMAND_VALUE 40081
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1183
|
#define _APS_NEXT_CONTROL_VALUE 1208
|
||||||
#define _APS_NEXT_SYMED_VALUE 101
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -157,6 +157,23 @@ Settings.SaveChangesPrompt="Would you like to save and apply your changes?"
|
||||||
Settings.SaveChangesTitle="Apply settings?"
|
Settings.SaveChangesTitle="Apply settings?"
|
||||||
Settings.Video="Video"
|
Settings.Video="Video"
|
||||||
Settings.Hotkeys="Hotkeys"
|
Settings.Hotkeys="Hotkeys"
|
||||||
|
Settings.QSV="Quick Sync Encoder"
|
||||||
|
|
||||||
|
Settings.QSV.UseCustomParams="Use custom parameters"
|
||||||
|
Settings.QSV.RateControlMethod="Rate Control Method"
|
||||||
|
Settings.QSV.BitrateParameters="Parameters"
|
||||||
|
Settings.QSV.TargetKbps="TargetKbps:"
|
||||||
|
Settings.QSV.UseGlobalBitrate="Use global Max Bitrate"
|
||||||
|
Settings.QSV.MaxKbps="MaxKbps:"
|
||||||
|
Settings.QSV.BufferSizeInKB="BufferSizeInKB (1000 bytes):"
|
||||||
|
Settings.QSV.UseGlobalBufferSize="Use global Buffer Size"
|
||||||
|
Settings.QSV.Accuracy="Accuracy (%):"
|
||||||
|
Settings.QSV.Convergence="Convergence (100 frames):"
|
||||||
|
Settings.QSV.LookAheadDepth="Look-Ahead Depth:"
|
||||||
|
Settings.QSV.QPI="QPI:"
|
||||||
|
Settings.QSV.QPP="QPP:"
|
||||||
|
Settings.QSV.QPB="QPB:"
|
||||||
|
Settings.QSV.ICQQuality="ICQQuality:"
|
||||||
|
|
||||||
Settings.Hotkeys.Audio="Audio"
|
Settings.Hotkeys.Audio="Audio"
|
||||||
Settings.Hotkeys.Publish="Broadcast"
|
Settings.Hotkeys.Publish="Broadcast"
|
||||||
|
@ -426,6 +443,7 @@ Encoder.QSV.ExceededResolutionHelp="Either lower your output resolution in Setti
|
||||||
Encoder.QSV.SNBIVBMaximumResolutionWidthHeightExceeded="Your output resolution of %ux%u exceeds the maximum of 1920x1200 supported by Quick Sync on Sandy Bridge and Ivy Bridge based processors!\r\n"
|
Encoder.QSV.SNBIVBMaximumResolutionWidthHeightExceeded="Your output resolution of %ux%u exceeds the maximum of 1920x1200 supported by Quick Sync on Sandy Bridge and Ivy Bridge based processors!\r\n"
|
||||||
Encoder.QSV.SNBIVBMaximumResolutionWidthExceeded="Your output resolution width of %u exceeds the maximum of 1920 supported by Quick Sync on Sandy Bridge and Ivy Bridge based processors!\r\n"
|
Encoder.QSV.SNBIVBMaximumResolutionWidthExceeded="Your output resolution width of %u exceeds the maximum of 1920 supported by Quick Sync on Sandy Bridge and Ivy Bridge based processors!\r\n"
|
||||||
Encoder.QSV.SNBIVBMaximumResolutionHeightExceeded="Your output resolution height of %u exceeds the maximum of 1200 supported by Quick Sync on Sandy Bridge and Ivy Bridge based processors!\r\n"
|
Encoder.QSV.SNBIVBMaximumResolutionHeightExceeded="Your output resolution height of %u exceeds the maximum of 1200 supported by Quick Sync on Sandy Bridge and Ivy Bridge based processors!\r\n"
|
||||||
|
Encoder.QSV.InitCustomParamsFailed="Encoder initialization failed while custom parameters where active. Try enabling CBR or VBR in the Quick Sync Encoder settings."
|
||||||
|
|
||||||
Updater.DownloadNow="Would you like to download them now?"
|
Updater.DownloadNow="Would you like to download them now?"
|
||||||
Updater.NewUpdates="The following updates are available:\r\n\r\n"
|
Updater.NewUpdates="The following updates are available:\r\n\r\n"
|
||||||
|
|
Loading…
Reference in New Issue