summaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2016-01-02 11:21:16 +0100
committerHendrik Leppkes <h.leppkes@gmail.com>2016-01-02 11:21:16 +0100
commite97e2588ca74270a14cc1df5a2576a5ea59b119f (patch)
tree52cb16a1034fe98657c9c43bf222b9513c705516 /libavcodec
parent10e075c138467b1fbe63cd9eec0dfd2c18cf903a (diff)
parenta0fc780a2093784e8664f88205ee1b215e109cee (diff)
downloadffmpeg-streaming-e97e2588ca74270a14cc1df5a2576a5ea59b119f.zip
ffmpeg-streaming-e97e2588ca74270a14cc1df5a2576a5ea59b119f.tar.gz
Merge commit 'a0fc780a2093784e8664f88205ee1b215e109cee'
* commit 'a0fc780a2093784e8664f88205ee1b215e109cee': arm64: int32_to_float_fmul neon asm Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/aarch64/Makefile2
-rw-r--r--libavcodec/aarch64/fmtconvert_init.c43
-rw-r--r--libavcodec/aarch64/fmtconvert_neon.S76
-rw-r--r--libavcodec/fmtconvert.c14
-rw-r--r--libavcodec/fmtconvert.h1
5 files changed, 132 insertions, 4 deletions
diff --git a/libavcodec/aarch64/Makefile b/libavcodec/aarch64/Makefile
index 2175578..022ed84 100644
--- a/libavcodec/aarch64/Makefile
+++ b/libavcodec/aarch64/Makefile
@@ -1,5 +1,6 @@
OBJS-$(CONFIG_DCA_DECODER) += aarch64/dcadsp_init.o
OBJS-$(CONFIG_FFT) += aarch64/fft_init_aarch64.o
+OBJS-$(CONFIG_FMTCONVERT) += aarch64/fmtconvert_init.o
OBJS-$(CONFIG_H264CHROMA) += aarch64/h264chroma_init_aarch64.o
OBJS-$(CONFIG_H264DSP) += aarch64/h264dsp_init_aarch64.o
OBJS-$(CONFIG_H264PRED) += aarch64/h264pred_init.o
@@ -19,6 +20,7 @@ ARMV8-OBJS-$(CONFIG_VIDEODSP) += aarch64/videodsp.o
NEON-OBJS-$(CONFIG_DCA_DECODER) += aarch64/dcadsp_neon.o \
aarch64/synth_filter_neon.o
NEON-OBJS-$(CONFIG_FFT) += aarch64/fft_neon.o
+NEON-OBJS-$(CONFIG_FMTCONVERT) += aarch64/fmtconvert_neon.o
NEON-OBJS-$(CONFIG_H264CHROMA) += aarch64/h264cmc_neon.o
NEON-OBJS-$(CONFIG_H264DSP) += aarch64/h264dsp_neon.o \
aarch64/h264idct_neon.o
diff --git a/libavcodec/aarch64/fmtconvert_init.c b/libavcodec/aarch64/fmtconvert_init.c
new file mode 100644
index 0000000..210e74b
--- /dev/null
+++ b/libavcodec/aarch64/fmtconvert_init.c
@@ -0,0 +1,43 @@
+/*
+ * ARM optimized Format Conversion Utils
+ *
+ * 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 <stdint.h>
+
+#include "libavutil/attributes.h"
+#include "libavutil/aarch64/cpu.h"
+#include "libavcodec/avcodec.h"
+#include "libavcodec/fmtconvert.h"
+
+void ff_int32_to_float_fmul_array8_neon(FmtConvertContext *c, float *dst,
+ const int32_t *src, const float *mul,
+ int len);
+void ff_int32_to_float_fmul_scalar_neon(float *dst, const int32_t *src,
+ float mul, int len);
+
+av_cold void ff_fmt_convert_init_aarch64(FmtConvertContext *c,
+ AVCodecContext *avctx)
+{
+ int cpu_flags = av_get_cpu_flags();
+
+ if (have_neon(cpu_flags)) {
+ c->int32_to_float_fmul_array8 = ff_int32_to_float_fmul_array8_neon;
+ c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_neon;
+ }
+}
diff --git a/libavcodec/aarch64/fmtconvert_neon.S b/libavcodec/aarch64/fmtconvert_neon.S
new file mode 100644
index 0000000..2161c3a
--- /dev/null
+++ b/libavcodec/aarch64/fmtconvert_neon.S
@@ -0,0 +1,76 @@
+/*
+ * ARM NEON optimised Format Conversion Utils
+ * Copyright (c) 2008 Mans Rullgard <mans@mansr.com>
+ * Copyright (c) 2015 Janne Grunau <janne-libav@jannau.net>
+ *
+ * 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 "config.h"
+#include "libavutil/aarch64/asm.S"
+
+function ff_int32_to_float_fmul_scalar_neon, export=1
+ ld1 {v1.4s,v2.4s}, [x1], #32
+ scvtf v1.4s, v1.4s
+ scvtf v2.4s, v2.4s
+1:
+ subs w2, w2, #8
+ fmul v3.4s, v1.4s, v0.s[0]
+ fmul v4.4s, v2.4s, v0.s[0]
+ b.le 2f
+ ld1 {v1.4s,v2.4s}, [x1], #32
+ st1 {v3.4s,v4.4s}, [x0], #32
+ scvtf v1.4s, v1.4s
+ scvtf v2.4s, v2.4s
+ b 1b
+2:
+ st1 {v3.4s,v4.4s}, [x0]
+ ret
+endfunc
+
+function ff_int32_to_float_fmul_array8_neon, export=1
+ lsr w4, w4, #3
+ subs w5, w4, #1
+ b.eq 1f
+2:
+ ld1 {v0.4s,v1.4s}, [x2], #32
+ ld1 {v2.4s,v3.4s}, [x2], #32
+ scvtf v0.4s, v0.4s
+ scvtf v1.4s, v1.4s
+ ld1 {v16.2s}, [x3], #8
+ scvtf v2.4s, v2.4s
+ scvtf v3.4s, v3.4s
+ fmul v4.4s, v0.4s, v16.s[0]
+ fmul v5.4s, v1.4s, v16.s[0]
+ fmul v6.4s, v2.4s, v16.s[1]
+ fmul v7.4s, v3.4s, v16.s[1]
+ st1 {v4.4s,v5.4s}, [x1], #32
+ st1 {v6.4s,v7.4s}, [x1], #32
+ subs w5, w5, #2
+ b.gt 2b
+ b.eq 1f
+ ret
+1:
+ ld1 {v0.4s,v1.4s}, [x2]
+ ld1 {v16.s}[0], [x3]
+ scvtf v0.4s, v0.4s
+ scvtf v1.4s, v1.4s
+ fmul v4.4s, v0.4s, v16.s[0]
+ fmul v5.4s, v1.4s, v16.s[0]
+ st1 {v4.4s,v5.4s}, [x1]
+ ret
+endfunc
diff --git a/libavcodec/fmtconvert.c b/libavcodec/fmtconvert.c
index 1de1d31..88ffcb0 100644
--- a/libavcodec/fmtconvert.c
+++ b/libavcodec/fmtconvert.c
@@ -46,8 +46,14 @@ av_cold void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx)
c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_c;
c->int32_to_float_fmul_array8 = int32_to_float_fmul_array8_c;
- if (ARCH_ARM) ff_fmt_convert_init_arm(c, avctx);
- if (ARCH_PPC) ff_fmt_convert_init_ppc(c, avctx);
- if (ARCH_X86) ff_fmt_convert_init_x86(c, avctx);
- if (HAVE_MIPSFPU) ff_fmt_convert_init_mips(c);
+ if (ARCH_AARCH64)
+ ff_fmt_convert_init_aarch64(c, avctx);
+ if (ARCH_ARM)
+ ff_fmt_convert_init_arm(c, avctx);
+ if (ARCH_PPC)
+ ff_fmt_convert_init_ppc(c, avctx);
+ if (ARCH_X86)
+ ff_fmt_convert_init_x86(c, avctx);
+ if (HAVE_MIPSFPU)
+ ff_fmt_convert_init_mips(c);
}
diff --git a/libavcodec/fmtconvert.h b/libavcodec/fmtconvert.h
index 4b8b958..b2df7a9 100644
--- a/libavcodec/fmtconvert.h
+++ b/libavcodec/fmtconvert.h
@@ -58,6 +58,7 @@ typedef struct FmtConvertContext {
void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx);
+void ff_fmt_convert_init_aarch64(FmtConvertContext *c, AVCodecContext *avctx);
void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx);
void ff_fmt_convert_init_ppc(FmtConvertContext *c, AVCodecContext *avctx);
void ff_fmt_convert_init_x86(FmtConvertContext *c, AVCodecContext *avctx);
OpenPOWER on IntegriCloud