1;******************************************************************************
2;* SIMD optimized DSP functions for G722 coding
3;*
4;* Copyright (c) 2014 James Almer
5;*
6;* This file is part of FFmpeg.
7;*
8;* FFmpeg is free software; you can redistribute it and/or
9;* modify it under the terms of the GNU Lesser General Public
10;* License as published by the Free Software Foundation; either
11;* version 2.1 of the License, or (at your option) any later version.
12;*
13;* FFmpeg is distributed in the hope that it will be useful,
14;* but WITHOUT ANY WARRANTY; without even the implied warranty of
15;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16;* Lesser General Public License for more details.
17;*
18;* You should have received a copy of the GNU Lesser General Public
19;* License along with FFmpeg; if not, write to the Free Software
20;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21;******************************************************************************
22
23%include "libavutil/x86/x86util.asm"
24
25SECTION_RODATA
26
27pw_qmf_coeffs:  dw   3, -210,  -11, -805,  -11,  951,  53, 3876
28pw_qmf_coeffs2: dw  12, 3876, -156,  951,   32, -805, 362, -210
29pw_qmf_coeffs3: dw 362,    0 ,  32,    0, -156,    0,  12,    0
30pw_qmf_coeffs4: dw  53,    0,  -11,    0,  -11,    0,   3,    0
31
32SECTION .text
33
34INIT_XMM sse2
35cglobal g722_apply_qmf, 2, 2, 5, prev, out
36    movu m0, [prevq+mmsize*0]
37    movu m1, [prevq+mmsize*1]
38    movu m2, [prevq+mmsize*2]
39    punpcklwd m3, m0, m1
40    punpckhwd m0, m1
41    punpcklwd m4, m2, m2
42    punpckhwd m2, m2
43    pmaddwd   m3, [pw_qmf_coeffs ]
44    pmaddwd   m0, [pw_qmf_coeffs2]
45    pmaddwd   m4, [pw_qmf_coeffs3]
46    pmaddwd   m2, [pw_qmf_coeffs4]
47    paddd     m0, m3
48    paddd     m2, m4
49    paddd     m0, m2
50    pshufd    m2, m0, q0032
51    paddd     m0, m2
52    pshufd    m0, m0, q0001
53    movq  [outq], m0
54    RET
55