Added support for custom Avs2YUV parameters. Required to allow passing trough 4:2:2 (YV16) and 4:4:4 (YV24) data, as Avs2YUV converts to 4:2:0 (YV12) by default. YV16 and YV24 requires Avisynth 2.6!

This commit is contained in:
LoRd_MuldeR 2012-02-12 15:58:28 +01:00
parent 5025b163a9
commit e149f87ed8
8 changed files with 170 additions and 29 deletions

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>640</width>
<height>569</height>
<height>611</height>
</rect>
</property>
<property name="windowTitle">
@ -884,7 +884,7 @@
</spacer>
</item>
<item>
<widget class="QLabel" name="labelHelpScreen">
<widget class="QLabel" name="labelHelpScreenX264">
<property name="palette">
<palette>
<active>
@ -955,6 +955,100 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_11">
<property name="text">
<string>Custom Avs2YUV Parameters:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_11">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="labelHelpScreenAvs2YUV">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>120</red>
<green>120</green>
<blue>120</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<underline>true</underline>
</font>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="toolTip">
<string>Click here to show a detailed list of all command-line options available in your build of Avs2YUV!</string>
</property>
<property name="text">
<string>Show Help Screen</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLineEdit" name="editCustomAvs2YUVParams">
<property name="font">
<font>
<family>Lucida Console</family>
</font>
</property>
<property name="toolTip">
<string>All command-line parameters you enter here will be passed to Avs2YUV unmodified and unchecked. Only relevant for Avisynth input!</string>
</property>
<property name="placeholderText">
<string>You can enter custom command-line options here...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>

View File

@ -36,7 +36,7 @@ OptionsModel::OptionsModel(void)
m_preset = "Medium";
m_tune = "None";
m_profile = "Auto";
m_custom = "";
m_custom_x264 = "";
}
OptionsModel::~OptionsModel(void)
@ -75,7 +75,8 @@ bool OptionsModel::equals(OptionsModel *model)
if(this->m_preset.compare(model->m_preset, Qt::CaseInsensitive)) equal = false;
if(this->m_tune.compare(model->m_tune, Qt::CaseInsensitive)) equal = false;
if(this->m_profile.compare(model->m_profile, Qt::CaseInsensitive)) equal = false;
if(this->m_custom.compare(model->m_custom, Qt::CaseInsensitive)) equal = false;
if(this->m_custom_x264.compare(model->m_custom_x264, Qt::CaseInsensitive)) equal = false;
if(this->m_custom_avs2yuv.compare(model->m_custom_avs2yuv, Qt::CaseInsensitive)) equal = false;
return equal;
}
@ -99,7 +100,8 @@ bool OptionsModel::saveTemplate(OptionsModel *model, const QString &name)
settings.setValue("preset_name", model->m_preset);
settings.setValue("tuning_name", model->m_tune);
settings.setValue("profile_name", model->m_profile);
settings.setValue("custom_params", model->m_custom);
settings.setValue("custom_params_x264", model->m_custom_x264);
settings.setValue("custom_params_avs2yuv", model->m_custom_avs2yuv);
settings.endGroup();
settings.sync();
@ -126,7 +128,8 @@ bool OptionsModel::loadTemplate(OptionsModel *model, const QString &name)
if(!settings.contains("preset_name")) complete = false;
if(!settings.contains("tuning_name")) complete = false;
if(!settings.contains("profile_name")) complete = false;
if(!settings.contains("custom_params")) complete = false;
if(!settings.contains("custom_params_x264")) complete = false;
if(!settings.contains("custom_params_avs2yuv")) complete = false;
if(complete)
{
@ -136,7 +139,8 @@ bool OptionsModel::loadTemplate(OptionsModel *model, const QString &name)
model->setPreset(settings.value("preset_name", model->m_preset).toString());
model->setTune(settings.value("tuning_name", model->m_tune).toString());
model->setProfile(settings.value("profile_name", model->m_profile).toString());
model->setCustom(settings.value("custom_params", model->m_custom).toString());
model->setCustomX264(settings.value("custom_params_x264", model->m_custom_x264).toString());
model->setCustomAvs2YUV(settings.value("custom_params_avs2yuv", model->m_custom_avs2yuv).toString());
}
settings.endGroup();

View File

