aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/lowpass.h
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2008-08-23 15:49:58 +0000
committerKostya Shishkov <kostya.shishkov@gmail.com>2008-08-23 15:49:58 +0000
commit2e0b635a57c39ca0ff968904370fc1a7b2cb7a2a (patch)
tree8b71ad37476c9b6f7c269228afb361226e1aaddc /libavcodec/lowpass.h
parentcda00def4b3234f702c569a6b10930b25b47daeb (diff)
downloadffmpeg-2e0b635a57c39ca0ff968904370fc1a7b2cb7a2a.tar.gz
Simple lowpass filter implementation.
Originally committed as revision 14921 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/lowpass.h')
-rw-r--r--libavcodec/lowpass.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/libavcodec/lowpass.h b/libavcodec/lowpass.h
new file mode 100644
index 0000000000..6a77907746
--- /dev/null
+++ b/libavcodec/lowpass.h
@@ -0,0 +1,83 @@
+/*
+ * Lowpass IIR filter
+ * Copyright (c) 2008 Konstantin Shishkov
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file lowpass.h
+ * lowpass filter interface
+ */
+
+#ifndef FFMPEG_LOWPASS_H
+#define FFMPEG_LOWPASS_H
+
+#include "avcodec.h"
+
+struct FFLPFilterCoeffs;
+struct FFLPFilterState;
+
+/**
+ * Initialize filter coefficients.
+ *
+ * @param order filter order
+ * @param cutoff_ratio cutoff to input frequency ratio
+ *
+ * @return pointer to filter coefficients structure or NULL if filter cannot be created
+ */
+const struct FFLPFilterCoeffs* ff_lowpass_filter_init_coeffs(int order, float cutoff_ratio);
+
+/**
+ * Create new filter state.
+ *
+ * @param order filter order
+ *
+ * @return pointer to new filter state or NULL if state creation fails
+ */
+struct FFLPFilterState* ff_lowpass_filter_init_state(int order);
+
+#if 0 //enable with arbitrary order filter implementation, use av_free() for filter state only for now
+/**
+ * Free filter coefficients.
+ *
+ * @param coeffs pointer allocated with ff_lowpass_filter_init_coeffs()
+ */
+void ff_lowpass_filter_free_coeffs(struct FFLPFilterCoeffs *coeffs);
+
+/**
+ * Free filter state.
+ *
+ * @param state pointer allocated with ff_lowpass_filter_init_state()
+ */
+void ff_lowpass_filter_free_state(struct FFLPFilterState *state);
+#endif
+
+/**
+ * Perform lowpass filtering on input samples.
+ *
+ * @param coeffs pointer to filter coefficients
+ * @param state pointer to filter state
+ * @param size input length
+ * @param src source samples
+ * @param sstep source stride
+ * @param dst filtered samples (destination may be the same as input)
+ * @param dstep destination stride
+ */
+void ff_lowpass_filter(const struct FFLPFilterCoeffs *coeffs, struct FFLPFilterState *state, int size, int16_t *src, int sstep, int16_t *dst, int dstep);
+
+#endif /* FFMPEG_LOWPASS_H */