[FFmpeg-devel] Channel layouts for aac encoding/decoding and vorbis decoding

Robert Swain robert.swain
Mon Aug 10 14:24:35 CEST 2009


Hey,

2009/8/10 Alex Converse <alex.converse at gmail.com>:
> On Sun, Aug 9, 2009 at 8:59 PM, Jason Tackaberry<tack at urandom.ca> wrote:
>> [...]
>>
>> Some time last year, changes were made to ffmpeg with respect to
>> handling of multi-channel audio [2], the result of which seems to be a
>> normalization of most ffmpeg codecs to the SMPTE/ITU-R order (L R C LFE
>> Ls Rs for 6 channels). ?At least the ac3, dca, and flac codecs were
>> adjusted to decode (and encode for ac3) in this order.
>>
>> AAC and Vorbis are two potential anomalies that I'd like to ask about.
>> AAC in particular has different channel orders for decoding and encoding
>> of 6 channels. ?Decoding uses C L R LFE Ls Rs as defined in
>
> Looking at the code I also think it is C L R LFE (L R pairs) (the same
> for 5.1 but C L R LFE L R L R for 7.1)
>
> This was addressed in
> http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2008-November/055460.html
> but never resolved.
>
> Switching up the order that we iterate over types to (CPE (1), SCE
> (0), LFE (2), CCE (3)) should at least get us to L R C LFE (L R pairs)
>
>> aac.c:output_configure(). ?Encoding uses C L R Ls Rs LFE as defined in
>> aacenc.c:aac_chan_configs[].
>
> This is the AAC native channel order and is probably an artifact of
> convenience, channel ordering is near the bottom of my priority list
> for the AAC encoder (it needs work in lots of areas, spitting out
> legal 5.1 bitstreams comes well above that but still is ranked fairly
> low) but patches welcome.

First I want to find out what the channel layouts are supposed to be.
Then I think a mapping for the array of pointers for the output
interleaving can be created and used.

Looking at Table 1.17 - Channel Configuration in 14496-3:


1 channel
single_channel_element()
center front speaker

CH_LAYOUT_MONO


2 channels
channel_pair_element()
left, right front speakers

CH_LAYOUT_STEREO


3 channels
single_channel_element(), channel_pair_element()
center front speaker; left, right front speakers

CH_LAYOUT_SURROUND


4 channels
single_channel_element(), channel_pair_element(), single_channel_element()
center front speaker; left, right center front speakers; rear surround speakers

Rear surround sent as a single channel? Seems strange. I know it's not
the most reliable source but the Wikipedia page about surround sound
suggests (4.0 Dolby Pro Logic) that the 'rear surround speaker'
channel needs upmixing (duplicating) to the back left and back right
during playback. So, really I think it seems like it should be 4POINT0
if 'rear surround speakers' is interpreted as 'back center' and the
'left, right center front' are taken as FL, FR:

CH_LAYOUT_4POINT0 == CH_FRONT_LEFT|CH_FRONT_RIGHT|CH_FRONT_CENTER|CH_BACK_CENTER

Though I think strictly according to the AAC spec it should be (with
'upmixing' of the rear channel on playback:

CH_FRONT_CENTER|CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER|CH_BACK_CENTER

Comments?


5 channels
single_channel_element(), channel_pair_element(), channel_pair_element()
center front speaker; left, right front speakers; left surround, right
surround rear speakers

CH_LAYOUT_5POINT0_BACK ==
CH_FRONT_CENTER|CH_FRONT_LEFT|CH_FRONT_RIGHT|CH_BACK_LEFT|CH_BACK_RIGHT


6 channels (5.1)
single_channel_element(), channel_pair_element(),
channel_pair_element(), lfe _element()
center front speaker; left, right front speakers; left surround, right
surround rear speakers; front low frequency effects speaker

CH_LAYOUT_5POINT1_BACK ==
CH_FRONT_CENTER|CH_FRONT_LEFT|CH_FRONT_RIGHT|CH_BACK_LEFT|CH_BACK_RIGHT|CH_LOW_FREQUENCY


7 7+1 single_channel_element(),
channel_pair_element(),
channel_pair_element(),
channel_pair_element(),
lfe_element()
center front speaker
left, right center front speakers,
left, right outside front speakers,
left surround, right surround rear speakers,
front low frequency effects speaker

Are 'outside front' front left/right or side left/right?

CH_LAYOUT_7POINT1_WIDE ==
CH_FRONT_CENTER|CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER|CH_FRONT_LEFT|CH_FRONT_RIGHT|CH_BACK_LEFT|CH_BACK_RIGHT|CH_LOW_FREQUENCY

Regards,
Rob



More information about the ffmpeg-devel mailing list