Commit graph

83 commits

Author SHA1 Message Date
Stefan Kost
fb071dd89e spectrum: refactor processing loop for block based operation
Previously the chain function was working sample frame based. In each cycle it
was checking if it is time to run a fft or if it is time to send a message.
Now we changed the data transform functions to work on a block of data and
calculate the max length until either {end-of-data, do-fft, do-msg}. This allows
us also to avoid the duplicated code for the single and multi-channel case (as
the transformers have the same signature now).
2011-03-25 00:15:48 +02:00
Stefan Kost
f00af192c9 spectrum: fix the error accumulation and frames_todo handling
Even though we wrap around the accumulated second, we still need to add the
error in the same cycle. Increase the todo in the same conditional as afterwards
the accumulated error will be below one second.
2011-03-24 14:14:09 +02:00
Stefan Kost
315347a8dc spectrum: fix broken code resulting for a wrong splitup of changes 2011-03-24 13:53:12 +02:00
Stefan Kost
3b552ae6f8 spectrum: simplify the have_interval calculation
Move some of the conditions to the places where the dependent variables change.
2011-03-24 11:27:34 +02:00
Stefan Kost
1979b04f46 spectrum: use local var for input_data function
Avoid dereferencing the input_data from the instance from within an inner loop.
2011-03-24 11:27:34 +02:00
Stefan Kost
32afdea96d spectrum: more comments and tune and logging 2011-03-10 14:29:25 +02:00
Stefan Kost
1a32265b51 spectrum: avoid unneccesary extra fft runs
Before it was possible that we run an extra fft when the time for sending a new
message is due. Only do this if we have not run the fft for the interval at all.
2011-03-10 14:15:42 +02:00
Stefan Kost
f1785b0e4a 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.
2011-03-10 14:12:01 +02:00
Stefan Kost
5bf267c485 spectrum: put number of channels to instance variable
When freeing data the format might have changed. Thus we need to remember for
which format we allocated memory.
2011-03-10 14:10:25 +02:00
Stefan Kost
dc1fe1d77f spectrum: update doc review stamp 2011-03-10 10:27:41 +02:00
Stefan Kost
b792b100e2 spectrum: use function pointers for data readers
Don't check the format for each sample frame to read. We can make that decission
in _setup already. This is still not ideal as we call the function per frame.
Ideally we determine how many samples we can copy and have a loop in the input
reader. As an alternative we might also consider to use the fft variants for the
various formats and not convert to float for all cases - we would still need to
mix or deinterleave though.
2011-03-10 10:27:41 +02:00
Stefan Kost
c622477a92 spectrum: multi-channel support
Add a boolean multi-channel property with a default of FALSE. When set to TRUE
the element won't mix all input channels to mono, but instead run a FFT on each
channel. In that case the result message would contain a 2 dimensional array
of channel x data for magnitude and phase.

API: GstSpectrum:multi-channel
https://bugzilla.gnome.org/show_bug.cgi?id=593482
2011-03-09 17:01:47 +02:00
Stefan Kost
832aac534a spectrum: more xrefs in the docs 2011-03-09 17:00:58 +02:00
Stefan Kost
65f4c4b3e6 spectrum: factor out the code that accumulated samples into the ring-buffer
Use a separate function to read a sample frame into a ringbuffer slot. In the
future we can use format-specific function pointer to avoid the reoccuring
format checks.
2011-03-09 17:00:58 +02:00
Stefan Kost
5b9028c52c spectrum: pull format to temp var to improve readability of lines using it 2011-03-09 17:00:58 +02:00
Stefan Kost
b60675acaf spectrum: code cleanup for copying data to ring-buffer
Rename fp to is_float and restructure if-else part for handling the different formats.
2011-03-09 17:00:58 +02:00
Stefan Kost
787aca6898 spectrum: add a GstSpecrtumChannel context structure
We now keep the fft data that is related to one channel in a separate structure
to prepare for multichannel support. We also refactor the code to operate more
often on the channel context.
2011-03-09 17:00:57 +02:00
Stefan Kost
2fd09ebd89 spectrum: call the instance var spectrum instead of filter 2011-03-09 17:00:57 +02:00
Stefan Kost
d8d6a3b79e spectrum: don't value we already took from the gvalue 2011-03-09 17:00:57 +02:00
Stefan Kost
77fe8c151a spectrum only aggregate magnitude/phase if user asks for it 2010-09-06 09:53:00 +03:00
Stefan Kost
0dca0becb2 spectrum: improve performance with local vars
Use 'input' instead of 'spectrum->input' which was intende already (variable
exists, but not used everywhere). Also use a local version of
'spectrum->input_pos'.
2010-09-06 09:53:00 +03:00
Stefan Kost
8beead14d0 spectrum: code cleanup
More comments and logging. Extract one complex condition to a variable. Reorder
some code for readability.
2010-09-06 09:53:00 +03:00
Stefan Kost
50a139de85 spectrum: improve property setter
consistently only update if the property actualy changed the value. Do it
without reading the gvalue twice. No need to reset the spectrum analyzer for
threshold changes.
2010-09-06 09:53:00 +03:00
Stefan Kost
61f22f4379 spectrum: add helper to only flush ringbuffer data without resetting the fft
Reduces some duplicated code as well.
2010-09-06 09:53:00 +03:00
Stefan Kost
34bdec3d58 spectrum: more comments 2010-09-06 09:53:00 +03:00
Alexander Kojevnikov
2d13b15376 spectrum: support 24-bit width
Fixes #619045
2010-06-01 11:21:29 +02:00
Alexander Kojevnikov
c69dd320af spectrum: support arbitrary bit depth
Partially fixes #619045
2010-06-01 11:21:29 +02:00
Wim Taymans
445236a769 spectrum: add post-messages property
Add a post-messages property and deprecate the less descriptive message
property.
2009-09-11 13:28:35 +02:00
Stefan Kost
a99d3f8769 Update and add documentation for plugins with no deps (gst).
Link to properties. Correct titles for examples. Document a few trivial cases. Keep lists in section file and docs/plugins/Makefile.am alphabetically ordered.
2009-01-28 12:32:59 +02:00
Sebastian Dröge
d912a42065 gst/spectrum/gstspectrum.*: Implement a simple compensation algorithm for rounding errors.
Original commit message from CVS:
* gst/spectrum/gstspectrum.c: (gst_spectrum_reset_state),
(gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
Implement a simple compensation algorithm for rounding errors.
This makes sure that a spectrum message is posted on the bus
every interval nanoseconds. Fixes bug #567955.
2009-01-19 10:13:53 +00:00
Sebastian Dröge
9ee7150985 gst/spectrum/gstspectrum.c: Don't call gst_fft_f32_free() with NULL to prevent a crash. Fixes bug #567642.
Original commit message from CVS:
* gst/spectrum/gstspectrum.c: (gst_spectrum_reset_state):
Don't call gst_fft_f32_free() with NULL to prevent a
crash. Fixes bug #567642.
2009-01-15 11:40:23 +00:00
Sebastian Dröge
f4b2d38c87 gst/spectrum/gstspectrum.*: Use correct types for frame/fft counters and some minor cleanup.
Original commit message from CVS:
* gst/spectrum/gstspectrum.c: (gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
Use correct types for frame/fft counters and some minor
cleanup.
2009-01-14 15:44:18 +00:00
Sebastian Dröge
5d001b3ab6 gst/spectrum/: Post a spectrum message on the bus for every interval, even if the interval is small than the length o...
Original commit message from CVS:
* gst/spectrum/Makefile.am:
* gst/spectrum/README:
* gst/spectrum/gstspectrum.c: (gst_spectrum_base_init),
(gst_spectrum_class_init), (gst_spectrum_init),
(gst_spectrum_reset_state), (gst_spectrum_finalize),
(gst_spectrum_set_property), (gst_spectrum_start),
(gst_spectrum_stop), (gst_spectrum_setup),
(gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
Post a spectrum message on the bus for every interval, even
if the interval is small than the length of the FFT.
Fixes bug #567642.
Major cleanup of the spectrum element.
2009-01-14 10:46:54 +00:00
Stefan Kost
a12235aec7 gst/spectrum/gstspectrum.c: Don't terminate on fabs(in)>1.0. Init doubles as doubles.
Original commit message from CVS:
* gst/spectrum/gstspectrum.c:
Don't terminate on fabs(in)>1.0. Init doubles as doubles.
2008-08-13 09:17:20 +00:00
Stefan Kost
20b5b4c2d9 gst/level/gstlevel.c: Little renaming (l -> level).
Original commit message from CVS:
* gst/level/gstlevel.c:
Little renaming (l -> level).
* gst/spectrum/gstspectrum.c:
* gst/spectrum/gstspectrum.h:
Also send full timestamp/duration details here.
2008-08-10 15:52:42 +00:00
Tim-Philipp Müller
bf7cf95033 gst/spectrum/gstspectrum.c: Rename property enums and default defines for the properties to match the property names ...
Original commit message from CVS:
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init),
(gst_spectrum_init), (gst_spectrum_set_property),
(gst_spectrum_get_property), (gst_spectrum_message_new):
Rename property enums and default defines for the properties to match
the property names and rephrase property descriptions to make them a
bit clearer (hopefully). See #518188.
2008-04-04 09:50:10 +00:00
Jan Schmidt
1ba01acdc0 Add a simple example application for the spectrum element, include it in the docs, and fix some documentation ambigui...
Original commit message from CVS:
* docs/plugins/Makefile.am:
* gst/spectrum/gstspectrum.c:
* tests/examples/spectrum/.cvsignore:
* tests/examples/spectrum/Makefile.am:
* tests/examples/spectrum/spectrum-example.c:
Add a simple example application for the spectrum element, include it
in the docs, and fix some documentation ambiguities.
Fixes: #348085
2008-02-09 01:45:32 +00:00
Stefan Kost
0664e6be03 gst/spectrum/gstspectrum.c: Improve the docs.
Original commit message from CVS:
* gst/spectrum/gstspectrum.c:
Improve the docs.
2008-02-07 13:41:11 +00:00
Stefan Kost
0c4a31d3d7 docs/plugins/: Add symbols from -unused.txt to the right place.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-bad-plugins-sections.txt:
Add symbols from -unused.txt to the right place.
* gst/dvdspu/gstdvdspu.c:
* gst/dvdspu/gstdvdspu.h:
Coherent namespace usage.
* gst/spectrum/gstspectrum.c:
Fix broken XML fragment in doc snippet even more.
2008-01-21 09:57:07 +00:00
Stefan Kost
60144c1f08 docs/plugins/Makefile.am: Update include list.
Original commit message from CVS:
* docs/plugins/Makefile.am:
Update include list.
* docs/plugins/gst-plugins-bad-plugins-docs.sgml:
Update xml includes.
* docs/plugins/inspect/plugin-alsaspdif.xml:
* docs/plugins/inspect/plugin-amrwb.xml:
* docs/plugins/inspect/plugin-bayer.xml:
* docs/plugins/inspect/plugin-bz2.xml:
* docs/plugins/inspect/plugin-cdxaparse.xml:
* docs/plugins/inspect/plugin-dtsdec.xml:
* docs/plugins/inspect/plugin-dvbsrc.xml:
* docs/plugins/inspect/plugin-dvdspu.xml:
* docs/plugins/inspect/plugin-equalizer.xml:
* docs/plugins/inspect/plugin-faac.xml:
* docs/plugins/inspect/plugin-faad.xml:
* docs/plugins/inspect/plugin-fbdevsink.xml:
* docs/plugins/inspect/plugin-festival.xml:
* docs/plugins/inspect/plugin-filter.xml:
* docs/plugins/inspect/plugin-flvdemux.xml:
* docs/plugins/inspect/plugin-freeze.xml:
* docs/plugins/inspect/plugin-gsm.xml:
* docs/plugins/inspect/plugin-gstinterlace.xml:
* docs/plugins/inspect/plugin-gstrtpmanager.xml:
* docs/plugins/inspect/plugin-h264parse.xml:
* docs/plugins/inspect/plugin-interleave.xml:
* docs/plugins/inspect/plugin-ladspa.xml:
* docs/plugins/inspect/plugin-metadata.xml:
* docs/plugins/inspect/plugin-modplug.xml:
* docs/plugins/inspect/plugin-mpeg4videoparse.xml:
* docs/plugins/inspect/plugin-mpegtsparse.xml:
* docs/plugins/inspect/plugin-mpegvideoparse.xml:
* docs/plugins/inspect/plugin-musicbrainz.xml:
* docs/plugins/inspect/plugin-mve.xml:
* docs/plugins/inspect/plugin-nsfdec.xml:
* docs/plugins/inspect/plugin-nuvdemux.xml:
* docs/plugins/inspect/plugin-qtdemux.xml:
* docs/plugins/inspect/plugin-quicktime.xml:
* docs/plugins/inspect/plugin-real.xml:
* docs/plugins/inspect/plugin-replaygain.xml:
* docs/plugins/inspect/plugin-sdl.xml:
* docs/plugins/inspect/plugin-sdp.xml:
* docs/plugins/inspect/plugin-spectrum.xml:
* docs/plugins/inspect/plugin-speed.xml:
* docs/plugins/inspect/plugin-speexresample.xml:
* docs/plugins/inspect/plugin-stereo.xml:
* docs/plugins/inspect/plugin-switch.xml:
* docs/plugins/inspect/plugin-timidity.xml:
* docs/plugins/inspect/plugin-tta.xml:
* docs/plugins/inspect/plugin-videocrop.xml:
* docs/plugins/inspect/plugin-videoparse.xml:
* docs/plugins/inspect/plugin-videosignal.xml:
* docs/plugins/inspect/plugin-vmnc.xml:
* docs/plugins/inspect/plugin-wildmidi.xml:
* docs/plugins/inspect/plugin-x264.xml:
* docs/plugins/inspect/plugin-xingheader.xml:
* docs/plugins/inspect/plugin-xvid.xml:
* docs/plugins/inspect/plugin-y4menc.xml:
Regenerate files.
* gst/spectrum/gstspectrum.c:
Fix broken XML fragment in doc snippet.
* tests/check/elements/.cvsignore:
Add test binary to ignores.
2008-01-21 07:54:02 +00:00
Stefan Kost
48a4bc909a gst/spectrum/gstspectrum.c: Use dispose and finalize. Dispose can be called multiple times.
Original commit message from CVS:
* gst/spectrum/gstspectrum.c:
Use dispose and finalize. Dispose can be called multiple times.
2007-11-26 10:08:20 +00:00
Sebastian Dröge
546ec34716 gst/: Change the meaning of the magnitude values given in the
Original commit message from CVS:
* gst/equalizer/demo.c: (draw_spectrum):
* gst/spectrum/demo-audiotest.c: (draw_spectrum):
* gst/spectrum/demo-osssrc.c: (draw_spectrum):
* gst/spectrum/gstspectrum.c: (gst_spectrum_class_init):
Change the meaning of the magnitude values given in the
GstMessages by spectrum to decibel instead of
decibel+threshold.
2007-11-11 21:12:10 +00:00
Sebastian Dröge
d4085d9387 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.
2007-11-09 17:27:00 +00:00
Sebastian Dröge
f75f427ec1 gst/spectrum/demo-audiotest.c: Use autoaudiosink instead of alsasink and use a sine wave.
Original commit message from CVS:
* gst/spectrum/demo-audiotest.c: (main):
Use autoaudiosink instead of alsasink and use a sine wave.
* gst/spectrum/gstspectrum.c:
Fix the magnitude calculation.
2007-11-06 12:23:35 +00:00
Stefan Kost
098c8faefb ChangeLog: Add missing newline.
Original commit message from CVS:
* ChangeLog:
Add missing newline.
* gst/librfb/rfbdecoder.c:
Fix the build (missing stdlib.h).
* gst/spectrum/gstspectrum.c:
* gst/spectrum/gstspectrum.h:
Use basetransform segment so that it is correctly managed on flushes
and start/stop. Report message timestamp as stream time, which is what
an application can understand. (Yes these are adapted from wim recent
level element changes)
2007-09-18 11:45:06 +00:00
Sebastian Dröge
1b98dfee5e gst/spectrum/gstspectrum.c: Use the correct parameter order for the memset calls.
Original commit message from CVS:
* gst/spectrum/gstspectrum.c: (gst_spectrum_start),
(gst_spectrum_transform_ip):
Use the correct parameter order for the memset calls.
Thanks to Christian Schaller for noticing.
2007-09-07 15:54:38 +00:00
Sebastian Dröge
f5a3e61e69 Port GstSpectrum to GstAudioFilter and libgstfft, add support for int32, float and double, use floats for the message...
Original commit message from CVS:
* configure.ac:
* gst/spectrum/Makefile.am:
* gst/spectrum/demo-audiotest.c: (draw_spectrum),
(message_handler), (main):
* gst/spectrum/demo-osssrc.c: (draw_spectrum), (message_handler):
* gst/spectrum/gstspectrum.c: (gst_spectrum_base_init),
(gst_spectrum_class_init), (gst_spectrum_init),
(gst_spectrum_dispose), (gst_spectrum_set_property),
(gst_spectrum_get_property), (gst_spectrum_start),
(gst_spectrum_setup), (gst_spectrum_message_new),
(gst_spectrum_transform_ip):
* gst/spectrum/gstspectrum.h:
Port GstSpectrum to GstAudioFilter and libgstfft, add support
for int32, float and double, use floats for the message contents,
average all FFTs done in one interval for better results, use
a better windowing function, allow posting the phase in the message
and actually do an FFT with the requested number of bands instead
of interpolating.
* tests/check/elements/spectrum.c: (GST_START_TEST),
(spectrum_suite):
Improve the units tests by checking for a 11025Hz sine wave
and add unit tests for all 4 supported sample types.
2007-09-06 07:21:22 +00:00
Stefan Kost
048a15698d gst/spectrum/gstspectrum.c: Fix leaking buffers.
Original commit message from CVS:
* gst/spectrum/gstspectrum.c: (gst_spectrum_event),
(gst_spectrum_transform_ip):
Fix leaking buffers.
* tests/check/Makefile.am:
* tests/check/elements/spectrum.c: (setup_spectrum),
(cleanup_spectrum), (GST_START_TEST), (spectrum_suite), (main):
Add simple test for spectrum element.
2007-06-20 08:56:17 +00:00
Stefan Kost
ab92670d13 configure.ac: Depend on gstreamer-0.10.12.1. gst/equalizer/gstiirequalizer.c (ARG_BAND_WIDTH, _do_init, ARG_GAIN, _Gs...
Original commit message from CVS:
* configure.ac:
Depend on gstreamer-0.10.12.1.
* gst/equalizer/gstiirequalizer.c (ARG_BAND_WIDTH, _do_init, ARG_GAIN,
_GstIirEqualizerBand, object, _GstIirEqualizerBandClass,
parent_class, gst_iir_equalizer_band_set_property,
gst_iir_equalizer_band_class_init, gst_iir_equalizer_band_get_type,
gst_iir_equalizer_child_proxy_get_child_by_index,
gst_iir_equalizer_child_proxy_get_children_count,
gst_iir_equalizer_child_proxy_interface_init, setup_filter,
gst_iir_equalizer_compute_frequencies,
gst_iir_equalizer_set_property, gst_iir_equalizer_get_property,
plugin_init):
* gst/equalizer/gstiirequalizer.h (audiofilter):
* gst/equalizer/gstiirequalizernbands.c (ARG_NUM_BANDS,
gst_iir_equalizer_nbands_base_init, gst_iir_equalizer_nbands_init,
gst_iir_equalizer_nbands_set_property):
Use new locking macros.
* gst/filter/gstbpwsinc.c (bpwsinc_set_caps):
Add fixme.
* gst/spectrum/gstspectrum.c (SPECTRUM_WINDOW_BASE,
SPECTRUM_WINDOW_LEN, gst_spectrum_init, gst_spectrum_set_property,
gst_spectrum_event, gst_spectrum_transform_ip):
Use new locking macros. Turn two fixed values into #defines.
2007-05-22 11:14:13 +00:00
Stefan Kost
5e9e882543 gst/spectrum/gstspectrum.c (gst_spectrum_set_property, gst_spectrum_event, gst_spectrum_transform_ip):
Original commit message from CVS:
* gst/spectrum/gstspectrum.c (gst_spectrum_set_property,
gst_spectrum_event, gst_spectrum_transform_ip):
Use lock to protect from concurrent access.
2007-05-21 12:43:37 +00:00