Revision 0ce66801
libavcodec/ac3dec.c  

39  39 
#include "dsputil.h" 
40  40 
#include "random.h" 
41  41  
42 
static uint8_t bndtab[51]; 

43 
static uint8_t masktab[253]; 

44  
45  42 
static const int nfchans_tbl[8] = { 2, 1, 2, 3, 3, 4, 4, 5 }; 
46  43  
47  44 
/* table for exponent to scale_factor mapping 
...  ...  
49  46 
*/ 
50  47 
static float scale_factors[25]; 
51  48  
52 
static int16_t psdtab[25]; 

53  
54  49 
static int8_t exp_1[128]; 
55  50 
static int8_t exp_2[128]; 
56  51 
static int8_t exp_3[128]; 
...  ...  
272  267 
*/ 
273  268 
static void ac3_tables_init(void) 
274  269 
{ 
275 
int i, j, k, l, v; 

276 
/* compute bndtab and masktab from bandsz */ 

277 
k = 0; 

278 
l = 0; 

279 
for(i=0;i<50;i++) { 

280 
bndtab[i] = l; 

281 
v = ff_ac3_bndsz[i]; 

282 
for(j=0;j<v;j++) masktab[k++]=i; 

283 
l += v; 

284 
} 

285 
masktab[253] = masktab[254] = masktab[255] = 0; 

286 
bndtab[50] = 0; 

287  
288 
/* PSD Table For Mapping Exponents To PSD. */ 

289 
for (i = 0; i < 25; i++) 

290 
psdtab[i] = 3072  (i << 7); 

270 
int i, j, v; 

291  271  
292  272 
/* Exponent Decoding Tables */ 
293  273 
for (i = 0; i < 5; i++) { 
...  ...  
583  563 
} 
584  564 
} 
585  565  
586 
/* Check if snroffsets are zero. */ 

587 
static int is_snr_offsets_zero(AC3DecodeContext *ctx) 

588 
{ 

589 
int i; 

590  
591 
if ((ctx>csnroffst)  (ctx>cplinu && ctx>cplfsnroffst)  

592 
(ctx>lfeon && ctx>lfefsnroffst)) 

593 
return 0; 

594  
595 
for (i = 0; i < ctx>nfchans; i++) 

596 
if (ctx>fsnroffst[i]) 

597 
return 0; 

598  
599 
return 1; 

600 
} 

601  
602  566 
typedef struct { /* grouped mantissas for 3level 5leve and 11level quantization */ 
603  567 
int16_t l3_quantizers[3]; 
604  568 
int16_t l5_quantizers[3]; 
...  ...  
1674  1638 
} 
1675  1639  
1676  1640 
if (bit_alloc_flags) { 
1677 
if (is_snr_offsets_zero(ctx)) { 

1678 
memset(ctx>cplbap, 0, sizeof (ctx>cplbap)); 

1679 
memset(ctx>lfebap, 0, sizeof (ctx>lfebap)); 

1680 
for (i = 0; i < nfchans; i++) 

1681 
memset(ctx>bap[i], 0, sizeof(ctx>bap[i])); 

1682 
} else { 

1683  1641 
/* set bit allocation parameters */ 
1684  1642 
ctx>bit_alloc_params.fscod = ctx>fscod; 
1685  1643 
ctx>bit_alloc_params.halfratecod = 0; 
...  ...  
1698  1656 
do_bit_allocation(ctx, i); 
1699  1657 
if (ctx>lfeon && (bit_alloc_flags & 32)) 
1700  1658 
do_bit_allocation(ctx, 6); 
1701 
} 

1702  1659 
} 
1703  1660  
1704  1661 
if (get_bits1(gb)) { /* unused dummy data */ 
Also available in: Unified diff