[MPlayer-dev-eng] [RFC] Support for 8 channel audio
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Fri Aug 14 21:26:52 CEST 2009
On Mon, Aug 10, 2009 at 10:55:47PM -0400, Jason Tackaberry wrote:
> + int8_t *dest_8 = dest;
> + const int8_t *src_8 = src;
> + for (i = 0; i < samples; i += 24) {
> + dest_8[i] = src_8[i+s0*3];
> + dest_8[i+1] = src_8[i+s0*3+1];
> + dest_8[i+2] = src_8[i+s0*3+2];
> + dest_8[i+3] = src_8[i+s1*3];
> + dest_8[i+4] = src_8[i+s1*3+1];
> + dest_8[i+5] = src_8[i+s1*3+2];
> + dest_8[i+6] = src_8[i+s2*3];
> + dest_8[i+7] = src_8[i+s2*3+1];
> + dest_8[i+8] = src_8[i+s2*3+2];
> + dest_8[i+9] = src_8[i+s3*3];
> + dest_8[i+10] = src_8[i+s3*3+1];
> + dest_8[i+11] = src_8[i+s3*3+2];
> + dest_8[i+12] = src_8[i+s4*3];
> + dest_8[i+13] = src_8[i+s4*3+1];
> + dest_8[i+14] = src_8[i+s4*3+2];
> + dest_8[i+15] = src_8[i+s5*3];
> + dest_8[i+16] = src_8[i+s5*3+1];
> + dest_8[i+17] = src_8[i+s5*3+2];
> + dest_8[i+18] = src_8[i+s6*3];
> + dest_8[i+19] = src_8[i+s6*3+1];
> + dest_8[i+20] = src_8[i+s6*3+2];
> + dest_8[i+21] = src_8[i+s7*3];
> + dest_8[i+22] = src_8[i+s7*3+1];
> + dest_8[i+23] = src_8[i+s7*3+2];
If you are ready to assume a modern compiler, this could be done a bit
nicer with e.g.
memcpy(dest_8+3*0, src_8+3*s0, 3);
memcpy(dest_8+3*1, src_8+3*s1, 3);
memcpy(dest_8+3*2, src_8+3*s2, 3);
...
At least I would suggest using s[8] instead of s0..s7
and then
for (j = 0; j < 8; j++) {
dest_8[i+3*j] = src_8[i+3*s[0]];
...
}
Though doing the *3 outside the loop might be a good idea, too...
> --- mplayer.orig/libao2/ao_pcm.c 2009-08-10 22:15:34.000000000 -0400
> +++ mplayer/libao2/ao_pcm.c 2009-08-10 20:21:16.000000000 -0400
> @@ -244,7 +244,7 @@
> }
> #endif
>
> - if (ao_data.channels == 6 || ao_data.channels == 5) {
> + if (ao_data.channels == 6 || ao_data.channels == 5 || ao_data.channels == 8) {
Having this in some kind of order would be nice.
More information about the MPlayer-dev-eng
mailing list