@ -46,7 +46,8 @@ public:
QString preset(void) const { return m_preset; }
QString tune(void) const { return m_tune; }
QString profile(void) const { return m_profile; }
QString custom(void) const { return m_custom; }
QString customX264(void) const { return m_custom_x264; }
QString customAvs2YUV(void) const { return m_custom_avs2yuv; }
//Setter
void setRCMode(RCMode mode) { m_rcMode = qBound(RCMode_CRF, mode, RCMode_ABR); }
@ -55,7 +56,8 @@ public:
void setPreset(const QString &preset) { m_preset = preset.trimmed(); }
void setTune(const QString &tune) { m_tune = tune.trimmed(); }
void setProfile(const QString &profile) { m_profile = profile.trimmed(); }
void setCustom(const QString &custom) { m_custom = custom.trimmed(); }
void setCustomX264(const QString &custom) { m_custom_x264 = custom.trimmed(); }
void setCustomAvs2YUV(const QString &custom) { m_custom_avs2yuv = custom.trimmed(); }
//Stuff
bool equals(OptionsModel *model);
@ -75,5 +77,6 @@ protected:
QString m_preset;
QString m_tune;
QString m_profile;
QString m_custom;
QString m_custom_x264;
QString m_custom_avs2yuv;
};

View File

@ -184,7 +184,7 @@ void EncodeThread::encode(void)
log(tr("Preset: %1").arg(m_options->preset()));
log(tr("Tuning: %1").arg(m_options->tune()));
log(tr("Profile: %1").arg(m_options->profile()));
log(tr("Custom: %1").arg(m_options->custom().isEmpty() ? tr("(None)") : m_options->custom()));
log(tr("Custom: %1").arg(m_options->customX264().isEmpty() ? tr("(None)") : m_options->customX264()));
bool ok = false;
unsigned int frames = 0;
@ -284,6 +284,10 @@ bool EncodeThread::runEncodingPass(bool x264_x64, bool avs2yuv_x64, bool usePipe
if(usePipe)
{
QStringList cmdLine_Avisynth;
if(!m_options->customAvs2YUV().isEmpty())
{
cmdLine_Avisynth.append(splitParams(m_options->customAvs2YUV()));
}
cmdLine_Avisynth << pathToLocal(QDir::toNativeSeparators(m_sourceFileName));
cmdLine_Avisynth << "-";
processAvisynth.setStandardOutputProcess(&processEncode);
@ -521,9 +525,9 @@ QStringList EncodeThread::buildCommandLine(bool usePipe, unsigned int frames, co
cmdLine << "--profile" << m_options->profile().toLower();
}
if(!m_options->custom().isEmpty())
if(!m_options->customX264().isEmpty())
{
cmdLine.append(splitParams(m_options->custom()));
cmdLine.append(splitParams(m_options->customX264()));
}
cmdLine << "--output" << pathToLocal(QDir::toNativeSeparators(m_outputFileName), true);
@ -744,8 +748,14 @@ unsigned int EncodeThread::checkVersionAvs2yuv(bool x64)
bool EncodeThread::checkProperties(bool x64, unsigned int &frames)
{
QProcess process;
QStringList cmdLine = QStringList() << "-frames" << "1";
QStringList cmdLine;
if(!m_options->customAvs2YUV().isEmpty())
{
cmdLine.append(splitParams(m_options->customAvs2YUV()));
}
cmdLine << "-frames" << "1";
cmdLine << pathToLocal(QDir::toNativeSeparators(m_sourceFileName)) << "NUL";
log("Creating process:");
@ -846,6 +856,10 @@ bool EncodeThread::checkProperties(bool x64, unsigned int &frames)
{
log(tr("\nWarning: It seems that %1-Bit Avisynth is not currently installed !!!").arg(x64 ? "64" : "32"));
}
if(text.contains(QRegExp("couldn't convert input clip to (YV16|YV24)", Qt::CaseInsensitive)))
{
log(tr("\nWarning: YV16 (4:2:2) and YV24 (4:4:4) color-spaces only supported in Avisynth 2.6 !!!"));
}
}
}
}

View File

@ -22,7 +22,7 @@
#define VER_X264_MAJOR 2
#define VER_X264_MINOR 0
#define VER_X264_PATCH 1
#define VER_X264_BUILD 126
#define VER_X264_BUILD 134
#define VER_X264_MINIMUM_REV 2146
#define VER_X264_CURRENT_API 120

View File

