Exemple #1
0
QString X264Encoder::getName(void) const
{
	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);
}
Exemple #2
0
void AbstractEncoder::setSamplingRate(const int &value)
{
	if (!toEncoderInfo()->isResamplingSupported())
	{
		MUTILS_THROW("This encoder does *not* support native resampling!");
	}
	m_configSamplingRate = qBound(0, value, 48000);
};
	Blake2_Context(void)
	{
		if(!(state = (MUtils::Hash::Internal::Blake2Impl::blake2b_state*) _aligned_malloc(sizeof(MUtils::Hash::Internal::Blake2Impl::blake2b_state), HASH_SIZE)))
		{
			MUTILS_THROW("Aligend malloc has failed!");
		}
		memset(state, 0, sizeof(MUtils::Hash::Internal::Blake2Impl::blake2b_state));
	}
Exemple #4
0
	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);
	}
bool MUtils::Hash::Blake2::process(const quint8 *const data, const quint32 len)
{
	if(m_finalized)
	{
		MUTILS_THROW("BLAKE2 was already finalized!");
	}

	if(data && (len > 0))
	{
		if(blake2b_update(m_context->state, data, len) != 0)
		{
			MUTILS_THROW("BLAKE2 internal error!");
		}
	}

	return true;
}
void InitializationThread::selfTest(void)
{
	const unsigned int cpu[4] = {CPU_TYPE_X86_GEN, CPU_TYPE_X86_SSE, CPU_TYPE_X64_GEN, CPU_TYPE_X64_SSE};

	LockedFile::selfTest();

	for(size_t k = 0; k < 4; k++)
	{
		qDebug("[TEST]");
		switch(cpu[k])
		{
			PRINT_CPU_TYPE(CPU_TYPE_X86_GEN); break;
			PRINT_CPU_TYPE(CPU_TYPE_X86_SSE); break;
			PRINT_CPU_TYPE(CPU_TYPE_X64_GEN); break;
			PRINT_CPU_TYPE(CPU_TYPE_X64_SSE); break;
			default: MUTILS_THROW("CPU support undefined!");
		}
		unsigned int n = 0;
		for(int i = 0; true; i++)
		{
			if(!(g_lamexp_tools[i].pcName || g_lamexp_tools[i].pcHash  || g_lamexp_tools[i].uiVersion))
			{
				break;
			}
			else if(g_lamexp_tools[i].pcName && g_lamexp_tools[i].pcHash && g_lamexp_tools[i].uiVersion)
			{
				const QString toolName = QString::fromLatin1(g_lamexp_tools[i].pcName);
				const QByteArray expectedHash = QByteArray(g_lamexp_tools[i].pcHash);
				if(g_lamexp_tools[i].uiCpuType & cpu[k])
				{
					qDebug("%02i -> %s", ++n, MUTILS_UTF8(toolName));
					QFile resource(QString(":/tools/%1").arg(toolName));
					if(!resource.open(QIODevice::ReadOnly))
					{
						qFatal("The resource for \"%s\" could not be opened!", MUTILS_UTF8(toolName));
						break;
					}
					QByteArray hash = LockedFile::fileHash(resource);
					if(hash.isNull() || _stricmp(hash.constData(), expectedHash.constData()))
					{
						qFatal("Hash check for tool \"%s\" has failed!", MUTILS_UTF8(toolName));
						break;
					}
					resource.close();
				}
			}
			else
			{
				qFatal("Inconsistent checksum data detected. Take care!");
			}
		}
		if(n != EXPECTED_TOOL_COUNT)
		{
			qFatal("Tool count mismatch for CPU type %u !!!", cpu[k]);
		}
		qDebug("Done.\n");
	}
}
Exemple #7
0
ALACDecoder::ALACDecoder(void)
    :
    m_binary(lamexp_tools_lookup("refalac.exe"))
{
    if(m_binary.isEmpty())
    {
        MUTILS_THROW("Error initializing ALAC decoder. Tool 'refalac.exe' is not registred!");
    }
}
Exemple #8
0
DownmixFilter::DownmixFilter(void)
:
	m_binary(lamexp_tools_lookup("sox.exe"))
{
	if(m_binary.isEmpty())
	{
		MUTILS_THROW("Error initializing SoX filter. Tool 'sox.exe' is not registred!");
	}
}
Exemple #9
0
TTADecoder::TTADecoder(void)
:
	m_binary(lamexp_tools_lookup("tta.exe"))
{
	if(m_binary.isEmpty())
	{
		MUTILS_THROW("Error initializing TTA decoder. Tool 'ttaenc.exe' is not registred!");
	}
}
Exemple #10
0
SpeexDecoder::SpeexDecoder(void)
:
	m_binary(lamexp_tools_lookup("speexdec.exe"))
{
	if(m_binary.isEmpty())
	{
		MUTILS_THROW("Error initializing Speex decoder. Tool 'speexdec.exe' is not registred!");
	}
}
Exemple #11
0
AvisynthDecoder::AvisynthDecoder(void)
:
	m_binary(lamexp_tools_lookup("avs2wav.exe"))
{
	if(m_binary.isEmpty())
	{
		MUTILS_THROW("Error initializing Avisynth decoder. Tool 'avs2wav.exe' is not registred!");
	}
}
Exemple #12
0
void AbstractEncoder::setBitrate(const int &bitrate)
{
	const int valueCount = toEncoderInfo()->valueCount(m_configRCMode);
	if ((valueCount > 0) && (qMax(0, bitrate) >= valueCount))
	{
		MUTILS_THROW("The specified bitrate/quality is out of range!");
	}
	m_configBitrate = qMax(0, bitrate);
}
Exemple #13
0
void AbstractEncoder::setRCMode(const int &mode)
{
	if (!toEncoderInfo()->isModeSupported(qMax(0, mode)))
	{
		MUTILS_THROW("This RC mode is not supported by the encoder!");
	}
	m_configRCMode = qMax(0, mode);
	m_configBitrate = qBound(0, m_configBitrate, toEncoderInfo()->valueCount(m_configRCMode) - 1);
}
Exemple #14
0
MP3Decoder::MP3Decoder(void)
    :
    m_binary(lamexp_tools_lookup("mpg123.exe"))
{
    if(m_binary.isEmpty())
    {
        MUTILS_THROW("Error initializing MPG123 decoder. Tool 'mpg123.exe' is not registred!");
    }
}
Exemple #15
0
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)
{
	if(options->encType() != OptionsModel::EncType_X264)
	{
		MUTILS_THROW("Invalid encoder type!");
	}
}
Exemple #16
0
ADPCMDecoder::ADPCMDecoder(void)
:
	m_binary(lamexp_tools_lookup("sox.exe"))
{
	if(m_binary.isEmpty())
	{
		MUTILS_THROW("Error initializing Vorbis decoder. Tool 'sox.exe' is not registred!");
	}
}
Exemple #17
0
QByteArray MUtils::Hash::Blake2::finalize(void)
{
	QByteArray result(HASH_SIZE, '\0');
	if(blake2b_final(m_context->state, (uint8_t*) result.data(), result.size()) != 0)
	{
		MUTILS_THROW("BLAKE2 internal error!");
	}
	m_finalized = true;
	return result;
}
Exemple #18
0
FHGAACEncoder::FHGAACEncoder(void)
:
	m_binary_enc(lamexp_tools_lookup(L1S("fhgaacenc.exe"))),
	m_binary_dll(lamexp_tools_lookup(L1S("enc_fhgaac.dll")))
{
	if(m_binary_enc.isEmpty() || m_binary_dll.isEmpty())
	{
		MUTILS_THROW("Error initializing FhgAacEnc. Tool 'fhgaacenc.exe' is not registred!");
	}

	m_configProfile = 0;
}
Exemple #19
0
QAACEncoder::QAACEncoder(void)
:
	m_binary_qaac32(lamexp_tools_lookup("qaac.exe")),
	m_binary_qaac64(lamexp_tools_lookup("qaac64.exe"))
{
	if(m_binary_qaac32.isEmpty() && m_binary_qaac64.isEmpty())
	{
		MUTILS_THROW("Error initializing QAAC. Tool 'qaac.exe' is not registred!");
	}

	m_configProfile = 0;
}
Exemple #20
0
ToneAdjustFilter::ToneAdjustFilter(int bass, int treble)
:
	m_binary(lamexp_tools_lookup("sox.exe"))
{
	if(m_binary.isEmpty())
	{
		MUTILS_THROW("Error initializing SoX filter. Tool 'sox.exe' is not registred!");
	}

	m_bass = qMax(-2000, qMin(2000, bass));
	m_treble = qMax(-2000, qMin(2000, treble));
}
Exemple #21
0
	virtual int valueAt(int mode, int index) const
	{
		switch(mode)
		{
		case SettingsModel::VBRMode:
		case SettingsModel::ABRMode:
		case SettingsModel::CBRMode:
			return qBound(8, (index + 1) * 8, 256);
			break;
		default:
			MUTILS_THROW("Bad RC mode specified!");
		}
	}
