Added option to choose between 8-Bit and 10-Bit encoding at runtime. We now include 8-Bit and 10-Bit builds in the distribution package.

This commit is contained in:
LoRd_MuldeR 2012-03-25 22:11:07 +02:00
parent 2c021cf3f1
commit b7acf86d6e
8 changed files with 116 additions and 35 deletions

View File

@ -10,7 +10,7 @@
<x>0</x>
<y>0</y>
<width>379</width>
<height>226</height>
<height>260</height>
</rect>
</property>
<property name="windowTitle">
@ -47,7 +47,7 @@
</property>
</widget>
</item>
<item row="1" column="0" rowspan="6">
<item row="1" column="0" rowspan="8">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -63,7 +63,7 @@
</property>
</spacer>
</item>
<item row="1" column="6" rowspan="6">
<item row="1" column="6" rowspan="8">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -89,7 +89,7 @@
<item row="1" column="1">
<widget class="QCheckBox" name="checkRunNextJob">
<property name="text">
<string/>
<string notr="true"/>
</property>
</widget>
</item>
@ -128,14 +128,14 @@
</property>
</widget>
</item>
<item row="4" column="1">
<item row="6" column="1">
<widget class="QCheckBox" name="checkUse64BitAvs2YUV">
<property name="toolTip">
<string>If this option is un-checked (default), then 32-Bit Avisynth will be used - even when using 64-Bit x264.
Please be aware that this option does NOT have any effect on 32-Bit systems.</string>
</property>
<property name="text">
<string/>
<string notr="true"/>
</property>
</widget>
</item>
@ -155,14 +155,14 @@ Please be aware that this option does NOT have any effect on 32-Bit systems.</st
</property>
</spacer>
</item>
<item row="6" column="1">
<item row="8" column="1">
<widget class="QCheckBox" name="checkShutdownComputer">
<property name="text">
<string/>
<string notr="true"/>
</property>
</widget>
</item>
<item row="6" column="2" colspan="4">
<item row="8" column="2" colspan="4">
<widget class="QLabel" name="labelShutdownComputer">
<property name="text">
<string>Shutdown computer as soon as the last job has completed</string>
@ -185,7 +185,7 @@ Please be aware that this option does NOT have any effect on 32-Bit systems.</st
</property>
</spacer>
</item>
<item row="7" column="1" colspan="5">
<item row="9" column="1" colspan="5">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -201,7 +201,7 @@ Please be aware that this option does NOT have any effect on 32-Bit systems.</st
</property>
</spacer>
</item>
<item row="4" column="2" colspan="4">
<item row="6" column="2" colspan="4">
<widget class="QLabel" name="labelUse64BitAvs2YUV">
<property name="toolTip">
<string>If this option is un-checked (default), then 32-Bit Avisynth will be used - even when using 64-Bit x264.
@ -212,7 +212,7 @@ Please be aware that this option does NOT have any effect on 32-Bit systems.</st
</property>
</widget>
</item>
<item row="5" column="2" colspan="4">
<item row="7" column="1" colspan="5">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -228,6 +228,36 @@ Please be aware that this option does NOT have any effect on 32-Bit systems.</st
</property>
</spacer>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="checkUse10BitEncoding">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="4" column="2" colspan="4">
<widget class="QLabel" name="labelUse10BitEncoding">
<property name="text">
<string>Use 10-Bit version of x264 → implies 'High 10' H.264 Profile</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="5">
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>

View File

