[FFmpeg-cvslog] r19634 - in trunk/libavcodec: celp_filters.c celp_filters.h
superdump
subversion
Wed Aug 12 21:54:28 CEST 2009
Author: superdump
Date: Wed Aug 12 21:54:28 2009
New Revision: 19634
Log:
Add ff_celp_circ_addf() function to be used for sparse vector circular
convolution in the upcoming AMR-NB floating point decoder. The function scales
and adds a vector, that is lagged by some offset, to another vector with the
same number of elements.
Patch by Colin McQuillan ( m.niloc googlemail com )
Modified:
trunk/libavcodec/celp_filters.c
trunk/libavcodec/celp_filters.h
Modified: trunk/libavcodec/celp_filters.c
==============================================================================
--- trunk/libavcodec/celp_filters.c Wed Aug 12 15:25:37 2009 (r19633)
+++ trunk/libavcodec/celp_filters.c Wed Aug 12 21:54:28 2009 (r19634)
@@ -47,6 +47,16 @@ void ff_celp_convolve_circ(int16_t* fc_o
}
}
+void ff_celp_circ_addf(float *out, const float *in,
+ const float *lagged, int lag, float fac, int n)
+{
+ int k;
+ for (k = 0; k < lag; k++)
+ out[k] = in[k] + fac * lagged[n + k - lag];
+ for (; k < n; k++)
+ out[k] = in[k] + fac * lagged[ k - lag];
+}
+
int ff_celp_lp_synthesis_filter(int16_t *out,
const int16_t* filter_coeffs,
const int16_t* in,
Modified: trunk/libavcodec/celp_filters.h
==============================================================================
--- trunk/libavcodec/celp_filters.h Wed Aug 12 15:25:37 2009 (r19633)
+++ trunk/libavcodec/celp_filters.h Wed Aug 12 21:54:28 2009 (r19634)
@@ -42,6 +42,21 @@ void ff_celp_convolve_circ(int16_t* fc_o
int len);
/**
+ * Add an array to a rotated array.
+ *
+ * out[k] = in[k] + fac * lagged[k-lag] with wrap-around
+ *
+ * @param out result vector
+ * @param in samples to be added unfiltered
+ * @param lagged samples to be rotated, multiplied and added
+ * @param lag lagged vector delay in the range [0, n]
+ * @param fac scalefactor for lagged samples
+ * @param n number of samples
+ */
+void ff_celp_circ_addf(float *out, const float *in,
+ const float *lagged, int lag, float fac, int n);
+
+/**
* LP synthesis filter.
* @param out [out] pointer to output buffer
* @param filter_coeffs filter coefficients (-0x8000 <= (3.12) < 0x8000)
More information about the ffmpeg-cvslog
mailing list