[Vorbis-dev] oggdec channel ordering bug

Nicolas George nicolas.george at normalesup.org
Wed Jul 4 03:18:12 PDT 2012


Hi.

I just noticed that oggdec channel reordering for WAV is bogus.

With irrelevant clutter removed, oggenc has the following code:

	permute = {0,2,1,4,5,3}                 // oggenc/audio.c:401
	for (j)
	    to_vorbis[j] = from_wav[permute[j]] // oggenc/audio.c:619

While oggdec has the following code:

	permute = {0,2,1,5,3,4}                 // oggdec/oggdec.c:229
	for (j)
	    to_wav[permute[j]] = from_vorbis[j] // oggdec/oggdec.c:240

You can notice the permutation vectors are reciprocal to each other and that
the code apply them in the opposite direction. Both inversions cancel
each-other.

After more careful checking with the specs, oggenc is right and oggdec is
wrong.

Note that this is for 5.1; 5.0 seems even wronger and 6.1 and 7.1 are not
implemented.

The obvious fix is to copy-paste the matrix from oggenc to oggdec. Patch
attached.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-oggdec-import-permute-matrix-from-oggenc.patch
Type: text/x-diff
Size: 1550 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/vorbis-dev/attachments/20120704/8c9cbef0/attachment.patch 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
Url : http://lists.xiph.org/pipermail/vorbis-dev/attachments/20120704/8c9cbef0/attachment.pgp 


More information about the Vorbis-dev mailing list