Added support for fractional CRF values. In CQ mode the quantizer will be rounded to the next int value. Also cleaned-up resource file.

This commit is contained in:
LoRd_MuldeR 2012-02-04 15:56:38 +01:00
parent 4663c724ef
commit fa9488fb78
8 changed files with 25 additions and 22 deletions

View File

@ -170,7 +170,7 @@
<item>
<widget class="QLabel" name="label_9">
<property name="toolTip">
<string>Here you can load a user-defined template that you have saved before. Use the &quot;Save&quot; button to save your current configuration to a new profile.</string>
<string>Here you can load a user-defined template that you have saved before. Use the &quot;Save As&quot; button to save your current configuration to a new profile.</string>
</property>
<property name="text">
<string>Template:</string>
@ -192,7 +192,7 @@
</size>
</property>
<property name="toolTip">
<string>Here you can load a user-defined template that you have saved before. Use the &quot;Save&quot; button to save your current configuration to a new profile.</string>
<string>Here you can load a user-defined template that you have saved before. Use the &quot;Save As&quot; button to save your current configuration to a new profile.</string>
</property>
<property name="currentIndex">
<number>-1</number>
@ -368,15 +368,15 @@
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinQuantizer">
<property name="toolTip">
<string>Select the quantizer or CRF value. Smaller value means better quality, but bigger file. Higher value means smaller file, but lower quality. A value of '0' triggers lossless mode.</string>
<widget class="QDoubleSpinBox" name="spinQuantizer">
<property name="decimals">
<number>1</number>
</property>
<property name="maximum">
<number>52</number>
<double>52.000000000000000</double>
</property>
<property name="value">
<number>22</number>
<double>22.000000000000000</double>
</property>
</widget>
</item>
@ -422,7 +422,7 @@
<number>250000</number>
</property>
<property name="value">
<number>1200</number>
<number>100</number>
</property>
</widget>
</item>
@ -1018,7 +1018,6 @@
<tabstop>buttonSaveTemplate</tabstop>
<tabstop>buttonDeleteTemplate</tabstop>
<tabstop>cbxRateControlMode</tabstop>
<tabstop>spinQuantizer</tabstop>
<tabstop>spinBitrate</tabstop>
<tabstop>cbxPreset</tabstop>
<tabstop>cbxTuning</tabstop>

View File

@ -129,7 +129,7 @@ QMap<QString, OptionsModel*> OptionsModel::loadAllTemplates(void)
OptionsModel *options = new OptionsModel();
options->setRCMode(static_cast<OptionsModel::RCMode>(settings.value("rate_control_mode", options->m_rcMode).toInt()));
options->setBitrate(settings.value("target_bitrate", options->m_bitrate).toUInt());
options->setQuantizer(settings.value("target_quantizer", options->m_quantizer).toUInt());
options->setQuantizer(settings.value("target_quantizer", options->m_quantizer).toDouble());
options->setPreset(settings.value("preset_name", options->m_preset).toString());
options->setTune(settings.value("tuning_name", options->m_tune).toString());
options->setProfile(settings.value("profile_name", options->m_profile).toString());

View File

@ -42,7 +42,7 @@ public:
//Getter
RCMode rcMode(void) const { return m_rcMode; }
unsigned int bitrate(void) const { return m_bitrate; }
unsigned int quantizer(void) const { return m_quantizer; }
double quantizer(void) const { return m_quantizer; }
QString preset(void) const { return m_preset; }
QString tune(void) const { return m_tune; }
QString profile(void) const { return m_profile; }
@ -51,7 +51,7 @@ public:
//Setter
void setRCMode(RCMode mode) { m_rcMode = qBound(RCMode_CRF, mode, RCMode_ABR); }
void setBitrate(unsigned int bitrate) { m_bitrate = qBound(100U, bitrate, 250000U); }
void setQuantizer(unsigned int quantizer) { m_quantizer = qBound(0U, quantizer, 52U); }
void setQuantizer(double quantizer) { m_quantizer = qBound(0.0, quantizer, 52.0); }
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(); }
@ -70,7 +70,7 @@ public:
protected:
RCMode m_rcMode;
unsigned int m_bitrate;
unsigned int m_quantizer;
double m_quantizer;
QString m_preset;
QString m_tune;
QString m_profile;

