Mercurial > mplayer.hg
annotate libaf/reorder_ch.c @ 31474:133a32b2a5a5
Replace ever-growing-to-uglyness IS_* macros to by functions
and switch().
author | reimar |
---|---|
date | Wed, 23 Jun 2010 16:44:21 +0000 |
parents | 49c6bb4f97aa |
children | 91d62f0e2952 |
rev | line source |
---|---|
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1 /* |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
2 * common functions for reordering audio channels |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
3 * |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
4 * Copyright (C) 2007 Ulion <ulion A gmail P com> |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
5 * |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
6 * This file is part of MPlayer. |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
7 * |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
8 * MPlayer is free software; you can redistribute it and/or modify |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
11 * (at your option) any later version. |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
12 * |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
13 * MPlayer is distributed in the hope that it will be useful, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
17 * |
26740
b3a38b361fef
Use standard license headers with standard formatting.
diego
parents:
26132
diff
changeset
|
18 * You should have received a copy of the GNU General Public License along |
b3a38b361fef
Use standard license headers with standard formatting.
diego
parents:
26132
diff
changeset
|
19 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
b3a38b361fef
Use standard license headers with standard formatting.
diego
parents:
26132
diff
changeset
|
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
21 */ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
22 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
23 #include <stdio.h> |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
24 #include <stdlib.h> |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
25 #include <inttypes.h> |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
26 #include <string.h> |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
27 #include "libvo/fastmemcpy.h" |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
28 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
29 #include "reorder_ch.h" |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
30 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
31 #ifdef TEST |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
32 #define mp_msg(mod,lev, fmt, args... ) printf( fmt, ## args ) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
33 #else |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
34 #include "mp_msg.h" |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
35 #endif |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
36 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
37 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
38 #define REORDER_COPY_5(DEST,SRC,SAMPLES,S0,S1,S2,S3,S4) \ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
39 for (i = 0; i < SAMPLES; i += 5) {\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
40 DEST[i] = SRC[i+S0];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
41 DEST[i+1] = SRC[i+S1];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
42 DEST[i+2] = SRC[i+S2];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
43 DEST[i+3] = SRC[i+S3];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
44 DEST[i+4] = SRC[i+S4];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
45 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
46 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
47 static int reorder_copy_5ch(void *dest, const void *src, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
48 unsigned int samples, unsigned int samplesize, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
49 int s0, int s1, int s2, int s3, int s4) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
50 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
51 int i; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
52 switch (samplesize) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
53 case 1: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
54 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
55 int8_t *dest_8 = dest; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
56 const int8_t *src_8 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
57 REORDER_COPY_5(dest_8,src_8,samples,s0,s1,s2,s3,s4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
58 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
59 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
60 case 2: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
61 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
62 int16_t *dest_16 = dest; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
63 const int16_t *src_16 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
64 REORDER_COPY_5(dest_16,src_16,samples,s0,s1,s2,s3,s4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
65 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
66 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
67 case 3: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
68 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
69 int8_t *dest_8 = dest; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
70 const int8_t *src_8 = src; |
29929
49c6bb4f97aa
Fix mangling of 24-bit audio during channel reorder.
tack
parents:
29826
diff
changeset
|
71 for (i = 0; i < samples * 3; i += 15) { |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
72 dest_8[i] = src_8[i+s0*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
73 dest_8[i+1] = src_8[i+s0*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
74 dest_8[i+2] = src_8[i+s0*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
75 dest_8[i+3] = src_8[i+s1*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
76 dest_8[i+4] = src_8[i+s1*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
77 dest_8[i+5] = src_8[i+s1*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
78 dest_8[i+6] = src_8[i+s2*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
79 dest_8[i+7] = src_8[i+s2*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
80 dest_8[i+8] = src_8[i+s2*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
81 dest_8[i+9] = src_8[i+s3*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
82 dest_8[i+10] = src_8[i+s3*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
83 dest_8[i+11] = src_8[i+s3*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
84 dest_8[i+12] = src_8[i+s4*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
85 dest_8[i+13] = src_8[i+s4*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
86 dest_8[i+14] = src_8[i+s4*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
87 } |
29499
e8072b90858e
Fix channel reordering when using 24-bit samples by adding breaks to cases
tack
parents:
29491
diff
changeset
|
88 break; |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
89 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
90 case 4: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
91 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
92 int32_t *dest_32 = dest; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
93 const int32_t *src_32 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
94 REORDER_COPY_5(dest_32,src_32,samples,s0,s1,s2,s3,s4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
95 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
96 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
97 case 8: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
98 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
99 int64_t *dest_64 = dest; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
100 const int64_t *src_64 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
101 REORDER_COPY_5(dest_64,src_64,samples,s0,s1,s2,s3,s4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
102 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
103 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
104 default: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
105 mp_msg(MSGT_GLOBAL, MSGL_WARN, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
106 "[reorder_ch] Unsupported sample size: %d, please " |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
107 "report this error on the MPlayer mailing list.\n",samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
108 return 0; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
109 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
110 return 1; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
111 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
112 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
113 #define REORDER_COPY_6(DEST,SRC,SAMPLES,S0,S1,S2,S3,S4,S5) \ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
114 for (i = 0; i < SAMPLES; i += 6) {\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
115 DEST[i] = SRC[i+S0];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
116 DEST[i+1] = SRC[i+S1];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
117 DEST[i+2] = SRC[i+S2];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
118 DEST[i+3] = SRC[i+S3];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
119 DEST[i+4] = SRC[i+S4];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
120 DEST[i+5] = SRC[i+S5];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
121 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
122 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
123 static int reorder_copy_6ch(void *dest, const void *src, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
124 unsigned int samples, uint8_t samplesize, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
125 int s0, int s1, int s2, int s3, int s4, int s5) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
126 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
127 int i; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
128 switch (samplesize) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
129 case 1: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
130 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
131 int8_t *dest_8 = dest; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
132 const int8_t *src_8 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
133 REORDER_COPY_6(dest_8,src_8,samples,s0,s1,s2,s3,s4,s5); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
134 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
135 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
136 case 2: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
137 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
138 int16_t *dest_16 = dest; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
139 const int16_t *src_16 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
140 REORDER_COPY_6(dest_16,src_16,samples,s0,s1,s2,s3,s4,s5); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
141 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
142 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
143 case 3: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
144 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
145 int8_t *dest_8 = dest; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
146 const int8_t *src_8 = src; |
29929
49c6bb4f97aa
Fix mangling of 24-bit audio during channel reorder.
tack
parents:
29826
diff
changeset
|
147 for (i = 0; i < samples * 3; i += 18) { |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
148 dest_8[i] = src_8[i+s0*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
149 dest_8[i+1] = src_8[i+s0*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
150 dest_8[i+2] = src_8[i+s0*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
151 dest_8[i+3] = src_8[i+s1*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
152 dest_8[i+4] = src_8[i+s1*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
153 dest_8[i+5] = src_8[i+s1*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
154 dest_8[i+6] = src_8[i+s2*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
155 dest_8[i+7] = src_8[i+s2*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
156 dest_8[i+8] = src_8[i+s2*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
157 dest_8[i+9] = src_8[i+s3*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
158 dest_8[i+10] = src_8[i+s3*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
159 dest_8[i+11] = src_8[i+s3*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
160 dest_8[i+12] = src_8[i+s4*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
161 dest_8[i+13] = src_8[i+s4*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
162 dest_8[i+14] = src_8[i+s4*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
163 dest_8[i+15] = src_8[i+s5*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
164 dest_8[i+16] = src_8[i+s5*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
165 dest_8[i+17] = src_8[i+s5*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
166 } |
29499
e8072b90858e
Fix channel reordering when using 24-bit samples by adding breaks to cases
tack
parents:
29491
diff
changeset
|
167 break; |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
168 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
169 case 4: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
170 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
171 int32_t *dest_32 = dest; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
172 const int32_t *src_32 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
173 REORDER_COPY_6(dest_32,src_32,samples,s0,s1,s2,s3,s4,s5); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
174 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
175 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
176 case 8: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
177 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
178 int64_t *dest_64 = dest; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
179 const int64_t *src_64 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
180 REORDER_COPY_6(dest_64,src_64,samples,s0,s1,s2,s3,s4,s5); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
181 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
182 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
183 default: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
184 mp_msg(MSGT_GLOBAL, MSGL_WARN, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
185 "[reorder_ch] Unsupported sample size: %d, please " |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
186 "report this error on the MPlayer mailing list.\n",samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
187 return 0; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
188 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
189 return 1; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
190 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
191 |
29826 | 192 #define REORDER_COPY_8(DEST,SRC,SAMPLES,S0,S1,S2,S3,S4,S5,S6,S7) \ |
193 for (i = 0; i < SAMPLES; i += 8) {\ | |
194 DEST[i] = SRC[i+S0];\ | |
195 DEST[i+1] = SRC[i+S1];\ | |
196 DEST[i+2] = SRC[i+S2];\ | |
197 DEST[i+3] = SRC[i+S3];\ | |
198 DEST[i+4] = SRC[i+S4];\ | |
199 DEST[i+5] = SRC[i+S5];\ | |
200 DEST[i+6] = SRC[i+S6];\ | |
201 DEST[i+7] = SRC[i+S7];\ | |
202 } | |
203 | |
204 static int reorder_copy_8ch(void *dest, const void *src, | |
205 unsigned int samples, uint8_t samplesize, | |
206 int s0, int s1, int s2, int s3, | |
207 int s4, int s5, int s6, int s7) | |
208 { | |
209 int i; | |
210 switch (samplesize) { | |
211 case 1: | |
212 { | |
213 int8_t *dest_8 = dest; | |
214 const int8_t *src_8 = src; | |
215 REORDER_COPY_8(dest_8,src_8,samples,s0,s1,s2,s3,s4,s5,s6,s7); | |
216 break; | |
217 } | |
218 case 2: | |
219 { | |
220 int16_t *dest_16 = dest; | |
221 const int16_t *src_16 = src; | |
222 REORDER_COPY_8(dest_16,src_16,samples,s0,s1,s2,s3,s4,s5,s6,s7); | |
223 break; | |
224 } | |
225 case 3: | |
226 { | |
227 int8_t *dest_8 = dest; | |
228 const int8_t *src_8 = src; | |
29929
49c6bb4f97aa
Fix mangling of 24-bit audio during channel reorder.
tack
parents:
29826
diff
changeset
|
229 for (i = 0; i < samples * 3; i += 24) { |
29826 | 230 dest_8[i] = src_8[i+s0*3]; |
231 dest_8[i+1] = src_8[i+s0*3+1]; | |
232 dest_8[i+2] = src_8[i+s0*3+2]; | |
233 dest_8[i+3] = src_8[i+s1*3]; | |
234 dest_8[i+4] = src_8[i+s1*3+1]; | |
235 dest_8[i+5] = src_8[i+s1*3+2]; | |
236 dest_8[i+6] = src_8[i+s2*3]; | |
237 dest_8[i+7] = src_8[i+s2*3+1]; | |
238 dest_8[i+8] = src_8[i+s2*3+2]; | |
239 dest_8[i+9] = src_8[i+s3*3]; | |
240 dest_8[i+10] = src_8[i+s3*3+1]; | |
241 dest_8[i+11] = src_8[i+s3*3+2]; | |
242 dest_8[i+12] = src_8[i+s4*3]; | |
243 dest_8[i+13] = src_8[i+s4*3+1]; | |
244 dest_8[i+14] = src_8[i+s4*3+2]; | |
245 dest_8[i+15] = src_8[i+s5*3]; | |
246 dest_8[i+16] = src_8[i+s5*3+1]; | |
247 dest_8[i+17] = src_8[i+s5*3+2]; | |
248 dest_8[i+18] = src_8[i+s6*3]; | |
249 dest_8[i+19] = src_8[i+s6*3+1]; | |
250 dest_8[i+20] = src_8[i+s6*3+2]; | |
251 dest_8[i+21] = src_8[i+s7*3]; | |
252 dest_8[i+22] = src_8[i+s7*3+1]; | |
253 dest_8[i+23] = src_8[i+s7*3+2]; | |
254 } | |
255 break; | |
256 } | |
257 case 4: | |
258 { | |
259 int32_t *dest_32 = dest; | |
260 const int32_t *src_32 = src; | |
261 REORDER_COPY_8(dest_32,src_32,samples,s0,s1,s2,s3,s4,s5,s6,s7); | |
262 break; | |
263 } | |
264 case 8: | |
265 { | |
266 int64_t *dest_64 = dest; | |
267 const int64_t *src_64 = src; | |
268 REORDER_COPY_8(dest_64,src_64,samples,s0,s1,s2,s3,s4,s5,s6,s7); | |
269 break; | |
270 } | |
271 default: | |
272 mp_msg(MSGT_GLOBAL, MSGL_WARN, | |
273 "[reorder_ch] Unsupported sample size: %d, please " | |
274 "report this error on the MPlayer mailing list.\n",samplesize); | |
275 return 0; | |
276 } | |
277 return 1; | |
278 } | |
279 | |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
280 void reorder_channel_copy(void *src, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
281 int src_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
282 void *dest, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
283 int dest_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
284 int samples, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
285 int samplesize) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
286 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
287 if (dest_layout==src_layout) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
288 fast_memcpy(dest, src, samples*samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
289 return; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
290 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
291 if (!AF_IS_SAME_CH_NUM(dest_layout,src_layout)) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
292 mp_msg(MSGT_GLOBAL, MSGL_WARN, "[reorder_ch] different channel count " |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
293 "between src and dest: %x, %x\n", |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
294 AF_GET_CH_NUM_WITH_LFE(src_layout), |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
295 AF_GET_CH_NUM_WITH_LFE(dest_layout)); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
296 return; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
297 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
298 switch ((src_layout<<16)|dest_layout) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
299 // AF_CHANNEL_LAYOUT_5_0_A L R C Ls Rs |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
300 // AF_CHANNEL_LAYOUT_5_0_B L R Ls Rs C |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
301 // AF_CHANNEL_LAYOUT_5_0_C L C R Ls Rs |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
302 // AF_CHANNEL_LAYOUT_5_0_D C L R Ls Rs |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
303 case AF_CHANNEL_LAYOUT_5_0_A << 16 | AF_CHANNEL_LAYOUT_5_0_B: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
304 reorder_copy_5ch(dest, src, samples, samplesize, 0, 1, 3, 4, 2); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
305 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
306 case AF_CHANNEL_LAYOUT_5_0_A << 16 | AF_CHANNEL_LAYOUT_5_0_C: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
307 reorder_copy_5ch(dest, src, samples, samplesize, 0, 2, 1, 3, 4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
308 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
309 case AF_CHANNEL_LAYOUT_5_0_A << 16 | AF_CHANNEL_LAYOUT_5_0_D: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
310 reorder_copy_5ch(dest, src, samples, samplesize, 2, 0, 1, 3, 4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
311 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
312 case AF_CHANNEL_LAYOUT_5_0_B << 16 | AF_CHANNEL_LAYOUT_5_0_A: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
313 reorder_copy_5ch(dest, src, samples, samplesize, 0, 1, 4, 2, 3); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
314 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
315 case AF_CHANNEL_LAYOUT_5_0_B << 16 | AF_CHANNEL_LAYOUT_5_0_C: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
316 reorder_copy_5ch(dest, src, samples, samplesize, 0, 4, 1, 2, 3); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
317 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
318 case AF_CHANNEL_LAYOUT_5_0_B << 16 | AF_CHANNEL_LAYOUT_5_0_D: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
319 reorder_copy_5ch(dest, src, samples, samplesize, 4, 0, 1, 2, 3); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
320 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
321 case AF_CHANNEL_LAYOUT_5_0_C << 16 | AF_CHANNEL_LAYOUT_5_0_A: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
322 reorder_copy_5ch(dest, src, samples, samplesize, 0, 2, 1, 3, 4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
323 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
324 case AF_CHANNEL_LAYOUT_5_0_C << 16 | AF_CHANNEL_LAYOUT_5_0_B: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
325 reorder_copy_5ch(dest, src, samples, samplesize, 0, 2, 3, 4, 1); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
326 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
327 case AF_CHANNEL_LAYOUT_5_0_C << 16 | AF_CHANNEL_LAYOUT_5_0_D: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
328 reorder_copy_5ch(dest, src, samples, samplesize, 1, 0, 2, 3, 4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
329 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
330 case AF_CHANNEL_LAYOUT_5_0_D << 16 | AF_CHANNEL_LAYOUT_5_0_A: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
331 reorder_copy_5ch(dest, src, samples, samplesize, 1, 2, 0, 3, 4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
332 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
333 case AF_CHANNEL_LAYOUT_5_0_D << 16 | AF_CHANNEL_LAYOUT_5_0_B: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
334 reorder_copy_5ch(dest, src, samples, samplesize, 1, 2, 3, 4, 0); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
335 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
336 case AF_CHANNEL_LAYOUT_5_0_D << 16 | AF_CHANNEL_LAYOUT_5_0_C: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
337 reorder_copy_5ch(dest, src, samples, samplesize, 1, 0, 2, 3, 4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
338 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
339 // AF_CHANNEL_LAYOUT_5_1_A L R C LFE Ls Rs |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
340 // AF_CHANNEL_LAYOUT_5_1_B L R Ls Rs C LFE |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
341 // AF_CHANNEL_LAYOUT_5_1_C L C R Ls Rs LFE |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
342 // AF_CHANNEL_LAYOUT_5_1_D C L R Ls Rs LFE |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
343 // AF_CHANNEL_LAYOUT_5_1_E LFE L C R Ls Rs |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
344 case AF_CHANNEL_LAYOUT_5_1_A << 16 | AF_CHANNEL_LAYOUT_5_1_B: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
345 reorder_copy_6ch(dest, src, samples, samplesize, 0, 1, 4, 5, 2, 3); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
346 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
347 case AF_CHANNEL_LAYOUT_5_1_A << 16 | AF_CHANNEL_LAYOUT_5_1_C: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
348 reorder_copy_6ch(dest, src, samples, samplesize, 0, 2, 1, 4, 5, 3); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
349 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
350 case AF_CHANNEL_LAYOUT_5_1_A << 16 | AF_CHANNEL_LAYOUT_5_1_D: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
351 reorder_copy_6ch(dest, src, samples, samplesize, 2, 0, 1, 4, 5, 3); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
352 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
353 case AF_CHANNEL_LAYOUT_5_1_B << 16 | AF_CHANNEL_LAYOUT_5_1_A: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
354 reorder_copy_6ch(dest, src, samples, samplesize, 0, 1, 4, 5, 2, 3); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
355 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
356 case AF_CHANNEL_LAYOUT_5_1_B << 16 | AF_CHANNEL_LAYOUT_5_1_C: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
357 reorder_copy_6ch(dest, src, samples, samplesize, 0, 4, 1, 2, 3, 5); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
358 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
359 case AF_CHANNEL_LAYOUT_5_1_B << 16 | AF_CHANNEL_LAYOUT_5_1_D: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
360 reorder_copy_6ch(dest, src, samples, samplesize, 4, 0, 1, 2, 3, 5); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
361 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
362 case AF_CHANNEL_LAYOUT_5_1_B << 16 | AF_CHANNEL_LAYOUT_5_1_E: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
363 reorder_copy_6ch(dest, src, samples, samplesize, 5, 0, 4, 1, 2, 3); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
364 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
365 case AF_CHANNEL_LAYOUT_5_1_C << 16 | AF_CHANNEL_LAYOUT_5_1_A: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
366 reorder_copy_6ch(dest, src, samples, samplesize, 0, 2, 1, 5, 3, 4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
367 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
368 case AF_CHANNEL_LAYOUT_5_1_C << 16 | AF_CHANNEL_LAYOUT_5_1_B: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
369 reorder_copy_6ch(dest, src, samples, samplesize, 0, 2, 3, 4, 1, 5); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
370 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
371 case AF_CHANNEL_LAYOUT_5_1_C << 16 | AF_CHANNEL_LAYOUT_5_1_D: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
372 reorder_copy_6ch(dest, src, samples, samplesize, 1, 0, 2, 3, 4, 5); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
373 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
374 case AF_CHANNEL_LAYOUT_5_1_D << 16 | AF_CHANNEL_LAYOUT_5_1_A: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
375 reorder_copy_6ch(dest, src, samples, samplesize, 1, 2, 0, 5, 3, 4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
376 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
377 case AF_CHANNEL_LAYOUT_5_1_D << 16 | AF_CHANNEL_LAYOUT_5_1_B: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
378 reorder_copy_6ch(dest, src, samples, samplesize, 1, 2, 3, 4, 0, 5); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
379 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
380 case AF_CHANNEL_LAYOUT_5_1_D << 16 | AF_CHANNEL_LAYOUT_5_1_C: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
381 reorder_copy_6ch(dest, src, samples, samplesize, 1, 0, 2, 3, 4, 5); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
382 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
383 case AF_CHANNEL_LAYOUT_5_1_E << 16 | AF_CHANNEL_LAYOUT_5_1_B: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
384 reorder_copy_6ch(dest, src, samples, samplesize, 1, 3, 4, 5, 2, 0); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
385 break; |
29491
99eda963d27a
Fix incorrect channel ordering for lavc audio codecs (specifically ffac3,
tack
parents:
29385
diff
changeset
|
386 case AF_CHANNEL_LAYOUT_5_1_F << 16 | AF_CHANNEL_LAYOUT_5_1_B: |
99eda963d27a
Fix incorrect channel ordering for lavc audio codecs (specifically ffac3,
tack
parents:
29385
diff
changeset
|
387 reorder_copy_6ch(dest, src, samples, samplesize, 1, 2, 4, 5, 0, 3); |
99eda963d27a
Fix incorrect channel ordering for lavc audio codecs (specifically ffac3,
tack
parents:
29385
diff
changeset
|
388 break; |
29826 | 389 // AF_CHANNEL_LAYOUT_7_1_A L R C LFE Ls Rs Rls Rrs |
390 // AF_CHANNEL_LAYOUT_7_1_B L R Ls Rs C LFE Rls Rrs | |
391 // AF_CHANNEL_LAYOUT_7_1_D C L R Ls Rs Rls Rrs LFE | |
392 case AF_CHANNEL_LAYOUT_7_1_A << 16 | AF_CHANNEL_LAYOUT_7_1_B: | |
393 case AF_CHANNEL_LAYOUT_7_1_B << 16 | AF_CHANNEL_LAYOUT_7_1_A: | |
394 reorder_copy_8ch(dest, src, samples, samplesize, 0, 1, 4, 5, 2, 3, 6, 7); | |
395 break; | |
396 case AF_CHANNEL_LAYOUT_7_1_D << 16 | AF_CHANNEL_LAYOUT_7_1_B: | |
397 reorder_copy_8ch(dest, src, samples, samplesize, 1, 2, 3, 4, 0, 7, 5, 6); | |
398 break; | |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
399 default: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
400 mp_msg(MSGT_GLOBAL, MSGL_WARN, "[reorder_channel_copy] unsupport " |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
401 "from %x to %x, %d * %d\n", src_layout, dest_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
402 samples, samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
403 fast_memcpy(dest, src, samples*samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
404 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
405 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
406 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
407 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
408 #define REORDER_SELF_SWAP_2(SRC,TMP,SAMPLES,CHNUM,S0,S1) \ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
409 for (i = 0; i < SAMPLES; i += CHNUM) {\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
410 TMP = SRC[i+S0];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
411 SRC[i+S0] = SRC[i+S1];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
412 SRC[i+S1] = TMP;\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
413 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
414 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
415 static int reorder_self_2(void *src, unsigned int samples, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
416 unsigned int samplesize, unsigned int chnum, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
417 int s0, int s1) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
418 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
419 int i; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
420 switch (samplesize) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
421 case 1: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
422 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
423 int8_t *src_8 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
424 int8_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
425 if (chnum==6) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
426 REORDER_SELF_SWAP_2(src_8,tmp,samples,6,s0,s1); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
427 } |
29826 | 428 else if (chnum==8) { |
429 REORDER_SELF_SWAP_2(src_8,tmp,samples,8,s0,s1); | |
430 } | |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
431 else { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
432 REORDER_SELF_SWAP_2(src_8,tmp,samples,5,s0,s1); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
433 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
434 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
435 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
436 case 2: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
437 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
438 int16_t *src_16 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
439 int16_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
440 if (chnum==6) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
441 REORDER_SELF_SWAP_2(src_16,tmp,samples,6,s0,s1); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
442 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
443 else if (chnum==3) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
444 REORDER_SELF_SWAP_2(src_16,tmp,samples,3,s0,s1); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
445 } |
29826 | 446 else if (chnum==4) { |
447 REORDER_SELF_SWAP_2(src_16,tmp,samples,3,s0,s1); | |
448 } | |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
449 else { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
450 REORDER_SELF_SWAP_2(src_16,tmp,samples,5,s0,s1); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
451 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
452 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
453 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
454 case 3: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
455 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
456 int8_t *src_8 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
457 int8_t tmp0, tmp1, tmp2; |
29929
49c6bb4f97aa
Fix mangling of 24-bit audio during channel reorder.
tack
parents:
29826
diff
changeset
|
458 for (i = 0; i < samples * 3; i += chnum * 3) { |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
459 tmp0 = src_8[i+s0*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
460 tmp1 = src_8[i+s0*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
461 tmp2 = src_8[i+s0*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
462 src_8[i+s0*3] = src_8[i+s1*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
463 src_8[i+s0*3+1] = src_8[i+s1*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
464 src_8[i+s0*3+2] = src_8[i+s1*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
465 src_8[i+s1*3] = tmp0; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
466 src_8[i+s1*3+1] = tmp1; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
467 src_8[i+s1*3+2] = tmp2; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
468 } |
29499
e8072b90858e
Fix channel reordering when using 24-bit samples by adding breaks to cases
tack
parents:
29491
diff
changeset
|
469 break; |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
470 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
471 case 4: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
472 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
473 int32_t *src_32 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
474 int32_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
475 if (chnum==6) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
476 REORDER_SELF_SWAP_2(src_32,tmp,samples,6,s0,s1); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
477 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
478 else if (chnum==3) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
479 REORDER_SELF_SWAP_2(src_32,tmp,samples,3,s0,s1); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
480 } |
29826 | 481 else if (chnum==4) { |
482 REORDER_SELF_SWAP_2(src_32,tmp,samples,4,s0,s1); | |
483 } | |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
484 else { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
485 REORDER_SELF_SWAP_2(src_32,tmp,samples,5,s0,s1); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
486 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
487 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
488 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
489 case 8: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
490 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
491 int64_t *src_64 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
492 int64_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
493 if (chnum==6) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
494 REORDER_SELF_SWAP_2(src_64,tmp,samples,6,s0,s1); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
495 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
496 else if (chnum==3) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
497 REORDER_SELF_SWAP_2(src_64,tmp,samples,3,s0,s1); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
498 } |
29826 | 499 else if (chnum==4) { |
500 REORDER_SELF_SWAP_2(src_64,tmp,samples,4,s0,s1); | |
501 } | |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
502 else { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
503 REORDER_SELF_SWAP_2(src_64,tmp,samples,5,s0,s1); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
504 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
505 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
506 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
507 default: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
508 mp_msg(MSGT_GLOBAL, MSGL_WARN, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
509 "[reorder_ch] Unsupported sample size: %d, please " |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
510 "report this error on the MPlayer mailing list.\n",samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
511 return 0; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
512 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
513 return 1; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
514 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
515 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
516 #define REORDER_SELF_SWAP_3(SRC,TMP,SAMPLES,CHNUM,S0,S1,S2) \ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
517 for (i = 0; i < SAMPLES; i += CHNUM) {\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
518 TMP = SRC[i+S0];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
519 SRC[i+S0] = SRC[i+S1];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
520 SRC[i+S1] = SRC[i+S2];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
521 SRC[i+S2] = TMP;\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
522 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
523 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
524 static int reorder_self_3(void *src, unsigned int samples, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
525 unsigned int samplesize, unsigned int chnum, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
526 int s0, int s1, int s2) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
527 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
528 int i; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
529 switch (samplesize) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
530 case 1: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
531 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
532 int8_t *src_8 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
533 int8_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
534 if (chnum==6) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
535 REORDER_SELF_SWAP_3(src_8,tmp,samples,6,s0,s1,s2); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
536 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
537 else { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
538 REORDER_SELF_SWAP_3(src_8,tmp,samples,5,s0,s1,s2); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
539 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
540 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
541 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
542 case 2: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
543 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
544 int16_t *src_16 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
545 int16_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
546 if (chnum==6) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
547 REORDER_SELF_SWAP_3(src_16,tmp,samples,6,s0,s1,s2); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
548 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
549 else { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
550 REORDER_SELF_SWAP_3(src_16,tmp,samples,5,s0,s1,s2); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
551 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
552 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
553 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
554 case 3: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
555 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
556 int8_t *src_8 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
557 int8_t tmp0, tmp1, tmp2; |
29929
49c6bb4f97aa
Fix mangling of 24-bit audio during channel reorder.
tack
parents:
29826
diff
changeset
|
558 for (i = 0; i < samples * 3; i += chnum * 3) { |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
559 tmp0 = src_8[i+s0*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
560 tmp1 = src_8[i+s0*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
561 tmp2 = src_8[i+s0*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
562 src_8[i+s0*3] = src_8[i+s1*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
563 src_8[i+s0*3+1] = src_8[i+s1*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
564 src_8[i+s0*3+2] = src_8[i+s1*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
565 src_8[i+s1*3] = src_8[i+s2*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
566 src_8[i+s1*3+1] = src_8[i+s2*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
567 src_8[i+s1*3+2] = src_8[i+s2*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
568 src_8[i+s2*3] = tmp0; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
569 src_8[i+s2*3+1] = tmp1; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
570 src_8[i+s2*3+2] = tmp2; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
571 } |
29385 | 572 break; |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
573 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
574 case 4: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
575 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
576 int32_t *src_32 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
577 int32_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
578 if (chnum==6) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
579 REORDER_SELF_SWAP_3(src_32,tmp,samples,6,s0,s1,s2); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
580 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
581 else { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
582 REORDER_SELF_SWAP_3(src_32,tmp,samples,5,s0,s1,s2); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
583 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
584 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
585 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
586 case 8: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
587 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
588 int64_t *src_64 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
589 int64_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
590 if (chnum==6) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
591 REORDER_SELF_SWAP_3(src_64,tmp,samples,6,s0,s1,s2); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
592 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
593 else { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
594 REORDER_SELF_SWAP_3(src_64,tmp,samples,5,s0,s1,s2); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
595 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
596 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
597 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
598 default: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
599 mp_msg(MSGT_GLOBAL, MSGL_WARN, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
600 "[reorder_ch] Unsupported sample size: %d, please " |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
601 "report this error on the MPlayer mailing list.\n",samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
602 return 0; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
603 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
604 return 1; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
605 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
606 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
607 #define REORDER_SELF_SWAP_4_STEP_1(SRC,TMP,SAMPLES,CHNUM,S0,S1,S2,S3) \ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
608 for (i = 0; i < SAMPLES; i += CHNUM) {\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
609 TMP = SRC[i+S0];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
610 SRC[i+S0] = SRC[i+S1];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
611 SRC[i+S1] = SRC[i+S2];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
612 SRC[i+S2] = SRC[i+S3];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
613 SRC[i+S3] = TMP;\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
614 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
615 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
616 static int reorder_self_4_step_1(void *src, unsigned int samples, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
617 unsigned int samplesize, unsigned int chnum, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
618 int s0, int s1, int s2, int s3) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
619 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
620 int i; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
621 switch (samplesize) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
622 case 1: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
623 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
624 int8_t *src_8 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
625 int8_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
626 if (chnum==6) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
627 REORDER_SELF_SWAP_4_STEP_1(src_8,tmp,samples,6,s0,s1,s2,s3); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
628 } |
29826 | 629 else if (chnum==8) { |
630 REORDER_SELF_SWAP_4_STEP_1(src_8,tmp,samples,8,s0,s1,s2,s3); | |
631 } | |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
632 else { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
633 REORDER_SELF_SWAP_4_STEP_1(src_8,tmp,samples,5,s0,s1,s2,s3); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
634 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
635 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
636 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
637 case 2: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
638 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
639 int16_t *src_16 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
640 int16_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
641 if (chnum==6) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
642 REORDER_SELF_SWAP_4_STEP_1(src_16,tmp,samples,6,s0,s1,s2,s3); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
643 } |
29826 | 644 else if (chnum==8) { |
645 REORDER_SELF_SWAP_4_STEP_1(src_16,tmp,samples,8,s0,s1,s2,s3); | |
646 } | |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
647 else { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
648 REORDER_SELF_SWAP_4_STEP_1(src_16,tmp,samples,5,s0,s1,s2,s3); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
649 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
650 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
651 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
652 case 3: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
653 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
654 int8_t *src_8 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
655 int8_t tmp0, tmp1, tmp2; |
29929
49c6bb4f97aa
Fix mangling of 24-bit audio during channel reorder.
tack
parents:
29826
diff
changeset
|
656 for (i = 0; i < samples * 3; i += chnum * 3) { |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
657 tmp0 = src_8[i+s0*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
658 tmp1 = src_8[i+s0*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
659 tmp2 = src_8[i+s0*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
660 src_8[i+s0*3] = src_8[i+s1*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
661 src_8[i+s0*3+1] = src_8[i+s1*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
662 src_8[i+s0*3+2] = src_8[i+s1*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
663 src_8[i+s1*3] = src_8[i+s2*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
664 src_8[i+s1*3+1] = src_8[i+s2*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
665 src_8[i+s1*3+2] = src_8[i+s2*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
666 src_8[i+s2*3] = src_8[i+s3*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
667 src_8[i+s2*3+1] = src_8[i+s3*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
668 src_8[i+s2*3+2] = src_8[i+s3*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
669 src_8[i+s3*3] = tmp0; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
670 src_8[i+s3*3+1] = tmp1; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
671 src_8[i+s3*3+2] = tmp2; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
672 } |
29385 | 673 break; |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
674 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
675 case 4: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
676 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
677 int32_t *src_32 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
678 int32_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
679 if (chnum==6) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
680 REORDER_SELF_SWAP_4_STEP_1(src_32,tmp,samples,6,s0,s1,s2,s3); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
681 } |
29826 | 682 else if (chnum==8) { |
683 REORDER_SELF_SWAP_4_STEP_1(src_32,tmp,samples,8,s0,s1,s2,s3); | |
684 } | |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
685 else { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
686 REORDER_SELF_SWAP_4_STEP_1(src_32,tmp,samples,5,s0,s1,s2,s3); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
687 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
688 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
689 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
690 case 8: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
691 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
692 int64_t *src_64 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
693 int64_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
694 if (chnum==6) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
695 REORDER_SELF_SWAP_4_STEP_1(src_64,tmp,samples,6,s0,s1,s2,s3); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
696 } |
29826 | 697 else if (chnum==8) { |
698 REORDER_SELF_SWAP_4_STEP_1(src_64,tmp,samples,8,s0,s1,s2,s3); | |
699 } | |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
700 else { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
701 REORDER_SELF_SWAP_4_STEP_1(src_64,tmp,samples,5,s0,s1,s2,s3); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
702 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
703 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
704 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
705 default: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
706 mp_msg(MSGT_GLOBAL, MSGL_WARN, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
707 "[reorder_ch] Unsupported sample size: %d, please " |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
708 "report this error on the MPlayer mailing list.\n",samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
709 return 0; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
710 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
711 return 1; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
712 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
713 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
714 #define REORDER_SELF_SWAP_4_STEP_2(SRC,TMP,SAMPLES,CHNUM,S0,S1,S2,S3) \ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
715 for (i = 0; i < SAMPLES; i += CHNUM) {\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
716 TMP = SRC[i+S0];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
717 SRC[i+S0] = SRC[i+S2];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
718 SRC[i+S2] = TMP;\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
719 TMP = SRC[i+S1];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
720 SRC[i+S1] = SRC[i+S3];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
721 SRC[i+S3] = TMP;\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
722 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
723 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
724 static int reorder_self_4_step_2(void *src, unsigned int samples, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
725 unsigned int samplesize, unsigned int chnum, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
726 int s0, int s1, int s2, int s3) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
727 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
728 int i; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
729 switch (samplesize) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
730 case 3: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
731 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
732 int8_t *src_8 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
733 int8_t tmp0, tmp1, tmp2; |
29929
49c6bb4f97aa
Fix mangling of 24-bit audio during channel reorder.
tack
parents:
29826
diff
changeset
|
734 for (i = 0; i < samples * 3; i += chnum * 3) { |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
735 tmp0 = src_8[i+s0*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
736 tmp1 = src_8[i+s0*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
737 tmp2 = src_8[i+s0*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
738 src_8[i+s0*3] = src_8[i+s2*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
739 src_8[i+s0*3+1] = src_8[i+s2*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
740 src_8[i+s0*3+2] = src_8[i+s2*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
741 src_8[i+s2*3] = tmp0; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
742 src_8[i+s2*3+1] = tmp1; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
743 src_8[i+s2*3+2] = tmp2; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
744 tmp0 = src_8[i+s1*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
745 tmp1 = src_8[i+s1*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
746 tmp2 = src_8[i+s1*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
747 src_8[i+s1*3] = src_8[i+s3*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
748 src_8[i+s1*3+1] = src_8[i+s3*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
749 src_8[i+s1*3+2] = src_8[i+s3*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
750 src_8[i+s3*3] = tmp0; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
751 src_8[i+s3*3+1] = tmp1; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
752 src_8[i+s3*3+2] = tmp2; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
753 } |
29499
e8072b90858e
Fix channel reordering when using 24-bit samples by adding breaks to cases
tack
parents:
29491
diff
changeset
|
754 break; |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
755 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
756 default: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
757 mp_msg(MSGT_GLOBAL, MSGL_WARN, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
758 "[reorder_ch] Unsupported sample size: %d, please " |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
759 "report this error on the MPlayer mailing list.\n",samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
760 return 0; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
761 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
762 return 1; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
763 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
764 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
765 #define REORDER_SELF_SWAP_5_STEP_1(SRC,TMP,SAMPLES,CHNUM,S0,S1,S2,S3,S4) \ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
766 for (i = 0; i < SAMPLES; i += CHNUM) {\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
767 TMP = SRC[i+S0];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
768 SRC[i+S0] = SRC[i+S1];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
769 SRC[i+S1] = SRC[i+S2];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
770 SRC[i+S2] = SRC[i+S3];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
771 SRC[i+S3] = SRC[i+S4];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
772 SRC[i+S4] = TMP;\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
773 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
774 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
775 static int reorder_self_5_step_1(void *src, unsigned int samples, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
776 unsigned int samplesize, unsigned int chnum, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
777 int s0, int s1, int s2, int s3, int s4) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
778 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
779 int i; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
780 switch (samplesize) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
781 case 1: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
782 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
783 int8_t *src_8 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
784 int8_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
785 if (chnum==6) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
786 REORDER_SELF_SWAP_5_STEP_1(src_8,tmp,samples,6,s0,s1,s2,s3,s4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
787 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
788 else { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
789 REORDER_SELF_SWAP_5_STEP_1(src_8,tmp,samples,5,s0,s1,s2,s3,s4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
790 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
791 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
792 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
793 case 2: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
794 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
795 int16_t *src_16 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
796 int16_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
797 if (chnum==6) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
798 REORDER_SELF_SWAP_5_STEP_1(src_16,tmp,samples,6,s0,s1,s2,s3,s4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
799 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
800 else { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
801 REORDER_SELF_SWAP_5_STEP_1(src_16,tmp,samples,5,s0,s1,s2,s3,s4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
802 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
803 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
804 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
805 case 3: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
806 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
807 int8_t *src_8 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
808 int8_t tmp0, tmp1, tmp2; |
29929
49c6bb4f97aa
Fix mangling of 24-bit audio during channel reorder.
tack
parents:
29826
diff
changeset
|
809 for (i = 0; i < samples * 3; i += chnum * 3) { |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
810 tmp0 = src_8[i+s0*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
811 tmp1 = src_8[i+s0*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
812 tmp2 = src_8[i+s0*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
813 src_8[i+s0*3] = src_8[i+s1*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
814 src_8[i+s0*3+1] = src_8[i+s1*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
815 src_8[i+s0*3+2] = src_8[i+s1*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
816 src_8[i+s1*3] = src_8[i+s2*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
817 src_8[i+s1*3+1] = src_8[i+s2*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
818 src_8[i+s1*3+2] = src_8[i+s2*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
819 src_8[i+s2*3] = src_8[i+s3*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
820 src_8[i+s2*3+1] = src_8[i+s3*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
821 src_8[i+s2*3+2] = src_8[i+s3*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
822 src_8[i+s3*3] = src_8[i+s4*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
823 src_8[i+s3*3+1] = src_8[i+s4*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
824 src_8[i+s3*3+2] = src_8[i+s4*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
825 src_8[i+s4*3] = tmp0; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
826 src_8[i+s4*3+1] = tmp1; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
827 src_8[i+s4*3+2] = tmp2; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
828 } |
29385 | 829 break; |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
830 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
831 case 4: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
832 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
833 int32_t *src_32 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
834 int32_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
835 if (chnum==6) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
836 REORDER_SELF_SWAP_5_STEP_1(src_32,tmp,samples,6,s0,s1,s2,s3,s4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
837 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
838 else { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
839 REORDER_SELF_SWAP_5_STEP_1(src_32,tmp,samples,5,s0,s1,s2,s3,s4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
840 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
841 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
842 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
843 case 8: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
844 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
845 int64_t *src_64 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
846 int64_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
847 if (chnum==6) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
848 REORDER_SELF_SWAP_5_STEP_1(src_64,tmp,samples,6,s0,s1,s2,s3,s4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
849 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
850 else { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
851 REORDER_SELF_SWAP_5_STEP_1(src_64,tmp,samples,5,s0,s1,s2,s3,s4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
852 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
853 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
854 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
855 default: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
856 mp_msg(MSGT_GLOBAL, MSGL_WARN, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
857 "[reorder_ch] Unsupported sample size: %d, please " |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
858 "report this error on the MPlayer mailing list.\n",samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
859 return 0; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
860 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
861 return 1; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
862 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
863 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
864 #define REORDER_SELF_SWAP_2_3(SRC,TMP,SAMPLES,CHNUM,S0,S1,S2,S3,S4) \ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
865 for (i = 0; i < SAMPLES; i += CHNUM) {\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
866 TMP = SRC[i+S0];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
867 SRC[i+S0] = SRC[i+S1];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
868 SRC[i+S1] = TMP;\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
869 TMP = SRC[i+S2];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
870 SRC[i+S2] = SRC[i+S3];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
871 SRC[i+S3] = SRC[i+S4];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
872 SRC[i+S4] = TMP;\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
873 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
874 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
875 static int reorder_self_2_3(void *src, unsigned int samples, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
876 unsigned int samplesize, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
877 int s0, int s1, int s2, int s3, int s4) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
878 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
879 int i; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
880 switch (samplesize) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
881 case 1: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
882 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
883 int8_t *src_8 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
884 int8_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
885 REORDER_SELF_SWAP_2_3(src_8,tmp,samples,6,s0,s1,s2,s3,s4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
886 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
887 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
888 case 2: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
889 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
890 int16_t *src_16 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
891 int16_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
892 REORDER_SELF_SWAP_2_3(src_16,tmp,samples,6,s0,s1,s2,s3,s4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
893 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
894 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
895 case 3: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
896 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
897 int8_t *src_8 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
898 int8_t tmp0, tmp1, tmp2; |
29929
49c6bb4f97aa
Fix mangling of 24-bit audio during channel reorder.
tack
parents:
29826
diff
changeset
|
899 for (i = 0; i < samples * 3; i += 18) { |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
900 tmp0 = src_8[i+s0*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
901 tmp1 = src_8[i+s0*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
902 tmp2 = src_8[i+s0*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
903 src_8[i+s0*3] = src_8[i+s1*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
904 src_8[i+s0*3+1] = src_8[i+s1*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
905 src_8[i+s0*3+2] = src_8[i+s1*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
906 src_8[i+s1*3] = tmp0; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
907 src_8[i+s1*3+1] = tmp1; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
908 src_8[i+s1*3+2] = tmp2; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
909 tmp0 = src_8[i+s2*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
910 tmp1 = src_8[i+s2*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
911 tmp2 = src_8[i+s2*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
912 src_8[i+s2*3] = src_8[i+s3*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
913 src_8[i+s2*3+1] = src_8[i+s3*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
914 src_8[i+s2*3+2] = src_8[i+s3*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
915 src_8[i+s3*3] = src_8[i+s4*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
916 src_8[i+s3*3+1] = src_8[i+s4*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
917 src_8[i+s3*3+2] = src_8[i+s4*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
918 src_8[i+s4*3] = tmp0; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
919 src_8[i+s4*3+1] = tmp1; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
920 src_8[i+s4*3+2] = tmp2; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
921 } |
29385 | 922 break; |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
923 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
924 case 4: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
925 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
926 int32_t *src_32 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
927 int32_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
928 REORDER_SELF_SWAP_2_3(src_32,tmp,samples,6,s0,s1,s2,s3,s4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
929 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
930 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
931 case 8: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
932 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
933 int64_t *src_64 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
934 int64_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
935 REORDER_SELF_SWAP_2_3(src_64,tmp,samples,6,s0,s1,s2,s3,s4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
936 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
937 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
938 default: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
939 mp_msg(MSGT_GLOBAL, MSGL_WARN, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
940 "[reorder_ch] Unsupported sample size: %d, please " |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
941 "report this error on the MPlayer mailing list.\n",samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
942 return 0; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
943 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
944 return 1; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
945 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
946 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
947 #define REORDER_SELF_SWAP_3_3(SRC,TMP,SAMPLES,CHNUM,S0,S1,S2,S3,S4,S5) \ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
948 for (i = 0; i < SAMPLES; i += CHNUM) {\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
949 TMP = SRC[i+S0];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
950 SRC[i+S0] = SRC[i+S1];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
951 SRC[i+S1] = SRC[i+S2];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
952 SRC[i+S2] = TMP;\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
953 TMP = SRC[i+S3];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
954 SRC[i+S3] = SRC[i+S4];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
955 SRC[i+S4] = SRC[i+S5];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
956 SRC[i+S5] = TMP;\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
957 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
958 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
959 static int reorder_self_3_3(void *src, unsigned int samples, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
960 unsigned int samplesize, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
961 int s0, int s1, int s2, int s3, int s4, int s5) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
962 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
963 int i; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
964 switch (samplesize) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
965 case 1: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
966 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
967 int8_t *src_8 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
968 int8_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
969 REORDER_SELF_SWAP_3_3(src_8,tmp,samples,6,s0,s1,s2,s3,s4,s5); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
970 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
971 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
972 case 2: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
973 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
974 int16_t *src_16 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
975 int16_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
976 REORDER_SELF_SWAP_3_3(src_16,tmp,samples,6,s0,s1,s2,s3,s4,s5); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
977 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
978 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
979 case 3: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
980 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
981 int8_t *src_8 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
982 int8_t tmp0, tmp1, tmp2; |
29929
49c6bb4f97aa
Fix mangling of 24-bit audio during channel reorder.
tack
parents:
29826
diff
changeset
|
983 for (i = 0; i < samples * 3; i += 18) { |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
984 tmp0 = src_8[i+s0*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
985 tmp1 = src_8[i+s0*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
986 tmp2 = src_8[i+s0*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
987 src_8[i+s0*3] = src_8[i+s1*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
988 src_8[i+s0*3+1] = src_8[i+s1*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
989 src_8[i+s0*3+2] = src_8[i+s1*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
990 src_8[i+s1*3] = src_8[i+s2*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
991 src_8[i+s1*3+1] = src_8[i+s2*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
992 src_8[i+s1*3+2] = src_8[i+s2*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
993 src_8[i+s2*3] = tmp0; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
994 src_8[i+s2*3+1] = tmp1; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
995 src_8[i+s2*3+2] = tmp2; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
996 tmp0 = src_8[i+s3*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
997 tmp1 = src_8[i+s3*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
998 tmp2 = src_8[i+s3*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
999 src_8[i+s3*3] = src_8[i+s4*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1000 src_8[i+s3*3+1] = src_8[i+s4*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1001 src_8[i+s3*3+2] = src_8[i+s4*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1002 src_8[i+s4*3] = src_8[i+s5*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1003 src_8[i+s4*3+1] = src_8[i+s5*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1004 src_8[i+s4*3+2] = src_8[i+s5*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1005 src_8[i+s5*3] = tmp0; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1006 src_8[i+s5*3+1] = tmp1; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1007 src_8[i+s5*3+2] = tmp2; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1008 } |
29385 | 1009 break; |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1010 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1011 case 4: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1012 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1013 int32_t *src_32 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1014 int32_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1015 REORDER_SELF_SWAP_3_3(src_32,tmp,samples,6,s0,s1,s2,s3,s4,s5); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1016 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1017 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1018 case 8: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1019 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1020 int64_t *src_64 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1021 int64_t tmp; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1022 REORDER_SELF_SWAP_3_3(src_64,tmp,samples,6,s0,s1,s2,s3,s4,s5); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1023 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1024 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1025 default: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1026 mp_msg(MSGT_GLOBAL, MSGL_WARN, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1027 "[reorder_ch] Unsupported sample size: %d, please " |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1028 "report this error on the MPlayer mailing list.\n",samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1029 return 0; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1030 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1031 return 1; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1032 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1033 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1034 #define REORDER_SELF_SWAP_2_4(SRC,TMP,SAMPLES,CHNUM,S0,S1,S2,S3,S4,S5) \ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1035 for (i = 0; i < SAMPLES; i += CHNUM) {\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1036 TMP = SRC[i+S0];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1037 SRC[i+S0] = SRC[i+S1];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1038 SRC[i+S1] = TMP;\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1039 TMP = SRC[i+S2];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1040 SRC[i+S2] = SRC[i+S3];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1041 SRC[i+S3] = SRC[i+S4];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1042 SRC[i+S4] = SRC[i+S5];\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1043 SRC[i+S5] = TMP;\ |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1044 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1045 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1046 static int reorder_self_2_4(void *src, unsigned int samples, |
29826 | 1047 unsigned int samplesize, int chnum, |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1048 int s0, int s1, int s2, int s3, int s4, int s5) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1049 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1050 int i; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1051 switch (samplesize) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1052 case 1: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1053 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1054 int8_t *src_8 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1055 int8_t tmp; |
29826 | 1056 if (chnum==6) { |
1057 REORDER_SELF_SWAP_2_4(src_8,tmp,samples,6,s0,s1,s2,s3,s4,s5); | |
1058 } else { | |
1059 REORDER_SELF_SWAP_2_4(src_8,tmp,samples,8,s0,s1,s2,s3,s4,s5); | |
1060 } | |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1061 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1062 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1063 case 2: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1064 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1065 int16_t *src_16 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1066 int16_t tmp; |
29826 | 1067 if (chnum==6) { |
1068 REORDER_SELF_SWAP_2_4(src_16,tmp,samples,6,s0,s1,s2,s3,s4,s5); | |
1069 } else { | |
1070 REORDER_SELF_SWAP_2_4(src_16,tmp,samples,8,s0,s1,s2,s3,s4,s5); | |
1071 } | |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1072 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1073 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1074 case 3: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1075 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1076 int8_t *src_8 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1077 int8_t tmp0, tmp1, tmp2; |
29929
49c6bb4f97aa
Fix mangling of 24-bit audio during channel reorder.
tack
parents:
29826
diff
changeset
|
1078 for (i = 0; i < samples * 3; i += chnum * 3) { |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1079 tmp0 = src_8[i+s0*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1080 tmp1 = src_8[i+s0*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1081 tmp2 = src_8[i+s0*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1082 src_8[i+s0*3] = src_8[i+s1*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1083 src_8[i+s0*3+1] = src_8[i+s1*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1084 src_8[i+s0*3+2] = src_8[i+s1*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1085 src_8[i+s1*3] = tmp0; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1086 src_8[i+s1*3+1] = tmp1; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1087 src_8[i+s1*3+2] = tmp2; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1088 tmp0 = src_8[i+s2*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1089 tmp1 = src_8[i+s2*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1090 tmp2 = src_8[i+s2*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1091 src_8[i+s2*3] = src_8[i+s3*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1092 src_8[i+s2*3+1] = src_8[i+s3*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1093 src_8[i+s2*3+2] = src_8[i+s3*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1094 src_8[i+s3*3] = src_8[i+s4*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1095 src_8[i+s3*3+1] = src_8[i+s4*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1096 src_8[i+s3*3+2] = src_8[i+s4*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1097 src_8[i+s4*3] = src_8[i+s5*3]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1098 src_8[i+s4*3+1] = src_8[i+s5*3+1]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1099 src_8[i+s4*3+2] = src_8[i+s5*3+2]; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1100 src_8[i+s5*3] = tmp0; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1101 src_8[i+s5*3+1] = tmp1; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1102 src_8[i+s5*3+2] = tmp2; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1103 } |
29385 | 1104 break; |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1105 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1106 case 4: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1107 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1108 int32_t *src_32 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1109 int32_t tmp; |
29826 | 1110 if (chnum==6) { |
1111 REORDER_SELF_SWAP_2_4(src_32,tmp,samples,6,s0,s1,s2,s3,s4,s5); | |
1112 } else { | |
1113 REORDER_SELF_SWAP_2_4(src_32,tmp,samples,8,s0,s1,s2,s3,s4,s5); | |
1114 } | |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1115 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1116 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1117 case 8: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1118 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1119 int64_t *src_64 = src; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1120 int64_t tmp; |
29826 | 1121 if (chnum==6) { |
1122 REORDER_SELF_SWAP_2_4(src_64,tmp,samples,6,s0,s1,s2,s3,s4,s5); | |
1123 } else { | |
1124 REORDER_SELF_SWAP_2_4(src_64,tmp,samples,8,s0,s1,s2,s3,s4,s5); | |
1125 } | |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1126 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1127 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1128 default: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1129 mp_msg(MSGT_GLOBAL, MSGL_WARN, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1130 "[reorder_ch] Unsupported sample size: %d, please " |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1131 "report this error on the MPlayer mailing list.\n",samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1132 return 0; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1133 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1134 return 1; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1135 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1136 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1137 void reorder_channel(void *src, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1138 int src_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1139 int dest_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1140 int samples, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1141 int samplesize) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1142 { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1143 if (dest_layout==src_layout) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1144 return; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1145 if (!AF_IS_SAME_CH_NUM(dest_layout,src_layout)) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1146 mp_msg(MSGT_GLOBAL, MSGL_WARN, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1147 "[reorder_channel] different channel count " |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1148 "between current and target: %x, %x\n", |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1149 AF_GET_CH_NUM_WITH_LFE(src_layout), |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1150 AF_GET_CH_NUM_WITH_LFE(dest_layout)); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1151 return; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1152 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1153 switch ((src_layout<<16)|dest_layout) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1154 // AF_CHANNEL_LAYOUT_5_0_A L R C Ls Rs |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1155 // AF_CHANNEL_LAYOUT_5_0_B L R Ls Rs C |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1156 // AF_CHANNEL_LAYOUT_5_0_C L C R Ls Rs |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1157 // AF_CHANNEL_LAYOUT_5_0_D C L R Ls Rs |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1158 case AF_CHANNEL_LAYOUT_5_0_A << 16 | AF_CHANNEL_LAYOUT_5_0_B: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1159 reorder_self_3(src, samples, samplesize, 5, 2, 3, 4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1160 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1161 case AF_CHANNEL_LAYOUT_5_0_A << 16 | AF_CHANNEL_LAYOUT_5_0_C: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1162 reorder_self_2(src, samples, samplesize, 5, 1, 2); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1163 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1164 case AF_CHANNEL_LAYOUT_5_0_A << 16 | AF_CHANNEL_LAYOUT_5_0_D: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1165 reorder_self_3(src, samples, samplesize, 5, 2, 1, 0); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1166 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1167 case AF_CHANNEL_LAYOUT_5_0_B << 16 | AF_CHANNEL_LAYOUT_5_0_A: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1168 reorder_self_3(src, samples, samplesize, 5, 4, 3, 2); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1169 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1170 case AF_CHANNEL_LAYOUT_5_0_B << 16 | AF_CHANNEL_LAYOUT_5_0_C: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1171 reorder_self_4_step_1(src, samples, samplesize, 5, 4, 3, 2, 1); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1172 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1173 case AF_CHANNEL_LAYOUT_5_0_B << 16 | AF_CHANNEL_LAYOUT_5_0_D: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1174 reorder_self_5_step_1(src, samples, samplesize, 5, 4, 3, 2, 1, 0); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1175 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1176 case AF_CHANNEL_LAYOUT_5_0_C << 16 | AF_CHANNEL_LAYOUT_5_0_A: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1177 reorder_self_2(src, samples, samplesize, 5, 1, 2); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1178 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1179 case AF_CHANNEL_LAYOUT_5_0_C << 16 | AF_CHANNEL_LAYOUT_5_0_B: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1180 reorder_self_4_step_1(src, samples, samplesize, 5, 1, 2, 3, 4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1181 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1182 case AF_CHANNEL_LAYOUT_5_0_C << 16 | AF_CHANNEL_LAYOUT_5_0_D: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1183 reorder_self_2(src, samples, samplesize, 5, 0, 1); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1184 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1185 case AF_CHANNEL_LAYOUT_5_0_D << 16 | AF_CHANNEL_LAYOUT_5_0_A: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1186 reorder_self_3(src, samples, samplesize, 5, 0, 1, 2); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1187 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1188 case AF_CHANNEL_LAYOUT_5_0_D << 16 | AF_CHANNEL_LAYOUT_5_0_B: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1189 reorder_self_5_step_1(src, samples, samplesize, 5, 0, 1, 2, 3, 4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1190 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1191 case AF_CHANNEL_LAYOUT_5_0_D << 16 | AF_CHANNEL_LAYOUT_5_0_C: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1192 reorder_self_2(src, samples, samplesize, 5, 0, 1); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1193 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1194 // AF_CHANNEL_LAYOUT_5_1_A L R C LFE Ls Rs |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1195 // AF_CHANNEL_LAYOUT_5_1_B L R Ls Rs C LFE |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1196 // AF_CHANNEL_LAYOUT_5_1_C L C R Ls Rs LFE |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1197 // AF_CHANNEL_LAYOUT_5_1_D C L R Ls Rs LFE |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1198 // AF_CHANNEL_LAYOUT_5_1_E LFE L C R Ls Rs |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1199 case AF_CHANNEL_LAYOUT_5_1_A << 16 | AF_CHANNEL_LAYOUT_5_1_B: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1200 if (samplesize != 3) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1201 reorder_self_2(src, samples/2, samplesize*2, 3, 1, 2); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1202 else |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1203 reorder_self_4_step_2(src, samples, samplesize, 6, 2, 3, 4, 5); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1204 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1205 case AF_CHANNEL_LAYOUT_5_1_A << 16 | AF_CHANNEL_LAYOUT_5_1_C: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1206 reorder_self_2_3(src, samples, samplesize, 1, 2, 3, 4, 5); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1207 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1208 case AF_CHANNEL_LAYOUT_5_1_A << 16 | AF_CHANNEL_LAYOUT_5_1_D: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1209 reorder_self_3_3(src, samples, samplesize, 2, 1, 0, 3, 4, 5); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1210 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1211 case AF_CHANNEL_LAYOUT_5_1_B << 16 | AF_CHANNEL_LAYOUT_5_1_A: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1212 if (samplesize != 3) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1213 reorder_self_2(src, samples/2, samplesize*2, 3, 1, 2); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1214 else |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1215 reorder_self_4_step_2(src, samples, samplesize, 6, 2, 3, 4, 5); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1216 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1217 case AF_CHANNEL_LAYOUT_5_1_B << 16 | AF_CHANNEL_LAYOUT_5_1_C: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1218 reorder_self_4_step_1(src, samples, samplesize, 6, 4, 3, 2, 1); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1219 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1220 case AF_CHANNEL_LAYOUT_5_1_B << 16 | AF_CHANNEL_LAYOUT_5_1_D: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1221 reorder_self_5_step_1(src, samples, samplesize, 6, 4, 3, 2, 1, 0); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1222 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1223 case AF_CHANNEL_LAYOUT_5_1_B << 16 | AF_CHANNEL_LAYOUT_5_1_E: |
29826 | 1224 reorder_self_2_4(src, samples, samplesize, 6, 2, 4, 5, 3, 1, 0); |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1225 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1226 case AF_CHANNEL_LAYOUT_5_1_C << 16 | AF_CHANNEL_LAYOUT_5_1_A: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1227 reorder_self_2_3(src, samples, samplesize, 1, 2, 5, 4, 3); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1228 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1229 case AF_CHANNEL_LAYOUT_5_1_C << 16 | AF_CHANNEL_LAYOUT_5_1_B: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1230 reorder_self_4_step_1(src, samples, samplesize, 6, 1, 2, 3, 4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1231 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1232 case AF_CHANNEL_LAYOUT_5_1_C << 16 | AF_CHANNEL_LAYOUT_5_1_D: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1233 reorder_self_2(src, samples, samplesize, 6, 0, 1); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1234 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1235 case AF_CHANNEL_LAYOUT_5_1_D << 16 | AF_CHANNEL_LAYOUT_5_1_A: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1236 reorder_self_3_3(src, samples, samplesize, 0, 1, 2, 5, 4, 3); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1237 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1238 case AF_CHANNEL_LAYOUT_5_1_D << 16 | AF_CHANNEL_LAYOUT_5_1_B: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1239 reorder_self_5_step_1(src, samples, samplesize, 6, 0, 1, 2, 3, 4); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1240 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1241 case AF_CHANNEL_LAYOUT_5_1_D << 16 | AF_CHANNEL_LAYOUT_5_1_C: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1242 reorder_self_2(src, samples, samplesize, 6, 0, 1); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1243 break; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1244 case AF_CHANNEL_LAYOUT_5_1_E << 16 | AF_CHANNEL_LAYOUT_5_1_B: |
29826 | 1245 reorder_self_2_4(src, samples, samplesize, 6, 2, 4, 0, 1, 3, 5); |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1246 break; |
29491
99eda963d27a
Fix incorrect channel ordering for lavc audio codecs (specifically ffac3,
tack
parents:
29385
diff
changeset
|
1247 case AF_CHANNEL_LAYOUT_5_1_F << 16 | AF_CHANNEL_LAYOUT_5_1_B: |
29826 | 1248 reorder_self_2_4(src, samples, samplesize, 6, 3, 5, 0, 1, 2, 4); |
1249 break; | |
1250 // AF_CHANNEL_LAYOUT_7_1_A L R C LFE Ls Rs Rls Rrs | |
1251 // AF_CHANNEL_LAYOUT_7_1_B L R Ls Rs C LFE Rls Rrs | |
1252 // AF_CHANNEL_LAYOUT_7_1_C L C R Ls Rs LFE Rls Rrs | |
1253 // AF_CHANNEL_LAYOUT_7_1_F C L R LFE Ls Rs Rls Rrs | |
1254 case AF_CHANNEL_LAYOUT_7_1_A << 16 | AF_CHANNEL_LAYOUT_7_1_B: | |
1255 case AF_CHANNEL_LAYOUT_7_1_B << 16 | AF_CHANNEL_LAYOUT_7_1_A: | |
1256 if (samplesize != 3) | |
1257 reorder_self_2(src, samples/2, samplesize*2, 4, 1, 2); | |
1258 else | |
1259 reorder_self_4_step_2(src, samples, samplesize, 8, 2, 3, 4, 5); | |
1260 break; | |
1261 case AF_CHANNEL_LAYOUT_7_1_C << 16 | AF_CHANNEL_LAYOUT_7_1_B: | |
1262 reorder_self_4_step_1(src, samples, samplesize, 8, 1, 2, 3, 4); | |
1263 break; | |
1264 case AF_CHANNEL_LAYOUT_7_1_F << 16 | AF_CHANNEL_LAYOUT_7_1_B: | |
1265 reorder_self_2_4(src, samples, samplesize, 8, 3, 5, 0, 1, 2, 4); | |
29491
99eda963d27a
Fix incorrect channel ordering for lavc audio codecs (specifically ffac3,
tack
parents:
29385
diff
changeset
|
1266 break; |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1267 default: |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1268 mp_msg(MSGT_GLOBAL, MSGL_WARN, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1269 "[reorder_channel] unsupported from %x to %x, %d * %d\n", |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1270 src_layout, dest_layout, samples, samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1271 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1272 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1273 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1274 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1275 static int channel_layout_mapping_5ch[AF_CHANNEL_LAYOUT_SOURCE_NUM] = { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1276 AF_CHANNEL_LAYOUT_ALSA_5CH_DEFAULT, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1277 AF_CHANNEL_LAYOUT_AAC_5CH_DEFAULT, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1278 AF_CHANNEL_LAYOUT_WAVEEX_5CH_DEFAULT, |
29491
99eda963d27a
Fix incorrect channel ordering for lavc audio codecs (specifically ffac3,
tack
parents:
29385
diff
changeset
|
1279 AF_CHANNEL_LAYOUT_LAVC_5CH_DEFAULT, |
26987
d3a0f537dbe8
rename AF_CHANNEL_LAYOUT_LAVC_VORBIS* => AF_CHANNEL_LAYOUT_VORBIS*.
ulion
parents:
26740
diff
changeset
|
1280 AF_CHANNEL_LAYOUT_VORBIS_5CH_DEFAULT, |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1281 }; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1282 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1283 static int channel_layout_mapping_6ch[AF_CHANNEL_LAYOUT_SOURCE_NUM] = { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1284 AF_CHANNEL_LAYOUT_ALSA_6CH_DEFAULT, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1285 AF_CHANNEL_LAYOUT_AAC_6CH_DEFAULT, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1286 AF_CHANNEL_LAYOUT_WAVEEX_6CH_DEFAULT, |
29491
99eda963d27a
Fix incorrect channel ordering for lavc audio codecs (specifically ffac3,
tack
parents:
29385
diff
changeset
|
1287 AF_CHANNEL_LAYOUT_LAVC_6CH_DEFAULT, |
26987
d3a0f537dbe8
rename AF_CHANNEL_LAYOUT_LAVC_VORBIS* => AF_CHANNEL_LAYOUT_VORBIS*.
ulion
parents:
26740
diff
changeset
|
1288 AF_CHANNEL_LAYOUT_VORBIS_6CH_DEFAULT, |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1289 }; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1290 |
29826 | 1291 static int channel_layout_mapping_8ch[AF_CHANNEL_LAYOUT_SOURCE_NUM] = { |
1292 AF_CHANNEL_LAYOUT_ALSA_8CH_DEFAULT, | |
1293 AF_CHANNEL_LAYOUT_AAC_8CH_DEFAULT, | |
1294 AF_CHANNEL_LAYOUT_WAVEEX_8CH_DEFAULT, | |
1295 AF_CHANNEL_LAYOUT_LAVC_8CH_DEFAULT, | |
1296 AF_CHANNEL_LAYOUT_VORBIS_8CH_DEFAULT, | |
1297 }; | |
1298 | |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1299 void reorder_channel_copy_nch(void *src, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1300 int src_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1301 void *dest, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1302 int dest_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1303 int chnum, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1304 int samples, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1305 int samplesize) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1306 { |
29826 | 1307 if (chnum < 5 || chnum == 7 || chnum > 8 || |
1308 src_layout < 0 || dest_layout < 0 || | |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1309 src_layout >= AF_CHANNEL_LAYOUT_SOURCE_NUM || |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1310 dest_layout >= AF_CHANNEL_LAYOUT_SOURCE_NUM) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1311 fast_memcpy(dest, src, samples*samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1312 else if (chnum == 6) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1313 reorder_channel_copy(src, channel_layout_mapping_6ch[src_layout], |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1314 dest, channel_layout_mapping_6ch[dest_layout], |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1315 samples, samplesize); |
29826 | 1316 else if (chnum == 8) |
1317 reorder_channel_copy(src, channel_layout_mapping_8ch[src_layout], | |
1318 dest, channel_layout_mapping_8ch[dest_layout], | |
1319 samples, samplesize); | |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1320 else |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1321 reorder_channel_copy(src, channel_layout_mapping_5ch[src_layout], |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1322 dest, channel_layout_mapping_5ch[dest_layout], |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1323 samples, samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1324 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1325 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1326 void reorder_channel_nch(void *buf, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1327 int src_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1328 int dest_layout, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1329 int chnum, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1330 int samples, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1331 int samplesize) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1332 { |
29826 | 1333 if (src_layout == dest_layout || chnum < 5 || chnum == 7 || chnum > 8 || |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1334 src_layout < 0 || dest_layout < 0 || |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1335 src_layout >= AF_CHANNEL_LAYOUT_SOURCE_NUM || |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1336 dest_layout >= AF_CHANNEL_LAYOUT_SOURCE_NUM || |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1337 src_layout == dest_layout) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1338 return; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1339 if (chnum == 6) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1340 reorder_channel(buf, channel_layout_mapping_6ch[src_layout], |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1341 channel_layout_mapping_6ch[dest_layout], |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1342 samples, samplesize); |
29826 | 1343 else if (chnum == 8) |
1344 reorder_channel(buf, channel_layout_mapping_8ch[src_layout], | |
1345 channel_layout_mapping_8ch[dest_layout], | |
1346 samples, samplesize); | |
25315
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1347 else |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1348 reorder_channel(buf, channel_layout_mapping_5ch[src_layout], |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1349 channel_layout_mapping_5ch[dest_layout], |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1350 samples, samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1351 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1352 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1353 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1354 #ifdef TEST |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1355 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1356 static void test_copy(int channels) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1357 int samples = 12*1024*1024; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1358 int samplesize = 2; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1359 int i; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1360 unsigned char *bufin = malloc((samples+100)*samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1361 unsigned char *bufout = malloc((samples+100)*samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1362 memset(bufin, 0xFF, samples*samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1363 for (i = 0;i < 100; ++i) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1364 reorder_channel_copy(bufin, AF_CHANNEL_LAYOUT_5_1_A, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1365 bufout, AF_CHANNEL_LAYOUT_5_1_B, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1366 samples, samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1367 // reorder_channel(bufin, AF_CHANNEL_LAYOUT_5_1_B, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1368 // AF_CHANNEL_LAYOUT_5_1_D, |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1369 // samples, samplesize); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1370 free(bufin); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1371 free(bufout); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1372 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1373 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1374 int main(int argc, char *argv[]) { |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1375 int channels = 6; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1376 if (argc > 1) |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1377 channels = atoi(argv[1]); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1378 test_copy(channels); |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1379 return 0; |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1380 } |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1381 |
dfa8a510c81c
Fix all current known multi-channel wrong order problems by adding
ulion
parents:
diff
changeset
|
1382 #endif |