# HG changeset patch # User vitor # Date 1217213747 0 # Node ID 21ecdb66d5b06c7f17b33b54ff5d9c53be927e85 # Parent 158d1acfe3bf7ddb810d2984d0b8d01b9eb39d48 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. diff -r 158d1acfe3bf -r 21ecdb66d5b0 ra288.c --- a/ra288.c Mon Jul 28 02:53:07 2008 +0000 +++ b/ra288.c Mon Jul 28 02:55:47 2008 +0000 @@ -153,6 +153,11 @@ /** * 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 @@ /* 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 @@ { 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))