MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / analyzeInt16Stereo

Function analyzeInt16Stereo

src/core/TxMicChannelNormalizer.cpp:137–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135}
136
137void analyzeInt16Stereo(const int16_t* src, int frames, Diagnostics& diag)
138{
139 double leftSumSq = 0.0;
140 double rightSumSq = 0.0;
141 float leftPeak = 0.0f;
142 float rightPeak = 0.0f;
143
144 for (int i = 0; i < frames; ++i) {
145 const float left = absInt16(src[i * 2]);
146 const float right = absInt16(src[i * 2 + 1]);
147 leftPeak = std::max(leftPeak, left);
148 rightPeak = std::max(rightPeak, right);
149 leftSumSq += static_cast<double>(left) * left;
150 rightSumSq += static_cast<double>(right) * right;
151 }
152
153 diag.leftPeak = leftPeak;
154 diag.rightPeak = rightPeak;
155 diag.leftRms = frames > 0 ? static_cast<float>(std::sqrt(leftSumSq / frames)) : 0.0f;
156 diag.rightRms = frames > 0 ? static_cast<float>(std::sqrt(rightSumSq / frames)) : 0.0f;
157}
158
159void analyzeFloat32Mono(const float* src, int frames, Diagnostics& diag)
160{

Callers 1

Calls 1

absInt16Function · 0.85

Tested by

no test coverage detected