Audacity 3.2.0
EBUR128.h
Go to the documentation of this file.
1/**********************************************************************
2
3Audacity: A Digital Audio Editor
4
5EBUR128.h
6
7Max Maisel
8
9***********************************************************************/
10
11#ifndef __EBUR128_H__
12#define __EBUR128_H__
13
14#include "Biquad.h"
15#include <memory>
16#include "SampleFormat.h"
17
18#include <cmath>
19
22{
23public:
24 EBUR128(double rate, size_t channels);
25 EBUR128(const EBUR128&) = delete;
26 EBUR128(EBUR128&&) = delete;
27 ~EBUR128() = default;
28
29 static ArrayOf<Biquad> CalcWeightingFilter(double fs);
30 void Initialize();
31 void ProcessSampleFromChannel(float x_in, size_t channel);
32 void NextSample();
33 double IntegrativeLoudness();
34 inline double IntegrativeLoudnessToLUFS(double loudness)
35 { return 10 * log10(loudness); }
36
37private:
38 void HistogramSums(size_t start_idx, double& sum_v, long int& sum_c);
39 void AddBlockToHistogram(size_t validLen);
40
41 static const size_t HIST_BIN_COUNT = 65536;
43 static constexpr double GAMMA_A = (-70.0 + 0.691) / 10.0;
49 size_t mBlockSize;
52 double mRate;
53
59};
60
61#endif
Implements EBU-R128 loudness measurement.
Definition: EBUR128.h:22
ArrayOf< long int > mLoudnessHist
Definition: EBUR128.h:44
void ProcessSampleFromChannel(float x_in, size_t channel)
Definition: EBUR128.cpp:89
size_t mBlockRingPos
Definition: EBUR128.h:47
void HistogramSums(size_t start_idx, double &sum_v, long int &sum_c)
Definition: EBUR128.cpp:154
void Initialize()
Definition: EBUR128.cpp:27
size_t mChannelCount
Definition: EBUR128.h:51
size_t mBlockOverlap
Definition: EBUR128.h:50
static constexpr double GAMMA_A
EBU R128 absolute threshold.
Definition: EBUR128.h:43
double IntegrativeLoudnessToLUFS(double loudness)
Definition: EBUR128.h:34
void AddBlockToHistogram(size_t validLen)
Definition: EBUR128.cpp:172
~EBUR128()=default
static const size_t HIST_BIN_COUNT
Definition: EBUR128.h:41
size_t mBlockRingSize
Definition: EBUR128.h:48
size_t mBlockSize
Definition: EBUR128.h:49
static ArrayOf< Biquad > CalcWeightingFilter(double fs)
Definition: EBUR128.cpp:48
double mRate
Definition: EBUR128.h:52
double IntegrativeLoudness()
Definition: EBUR128.cpp:121
EBUR128(double rate, size_t channels)
Definition: EBUR128.cpp:14
EBUR128(EBUR128 &&)=delete
void NextSample()
Definition: EBUR128.cpp:104
size_t mSampleCount
Definition: EBUR128.h:46
Doubles mBlockRingBuffer
Definition: EBUR128.h:45
EBUR128(const EBUR128 &)=delete
ArrayOf< ArrayOf< Biquad > > mWeightingFilter
Definition: EBUR128.h:58