[FFmpeg-devel] [PATCH 1/3] avcodec/aacenc: Fix LFE layouts in PCE table

pkv.stream pkv.stream at gmail.com
Sun Oct 21 15:22:02 EEST 2018


For context , search for the discussion: aacenc: remove unsupported PCE 
mappings

-------------- next part --------------
From fb2b44216caa7b52d1a69ce4f03119c3473ebf45 Mon Sep 17 00:00:00 2001
From: pkviet <pkv.stream at gmail.com>
Date: Sun, 16 Sep 2018 01:41:52 +0200
Subject: [PATCH 1/3] avcodec/aacenc: Fix LFE layouts in PCE table

The LFE layouts were previously replaced by SCE due to bad ordering.
This was actually a problem with the aac native decoder not the encoder.
The commit reinstates LFE channels for layouts using them.
(some style fixes also)

Signed-off-by: pkviet <pkv.stream at gmail.com>
---
 libavcodec/aacenc.h | 156 ++++++++++++++++++++++++++--------------------------
 1 file changed, 78 insertions(+), 78 deletions(-)

diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h
index 5a015ca92e..da20affc38 100644
--- a/libavcodec/aacenc.h
+++ b/libavcodec/aacenc.h
@@ -155,7 +155,7 @@ static const AACPCEInfo aac_pce_configs[] = {
         .layout = AV_CH_LAYOUT_2POINT1,
         .num_ele = { 1, 0, 0, 1 },
         .pairing = { { 1 }, },
-        .index = { { 0 },{ 0 },{ 0 },{ 0 } },
+        .index = { { 0 }, { 0 }, { 0 }, { 0 } },
         .config_map = { 2, TYPE_CPE, TYPE_LFE },
         .reorder_map = { 0, 1, 2 },
     },
