Add loudness histogram Feature to the EBUr128 VAMP plugin
This commit is contained in:
parent
6c8a062be9
commit
e41296bf5d
|
@ -31,26 +31,33 @@ namespace ARDOUR {
|
||||||
ExportAnalysis ()
|
ExportAnalysis ()
|
||||||
: loudness (0)
|
: loudness (0)
|
||||||
, loudness_range (0)
|
, loudness_range (0)
|
||||||
|
, loudness_hist_max (0)
|
||||||
, have_loudness (false)
|
, have_loudness (false)
|
||||||
{
|
{
|
||||||
memset (_peaks, 0, sizeof(_peaks));
|
memset (peaks, 0, sizeof(peaks));
|
||||||
memset (_spectrum, 0, sizeof(_spectrum));
|
memset (spectrum, 0, sizeof(spectrum));
|
||||||
|
memset (loudness_hist, 0, sizeof(loudness_hist));
|
||||||
}
|
}
|
||||||
|
|
||||||
ExportAnalysis (const ExportAnalysis& other)
|
ExportAnalysis (const ExportAnalysis& other)
|
||||||
: loudness (other.loudness)
|
: loudness (other.loudness)
|
||||||
, loudness_range (other.loudness_range)
|
, loudness_range (other.loudness_range)
|
||||||
|
, loudness_hist_max (other.loudness_hist_max)
|
||||||
, have_loudness (other.have_loudness)
|
, have_loudness (other.have_loudness)
|
||||||
{
|
{
|
||||||
memcpy (_peaks, other._peaks, sizeof(_peaks));
|
memcpy (peaks, other.peaks, sizeof(peaks));
|
||||||
memcpy (_spectrum, other._spectrum, sizeof(_spectrum));
|
memcpy (spectrum, other.spectrum, sizeof(spectrum));
|
||||||
|
memcpy (loudness_hist, other.loudness_hist, sizeof(loudness_hist));
|
||||||
}
|
}
|
||||||
|
|
||||||
float loudness;
|
float loudness;
|
||||||
float loudness_range;
|
float loudness_range;
|
||||||
|
int loudness_hist[540];
|
||||||
|
int loudness_hist_max;
|
||||||
bool have_loudness;
|
bool have_loudness;
|
||||||
PeakData _peaks[800];
|
|
||||||
float _spectrum[800][256];
|
PeakData peaks[800];
|
||||||
|
float spectrum[800][200];
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef boost::shared_ptr<ExportAnalysis> ExportAnalysisPtr;
|
typedef boost::shared_ptr<ExportAnalysis> ExportAnalysisPtr;
|
||||||
|
|
|
@ -111,7 +111,7 @@ VampEBUr128::getOutputDescriptors() const
|
||||||
OutputDescriptor zc;
|
OutputDescriptor zc;
|
||||||
zc.identifier = "loundless";
|
zc.identifier = "loundless";
|
||||||
zc.name = "Integrated loudness";
|
zc.name = "Integrated loudness";
|
||||||
zc.description = "Integrated loudness";
|
zc.description = "Integrated Loudness";
|
||||||
zc.unit = "LUFS";
|
zc.unit = "LUFS";
|
||||||
zc.hasFixedBinCount = true;
|
zc.hasFixedBinCount = true;
|
||||||
zc.binCount = 0;
|
zc.binCount = 0;
|
||||||
|
@ -121,8 +121,8 @@ VampEBUr128::getOutputDescriptors() const
|
||||||
list.push_back(zc);
|
list.push_back(zc);
|
||||||
|
|
||||||
zc.identifier = "range";
|
zc.identifier = "range";
|
||||||
zc.name = "Integrated loudness Range";
|
zc.name = "Integrated Loudness Range";
|
||||||
zc.description = "Dynamic Range of the audio";
|
zc.description = "Dynamic Range of the Audio";
|
||||||
zc.unit = "LU";
|
zc.unit = "LU";
|
||||||
zc.hasFixedBinCount = true;
|
zc.hasFixedBinCount = true;
|
||||||
zc.binCount = 0;
|
zc.binCount = 0;
|
||||||
|
@ -131,6 +131,17 @@ VampEBUr128::getOutputDescriptors() const
|
||||||
zc.sampleType = OutputDescriptor::OneSamplePerStep;
|
zc.sampleType = OutputDescriptor::OneSamplePerStep;
|
||||||
list.push_back(zc);
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,5 +177,13 @@ VampEBUr128::getRemainingFeatures()
|
||||||
range.values.push_back(ebu.range_max () - ebu.range_min ());
|
range.values.push_back(ebu.range_max () - ebu.range_min ());
|
||||||
returnFeatures[1].push_back(range);
|
returnFeatures[1].push_back(range);
|
||||||
|
|
||||||
|
Feature hist;
|
||||||
|
hist.hasTimestamp = false;
|
||||||
|
const int * hist_M = ebu.histogram_M();
|
||||||
|
for (int i = 110; i < 650; ++i) {
|
||||||
|
hist.values.push_back(hist_M[i]);
|
||||||
|
}
|
||||||
|
returnFeatures[2].push_back(hist);
|
||||||
|
|
||||||
return returnFeatures;
|
return returnFeatures;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user