View File

@ -465,14 +465,16 @@ bool EncodeThread::runEncodingPass(bool x64, bool usePipe, unsigned int frames,
QStringList EncodeThread::buildCommandLine(bool usePipe, unsigned int frames, const QString &indexFile, int pass, const QString &passLogFile)
{
QStringList cmdLine;
double crf_int = 0.0, crf_frc = 0.0;
switch(m_options->rcMode())
{
case OptionsModel::RCMode_CRF:
cmdLine << "--crf" << QString::number(m_options->quantizer());
break;
case OptionsModel::RCMode_CQ:
cmdLine << "--qp" << QString::number(m_options->quantizer());
cmdLine << "--qp" << QString::number(qRound(m_options->quantizer()));
break;
case OptionsModel::RCMode_CRF:
crf_frc = modf(m_options->quantizer(), &crf_int);
cmdLine << "--crf" << QString("%1.%2").arg(QString::number(qRound(crf_int)), QString::number(qRound(crf_frc * 10.0)));
break;
case OptionsModel::RCMode_2Pass:
case OptionsModel::RCMode_ABR:

View File

@ -166,7 +166,7 @@ AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *options, bool x64suppo
//Monitor for options changes
connect(cbxRateControlMode, SIGNAL(currentIndexChanged(int)), this, SLOT(configurationChanged()));
connect(spinQuantizer, SIGNAL(valueChanged(int)), this, SLOT(configurationChanged()));
connect(spinQuantizer, SIGNAL(valueChanged(double)), this, SLOT(configurationChanged()));
connect(spinBitrate, SIGNAL(valueChanged(int)), this, SLOT(configurationChanged()));
connect(cbxPreset, SIGNAL(currentIndexChanged(int)), this, SLOT(configurationChanged()));
connect(cbxTuning, SIGNAL(currentIndexChanged(int)), this, SLOT(configurationChanged()));

View File

@ -151,12 +151,13 @@ MainWindow::~MainWindow(void)
// Slots
///////////////////////////////////////////////////////////////////////////////
void MainWindow::addButtonPressed(const QString &filePath, bool *ok)
void MainWindow::addButtonPressed(const QString &filePath, int fileNo, int fileTotal, bool *ok)
{
if(ok) *ok = false;
AddJobDialog *addDialog = new AddJobDialog(this, m_options, m_x64supported);
addDialog->setRunImmediately(countRunningJobs() < (m_preferences.autoRunNextJob ? m_preferences.maxRunningJobCount : 1));
if((fileNo >= 0) && (fileTotal > 1)) addDialog->setWindowTitle(addDialog->windowTitle().append(tr(" (File %1 of %2)").arg(QString::number(fileNo+1), QString::number(fileTotal))));
if(!filePath.isEmpty()) addDialog->setSourceFile(filePath);
int result = addDialog->exec();
@ -654,13 +655,14 @@ void MainWindow::dropEvent(QDropEvent *event)
}
droppedFiles.sort();
int totalFiles = droppedFiles.count();
bool ok = true;
bool ok = true; int n = 0;
while((!droppedFiles.isEmpty()) && ok)
{
QString currentFile = droppedFiles.takeFirst();
qDebug("Adding file: %s", currentFile.toUtf8().constData());
addButtonPressed(currentFile, &ok);
addButtonPressed(currentFile, n++, totalFiles, &ok);
}
}

View File

@ -63,7 +63,7 @@ private:
unsigned int countRunningJobs(void);
private slots:
void addButtonPressed(const QString &filePath = QString(), bool *ok = NULL);
void addButtonPressed(const QString &filePath = QString(), int fileNo = 0, int fileTotal = 0, bool *ok = NULL);
void abortButtonPressed(void);
void browseButtonPressed(void);
void deleteButtonPressed(void);

Binary file not shown.