@@ -170,34 +170,34 @@ static const AACPCEInfo aac_pce_configs[] = {
     {
         .layout = AV_CH_LAYOUT_SURROUND,
         .num_ele = { 2, 0, 0, 0 },
-        .pairing = { { 1, 0 }, },
+        .pairing = { { 0, 1 }, },
         .index = { { 0, 0 }, },
-        .config_map = { 2, TYPE_CPE, TYPE_SCE, },
+        .config_map = { 2, TYPE_SCE, TYPE_CPE, },
         .reorder_map = { 0, 1, 2 },
     },
     {
         .layout = AV_CH_LAYOUT_3POINT1,
         .num_ele = { 2, 0, 0, 1 },
-        .pairing = { { 1, 0 }, },
+        .pairing = { { 0, 1 }, },
         .index = { { 0, 0 }, { 0 }, { 0 }, { 0 }, },
-        .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_LFE },
+        .config_map = { 3, TYPE_SCE, TYPE_CPE, TYPE_LFE },
         .reorder_map = { 0, 1, 2, 3 },
     },
     {
         .layout = AV_CH_LAYOUT_4POINT0,
         .num_ele = { 2, 0, 1, 0 },
-        .pairing = { { 1, 0 }, { 0 }, { 0 }, },
+        .pairing = { { 0, 1 }, { 0 }, { 0 }, },
         .index = { { 0, 0 }, { 0 }, { 1 } },
-        .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_SCE },
-        .reorder_map = {  0, 1, 2, 3 },
+        .config_map = { 3, TYPE_SCE, TYPE_CPE, TYPE_SCE },
+        .reorder_map = { 0, 1, 2, 3 },
     },
     {
         .layout = AV_CH_LAYOUT_4POINT1,
-        .num_ele = { 2, 1, 1, 0 },
-        .pairing = { { 1, 0 }, { 0 }, { 0 }, },
-        .index = { { 0, 0 }, { 1 }, { 2 }, { 0 } },
-        .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_SCE },
-        .reorder_map = { 0, 1, 2, 3, 4 },
+        .num_ele = { 2, 0, 1, 1 },
+        .pairing = { { 0, 1 }, { 0 }, { 0 }, },
+        .index = { { 0, 0 }, { 0 }, { 1 }, { 0 } },
+        .config_map = { 4, TYPE_SCE, TYPE_CPE, TYPE_SCE, TYPE_LFE },
+        .reorder_map = { 2, 0, 1, 4, 3 },
     },
     {
         .layout = AV_CH_LAYOUT_2_2,
@@ -218,140 +218,140 @@ static const AACPCEInfo aac_pce_configs[] = {
     {
         .layout = AV_CH_LAYOUT_5POINT0,
         .num_ele = { 2, 1, 0, 0 },
-        .pairing = { { 1, 0 }, { 1 }, },
+        .pairing = { { 0, 1 }, { 1 }, },
         .index = { { 0, 0 }, { 1 } },
-        .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_CPE },
+        .config_map = { 3, TYPE_SCE, TYPE_CPE, TYPE_CPE },
         .reorder_map = { 0, 1, 2, 3, 4 },
     },
     {
         .layout = AV_CH_LAYOUT_5POINT1,
-        .num_ele = { 2, 1, 1, 0 },
-        .pairing = { { 1, 0 }, { 0 }, { 1 }, },
-        .index = { { 0, 0 }, { 1 }, { 1 } },
-        .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE },
-        .reorder_map = { 0, 1, 2, 3, 4, 5 },
+        .num_ele = { 2, 1, 0, 1 },
+        .pairing = { { 0, 1 }, { 1 }, { 0 }, },
+        .index = { { 0, 0 }, { 1 }, { 0 }, { 0 } },
+        .config_map = { 4, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_LFE },
+        .reorder_map = { 2, 0, 1, 4, 5, 3 },
     },
     {
         .layout = AV_CH_LAYOUT_5POINT0_BACK,
         .num_ele = { 2, 0, 1, 0 },
-        .pairing = { { 1, 0 }, { 0 }, { 1 } },
+        .pairing = { { 0, 1 }, { 0 }, { 1 } },
         .index = { { 0, 0 }, { 0 }, { 1 } },
-        .config_map = { 3, TYPE_CPE, TYPE_SCE, TYPE_CPE },
+        .config_map = { 3, TYPE_SCE, TYPE_CPE, TYPE_CPE },
         .reorder_map = { 0, 1, 2, 3, 4 },
     },
     {
         .layout = AV_CH_LAYOUT_5POINT1_BACK,
-        .num_ele = { 2, 1, 1, 0 },
-        .pairing = { { 1, 0 }, { 0 }, { 1 }, },
-        .index = { { 0, 0 }, { 1 }, { 1 } },
-        .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE },
-        .reorder_map = { 0, 1, 2, 3, 4, 5 },
+        .num_ele = { 2, 0, 1, 1 },
+        .pairing = { { 0, 1 }, { 0 }, { 1 }, },
+        .index = { { 0, 0 }, { 0 }, { 1 }, { 0 } },
+        .config_map = { 4, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_LFE },
+        .reorder_map = { 2, 0, 1, 4, 5, 3 },
     },
     {
         .layout = AV_CH_LAYOUT_6POINT0,
         .num_ele = { 2, 1, 1, 0 },
-        .pairing = { { 1, 0 }, { 1 }, { 0 }, },
+        .pairing = { { 0, 1 }, { 1 }, { 0 }, },
         .index = { { 0, 0 }, { 1 }, { 1 } },
-        .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
+        .config_map = { 4, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_SCE },
         .reorder_map = { 0, 1, 2, 3, 4, 5 },
     },
     {
         .layout = AV_CH_LAYOUT_6POINT0_FRONT,
         .num_ele = { 2, 1, 0, 0 },
         .pairing = { { 1, 1 }, { 1 } },
-        .index = { { 1, 0 }, { 2 }, },
+        .index = { { 0, 1 }, { 2 }, },
         .config_map = { 3, TYPE_CPE, TYPE_CPE, TYPE_CPE, },
         .reorder_map = { 0, 1, 2, 3, 4, 5 },
     },
     {
         .layout = AV_CH_LAYOUT_HEXAGONAL,
         .num_ele = { 2, 0, 2, 0 },
-        .pairing = { { 1, 0 },{ 0 },{ 1, 0 }, },
-        .index = { { 0, 0 },{ 0 },{ 1, 1 } },
-        .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE, },
+        .pairing = { { 0, 1 }, { 0 }, { 1, 0 }, },
+        .index = { { 0, 0 }, { 0 }, { 1, 1 } },
+        .config_map = { 4, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_SCE, },
         .reorder_map = { 0, 1, 2, 3, 4, 5 },
     },
     {
         .layout = AV_CH_LAYOUT_6POINT1,
-        .num_ele = { 2, 1, 2, 0 },
-        .pairing = { { 1, 0 },{ 0 },{ 1, 0 }, },
-        .index = { { 0, 0 },{ 1 },{ 1, 2 } },
-        .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
-        .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
+        .num_ele = { 2, 1, 1, 1 },
+        .pairing = { { 0, 1 }, { 1 }, { 0 }, },
+        .index = { { 0, 0 }, { 1 }, { 1 }, { 0 } },
+        .config_map = { 5, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_SCE, TYPE_LFE },
+        .reorder_map = { 2, 0, 1, 4, 5, 6 , 3 },
     },
     {
         .layout = AV_CH_LAYOUT_6POINT1_BACK,
-        .num_ele = { 2, 1, 2, 0 },
-        .pairing = { { 1, 0 }, { 0 }, { 1, 0 }, },
-        .index = { { 0, 0 }, { 1 }, { 1, 2 } },
-        .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
-        .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
+        .num_ele = { 2, 0, 2, 1 },
+        .pairing = { { 0, 1 }, { 0 }, { 1, 0 }, },
+        .index = { { 0, 0 }, { 0 }, { 1, 1 }, { 0 } },
+        .config_map = { 5, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_SCE, TYPE_LFE },
+        .reorder_map = { 2, 0, 1, 4, 5, 6, 3 },
     },
     {
         .layout = AV_CH_LAYOUT_6POINT1_FRONT,
-        .num_ele = { 2, 1, 2, 0 },
-        .pairing = { { 1, 0 }, { 0 }, { 1, 0 }, },
-        .index = { { 0, 0 }, { 1 }, { 1, 2 } },
-        .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
-        .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
+        .num_ele = { 2, 1, 0, 1 },
+        .pairing = { { 1, 1 }, { 1 }, { 0 }, },
+        .index = { { 0, 1 }, { 2 }, { 0 }, { 0 }, },
+        .config_map = { 4, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_LFE },
+        .reorder_map = { 2, 0, 1, 4, 5, 6, 3 },
     },
     {
         .layout = AV_CH_LAYOUT_7POINT0,
         .num_ele = { 2, 1, 1, 0 },
-        .pairing = { { 1, 0 }, { 1 }, { 1 }, },
+        .pairing = { { 0, 1 }, { 1 }, { 1 }, },
         .index = { { 0, 0 }, { 1 }, { 2 }, },
-        .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
+        .config_map = { 4, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE },
         .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
     },
     {
         .layout = AV_CH_LAYOUT_7POINT0_FRONT,
-        .num_ele = { 2, 1, 1, 0 },
-        .pairing = { { 1, 0 }, { 1 }, { 1 }, },
-        .index = { { 0, 0 }, { 1 }, { 2 }, },
-        .config_map = { 4, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
+        .num_ele = { 3, 1, 0, 0 },
+        .pairing = { { 0, 1, 1 }, { 1 }, { 0 }, },
+        .index = { { 0, 0, 1 }, { 2 }, { 0 }, },
+        .config_map = { 4, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE },
         .reorder_map = { 0, 1, 2, 3, 4, 5, 6 },
     },
     {
         .layout = AV_CH_LAYOUT_7POINT1,
-        .num_ele = { 2, 1, 2, 0 },
-        .pairing = { { 1, 0 }, { 0 }, { 1, 1 }, },
-        .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } },
-        .config_map = { 5, TYPE_CPE, TYPE_SCE,  TYPE_SCE, TYPE_CPE, TYPE_CPE },
-        .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
+        .num_ele = { 2, 1, 1, 1 },
+        .pairing = { { 0, 1 }, { 1 }, { 1 }, },
+        .index = { { 0, 0 }, { 1 }, { 2 }, { 0 } },
+        .config_map = { 5, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_LFE},
+        .reorder_map = { 2, 0, 1, 6, 7, 4, 5, 3 },
     },
     {
         .layout = AV_CH_LAYOUT_7POINT1_WIDE,
-        .num_ele = { 2, 1, 2, 0 },
-        .pairing = { { 1, 0 }, { 0 },{  1, 1 }, },
-        .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } },
-        .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
-        .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
+        .num_ele = { 3, 1, 0, 1 },
+        .pairing = { { 0, 1, 1 }, { 1 },{ 0 }, },
+        .index = { { 0, 0, 1 }, { 2 }, { 0 }, { 0 } },
+        .config_map = { 5, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_LFE },
+        .reorder_map = { 2, 0, 1, 6, 7, 4, 5, 3 },
     },
     {
         .layout = AV_CH_LAYOUT_7POINT1_WIDE_BACK,
-        .num_ele = { 2, 1, 2, 0 },
-        .pairing = { { 1, 0 }, { 0 }, { 1, 1 }, },
-        .index = { { 0, 0 }, { 1 }, { 1, 2 }, { 0 } },
-        .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE },
-        .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
+        .num_ele = { 3, 0, 1, 1 },
+        .pairing = { { 0, 1, 1 }, { 0 }, { 1 }, },
+        .index = { { 0, 0 , 1 }, { 0 }, { 2 }, { 0 } },
+        .config_map = { 5, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_LFE },
+        .reorder_map = { 2, 0, 1, 6, 7, 4, 5, 3 },
     },
     {
         .layout = AV_CH_LAYOUT_OCTAGONAL,
         .num_ele = { 2, 1, 2, 0 },
-        .pairing = { { 1, 0 }, { 1 }, { 1, 0 }, },
+        .pairing = { { 0, 1 }, { 1 }, { 1, 0 }, },
         .index = { { 0, 0 }, { 1 }, { 2, 1 } },
-        .config_map = { 5, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_SCE },
+        .config_map = { 5, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_SCE },
         .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7 },
     },
