[FFmpeg-cvslog] r14447 - trunk/libavcodec/ra288.c

vitor subversion
Mon Jul 28 04:55:47 CEST 2008


Author: vitor
Date: Mon Jul 28 04:55:47 2008
New Revision: 14447

Log:
Change the way the input is passed to do_hybrid_filter(). Before, in[0] was 
the oldest input sample passed and in[n-1] was the latest. Now it is the 
contrary. This allows making backward_filter() somewhat simpler.


Modified:
   trunk/libavcodec/ra288.c

Modified: trunk/libavcodec/ra288.c
==============================================================================
--- trunk/libavcodec/ra288.c	(original)
+++ trunk/libavcodec/ra288.c	Mon Jul 28 04:55:47 2008
@@ -153,6 +153,11 @@ static void prodsum(float *tgt, const fl
 /**
  * Hybrid window filtering. See blocks 36 and 49 of the G.728 specification.
  *
+ * @note This function is slightly different from that described in the spec.
+ *       It expects in[0] to be the newest sample and in[n-1] to be the oldest
+ *       one stored. The spec has in the more ordinary way (in[0] the oldest
+ *       and in[n-1] the newest).
+ *
  * @param order   the order of the filter
  * @param n       the length of the input
  * @param non_rec the number of non-recursive samples
@@ -175,7 +180,9 @@ static void do_hybrid_window(int order, 
 
     /* update history */
     memmove(hist                  , hist + n, (order + non_rec)*sizeof(*hist));
-    memcpy (hist + order + non_rec, in      , n                *sizeof(*hist));
+
+    for (x=0; x < n; x++)
+        hist[order + non_rec + x] = in[n-x-1];
 
     colmult(work, window, hist, order + n + non_rec);
 
@@ -198,23 +205,14 @@ static void backward_filter(RA288Context
 {
     float temp1[37]; // RTMP in the spec
     float temp2[11]; // GPTPMP in the spec
-    float history[8];
-    float speech[40];
-    int i;
-
-    for (i=0 ; i < 8; i++)
-        history[i] = ractx->lhist[7-i];
 
-    for (i=0; i < 40; i++)
-        speech[i] = ractx->sb[39-i];
-
-    do_hybrid_window(36, 40, 35, speech, temp1, ractx->sp_hist,
+    do_hybrid_window(36, 40, 35, ractx->sb, temp1, ractx->sp_hist,
                      ractx->sp_rec, syn_window);
 
     if (!eval_lpc_coeffs(temp1, ractx->sp_lpc, 36))
         colmult(ractx->sp_lpc, ractx->sp_lpc, syn_bw_tab, 36);
 
-    do_hybrid_window(10, 8, 20, history, temp2, ractx->gain_hist,
+    do_hybrid_window(10, 8, 20, ractx->lhist, temp2, ractx->gain_hist,
                      ractx->gain_rec, gain_window);
 
     if (!eval_lpc_coeffs(temp2, ractx->gain_lpc, 10))




More information about the ffmpeg-cvslog mailing list