mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-26 09:08:14 +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,12 +889,16 @@ gst_spectrum_prepare_message_data (GstSpectrum * spectrum,
|
||||||
guint i;
|
guint i;
|
||||||
guint bands = spectrum->bands;
|
guint bands = spectrum->bands;
|
||||||
guint num_fft = spectrum->num_fft;
|
guint num_fft = spectrum->num_fft;
|
||||||
gfloat *spect_magnitude = cd->spect_magnitude;
|
|
||||||
gfloat *spect_phase = cd->spect_phase;
|
|
||||||
|
|
||||||
/* Calculate average */
|
/* Calculate average */
|
||||||
for (i = 0; i < bands; i++) {
|
if (spectrum->message_magnitude) {
|
||||||
|
gfloat *spect_magnitude = cd->spect_magnitude;
|
||||||
|
for (i = 0; i < bands; i++)
|
||||||
spect_magnitude[i] /= num_fft;
|
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;
|
spect_phase[i] /= num_fft;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue