* GStreamer
* Copyright (C) 1999-2001 Erik Walthinsen <omega@cse.ogi.edu>
* 2006 Dreamlab Technologies Ltd. <mathis.hofer@dreamlab.net>
+ * 2007-2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*
*
* this windowed sinc filter is taken from the freely downloadable DSP book,
* chapter 16
* available at http://www.dspguide.com/
*
- * FIXME:
- * - this filter is totally unoptimized !
- * - we do not destroy the allocated memory for filters and residue
- * - this might be improved upon with bytestream
*/
-#ifndef __GST_LPWSINC_H__
-#define __GST_LPWSINC_H__
+#ifndef __GST_AUDIO_WSINC_LIMIT_H__
+#define __GST_AUDIO_WSINC_LIMIT_H__
-#include "gstfilter.h"
#include <gst/gst.h>
#include <gst/audio/gstaudiofilter.h>
-G_BEGIN_DECLS
+#include "audiofxbasefirfilter.h"
-#define GST_TYPE_LPWSINC \
- (gst_lpwsinc_get_type())
-#define GST_LPWSINC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_LPWSINC,GstLPWSinc))
-#define GST_LPWSINC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_LPWSINC,GstLPWSincClass))
-#define GST_IS_LPWSINC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_LPWSINC))
-#define GST_IS_LPWSINC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_LPWSINC))
+G_BEGIN_DECLS
-typedef struct _GstLPWSinc GstLPWSinc;
-typedef struct _GstLPWSincClass GstLPWSincClass;
+#define GST_TYPE_AUDIO_WSINC_LIMIT \
+ (gst_audio_wsinclimit_get_type())
+#define GST_AUDIO_WSINC_LIMIT(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_WSINC_LIMIT,GstAudioWSincLimit))
+#define GST_AUDIO_WSINC_LIMIT_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_WSINC_LIMIT,GstAudioWSincLimitClass))
+#define GST_IS_AUDIO_WSINC_LIMIT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_WSINC_LIMIT))
+#define GST_IS_AUDIO_WSINC_LIMIT_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_WSINC_LIMIT))
-typedef void (*GstLPWSincProcessFunc) (GstLPWSinc *, guint8 *, guint8 *, guint);
+typedef struct _GstAudioWSincLimit GstAudioWSincLimit;
+typedef struct _GstAudioWSincLimitClass GstAudioWSincLimitClass;
/**
- * GstLPWSinc:
+ * GstAudioWSincLimit:
*
* Opaque data structure.
*/
-struct _GstLPWSinc {
- GstAudioFilter element;
-
- GstLPWSincProcessFunc process;
+struct _GstAudioWSincLimit {
+ GstAudioFXBaseFIRFilter parent;
gint mode;
gint window;
- gdouble frequency;
- gint wing_size; /* length of a "wing" of the filter;
- actual length is 2 * wing_size + 1 */
+ gfloat cutoff;
+ gint kernel_length;
- gdouble *residue; /* buffer for left-over samples from previous buffer */
- gdouble *kernel; /* filter kernel */
- gboolean have_kernel;
+ /* < private > */
+ GMutex lock;
};
-struct _GstLPWSincClass {
- GstAudioFilterClass parent_class;
+struct _GstAudioWSincLimitClass {
+ GstAudioFXBaseFIRFilterClass parent;
};
+GType gst_audio_wsinclimit_get_type (void);
+
G_END_DECLS
-#endif /* __GST_LPWSINC_H__ */
+#endif /* __GST_AUDIO_WSINC_LIMIT_H__ */