# HG changeset patch # User michael # Date 1115302252 0 # Node ID 6ff5dc0dbaf0ae71ae3eeb91c0d2d7d40c81e54d # Parent 8e42a0463f6866ef170ff0a4fa51ef914e153c2b While adding stereo rematrixing, I came across something that needs to be fixed even without adding the feature. The output correctly uses 4 dummy values for the rematrixing flags in block-0, but the bit allocation routine does not take these bits into account. From what I can tell, there was a patch in 2003 that corrected the output to make it DVD and spec compatible, but it didn't correct the bit allocation. It's only 4 bits over the entire 6 blocks, so overflow errors would happen rarely or never, but it's still worth fixing. So here is a fix. patch by (Justin Ruggles {jruggle earthlink net) diff -r 8e42a0463f68 -r 6ff5dc0dbaf0 ac3enc.c --- a/ac3enc.c Thu May 05 13:40:28 2005 +0000 +++ b/ac3enc.c Thu May 05 14:10:52 2005 +0000 @@ -703,8 +703,10 @@ /* audio blocks */ for(i=0;inb_channels * 2 + 2; /* blksw * c, dithflag * c, dynrnge, cplstre */ - if (s->acmod == 2) + if (s->acmod == 2) { frame_bits++; /* rematstr */ + if(i==0) frame_bits += 4; + } frame_bits += 2 * s->nb_channels; /* chexpstr[2] * c */ if (s->lfe) frame_bits++; /* lfeexpstr */