| 1 | /* |
| 2 | * ARM NEON optimised audio functions |
| 3 | * Copyright (c) 2008 Mans Rullgard <mans@mansr.com> |
| 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 | function ff_vector_clipf_neon, export=1 |
| 25 | VFP vdup.32 q1, d0[1] |
| 26 | VFP vdup.32 q0, d0[0] |
| 27 | NOVFP vdup.32 q0, r2 |
| 28 | NOVFP vdup.32 q1, r3 |
| 29 | NOVFP ldr r2, [sp] |
| 30 | vld1.f32 {q2},[r1,:128]! |
| 31 | vmin.f32 q10, q2, q1 |
| 32 | vld1.f32 {q3},[r1,:128]! |
| 33 | vmin.f32 q11, q3, q1 |
| 34 | 1: vmax.f32 q8, q10, q0 |
| 35 | vmax.f32 q9, q11, q0 |
| 36 | subs r2, r2, #8 |
| 37 | beq 2f |
| 38 | vld1.f32 {q2},[r1,:128]! |
| 39 | vmin.f32 q10, q2, q1 |
| 40 | vld1.f32 {q3},[r1,:128]! |
| 41 | vmin.f32 q11, q3, q1 |
| 42 | vst1.f32 {q8},[r0,:128]! |
| 43 | vst1.f32 {q9},[r0,:128]! |
| 44 | b 1b |
| 45 | 2: vst1.f32 {q8},[r0,:128]! |
| 46 | vst1.f32 {q9},[r0,:128]! |
| 47 | bx lr |
| 48 | endfunc |
| 49 | |
| 50 | function ff_vector_clip_int32_neon, export=1 |
| 51 | vdup.32 q0, r2 |
| 52 | vdup.32 q1, r3 |
| 53 | ldr r2, [sp] |
| 54 | 1: |
| 55 | vld1.32 {q2-q3}, [r1,:128]! |
| 56 | vmin.s32 q2, q2, q1 |
| 57 | vmin.s32 q3, q3, q1 |
| 58 | vmax.s32 q2, q2, q0 |
| 59 | vmax.s32 q3, q3, q0 |
| 60 | vst1.32 {q2-q3}, [r0,:128]! |
| 61 | subs r2, r2, #8 |
| 62 | bgt 1b |
| 63 | bx lr |
| 64 | endfunc |