[vlc-devel] Re: your vlc audio patch

Jean-Alexis Montignies ja at sente.ch
Thu Jul 1 14:59:50 CEST 2004


On 1 juil. 04, at 13:52, Mark Wells wrote:

> Hello again
>
> I have been working on 5.0 and 5.1 audio environments under OS X. you 
> may remember that the 5-channel combination was incorrect, so I have 
> taken the advice given by Jean-Alexis and changed the channel ordering 
> array in vlc/modules/audio_filter/converter/a52tofloat32.c so that the 
> correct audio channels come out. This is what I have found:
>
> static const int translation[7][6] =
>     {{ 0, 0, 0, 0, 0, 0 },      /* 0 channels (rarely used) */
>     { 0, 0, 0, 0, 0, 0 },       /* 1 ch */
>     { 0, 1, 0, 0, 0, 0 },       /* 2 */
>     { 1, 2, 0, 0, 0, 0 },       /* 3 */
>     { 1, 3, 2, 0, 0, 0 },       /* 4 */
>     //{ 1, 3, 4, 2, 0, 0 },       /* 5 */ The incorrect old arrangement
>     { 0, 2, 3, 4, 1, 0 },       /* 5 */
>     { 1, 3, 4, 5, 2, 0 }};      /* 6 */
>
>
> I now have a couple of questions regarding where to go from here:
>
> a) I know that the 5.0 channel setup is now correct, but is it 
> expected that the arrangement is so different to 5.1?

The mapping for 5 channels in translation was for 3F1R+LFE mapping
So the correct mapping for 3F2R would have been (0,2,3,4,1,0). Good I 
found the same order as you do :).

It is no so different, it's just that the LFE  is added in the input 
stream at the beginning for 5.1, so all the numbers get incremented, 
and the LFE (0) added at the end.

However I looked at the code in liba52, it doesn't mix the LFE when the 
LFE is not asked so the basses may be lost.

> b) If I select the 5.1 audio option while my content only supports 
> 5.0, all the channels get swapped around. However, if I do the reverse 
> (ie select 5.0 audio but use some 5.1 content) then the results are 
> what I would expect logically - the LFE channel is simply ignored and 
> content effectively plays as 5.0. Why is this? Can I fix it so that 
> 5.0 content plays correctly in a 5.1 environment?
>
It could be that liba52 only outputs 5 channels while Interleave() is 
excpecting 6.

> c) The matrix above that determines channel allocation only goes up to 
> 6 channels. What happens for 7 or 8 channel audio and how do those 
> channels get assigned?
>
A mixer is added by vlc to processing chains which copies the channels 
1 and 2 to 7 and 8.

> Many thanks
>
> Mark Wells
>

I'm in the process in reingeneer this portion of code to do what's in 
the comments, that is to not only take into account the number of 
channels, but the configuration of liba52 so it would know the 
difference between for instance 3F1R and 2F2R (both are supported by 
liba52 and have 4 channels but require a different mapping).

So I propose you hack this function to work for your setup while 
waiting I fix it (unless you want to do it :) ), may be someone else 
could look in parallel the coreaudio.c code.
There is all what's needed in coreaudio for asking the current speaker 
configuration so that could be used to initialized 
output.i_original_channels value.
This value is used by a52toloat32 to configure liba52 downmixer.

The only settings to implement in vlc would be the device, and a choice 
of output channels as today (mono, stereo, surround, digital)

Comments and suggestions are welcome !

Jean-Alexis

http://www.sente.ch

-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html
If you are in trouble, please contact <postmaster at videolan.org>



More information about the vlc-devel mailing list