Audacity  3.0.3
EBUR128.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3 Audacity: A Digital Audio Editor
4 
5 EBUR128.h
6 
7 Max 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 
21 class EBUR128
22 {
23 public:
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 
37 private:
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;
46  size_t mSampleCount;
47  size_t mBlockRingPos;
49  size_t mBlockSize;
50  size_t mBlockOverlap;
51  size_t mChannelCount;
52  double mRate;
53 
59 };
60 
61 #endif
EBUR128::EBUR128
EBUR128(double rate, size_t channels)
Definition: EBUR128.cpp:14
EBUR128::mBlockSize
size_t mBlockSize
Definition: EBUR128.h:49
EBUR128::Initialize
void Initialize()
Definition: EBUR128.cpp:27
EBUR128::NextSample
void NextSample()
Definition: EBUR128.cpp:104
EBUR128::mRate
double mRate
Definition: EBUR128.h:52
EBUR128::mWeightingFilter
ArrayOf< ArrayOf< Biquad > > mWeightingFilter
Definition: EBUR128.h:58
EBUR128::EBUR128
EBUR128(const EBUR128 &)=delete
Biquad.h
EBUR128::mBlockRingPos
size_t mBlockRingPos
Definition: EBUR128.h:47
EBUR128::EBUR128
EBUR128(EBUR128 &&)=delete
EBUR128::ProcessSampleFromChannel
void ProcessSampleFromChannel(float x_in, size_t channel)
Definition: EBUR128.cpp:89
EBUR128::mSampleCount
size_t mSampleCount
Definition: EBUR128.h:46
EBUR128::mLoudnessHist
ArrayOf< long int > mLoudnessHist
Definition: EBUR128.h:44
EBUR128::CalcWeightingFilter
static ArrayOf< Biquad > CalcWeightingFilter(double fs)
Definition: EBUR128.cpp:48
EBUR128::mChannelCount
size_t mChannelCount
Definition: EBUR128.h:51
EBUR128::mBlockOverlap
size_t mBlockOverlap
Definition: EBUR128.h:50
EBUR128::mBlockRingBuffer
Doubles mBlockRingBuffer
Definition: EBUR128.h:45
EBUR128::~EBUR128
~EBUR128()=default
EBUR128::HIST_BIN_COUNT
static const size_t HIST_BIN_COUNT
Definition: EBUR128.h:41
EBUR128::IntegrativeLoudness
double IntegrativeLoudness()
Definition: EBUR128.cpp:121
EBUR128::GAMMA_A
static constexpr double GAMMA_A
EBU R128 absolute threshold.
Definition: EBUR128.h:43
EBUR128
Implements EBU-R128 loudness measurement.
Definition: EBUR128.h:22
EBUR128::IntegrativeLoudnessToLUFS
double IntegrativeLoudnessToLUFS(double loudness)
Definition: EBUR128.h:34
EBUR128::HistogramSums
void HistogramSums(size_t start_idx, double &sum_v, long int &sum_c)
Definition: EBUR128.cpp:154
SampleFormat.h
ArrayOf< Biquad >
EBUR128::mBlockRingSize
size_t mBlockRingSize
Definition: EBUR128.h:48
EBUR128::AddBlockToHistogram
void AddBlockToHistogram(size_t validLen)
Definition: EBUR128.cpp:172