[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec ac3enc.c,1.23,1.24

Michael Niedermayer CVS michael
Thu May 5 16:10:55 CEST 2005


Update of /cvsroot/ffmpeg/ffmpeg/libavcodec
In directory mail:/var2/tmp/cvs-serv24063/libavcodec

Modified Files:
	ac3enc.c 
Log Message:
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)


Index: ac3enc.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/ac3enc.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- ac3enc.c	29 Dec 2004 17:50:24 -0000	1.23
+++ ac3enc.c	5 May 2005 14:10:52 -0000	1.24
@@ -703,8 +703,10 @@
     /* audio blocks */
     for(i=0;i<NB_BLOCKS;i++) {
         frame_bits += s->nb_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 */





More information about the ffmpeg-cvslog mailing list