summaryrefslogtreecommitdiffstats
path: root/media/ffvpx/libavutil/aarch64
diff options
context:
space:
mode:
Diffstat (limited to 'media/ffvpx/libavutil/aarch64')
-rw-r--r--media/ffvpx/libavutil/aarch64/asm.S237
-rw-r--r--media/ffvpx/libavutil/aarch64/bswap.h56
-rw-r--r--media/ffvpx/libavutil/aarch64/cpu.c38
-rw-r--r--media/ffvpx/libavutil/aarch64/cpu.h29
-rw-r--r--media/ffvpx/libavutil/aarch64/float_dsp_init.c69
-rw-r--r--media/ffvpx/libavutil/aarch64/float_dsp_neon.S202
-rw-r--r--media/ffvpx/libavutil/aarch64/moz.build19
-rw-r--r--media/ffvpx/libavutil/aarch64/timer.h50
8 files changed, 700 insertions, 0 deletions
diff --git a/media/ffvpx/libavutil/aarch64/asm.S b/media/ffvpx/libavutil/aarch64/asm.S
new file mode 100644
index 0000000000..a7782415d7
--- /dev/null
+++ b/media/ffvpx/libavutil/aarch64/asm.S
@@ -0,0 +1,237 @@
+/*
+ * 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 "config.h"
+
+#ifdef __ELF__
+# define ELF
+#else
+# define ELF #
+#endif
+
+#if HAVE_AS_FUNC
+# define FUNC
+#else
+# define FUNC #
+#endif
+
+#ifndef __has_feature
+# define __has_feature(x) 0
+#endif
+
+
+/* Support macros for
+ * - Armv8.3-A Pointer Authentication and
+ * - Armv8.5-A Branch Target Identification
+ * features which require emitting a .note.gnu.property section with the
+ * appropriate architecture-dependent feature bits set.
+ *
+ * |AARCH64_SIGN_LINK_REGISTER| and |AARCH64_VALIDATE_LINK_REGISTER| expand to
+ * PACIxSP and AUTIxSP, respectively. |AARCH64_SIGN_LINK_REGISTER| should be
+ * used immediately before saving the LR register (x30) to the stack.
+ * |AARCH64_VALIDATE_LINK_REGISTER| should be used immediately after restoring
+ * it. Note |AARCH64_SIGN_LINK_REGISTER|'s modifications to LR must be undone
+ * with |AARCH64_VALIDATE_LINK_REGISTER| before RET. The SP register must also
+ * have the same value at the two points. For example:
+ *
+ * .global f
+ * f:
+ * AARCH64_SIGN_LINK_REGISTER
+ * stp x29, x30, [sp, #-96]!
+ * mov x29, sp
+ * ...
+ * ldp x29, x30, [sp], #96
+ * AARCH64_VALIDATE_LINK_REGISTER
+ * ret
+ *
+ * |AARCH64_VALID_CALL_TARGET| expands to BTI 'c'. Either it, or
+ * |AARCH64_SIGN_LINK_REGISTER|, must be used at every point that may be an
+ * indirect call target. In particular, all symbols exported from a file must
+ * begin with one of these macros. For example, a leaf function that does not
+ * save LR can instead use |AARCH64_VALID_CALL_TARGET|:
+ *
+ * .globl return_zero
+ * return_zero:
+ * AARCH64_VALID_CALL_TARGET
+ * mov x0, #0
+ * ret
+ *
+ * A non-leaf function which does not immediately save LR may need both macros
+ * because |AARCH64_SIGN_LINK_REGISTER| appears late. For example, the function
+ * may jump to an alternate implementation before setting up the stack:
+ *
+ * .globl with_early_jump
+ * with_early_jump:
+ * AARCH64_VALID_CALL_TARGET
+ * cmp x0, #128
+ * b.lt .Lwith_early_jump_128
+ * AARCH64_SIGN_LINK_REGISTER
+ * stp x29, x30, [sp, #-96]!
+ * mov x29, sp
+ * ...
+ * ldp x29, x30, [sp], #96
+ * AARCH64_VALIDATE_LINK_REGISTER
+ * ret
+ *
+ * .Lwith_early_jump_128:
+ * ...
+ * ret
+ *
+ * These annotations are only required with indirect calls. Private symbols that
+ * are only the target of direct calls do not require annotations. Also note
+ * that |AARCH64_VALID_CALL_TARGET| is only valid for indirect calls (BLR), not
+ * indirect jumps (BR). Indirect jumps in assembly are supported through
+ * |AARCH64_VALID_JUMP_TARGET|. Landing Pads which shall serve for jumps and
+ * calls can be created using |AARCH64_VALID_JUMP_CALL_TARGET|.
+ *
+ * Although not necessary, it is safe to use these macros in 32-bit ARM
+ * assembly. This may be used to simplify dual 32-bit and 64-bit files.
+ *
+ * References:
+ * - "ELF for the ArmĀ® 64-bit Architecture"
+ * https: *github.com/ARM-software/abi-aa/blob/master/aaelf64/aaelf64.rst
+ * - "Providing protection for complex software"
+ * https://developer.arm.com/architectures/learn-the-architecture/providing-protection-for-complex-software
+ */
+#if defined(__ARM_FEATURE_BTI_DEFAULT) && (__ARM_FEATURE_BTI_DEFAULT == 1)
+# define GNU_PROPERTY_AARCH64_BTI (1 << 0) // Has BTI
+# define AARCH64_VALID_CALL_TARGET hint #34 // BTI 'c'
+# define AARCH64_VALID_JUMP_TARGET hint #38 // BTI 'j'
+#else
+# define GNU_PROPERTY_AARCH64_BTI 0 // No BTI
+# define AARCH64_VALID_CALL_TARGET
+# define AARCH64_VALID_JUMP_TARGET
+#endif
+
+#if defined(__ARM_FEATURE_PAC_DEFAULT)
+# if ((__ARM_FEATURE_PAC_DEFAULT & (1 << 0)) != 0) // authentication using key A
+# define AARCH64_SIGN_LINK_REGISTER paciasp
+# define AARCH64_VALIDATE_LINK_REGISTER autiasp
+# elif ((__ARM_FEATURE_PAC_DEFAULT & (1 << 1)) != 0) // authentication using key B
+# define AARCH64_SIGN_LINK_REGISTER pacibsp
+# define AARCH64_VALIDATE_LINK_REGISTER autibsp
+# else
+# error Pointer authentication defines no valid key!
+# endif
+# if ((__ARM_FEATURE_PAC_DEFAULT & (1 << 2)) != 0)
+# error Authentication of leaf functions is enabled but not supported in FFmpeg!
+# endif
+# define GNU_PROPERTY_AARCH64_PAC (1 << 1)
+#else
+# define GNU_PROPERTY_AARCH64_PAC 0
+# define AARCH64_SIGN_LINK_REGISTER
+# define AARCH64_VALIDATE_LINK_REGISTER
+#endif
+
+
+#if (GNU_PROPERTY_AARCH64_BTI != 0 || GNU_PROPERTY_AARCH64_PAC != 0) && defined(__ELF__)
+ .pushsection .note.gnu.property, "a"
+ .balign 8
+ .long 4
+ .long 0x10
+ .long 0x5
+ .asciz "GNU"
+ .long 0xc0000000 /* GNU_PROPERTY_AARCH64_FEATURE_1_AND */
+ .long 4
+ .long (GNU_PROPERTY_AARCH64_BTI | GNU_PROPERTY_AARCH64_PAC)
+ .long 0
+ .popsection
+#endif
+
+.macro function name, export=0, align=2
+ .macro endfunc
+ELF .size \name, . - \name
+FUNC .endfunc
+ .purgem endfunc
+ .endm
+ .text
+ .align \align
+ .if \export
+ .global EXTERN_ASM\name
+ELF .type EXTERN_ASM\name, %function
+FUNC .func EXTERN_ASM\name
+EXTERN_ASM\name:
+ AARCH64_VALID_CALL_TARGET
+ .else
+ELF .type \name, %function
+FUNC .func \name
+\name:
+ .endif
+.endm
+
+.macro const name, align=2, relocate=0
+ .macro endconst
+ELF .size \name, . - \name
+ .purgem endconst
+ .endm
+#if HAVE_SECTION_DATA_REL_RO
+.if \relocate
+ .section .data.rel.ro
+.else
+ .section .rodata
+.endif
+#elif defined(_WIN32)
+ .section .rdata
+#elif !defined(__MACH__)
+ .section .rodata
+#else
+ .const_data
+#endif
+ .align \align
+\name:
+.endm
+
+.macro movrel rd, val, offset=0
+#if CONFIG_PIC && defined(__APPLE__)
+ .if \offset < 0
+ adrp \rd, \val@PAGE
+ add \rd, \rd, \val@PAGEOFF
+ sub \rd, \rd, -(\offset)
+ .else
+ adrp \rd, \val+(\offset)@PAGE
+ add \rd, \rd, \val+(\offset)@PAGEOFF
+ .endif
+#elif CONFIG_PIC && defined(_WIN32)
+ .if \offset < 0
+ adrp \rd, \val
+ add \rd, \rd, :lo12:\val
+ sub \rd, \rd, -(\offset)
+ .else
+ adrp \rd, \val+(\offset)
+ add \rd, \rd, :lo12:\val+(\offset)
+ .endif
+#elif CONFIG_PIC
+# if __has_feature(hwaddress_sanitizer)
+ adrp \rd, :pg_hi21_nc:\val+(\offset)
+# else
+ adrp \rd, \val+(\offset)
+# endif
+ add \rd, \rd, :lo12:\val+(\offset)
+#else
+ ldr \rd, =\val+\offset
+#endif
+.endm
+
+#define GLUE(a, b) a ## b
+#define JOIN(a, b) GLUE(a, b)
+#define X(s) JOIN(EXTERN_ASM, s)
+
+#define x18 do_not_use_x18
+#define w18 do_not_use_w18
diff --git a/media/ffvpx/libavutil/aarch64/bswap.h b/media/ffvpx/libavutil/aarch64/bswap.h
new file mode 100644
index 0000000000..7abca657ba
--- /dev/null
+++ b/media/ffvpx/libavutil/aarch64/bswap.h
@@ -0,0 +1,56 @@
+/*
+ * 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
+ */
+
+#ifndef AVUTIL_AARCH64_BSWAP_H
+#define AVUTIL_AARCH64_BSWAP_H
+
+#include <stdint.h>
+#include "config.h"
+#include "libavutil/attributes.h"
+
+#if HAVE_INLINE_ASM
+
+#define av_bswap16 av_bswap16
+static av_always_inline av_const unsigned av_bswap16(unsigned x)
+{
+ unsigned y;
+
+ __asm__("rev16 %w0, %w1" : "=r"(y) : "r"(x));
+ return y;
+}
+
+#define av_bswap32 av_bswap32
+static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
+{
+ uint32_t y;
+
+ __asm__("rev %w0, %w1" : "=r"(y) : "r"(x));
+ return y;
+}
+
+#define av_bswap64 av_bswap64
+static av_always_inline av_const uint64_t av_bswap64(uint64_t x)
+{
+ uint64_t y;
+
+ __asm__("rev %0, %1" : "=r"(y) : "r"(x));
+ return y;
+}
+
+#endif /* HAVE_INLINE_ASM */
+#endif /* AVUTIL_AARCH64_BSWAP_H */
diff --git a/media/ffvpx/libavutil/aarch64/cpu.c b/media/ffvpx/libavutil/aarch64/cpu.c
new file mode 100644
index 0000000000..cc641da576
--- /dev/null
+++ b/media/ffvpx/libavutil/aarch64/cpu.c
@@ -0,0 +1,38 @@
+/*
+ * 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/cpu.h"
+#include "libavutil/cpu_internal.h"
+#include "config.h"
+
+int ff_get_cpu_flags_aarch64(void)
+{
+ return AV_CPU_FLAG_ARMV8 * HAVE_ARMV8 |
+ AV_CPU_FLAG_NEON * HAVE_NEON |
+ AV_CPU_FLAG_VFP * HAVE_VFP;
+}
+
+size_t ff_get_cpu_max_align_aarch64(void)
+{
+ int flags = av_get_cpu_flags();
+
+ if (flags & AV_CPU_FLAG_NEON)
+ return 16;
+
+ return 8;
+}
diff --git a/media/ffvpx/libavutil/aarch64/cpu.h b/media/ffvpx/libavutil/aarch64/cpu.h
new file mode 100644
index 0000000000..2ee3f9323a
--- /dev/null
+++ b/media/ffvpx/libavutil/aarch64/cpu.h
@@ -0,0 +1,29 @@
+/*
+ * 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
+ */
+
+#ifndef AVUTIL_AARCH64_CPU_H
+#define AVUTIL_AARCH64_CPU_H
+
+#include "libavutil/cpu.h"
+#include "libavutil/cpu_internal.h"
+
+#define have_armv8(flags) CPUEXT(flags, ARMV8)
+#define have_neon(flags) CPUEXT(flags, NEON)
+#define have_vfp(flags) CPUEXT(flags, VFP)
+
+#endif /* AVUTIL_AARCH64_CPU_H */
diff --git a/media/ffvpx/libavutil/aarch64/float_dsp_init.c b/media/ffvpx/libavutil/aarch64/float_dsp_init.c
new file mode 100644
index 0000000000..4325071821
--- /dev/null
+++ b/media/ffvpx/libavutil/aarch64/float_dsp_init.c
@@ -0,0 +1,69 @@
+/*
+ * ARM NEON optimised Float DSP functions
+ * 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 <stdint.h>
+
+#include "libavutil/attributes.h"
+#include "libavutil/cpu.h"
+#include "libavutil/float_dsp.h"
+#include "cpu.h"
+
+void ff_vector_fmul_neon(float *dst, const float *src0, const float *src1,
+ int len);
+
+void ff_vector_fmac_scalar_neon(float *dst, const float *src, float mul,
+ int len);
+
+void ff_vector_fmul_scalar_neon(float *dst, const float *src, float mul,
+ int len);
+
+void ff_vector_dmul_scalar_neon(double *dst, const double *src, double mul,
+ int len);
+
+void ff_vector_fmul_window_neon(float *dst, const float *src0,
+ const float *src1, const float *win, int len);
+
+void ff_vector_fmul_add_neon(float *dst, const float *src0, const float *src1,
+ const float *src2, int len);
+
+void ff_vector_fmul_reverse_neon(float *dst, const float *src0,
+ const float *src1, int len);
+
+void ff_butterflies_float_neon(float *v1, float *v2, int len);
+
+float ff_scalarproduct_float_neon(const float *v1, const float *v2, int len);
+
+av_cold void ff_float_dsp_init_aarch64(AVFloatDSPContext *fdsp)
+{
+ int cpu_flags = av_get_cpu_flags();
+
+ if (have_neon(cpu_flags)) {
+ fdsp->butterflies_float = ff_butterflies_float_neon;
+ fdsp->scalarproduct_float = ff_scalarproduct_float_neon;
+ fdsp->vector_dmul_scalar = ff_vector_dmul_scalar_neon;
+ fdsp->vector_fmul = ff_vector_fmul_neon;
+ fdsp->vector_fmac_scalar = ff_vector_fmac_scalar_neon;
+ fdsp->vector_fmul_add = ff_vector_fmul_add_neon;
+ fdsp->vector_fmul_reverse = ff_vector_fmul_reverse_neon;
+ fdsp->vector_fmul_scalar = ff_vector_fmul_scalar_neon;
+ fdsp->vector_fmul_window = ff_vector_fmul_window_neon;
+ }
+}
diff --git a/media/ffvpx/libavutil/aarch64/float_dsp_neon.S b/media/ffvpx/libavutil/aarch64/float_dsp_neon.S
new file mode 100644
index 0000000000..02d790c0cc
--- /dev/null
+++ b/media/ffvpx/libavutil/aarch64/float_dsp_neon.S
@@ -0,0 +1,202 @@
+/*
+ * ARM NEON optimised Float DSP functions
+ * Copyright (c) 2008 Mans Rullgard <mans@mansr.com>
+ * Copyright (c) 2014 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 "asm.S"
+
+function ff_vector_fmul_neon, export=1
+1: subs w3, w3, #16
+ ld1 {v0.4S, v1.4S}, [x1], #32
+ ld1 {v2.4S, v3.4S}, [x1], #32
+ ld1 {v4.4S, v5.4S}, [x2], #32
+ ld1 {v6.4S, v7.4S}, [x2], #32
+ fmul v16.4S, v0.4S, v4.4S
+ fmul v17.4S, v1.4S, v5.4S
+ fmul v18.4S, v2.4S, v6.4S
+ fmul v19.4S, v3.4S, v7.4S
+ st1 {v16.4S, v17.4S}, [x0], #32
+ st1 {v18.4S, v19.4S}, [x0], #32
+ b.ne 1b
+ ret
+endfunc
+
+function ff_vector_fmac_scalar_neon, export=1
+ mov x3, #-32
+1: subs w2, w2, #16
+ ld1 {v16.4S, v17.4S}, [x0], #32
+ ld1 {v18.4S, v19.4S}, [x0], x3
+ ld1 {v4.4S, v5.4S}, [x1], #32
+ ld1 {v6.4S, v7.4S}, [x1], #32
+ fmla v16.4S, v4.4S, v0.S[0]
+ fmla v17.4S, v5.4S, v0.S[0]
+ fmla v18.4S, v6.4S, v0.S[0]
+ fmla v19.4S, v7.4S, v0.S[0]
+ st1 {v16.4S, v17.4S}, [x0], #32
+ st1 {v18.4S, v19.4S}, [x0], #32
+ b.ne 1b
+ ret
+endfunc
+
+function ff_vector_fmul_scalar_neon, export=1
+ mov w4, #15
+ bics w3, w2, w4
+ dup v16.4S, v0.S[0]
+ b.eq 3f
+ ld1 {v0.4S, v1.4S}, [x1], #32
+1: subs w3, w3, #16
+ fmul v0.4S, v0.4S, v16.4S
+ ld1 {v2.4S, v3.4S}, [x1], #32
+ fmul v1.4S, v1.4S, v16.4S
+ fmul v2.4S, v2.4S, v16.4S
+ st1 {v0.4S, v1.4S}, [x0], #32
+ fmul v3.4S, v3.4S, v16.4S
+ b.eq 2f
+ ld1 {v0.4S, v1.4S}, [x1], #32
+ st1 {v2.4S, v3.4S}, [x0], #32
+ b 1b
+2: ands w2, w2, #15
+ st1 {v2.4S, v3.4S}, [x0], #32
+ b.eq 4f
+3: ld1 {v0.4S}, [x1], #16
+ fmul v0.4S, v0.4S, v16.4S
+ st1 {v0.4S}, [x0], #16
+ subs w2, w2, #4
+ b.gt 3b
+4: ret
+endfunc
+
+function ff_vector_dmul_scalar_neon, export=1
+ dup v16.2D, v0.D[0]
+ ld1 {v0.2D, v1.2D}, [x1], #32
+1: subs w2, w2, #8
+ fmul v0.2D, v0.2D, v16.2D
+ ld1 {v2.2D, v3.2D}, [x1], #32
+ fmul v1.2D, v1.2D, v16.2D
+ fmul v2.2D, v2.2D, v16.2D
+ st1 {v0.2D, v1.2D}, [x0], #32
+ fmul v3.2D, v3.2D, v16.2D
+ ld1 {v0.2D, v1.2D}, [x1], #32
+ st1 {v2.2D, v3.2D}, [x0], #32
+ b.gt 1b
+ ret
+endfunc
+
+function ff_vector_fmul_window_neon, export=1
+ sxtw x4, w4 // len
+ sub x2, x2, #8
+ sub x5, x4, #2
+ add x2, x2, x5, lsl #2 // src1 + 4 * (len - 4)
+ add x6, x3, x5, lsl #3 // win + 8 * (len - 2)
+ add x5, x0, x5, lsl #3 // dst + 8 * (len - 2)
+ mov x7, #-16
+ ld1 {v0.4S}, [x1], #16 // s0
+ ld1 {v2.4S}, [x3], #16 // wi
+ ld1 {v1.4S}, [x2], x7 // s1
+1: ld1 {v3.4S}, [x6], x7 // wj
+ subs x4, x4, #4
+ fmul v17.4S, v0.4S, v2.4S // s0 * wi
+ rev64 v4.4S, v1.4S
+ rev64 v5.4S, v3.4S
+ rev64 v17.4S, v17.4S
+ ext v4.16B, v4.16B, v4.16B, #8 // s1_r
+ ext v5.16B, v5.16B, v5.16B, #8 // wj_r
+ ext v17.16B, v17.16B, v17.16B, #8 // (s0 * wi)_rev
+ fmul v16.4S, v0.4S, v5.4S // s0 * wj_r
+ fmla v17.4S, v1.4S, v3.4S // (s0 * wi)_rev + s1 * wj
+ b.eq 2f
+ ld1 {v0.4S}, [x1], #16
+ fmls v16.4S, v4.4S, v2.4S // s0 * wj_r - s1_r * wi
+ st1 {v17.4S}, [x5], x7
+ ld1 {v2.4S}, [x3], #16
+ ld1 {v1.4S}, [x2], x7
+ st1 {v16.4S}, [x0], #16
+ b 1b
+2:
+ fmls v16.4S, v4.4S, v2.4S // s0 * wj_r - s1_r * wi
+ st1 {v17.4S}, [x5], x7
+ st1 {v16.4S}, [x0], #16
+ ret
+endfunc
+
+function ff_vector_fmul_add_neon, export=1
+ ld1 {v0.4S, v1.4S}, [x1], #32
+ ld1 {v2.4S, v3.4S}, [x2], #32
+ ld1 {v4.4S, v5.4S}, [x3], #32
+1: subs w4, w4, #8
+ fmla v4.4S, v0.4S, v2.4S
+ fmla v5.4S, v1.4S, v3.4S
+ b.eq 2f
+ ld1 {v0.4S, v1.4S}, [x1], #32
+ ld1 {v2.4S, v3.4S}, [x2], #32
+ st1 {v4.4S, v5.4S}, [x0], #32
+ ld1 {v4.4S, v5.4S}, [x3], #32
+ b 1b
+2: st1 {v4.4S, v5.4S}, [x0], #32
+ ret
+endfunc
+
+function ff_vector_fmul_reverse_neon, export=1
+ sxtw x3, w3
+ add x2, x2, x3, lsl #2
+ sub x2, x2, #32
+ mov x4, #-32
+ ld1 {v2.4S, v3.4S}, [x2], x4
+ ld1 {v0.4S, v1.4S}, [x1], #32
+1: subs x3, x3, #8
+ rev64 v3.4S, v3.4S
+ rev64 v2.4S, v2.4S
+ ext v3.16B, v3.16B, v3.16B, #8
+ ext v2.16B, v2.16B, v2.16B, #8
+ fmul v16.4S, v0.4S, v3.4S
+ fmul v17.4S, v1.4S, v2.4S
+ b.eq 2f
+ ld1 {v2.4S, v3.4S}, [x2], x4
+ ld1 {v0.4S, v1.4S}, [x1], #32
+ st1 {v16.4S, v17.4S}, [x0], #32
+ b 1b
+2: st1 {v16.4S, v17.4S}, [x0], #32
+ ret
+endfunc
+
+function ff_butterflies_float_neon, export=1
+1: ld1 {v0.4S}, [x0]
+ ld1 {v1.4S}, [x1]
+ subs w2, w2, #4
+ fsub v2.4S, v0.4S, v1.4S
+ fadd v3.4S, v0.4S, v1.4S
+ st1 {v2.4S}, [x1], #16
+ st1 {v3.4S}, [x0], #16
+ b.gt 1b
+ ret
+endfunc
+
+function ff_scalarproduct_float_neon, export=1
+ movi v2.4S, #0
+1: ld1 {v0.4S}, [x0], #16
+ ld1 {v1.4S}, [x1], #16
+ subs w2, w2, #4
+ fmla v2.4S, v0.4S, v1.4S
+ b.gt 1b
+ faddp v0.4S, v2.4S, v2.4S
+ faddp s0, v0.2S
+ ret
+endfunc
diff --git a/media/ffvpx/libavutil/aarch64/moz.build b/media/ffvpx/libavutil/aarch64/moz.build
new file mode 100644
index 0000000000..9233abf768
--- /dev/null
+++ b/media/ffvpx/libavutil/aarch64/moz.build
@@ -0,0 +1,19 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+SOURCES += [
+ 'cpu.c',
+ 'float_dsp_init.c',
+ 'float_dsp_neon.S',
+]
+
+if CONFIG['OS_ARCH'] == 'WINNT':
+ USE_INTEGRATED_CLANGCL_AS = True
+ DEFINES['EXTERN_ASM'] = ''
+
+FINAL_LIBRARY = 'mozavutil'
+
+include('/media/ffvpx/ffvpxcommon.mozbuild')
diff --git a/media/ffvpx/libavutil/aarch64/timer.h b/media/ffvpx/libavutil/aarch64/timer.h
new file mode 100644
index 0000000000..8b28fd354c
--- /dev/null
+++ b/media/ffvpx/libavutil/aarch64/timer.h
@@ -0,0 +1,50 @@
+/*
+ * 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
+ */
+
+#ifndef AVUTIL_AARCH64_TIMER_H
+#define AVUTIL_AARCH64_TIMER_H
+
+#include <stdint.h>
+#include "config.h"
+
+#if defined(__APPLE__)
+
+#include <mach/mach_time.h>
+
+#define AV_READ_TIME mach_absolute_time
+
+#elif HAVE_INLINE_ASM
+
+#define AV_READ_TIME read_time
+
+static inline uint64_t read_time(void)
+{
+ uint64_t cycle_counter;
+ __asm__ volatile(
+ "isb \t\n"
+ "mrs %0, pmccntr_el0 "
+ : "=r"(cycle_counter) :: "memory" );
+
+ return cycle_counter;
+}
+
+#endif /* HAVE_INLINE_ASM */
+
+#endif /* AVUTIL_AARCH64_TIMER_H */