Revision 7d87d56f libavcodec/ac3enc.c
libavcodec/ac3enc.c  

587  587 
*/ 
588  588 
static void encode_exponents(AC3EncodeContext *s) 
589  589 
{ 
590 
int blk, blk1, blk2, ch; 

591 
AC3Block *block, *block1, *block2; 

590 
int blk, blk1, ch; 

591 
uint8_t *exp, *exp1, *exp_strategy; 

592 
int nb_coefs; 

592  593  
593  594 
for (ch = 0; ch < s>channels; ch++) { 
595 
exp = s>blocks[0].exp[ch]; 

596 
exp_strategy = s>exp_strategy[ch]; 

597 
nb_coefs = s>nb_coefs[ch]; 

598  
594  599 
blk = 0; 
595 
block = &s>blocks[0]; 

596  600 
while (blk < AC3_MAX_BLOCKS) { 
597  601 
blk1 = blk + 1; 
598 
block1 = block + 1;


602 
exp1 = exp + AC3_MAX_COEFS;


599  603 
/* for the EXP_REUSE case we select the min of the exponents */ 
600 
while (blk1 < AC3_MAX_BLOCKS && s>exp_strategy[ch][blk1] == EXP_REUSE) {


601 
exponent_min(block>exp[ch], block1>exp[ch], s>nb_coefs[ch]);


604 
while (blk1 < AC3_MAX_BLOCKS && exp_strategy[blk1] == EXP_REUSE) {


605 
exponent_min(exp, exp1, nb_coefs);


602  606 
blk1++; 
603 
block1++;


607 
exp1 += AC3_MAX_COEFS;


604  608 
} 
605 
encode_exponents_blk_ch(block>exp[ch], s>nb_coefs[ch],


606 
s>exp_strategy[ch][blk]);


609 
encode_exponents_blk_ch(exp, nb_coefs,


610 
exp_strategy[blk]);


607  611 
/* copy encoded exponents for reuse case */ 
608 
block2 = block + 1; 

609 
for (blk2 = blk+1; blk2 < blk1; blk2++, block2++) { 

610 
memcpy(block2>exp[ch], block>exp[ch], 

611 
s>nb_coefs[ch] * sizeof(uint8_t)); 

612 
exp1 = exp + AC3_MAX_COEFS; 

613 
while (blk < blk11) { 

614 
memcpy(exp1, exp, nb_coefs * sizeof(*exp)); 

615 
exp1 += AC3_MAX_COEFS; 

616 
blk++; 

612  617 
} 
613  618 
blk = blk1; 
614 
block = block1;


619 
exp = exp1;


615  620 
} 
616  621 
} 
617  622 
} 
Also available in: Unified diff