mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 02:15:31 +00:00
spectrum: only scale the vectors that we are processing
Phase is not produced by default, so lets not scale it unconditionally to save a few cycles.
This commit is contained in:
parent
5bf267c485
commit
f1785b0e4a
1 changed files with 9 additions and 5 deletions
|
@ -889,13 +889,17 @@ gst_spectrum_prepare_message_data (GstSpectrum * spectrum,
|
|||
guint i;
|
||||
guint bands = spectrum->bands;
|
||||
guint num_fft = spectrum->num_fft;
|
||||
gfloat *spect_magnitude = cd->spect_magnitude;
|
||||
gfloat *spect_phase = cd->spect_phase;
|
||||
|
||||
/* Calculate average */
|
||||
for (i = 0; i < bands; i++) {
|
||||
spect_magnitude[i] /= num_fft;
|
||||
spect_phase[i] /= num_fft;
|
||||
if (spectrum->message_magnitude) {
|
||||
gfloat *spect_magnitude = cd->spect_magnitude;
|
||||
for (i = 0; i < bands; i++)
|
||||
spect_magnitude[i] /= num_fft;
|
||||
}
|
||||
if (spectrum->message_phase) {
|
||||
gfloat *spect_phase = cd->spect_phase;
|
||||
for (i = 0; i < bands; i++)
|
||||
spect_phase[i] /= num_fft;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue