Add libavresample
[libav.git] / libavresample / x86 / audio_mix.asm
1 ;******************************************************************************
2 ;* x86 optimized channel mixing
3 ;* Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
4 ;*
5 ;* This file is part of Libav.
6 ;*
7 ;* Libav is free software; you can redistribute it and/or
8 ;* modify it under the terms of the GNU Lesser General Public
9 ;* License as published by the Free Software Foundation; either
10 ;* version 2.1 of the License, or (at your option) any later version.
11 ;*
12 ;* Libav is distributed in the hope that it will be useful,
13 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ;* Lesser General Public License for more details.
16 ;*
17 ;* You should have received a copy of the GNU Lesser General Public
18 ;* License along with Libav; if not, write to the Free Software
19 ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 ;******************************************************************************
21
22 %include "x86inc.asm"
23 %include "x86util.asm"
24
25 SECTION_TEXT
26
27 ;-----------------------------------------------------------------------------
28 ; void ff_mix_2_to_1_fltp_flt(float **src, float **matrix, int len,
29 ; int out_ch, int in_ch);
30 ;-----------------------------------------------------------------------------
31
32 %macro MIX_2_TO_1_FLTP_FLT 0
33 cglobal mix_2_to_1_fltp_flt, 3,4,6, src, matrix, len, src1
34 mov src1q, [srcq+gprsize]
35 mov srcq, [srcq ]
36 sub src1q, srcq
37 mov matrixq, [matrixq ]
38 VBROADCASTSS m4, [matrixq ]
39 VBROADCASTSS m5, [matrixq+4]
40 ALIGN 16
41 .loop:
42 mulps m0, m4, [srcq ]
43 mulps m1, m5, [srcq+src1q ]
44 mulps m2, m4, [srcq+ mmsize]
45 mulps m3, m5, [srcq+src1q+mmsize]
46 addps m0, m0, m1
47 addps m2, m2, m3
48 mova [srcq ], m0
49 mova [srcq+mmsize], m2
50 add srcq, mmsize*2
51 sub lend, mmsize*2/4
52 jg .loop
53 %if mmsize == 32
54 vzeroupper
55 RET
56 %else
57 REP_RET
58 %endif
59 %endmacro
60
61 INIT_XMM sse
62 MIX_2_TO_1_FLTP_FLT
63 INIT_YMM avx
64 MIX_2_TO_1_FLTP_FLT