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> <item>
<widget class="QLabel" name="label_9"> <widget class="QLabel" name="label_9">
<property name="toolTip"> <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>
<property name="text"> <property name="text">
<string>Template:</string> <string>Template:</string>
@ -192,7 +192,7 @@
</size> </size>
</property> </property>
<property name="toolTip"> <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>
<property name="currentIndex"> <property name="currentIndex">
<number>-1</number> <number>-1</number>
@ -368,15 +368,15 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QSpinBox" name="spinQuantizer"> <widget class="QDoubleSpinBox" name="spinQuantizer">
<property name="toolTip"> <property name="decimals">
<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> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>52</number> <double>52.000000000000000</double>
</property> </property>
<property name="value"> <property name="value">
<number>22</number> <double>22.000000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
@ -422,7 +422,7 @@
<number>250000</number> <number>250000</number>
</property> </property>
<property name="value"> <property name="value">
<number>1200</number> <number>100</number>
</property> </property>
</widget> </widget>
</item> </item>
@ -1018,7 +1018,6 @@
<tabstop>buttonSaveTemplate</tabstop> <tabstop>buttonSaveTemplate</tabstop>
<tabstop>buttonDeleteTemplate</tabstop> <tabstop>buttonDeleteTemplate</tabstop>
<tabstop>cbxRateControlMode</tabstop> <tabstop>cbxRateControlMode</tabstop>
<tabstop>spinQuantizer</tabstop>
<tabstop>spinBitrate</tabstop> <tabstop>spinBitrate</tabstop>
<tabstop>cbxPreset</tabstop> <tabstop>cbxPreset</tabstop>
<tabstop>cbxTuning</tabstop> <tabstop>cbxTuning</tabstop>

View File

@ -129,7 +129,7 @@ QMap<QString, OptionsModel*> OptionsModel::loadAllTemplates(void)
OptionsModel *options = new OptionsModel(); OptionsModel *options = new OptionsModel();
options->setRCMode(static_cast<OptionsModel::RCMode>(settings.value("rate_control_mode", options->m_rcMode).toInt())); 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->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->setPreset(settings.value("preset_name", options->m_preset).toString());
options->setTune(settings.value("tuning_name", options->m_tune).toString()); options->setTune(settings.value("tuning_name", options->m_tune).toString());
options->setProfile(settings.value("profile_name", options->m_profile).toString()); options->setProfile(settings.value("profile_name", options->m_profile).toString());

View File

@ -42,7 +42,7 @@ public:
//Getter //Getter
RCMode rcMode(void) const { return m_rcMode; } RCMode rcMode(void) const { return m_rcMode; }
unsigned int bitrate(void) const { return m_bitrate; } 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 preset(void) const { return m_preset; }
QString tune(void) const { return m_tune; } QString tune(void) const { return m_tune; }
QString profile(void) const { return m_profile; } QString profile(void) const { return m_profile; }
@ -51,7 +51,7 @@ public:
//Setter //Setter
void setRCMode(RCMode mode) { m_rcMode = qBound(RCMode_CRF, mode, RCMode_ABR); } void setRCMode(RCMode mode) { m_rcMode = qBound(RCMode_CRF, mode, RCMode_ABR); }
void setBitrate(unsigned int bitrate) { m_bitrate = qBound(100U, bitrate, 250000U); } 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 setPreset(const QString &preset) { m_preset = preset.trimmed(); }
void setTune(const QString &tune) { m_tune = tune.trimmed(); } void setTune(const QString &tune) { m_tune = tune.trimmed(); }
void setProfile(const QString &profile) { m_profile = profile.trimmed(); } void setProfile(const QString &profile) { m_profile = profile.trimmed(); }
@ -70,7 +70,7 @@ public:
protected: protected:
RCMode m_rcMode; RCMode m_rcMode;
unsigned int m_bitrate; unsigned int m_bitrate;
unsigned int m_quantizer; double m_quantizer;
QString m_preset; QString m_preset;
QString m_tune; QString m_tune;
QString m_profile; 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 EncodeThread::buildCommandLine(bool usePipe, unsigned int frames, const QString &indexFile, int pass, const QString &passLogFile)
{ {
QStringList cmdLine; QStringList cmdLine;
double crf_int = 0.0, crf_frc = 0.0;
switch(m_options->rcMode()) switch(m_options->rcMode())
{ {
case OptionsModel::RCMode_CRF:
cmdLine << "--crf" << QString::number(m_options->quantizer());
break;
case OptionsModel::RCMode_CQ: 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; break;
case OptionsModel::RCMode_2Pass: case OptionsModel::RCMode_2Pass:
case OptionsModel::RCMode_ABR: case OptionsModel::RCMode_ABR:

View File

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

View File

@ -151,12 +151,13 @@ MainWindow::~MainWindow(void)
// Slots // 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; if(ok) *ok = false;
AddJobDialog *addDialog = new AddJobDialog(this, m_options, m_x64supported); AddJobDialog *addDialog = new AddJobDialog(this, m_options, m_x64supported);
addDialog->setRunImmediately(countRunningJobs() < (m_preferences.autoRunNextJob ? m_preferences.maxRunningJobCount : 1)); 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); if(!filePath.isEmpty()) addDialog->setSourceFile(filePath);
int result = addDialog->exec(); int result = addDialog->exec();
@ -654,13 +655,14 @@ void MainWindow::dropEvent(QDropEvent *event)
} }
droppedFiles.sort(); droppedFiles.sort();
int totalFiles = droppedFiles.count();
bool ok = true; bool ok = true; int n = 0;
while((!droppedFiles.isEmpty()) && ok) while((!droppedFiles.isEmpty()) && ok)
{ {
QString currentFile = droppedFiles.takeFirst(); QString currentFile = droppedFiles.takeFirst();
qDebug("Adding file: %s", currentFile.toUtf8().constData()); 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); unsigned int countRunningJobs(void);
private slots: 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 abortButtonPressed(void);
void browseButtonPressed(void); void browseButtonPressed(void);
void deleteButtonPressed(void); void deleteButtonPressed(void);

Binary file not shown.