1
mirror of https://github.com/mpv-player/mpv synced 2024-11-03 03:19:24 +01:00

reorder_ch: support reordering 8 channels to AAC layout

This will allow us to encode 7.1 audio AAC.

7.1 audio not being really popular, instead of creating a new re_order
function, I'm using 2 functions for the re_ordering from

L R Ls Rs C LFE Rls Rrs   -->  C L R Ls Rs Rls Rrs LFE

Patch by Thierry Foucu [tfoucu gmail]

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34877 b3059339-0415-0410-9bf9-f77b7e298cf2
Author: ranma

http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2012-April/070252.html
This commit is contained in:
mplayer-svn 2012-04-24 21:01:15 +00:00 committed by wm4
parent 97f0ed25ed
commit 882f538efb

View File

@ -785,6 +785,9 @@ static int reorder_self_5_step_1(void *src, unsigned int samples,
if (chnum==6) {
REORDER_SELF_SWAP_5_STEP_1(src_8,tmp,samples,6,s0,s1,s2,s3,s4);
}
else if (chnum==8) {
REORDER_SELF_SWAP_5_STEP_1(src_8,tmp,samples,8,s0,s1,s2,s3,s4);
}
else {
REORDER_SELF_SWAP_5_STEP_1(src_8,tmp,samples,5,s0,s1,s2,s3,s4);
}
@ -797,6 +800,9 @@ static int reorder_self_5_step_1(void *src, unsigned int samples,
if (chnum==6) {
REORDER_SELF_SWAP_5_STEP_1(src_16,tmp,samples,6,s0,s1,s2,s3,s4);
}
else if (chnum==8) {
REORDER_SELF_SWAP_5_STEP_1(src_16,tmp,samples,8,s0,s1,s2,s3,s4);
}
else {
REORDER_SELF_SWAP_5_STEP_1(src_16,tmp,samples,5,s0,s1,s2,s3,s4);
}
@ -835,6 +841,9 @@ static int reorder_self_5_step_1(void *src, unsigned int samples,
if (chnum==6) {
REORDER_SELF_SWAP_5_STEP_1(src_32,tmp,samples,6,s0,s1,s2,s3,s4);
}
else if (chnum==8) {
REORDER_SELF_SWAP_5_STEP_1(src_32,tmp,samples,8,s0,s1,s2,s3,s4);
}
else {
REORDER_SELF_SWAP_5_STEP_1(src_32,tmp,samples,5,s0,s1,s2,s3,s4);
}
@ -847,6 +856,9 @@ static int reorder_self_5_step_1(void *src, unsigned int samples,
if (chnum==6) {
REORDER_SELF_SWAP_5_STEP_1(src_64,tmp,samples,6,s0,s1,s2,s3,s4);
}
else if (chnum==8) {
REORDER_SELF_SWAP_5_STEP_1(src_64,tmp,samples,8,s0,s1,s2,s3,s4);
}
else {
REORDER_SELF_SWAP_5_STEP_1(src_64,tmp,samples,5,s0,s1,s2,s3,s4);
}
@ -1250,6 +1262,7 @@ void reorder_channel(void *src,
// AF_CHANNEL_LAYOUT_7_1_A L R C LFE Ls Rs Rls Rrs
// AF_CHANNEL_LAYOUT_7_1_B L R Ls Rs C LFE Rls Rrs
// AF_CHANNEL_LAYOUT_7_1_C L C R Ls Rs LFE Rls Rrs
// AF_CHANNEL_LAYOUT_7_1_D C L R Ls Rs Rls Rrs LFE
// AF_CHANNEL_LAYOUT_7_1_F C L R LFE Ls Rs Rls Rrs
case AF_CHANNEL_LAYOUT_7_1_A << 16 | AF_CHANNEL_LAYOUT_7_1_B:
case AF_CHANNEL_LAYOUT_7_1_B << 16 | AF_CHANNEL_LAYOUT_7_1_A:
@ -1258,6 +1271,12 @@ void reorder_channel(void *src,
else
reorder_self_4_step_2(src, samples, samplesize, 8, 2, 3, 4, 5);
break;
case AF_CHANNEL_LAYOUT_7_1_B << 16 | AF_CHANNEL_LAYOUT_7_1_D:
// First convert to AF_CHANNEL_LAYOUT_7_1_F
reorder_self_2_4(src, samples, samplesize, 8, 3, 5, 4, 2, 1, 0);
// then convert to AF_CHANNEL_LAYOUT_7_1_D
reorder_self_5_step_1(src, samples, samplesize, 8, 3, 4, 5, 6, 7);
break;
case AF_CHANNEL_LAYOUT_7_1_C << 16 | AF_CHANNEL_LAYOUT_7_1_B:
reorder_self_4_step_1(src, samples, samplesize, 8, 1, 2, 3, 4);
break;