Exemple #22
0
	virtual int valueCount(int mode) const
	{
		switch(mode)
		{
		case SettingsModel::VBRMode:
		case SettingsModel::ABRMode:
		case SettingsModel::CBRMode:
			return 32;
			break;
		default:
			MUTILS_THROW("Bad RC mode specified!");
		}
	}
Exemple #23
0
	virtual bool isModeSupported(int mode) const
	{
		switch(mode)
		{
		case SettingsModel::VBRMode:
		case SettingsModel::ABRMode:
		case SettingsModel::CBRMode:
			return true;
			break;
		default:
			MUTILS_THROW("Bad RC mode specified!");
		}
	}
Exemple #24
0
OpusEncoder::OpusEncoder(void)
:
	m_binary(lamexp_tools_lookup("opusenc.exe"))
{
	if(m_binary.isEmpty())
	{
		MUTILS_THROW("Error initializing Opus encoder. Tool 'opusenc.exe' is not registred!");
	}

	m_configOptimizeFor = 0;
	m_configEncodeComplexity = 10;
	m_configFrameSize = 3;
}
Exemple #25
0
VorbisEncoder::VorbisEncoder(void)
:
	m_binary(lamexp_tools_lookup(L1S("oggenc2.exe")))
{
	if(m_binary.isEmpty())
	{
		MUTILS_THROW("Error initializing Vorbis encoder. Tool 'oggenc2.exe' is not registred!");
	}

	m_configBitrateMaximum = 0;
	m_configBitrateMinimum = 0;
	m_configSamplingRate = 0;
}
Exemple #26
0
	virtual int valueType(int mode) const
	{
		switch(mode)
		{
		case SettingsModel::VBRMode:
		case SettingsModel::ABRMode:
		case SettingsModel::CBRMode:
			return TYPE_UNCOMPRESSED;
			break;
		default:
			MUTILS_THROW("Bad RC mode specified!");
		}
	}
