Mercurial > libavcodec.hg
diff ac3enc.c @ 1408:4d67eb341a0c libavcodec
AC3 encoding patch ba (Ross Martin <ffmpeg at ross dot interwrx dot com>)
author | michaelni |
---|---|
date | Wed, 20 Aug 2003 07:57:00 +0000 |
parents | 1e39f273ecd6 |
children | 79dddc5cd990 |
line wrap: on
line diff
--- a/ac3enc.c Wed Aug 20 07:35:23 2003 +0000 +++ b/ac3enc.c Wed Aug 20 07:57:00 2003 +0000 @@ -978,7 +978,7 @@ int8_t global_exp[AC3_MAX_CHANNELS], int block_num) { - int ch, nb_groups, group_size, i, baie; + int ch, nb_groups, group_size, i, baie, rbnd; uint8_t *p; uint16_t qmant[AC3_MAX_CHANNELS][N/2]; int exp0, exp1; @@ -1000,14 +1000,28 @@ put_bits(&s->pb, 1, 0); /* no new coupling strategy */ } - if (s->acmod == 2) { - put_bits(&s->pb, 1, 0); /* no matrixing (but should be used in the future) */ - } + if (s->acmod == 2) + { + if(block_num==0) + { + /* first block must define rematrixing (rematstr) */ + put_bits(&s->pb, 1, 1); + + /* dummy rematrixing rematflg(1:4)=0 */ + for (rbnd=0;rbnd<4;rbnd++) + put_bits(&s->pb, 1, 0); + } + else + { + /* no matrixing (but should be used in the future) */ + put_bits(&s->pb, 1, 0); + } + } #if defined(DEBUG) { - static int count = 0; - printf("Block #%d (%d)\n", block_num, count++); + static int count = 0; + printf("Block #%d (%d)\n", block_num, count++); } #endif /* exponent strategy */ @@ -1329,7 +1343,8 @@ frame = s->pb.buf; n = 2 * s->frame_size - (pbBufPtr(&s->pb) - frame) - 2; assert(n >= 0); - memset(pbBufPtr(&s->pb), 0, n); + if(n>0) + memset(pbBufPtr(&s->pb), 0, n); /* Now we must compute both crcs : this is not so easy for crc1 because it is at the beginning of the data... */