@ -71,6 +71,8 @@ QMutex EncodeThread::m_mutex_startProcess;
} \
}
#define X264_BINARY(BIN_DIR, IS_10BIT, IS_X64) QString("%1/x264_%2_%3.exe").arg((BIN_DIR), ((IS_10BIT) ? "10bit" : "8bit"), ((IS_X64) ? "x64" : "x86"))
/*
* Static vars
*/
@ -80,7 +82,7 @@ static const unsigned int REV_MULT = 10000;
// Constructor & Destructor
///////////////////////////////////////////////////////////////////////////////
EncodeThread::EncodeThread(const QString &sourceFileName, const QString &outputFileName, const OptionsModel *options, const QString &binDir, bool x264_x64, bool avs2yuv_x64)
EncodeThread::EncodeThread(const QString &sourceFileName, const QString &outputFileName, const OptionsModel *options, const QString &binDir, bool x264_x64, bool x264_10bit, bool avs2yuv_x64)
:
m_jobId(QUuid::createUuid()),
m_sourceFileName(sourceFileName),
@ -88,6 +90,7 @@ EncodeThread::EncodeThread(const QString &sourceFileName, const QString &outputF
m_options(new OptionsModel(*options)),
m_binDir(binDir),
m_x264_x64(x264_x64),
m_x264_10bit(x264_10bit),
m_avs2yuv_x64(avs2yuv_x64),
m_handle_jobObject(NULL),
m_semaphorePaused(0)
@ -200,7 +203,7 @@ void EncodeThread::encode(void)
log(tr("\n--- CHECK VERSION ---\n"));
unsigned int revision_x264 = UINT_MAX;
bool x264_modified = false;
ok = ((revision_x264 = checkVersionX264(m_x264_x64, x264_modified)) != UINT_MAX);
ok = ((revision_x264 = checkVersionX264(m_x264_x64, m_x264_10bit, x264_modified)) != UINT_MAX);
CHECK_STATUS(m_abort, ok);
//Checking avs2yuv version
@ -259,17 +262,17 @@ void EncodeThread::encode(void)
}
log(tr("\n--- PASS 1 ---\n"));
ok = runEncodingPass(m_x264_x64, m_avs2yuv_x64, usePipe, frames, indexFile, 1, passLogFile);
ok = runEncodingPass(m_x264_x64, m_x264_10bit, m_avs2yuv_x64, usePipe, frames, indexFile, 1, passLogFile);
CHECK_STATUS(m_abort, ok);
log(tr("\n--- PASS 2 ---\n"));
ok = runEncodingPass(m_x264_x64, m_avs2yuv_x64, usePipe, frames, indexFile, 2, passLogFile);
ok = runEncodingPass(m_x264_x64, m_x264_10bit, m_avs2yuv_x64, usePipe, frames, indexFile, 2, passLogFile);
CHECK_STATUS(m_abort, ok);
}
else
{
log(tr("\n--- ENCODING ---\n"));
ok = runEncodingPass(m_x264_x64, m_avs2yuv_x64, usePipe, frames, indexFile);
ok = runEncodingPass(m_x264_x64, m_x264_10bit, m_avs2yuv_x64, usePipe, frames, indexFile);
CHECK_STATUS(m_abort, ok);
}
@ -280,7 +283,7 @@ void EncodeThread::encode(void)
setStatus(JobStatus_Completed);
}
bool EncodeThread::runEncodingPass(bool x264_x64, bool avs2yuv_x64, bool usePipe, unsigned int frames, const QString &indexFile, int pass, const QString &passLogFile)
bool EncodeThread::runEncodingPass(bool x264_x64, bool x264_10bit, bool avs2yuv_x64, bool usePipe, unsigned int frames, const QString &indexFile, int pass, const QString &passLogFile)
{
QProcess processEncode, processAvisynth;
@ -302,10 +305,10 @@ bool EncodeThread::runEncodingPass(bool x264_x64, bool avs2yuv_x64, bool usePipe
}
}
QStringList cmdLine_Encode = buildCommandLine(usePipe, frames, indexFile, pass, passLogFile);
QStringList cmdLine_Encode = buildCommandLine(usePipe, x264_10bit, frames, indexFile, pass, passLogFile);
log("Creating x264 process:");
if(!startProcess(processEncode, QString("%1/%2.exe").arg(m_binDir, x264_x64 ? "x264_x64" : "x264"), cmdLine_Encode))
if(!startProcess(processEncode, X264_BINARY(m_binDir, x264_10bit, x264_x64), cmdLine_Encode))
{
return false;
}
@ -510,7 +513,7 @@ bool EncodeThread::runEncodingPass(bool x264_x64, bool avs2yuv_x64, bool usePipe
return true;
}
QStringList EncodeThread::buildCommandLine(bool usePipe, unsigned int frames, const QString &indexFile, int pass, const QString &passLogFile)
QStringList EncodeThread::buildCommandLine(bool usePipe, bool use10Bit, unsigned int frames, const QString &indexFile, int pass, const QString &passLogFile)
{
QStringList cmdLine;
double crf_int = 0.0, crf_frc = 0.0;
@ -548,7 +551,21 @@ QStringList EncodeThread::buildCommandLine(bool usePipe, unsigned int frames, co
if(m_options->profile().compare("auto", Qt::CaseInsensitive))
{
cmdLine << "--profile" << m_options->profile().toLower();
if(use10Bit)
{
if(m_options->profile().compare("baseline", Qt::CaseInsensitive) || m_options->profile().compare("main", Qt::CaseInsensitive) || m_options->profile().compare("high", Qt::CaseInsensitive))
{
log(tr("WARNING: Selected H.264 Profile not compatible with 10-Bit encoding. Ignoring!\n"));
}
else
{
cmdLine << "--profile" << m_options->profile().toLower();
}
}
else
{
cmdLine << "--profile" << m_options->profile().toLower();
}
}
if(!m_options->customX264().isEmpty())
@ -574,13 +591,13 @@ QStringList EncodeThread::buildCommandLine(bool usePipe, unsigned int frames, co
return cmdLine;
}
unsigned int EncodeThread::checkVersionX264(bool x64, bool &modified)
unsigned int EncodeThread::checkVersionX264(bool use_x64, bool use_10bit, bool &modified)
{
QProcess process;
QStringList cmdLine = QStringList() << "--version";
log("Creating process:");
if(!startProcess(process, QString("%1/%2.exe").arg(m_binDir, x64 ? "x264_x64" : "x264"), cmdLine))
if(!startProcess(process, X264_BINARY(m_binDir, use_10bit, use_x64), cmdLine))
{
return false;;
}

View File

@ -53,7 +53,7 @@ public:
JobStatus_Undefined = 666
};
EncodeThread(const QString &sourceFileName, const QString &outputFileName, const OptionsModel *options, const QString &binDir, bool x264_x64, bool avs2yuv_x64);
EncodeThread(const QString &sourceFileName, const QString &outputFileName, const OptionsModel *options, const QString &binDir, bool x264_x64, bool x264_10bit, bool avs2yuv_x64);
~EncodeThread(void);
QUuid getId(void) { return this->m_jobId; };
@ -90,6 +90,7 @@ protected:
const OptionsModel *m_options;
const QString m_binDir;
const bool m_x264_x64;
const bool m_x264_10bit;
const bool m_avs2yuv_x64;
//Flags
@ -112,9 +113,9 @@ protected:
//Encode functions
void encode(void);
bool runEncodingPass(bool x264_x64, bool avs2yuv_x64, bool usePipe, unsigned int frames, const QString &indexFile, int pass = 0, const QString &passLogFile = QString());
QStringList buildCommandLine(bool usePipe, unsigned int frames, const QString &indexFile, int pass = 0, const QString &passLogFile = QString());
unsigned int checkVersionX264(bool x64, bool &modified);
bool runEncodingPass(bool x264_x64, bool x264_10bit, bool avs2yuv_x64, bool usePipe, unsigned int frames, const QString &indexFile, int pass = 0, const QString &passLogFile = QString());
QStringList buildCommandLine(bool usePipe, bool use10Bit, unsigned int frames, const QString &indexFile, int pass = 0, const QString &passLogFile = QString());
unsigned int checkVersionX264(bool use_x64, bool use_10bit, bool &modified);
unsigned int checkVersionAvs2yuv(bool x64);
bool checkProperties(bool x64, unsigned int &frames);

View File

@ -21,11 +21,11 @@
#define VER_X264_MAJOR 2
#define VER_X264_MINOR 0
#define VER_X264_PATCH 2
#define VER_X264_BUILD 275
#define VER_X264_PATCH 3
#define VER_X264_BUILD 291
#define VER_X264_MINIMUM_REV 2146
#define VER_X264_CURRENT_API 120
#define VER_X264_MINIMUM_REV 2164
#define VER_X264_CURRENT_API 122
#define VER_X264_AVS2YUV_VER 242
#define VER_X264_PRE_RELEASE (0)

View File

@ -227,6 +227,7 @@ void MainWindow::addButtonPressed(const QString &filePathIn, const QString &file
options ? options : m_options,
QString("%1/toolset").arg(m_appDir),
m_cpuFeatures->x64,
m_preferences.use10BitEncoding,
m_cpuFeatures->x64 && m_preferences.useAvisyth64Bit
);
@ -629,7 +630,7 @@ void MainWindow::shutdownComputer(void)
*/
void MainWindow::init(void)
{
static const char *binFiles = "x264.exe:x264_x64.exe:avs2yuv.exe:avs2yuv_x64.exe";
static const char *binFiles = "x264_8bit_x86.exe:x264_8bit_x64.exe:x264_10bit_x86.exe:x264_10bit_x64.exe:avs2yuv.exe:avs2yuv_x64.exe";
QStringList binaries = QString::fromLatin1(binFiles).split(":", QString::SkipEmptyParts);
updateLabelPos();

View File

@ -26,6 +26,7 @@
#include <QSettings>
#include <QDesktopServices>
#include <QMouseEvent>
#include <QMessageBox>
#define UPDATE_CHECKBOX(CHKBOX, VALUE) \
{ \
@ -43,10 +44,12 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Preferences *preferences,
setFixedSize(minimumSize());
labelRunNextJob->installEventFilter(this);
labelUse10BitEncoding->installEventFilter(this);
labelUse64BitAvs2YUV->installEventFilter(this);
labelShutdownComputer->installEventFilter(this);
connect(resetButton, SIGNAL(clicked()), this, SLOT(resetButtonPressed()));
connect(checkUse10BitEncoding, SIGNAL(toggled(bool)), this, SLOT(use10BitEncodingToggled(bool)));
m_preferences = preferences;
}
@ -62,7 +65,11 @@ void PreferencesDialog::showEvent(QShowEvent *event)
UPDATE_CHECKBOX(checkRunNextJob, m_preferences->autoRunNextJob);
UPDATE_CHECKBOX(checkShutdownComputer, m_preferences->shutdownComputer);
UPDATE_CHECKBOX(checkUse64BitAvs2YUV, m_preferences->useAvisyth64Bit);
checkUse10BitEncoding->blockSignals(true);
UPDATE_CHECKBOX(checkUse10BitEncoding, m_preferences->use10BitEncoding);
checkUse10BitEncoding->blockSignals(false);
spinBoxJobCount->setValue(m_preferences->maxRunningJobCount);
checkUse64BitAvs2YUV->setEnabled(m_x64);
@ -73,6 +80,7 @@ bool PreferencesDialog::eventFilter(QObject *o, QEvent *e)
{
emulateMouseEvent(o, e, labelRunNextJob, checkRunNextJob);
emulateMouseEvent(o, e, labelShutdownComputer, checkShutdownComputer);
emulateMouseEvent(o, e, labelUse10BitEncoding, checkUse10BitEncoding);
emulateMouseEvent(o, e, labelUse64BitAvs2YUV, checkUse64BitAvs2YUV);
return false;
}
@ -101,6 +109,7 @@ void PreferencesDialog::done(int n)
{
m_preferences->autoRunNextJob = checkRunNextJob->isChecked();
m_preferences->shutdownComputer = checkShutdownComputer->isChecked();
m_preferences->use10BitEncoding = checkUse10BitEncoding->isChecked();
m_preferences->useAvisyth64Bit = checkUse64BitAvs2YUV->isChecked();
m_preferences->maxRunningJobCount = spinBoxJobCount->value();
@ -114,6 +123,22 @@ void PreferencesDialog::resetButtonPressed(void)
showEvent(NULL);
}
void PreferencesDialog::use10BitEncodingToggled(bool checked)
{
if(checked)
{
QString text;
text += tr("<nobr>Please note that 10&minus;Bit H.264 streams are <b>not</b> currently supported by hardware (standalone) players!</nobr><br>");
text += tr("<nobr>To play such streams, you will need an <i>up&minus;to&minus;date</i> ffdshow&minus;tryouts, CoreAVC 3.x or another supported s/w decoder.</nobr><br>");
text += tr("<nobr>Also be aware that hardware&minus;acceleration (CUDA, DXVA, etc) usually will <b>not</b> work with 10&minus;Bit H.264 streams.</nobr><br>");
if(QMessageBox::warning(this, tr("10-Bit Encoding"), text, tr("Continue"), tr("Revert"), QString(), 1) != 0)
{
UPDATE_CHECKBOX(checkUse10BitEncoding, false);
}
}
}
///////////////////////////////////////////////////////////////////////////////
// Static Functions
///////////////////////////////////////////////////////////////////////////////
@ -125,6 +150,7 @@ void PreferencesDialog::initPreferences(Preferences *preferences)
preferences->autoRunNextJob = true;
preferences->maxRunningJobCount = 1;
preferences->shutdownComputer = false;
preferences->use10BitEncoding = false;
preferences->useAvisyth64Bit = false;
}
@ -140,6 +166,7 @@ void PreferencesDialog::loadPreferences(Preferences *preferences)
preferences->autoRunNextJob = settings.value("auto_run_next_job", QVariant(defaults.autoRunNextJob)).toBool();
preferences->maxRunningJobCount = qBound(1U, settings.value("max_running_job_count", QVariant(defaults.maxRunningJobCount)).toUInt(), 16U);
preferences->shutdownComputer = settings.value("shutdown_computer_on_completion", QVariant(defaults.shutdownComputer)).toBool();
preferences->use10BitEncoding = settings.value("use_10bit_encoding", QVariant(defaults.use10BitEncoding)).toBool();
preferences->useAvisyth64Bit = settings.value("use_64bit_avisynth", QVariant(defaults.useAvisyth64Bit)).toBool();
}
@ -152,6 +179,7 @@ void PreferencesDialog::savePreferences(Preferences *preferences)
settings.setValue("auto_run_next_job", preferences->autoRunNextJob);
settings.setValue("shutdown_computer_on_completion", preferences->shutdownComputer);
settings.setValue("max_running_job_count", preferences->maxRunningJobCount);
settings.setValue("use_10bit_encoding", preferences->use10BitEncoding);
settings.setValue("use_64bit_avisynth", preferences->useAvisyth64Bit);
settings.sync();
}

