diff qcelpdec.c @ 9156:139d30c8c274 libavcodec

Functional part Kenan Gillet's 'extract and share weighted_vector_sumf' patchset. Idea is to share this common code between the AMR and QCELP decoders.
author reynaldo
date Mon, 09 Mar 2009 21:55:24 +0000
parents 36a5caff8540
children 33477a19f89e
line wrap: on
line diff
--- a/qcelpdec.c	Mon Mar 09 08:04:41 2009 +0000
+++ b/qcelpdec.c	Mon Mar 09 21:55:24 2009 +0000
@@ -37,6 +37,7 @@
 
 #include "celp_math.h"
 #include "celp_filters.h"
+#include "acelp_vectors.h"
 
 #undef NDEBUG
 #include <assert.h>
@@ -81,17 +82,6 @@
  */
 void ff_celp_lspf2lpc(const double *lspf, float *lpc);
 
-static void weighted_vector_sumf(float *out, const float *in_a,
-                                 const float *in_b, float weight_coeff_a,
-                                 float weight_coeff_b, int length)
-{
-    int i;
-
-    for(i=0; i<length; i++)
-        out[i] = weight_coeff_a * in_a[i]
-               + weight_coeff_b * in_b[i];
-}
-
 /**
  * Initialize the speech codec according to the specification.
  *
@@ -174,7 +164,7 @@
             lspf[i-1] = FFMIN(lspf[i-1], (lspf[i] - QCELP_LSP_SPREAD_FACTOR));
 
         // Low-pass filter the LSP frequencies.
-        weighted_vector_sumf(lspf, lspf, q->prev_lspf, smooth, 1.0-smooth, 10);
+        ff_weighted_vector_sumf(lspf, lspf, q->prev_lspf, smooth, 1.0-smooth, 10);
     }else
     {
         q->octave_count = 0;
@@ -640,7 +630,7 @@
 
     if(weight != 1.0)
     {
-        weighted_vector_sumf(interpolated_lspf, curr_lspf, q->prev_lspf,
+        ff_weighted_vector_sumf(interpolated_lspf, curr_lspf, q->prev_lspf,
                              weight, 1.0 - weight, 10);
         lspf2lpc(interpolated_lspf, lpc);
     }else if(q->bitrate >= RATE_QUARTER ||