mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
gst/spectrum/gstspectrum.c: Now do the scaling right for real. Also initialize a previously uninitialized variable.
Original commit message from CVS: * gst/spectrum/gstspectrum.c: Now do the scaling right for real. Also initialize a previously uninitialized variable.
This commit is contained in:
parent
912538f37a
commit
ee25c44f93
2 changed files with 9 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2007-11-09 Sebastian Dröge <slomo@circular-chaos.org>
|
||||||
|
|
||||||
|
* gst/spectrum/gstspectrum.c:
|
||||||
|
Now do the scaling right for real. Also initialize a previously
|
||||||
|
uninitialized variable.
|
||||||
|
|
||||||
2007-11-09 Edgard Lima <edgard.lima@indt.org.br>
|
2007-11-09 Edgard Lima <edgard.lima@indt.org.br>
|
||||||
|
|
||||||
* ext/metadata/metadataparsexmp.c:
|
* ext/metadata/metadataparsexmp.c:
|
||||||
|
|
|
@ -517,10 +517,9 @@ process_s##width (GstSpectrum *spectrum, const gint##width *samples) \
|
||||||
\
|
\
|
||||||
/* Calculate magnitude in db */ \
|
/* Calculate magnitude in db */ \
|
||||||
for (i = 0; i < spectrum->bands; i++) { \
|
for (i = 0; i < spectrum->bands; i++) { \
|
||||||
gdouble val; \
|
gdouble val = 0.0; \
|
||||||
val = (gdouble) freqdata[i].r * (gdouble) freqdata[i].r; \
|
val = (gdouble) freqdata[i].r * (gdouble) freqdata[i].r; \
|
||||||
val += (gdouble) freqdata[i].i * (gdouble) freqdata[i].i; \
|
val += (gdouble) freqdata[i].i * (gdouble) freqdata[i].i; \
|
||||||
val *= nfft; \
|
|
||||||
val /= max*max; \
|
val /= max*max; \
|
||||||
val = 10.0 * log10 (val); \
|
val = 10.0 * log10 (val); \
|
||||||
if (val > spectrum->threshold) \
|
if (val > spectrum->threshold) \
|
||||||
|
@ -585,10 +584,10 @@ process_f##width (GstSpectrum *spectrum, const g##type *samples) \
|
||||||
\
|
\
|
||||||
/* Calculate magnitude in db */ \
|
/* Calculate magnitude in db */ \
|
||||||
for (i = 0; i < spectrum->bands; i++) { \
|
for (i = 0; i < spectrum->bands; i++) { \
|
||||||
gdouble val; \
|
gdouble val = 0.0; \
|
||||||
val = freqdata[i].r * freqdata[i].r; \
|
val = freqdata[i].r * freqdata[i].r; \
|
||||||
val += freqdata[i].i * freqdata[i].i; \
|
val += freqdata[i].i * freqdata[i].i; \
|
||||||
val /= nfft; \
|
val /= nfft*nfft; \
|
||||||
val = 10.0 * log10 (val); \
|
val = 10.0 * log10 (val); \
|
||||||
if (val > spectrum->threshold) \
|
if (val > spectrum->threshold) \
|
||||||
val -= spectrum->threshold; \
|
val -= spectrum->threshold; \
|
||||||
|
|
Loading…
Reference in a new issue