Fix attempt for 1399; if it doesn't completely correct the
authorMonty <xiphmont@xiph.org>
Fri, 11 Jul 2008 23:29:15 +0000 (23:29 +0000)
committerMonty <xiphmont@xiph.org>
Fri, 11 Jul 2008 23:29:15 +0000 (23:29 +0000)
multichannel corruption problem (encoder only), then it is a necessary
part of the fix.

(The encoder was accidentally collapsing the redidue bundle to remove
silent residues twice, potentiall causing corruption the second time
if a preceeding channel was silent)

svn path=/trunk/vorbis/; revision=15110

lib/mapping0.c

index 912b754..74b19b7 100644 (file)
@@ -722,7 +722,15 @@ static int mapping0_forward(vorbis_block *vb){
        
        classifications=_residue_P[ci->residue_type[resnum]]->
          class(vb,b->residue[resnum],couple_bundle,zerobundle,ch_in_bundle);
-       
+
+       /* couple_bundle is destructively overwritten by
+          the class function if some but not all of the channels are
+          marked as silence; build a fresh copy */
+       ch_in_bundle=0; 
+       for(j=0;j<vi->channels;j++)
+         if(info->chmuxlist[j]==i)
+           couple_bundle[ch_in_bundle++]=vb->pcm[j]+n/2;
+
        _residue_P[ci->residue_type[resnum]]->
          forward(opb,vb,b->residue[resnum],
                  couple_bundle,NULL,zerobundle,ch_in_bundle,classifications);