early-access version 1432
This commit is contained in:
7
externals/ffmpeg/libavresample/arm/Makefile
vendored
Executable file
7
externals/ffmpeg/libavresample/arm/Makefile
vendored
Executable file
@@ -0,0 +1,7 @@
|
||||
OBJS += arm/audio_convert_init.o \
|
||||
arm/resample_init.o
|
||||
|
||||
OBJS-$(CONFIG_NEON_CLOBBER_TEST) += arm/neontest.o
|
||||
|
||||
NEON-OBJS += arm/audio_convert_neon.o \
|
||||
arm/resample_neon.o
|
29
externals/ffmpeg/libavresample/arm/asm-offsets.h
vendored
Executable file
29
externals/ffmpeg/libavresample/arm/asm-offsets.h
vendored
Executable file
@@ -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 AVRESAMPLE_ARM_ASM_OFFSETS_H
|
||||
#define AVRESAMPLE_ARM_ASM_OFFSETS_H
|
||||
|
||||
/* struct ResampleContext */
|
||||
#define FILTER_BANK 0x08
|
||||
#define FILTER_LENGTH 0x0c
|
||||
#define SRC_INCR 0x20
|
||||
#define PHASE_SHIFT 0x28
|
||||
#define PHASE_MASK (PHASE_SHIFT + 0x04)
|
||||
|
||||
#endif /* AVRESAMPLE_ARM_ASM_OFFSETS_H */
|
49
externals/ffmpeg/libavresample/arm/audio_convert_init.c
vendored
Executable file
49
externals/ffmpeg/libavresample/arm/audio_convert_init.c
vendored
Executable file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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 "config.h"
|
||||
#include "libavutil/attributes.h"
|
||||
#include "libavutil/cpu.h"
|
||||
#include "libavutil/arm/cpu.h"
|
||||
#include "libavutil/samplefmt.h"
|
||||
#include "libavresample/audio_convert.h"
|
||||
|
||||
void ff_conv_flt_to_s16_neon(int16_t *dst, const float *src, int len);
|
||||
void ff_conv_fltp_to_s16_neon(int16_t *dst, float *const *src,
|
||||
int len, int channels);
|
||||
void ff_conv_fltp_to_s16_2ch_neon(int16_t *dst, float *const *src,
|
||||
int len, int channels);
|
||||
|
||||
av_cold void ff_audio_convert_init_arm(AudioConvert *ac)
|
||||
{
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
if (have_neon(cpu_flags)) {
|
||||
ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT,
|
||||
0, 16, 8, "NEON",
|
||||
ff_conv_flt_to_s16_neon);
|
||||
ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP,
|
||||
0, 16, 8, "NEON",
|
||||
ff_conv_fltp_to_s16_neon);
|
||||
ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP,
|
||||
2, 16, 8, "NEON",
|
||||
ff_conv_fltp_to_s16_2ch_neon);
|
||||
}
|
||||
}
|
363
externals/ffmpeg/libavresample/arm/audio_convert_neon.S
vendored
Executable file
363
externals/ffmpeg/libavresample/arm/audio_convert_neon.S
vendored
Executable file
@@ -0,0 +1,363 @@
|
||||
/*
|
||||
* 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"
|
||||
#include "libavutil/arm/asm.S"
|
||||
|
||||
function ff_conv_flt_to_s16_neon, export=1
|
||||
subs r2, r2, #8
|
||||
vld1.32 {q0}, [r1,:128]!
|
||||
vcvt.s32.f32 q8, q0, #31
|
||||
vld1.32 {q1}, [r1,:128]!
|
||||
vcvt.s32.f32 q9, q1, #31
|
||||
beq 3f
|
||||
bics r12, r2, #15
|
||||
beq 2f
|
||||
1: subs r12, r12, #16
|
||||
vqrshrn.s32 d4, q8, #16
|
||||
vld1.32 {q0}, [r1,:128]!
|
||||
vcvt.s32.f32 q0, q0, #31
|
||||
vqrshrn.s32 d5, q9, #16
|
||||
vld1.32 {q1}, [r1,:128]!
|
||||
vcvt.s32.f32 q1, q1, #31
|
||||
vqrshrn.s32 d6, q0, #16
|
||||
vst1.16 {q2}, [r0,:128]!
|
||||
vqrshrn.s32 d7, q1, #16
|
||||
vld1.32 {q8}, [r1,:128]!
|
||||
vcvt.s32.f32 q8, q8, #31
|
||||
vld1.32 {q9}, [r1,:128]!
|
||||
vcvt.s32.f32 q9, q9, #31
|
||||
vst1.16 {q3}, [r0,:128]!
|
||||
bne 1b
|
||||
ands r2, r2, #15
|
||||
beq 3f
|
||||
2: vld1.32 {q0}, [r1,:128]!
|
||||
vqrshrn.s32 d4, q8, #16
|
||||
vcvt.s32.f32 q0, q0, #31
|
||||
vld1.32 {q1}, [r1,:128]!
|
||||
vqrshrn.s32 d5, q9, #16
|
||||
vcvt.s32.f32 q1, q1, #31
|
||||
vqrshrn.s32 d6, q0, #16
|
||||
vst1.16 {q2}, [r0,:128]!
|
||||
vqrshrn.s32 d7, q1, #16
|
||||
vst1.16 {q3}, [r0,:128]!
|
||||
bx lr
|
||||
3: vqrshrn.s32 d4, q8, #16
|
||||
vqrshrn.s32 d5, q9, #16
|
||||
vst1.16 {q2}, [r0,:128]!
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
function ff_conv_fltp_to_s16_2ch_neon, export=1
|
||||
ldm r1, {r1, r3}
|
||||
subs r2, r2, #8
|
||||
vld1.32 {q0}, [r1,:128]!
|
||||
vcvt.s32.f32 q8, q0, #31
|
||||
vld1.32 {q1}, [r1,:128]!
|
||||
vcvt.s32.f32 q9, q1, #31
|
||||
vld1.32 {q10}, [r3,:128]!
|
||||
vcvt.s32.f32 q10, q10, #31
|
||||
vld1.32 {q11}, [r3,:128]!
|
||||
vcvt.s32.f32 q11, q11, #31
|
||||
beq 3f
|
||||
bics r12, r2, #15
|
||||
beq 2f
|
||||
1: subs r12, r12, #16
|
||||
vld1.32 {q0}, [r1,:128]!
|
||||
vcvt.s32.f32 q0, q0, #31
|
||||
vsri.32 q10, q8, #16
|
||||
vld1.32 {q1}, [r1,:128]!
|
||||
vcvt.s32.f32 q1, q1, #31
|
||||
vld1.32 {q12}, [r3,:128]!
|
||||
vcvt.s32.f32 q12, q12, #31
|
||||
vld1.32 {q13}, [r3,:128]!
|
||||
vsri.32 q11, q9, #16
|
||||
vst1.16 {q10}, [r0,:128]!
|
||||
vcvt.s32.f32 q13, q13, #31
|
||||
vst1.16 {q11}, [r0,:128]!
|
||||
vsri.32 q12, q0, #16
|
||||
vld1.32 {q8}, [r1,:128]!
|
||||
vsri.32 q13, q1, #16
|
||||
vst1.16 {q12}, [r0,:128]!
|
||||
vcvt.s32.f32 q8, q8, #31
|
||||
vld1.32 {q9}, [r1,:128]!
|
||||
vcvt.s32.f32 q9, q9, #31
|
||||
vld1.32 {q10}, [r3,:128]!
|
||||
vcvt.s32.f32 q10, q10, #31
|
||||
vld1.32 {q11}, [r3,:128]!
|
||||
vcvt.s32.f32 q11, q11, #31
|
||||
vst1.16 {q13}, [r0,:128]!
|
||||
bne 1b
|
||||
ands r2, r2, #15
|
||||
beq 3f
|
||||
2: vsri.32 q10, q8, #16
|
||||
vld1.32 {q0}, [r1,:128]!
|
||||
vcvt.s32.f32 q0, q0, #31
|
||||
vld1.32 {q1}, [r1,:128]!
|
||||
vcvt.s32.f32 q1, q1, #31
|
||||
vld1.32 {q12}, [r3,:128]!
|
||||
vcvt.s32.f32 q12, q12, #31
|
||||
vsri.32 q11, q9, #16
|
||||
vld1.32 {q13}, [r3,:128]!
|
||||
vcvt.s32.f32 q13, q13, #31
|
||||
vst1.16 {q10}, [r0,:128]!
|
||||
vsri.32 q12, q0, #16
|
||||
vst1.16 {q11}, [r0,:128]!
|
||||
vsri.32 q13, q1, #16
|
||||
vst1.16 {q12-q13},[r0,:128]!
|
||||
bx lr
|
||||
3: vsri.32 q10, q8, #16
|
||||
vsri.32 q11, q9, #16
|
||||
vst1.16 {q10-q11},[r0,:128]!
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
function ff_conv_fltp_to_s16_neon, export=1
|
||||
cmp r3, #2
|
||||
itt lt
|
||||
ldrlt r1, [r1]
|
||||
blt X(ff_conv_flt_to_s16_neon)
|
||||
beq X(ff_conv_fltp_to_s16_2ch_neon)
|
||||
|
||||
push {r4-r8, lr}
|
||||
cmp r3, #4
|
||||
lsl r12, r3, #1
|
||||
blt 4f
|
||||
|
||||
@ 4 channels
|
||||
5: ldm r1!, {r4-r7}
|
||||
mov lr, r2
|
||||
mov r8, r0
|
||||
vld1.32 {q8}, [r4,:128]!
|
||||
vcvt.s32.f32 q8, q8, #31
|
||||
vld1.32 {q9}, [r5,:128]!
|
||||
vcvt.s32.f32 q9, q9, #31
|
||||
vld1.32 {q10}, [r6,:128]!
|
||||
vcvt.s32.f32 q10, q10, #31
|
||||
vld1.32 {q11}, [r7,:128]!
|
||||
vcvt.s32.f32 q11, q11, #31
|
||||
6: subs lr, lr, #8
|
||||
vld1.32 {q0}, [r4,:128]!
|
||||
vcvt.s32.f32 q0, q0, #31
|
||||
vsri.32 q9, q8, #16
|
||||
vld1.32 {q1}, [r5,:128]!
|
||||
vcvt.s32.f32 q1, q1, #31
|
||||
vsri.32 q11, q10, #16
|
||||
vld1.32 {q2}, [r6,:128]!
|
||||
vcvt.s32.f32 q2, q2, #31
|
||||
vzip.32 d18, d22
|
||||
vld1.32 {q3}, [r7,:128]!
|
||||
vcvt.s32.f32 q3, q3, #31
|
||||
vzip.32 d19, d23
|
||||
vst1.16 {d18}, [r8], r12
|
||||
vsri.32 q1, q0, #16
|
||||
vst1.16 {d22}, [r8], r12
|
||||
vsri.32 q3, q2, #16
|
||||
vst1.16 {d19}, [r8], r12
|
||||
vzip.32 d2, d6
|
||||
vst1.16 {d23}, [r8], r12
|
||||
vzip.32 d3, d7
|
||||
beq 7f
|
||||
vld1.32 {q8}, [r4,:128]!
|
||||
vcvt.s32.f32 q8, q8, #31
|
||||
vst1.16 {d2}, [r8], r12
|
||||
vld1.32 {q9}, [r5,:128]!
|
||||
vcvt.s32.f32 q9, q9, #31
|
||||
vst1.16 {d6}, [r8], r12
|
||||
vld1.32 {q10}, [r6,:128]!
|
||||
vcvt.s32.f32 q10, q10, #31
|
||||
vst1.16 {d3}, [r8], r12
|
||||
vld1.32 {q11}, [r7,:128]!
|
||||
vcvt.s32.f32 q11, q11, #31
|
||||
vst1.16 {d7}, [r8], r12
|
||||
b 6b
|
||||
7: vst1.16 {d2}, [r8], r12
|
||||
vst1.16 {d6}, [r8], r12
|
||||
vst1.16 {d3}, [r8], r12
|
||||
vst1.16 {d7}, [r8], r12
|
||||
subs r3, r3, #4
|
||||
it eq
|
||||
popeq {r4-r8, pc}
|
||||
cmp r3, #4
|
||||
add r0, r0, #8
|
||||
bge 5b
|
||||
|
||||
@ 2 channels
|
||||
4: cmp r3, #2
|
||||
blt 4f
|
||||
ldm r1!, {r4-r5}
|
||||
mov lr, r2
|
||||
mov r8, r0
|
||||
tst lr, #8
|
||||
vld1.32 {q8}, [r4,:128]!
|
||||
vcvt.s32.f32 q8, q8, #31
|
||||
vld1.32 {q9}, [r5,:128]!
|
||||
vcvt.s32.f32 q9, q9, #31
|
||||
vld1.32 {q10}, [r4,:128]!
|
||||
vcvt.s32.f32 q10, q10, #31
|
||||
vld1.32 {q11}, [r5,:128]!
|
||||
vcvt.s32.f32 q11, q11, #31
|
||||
beq 6f
|
||||
subs lr, lr, #8
|
||||
beq 7f
|
||||
vsri.32 d18, d16, #16
|
||||
vsri.32 d19, d17, #16
|
||||
vld1.32 {q8}, [r4,:128]!
|
||||
vcvt.s32.f32 q8, q8, #31
|
||||
vst1.32 {d18[0]}, [r8], r12
|
||||
vsri.32 d22, d20, #16
|
||||
vst1.32 {d18[1]}, [r8], r12
|
||||
vsri.32 d23, d21, #16
|
||||
vst1.32 {d19[0]}, [r8], r12
|
||||
vst1.32 {d19[1]}, [r8], r12
|
||||
vld1.32 {q9}, [r5,:128]!
|
||||
vcvt.s32.f32 q9, q9, #31
|
||||
vst1.32 {d22[0]}, [r8], r12
|
||||
vst1.32 {d22[1]}, [r8], r12
|
||||
vld1.32 {q10}, [r4,:128]!
|
||||
vcvt.s32.f32 q10, q10, #31
|
||||
vst1.32 {d23[0]}, [r8], r12
|
||||
vst1.32 {d23[1]}, [r8], r12
|
||||
vld1.32 {q11}, [r5,:128]!
|
||||
vcvt.s32.f32 q11, q11, #31
|
||||
6: subs lr, lr, #16
|
||||
vld1.32 {q0}, [r4,:128]!
|
||||
vcvt.s32.f32 q0, q0, #31
|
||||
vsri.32 d18, d16, #16
|
||||
vld1.32 {q1}, [r5,:128]!
|
||||
vcvt.s32.f32 q1, q1, #31
|
||||
vsri.32 d19, d17, #16
|
||||
vld1.32 {q2}, [r4,:128]!
|
||||
vcvt.s32.f32 q2, q2, #31
|
||||
vld1.32 {q3}, [r5,:128]!
|
||||
vcvt.s32.f32 q3, q3, #31
|
||||
vst1.32 {d18[0]}, [r8], r12
|
||||
vsri.32 d22, d20, #16
|
||||
vst1.32 {d18[1]}, [r8], r12
|
||||
vsri.32 d23, d21, #16
|
||||
vst1.32 {d19[0]}, [r8], r12
|
||||
vsri.32 d2, d0, #16
|
||||
vst1.32 {d19[1]}, [r8], r12
|
||||
vsri.32 d3, d1, #16
|
||||
vst1.32 {d22[0]}, [r8], r12
|
||||
vsri.32 d6, d4, #16
|
||||
vst1.32 {d22[1]}, [r8], r12
|
||||
vsri.32 d7, d5, #16
|
||||
vst1.32 {d23[0]}, [r8], r12
|
||||
vst1.32 {d23[1]}, [r8], r12
|
||||
beq 6f
|
||||
vld1.32 {q8}, [r4,:128]!
|
||||
vcvt.s32.f32 q8, q8, #31
|
||||
vst1.32 {d2[0]}, [r8], r12
|
||||
vst1.32 {d2[1]}, [r8], r12
|
||||
vld1.32 {q9}, [r5,:128]!
|
||||
vcvt.s32.f32 q9, q9, #31
|
||||
vst1.32 {d3[0]}, [r8], r12
|
||||
vst1.32 {d3[1]}, [r8], r12
|
||||
vld1.32 {q10}, [r4,:128]!
|
||||
vcvt.s32.f32 q10, q10, #31
|
||||
vst1.32 {d6[0]}, [r8], r12
|
||||
vst1.32 {d6[1]}, [r8], r12
|
||||
vld1.32 {q11}, [r5,:128]!
|
||||
vcvt.s32.f32 q11, q11, #31
|
||||
vst1.32 {d7[0]}, [r8], r12
|
||||
vst1.32 {d7[1]}, [r8], r12
|
||||
bgt 6b
|
||||
6: vst1.32 {d2[0]}, [r8], r12
|
||||
vst1.32 {d2[1]}, [r8], r12
|
||||
vst1.32 {d3[0]}, [r8], r12
|
||||
vst1.32 {d3[1]}, [r8], r12
|
||||
vst1.32 {d6[0]}, [r8], r12
|
||||
vst1.32 {d6[1]}, [r8], r12
|
||||
vst1.32 {d7[0]}, [r8], r12
|
||||
vst1.32 {d7[1]}, [r8], r12
|
||||
b 8f
|
||||
7: vsri.32 d18, d16, #16
|
||||
vsri.32 d19, d17, #16
|
||||
vst1.32 {d18[0]}, [r8], r12
|
||||
vsri.32 d22, d20, #16
|
||||
vst1.32 {d18[1]}, [r8], r12
|
||||
vsri.32 d23, d21, #16
|
||||
vst1.32 {d19[0]}, [r8], r12
|
||||
vst1.32 {d19[1]}, [r8], r12
|
||||
vst1.32 {d22[0]}, [r8], r12
|
||||
vst1.32 {d22[1]}, [r8], r12
|
||||
vst1.32 {d23[0]}, [r8], r12
|
||||
vst1.32 {d23[1]}, [r8], r12
|
||||
8: subs r3, r3, #2
|
||||
add r0, r0, #4
|
||||
it eq
|
||||
popeq {r4-r8, pc}
|
||||
|
||||
@ 1 channel
|
||||
4: ldr r4, [r1]
|
||||
tst r2, #8
|
||||
mov lr, r2
|
||||
mov r5, r0
|
||||
vld1.32 {q0}, [r4,:128]!
|
||||
vcvt.s32.f32 q0, q0, #31
|
||||
vld1.32 {q1}, [r4,:128]!
|
||||
vcvt.s32.f32 q1, q1, #31
|
||||
bne 8f
|
||||
6: subs lr, lr, #16
|
||||
vld1.32 {q2}, [r4,:128]!
|
||||
vcvt.s32.f32 q2, q2, #31
|
||||
vld1.32 {q3}, [r4,:128]!
|
||||
vcvt.s32.f32 q3, q3, #31
|
||||
vst1.16 {d0[1]}, [r5,:16], r12
|
||||
vst1.16 {d0[3]}, [r5,:16], r12
|
||||
vst1.16 {d1[1]}, [r5,:16], r12
|
||||
vst1.16 {d1[3]}, [r5,:16], r12
|
||||
vst1.16 {d2[1]}, [r5,:16], r12
|
||||
vst1.16 {d2[3]}, [r5,:16], r12
|
||||
vst1.16 {d3[1]}, [r5,:16], r12
|
||||
vst1.16 {d3[3]}, [r5,:16], r12
|
||||
beq 7f
|
||||
vld1.32 {q0}, [r4,:128]!
|
||||
vcvt.s32.f32 q0, q0, #31
|
||||
vld1.32 {q1}, [r4,:128]!
|
||||
vcvt.s32.f32 q1, q1, #31
|
||||
7: vst1.16 {d4[1]}, [r5,:16], r12
|
||||
vst1.16 {d4[3]}, [r5,:16], r12
|
||||
vst1.16 {d5[1]}, [r5,:16], r12
|
||||
vst1.16 {d5[3]}, [r5,:16], r12
|
||||
vst1.16 {d6[1]}, [r5,:16], r12
|
||||
vst1.16 {d6[3]}, [r5,:16], r12
|
||||
vst1.16 {d7[1]}, [r5,:16], r12
|
||||
vst1.16 {d7[3]}, [r5,:16], r12
|
||||
bgt 6b
|
||||
pop {r4-r8, pc}
|
||||
8: subs lr, lr, #8
|
||||
vst1.16 {d0[1]}, [r5,:16], r12
|
||||
vst1.16 {d0[3]}, [r5,:16], r12
|
||||
vst1.16 {d1[1]}, [r5,:16], r12
|
||||
vst1.16 {d1[3]}, [r5,:16], r12
|
||||
vst1.16 {d2[1]}, [r5,:16], r12
|
||||
vst1.16 {d2[3]}, [r5,:16], r12
|
||||
vst1.16 {d3[1]}, [r5,:16], r12
|
||||
vst1.16 {d3[3]}, [r5,:16], r12
|
||||
it eq
|
||||
popeq {r4-r8, pc}
|
||||
vld1.32 {q0}, [r4,:128]!
|
||||
vcvt.s32.f32 q0, q0, #31
|
||||
vld1.32 {q1}, [r4,:128]!
|
||||
vcvt.s32.f32 q1, q1, #31
|
||||
b 6b
|
||||
endfunc
|
31
externals/ffmpeg/libavresample/arm/neontest.c
vendored
Executable file
31
externals/ffmpeg/libavresample/arm/neontest.c
vendored
Executable file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* check NEON registers for clobbers
|
||||
* Copyright (c) 2013 Martin Storsjo
|
||||
*
|
||||
* 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 "libavresample/avresample.h"
|
||||
#include "libavutil/arm/neontest.h"
|
||||
|
||||
wrap(avresample_convert(AVAudioResampleContext *avr, uint8_t **output,
|
||||
int out_plane_size, int out_samples, uint8_t **input,
|
||||
int in_plane_size, int in_samples))
|
||||
{
|
||||
testneonclobbers(avresample_convert, avr, output, out_plane_size,
|
||||
out_samples, input, in_plane_size, in_samples);
|
||||
}
|
74
externals/ffmpeg/libavresample/arm/resample_init.c
vendored
Executable file
74
externals/ffmpeg/libavresample/arm/resample_init.c
vendored
Executable file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Peter Meerwald <pmeerw@pmeerw.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/cpu.h"
|
||||
#include "libavutil/arm/cpu.h"
|
||||
#include "libavutil/internal.h"
|
||||
#include "libavutil/samplefmt.h"
|
||||
|
||||
#include "libavresample/resample.h"
|
||||
|
||||
#include "asm-offsets.h"
|
||||
|
||||
AV_CHECK_OFFSET(struct ResampleContext, filter_bank, FILTER_BANK);
|
||||
AV_CHECK_OFFSET(struct ResampleContext, filter_length, FILTER_LENGTH);
|
||||
AV_CHECK_OFFSET(struct ResampleContext, src_incr, SRC_INCR);
|
||||
AV_CHECK_OFFSET(struct ResampleContext, phase_shift, PHASE_SHIFT);
|
||||
AV_CHECK_OFFSET(struct ResampleContext, phase_mask, PHASE_MASK);
|
||||
|
||||
void ff_resample_one_flt_neon(struct ResampleContext *c, void *dst0,
|
||||
int dst_index, const void *src0,
|
||||
unsigned int index, int frac);
|
||||
void ff_resample_one_s16_neon(struct ResampleContext *c, void *dst0,
|
||||
int dst_index, const void *src0,
|
||||
unsigned int index, int frac);
|
||||
void ff_resample_one_s32_neon(struct ResampleContext *c, void *dst0,
|
||||
int dst_index, const void *src0,
|
||||
unsigned int index, int frac);
|
||||
|
||||
void ff_resample_linear_flt_neon(struct ResampleContext *c, void *dst0,
|
||||
int dst_index, const void *src0,
|
||||
unsigned int index, int frac);
|
||||
|
||||
av_cold void ff_audio_resample_init_arm(ResampleContext *c,
|
||||
enum AVSampleFormat sample_fmt)
|
||||
{
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
if (have_neon(cpu_flags)) {
|
||||
switch (sample_fmt) {
|
||||
case AV_SAMPLE_FMT_FLTP:
|
||||
if (c->linear)
|
||||
c->resample_one = ff_resample_linear_flt_neon;
|
||||
else
|
||||
c->resample_one = ff_resample_one_flt_neon;
|
||||
break;
|
||||
case AV_SAMPLE_FMT_S16P:
|
||||
if (!c->linear)
|
||||
c->resample_one = ff_resample_one_s16_neon;
|
||||
break;
|
||||
case AV_SAMPLE_FMT_S32P:
|
||||
if (!c->linear)
|
||||
c->resample_one = ff_resample_one_s32_neon;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
358
externals/ffmpeg/libavresample/arm/resample_neon.S
vendored
Executable file
358
externals/ffmpeg/libavresample/arm/resample_neon.S
vendored
Executable file
@@ -0,0 +1,358 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Peter Meerwald <pmeerw@pmeerw.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 "libavutil/arm/asm.S"
|
||||
|
||||
#include "asm-offsets.h"
|
||||
|
||||
.macro resample_one fmt, es=2
|
||||
function ff_resample_one_\fmt\()_neon, export=1
|
||||
push {r4, r5}
|
||||
add r1, r1, r2, lsl #\es
|
||||
|
||||
ldr r2, [r0, #PHASE_SHIFT+4] /* phase_mask */
|
||||
ldr ip, [sp, #8] /* index */
|
||||
ldr r5, [r0, #FILTER_LENGTH]
|
||||
and r2, ip, r2 /* (index & phase_mask) */
|
||||
ldr r4, [r0, #PHASE_SHIFT]
|
||||
lsr r4, ip, r4 /* compute sample_index */
|
||||
mul r2, r2, r5
|
||||
|
||||
ldr ip, [r0, #FILTER_BANK]
|
||||
add r3, r3, r4, lsl #\es /* &src[sample_index] */
|
||||
|
||||
cmp r5, #8
|
||||
add r0, ip, r2, lsl #\es /* filter = &filter_bank[...] */
|
||||
|
||||
blt 5f
|
||||
8:
|
||||
subs r5, r5, #8
|
||||
LOAD4
|
||||
MUL4
|
||||
7:
|
||||
LOAD4
|
||||
beq 6f
|
||||
cmp r5, #8
|
||||
MLA4
|
||||
blt 4f
|
||||
subs r5, r5, #8
|
||||
LOAD4
|
||||
MLA4
|
||||
b 7b
|
||||
6:
|
||||
MLA4
|
||||
STORE
|
||||
pop {r4, r5}
|
||||
bx lr
|
||||
5:
|
||||
INIT4
|
||||
4: /* remaining filter_length 1 to 7 */
|
||||
cmp r5, #4
|
||||
blt 2f
|
||||
subs r5, r5, #4
|
||||
LOAD4
|
||||
MLA4
|
||||
beq 0f
|
||||
2: /* remaining filter_length 1 to 3 */
|
||||
cmp r5, #2
|
||||
blt 1f
|
||||
subs r5, r5, #2
|
||||
LOAD2
|
||||
MLA2
|
||||
beq 0f
|
||||
1: /* remaining filter_length 1 */
|
||||
LOAD1
|
||||
MLA1
|
||||
0:
|
||||
STORE
|
||||
pop {r4, r5}
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
.purgem LOAD1
|
||||
.purgem LOAD2
|
||||
.purgem LOAD4
|
||||
.purgem MLA1
|
||||
.purgem MLA2
|
||||
.purgem MLA4
|
||||
.purgem MUL4
|
||||
.purgem INIT4
|
||||
.purgem STORE
|
||||
.endm
|
||||
|
||||
|
||||
/* float32 */
|
||||
.macro LOAD1
|
||||
veor.32 d0, d0
|
||||
vld1.32 {d0[0]}, [r0]! /* load filter */
|
||||
vld1.32 {d4[0]}, [r3]! /* load src */
|
||||
.endm
|
||||
.macro LOAD2
|
||||
vld1.32 {d0}, [r0]! /* load filter */
|
||||
vld1.32 {d4}, [r3]! /* load src */
|
||||
.endm
|
||||
.macro LOAD4
|
||||
vld1.32 {d0,d1}, [r0]! /* load filter */
|
||||
vld1.32 {d4,d5}, [r3]! /* load src */
|
||||
.endm
|
||||
.macro MLA1
|
||||
vmla.f32 d16, d0, d4[0]
|
||||
.endm
|
||||
.macro MLA2
|
||||
vmla.f32 d16, d0, d4
|
||||
.endm
|
||||
.macro MLA4
|
||||
vmla.f32 d16, d0, d4
|
||||
vmla.f32 d17, d1, d5
|
||||
.endm
|
||||
.macro MUL4
|
||||
vmul.f32 d16, d0, d4
|
||||
vmul.f32 d17, d1, d5
|
||||
.endm
|
||||
.macro INIT4
|
||||
veor.f32 q8, q8
|
||||
.endm
|
||||
.macro STORE
|
||||
vpadd.f32 d16, d16, d17
|
||||
vpadd.f32 d16, d16, d16
|
||||
vst1.32 d16[0], [r1]
|
||||
.endm
|
||||
|
||||
resample_one flt, 2
|
||||
|
||||
|
||||
/* s32 */
|
||||
.macro LOAD1
|
||||
veor.32 d0, d0
|
||||
vld1.32 {d0[0]}, [r0]! /* load filter */
|
||||
vld1.32 {d4[0]}, [r3]! /* load src */
|
||||
.endm
|
||||
.macro LOAD2
|
||||
vld1.32 {d0}, [r0]! /* load filter */
|
||||
vld1.32 {d4}, [r3]! /* load src */
|
||||
.endm
|
||||
.macro LOAD4
|
||||
vld1.32 {d0,d1}, [r0]! /* load filter */
|
||||
vld1.32 {d4,d5}, [r3]! /* load src */
|
||||
.endm
|
||||
.macro MLA1
|
||||
vmlal.s32 q8, d0, d4[0]
|
||||
.endm
|
||||
.macro MLA2
|
||||
vmlal.s32 q8, d0, d4
|
||||
.endm
|
||||
.macro MLA4
|
||||
vmlal.s32 q8, d0, d4
|
||||
vmlal.s32 q9, d1, d5
|
||||
.endm
|
||||
.macro MUL4
|
||||
vmull.s32 q8, d0, d4
|
||||
vmull.s32 q9, d1, d5
|
||||
.endm
|
||||
.macro INIT4
|
||||
veor.s64 q8, q8
|
||||
veor.s64 q9, q9
|
||||
.endm
|
||||
.macro STORE
|
||||
vadd.s64 q8, q8, q9
|
||||
vadd.s64 d16, d16, d17
|
||||
vqrshrn.s64 d16, q8, #30
|
||||
vst1.32 d16[0], [r1]
|
||||
.endm
|
||||
|
||||
resample_one s32, 2
|
||||
|
||||
|
||||
/* s16 */
|
||||
.macro LOAD1
|
||||
veor.16 d0, d0
|
||||
vld1.16 {d0[0]}, [r0]! /* load filter */
|
||||
vld1.16 {d4[0]}, [r3]! /* load src */
|
||||
.endm
|
||||
.macro LOAD2
|
||||
veor.16 d0, d0
|
||||
vld1.32 {d0[0]}, [r0]! /* load filter */
|
||||
veor.16 d4, d4
|
||||
vld1.32 {d4[0]}, [r3]! /* load src */
|
||||
.endm
|
||||
.macro LOAD4
|
||||
vld1.16 {d0}, [r0]! /* load filter */
|
||||
vld1.16 {d4}, [r3]! /* load src */
|
||||
.endm
|
||||
.macro MLA1
|
||||
vmlal.s16 q8, d0, d4[0]
|
||||
.endm
|
||||
.macro MLA2
|
||||
vmlal.s16 q8, d0, d4
|
||||
.endm
|
||||
.macro MLA4
|
||||
vmlal.s16 q8, d0, d4
|
||||
.endm
|
||||
.macro MUL4
|
||||
vmull.s16 q8, d0, d4
|
||||
.endm
|
||||
.macro INIT4
|
||||
veor.s32 q8, q8
|
||||
.endm
|
||||
.macro STORE
|
||||
vpadd.s32 d16, d16, d17
|
||||
vpadd.s32 d16, d16, d16
|
||||
vqrshrn.s32 d16, q8, #15
|
||||
vst1.16 d16[0], [r1]
|
||||
.endm
|
||||
|
||||
resample_one s16, 1
|
||||
|
||||
|
||||
.macro resample_linear fmt, es=2
|
||||
function ff_resample_linear_\fmt\()_neon, export=1
|
||||
push {r4, r5}
|
||||
add r1, r1, r2, lsl #\es
|
||||
|
||||
ldr r2, [r0, #PHASE_SHIFT+4] /* phase_mask */
|
||||
ldr ip, [sp, #8] /* index */
|
||||
ldr r5, [r0, #FILTER_LENGTH]
|
||||
and r2, ip, r2 /* (index & phase_mask) */
|
||||
ldr r4, [r0, #PHASE_SHIFT]
|
||||
lsr r4, ip, r4 /* compute sample_index */
|
||||
mul r2, r2, r5
|
||||
|
||||
ldr ip, [r0, #FILTER_BANK]
|
||||
add r3, r3, r4, lsl #\es /* &src[sample_index] */
|
||||
|
||||
cmp r5, #8
|
||||
ldr r4, [r0, #SRC_INCR]
|
||||
add r0, ip, r2, lsl #\es /* filter = &filter_bank[...] */
|
||||
add r2, r0, r5, lsl #\es /* filter[... + c->filter_length] */
|
||||
|
||||
blt 5f
|
||||
8:
|
||||
subs r5, r5, #8
|
||||
LOAD4
|
||||
MUL4
|
||||
7:
|
||||
LOAD4
|
||||
beq 6f
|
||||
cmp r5, #8
|
||||
MLA4
|
||||
blt 4f
|
||||
subs r5, r5, #8
|
||||
LOAD4
|
||||
MLA4
|
||||
b 7b
|
||||
6:
|
||||
MLA4
|
||||
STORE
|
||||
pop {r4, r5}
|
||||
bx lr
|
||||
5:
|
||||
INIT4
|
||||
4: /* remaining filter_length 1 to 7 */
|
||||
cmp r5, #4
|
||||
blt 2f
|
||||
subs r5, r5, #4
|
||||
LOAD4
|
||||
MLA4
|
||||
beq 0f
|
||||
2: /* remaining filter_length 1 to 3 */
|
||||
cmp r5, #2
|
||||
blt 1f
|
||||
subs r5, r5, #2
|
||||
LOAD2
|
||||
MLA2
|
||||
beq 0f
|
||||
1: /* remaining filter_length 1 */
|
||||
LOAD1
|
||||
MLA1
|
||||
0:
|
||||
STORE
|
||||
pop {r4, r5}
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
.purgem LOAD1
|
||||
.purgem LOAD2
|
||||
.purgem LOAD4
|
||||
.purgem MLA1
|
||||
.purgem MLA2
|
||||
.purgem MLA4
|
||||
.purgem MUL4
|
||||
.purgem INIT4
|
||||
.purgem STORE
|
||||
.endm
|
||||
|
||||
|
||||
/* float32 linear */
|
||||
.macro LOAD1
|
||||
veor.32 d0, d0
|
||||
veor.32 d2, d2
|
||||
vld1.32 {d0[0]}, [r0]! /* load filter */
|
||||
vld1.32 {d2[0]}, [r2]! /* load filter */
|
||||
vld1.32 {d4[0]}, [r3]! /* load src */
|
||||
.endm
|
||||
.macro LOAD2
|
||||
vld1.32 {d0}, [r0]! /* load filter */
|
||||
vld1.32 {d2}, [r2]! /* load filter */
|
||||
vld1.32 {d4}, [r3]! /* load src */
|
||||
.endm
|
||||
.macro LOAD4
|
||||
vld1.32 {d0,d1}, [r0]! /* load filter */
|
||||
vld1.32 {d2,d3}, [r2]! /* load filter */
|
||||
vld1.32 {d4,d5}, [r3]! /* load src */
|
||||
.endm
|
||||
.macro MLA1
|
||||
vmla.f32 d18, d0, d4[0]
|
||||
vmla.f32 d16, d2, d4[0]
|
||||
.endm
|
||||
.macro MLA2
|
||||
vmla.f32 d18, d0, d4
|
||||
vmla.f32 d16, d2, d4
|
||||
.endm
|
||||
.macro MLA4
|
||||
vmla.f32 q9, q0, q2
|
||||
vmla.f32 q8, q1, q2
|
||||
.endm
|
||||
.macro MUL4
|
||||
vmul.f32 q9, q0, q2
|
||||
vmul.f32 q8, q1, q2
|
||||
.endm
|
||||
.macro INIT4
|
||||
veor.f32 q9, q9
|
||||
veor.f32 q8, q8
|
||||
.endm
|
||||
.macro STORE
|
||||
vldr s0, [sp, #12] /* frac */
|
||||
vmov s1, r4
|
||||
vcvt.f32.s32 d0, d0
|
||||
|
||||
vsub.f32 q8, q8, q9 /* v2 - val */
|
||||
vpadd.f32 d18, d18, d19
|
||||
vpadd.f32 d16, d16, d17
|
||||
vpadd.f32 d2, d18, d18
|
||||
vpadd.f32 d1, d16, d16
|
||||
|
||||
vmul.f32 s2, s2, s0 /* (v2 - val) * frac */
|
||||
vdiv.f32 s2, s2, s1 /* / c->src_incr */
|
||||
vadd.f32 s4, s4, s2
|
||||
|
||||
vstr s4, [r1]
|
||||
.endm
|
||||
|
||||
resample_linear flt, 2
|
Reference in New Issue
Block a user