* Windows XP with Service Pack 2 or any later Windows system – note that Windows XP is **not** recommended!
* 64-Bit editions of Windows are highly recommended, though 32-Bit editions will work as well
* The CPU must support at least the MMX and SSE instruction sets
-* Avisynth input only available with [Avisynth](http://avisynth.nl/index.php/Main_Page#Official_builds) **2.5+** installed – note that Avisynth **2.6** is recommended these days!
+* Avisynth input only available with [Avisynth](http://avisynth.nl/index.php/Main_Page#Official_builds) **2.6** installed – Avisynth **2.5.x** is *not* recommended!
* VapourSynth input only available with [VapourSynth](http://www.vapoursynth.com/) **r24+** installed – [Python](https://www.python.org/downloads/windows/) is a prerequisite for VapourSynth!
* YV16/YV24 color spaces require Avisynth 2.6 (see section 10)
//MUtils
#include <MUtils/Exception.h>
-/* --- Encooders --- */
-
-QString ENC_BINARY(const SysinfoModel *sysinfo, const OptionsModel::EncType &encType, const OptionsModel::EncArch &encArch, const OptionsModel::EncVariant &encVariant)
-{
- QString baseName, arch, variant;
-
- //Encoder Type
- switch(encType)
- {
- case OptionsModel::EncType_X264: baseName = "x264"; break;
- case OptionsModel::EncType_X265: baseName = "x265"; break;
- }
-
- //Architecture
- switch(encArch)
- {
- case OptionsModel::EncArch_x32: arch = "x86"; break;
- case OptionsModel::EncArch_x64: arch = "x64"; break;
- }
-
- //Encoder Variant
- switch(encVariant)
- {
- case OptionsModel::EncVariant_LoBit:
- switch(encType)
- {
- case OptionsModel::EncType_X264:
- case OptionsModel::EncType_X265: variant = "8bit"; break;
- }
- break;
- case OptionsModel::EncVariant_HiBit:
- switch(encType)
- {
- case OptionsModel::EncType_X264: variant = "10bit"; break;
- case OptionsModel::EncType_X265: variant = "16bit"; break;
- }
- break;
- }
-
- //Sanity check
- if(baseName.isEmpty() || arch.isEmpty() || variant.isEmpty())
- {
- MUTILS_THROW("Failed to determine the encoder binarty path!");
- }
-
- //Return path
- return QString("%1/toolset/%2/%3_%4_%2.exe").arg(sysinfo->getAppPath(), arch, baseName, variant);
-}
-
-QString ENC_BINARY(const SysinfoModel *sysinfo, const OptionsModel *options)
-{
- return ENC_BINARY(sysinfo, options->encType(), options->encArch(), options->encVariant());
-}
-
/* --- Avisynth --- */
QString AVS_BINARY(const SysinfoModel *sysinfo, const bool& x64)
class SysinfoModel;
class PreferencesModel;
-QString ENC_BINARY(const SysinfoModel *sysinfo, const OptionsModel *options);
-QString ENC_BINARY(const SysinfoModel *sysinfo, const OptionsModel::EncType &encType, const OptionsModel::EncArch &encArch, const OptionsModel::EncVariant &encVariant);
-
QString AVS_BINARY(const SysinfoModel *sysinfo, const bool &x64);
QString AVS_BINARY(const SysinfoModel *sysinfo, const PreferencesModel *preferences);
buildCommandLine(cmdLine_Encode, (pipedSource != NULL), frames, m_indexFile, pass, passLogFile);
log("Creating encoder process:");
- if(!startProcess(processEncode, ENC_BINARY(m_sysinfo, m_options), cmdLine_Encode))
+ if(!startProcess(processEncode, getBinaryPath(), cmdLine_Encode))
{
return false;
}
#pragma once
#include "tool_abstract.h"
+#include "model_options.h"
class QRegExp;
template<class T> class QList;
class AbstractEncoderInfo
{
public:
- virtual QString getVariantId(const int &variant) const = 0;
+ virtual QFlags<OptionsModel::EncVariant> getVariants(void) const = 0;
virtual QStringList getProfiles(const int &variant) const = 0;
- virtual QStringList getTunings(void) const = 0;
- virtual QStringList supportedOutputFormats(void) const = 0;
- virtual bool isRCModeSupported(const int rcMode) const = 0;
+ virtual QStringList getTunings(void) const = 0;
+ virtual QStringList supportedOutputFormats(void) const = 0;
+ virtual bool isRCModeSupported(const int rcMode) const = 0;
virtual bool isInputTypeSupported(const int format) const = 0;
+ virtual QString getBinaryPath(const SysinfoModel *sysinfo, const OptionsModel::EncArch &encArch, const OptionsModel::EncVariant &encVariant) const = 0;
};
class AbstractEncoder : public AbstractTool
#include "model_status.h"
#include "binaries.h"
#include "mediainfo.h"
+#include "model_sysinfo.h"
//MUtils
#include <MUtils/Exception.h>
#include <QRegExp>
//x264 version info
-static const unsigned int VERSION_X264_MINIMUM_REV = 2533;
-static const unsigned int VERSION_X264_CURRENT_API = 146;
+static const unsigned int VERSION_X264_MINIMUM_REV = 2555;
+static const unsigned int VERSION_X264_CURRENT_API = 148;
// ------------------------------------------------------------
// Helper Macros
} \
while(0)
-static QString MAKE_NAME(const char *baseName, const OptionsModel *options)
-{
- const QString arch = (options->encArch() == OptionsModel::EncArch_x64) ? "x64" : "x86";
- const QString vari = (options->encVariant() == OptionsModel::EncVariant_HiBit ) ? "10-Bit" : "8-Bit";
- return QString("%1, %2, %3").arg(QString::fromLatin1(baseName), arch, vari);
-}
-
// ------------------------------------------------------------
// Encoder Info
// ------------------------------------------------------------
class X264EncoderInfo : public AbstractEncoderInfo
{
public:
- virtual QString getVariantId(const int &variant) const
+ virtual QFlags<OptionsModel::EncVariant> getVariants(void) const
{
- switch(variant)
- {
- case OptionsModel::EncVariant_LoBit:
- return QString::fromLatin1("8-Bit");
- case OptionsModel::EncVariant_HiBit:
- return QString::fromLatin1("10-Bit");
- default:
- return QString::fromLatin1("N/A");
- }
+ QFlags<OptionsModel::EncVariant> variants;
+ variants |= OptionsModel::EncVariant_8Bit;
+ variants |= OptionsModel::EncVariant_10Bit;
+ return variants;
}
virtual QStringList getTunings(void) const
{
QStringList profiles;
- if(variant == OptionsModel::EncVariant_LoBit)
+ if(variant == OptionsModel::EncVariant_8Bit)
{
profiles << "Baseline" << "Main" << "High";
}
- if((variant == OptionsModel::EncVariant_LoBit) || (variant == OptionsModel::EncVariant_HiBit))
+ if((variant == OptionsModel::EncVariant_8Bit) || (variant == OptionsModel::EncVariant_10Bit))
{
profiles << "High10" << "High422" << "High444";
}
return false;
}
}
+
+ virtual QString getBinaryPath(const SysinfoModel *sysinfo, const OptionsModel::EncArch &encArch, const OptionsModel::EncVariant &encVariant) const
+ {
+ QString arch, variant;
+ switch(encArch)
+ {
+ case OptionsModel::EncArch_x86_32: arch = "x86"; break;
+ case OptionsModel::EncArch_x86_64: arch = "x64"; break;
+ default: MUTILS_THROW("Unknown encoder arch!");
+ }
+ switch(encVariant)
+ {
+ case OptionsModel::EncVariant_8Bit: variant = "8bit"; break;
+ case OptionsModel::EncVariant_10Bit: variant = "10bit"; break;
+ default: MUTILS_THROW("Unknown encoder arch!");
+ }
+ return QString("%1/toolset/%2/x264_%3_%2.exe").arg(sysinfo->getAppPath(), arch, variant);
+ }
};
static const X264EncoderInfo s_x264EncoderInfo;
X264Encoder::X264Encoder(JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobStatus &jobStatus, volatile bool *abort, volatile bool *pause, QSemaphore *semaphorePause, const QString &sourceFile, const QString &outputFile)
:
- AbstractEncoder(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile, outputFile),
- m_encoderName(MAKE_NAME("x264 (H.264/AVC)", m_options)),
- m_binaryFile(ENC_BINARY(sysinfo, options))
+ AbstractEncoder(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile, outputFile)
{
if(options->encType() != OptionsModel::EncType_X264)
{
/*Nothing to do here*/
}
-const QString &X264Encoder::getName(void)
+QString X264Encoder::getName(void) const
{
- return m_encoderName;
+ QString arch, variant;
+ switch(m_options->encArch())
+ {
+ case OptionsModel::EncArch_x86_32: arch = "x86"; break;
+ case OptionsModel::EncArch_x86_64: arch = "x64"; break;
+ default: MUTILS_THROW("Unknown encoder arch!");
+ }
+ switch(m_options->encVariant())
+ {
+ case OptionsModel::EncVariant_8Bit: variant = "8-Bit"; break;
+ case OptionsModel::EncVariant_10Bit: variant = "10-Bit"; break;
+ default: MUTILS_THROW("Unknown encoder arch!");
+ }
+ return QString("x264 (H.264/AVC), %1, %2").arg(arch, variant);
}
// ------------------------------------------------------------
X264Encoder(JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobStatus &jobStatus, volatile bool *abort, volatile bool *pause, QSemaphore *semaphorePause, const QString &sourceFile, const QString &outputFile);
virtual ~X264Encoder(void);
- virtual const QString &getName(void);
+ virtual QString getName(void) const;
virtual QString printVersion(const unsigned int &revision, const bool &modified);
virtual bool isVersionSupported(const unsigned int &revision, const bool &modified);
static const AbstractEncoderInfo& getEncoderInfo(void);
protected:
- virtual const QString &getBinaryPath() { return m_binaryFile; }
+ virtual QString getBinaryPath() const { return getEncoderInfo().getBinaryPath(m_sysinfo, m_options->encArch(), m_options->encVariant()); }
virtual void buildCommandLine(QStringList &cmdLine, const bool &usePipe, const unsigned int &frames, const QString &indexFile, const int &pass, const QString &passLogFile);
virtual void checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
virtual void runEncodingPass_init(QList<QRegExp*> &patterns);
virtual void runEncodingPass_parseLine(const QString &line, QList<QRegExp*> &patterns, const int &pass, double &last_progress, double &size_estimate);
- const QString m_encoderName;
- const QString m_binaryFile;
};
#include "model_status.h"
#include "binaries.h"
#include "mediainfo.h"
+#include "model_sysinfo.h"
//MUtils
#include <MUtils/Exception.h>
#include <QRegExp>
//x265 version info
-static const unsigned int VERSION_X265_MINIMUM_VER = 16;
-static const unsigned int VERSION_X265_MINIMUM_REV = 239;
+static const unsigned int VERSION_X265_MINIMUM_VER = 17;
+static const unsigned int VERSION_X265_MINIMUM_REV = 382;
// ------------------------------------------------------------
// Helper Macros
} \
while(0)
-static QString MAKE_NAME(const char *baseName, const OptionsModel *options)
-{
- const QString arch = (options->encArch() == OptionsModel::EncArch_x64) ? "x64" : "x86";
- const QString vari = (options->encVariant() == OptionsModel::EncVariant_HiBit ) ? "16-Bit" : "8-Bit";
- return QString("%1, %2, %3").arg(QString::fromLatin1(baseName), arch, vari);
-}
-
// ------------------------------------------------------------
// Encoder Info
// ------------------------------------------------------------
class X265EncoderInfo : public AbstractEncoderInfo
{
public:
- virtual QString getVariantId(const int &variant) const
+ virtual QFlags<OptionsModel::EncVariant> getVariants(void) const
{
- switch(variant)
- {
- case OptionsModel::EncVariant_LoBit:
- return QString::fromLatin1("8-Bit");
- case OptionsModel::EncVariant_HiBit:
- return QString::fromLatin1("16-Bit");
- default:
- return QString::fromLatin1("N/A");
- }
+ QFlags<OptionsModel::EncVariant> variants;
+ variants |= OptionsModel::EncVariant_8Bit;
+ variants |= OptionsModel::EncVariant_10Bit;
+ variants |= OptionsModel::EncVariant_12Bit;
+ return variants;
}
virtual QStringList getTunings(void) const
virtual QStringList getProfiles(const int &variant) const
{
- return QStringList();
+ QStringList profiles;
+ switch(variant)
+ {
+ case OptionsModel::EncVariant_8Bit:
+ profiles << "main" << "main-intra" << "mainstillpicture" << "main444-8" << "main444-intra" << "main444-stillpicture";
+ break;
+ case OptionsModel::EncVariant_10Bit:
+ profiles << "main10" << "main10-intra" << "main422-10" << "main422-10-intra" << "main444-10" << "main444-10-intra";
+ break;
+ case OptionsModel::EncVariant_12Bit:
+ profiles << "main12" << "main12-intra" << "main422-12" << "main422-12-intra" << "main444-12" << "main444-12-intra";
+ break;
+ }
+ return profiles;
}
virtual QStringList supportedOutputFormats(void) const
return false;
}
}
+
+ virtual QString getBinaryPath(const SysinfoModel *sysinfo, const OptionsModel::EncArch &encArch, const OptionsModel::EncVariant &encVariant) const
+ {
+ QString arch, variant;
+ switch(encArch)
+ {
+ case OptionsModel::EncArch_x86_32: arch = "x86"; break;
+ case OptionsModel::EncArch_x86_64: arch = "x64"; break;
+ default: MUTILS_THROW("Unknown encoder arch!");
+ }
+ switch(encVariant)
+ {
+ case OptionsModel::EncVariant_8Bit: variant = "8bit"; break;
+ case OptionsModel::EncVariant_10Bit: variant = "10bit"; break;
+ case OptionsModel::EncVariant_12Bit: variant = "12bit"; break;
+ default: MUTILS_THROW("Unknown encoder arch!");
+ }
+ return QString("%1/toolset/%2/x265_%3_%2.exe").arg(sysinfo->getAppPath(), arch, variant);
+ }
};
static const X265EncoderInfo s_x265EncoderInfo;
X265Encoder::X265Encoder(JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobStatus &jobStatus, volatile bool *abort, volatile bool *pause, QSemaphore *semaphorePause, const QString &sourceFile, const QString &outputFile)
:
- AbstractEncoder(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile, outputFile),
- m_encoderName(MAKE_NAME("x265 (H.265/HEVC)", m_options)),
- m_binaryFile(ENC_BINARY(sysinfo, options))
+ AbstractEncoder(jobObject, options, sysinfo, preferences, jobStatus, abort, pause, semaphorePause, sourceFile, outputFile)
{
if(options->encType() != OptionsModel::EncType_X265)
{
/*Nothing to do here*/
}
-const QString &X265Encoder::getName(void)
+QString X265Encoder::getName(void) const
{
- return m_encoderName;
+ QString arch, variant;
+ switch(m_options->encArch())
+ {
+ case OptionsModel::EncArch_x86_32: arch = "x86"; break;
+ case OptionsModel::EncArch_x86_64: arch = "x64"; break;
+ default: MUTILS_THROW("Unknown encoder arch!");
+ }
+ switch(m_options->encVariant())
+ {
+ case OptionsModel::EncVariant_8Bit: variant = "8-Bit"; break;
+ case OptionsModel::EncVariant_10Bit: variant = "10-Bit"; break;
+ case OptionsModel::EncVariant_12Bit: variant = "12-Bit"; break;
+ default: MUTILS_THROW("Unknown encoder arch!");
+ }
+ return QString("x265 (H.265/HEVC), %1, %2").arg(arch, variant);
}
// ------------------------------------------------------------
}
}
- if(m_options->profile().compare("auto", Qt::CaseInsensitive) != 0)
+ if(!m_options->profile().simplified().isEmpty())
{
- if((m_options->encType() == OptionsModel::EncType_X264) && (m_options->encVariant() == OptionsModel::EncVariant_LoBit))
+ if(m_options->profile().simplified().compare(QString::fromLatin1(OptionsModel::PROFILE_UNRESTRICTED), Qt::CaseInsensitive) != 0)
{
- cmdLine << "--profile" << m_options->profile().toLower();
+ cmdLine << "--profile" << m_options->profile().simplified().toLower();
}
}
X265Encoder(JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobStatus &jobStatus, volatile bool *abort, volatile bool *pause, QSemaphore *semaphorePause, const QString &sourceFile, const QString &outputFile);
virtual ~X265Encoder(void);
- virtual const QString &getName(void);
+ virtual QString getName(void) const;
virtual QString printVersion(const unsigned int &revision, const bool &modified);
virtual bool isVersionSupported(const unsigned int &revision, const bool &modified);
static const AbstractEncoderInfo& getEncoderInfo(void);
protected:
- virtual const QString &getBinaryPath() { return m_binaryFile; }
+ virtual QString getBinaryPath() const { return getEncoderInfo().getBinaryPath(m_sysinfo, m_options->encArch(), m_options->encVariant()); }
virtual void buildCommandLine(QStringList &cmdLine, const bool &usePipe, const unsigned int &frames, const QString &indexFile, const int &pass, const QString &passLogFile);
virtual void checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
virtual void runEncodingPass_init(QList<QRegExp*> &patterns);
virtual void runEncodingPass_parseLine(const QString &line, QList<QRegExp*> &patterns, const int &pass, double &last_progress, double &size_estimate);
-
- const QString m_encoderName;
- const QString m_binaryFile;
};
OptionsModel::OptionsModel(const SysinfoModel *sysinfo)
{
m_encoderType = EncType_X264;
- m_encoderArch = sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64) ? EncArch_x64 : EncArch_x32;
- m_encoderVariant = EncVariant_LoBit;
+ m_encoderArch = sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64) ? EncArch_x86_64 : EncArch_x86_32;
+ m_encoderVariant = EncVariant_8Bit;
m_rcMode = RCMode_CRF;
m_bitrate = 1200;
m_quantizer = 22;
if(!(settingsFile.contains(KEY_ENCODER_TYPE) || settingsFile.contains(KEY_ENCODER_ARCH) || settingsFile.contains(KEY_ENCODER_VARIANT)))
{
settingsFile.setValue(KEY_ENCODER_TYPE, OptionsModel::EncType_X264);
- settingsFile.setValue(KEY_ENCODER_ARCH, OptionsModel::EncArch_x32);
- settingsFile.setValue(KEY_ENCODER_VARIANT, OptionsModel::EncVariant_LoBit);
+ settingsFile.setValue(KEY_ENCODER_ARCH, OptionsModel::EncArch_x86_32);
+ settingsFile.setValue(KEY_ENCODER_VARIANT, OptionsModel::EncVariant_8Bit);
}
static const char *legacyKey[] = { "custom_params", "custom_params_x264", NULL };
{
EncType_X264 = 0,
EncType_X265 = 1,
+
+ EncType_MIN = EncType_X264,
+ EncType_MAX = EncType_X265,
};
enum EncArch
{
- EncArch_x32 = 0,
- EncArch_x64 = 1
+ EncArch_x86_32 = 0,
+ EncArch_x86_64 = 1,
+
+ EncArch_MIN = EncArch_x86_32,
+ EncArch_MAX = EncArch_x86_64
};
enum EncVariant
{
- EncVariant_LoBit = 0, // 8-Bit
- EncVariant_HiBit = 1, //10-Bit (x264) or 16-Bit (x265)
+ EncVariant_8Bit = 1,
+ EncVariant_10Bit = 2,
+ EncVariant_12Bit = 4,
+
+ EncVariant_MIN = EncVariant_8Bit,
+ EncVariant_MAX = EncVariant_12Bit
};
enum RCMode
{
- RCMode_CRF = 0,
- RCMode_CQ = 1,
+ RCMode_CRF = 0,
+ RCMode_CQ = 1,
RCMode_2Pass = 2,
- RCMode_ABR = 3,
+ RCMode_ABR = 3,
+
+ RCMode_MIN = RCMode_CRF,
+ RCMode_MAX = RCMode_ABR,
};
static const char *const TUNING_UNSPECIFIED;
//Setter
void setEncType(EncType type) { m_encoderType = qBound(EncType_X264, type, EncType_X265); }
- void setEncArch(EncArch arch) { m_encoderArch = qBound(EncArch_x32, arch, EncArch_x64); }
- void setEncVariant(EncVariant variant) { m_encoderVariant = qBound(EncVariant_LoBit, variant, EncVariant_HiBit); }
+ void setEncArch(EncArch arch) { m_encoderArch = qBound(EncArch_x86_32, arch, EncArch_x86_64); }
+ void setEncVariant(EncVariant variant) { m_encoderVariant = qBound(EncVariant_8Bit, variant, EncVariant_12Bit); }
void setRCMode(RCMode mode) { m_rcMode = qBound(RCMode_CRF, mode, RCMode_ABR); }
void setBitrate(unsigned int bitrate) { m_bitrate = qBound(10U, bitrate, 800000U); }
void setQuantizer(double quantizer) { m_quantizer = qBound(0.0, quantizer, 52.0); }
/*Nothing to do here*/
}
-const QString &AvisynthSource::getName(void)
+QString AvisynthSource::getName(void) const
{
return m_sourceName;
}
AvisynthSource(JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobStatus &jobStatus, volatile bool *abort, volatile bool *pause, QSemaphore *semaphorePause, const QString &sourceFile);
virtual ~AvisynthSource(void);
- virtual const QString &getName(void);
+ virtual QString getName(void) const;
virtual bool isSourceAvailable(void);
virtual QString printVersion(const unsigned int &revision, const bool &modified);
virtual void checkSourceProperties_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
virtual void checkSourceProperties_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &frames, unsigned int &fSizeW, unsigned int &fSizeH, unsigned int &fpsNom, unsigned int &fpsDen);
- virtual const QString &getBinaryPath() { return m_binaryFile; }
+
+ virtual QString getBinaryPath() const { return m_binaryFile; }
virtual void buildCommandLine(QStringList &cmdLine);
const QString m_sourceName;
/*Nothing to do here*/
}
-const QString &VapoursynthSource::getName(void)
+QString VapoursynthSource::getName(void) const
{
return m_sourceName;
}
VapoursynthSource(JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobStatus &jobStatus, volatile bool *abort, volatile bool *pause, QSemaphore *semaphorePause, const QString &sourceFile);
virtual ~VapoursynthSource(void);
- virtual const QString &getName(void);
+ virtual QString getName(void) const;
virtual bool isSourceAvailable(void);
virtual QString printVersion(const unsigned int &revision, const bool &modified);
virtual void checkSourceProperties_init(QList<QRegExp*> &patterns, QStringList &cmdLine);
virtual void checkSourceProperties_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &frames, unsigned int &fSizeW, unsigned int &fSizeH, unsigned int &fpsNom, unsigned int &fpsDen);
- virtual const QString &getBinaryPath() { return m_binaryFile; }
+ virtual QString getBinaryPath() const { return m_binaryFile; }
virtual void buildCommandLine(QStringList &cmdLine);
const QString m_sourceName;
#include "model_sysinfo.h"
#include "win_updater.h"
#include "binaries.h"
+#include "encoder_factory.h"
//MUtils
#include <MUtils/Global.h>
//Whatever
#define NEXT(X) ((*reinterpret_cast<int*>(&(X)))++)
+#define SHFL(X) ((*reinterpret_cast<int*>(&(X))) <<= 1)
//-------------------------------------
// External API
//Create list of all required binary files
QStringList binFiles;
- for(OptionsModel::EncArch arch = OptionsModel::EncArch_x32; arch <= OptionsModel::EncArch_x64; NEXT(arch))
+ for(OptionsModel::EncType encdr = OptionsModel::EncType_X264; encdr <= OptionsModel::EncType_X265; NEXT(encdr))
{
- for(OptionsModel::EncType encdr = OptionsModel::EncType_X264; encdr <= OptionsModel::EncType_X265; NEXT(encdr))
+ const AbstractEncoderInfo &encInfo = EncoderFactory::getEncoderInfo(encdr);
+ const QFlags<OptionsModel::EncVariant> variants = encInfo.getVariants();
+ for(OptionsModel::EncArch arch = OptionsModel::EncArch_x86_32; arch <= OptionsModel::EncArch_x86_64; NEXT(arch))
{
- for(OptionsModel::EncVariant varnt = OptionsModel::EncVariant_LoBit; varnt <= OptionsModel::EncVariant_HiBit; NEXT(varnt))
+ for(OptionsModel::EncVariant varnt = OptionsModel::EncVariant_MIN; varnt <= OptionsModel::EncVariant_MAX; SHFL(varnt))
{
- binFiles << ENC_BINARY(sysinfo, encdr, arch, varnt);
+ if(variants.testFlag(varnt))
+ {
+ binFiles << encInfo.getBinaryPath(sysinfo, arch, varnt);
+ }
}
}
- binFiles << AVS_BINARY(sysinfo, arch == OptionsModel::EncArch_x64);
- binFiles << CHK_BINARY(sysinfo, arch == OptionsModel::EncArch_x64);
+ }
+ for(OptionsModel::EncArch arch = OptionsModel::EncArch_x86_32; arch <= OptionsModel::EncArch_x86_64; NEXT(arch))
+ {
+ binFiles << AVS_BINARY(sysinfo, arch == OptionsModel::EncArch_x86_64);
+ binFiles << CHK_BINARY(sysinfo, arch == OptionsModel::EncArch_x86_64);
}
for(size_t i = 0; UpdaterDialog::BINARIES[i].name; i++)
{
if(!MUtils::OS::is_executable_file(file->fileName()))
{
success = false;
- qWarning("Required tool does NOT seem to be a valid Win32/Win64 binary:\n%s\n", MUTILS_UTF8(file->fileName()));
+ qWarning("Required tool does NOT look like a valid Win32/Win64 binary:\n%s\n", MUTILS_UTF8(file->fileName()));
return;
}
if(currentFile < MAX_BINARIES)
volatile bool m_success;
const SysinfoModel *const m_sysinfo;
- static const size_t MAX_BINARIES = 16;
+ static const size_t MAX_BINARIES = 32;
static QMutex m_binLock;
static QScopedPointer<QFile> m_binPath[MAX_BINARIES];
AbstractTool(JobObject *jobObject, const OptionsModel *options, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences, JobStatus &jobStatus, volatile bool *abort, volatile bool *pause, QSemaphore *semaphorePause);
virtual ~AbstractTool(void) {/*NOP*/}
- virtual const QString &getName(void) = 0;
+ virtual QString getName(void) const = 0;
virtual unsigned int checkVersion(bool &modified);
virtual bool isVersionSupported(const unsigned int &revision, const bool &modified) = 0;
static const unsigned int m_processTimeoutMaxCounter = 120;
static const unsigned int m_processTimeoutWarning = 24;
- virtual const QString &getBinaryPath(void) = 0;
+ virtual QString getBinaryPath(void) const = 0;
virtual void checkVersion_init(QList<QRegExp*> &patterns, QStringList &cmdLine) = 0;
virtual void checkVersion_parseLine(const QString &line, QList<QRegExp*> &patterns, unsigned int &core, unsigned int &build, bool &modified) = 0;
#endif
#define VER_X264_MAJOR 2
-#define VER_X264_MINOR 5
-#define VER_X264_PATCH 1
-#define VER_X264_BUILD 951
+#define VER_X264_MINOR 6
+#define VER_X264_PATCH 0
+#define VER_X264_BUILD 958
#define VER_X264_PORTABLE_EDITION (0)
//MUtils
#include <MUtils/Global.h>
+#include <MUtils/Exception.h>
//Qt
#include <QDate>
#define ARRAY_SIZE(ARRAY) (sizeof((ARRAY))/sizeof((ARRAY[0])))
#define VALID_DIR(PATH) ((!(PATH).isEmpty()) && QFileInfo(PATH).exists() && QFileInfo(PATH).isDir())
+#define SHFL(X) ((*reinterpret_cast<int*>(&(X))) <<= 1)
#define REMOVE_USAFED_ITEM \
{ \
WIDGET->addAction(_action); \
}
+static void setIndexByData(QComboBox *const box, const int &data)
+{
+ for(int i = 0; i < box->count(); i++)
+ {
+ if(box->itemData(i).toInt() == data)
+ {
+ box->setCurrentIndex(i);
+ break;
+ }
+ }
+}
+
Q_DECLARE_METATYPE(const void*)
///////////////////////////////////////////////////////////////////////////////
const AbstractEncoderInfo &encoderInfo = EncoderFactory::getEncoderInfo(ui->cbxEncoderType->currentIndex());
//Update encoder variants
- ui->cbxEncoderVariant->setItemText(OptionsModel::EncVariant_LoBit, encoderInfo.getVariantId(OptionsModel::EncVariant_LoBit));
- ui->cbxEncoderVariant->setItemText(OptionsModel::EncVariant_HiBit, encoderInfo.getVariantId(OptionsModel::EncVariant_HiBit));
+ const QFlags<OptionsModel::EncVariant> variants = encoderInfo.getVariants();
+ ui->cbxEncoderVariant->clear();
+ for(OptionsModel::EncVariant varnt = OptionsModel::EncVariant_MIN; varnt <= OptionsModel::EncVariant_MAX; SHFL(varnt))
+ {
+ if(variants.testFlag(varnt))
+ {
+ QString varntText;
+ switch(varnt)
+ {
+ case OptionsModel::EncVariant_8Bit: varntText = tr("8-Bit"); break;
+ case OptionsModel::EncVariant_10Bit: varntText = tr("10-Bit"); break;
+ case OptionsModel::EncVariant_12Bit: varntText = tr("12-Bit"); break;
+ default: MUTILS_THROW("Bad encoder variant!");
+ }
+ ui->cbxEncoderVariant->addItem(varntText, QVariant(varnt));
+ }
+ }
//Update tunings
QStringList tunings = encoderInfo.getTunings();
void AddJobDialog::accept(void)
{
//Check 64-Bit support
- if((ui->cbxEncoderArch->currentIndex() == OptionsModel::EncArch_x64) && (!m_sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64)))
+ if((ui->cbxEncoderArch->currentIndex() == OptionsModel::EncArch_x86_64) && (!m_sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64)))
{
QMessageBox::warning(this, tr("64-Bit unsupported!"), tr("<nobr>Sorry, this computer does <b>not</b> support 64-Bit encoders!</nobr>"));
- ui->cbxEncoderArch->setCurrentIndex(OptionsModel::EncArch_x32);
+ ui->cbxEncoderArch->setCurrentIndex(OptionsModel::EncArch_x86_32);
return;
}
//Ignore config changes while restoring template!
m_monitorConfigChanges = false;
- ui->cbxEncoderType ->setCurrentIndex(options->encType());
- ui->cbxEncoderArch ->setCurrentIndex(options->encArch());
- ui->cbxEncoderVariant ->setCurrentIndex(options->encVariant());
- ui->cbxRateControlMode->setCurrentIndex(options->rcMode());
+ ui->cbxEncoderType ->setCurrentIndex(options->encType());
+ ui->cbxEncoderArch ->setCurrentIndex(options->encArch());
+ setIndexByData(ui->cbxEncoderVariant, options->encVariant());
+ ui->cbxRateControlMode -> setCurrentIndex(options->rcMode());
ui->spinQuantizer->setValue(options->quantizer());
ui->spinBitrate ->setValue(options->bitrate());
{
options->setEncType(static_cast<OptionsModel::EncType>(ui->cbxEncoderType->currentIndex()));
options->setEncArch(static_cast<OptionsModel::EncArch>(ui->cbxEncoderArch->currentIndex()));
- options->setEncVariant(static_cast<OptionsModel::EncVariant>(ui->cbxEncoderVariant->currentIndex()));
+ options->setEncVariant(static_cast<OptionsModel::EncVariant>(ui->cbxEncoderVariant->itemData(ui->cbxEncoderVariant->currentIndex()).toInt()));
options->setRCMode(static_cast<OptionsModel::RCMode>(ui->cbxRateControlMode->currentIndex()));
options->setQuantizer(ui->spinQuantizer->value());
filters << QString("All files (*.*)");
return filters.join(";;");
}
+
+
#include "global.h"
#include "model_options.h"
#include "binaries.h"
+#include "encoder_factory.h"
//MUtils
#include <MUtils/Sound.h>
if(!m_avs2yuv)
{
- m_process->start(ENC_BINARY(m_sysinfo, m_options), QStringList() << "--version");
+ m_process->start(EncoderFactory::getEncoderInfo(m_options->encType()).getBinaryPath(m_sysinfo, m_options->encArch(), m_options->encVariant()), QStringList() << "--version");
}
else
{
m_startAgain = false;
if(!m_avs2yuv)
{
- m_process->start(ENC_BINARY(m_sysinfo, m_options), QStringList() << "--fullhelp");
+ m_process->start(EncoderFactory::getEncoderInfo(m_options->encType()).getBinaryPath(m_sysinfo, m_options->encArch(), m_options->encVariant()), QStringList() << "--fullhelp");
ui->plainTextEdit->appendPlainText("\n--------\n");
if(!m_process->waitForStarted())
qDebug("[Validating binaries]");
if(!BinariesCheckThread::check(m_sysinfo.data()))
{
- QMessageBox::critical(this, tr("Invalid File!"), tr("<nobr>At least one required tool is missing or is not a valid Win32/Win64 binary.<br>Please re-install the program in order to fix the problem!</nobr>").replace("-", "−"));
- qFatal("At least one required tool is missing or is not a valid Win32/Win64 binary!");
+ QMessageBox::critical(this, tr("Invalid File!"), tr("<nobr>At least one tool is missing or is not a valid Win32/Win64 binary.<br>Please re-install the program in order to fix the problem!</nobr>").replace("-", "−"));
+ qFatal("At least one tool is missing or is not a valid Win32/Win64 binary!");
}
qDebug(" ");
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalLibraryDirectories>$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Debug\lib;$(SolutionDir)\..\Prerequisites\VisualLeakDetector\lib\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalLibraryDirectories>$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Debug\lib;$(SolutionDir)\..\Prerequisites\VisualLeakDetector\lib\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>QtCored4.lib;QtGuid4.lib;Winmm.lib;Psapi.lib;SensAPI.lib;%(AdditionalDependencies)</AdditionalDependencies>
<EntryPointSymbol>x264_entry_point</EntryPointSymbol>
</Link>
copy /Y "$(SolutionDir)res\toolset\common\*.gpg" "$(TargetDir)\toolset\common\"
for %%i in (QtCored4, QtGuid4, QtSvgd4, QtXmld4) do (
- copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Debug\bin\%%i.dll" "$(TargetDir)"
- copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Debug\bin\%%i.pdb" "$(TargetDir)"
+ copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Debug\bin\%%i.dll" "$(TargetDir)"
+ copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Debug\bin\%%i.pdb" "$(TargetDir)"
)
for %%i in (qicod4, qsvgd4, qjpegd4, qtiffd4, qgifd4) do (
- copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Debug\plugins\imageformats\%%i.dll" "$(TargetDir)\imageformats"
- copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Debug\plugins\imageformats\%%i.pdb" "$(TargetDir)\imageformats"
+ copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Debug\plugins\imageformats\%%i.dll" "$(TargetDir)\imageformats"
+ copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Debug\plugins\imageformats\%%i.pdb" "$(TargetDir)\imageformats"
)
copy /Y "$(SolutionDir)\..\Prerequisites\VisualLeakDetector\bin\$(Platform)\*.dll" "$(TargetDir)"
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
- <AdditionalLibraryDirectories>$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalLibraryDirectories>$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>QtCore4.lib;QtGui4.lib;Winmm.lib;dwmapi.lib;Psapi.lib;SensAPI.lib;%(AdditionalDependencies)</AdditionalDependencies>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
copy /Y "$(SolutionDir)res\toolset\common\*.exe" "$(TargetDir)\toolset\common\"
copy /Y "$(SolutionDir)res\toolset\common\*.gpg" "$(TargetDir)\toolset\common\"
-copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\bin\QtCore4.dll" "$(TargetDir)"
-copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\bin\QtGui4.dll" "$(TargetDir)"
-copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\bin\QtSvg4.dll" "$(TargetDir)"
-copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\bin\QtXml4.dll" "$(TargetDir)"
-copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\plugins\imageformats\qico4.dll" "$(TargetDir)\imageformats"
-copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\plugins\imageformats\qsvg4.dll" "$(TargetDir)\imageformats"
-copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\plugins\imageformats\qjpeg4.dll" "$(TargetDir)\imageformats"
-copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\plugins\imageformats\qtiff4.dll" "$(TargetDir)\imageformats"
-copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\MSVC-2013\Shared\plugins\imageformats\qgif4.dll" "$(TargetDir)\imageformats"
+copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\bin\QtCore4.dll" "$(TargetDir)"
+copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\bin\QtGui4.dll" "$(TargetDir)"
+copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\bin\QtSvg4.dll" "$(TargetDir)"
+copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\bin\QtXml4.dll" "$(TargetDir)"
+copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\imageformats\qico4.dll" "$(TargetDir)\imageformats"
+copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\imageformats\qsvg4.dll" "$(TargetDir)\imageformats"
+copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\imageformats\qjpeg4.dll" "$(TargetDir)\imageformats"
+copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\imageformats\qtiff4.dll" "$(TargetDir)\imageformats"
+copy /Y "$(ProjectDir)\..\Prerequisites\Qt4\$(PlatformToolset)\Shared\plugins\imageformats\qgif4.dll" "$(TargetDir)\imageformats"
</Command>
<Message>Copy Toolset</Message>
</PostBuildEvent>
set "NSIS_PATH=C:\Program Files\NSIS\Unicode"
set "UPX3_PATH=C:\Program Files\UPX"
set "PDOC_PATH=C:\Program Files\Pandoc"
+set "TOOLS_VER=120"
REM ###############################################
REM # DO NOT MODIFY ANY LINES BELOW THIS LINE !!! #
REM ///////////////////////////////////////////////////////////////////////////
REM // Copy dependencies
REM ///////////////////////////////////////////////////////////////////////////
-for %%i in (100, 110, 120) do (
- if exist "%MSVC_PATH%\redist\x86\Microsoft.VC%%i.CRT\*.dll" (
- copy "%MSVC_PATH%\redist\x86\Microsoft.VC%%i.CRT\msvc?%%i.dll" "%PACK_PATH%"
- )
-)
-copy "%~dp0\..\Prerequisites\Qt4\MSVC-2013\Shared\bin\QtCore4.dll" "%PACK_PATH%"
-copy "%~dp0\..\Prerequisites\Qt4\MSVC-2013\Shared\bin\QtGui4.dll" "%PACK_PATH%"
-copy "%~dp0\..\Prerequisites\Qt4\MSVC-2013\Shared\bin\QtSvg4.dll" "%PACK_PATH%"
-copy "%~dp0\..\Prerequisites\Qt4\MSVC-2013\Shared\bin\QtXml4.dll" "%PACK_PATH%"
-copy "%~dp0\..\Prerequisites\Qt4\MSVC-2013\Shared\bin\QtXml4.dll" "%PACK_PATH%"
-copy "%~dp0\..\Prerequisites\Qt4\MSVC-2013\Shared\plugins\imageformats\*.dll" "%PACK_PATH%\imageformats"
+copy "%MSVC_PATH%\redist\x86\Microsoft.VC%TOOLS_VER%.CRT\*.dll" "%PACK_PATH%"
+copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtCore4.dll" "%PACK_PATH%"
+copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtGui4.dll" "%PACK_PATH%"
+copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtSvg4.dll" "%PACK_PATH%"
+copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtXml4.dll" "%PACK_PATH%"
+copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\bin\QtXml4.dll" "%PACK_PATH%"
+copy "%~dp0\..\Prerequisites\Qt4\v%TOOLS_VER%_xp\Shared\plugins\imageformats\*.dll" "%PACK_PATH%\imageformats"
del "%PACK_PATH%\imageformats\*d4.dll" 2> NUL
REM ///////////////////////////////////////////////////////////////////////////