-    {   /* Meant for order 2/mixed ambisonics */
+    {   /* Meant for order 2/mixed ambisonics; 9 channels; mask = 0xF37 */
         .layout = AV_CH_LAYOUT_OCTAGONAL | AV_CH_TOP_CENTER,
         .num_ele = { 2, 2, 2, 0 },
-        .pairing = { { 1, 0 }, { 1, 0 }, { 1, 0 }, },
+        .pairing = { { 0, 1 }, { 0, 1 }, { 1, 0 }, },
         .index = { { 0, 0 }, { 1, 1 }, { 2, 2 } },
-        .config_map = { 6, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
+        .config_map = { 6, TYPE_SCE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_SCE },
         .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8 },
     },
-    {   /* Meant for order 2/mixed ambisonics */
+    {   /* Meant for order 2/mixed ambisonics; provides 10 channels; mask = 0x FF3 */
         .layout = AV_CH_LAYOUT_6POINT0_FRONT | AV_CH_BACK_CENTER |
                   AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT | AV_CH_TOP_CENTER,
         .num_ele = { 2, 2, 2, 0 },
@@ -363,9 +363,9 @@ static const AACPCEInfo aac_pce_configs[] = {
     {
         .layout = AV_CH_LAYOUT_HEXADECAGONAL,
         .num_ele = { 4, 2, 4, 0 },
-        .pairing = { { 1, 0, 1, 0 }, { 1, 1 }, { 1, 0, 1, 0 }, },
-        .index = { { 0, 0, 1, 1 }, { 2, 3 }, { 4, 2, 5, 3 } },
-        .config_map = { 10, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_SCE, TYPE_CPE, TYPE_SCE },
+        .pairing = { { 0, 0, 1, 1 }, { 1, 1 }, { 1, 1, 0, 0 }, },
+        .index = { { 0, 1, 0, 1 }, { 2, 3 }, { 4, 5, 2, 3 } },
+        .config_map = { 10, TYPE_SCE, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_CPE, TYPE_SCE, TYPE_SCE },
         .reorder_map = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
     },
 };
-- 
2.16.2.windows.1



More information about the ffmpeg-devel mailing list