Revision 5fc2e007 libavcodec/ac3enc.c
libavcodec/ac3enc.c | ||
---|---|---|
1289 | 1289 |
/** |
1290 | 1290 |
* Write one audio block to the output bitstream. |
1291 | 1291 |
*/ |
1292 |
static void output_audio_block(AC3EncodeContext *s, int block_num)
|
|
1292 |
static void output_audio_block(AC3EncodeContext *s, int blk)
|
|
1293 | 1293 |
{ |
1294 | 1294 |
int ch, i, baie, rbnd; |
1295 |
AC3Block *block = &s->blocks[block_num];
|
|
1295 |
AC3Block *block = &s->blocks[blk];
|
|
1296 | 1296 |
|
1297 | 1297 |
/* block switching */ |
1298 | 1298 |
for (ch = 0; ch < s->fbw_channels; ch++) |
... | ... | |
1306 | 1306 |
put_bits(&s->pb, 1, 0); |
1307 | 1307 |
|
1308 | 1308 |
/* channel coupling */ |
1309 |
if (!block_num) {
|
|
1309 |
if (!blk) {
|
|
1310 | 1310 |
put_bits(&s->pb, 1, 1); /* coupling strategy present */ |
1311 | 1311 |
put_bits(&s->pb, 1, 0); /* no coupling strategy */ |
1312 | 1312 |
} else { |
... | ... | |
1325 | 1325 |
|
1326 | 1326 |
/* exponent strategy */ |
1327 | 1327 |
for (ch = 0; ch < s->fbw_channels; ch++) |
1328 |
put_bits(&s->pb, 2, s->exp_strategy[ch][block_num]);
|
|
1328 |
put_bits(&s->pb, 2, s->exp_strategy[ch][blk]);
|
|
1329 | 1329 |
if (s->lfe_on) |
1330 |
put_bits(&s->pb, 1, s->exp_strategy[s->lfe_channel][block_num]);
|
|
1330 |
put_bits(&s->pb, 1, s->exp_strategy[s->lfe_channel][blk]);
|
|
1331 | 1331 |
|
1332 | 1332 |
/* bandwidth */ |
1333 | 1333 |
for (ch = 0; ch < s->fbw_channels; ch++) { |
1334 |
if (s->exp_strategy[ch][block_num] != EXP_REUSE)
|
|
1334 |
if (s->exp_strategy[ch][blk] != EXP_REUSE)
|
|
1335 | 1335 |
put_bits(&s->pb, 6, s->bandwidth_code[ch]); |
1336 | 1336 |
} |
1337 | 1337 |
|
... | ... | |
1339 | 1339 |
for (ch = 0; ch < s->channels; ch++) { |
1340 | 1340 |
int nb_groups; |
1341 | 1341 |
|
1342 |
if (s->exp_strategy[ch][block_num] == EXP_REUSE)
|
|
1342 |
if (s->exp_strategy[ch][blk] == EXP_REUSE)
|
|
1343 | 1343 |
continue; |
1344 | 1344 |
|
1345 | 1345 |
/* DC exponent */ |
1346 | 1346 |
put_bits(&s->pb, 4, block->grouped_exp[ch][0]); |
1347 | 1347 |
|
1348 | 1348 |
/* exponent groups */ |
1349 |
nb_groups = exponent_group_tab[s->exp_strategy[ch][block_num]-1][s->nb_coefs[ch]];
|
|
1349 |
nb_groups = exponent_group_tab[s->exp_strategy[ch][blk]-1][s->nb_coefs[ch]];
|
|
1350 | 1350 |
for (i = 1; i <= nb_groups; i++) |
1351 | 1351 |
put_bits(&s->pb, 7, block->grouped_exp[ch][i]); |
1352 | 1352 |
|
... | ... | |
1356 | 1356 |
} |
1357 | 1357 |
|
1358 | 1358 |
/* bit allocation info */ |
1359 |
baie = (block_num == 0);
|
|
1359 |
baie = (blk == 0);
|
|
1360 | 1360 |
put_bits(&s->pb, 1, baie); |
1361 | 1361 |
if (baie) { |
1362 | 1362 |
put_bits(&s->pb, 2, s->slow_decay_code); |
Also available in: Unified diff