comparison 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
comparison
equal deleted inserted replaced
7787:681a05d9b04f 7788:ffd4b1364b62
77 77
78 78
79 #include "avcodec.h" 79 #include "avcodec.h"
80 #include "bitstream.h" 80 #include "bitstream.h"
81 #include "dsputil.h" 81 #include "dsputil.h"
82 #include "lpc.h"
82 83
83 #include "aac.h" 84 #include "aac.h"
84 #include "aactab.h" 85 #include "aactab.h"
85 #include "aacdectab.h" 86 #include "aacdectab.h"
86 #include "mpeg4audio.h" 87 #include "mpeg4audio.h"
632 coef_compress = get_bits1(gb); 633 coef_compress = get_bits1(gb);
633 coef_len = coef_res + 3 - coef_compress; 634 coef_len = coef_res + 3 - coef_compress;
634 tmp2_idx = 2*coef_compress + coef_res; 635 tmp2_idx = 2*coef_compress + coef_res;
635 636
636 for (i = 0; i < tns->order[w][filt]; i++) 637 for (i = 0; i < tns->order[w][filt]; i++)
637 tns->coef[w][filt][i] = tns_tmp2_map[tmp2_idx][get_bits(gb, coef_len)]; 638 tns->coef[w][filt][i] = -tns_tmp2_map[tmp2_idx][get_bits(gb, coef_len)];
638 } 639 }
639 } 640 }
640 } 641 }
641 return 0; 642 return 0;
642 } 643 }
1122 bottom = FFMAX(0, top - tns->length[w][filt]); 1123 bottom = FFMAX(0, top - tns->length[w][filt]);
1123 order = tns->order[w][filt]; 1124 order = tns->order[w][filt];
1124 if (order == 0) 1125 if (order == 0)
1125 continue; 1126 continue;
1126 1127
1127 /* tns_decode_coef 1128 // tns_decode_coef
1128 * FIXME: This duplicates the functionality of some double code in lpc.c. 1129 compute_lpc_coefs(tns->coef[w][filt], order, lpc, 0, 0, 0);
1129 */
1130 for (m = 0; m < order; m++) {
1131 float tmp;
1132 lpc[m] = tns->coef[w][filt][m];
1133 for (i = 0; i < m/2; i++) {
1134 tmp = lpc[i];
1135 lpc[i] += lpc[m] * lpc[m-1-i];
1136 lpc[m-1-i] += lpc[m] * tmp;
1137 }
1138 if(m & 1)
1139 lpc[i] += lpc[m] * lpc[i];
1140 }
1141 1130
1142 start = ics->swb_offset[FFMIN(bottom, mmm)]; 1131 start = ics->swb_offset[FFMIN(bottom, mmm)];
1143 end = ics->swb_offset[FFMIN( top, mmm)]; 1132 end = ics->swb_offset[FFMIN( top, mmm)];
1144 if ((size = end - start) <= 0) 1133 if ((size = end - start) <= 0)
1145 continue; 1134 continue;