• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2016 Matthieu Bouron <matthieu.bouron stupeflix.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_resample_common_apply_filter_x4_float_neon, export=1
24    vmov.f32            q0, #0.0                                       @ accumulator
251:  vld1.32             {q1}, [r1]!                                    @ src[0..3]
26    vld1.32             {q2}, [r2]!                                    @ filter[0..3]
27    vmla.f32            q0, q1, q2                                     @ accumulator += src[0..3] * filter[0..3]
28    subs                r3, #4                                         @ filter_length -= 4
29    bgt                 1b                                             @ loop until filter_length
30    vpadd.f32           d0, d0, d1                                     @ pair adding of the 4x32-bit accumulated values
31    vpadd.f32           d0, d0, d0                                     @ pair adding of the 4x32-bit accumulator values
32    vst1.32             {d0[0]}, [r0]                                  @ write accumulator
33    mov pc, lr
34endfunc
35
36function ff_resample_common_apply_filter_x8_float_neon, export=1
37    vmov.f32            q0, #0.0                                       @ accumulator
381:  vld1.32             {q1}, [r1]!                                    @ src[0..3]
39    vld1.32             {q2}, [r2]!                                    @ filter[0..3]
40    vld1.32             {q8}, [r1]!                                    @ src[4..7]
41    vld1.32             {q9}, [r2]!                                    @ filter[4..7]
42    vmla.f32            q0, q1, q2                                     @ accumulator += src[0..3] * filter[0..3]
43    vmla.f32            q0, q8, q9                                     @ accumulator += src[4..7] * filter[4..7]
44    subs                r3, #8                                         @ filter_length -= 8
45    bgt                 1b                                             @ loop until filter_length
46    vpadd.f32           d0, d0, d1                                     @ pair adding of the 4x32-bit accumulated values
47    vpadd.f32           d0, d0, d0                                     @ pair adding of the 4x32-bit accumulator values
48    vst1.32             {d0[0]}, [r0]                                  @ write accumulator
49    mov pc, lr
50endfunc
51
52function ff_resample_common_apply_filter_x4_s16_neon, export=1
53    vmov.s32            q0, #0                                         @ accumulator
541:  vld1.16             {d2}, [r1]!                                    @ src[0..3]
55    vld1.16             {d4}, [r2]!                                    @ filter[0..3]
56    vmlal.s16           q0, d2, d4                                     @ accumulator += src[0..3] * filter[0..3]
57    subs                r3, #4                                         @ filter_length -= 4
58    bgt                 1b                                             @ loop until filter_length
59    vpadd.s32           d0, d0, d1                                     @ pair adding of the 4x32-bit accumulated values
60    vpadd.s32           d0, d0, d0                                     @ pair adding of the 4x32-bit accumulator values
61    vst1.32             {d0[0]}, [r0]                                  @ write accumulator
62    mov pc, lr
63endfunc
64
65function ff_resample_common_apply_filter_x8_s16_neon, export=1
66    vmov.s32            q0, #0                                         @ accumulator
671:  vld1.16             {q1}, [r1]!                                    @ src[0..7]
68    vld1.16             {q2}, [r2]!                                    @ filter[0..7]
69    vmlal.s16           q0, d2, d4                                     @ accumulator += src[0..3] * filter[0..3]
70    vmlal.s16           q0, d3, d5                                     @ accumulator += src[4..7] * filter[4..7]
71    subs                r3, #8                                         @ filter_length -= 8
72    bgt                 1b                                             @ loop until filter_length
73    vpadd.s32           d0, d0, d1                                     @ pair adding of the 4x32-bit accumulated values
74    vpadd.s32           d0, d0, d0                                     @ pair adding of the 4x32-bit accumulator values
75    vst1.32             {d0[0]}, [r0]                                  @ write accumulator
76    mov pc, lr
77endfunc
78