diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-04-23 01:51:13 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-04-23 01:51:19 +0400 |
commit | cc17ff882635d41efa9917d0ef83185a1f1bfd2b (patch) | |
tree | 1776e28c0bd2bdf958834417b7bdf308853124a3 /libavcodec | |
parent | 59bfddfcdacf53a9f3dd0996c276b8b33c0e4e70 (diff) | |
parent | 3956a5e0ea46ed7e27ca888fe11c47986ad99261 (diff) |
Merge commit '3956a5e0ea46ed7e27ca888fe11c47986ad99261'
* commit '3956a5e0ea46ed7e27ca888fe11c47986ad99261':
aarch64: NEON vorbis_inverse_coupling
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/aarch64/Makefile | 3 | ||||
-rw-r--r-- | libavcodec/aarch64/vorbisdsp_init.c | 34 | ||||
-rw-r--r-- | libavcodec/aarch64/vorbisdsp_neon.S | 82 | ||||
-rw-r--r-- | libavcodec/vorbisdsp.c | 2 | ||||
-rw-r--r-- | libavcodec/vorbisdsp.h | 1 |
5 files changed, 122 insertions, 0 deletions
diff --git a/libavcodec/aarch64/Makefile b/libavcodec/aarch64/Makefile index 21d169559c..b0ebeb30ef 100644 --- a/libavcodec/aarch64/Makefile +++ b/libavcodec/aarch64/Makefile @@ -9,6 +9,7 @@ OBJS-$(CONFIG_VIDEODSP) += aarch64/videodsp_init.o OBJS-$(CONFIG_RV40_DECODER) += aarch64/rv40dsp_init_aarch64.o OBJS-$(CONFIG_VC1_DECODER) += aarch64/vc1dsp_init_aarch64.o +OBJS-$(CONFIG_VORBIS_DECODER) += aarch64/vorbisdsp_init.o ARMV8-OBJS-$(CONFIG_VIDEODSP) += aarch64/videodsp.o @@ -21,3 +22,5 @@ NEON-OBJS-$(CONFIG_H264QPEL) += aarch64/h264qpel_neon.o \ NEON-OBJS-$(CONFIG_HPELDSP) += aarch64/hpeldsp_neon.o NEON-OBJS-$(CONFIG_MPEGAUDIODSP) += aarch64/mpegaudiodsp_neon.o NEON-OBJS-$(CONFIG_MDCT) += aarch64/mdct_neon.o + +NEON-OBJS-$(CONFIG_VORBIS_DECODER) += aarch64/vorbisdsp_neon.o diff --git a/libavcodec/aarch64/vorbisdsp_init.c b/libavcodec/aarch64/vorbisdsp_init.c new file mode 100644 index 0000000000..c796f95e61 --- /dev/null +++ b/libavcodec/aarch64/vorbisdsp_init.c @@ -0,0 +1,34 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/aarch64/cpu.h" +#include "libavcodec/vorbisdsp.h" + +void ff_vorbis_inverse_coupling_neon(float *mag, float *ang, + intptr_t blocksize); + +av_cold void ff_vorbisdsp_init_aarch64(VorbisDSPContext *c) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + c->vorbis_inverse_coupling = ff_vorbis_inverse_coupling_neon; + } +} diff --git a/libavcodec/aarch64/vorbisdsp_neon.S b/libavcodec/aarch64/vorbisdsp_neon.S new file mode 100644 index 0000000000..e76feebc54 --- /dev/null +++ b/libavcodec/aarch64/vorbisdsp_neon.S @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2008 Mans Rullgard <mans@mansr.com> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/aarch64/asm.S" + +function ff_vorbis_inverse_coupling_neon, export=1 + movi v20.4s, #1<<7, lsl #24 + subs x2, x2, #4 + mov x3, x0 + mov x4, x1 + b.eq 3f + + ld1 {v7.4s}, [x1], #16 + ld1 {v6.4s}, [x0], #16 + cmle v4.4s, v7.4s, #0 + and v5.16b, v6.16b, v20.16b + eor v7.16b, v7.16b, v5.16b + and v2.16b, v7.16b, v4.16b + bic v3.16b, v7.16b, v4.16b + fadd v7.4s, v6.4s, v2.4s + fsub v6.4s, v6.4s, v3.4s +1: ld1 {v1.4s}, [x1], #16 + ld1 {v0.4s}, [x0], #16 + cmle v4.4s, v1.4s, #0 + and v5.16b, v0.16b, v20.16b + eor v1.16b, v1.16b, v5.16b + st1 {v7.4s}, [x3], #16 + st1 {v6.4s}, [x4], #16 + and v2.16b, v1.16b, v4.16b + bic v3.16b, v1.16b, v4.16b + fadd v1.4s, v0.4s, v2.4s + fsub v0.4s, v0.4s, v3.4s + subs x2, x2, #8 + b.le 2f + ld1 {v7.4s}, [x1], #16 + ld1 {v6.4s}, [x0], #16 + cmle v4.4s, v7.4s, #0 + and v5.16b, v6.16b, v20.16b + eor v7.16b, v7.16b, v5.16b + st1 {v1.4s}, [x3], #16 + st1 {v0.4s}, [x4], #16 + and v2.16b, v7.16b, v4.16b + bic v3.16b, v7.16b, v4.16b + fadd v7.4s, v6.4s, v2.4s + fsub v6.4s, v6.4s, v3.4s + b 1b + +2: st1 {v1.4s}, [x3], #16 + st1 {v0.4s}, [x4], #16 + b.lt ret + +3: ld1 {v1.4s}, [x1] + ld1 {v0.4s}, [x0] + cmle v4.4s, v1.4s, #0 + and v5.16b, v0.16b, v20.16b + eor v1.16b, v1.16b, v5.16b + and v2.16b, v1.16b, v4.16b + bic v3.16b, v1.16b, v4.16b + fadd v1.4s, v0.4s, v2.4s + fsub v0.4s, v0.4s, v3.4s + st1 {v1.4s}, [x0], #16 + st1 {v0.4s}, [x1], #16 +ret: + ret +endfunc diff --git a/libavcodec/vorbisdsp.c b/libavcodec/vorbisdsp.c index 784375697e..362a276296 100644 --- a/libavcodec/vorbisdsp.c +++ b/libavcodec/vorbisdsp.c @@ -25,6 +25,8 @@ av_cold void ff_vorbisdsp_init(VorbisDSPContext *dsp) { dsp->vorbis_inverse_coupling = ff_vorbis_inverse_coupling; + if (ARCH_AARCH64) + ff_vorbisdsp_init_aarch64(dsp); if (ARCH_ARM) ff_vorbisdsp_init_arm(dsp); if (ARCH_PPC) diff --git a/libavcodec/vorbisdsp.h b/libavcodec/vorbisdsp.h index ed14049c8c..7abec4e4b7 100644 --- a/libavcodec/vorbisdsp.h +++ b/libavcodec/vorbisdsp.h @@ -30,6 +30,7 @@ typedef struct VorbisDSPContext { void ff_vorbisdsp_init(VorbisDSPContext *dsp); /* for internal use only */ +void ff_vorbisdsp_init_aarch64(VorbisDSPContext *dsp); void ff_vorbisdsp_init_x86(VorbisDSPContext *dsp); void ff_vorbisdsp_init_arm(VorbisDSPContext *dsp); void ff_vorbisdsp_init_ppc(VorbisDSPContext *dsp); |