[FFmpeg-cvslog] r25061 - in trunk/libavcodec: amrnbdec.c lsp.c lsp.h

vitor subversion
Tue Sep 7 22:44:42 CEST 2010


Author: vitor
Date: Tue Sep  7 22:44:41 2010
New Revision: 25061

Log:
Move AMRNB lsf2lsp() function to common code for using in future AMRWB decoder.

Patch by Marcelo Galv?o P?voa

Modified:
   trunk/libavcodec/amrnbdec.c
   trunk/libavcodec/lsp.c
   trunk/libavcodec/lsp.h

Modified: trunk/libavcodec/amrnbdec.c
==============================================================================
--- trunk/libavcodec/amrnbdec.c	Tue Sep  7 21:54:48 2010	(r25060)
+++ trunk/libavcodec/amrnbdec.c	Tue Sep  7 22:44:41 2010	(r25061)
@@ -222,20 +222,6 @@ static enum Mode unpack_bitstream(AMRCon
 /// @{
 
 /**
- * Convert an lsf vector into an lsp vector.
- *
- * @param lsf               input lsf vector
- * @param lsp               output lsp vector
- */
-static void lsf2lsp(const float *lsf, double *lsp)
-{
-    int i;
-
-    for (i = 0; i < LP_FILTER_ORDER; i++)
-        lsp[i] = cos(2.0 * M_PI * lsf[i]);
-}
-
-/**
  * Interpolate the LSF vector (used for fixed gain smoothing).
  * The interpolation is done over all four subframes even in MODE_12k2.
  *
@@ -293,7 +279,7 @@ static void lsf2lsp_for_mode12k2(AMRCont
     if (update)
         interpolate_lsf(p->lsf_q, lsf_q);
 
-    lsf2lsp(lsf_q, lsp);
+    ff_acelp_lsf2lspd(lsp, lsf_q, LP_FILTER_ORDER);
 }
 
 /**
@@ -357,7 +343,7 @@ static void lsf2lsp_3(AMRContext *p)
     interpolate_lsf(p->lsf_q, lsf_q);
     memcpy(p->prev_lsf_r, lsf_r, LP_FILTER_ORDER * sizeof(*lsf_r));
 
-    lsf2lsp(lsf_q, p->lsp[3]);
+    ff_acelp_lsf2lspd(p->lsp[3], lsf_q, LP_FILTER_ORDER);
 
     // interpolate LSP vectors at subframes 1, 2 and 3
     for (i = 1; i <= 3; i++)

Modified: trunk/libavcodec/lsp.c
==============================================================================
--- trunk/libavcodec/lsp.c	Tue Sep  7 21:54:48 2010	(r25060)
+++ trunk/libavcodec/lsp.c	Tue Sep  7 22:44:41 2010	(r25061)
@@ -65,6 +65,14 @@ void ff_acelp_lsf2lsp(int16_t *lsp, cons
         lsp[i] = ff_cos(lsf[i] * 20861 >> 15); // divide by PI and (0,13) -> (0,14)
 }
 
+void ff_acelp_lsf2lspd(double *lsp, const float *lsf, int lp_order)
+{
+    int i;
+
+    for(i = 0; i < lp_order; i++)
+        lsp[i] = cos(2.0 * M_PI * lsf[i]);
+}
+
 /**
  * \brief decodes polynomial coefficients from LSP
  * \param f [out] decoded polynomial coefficients (-0x20000000 <= (3.22) <= 0x1fffffff)

Modified: trunk/libavcodec/lsp.h
==============================================================================
--- trunk/libavcodec/lsp.h	Tue Sep  7 21:54:48 2010	(r25060)
+++ trunk/libavcodec/lsp.h	Tue Sep  7 22:44:41 2010	(r25061)
@@ -63,6 +63,11 @@ void ff_set_min_dist_lsf(float *lsf, dou
 void ff_acelp_lsf2lsp(int16_t *lsp, const int16_t *lsf, int lp_order);
 
 /**
+ * Floating point version of ff_acelp_lsf2lsp()
+ */
+void ff_acelp_lsf2lspd(double *lsp, const float *lsf, int lp_order);
+
+/**
  * \brief LSP to LP conversion (3.2.6 of G.729)
  * \param[out] lp decoded LP coefficients (-0x8000 <= (3.12) < 0x8000)
  * \param lsp LSP coefficients (-0x8000 <= (0.15) < 0x8000)



More information about the ffmpeg-cvslog mailing list