]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Add a LPC filter
authorvitor <vitor@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Thu, 30 Oct 2008 21:05:37 +0000 (21:05 +0000)
committervitor <vitor@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Thu, 30 Oct 2008 21:05:37 +0000 (21:05 +0000)
Part of the QCELP patch by Kenan Gillet, kenan.gillet gmail com

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@15754 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavcodec/celp_filters.c
libavcodec/celp_filters.h

index 758c9b0a90a35f7940dde0ffb813d7dcd297294d..3d983c4f752ebeb94196d7952849d7c6395bd88c 100644 (file)
@@ -84,3 +84,24 @@ int ff_celp_lp_synthesis_filter(
 
     return 0;
 }
+
+void ff_celp_lp_synthesis_filterf(
+        float *out,
+        const float* filter_coeffs,
+        const float* in,
+        int buffer_length,
+        int filter_length)
+{
+    int i,n;
+
+    // These two lines are to avoid a -1 subtraction in the main loop
+    filter_length++;
+    filter_coeffs--;
+
+    for(n=0; n<buffer_length; n++)
+    {
+        out[n] = in[n];
+        for(i=1; i<filter_length; i++)
+            out[n] += filter_coeffs[i] * out[n-i];
+    }
+}
index cb73aa8869b1f685887e80cb1816e86bb7036ac2..f46dcd2d2ad4570e38a4fba5264db520024176ed 100644 (file)
@@ -69,4 +69,28 @@ int ff_celp_lp_synthesis_filter(
         int stop_on_overflow,
         int rounder);
 
+/**
+ * LP synthesis filter.
+ * @param out [out] pointer to output buffer
+ *        - the array out[-filter_length, -1] must
+ *        contain the previous result of this filter
+ * @param filter_coeffs filter coefficients.
+ * @param in input signal
+ * @param buffer_length amount of data to process
+ * @param filter_length filter length (10 for 10th order LP filter)
+ *
+ * @return 1 if overflow occurred, 0 - otherwise
+ *
+ * @note Output buffer must contain 10 samples of past
+ *       speech data before pointer.
+ *
+ * Routine applies 1/A(z) filter to given speech data.
+ */
+void ff_celp_lp_synthesis_filterf(
+        float *out,
+        const float* filter_coeffs,
+        const float* in,
+        int buffer_length,
+        int filter_length);
+
 #endif /* AVCODEC_CELP_FILTERS_H */