Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institute of Technical Acoustics (ITA)
ITABase
Commits
06cab9ae
Commit
06cab9ae
authored
Sep 20, 2016
by
Michael Kohnen
Browse files
added getEnergy function
parent
43b802ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/ITAHDFTSpectrum.h
View file @
06cab9ae
...
...
@@ -207,7 +207,14 @@ public:
//! Zeichenkette mit den Werten zurckgeben
std
::
string
toString
();
//! Calculates the energy of the spectrum
/**
* Returns the energy of a HDFTSpectrum as a float
*/
float
getEnergy
()
const
;
private:
int
m_iSize
;
int
m_iDFTSize
;
...
...
src/ITAHDFTSpectrum.cpp
View file @
06cab9ae
...
...
@@ -451,6 +451,16 @@ std::string ITAHDFTSpectrum::toString() {
return
s
;
}
float
ITAHDFTSpectrum
::
getEnergy
()
const
{
float
energy
=
0
;
for
(
int
i
=
0
;
i
<
m_iSize
;
i
++
)
{
float
mags
=
cabsf
(
m_pfData
[
2
*
i
],
m_pfData
[
2
*
i
+
1
]);
energy
+=
mags
*
mags
;
}
return
energy
/
((
float
)
m_iSize
);
}
void
ITAHDFTSpectrum
::
copy
(
const
ITAHDFTSpectrum
*
pSource
)
{
// TODO: FastMath? Jetzt gibt es Probleme mit SIMD-Alignment?
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment