Updated dcaenc. Also encoders can now report all supported channel numbers and downmix will be invoked as needed. We still downmix to Stereo, if the given channel number isn't supported. In a future version we should downmix to the most suitable supported channel number.

This commit is contained in:
LoRd_MuldeR 2011-12-23 00:43:11 +01:00
parent a0a29b9551
commit 36d4f4fb74
10 changed files with 32 additions and 11 deletions

BIN
res/tools/dcaenc.exe Normal file

Binary file not shown.

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 4 #define VER_LAMEXP_MINOR_LO 4
#define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 12 #define VER_LAMEXP_PATCH 12
#define VER_LAMEXP_BUILD 830 #define VER_LAMEXP_BUILD 832
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Tool versions (minimum expected versions!) // Tool versions (minimum expected versions!)

View File

@ -47,9 +47,9 @@ void AbstractEncoder::setCustomParams(const QString &customParams) { m_configCus
*/ */
// Does encoder require the input to be downmixed to stereo? // Does encoder require the input to be downmixed to stereo?
bool AbstractEncoder::requiresDownmix(void) const unsigned int *AbstractEncoder::supportedChannelCount(void)
{ {
return false; return NULL;
} }
// Does encoder require the input to be downsampled? (NULL-terminated array of supported sampling rates) // Does encoder require the input to be downsampled? (NULL-terminated array of supported sampling rates)

View File

@ -40,8 +40,8 @@ public:
virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag) = 0; virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag) = 0;
virtual bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion) = 0; virtual bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion) = 0;
virtual QString extension(void) = 0; virtual QString extension(void) = 0;
virtual bool requiresDownmix(void);
virtual const unsigned int *supportedSamplerates(void); virtual const unsigned int *supportedSamplerates(void);
virtual const unsigned int *supportedChannelCount(void);
virtual const unsigned int *supportedBitdepths(void); virtual const unsigned int *supportedBitdepths(void);
//Common setter methods //Common setter methods

View File

@ -139,6 +139,12 @@ bool DCAEncoder::isFormatSupported(const QString &containerType, const QString &
return false; return false;
} }
const unsigned int *DCAEncoder::supportedChannelCount(void)
{
static const unsigned int supportedChannels[] = {1, 2, 4, 5, 6, NULL};
return supportedChannels;
}
const unsigned int *DCAEncoder::supportedSamplerates(void) const unsigned int *DCAEncoder::supportedSamplerates(void)
{ {
static const unsigned int supportedRates[] = {48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, NULL}; static const unsigned int supportedRates[] = {48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, NULL};

View File

@ -36,6 +36,7 @@ public:
virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag); virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag);
virtual bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion); virtual bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion);
virtual QString extension(void); virtual QString extension(void);
virtual const unsigned int *supportedChannelCount(void);
virtual const unsigned int *supportedBitdepths(void); virtual const unsigned int *supportedBitdepths(void);
virtual const unsigned int *supportedSamplerates(void); virtual const unsigned int *supportedSamplerates(void);

View File

@ -231,9 +231,10 @@ bool MP3Encoder::isFormatSupported(const QString &containerType, const QString &
return false; return false;
} }
bool MP3Encoder::requiresDownmix(void) const unsigned int *MP3Encoder::supportedChannelCount(void)
{ {
return true; static const unsigned int supportedChannels[] = {1, 2, NULL};
return supportedChannels;
} }
void MP3Encoder::setAlgoQuality(int value) void MP3Encoder::setAlgoQuality(int value)

View File

@ -36,7 +36,7 @@ public:
virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag); virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag);
virtual bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion); virtual bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion);
virtual QString extension(void); virtual QString extension(void);
virtual bool requiresDownmix(void); virtual const unsigned int *supportedChannelCount(void);
//Advanced options //Advanced options
virtual void setAlgoQuality(int value); virtual void setAlgoQuality(int value);

View File

