[FFmpeg-devel] [PATCH 0/7 v3] 22.2 channel layout support for AAC decoding

Jan Ekström jeebjp at gmail.com
Sat Aug 1 14:07:23 EEST 2020


The decoding parts of this patch set have not changed from v2.
I have now added changes so that 22.2 gets properly handled as
5.1 (for which it has backwards compatibility) until it gets a
proper remix matrix defined in swresample. So
 -channel_layout "5.1"` now has been verified to just re-utilize
the six first channels as-is, and stereo output gets downmixed
from these known six channels. 

Now that we actually have sample(s) for channel_config 13, it was possible
to see at which various points the AAC decoder fails attempting to parse
the bit stream.

As the feature `-request_channel_layout 9223372036854775808` (AV_CH_LAYOUT_NATIVE)
seems to work, the channel order has been validated both visually with
Audacity, as well as by logging the post-reorder element ordering:

(what specific CPE/SCE/LFE elements mean is documented in the
`avcodec/aacdectab: add mapping for 22.2` commit):

Setting layout map list after reorder...
tag 0 = { pos: (null) (3), syn_elem: CPE, elem_id: 1 }
tag 1 = { pos: FC (4), syn_elem: SCE, elem_id: 0 }
tag 2 = { pos: LFE (8), syn_elem: LFE, elem_id: 0 }
tag 3 = { pos: (null) (30), syn_elem: CPE, elem_id: 3 }
tag 4 = { pos: (null) (c0), syn_elem: CPE, elem_id: 0 }
tag 5 = { pos: BC (100), syn_elem: SCE, elem_id: 1 }
tag 6 = { pos: LFE2 (800000000), syn_elem: LFE, elem_id: 1 }
tag 7 = { pos: (null) (600), syn_elem: CPE, elem_id: 2 }
tag 8 = { pos: (null) (5000), syn_elem: CPE, elem_id: 4 }
tag 9 = { pos: TFC (2000), syn_elem: SCE, elem_id: 2 }
tag 10 = { pos: TC (800), syn_elem: SCE, elem_id: 3 }
tag 11 = { pos: (null) (28000), syn_elem: CPE, elem_id: 6 }
tag 12 = { pos: (null) (3000000000), syn_elem: CPE, elem_id: 5 }
tag 13 = { pos: TBC (10000), syn_elem: SCE, elem_id: 4 }
tag 14 = { pos: BFC (8000000000), syn_elem: SCE, elem_id: 5 }
tag 15 = { pos: (null) (14000000000), syn_elem: CPE, elem_id: 7 }

Jan Ekström (7):
  avutil/channel_layout: add 22.2 layout
  swresample/matrix: switch internal clean_layout function to not drop
    high bits
  swresample/rematrix: treat 22.2 as 5.1 (back) when mixing
  avcodec/mpeg4audio: add newer channel_coding mappings
  avcodec/aacdectab: add mapping for 22.2
  avcodec/aacdec_template: mark second LFE element as LFE2
  avcodec/aacdec_template: add support for 22.2 / channel_config 13

 doc/APIchanges               |  5 ++
 libavcodec/aacdec_template.c | 98 ++++++++++++++++++++++++++++++++----
 libavcodec/aacdectab.h       | 23 ++++++++-
 libavcodec/mpeg4audio.c      | 17 ++++++-
 libavcodec/mpeg4audio.h      |  2 +-
 libavutil/channel_layout.c   |  6 +++
 libavutil/channel_layout.h   |  6 +++
 libavutil/version.h          |  2 +-
 libswresample/rematrix.c     | 12 ++++-
 9 files changed, 153 insertions(+), 18 deletions(-)

-- 
2.26.2



More information about the ffmpeg-devel mailing list