AE: re-add setting normalizelevels, formally inverted and known as boost...
#: system/settings/settings.xml
msgctxt "#346"
-msgid "Boost volume level on downmix"
+msgid "Normalize levels on downmix"
msgstr ""
#: system/settings/settings.xml
msgid "Same as movie"
msgstr ""
-#empty strings from id 36533 to 36534
+#: settings/DisplaySettings.cpp
+msgctxt "#36533"
+msgid "Select how audio is downmixed, for example from 5.1 to 2.0: [Enabled] maintains the dynamic range of the original audio source when downmixed however volume will be lower [Disabled] maintains volume level of the original audio source however the dynamic range is compressed. Note - Dynamic range is the difference between the quietest and loudest sounds in a audio source."
+msgstr ""
+
+#empty strings from id 36534 to 36534
#: guilib/StereoscopicsManager.cpp
#: xbmc/video/dialogs/GUIDialogVideoSettings.cpp
</dependencies>
<control type="toggle" />
</setting>
+ <setting id="audiooutput.normalizelevels" type="boolean" label="346" help="36533">
+ <level>2</level>
+ <default>true</default>
+ </setting>
<setting id="audiooutput.processquality" type="integer" label="13505" help="36169">
<requirement>HAS_AE_QUALITY_LEVELS</requirement>
<level>2</level>
{
(*it)->m_resampleBuffers = new CActiveAEBufferPoolResample((*it)->m_inputBuffers->m_format, outputFormat, m_settings.resampleQuality);
(*it)->m_resampleBuffers->m_changeResampler = (*it)->m_forceResampler;
- (*it)->m_resampleBuffers->Create(MAX_CACHE_LEVEL*1000, false, m_settings.stereoupmix);
+ (*it)->m_resampleBuffers->Create(MAX_CACHE_LEVEL*1000, false, m_settings.stereoupmix, m_settings.normalizelevels);
}
if (m_mode == MODE_TRANSCODE || m_streams.size() > 1)
(*it)->m_resampleBuffers->m_fillPackets = true;
std::list<CActiveAEStream*>::iterator it;
for(it=m_streams.begin(); it!=m_streams.end(); ++it)
{
+ bool normalize = true;
+ if (((*it)->m_resampleBuffers->m_format.m_channelLayout.Count() <
+ (*it)->m_resampleBuffers->m_inputFormat.m_channelLayout.Count()) &&
+ !m_settings.normalizelevels)
+ normalize = false;
+
if ((*it)->m_resampleBuffers && (*it)->m_resampleBuffers->m_resampler &&
(((*it)->m_resampleBuffers->m_resampleQuality != m_settings.resampleQuality) ||
- ((*it)->m_resampleBuffers->m_stereoUpmix != m_settings.stereoupmix)))
+ (((*it)->m_resampleBuffers->m_stereoUpmix != m_settings.stereoupmix)) ||
+ ((*it)->m_resampleBuffers->m_normalize != normalize)))
{
(*it)->m_resampleBuffers->m_changeResampler = true;
}
(*it)->m_resampleBuffers->m_resampleQuality = m_settings.resampleQuality;
(*it)->m_resampleBuffers->m_stereoUpmix = m_settings.stereoupmix;
+ (*it)->m_resampleBuffers->m_normalize = normalize;
}
}
fadingStep = delta / samples;
}
- // for stream amplification we need to run on a per sample basis
- if ((*it)->m_amplify != 1.0)
+ // for streams amplification of turned off downmix normalization
+ // we need to run on a per sample basis
+ if ((*it)->m_amplify != 1.0 || !(*it)->m_resampleBuffers->m_normalize)
{
nb_floats = out->pkt->config.channels / out->pkt->planes;
nb_loops = out->pkt->nb_samples;
fadingStep = delta / samples;
}
- // for stream amplification we need to run on a per sample basis
- if ((*it)->m_amplify != 1.0)
+ // for streams amplification of turned off downmix normalization
+ // we need to run on a per sample basis
+ if ((*it)->m_amplify != 1.0 || !(*it)->m_resampleBuffers->m_normalize)
{
nb_floats = out->pkt->config.channels / out->pkt->planes;
nb_loops = out->pkt->nb_samples;
m_settings.samplerate = CSettings::Get().GetInt("audiooutput.samplerate");
m_settings.stereoupmix = CSettings::Get().GetBool("audiooutput.stereoupmix");
+ m_settings.normalizelevels = CSettings::Get().GetBool("audiooutput.normalizelevels");
m_settings.passthrough = m_settings.config == AE_CONFIG_FIXED ? false : CSettings::Get().GetBool("audiooutput.passthrough");
m_settings.ac3passthrough = CSettings::Get().GetBool("audiooutput.ac3passthrough");
setting == "audiooutput.streamsilence" ||
setting == "audiooutput.processquality" ||
setting == "audiooutput.passthrough" ||
- setting == "audiooutput.samplerate")
+ setting == "audiooutput.samplerate" ||
+ setting == "audiooutput.normalizelevels")
{
m_controlPort.SendOutMessage(CActiveAEControlProtocol::RECONFIGURE);
}
orig_config.fmt,
orig_config.bits_per_sample,
false,
+ true,
NULL,
AE_QUALITY_MID);
bool truehdpassthrough;
bool dtshdpassthrough;
bool stereoupmix;
+ bool normalizelevels;
bool passthrough;
int config;
unsigned int samplerate;
m_resampleQuality = quality;
m_changeResampler = false;
m_stereoUpmix = false;
+ m_normalize = true;
}
CActiveAEBufferPoolResample::~CActiveAEBufferPoolResample()
delete m_resampler;
}
-bool CActiveAEBufferPoolResample::Create(unsigned int totaltime, bool remap, bool upmix)
+bool CActiveAEBufferPoolResample::Create(unsigned int totaltime, bool remap, bool upmix, bool normalize)
{
CActiveAEBufferPool::Create(totaltime);
+ m_stereoUpmix = upmix;
+ m_normalize = true;
+ if ((m_format.m_channelLayout.Count() < m_inputFormat.m_channelLayout.Count() && !normalize))
+ m_normalize = false;
+
if (m_inputFormat.m_channelLayout != m_format.m_channelLayout ||
m_inputFormat.m_sampleRate != m_format.m_sampleRate ||
m_inputFormat.m_dataFormat != m_format.m_dataFormat ||
CActiveAEResample::GetAVSampleFormat(m_inputFormat.m_dataFormat),
CAEUtil::DataFormatToUsedBits(m_inputFormat.m_dataFormat),
upmix,
+ m_normalize,
remap ? &m_format.m_channelLayout : NULL,
m_resampleQuality);
}
- m_stereoUpmix = upmix;
m_changeResampler = false;
return true;
CActiveAEResample::GetAVSampleFormat(m_inputFormat.m_dataFormat),
CAEUtil::DataFormatToUsedBits(m_inputFormat.m_dataFormat),
m_stereoUpmix,
+ m_normalize,
NULL,
m_resampleQuality);
public:
CActiveAEBufferPoolResample(AEAudioFormat inputFormat, AEAudioFormat outputFormat, AEQuality quality);
virtual ~CActiveAEBufferPoolResample();
- virtual bool Create(unsigned int totaltime, bool remap, bool upmix);
+ virtual bool Create(unsigned int totaltime, bool remap, bool upmix, bool normalize = true);
void ChangeResampler();
bool ResampleBuffers(unsigned int timestamp = 0);
float GetDelay();
double m_resampleRatio;
AEQuality m_resampleQuality;
bool m_stereoUpmix;
+ bool m_normalize;
};
}
m_dllSwResample.Unload();
}
-bool CActiveAEResample::Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, int dst_bits, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, int src_bits, bool upmix, CAEChannelInfo *remapLayout, AEQuality quality)
+bool CActiveAEResample::Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, int dst_bits, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, int src_bits, bool upmix, bool normalize, CAEChannelInfo *remapLayout, AEQuality quality)
{
if (!m_dllAvUtil.Load() || !m_dllSwResample.Load())
return false;
// not required for sink stage (remapLayout == true)
if ((m_dst_fmt == AV_SAMPLE_FMT_FLT || m_dst_fmt == AV_SAMPLE_FMT_FLTP) &&
(m_src_fmt == AV_SAMPLE_FMT_FLT || m_src_fmt == AV_SAMPLE_FMT_FLTP) &&
- !remapLayout)
+ !remapLayout && normalize)
{
m_dllAvUtil.av_opt_set_double(m_pContext, "rematrix_maxval", 1.0, 0);
}
public:
CActiveAEResample();
virtual ~CActiveAEResample();
- bool Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, int dst_bits, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, int src_bits, bool upmix, CAEChannelInfo *remapLayout, AEQuality quality);
+ bool Init(uint64_t dst_chan_layout, int dst_channels, int dst_rate, AVSampleFormat dst_fmt, int dst_bits, uint64_t src_chan_layout, int src_channels, int src_rate, AVSampleFormat src_fmt, int src_bits, bool upmix, bool normalize, CAEChannelInfo *remapLayout, AEQuality quality);
int Resample(uint8_t **dst_buffer, int dst_samples, uint8_t **src_buffer, int src_samples, double ratio);
int64_t GetDelay(int64_t base);
int GetBufferedSamples();
normalize = true;
else
{
- //FIXME: guisetting is reversed, change the setting name after frodo
- normalize = !CSettings::Get().GetBool("audiooutput.normalizelevels");
+ normalize = CSettings::Get().GetBool("audiooutput.normalizelevels");
CLog::Log(LOGDEBUG, "AERemap: Downmix normalization is %s", (normalize ? "enabled" : "disabled"));
}
m_outStride = m_inSampleSize * m_outChannels;
/* see if we need to normalize the levels */
- bool dontnormalize = CSettings::Get().GetBool("audiooutput.normalizelevels");
+ bool dontnormalize = !CSettings::Get().GetBool("audiooutput.normalizelevels");
CLog::Log(LOGDEBUG, "CPCMRemap: Downmix normalization is %s", (dontnormalize ? "disabled" : "enabled"));
ResolveChannels();
settingSet.insert("audiooutput.audiodevice");
settingSet.insert("audiooutput.passthroughdevice");
settingSet.insert("audiooutput.streamsilence");
+ settingSet.insert("audiooutput.normalizelevels");
settingSet.insert("lookandfeel.skin");
settingSet.insert("lookandfeel.skinsettings");
settingSet.insert("lookandfeel.font");