@ -177,7 +177,7 @@ void ProcessThread::processFile()
//------------------------------------ //------------------------------------
if(bSuccess && IS_WAVE(m_audioFile)) if(bSuccess && IS_WAVE(m_audioFile))
{ {
if(m_encoder->supportedSamplerates() || m_encoder->supportedBitdepths() || m_encoder->requiresDownmix()) if(m_encoder->supportedSamplerates() || m_encoder->supportedBitdepths() || m_encoder->supportedChannelCount())
{ {
m_currentStep = AnalyzeStep; m_currentStep = AnalyzeStep;
bSuccess = m_propDetect->detect(sourceFile, &m_audioFile, &m_aborted); bSuccess = m_propDetect->detect(sourceFile, &m_audioFile, &m_aborted);
@ -187,7 +187,7 @@ void ProcessThread::processFile()
handleMessage("\n-------------------------------\n"); handleMessage("\n-------------------------------\n");
//Do we need to take care if Stereo downmix? //Do we need to take care if Stereo downmix?
if(m_encoder->requiresDownmix()) if(m_encoder->supportedChannelCount())
{ {
insertDownmixFilter(); insertDownmixFilter();
} }
@ -477,6 +477,7 @@ void ProcessThread::insertDownmixFilter(void)
if(dynamic_cast<DownmixFilter*>(m_filters.at(i))) if(dynamic_cast<DownmixFilter*>(m_filters.at(i)))
{ {
qWarning("Encoder requires Stereo downmix, but user has already forced downmix!"); qWarning("Encoder requires Stereo downmix, but user has already forced downmix!");
handleMessage("WARNING: Encoder may need downmixning, but already using downmixning filter. Encoding *may* fail!\n");
applyDownmixing = false; applyDownmixing = false;
} }
} }
@ -484,8 +485,20 @@ void ProcessThread::insertDownmixFilter(void)
//Now add the downmixing filter, if needed //Now add the downmixing filter, if needed
if(applyDownmixing) if(applyDownmixing)
{ {
bool requiresDownmix = true;
const unsigned int *supportedChannels = m_encoder->supportedChannelCount();
unsigned int channels = m_audioFile.formatAudioChannels(); unsigned int channels = m_audioFile.formatAudioChannels();
if((channels == 0) || (channels > 2))
for(int i = 0; supportedChannels[i]; i++)
{
if(supportedChannels[i] == channels)
{
requiresDownmix = false;
break;
}
}
if(requiresDownmix)
{ {
m_filters.append(new DownmixFilter()); m_filters.append(new DownmixFilter());
} }

View File

@ -56,7 +56,7 @@ g_lamexp_tools[] =
{"29da0d3e810bc3e8d2cddb3db452325eefca0d0c1fff1379fa17806ad447752be1b88e2f", CPU_TYPE_X64_ALL, "aften.x64.exe", 8}, {"29da0d3e810bc3e8d2cddb3db452325eefca0d0c1fff1379fa17806ad447752be1b88e2f", CPU_TYPE_X64_ALL, "aften.x64.exe", 8},
{"1cca303fabd889a18fc01c32a7fd861194cfcac60ba63740ea2d7c55d049dbf8f59259fa", CPU_TYPE_ALL_ALL, "alac.exe", 20}, {"1cca303fabd889a18fc01c32a7fd861194cfcac60ba63740ea2d7c55d049dbf8f59259fa", CPU_TYPE_ALL_ALL, "alac.exe", 20},
{"6d22d4bbd7ce2162e38f70ac9187bc84eb28233b36ee6c0492d0a6195318782d7f05c444", CPU_TYPE_ALL_ALL, "avs2wav.exe", 13}, {"6d22d4bbd7ce2162e38f70ac9187bc84eb28233b36ee6c0492d0a6195318782d7f05c444", CPU_TYPE_ALL_ALL, "avs2wav.exe", 13},
{"d94bea403cbd24a890d91f55a4e4fed47898b21b62de3ba1202da55dc0917187304171f6", CPU_TYPE_ALL_ALL, "dcaenc.exe", 20111222}, {"28d8cd9eac2f5eaa0871623d616a9dc912de2bbedf06a9f50a3e8f87766dcf2e3d25bd73", CPU_TYPE_ALL_ALL, "dcaenc.exe", 20111222},
{"e53a787d4a0319453f4fe48c3145f190fcce7ac4802e521db908771437f6250746116e6c", CPU_TYPE_ALL_ALL, "elevator.exe", UINT_MAX}, {"e53a787d4a0319453f4fe48c3145f190fcce7ac4802e521db908771437f6250746116e6c", CPU_TYPE_ALL_ALL, "elevator.exe", UINT_MAX},
{"9ae98a3fc779f69ee876a3b477fbc35a709ba5066823b2eb62eeb015057c38807e4be51f", CPU_TYPE_ALL_ALL, "faad.exe", 27}, {"9ae98a3fc779f69ee876a3b477fbc35a709ba5066823b2eb62eeb015057c38807e4be51f", CPU_TYPE_ALL_ALL, "faad.exe", 27},
{"446054f9a7f705f1aadc9053ca7b8a86a775499ef159978954ebdea92de056c34f8841f7", CPU_TYPE_ALL_ALL, "flac.exe", 121}, {"446054f9a7f705f1aadc9053ca7b8a86a775499ef159978954ebdea92de056c34f8841f7", CPU_TYPE_ALL_ALL, "flac.exe", 121},