EBU/VAMP: clang-format and reduce scope

This commit is contained in:
Robin Gareus
2021-04-03 23:42:09 +02:00
parent 1890cc234f
commit e3a6fab05e
4 changed files with 525 additions and 508 deletions

View File

@@ -1,5 +1,3 @@
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
/*
Vamp
@@ -31,170 +29,170 @@
#include "EBUr128.h"
using std::string;
using std::vector;
using std::cerr;
using std::endl;
using std::string;
using std::vector;
VampEBUr128::VampEBUr128(float inputSampleRate)
: Plugin(inputSampleRate)
, m_stepSize(0)
VampEBUr128::VampEBUr128 (float inputSampleRate)
: Plugin (inputSampleRate)
, m_stepSize (0)
{
}
VampEBUr128::~VampEBUr128()
VampEBUr128::~VampEBUr128 ()
{
}
string
VampEBUr128::getIdentifier() const
VampEBUr128::getIdentifier () const
{
return "ebur128";
return "ebur128";
}
string
VampEBUr128::getName() const
VampEBUr128::getName () const
{
return "EBU R128 Loudness";
return "EBU R128 Loudness";
}
string
VampEBUr128::getDescription() const
VampEBUr128::getDescription () const
{
return "Loudness measurements according to the EBU Recommendation 128";
return "Loudness measurements according to the EBU Recommendation 128";
}
string
VampEBUr128::getMaker() const
VampEBUr128::getMaker () const
{
return "Harrison Consoles";
return "Harrison Consoles";
}
int
VampEBUr128::getPluginVersion() const
VampEBUr128::getPluginVersion () const
{
return 2;
return 2;
}
string
VampEBUr128::getCopyright() const
VampEBUr128::getCopyright () const
{
return "GPL version 2 or later";
return "GPL version 2 or later";
}
bool
VampEBUr128::initialise(size_t channels, size_t stepSize, size_t blockSize)
VampEBUr128::initialise (size_t channels, size_t stepSize, size_t blockSize)
{
if (channels < getMinChannelCount() ||
channels > getMaxChannelCount()) return false;
if (channels < getMinChannelCount () || channels > getMaxChannelCount ()) {
return false;
}
m_stepSize = std::min(stepSize, blockSize);
m_channels = channels;
m_stepSize = std::min (stepSize, blockSize);
m_channels = channels;
ebu.init (m_channels, m_inputSampleRate);
ebu.init (m_channels, m_inputSampleRate);
return true;
return true;
}
void
VampEBUr128::reset()
VampEBUr128::reset ()
{
ebu.reset ();
ebu.reset ();
}
VampEBUr128::OutputList
VampEBUr128::getOutputDescriptors() const
VampEBUr128::getOutputDescriptors () const
{
OutputList list;
OutputList list;
OutputDescriptor zc;
zc.identifier = "loundless";
zc.name = "Integrated loudness";
zc.description = "Loudness (integrated, short, momentary)";
zc.unit = "LUFS";
zc.hasFixedBinCount = true;
zc.binCount = 0;
zc.hasKnownExtents = false;
zc.isQuantized = false;
zc.sampleType = OutputDescriptor::OneSamplePerStep;
list.push_back(zc);
OutputDescriptor zc;
zc.identifier = "loundless";
zc.name = "Integrated loudness";
zc.description = "Loudness (integrated, short, momentary)";
zc.unit = "LUFS";
zc.hasFixedBinCount = true;
zc.binCount = 0;
zc.hasKnownExtents = false;
zc.isQuantized = false;
zc.sampleType = OutputDescriptor::OneSamplePerStep;
list.push_back (zc);
zc.identifier = "range";
zc.name = "Integrated Loudness Range";
zc.description = "Dynamic Range of the Audio";
zc.unit = "LU";
zc.hasFixedBinCount = true;
zc.binCount = 0;
zc.hasKnownExtents = false;
zc.isQuantized = false;
zc.sampleType = OutputDescriptor::OneSamplePerStep;
list.push_back(zc);
zc.identifier = "range";
zc.name = "Integrated Loudness Range";
zc.description = "Dynamic Range of the Audio";
zc.unit = "LU";
zc.hasFixedBinCount = true;
zc.binCount = 0;
zc.hasKnownExtents = false;
zc.isQuantized = false;
zc.sampleType = OutputDescriptor::OneSamplePerStep;
list.push_back (zc);
zc.identifier = "histogram";
zc.name = "Loudness Histogram";
zc.description = "Dynamic Range of the audio";
zc.unit = "";
zc.hasFixedBinCount = false;
zc.binCount = 0;
zc.hasKnownExtents = false;
zc.isQuantized = false;
zc.sampleType = OutputDescriptor::OneSamplePerStep;
list.push_back(zc);
zc.identifier = "histogram";
zc.name = "Loudness Histogram";
zc.description = "Dynamic Range of the audio";
zc.unit = "";
zc.hasFixedBinCount = false;
zc.binCount = 0;
zc.hasKnownExtents = false;
zc.isQuantized = false;
zc.sampleType = OutputDescriptor::OneSamplePerStep;
list.push_back (zc);
return list;
return list;
}
VampEBUr128::FeatureSet
VampEBUr128::process(const float *const *inputBuffers,
Vamp::RealTime timestamp)
VampEBUr128::process (const float* const* inputBuffers,
Vamp::RealTime timestamp)
{
if (m_stepSize == 0) {
cerr << "ERROR: VampEBUr128::process: "
<< "VampEBUr128 has not been initialised"
<< endl;
return FeatureSet();
}
if (m_stepSize == 0) {
cerr << "ERROR: VampEBUr128::process: "
<< "VampEBUr128 has not been initialised"
<< endl;
return FeatureSet ();
}
ebu.integr_start (); // noop if already started
ebu.process (m_stepSize, inputBuffers);
ebu.integr_start (); // noop if already started
ebu.process (m_stepSize, inputBuffers);
return FeatureSet();
return FeatureSet ();
}
VampEBUr128::FeatureSet
VampEBUr128::getRemainingFeatures()
VampEBUr128::getRemainingFeatures ()
{
FeatureSet returnFeatures;
FeatureSet returnFeatures;
Feature loudness_integrated;
loudness_integrated.hasTimestamp = false;
loudness_integrated.values.push_back(ebu.integrated());
Feature loudness_integrated;
loudness_integrated.hasTimestamp = false;
loudness_integrated.values.push_back (ebu.integrated ());
Feature loudness_short;
loudness_short.hasTimestamp = false;
loudness_short.values.push_back(ebu.maxloudn_S());
Feature loudness_short;
loudness_short.hasTimestamp = false;
loudness_short.values.push_back (ebu.maxloudn_S ());
Feature loudness_momentary;
loudness_momentary.hasTimestamp = false;
loudness_momentary.values.push_back(ebu.maxloudn_M());
Feature loudness_momentary;
loudness_momentary.hasTimestamp = false;
loudness_momentary.values.push_back (ebu.maxloudn_M ());
returnFeatures[0].push_back(loudness_integrated);
returnFeatures[0].push_back(loudness_short);
returnFeatures[0].push_back(loudness_momentary);
returnFeatures[0].push_back (loudness_integrated);
returnFeatures[0].push_back (loudness_short);
returnFeatures[0].push_back (loudness_momentary);
Feature range;
range.hasTimestamp = false;
range.values.push_back(ebu.range_max () - ebu.range_min ());
returnFeatures[1].push_back(range);
Feature range;
range.hasTimestamp = false;
range.values.push_back (ebu.range_max () - ebu.range_min ());
returnFeatures[1].push_back (range);
Feature hist;
hist.hasTimestamp = false;
const int * hist_S = ebu.histogram_S();
for (int i = 110; i < 650; ++i) {
hist.values.push_back(hist_S[i]);
}
returnFeatures[2].push_back(hist);
Feature hist;
hist.hasTimestamp = false;
const int* hist_S = ebu.histogram_S ();
for (int i = 110; i < 650; ++i) {
hist.values.push_back (hist_S[i]);
}
returnFeatures[2].push_back (hist);
return returnFeatures;
return returnFeatures;
}