View File

@ -33,6 +33,7 @@ public:
bool autoRunNextJob;
unsigned int maxRunningJobCount;
bool shutdownComputer;
bool use10BitEncoding;
bool useAvisyth64Bit;
}
Preferences;
@ -58,4 +59,5 @@ private:
private slots:
void resetButtonPressed(void);
void use10BitEncodingToggled(bool checked);
};

View File

@ -104,7 +104,7 @@ REM ///////////////////////////////////////////////////////////////////////////
REM // Compress
REM ///////////////////////////////////////////////////////////////////////////
"%UPX3_PATH%\upx.exe" --brute "%PACK_PATH%\*.exe"
"%UPX3_PATH%\upx.exe" --best "%PACK_PATH%\*.dll"
"%UPX3_PATH%\upx.exe" --best "%PACK_PATH%\*.dll"
REM ///////////////////////////////////////////////////////////////////////////
REM // Attributes
@ -134,6 +134,7 @@ echo #Generated File - Do NOT modify! > "%NSI_FILE%"
echo !define ZIP2EXE_NAME `Simple x264 Launcher (%ISO_DATE%)` >> "%NSI_FILE%"
echo !define ZIP2EXE_OUTFILE `%OUT_FULL%` >> "%NSI_FILE%"
echo !define ZIP2EXE_COMPRESSOR_LZMA >> "%NSI_FILE%"
echo !define ZIP2EXE_COMPRESSOR_SOLID >> "%NSI_FILE%"
echo !define ZIP2EXE_INSTALLDIR `$PROGRAMFILES\MuldeR\Simple x264 Launcher v2` >> "%NSI_FILE%"
echo !define ZIP2EXE_REGPATH `SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{986E454F-DACA-4326-A9C7-3E46C0BFFDCE}` >> "%NSI_FILE%"
echo !define MUI_INSTFILESPAGE_COLORS "C5DEFB 000000" >> "%NSI_FILE%"
@ -142,6 +143,7 @@ echo ShowInstDetails show >> "%NSI_FILE%"
echo BrandingText `Created: %ISO_DATE%, %ISO_TIME% [Build #%BUILD_NO%]` >> "%NSI_FILE%"
echo InstallDirRegKey HKLM `${ZIP2EXE_REGPATH}` InstallLocation >> "%NSI_FILE%"
echo !include `${NSISDIR}\Contrib\zip2exe\Base.nsh` >> "%NSI_FILE%"
echo SetCompressorDictSize 96 >> "%NSI_FILE%"
echo !include `${NSISDIR}\Contrib\zip2exe\Modern.nsh` >> "%NSI_FILE%"
echo !include `%~dp0\etc\check_os.nsh` >> "%NSI_FILE%"
echo !include `%~dp0\etc\finalization.nsh` >> "%NSI_FILE%"