@ -174,7 +174,8 @@ AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *options, bool x64suppo
editCustomParams->clear();
//Install event filter
labelHelpScreen->installEventFilter(this);
labelHelpScreenX264->installEventFilter(this);
labelHelpScreenAvs2YUV->installEventFilter(this);
//Monitor for options changes
connect(cbxRateControlMode, SIGNAL(currentIndexChanged(int)), this, SLOT(configurationChanged()));
@ -237,9 +238,15 @@ void AddJobDialog::showEvent(QShowEvent *event)
bool AddJobDialog::eventFilter(QObject *o, QEvent *e)
{
if((o == labelHelpScreen) && (e->type() == QEvent::MouseButtonPress))
if((o == labelHelpScreenX264) && (e->type() == QEvent::MouseButtonPress))
{
HelpDialog *helpScreen = new HelpDialog(this, m_x64supported);
HelpDialog *helpScreen = new HelpDialog(this, false, m_x64supported);
helpScreen->exec();
X264_DELETE(helpScreen);
}
else if((o == labelHelpScreenAvs2YUV) && (e->type() == QEvent::MouseButtonPress))
{
HelpDialog *helpScreen = new HelpDialog(this, true, m_x64supported);
helpScreen->exec();
X264_DELETE(helpScreen);
}
@ -247,6 +254,10 @@ bool AddJobDialog::eventFilter(QObject *o, QEvent *e)
{
editCustomParams->setText(editCustomParams->text().simplified());
}
else if((o == editCustomAvs2YUVParams) && (e->type() == QEvent::FocusOut))
{
editCustomAvs2YUVParams->setText(editCustomAvs2YUVParams->text().simplified());
}
return false;
}
@ -659,7 +670,8 @@ void AddJobDialog::restoreOptions(OptionsModel *options)
updateComboBox(cbxPreset, options->preset());
updateComboBox(cbxTuning, options->tune());
updateComboBox(cbxProfile, options->profile());
editCustomParams->setText(options->custom());
editCustomParams->setText(options->customX264());
editCustomAvs2YUVParams->setText(options->customAvs2YUV());
cbxRateControlMode->blockSignals(false);
spinQuantizer->blockSignals(false);
@ -678,7 +690,8 @@ void AddJobDialog::saveOptions(OptionsModel *options)
options->setPreset(cbxPreset->model()->data(cbxPreset->model()->index(cbxPreset->currentIndex(), 0)).toString());
options->setTune(cbxTuning->model()->data(cbxTuning->model()->index(cbxTuning->currentIndex(), 0)).toString());
options->setProfile(cbxProfile->model()->data(cbxProfile->model()->index(cbxProfile->currentIndex(), 0)).toString());
options->setCustom(editCustomParams->hasAcceptableInput() ? editCustomParams->text().simplified() : QString());
options->setCustomX264(editCustomParams->hasAcceptableInput() ? editCustomParams->text().simplified() : QString());
options->setCustomAvs2YUV(editCustomAvs2YUVParams->text().simplified());
}
QString AddJobDialog::makeFileFilter(void)

View File

@ -30,10 +30,11 @@
// Constructor & Destructor
///////////////////////////////////////////////////////////////////////////////
HelpDialog::HelpDialog(QWidget *parent, bool x64supported)
HelpDialog::HelpDialog(QWidget *parent, bool avs2yuv, bool x64supported)
:
QDialog(parent),
m_appDir(QApplication::applicationDirPath()),
m_avs2yuv(avs2yuv),
m_x64supported(x64supported),
m_process(new QProcess())
{
@ -67,7 +68,15 @@ void HelpDialog::showEvent(QShowEvent *event)
QDialog::showEvent(event);
m_startAgain = true;
m_process->start(QString("%1/toolset/%2.exe").arg(m_appDir, m_x64supported ? "x264_x64" : "x264"), QStringList() << "--version");
if(!m_avs2yuv)
{
m_process->start(QString("%1/toolset/%2.exe").arg(m_appDir, m_x64supported ? "x264_x64" : "x264"), QStringList() << "--version");
}
else
{
m_process->start(QString("%1/toolset/%2.exe").arg(m_appDir, m_x64supported ? "avs2yuv_x64" : "avs2yuv"), QStringList());
}
if(!m_process->waitForStarted())
{
@ -109,12 +118,15 @@ void HelpDialog::finished(void)
if(m_startAgain)
{
m_startAgain = false;
m_process->start(QString("%1/toolset/x264.exe").arg(m_appDir), QStringList() << "--fullhelp");
plainTextEdit->appendPlainText("\n--------\n");
if(!m_process->waitForStarted())
if(!m_avs2yuv)
{
plainTextEdit->appendPlainText(tr("Failed to create x264 process :-("));
m_process->start(QString("%1/toolset/x264.exe").arg(m_appDir), QStringList() << "--fullhelp");
plainTextEdit->appendPlainText("\n--------\n");
if(!m_process->waitForStarted())
{
plainTextEdit->appendPlainText(tr("Failed to create x264 process :-("));
}
}
}
else

View File

@ -30,7 +30,7 @@ class HelpDialog : public QDialog, private Ui::HelpDialog
Q_OBJECT
public:
HelpDialog(QWidget *parent, bool x64supported);
HelpDialog(QWidget *parent, bool avs2yuv, bool x64supported);
~HelpDialog(void);
private slots:
@ -44,6 +44,7 @@ private:
bool m_startAgain;
protected:
const bool m_avs2yuv;
const bool m_x64supported;
virtual void showEvent(QShowEvent *event);