diff aac.c @ 7788:ffd4b1364b62 libavcodec

Avoid duplicating compute_lpc_coefs() function in both the RA288 and AAC decoders.
author vitor
date Thu, 04 Sep 2008 11:03:14 +0000
parents 50a75afca76f
children 209a9ad96a6c
line wrap: on
line diff
--- a/aac.c	Wed Sep 03 19:04:46 2008 +0000
+++ b/aac.c	Thu Sep 04 11:03:14 2008 +0000
@@ -79,6 +79,7 @@
 #include "avcodec.h"
 #include "bitstream.h"
 #include "dsputil.h"
+#include "lpc.h"
 
 #include "aac.h"
 #include "aactab.h"
@@ -634,7 +635,7 @@
                 tmp2_idx = 2*coef_compress + coef_res;
 
                 for (i = 0; i < tns->order[w][filt]; i++)
-                    tns->coef[w][filt][i] = tns_tmp2_map[tmp2_idx][get_bits(gb, coef_len)];
+                    tns->coef[w][filt][i] = -tns_tmp2_map[tmp2_idx][get_bits(gb, coef_len)];
             }
         }
     }
@@ -1124,20 +1125,8 @@
             if (order == 0)
                 continue;
 
-            /* tns_decode_coef
-             * FIXME: This duplicates the functionality of some double code in lpc.c.
-             */
-            for (m = 0; m < order; m++) {
-                float tmp;
-                lpc[m] = tns->coef[w][filt][m];
-                for (i = 0; i < m/2; i++) {
-                    tmp = lpc[i];
-                    lpc[i]     += lpc[m] * lpc[m-1-i];
-                    lpc[m-1-i] += lpc[m] * tmp;
-                }
-                if(m & 1)
-                    lpc[i]     += lpc[m] * lpc[i];
-            }
+            // tns_decode_coef
+            compute_lpc_coefs(tns->coef[w][filt], order, lpc, 0, 0, 0);
 
             start = ics->swb_offset[FFMIN(bottom, mmm)];
             end   = ics->swb_offset[FFMIN(   top, mmm)];