diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h
index 5a015ca92e..d970d0af05 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 },
     },
@@ -178,26 +178,26 @@ static const AACPCEInfo aac_pce_configs[] = {
     {
         .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 },
     },
 };