Exemple #27
0
/*
 * Register tool
 */
void lamexp_tools_register(const QString &toolName, LockedFile *const file, const quint32 &version, const QString &tag)
{
	QWriteLocker writeLock(&g_lamexp_tools_lock);
	
	if(!file)
	{
		MUTILS_THROW("lamexp_register_tool: Tool file must not be NULL!");
	}

	if(g_lamexp_tools_data.isNull())
	{
		g_lamexp_tools_data.reset(new tool_hash_t());
		atexit(lamexp_tools_clean_up);
	}

	const QString key = toolName.simplified().toLower();
	if(g_lamexp_tools_data->contains(key))
	{
		MUTILS_THROW("lamexp_register_tool: Tool is already registered!");
	}

	g_lamexp_tools_data->insert(key, MAKE_ENTRY(file, version, tag));
}
Exemple #28
0
AACEncoder::AACEncoder(void)
:
	m_binary_enc(lamexp_tools_lookup("neroAacEnc.exe")),
	m_binary_tag(lamexp_tools_lookup("neroAacTag.exe")),
	m_binary_sox(lamexp_tools_lookup("sox.exe"))
{
	if(m_binary_enc.isEmpty() || m_binary_tag.isEmpty() || m_binary_sox.isEmpty())
	{
		MUTILS_THROW("Error initializing AAC encoder. Tool 'neroAacEnc.exe' is not registred!");
	}

	m_configProfile = 0;
	m_configEnable2Pass = true;
}
const AbstractEncoderInfo& EncoderFactory::getEncoderInfo(const int &encoderType)
{
	switch(encoderType)
	{
	case OptionsModel::EncType_X264:
		return X264Encoder::getEncoderInfo();
	case OptionsModel::EncType_X265:
		return X265Encoder::getEncoderInfo();
	default:
		MUTILS_THROW("Unknown encoder type encountered!");
	}

	return *((AbstractEncoderInfo*)NULL);
}
Exemple #30
0
	virtual int valueAt(int mode, int index) const
	{
		switch(mode)
		{
		case SettingsModel::VBRMode:
			return qBound(0, index * 5, 100);
			break;
		case SettingsModel::ABRMode:
		case SettingsModel::CBRMode:
			return qBound(8, index2bitrate(index), 400);
			break;
		default:
			MUTILS_THROW("Bad RC mode specified!");
		}
	}