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
21class MATH_API EBUR128
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 ProcessSampleFromChannel(float x_in, size_t channel) const;
31 void NextSample();
32 double IntegrativeLoudness();
33 inline double IntegrativeLoudnessToLUFS(double loudness)
34 { return 10 * log10(loudness); }
35
36private:
37 void HistogramSums(size_t start_idx, double& sum_v, long int& sum_c) const;
38 void AddBlockToHistogram(size_t validLen);
39
40 static constexpr size_t HIST_BIN_COUNT = 65536;
42 static constexpr double GAMMA_A = (-70.0 + 0.691) / 10.0;
45 size_t mSampleCount{ 0 };
46 size_t mBlockRingPos{ 0 };
47 size_t mBlockRingSize{ 0 };
48 const size_t mChannelCount;
49 const double mRate;
50 const size_t mBlockSize;
51 const size_t mBlockOverlap;
52
58};
59
60#endif
Implements EBU-R128 loudness measurement.
Definition: EBUR128.h:22
ArrayOf< long int > mLoudnessHist
Definition: EBUR128.h:43
const size_t mChannelCount
Definition: EBUR128.h:48
double IntegrativeLoudnessToLUFS(double loudness)
Definition: EBUR128.h:33
~EBUR128()=default
const size_t mBlockSize
Definition: EBUR128.h:50
EBUR128(EBUR128 &&)=delete
const double mRate
Definition: EBUR128.h:49
Doubles mBlockRingBuffer
Definition: EBUR128.h:44
EBUR128(const EBUR128 &)=delete
ArrayOf< ArrayOf< Biquad > > mWeightingFilter
Definition: EBUR128.h:57
const size_t mBlockOverlap
Definition: EBUR128.h:51