Ivo Emanuel Gonçalves
2008-May-30 22:04 UTC
[Vorbis-dev] Request for Comments: multi-channel/32 bit WAV patch for oggenc
List, Some time ago, Jose A. Peirote (Tebasuna in the HA community) started a thread[1] in the HA forums to improve oggenc. He has since posted a patch[2] in Trac. I have tested it and it appears to work, though I have to confess not knowing much of multi-channel encoding (I only work with stereo). The other issues it supposedly fix seem to work, too, though I did not experiment with 4+ GB files since I don't have any lying around. It's also my understanding that some of those fixes are already available in John Edwards' oggenc. But I'm not going to commit it without feedback from the community. Please help testing. Jose has made available some WAV test files[3] that you should use to play around with the multi-channel encoding. Though I did request that he split his patch per issue he only posted this one and that's what we will have to work with. Now I leave you with some of his comments: "I have some improvements reflected in the attached file vorbis120.patch: 1) Major bug remapping channels. The values in wav_permute_matrix (oggenc\audio.c line 380) must be (instead the commented ones): {0,2,1,3,4}, // {0,1,2,3,4} {0,2,1,4,5,3} // {0,2,1,5,3,4} 2) New feature. Support for WAVE_FORMAT_EXTENSIBLE wav headers with only: if (format.format == WAVE_FORMAT_EXTENSIBLE && len > 25) format.format = READ_U16_LE(buf+24); 3) New feature. Support wav files 32 bits int. 4) New parameter --ignorelength. To support wav files > 4 GB or STDIN with datalength ignored." "If ogg, and flac, formats want support multichannel audio need manage correctly the channel order and: 1) The internal order is free but must store in header something like a ChannelMask (like acmod-lfeon in ac3). 2) The encoder need assume the uncompressed input channel order (raw or standard PCM wav file) is always the same: FL,FR,FC,LFE,BL,BR,... If a ChannelMask is supplied (by parameter or WAVE_FORMAT_EXTENSIBLE header) must be stored in ogg data. If isn't supplied a default (in function of the number of channels) must be assigned. 3) The decoder must do the inverse, and output always the same order." "A really mulltichannel support need: - Read and write WAVE_FORMAT_EXTENSIBLE wav files translating the MaskChannel to internal ogg format, to be recovered at output. - Read and write uncompressed files >4GB (wav, RF64 or w64 formats) to allow files with movie length (>4 GB is a 5.1, 24 bits, 83 min.) BTW, about the remapping bug, I can submit you two samples: FL-FR-FC-LF-BL-BR_WavOk.wav this is a correct multichannel wav and encoded with last oggenc produce: FL-FR-FC-LF-BL-BR_WavOk_OggBad.ogg with incorrect channel mapping. To obtain a correct ogg we need a bad wav mapped: FL-FR-FC-BR-LF-BL_WavBad.wav and after encoded is: FL-FR-FC-BR-LF-BL_WavBad_OggOk.ogg The audio is a channel test and played (wav or ogg) with Foobar2000 (or others) you can listen the problem in a 5.1 environment. You can use also ffdshow and see the channels in Volume tab." There's (a lot) more feedback in the HA thread. Please help testing/reviewing. -Ivo [1] http://www.hydrogenaudio.org/forums/index.php?showtopic=60755 [2] https://trac.xiph.org/ticket/1326 [3] http://spreadopenmedia.org/tmp/samples.7z