1/*
2 * Copyright (c) 2010 Mans Rullgard <mans@mansr.com>
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include "libavutil/arm/asm.S"
22
23function ff_decode_hf_neon, export=1
24        push            {r4-r5,lr}
25        add             r2,  r2,  r3
26        ldr             r3,       [sp, #12]
27        ldrd            r4,  r5,  [sp, #16]
28        add             r3,  r3,  r4, lsl #3
29        add             r1,  r1,  r4, lsl #2
30        add             r0,  r0,  r4, lsl #5
31
321:      ldr_post        lr,  r1,  #4
33        add             r4,  r4,  #1
34        add             lr,  r2,  lr, lsl #5
35        cmp             r4,  r5
36        vld1.32         {d7},     [r3]!
37        vld1.8          {d0},     [lr,:64]
38        vcvt.f32.s32    d7,  d7,  #4
39        vmovl.s8        q1,  d0
40        vmovl.s16       q0,  d2
41        vmovl.s16       q1,  d3
42        vcvt.f32.s32    q0,  q0
43        vcvt.f32.s32    q1,  q1
44        vmul.f32        q0,  q0,  d7[0]
45        vmul.f32        q1,  q1,  d7[0]
46        vst1.32         {q0-q1},  [r0,:128]!
47        bne             1b
48
49        pop             {r4-r5,pc}
50endfunc
51
52function ff_dca_lfe_fir0_neon, export=1
53        push            {r4-r6,lr}
54        mov             r3,  #32                @ decifactor
55        mov             r6,  #256/32
56        b               dca_lfe_fir
57endfunc
58
59function ff_dca_lfe_fir1_neon, export=1
60        push            {r4-r6,lr}
61        mov             r3,  #64                @ decifactor
62        mov             r6,  #256/64
63dca_lfe_fir:
64        add             r4,  r0,  r3,  lsl #2   @ out2
65        add             r5,  r2,  #256*4-16     @ cf1
66        sub             r1,  r1,  #12
67        mov             lr,  #-16
681:
69        vmov.f32        q2,  #0.0               @ v0
70        vmov.f32        q3,  #0.0               @ v1
71        mov             r12, r6
722:
73        vld1.32         {q8},     [r2,:128]!    @ cf0
74        vld1.32         {q9},     [r5,:128], lr @ cf1
75        vld1.32         {q1},     [r1], lr      @ in
76        subs            r12, r12, #4
77        vrev64.32       q10, q8
78        vmla.f32        q3,  q1,  q9
79        vmla.f32        d4,  d2,  d21
80        vmla.f32        d5,  d3,  d20
81        bne             2b
82
83        add             r1,  r1,  r6,  lsl #2
84        subs            r3,  r3,  #1
85        vadd.f32        d4,  d4,  d5
86        vadd.f32        d6,  d6,  d7
87        vpadd.f32       d5,  d4,  d6
88        vst1.32         {d5[0]},  [r0,:32]!
89        vst1.32         {d5[1]},  [r4,:32]!
90        bne             1b
91
92        pop             {r4-r6,pc}
93endfunc
94