• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * ARM NEON optimised integer operations
3 * Copyright (c) 2009 Kostya Shishkov
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg 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 * FFmpeg 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 FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#include "libavutil/arm/asm.S"
23
24@ scalarproduct_and_madd_int16(/*aligned*/v0,v1,v2,order,mul)
25function ff_scalarproduct_and_madd_int16_neon, export=1
26        vld1.16         {d28[],d29[]}, [sp]
27        vmov.i16        q0,  #0
28        vmov.i16        q1,  #0
29        vmov.i16        q2,  #0
30        vmov.i16        q3,  #0
31        mov             r12, r0
32
331:      vld1.16         {d16-d17}, [r0,:128]!
34        vld1.16         {d18-d19}, [r1]!
35        vld1.16         {d20-d21}, [r2]!
36        vld1.16         {d22-d23}, [r0,:128]!
37        vld1.16         {d24-d25}, [r1]!
38        vld1.16         {d26-d27}, [r2]!
39        vmul.s16        q10, q10,  q14
40        vmul.s16        q13, q13,  q14
41        vmlal.s16       q0,  d16,  d18
42        vmlal.s16       q1,  d17,  d19
43        vadd.s16        q10, q8,   q10
44        vadd.s16        q13, q11,  q13
45        vmlal.s16       q2,  d22,  d24
46        vmlal.s16       q3,  d23,  d25
47        vst1.16         {q10},     [r12,:128]!
48        subs            r3,  r3,   #16
49        vst1.16         {q13},     [r12,:128]!
50        bgt             1b
51
52        vpadd.s32       d16, d0,   d1
53        vpadd.s32       d17, d2,   d3
54        vpadd.s32       d18, d4,   d5
55        vpadd.s32       d19, d6,   d7
56        vpadd.s32       d0,  d16,  d17
57        vpadd.s32       d1,  d18,  d19
58        vpadd.s32       d2,  d0,   d1
59        vpaddl.s32      d3,  d2
60        vmov.32         r0,  d3[0]
61        bx              lr
62endfunc
63