Mercurial > libavcodec.hg
comparison ac3.c @ 10284:38e05838efc0 libavcodec
Cosmetics: Do some basic pretty-printing.
author | jbr |
---|---|
date | Sun, 27 Sep 2009 04:55:37 +0000 |
parents | a4b3121d4299 |
children | 4ce987b92348 |
comparison
equal
deleted
inserted
replaced
10283:a4b3121d4299 | 10284:38e05838efc0 |
---|---|
99 int16_t *band_psd) | 99 int16_t *band_psd) |
100 { | 100 { |
101 int bin, band; | 101 int bin, band; |
102 | 102 |
103 /* exponent mapping to PSD */ | 103 /* exponent mapping to PSD */ |
104 for(bin=start;bin<end;bin++) { | 104 for (bin = start; bin < end; bin++) { |
105 psd[bin]=(3072 - (exp[bin] << 7)); | 105 psd[bin]=(3072 - (exp[bin] << 7)); |
106 } | 106 } |
107 | 107 |
108 /* PSD integration */ | 108 /* PSD integration */ |
109 bin = start; | 109 bin = start; |
131 int bndstrt, bndend, begin, end1, tmp; | 131 int bndstrt, bndend, begin, end1, tmp; |
132 int lowcomp, fastleak, slowleak; | 132 int lowcomp, fastleak, slowleak; |
133 | 133 |
134 /* excitation function */ | 134 /* excitation function */ |
135 bndstrt = bin_to_band_tab[start]; | 135 bndstrt = bin_to_band_tab[start]; |
136 bndend = bin_to_band_tab[end-1] + 1; | 136 bndend = bin_to_band_tab[end-1] + 1; |
137 | 137 |
138 if (bndstrt == 0) { | 138 if (bndstrt == 0) { |
139 lowcomp = 0; | 139 lowcomp = 0; |
140 lowcomp = calc_lowcomp1(lowcomp, band_psd[0], band_psd[1], 384); | 140 lowcomp = calc_lowcomp1(lowcomp, band_psd[0], band_psd[1], 384); |
141 excite[0] = band_psd[0] - fast_gain - lowcomp; | 141 excite[0] = band_psd[0] - fast_gain - lowcomp; |
222 const uint8_t *bap_tab, uint8_t *bap) | 222 const uint8_t *bap_tab, uint8_t *bap) |
223 { | 223 { |
224 int i, j, k, end1, v, address; | 224 int i, j, k, end1, v, address; |
225 | 225 |
226 /* special case, if snr offset is -960, set all bap's to zero */ | 226 /* special case, if snr offset is -960, set all bap's to zero */ |
227 if(snr_offset == -960) { | 227 if (snr_offset == -960) { |
228 memset(bap, 0, 256); | 228 memset(bap, 0, 256); |
229 return; | 229 return; |
230 } | 230 } |
231 | 231 |
232 i = start; | 232 i = start; |
256 int16_t mask[50]; /* masking value */ | 256 int16_t mask[50]; /* masking value */ |
257 | 257 |
258 ff_ac3_bit_alloc_calc_psd(exp, start, end, psd, band_psd); | 258 ff_ac3_bit_alloc_calc_psd(exp, start, end, psd, band_psd); |
259 | 259 |
260 ff_ac3_bit_alloc_calc_mask(s, band_psd, start, end, fast_gain, is_lfe, | 260 ff_ac3_bit_alloc_calc_mask(s, band_psd, start, end, fast_gain, is_lfe, |
261 dba_mode, dba_nsegs, dba_offsets, dba_lengths, dba_values, | 261 dba_mode, dba_nsegs, dba_offsets, dba_lengths, |
262 mask); | 262 dba_values, mask); |
263 | 263 |
264 ff_ac3_bit_alloc_calc_bap(mask, psd, start, end, snr_offset, s->floor, | 264 ff_ac3_bit_alloc_calc_bap(mask, psd, start, end, snr_offset, s->floor, |
265 ff_ac3_bap_tab, bap); | 265 ff_ac3_bap_tab, bap); |
266 } | 266 } |
267 | 267 |
275 #if !CONFIG_HARDCODED_TABLES | 275 #if !CONFIG_HARDCODED_TABLES |
276 int i, j, k, l, v; | 276 int i, j, k, l, v; |
277 /* compute bndtab and masktab from bandsz */ | 277 /* compute bndtab and masktab from bandsz */ |
278 k = 0; | 278 k = 0; |
279 l = 0; | 279 l = 0; |
280 for(i=0;i<50;i++) { | 280 for (i = 0; i < 50; i++) { |
281 band_start_tab[i] = l; | 281 band_start_tab[i] = l; |
282 v = ff_ac3_critical_band_size_tab[i]; | 282 v = ff_ac3_critical_band_size_tab[i]; |
283 for(j=0;j<v;j++) bin_to_band_tab[k++]=i; | 283 for (j = 0; j < v; j++) |
284 bin_to_band_tab[k++] = i; | |
284 l += v; | 285 l += v; |
285 } | 286 } |
286 band_start_tab[50] = l; | 287 band_start_tab[50] = l; |
287 #endif /* !CONFIG_HARDCODED_TABLES */ | 288 #endif /* !CONFIG_HARDCODED_TABLES */ |
288 } | 289 } |