mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-08-09 17:39:08 +00:00
avcodec/fmtconvert: Remove int32_to_float_fmul_array8
Unused since aebf07075f.
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -24,9 +24,6 @@
|
||||
#include "libavutil/aarch64/cpu.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);
|
||||
|
||||
@@ -35,7 +32,6 @@ av_cold void ff_fmt_convert_init_aarch64(FmtConvertContext *c)
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,36 +41,3 @@ function ff_int32_to_float_fmul_scalar_neon, export=1
|
||||
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
|
||||
|
||||
@@ -24,17 +24,11 @@
|
||||
#include "libavutil/arm/cpu.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);
|
||||
|
||||
void ff_int32_to_float_fmul_scalar_vfp(float *dst, const int32_t *src,
|
||||
float mul, int len);
|
||||
void ff_int32_to_float_fmul_array8_vfp(FmtConvertContext *c, float *dst,
|
||||
const int32_t *src, const float *mul,
|
||||
int len);
|
||||
|
||||
av_cold void ff_fmt_convert_init_arm(FmtConvertContext *c)
|
||||
{
|
||||
@@ -42,11 +36,9 @@ av_cold void ff_fmt_convert_init_arm(FmtConvertContext *c)
|
||||
|
||||
if (have_vfp_vm(cpu_flags)) {
|
||||
c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_vfp;
|
||||
c->int32_to_float_fmul_array8 = ff_int32_to_float_fmul_array8_vfp;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,39 +50,3 @@ NOVFP len .req r3
|
||||
bx lr
|
||||
.unreq len
|
||||
endfunc
|
||||
|
||||
function ff_int32_to_float_fmul_array8_neon, export=1
|
||||
ldr r0, [sp]
|
||||
lsr r0, r0, #3
|
||||
subs r0, r0, #1
|
||||
beq 1f
|
||||
2:
|
||||
vld1.32 {q0-q1}, [r2,:128]!
|
||||
vld1.32 {q2-q3}, [r2,:128]!
|
||||
vld1.32 {d20}, [r3]!
|
||||
subs r0, r0, #2
|
||||
vcvt.f32.s32 q0, q0
|
||||
vcvt.f32.s32 q1, q1
|
||||
vdup.32 q8, d20[0]
|
||||
vcvt.f32.s32 q2, q2
|
||||
vcvt.f32.s32 q3, q3
|
||||
vmul.f32 q0, q0, q8
|
||||
vdup.32 q9, d20[1]
|
||||
vmul.f32 q1, q1, q8
|
||||
vmul.f32 q2, q2, q9
|
||||
vmul.f32 q3, q3, q9
|
||||
vst1.32 {q0-q1}, [r1,:128]!
|
||||
vst1.32 {q2-q3}, [r1,:128]!
|
||||
bgt 2b
|
||||
it lt
|
||||
bxlt lr
|
||||
1:
|
||||
vld1.32 {q0-q1}, [r2,:128]
|
||||
vld1.32 {d16[],d17[]}, [r3]
|
||||
vcvt.f32.s32 q0, q0
|
||||
vcvt.f32.s32 q1, q1
|
||||
vmul.f32 q0, q0, q8
|
||||
vmul.f32 q1, q1, q8
|
||||
vst1.32 {q0-q1}, [r1,:128]
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
@@ -21,167 +21,6 @@
|
||||
#include "config.h"
|
||||
#include "libavutil/arm/asm.S"
|
||||
|
||||
/**
|
||||
* ARM VFP optimised int32 to float conversion.
|
||||
* Assume len is a multiple of 8, destination buffer is at least 4 bytes aligned
|
||||
* (16 bytes alignment is best for BCM2835), little-endian.
|
||||
*/
|
||||
@ void ff_int32_to_float_fmul_array8_vfp(FmtConvertContext *c, float *dst, const int32_t *src, const float *mul, int len)
|
||||
function ff_int32_to_float_fmul_array8_vfp, export=1
|
||||
push {lr}
|
||||
ldr a1, [sp, #4]
|
||||
subs lr, a1, #3*8
|
||||
bcc 50f @ too short to pipeline
|
||||
@ Now need to find (len / 8) % 3. The approximation
|
||||
@ x / 24 = (x * 0xAB) >> 12
|
||||
@ is good for x < 4096, which is true for both AC3 and DCA.
|
||||
mov a1, #0xAB
|
||||
ldr ip, =0x03070000 @ RunFast mode, short vectors of length 8, stride 1
|
||||
mul a1, lr, a1
|
||||
vpush {s16-s31}
|
||||
mov a1, a1, lsr #12
|
||||
add a1, a1, a1, lsl #1
|
||||
rsb a1, a1, lr, lsr #3
|
||||
cmp a1, #1
|
||||
fmrx a1, FPSCR
|
||||
fmxr FPSCR, ip
|
||||
beq 11f
|
||||
blo 10f
|
||||
@ Array is (2 + multiple of 3) x 8 floats long
|
||||
@ drop through...
|
||||
vldmia a3!, {s16-s23}
|
||||
vldmia a4!, {s2,s3}
|
||||
vldmia a3!, {s24-s31}
|
||||
vcvt.f32.s32 s16, s16
|
||||
vcvt.f32.s32 s17, s17
|
||||
vcvt.f32.s32 s18, s18
|
||||
vcvt.f32.s32 s19, s19
|
||||
vcvt.f32.s32 s20, s20
|
||||
vcvt.f32.s32 s21, s21
|
||||
vcvt.f32.s32 s22, s22
|
||||
vcvt.f32.s32 s23, s23
|
||||
vmul.f32 s16, s16, s2
|
||||
@ drop through...
|
||||
3:
|
||||
vldmia a3!, {s8-s15}
|
||||
vldmia a4!, {s1}
|
||||
vcvt.f32.s32 s24, s24
|
||||
vcvt.f32.s32 s25, s25
|
||||
vcvt.f32.s32 s26, s26
|
||||
vcvt.f32.s32 s27, s27
|
||||
vcvt.f32.s32 s28, s28
|
||||
vcvt.f32.s32 s29, s29
|
||||
vcvt.f32.s32 s30, s30
|
||||
vcvt.f32.s32 s31, s31
|
||||
vmul.f32 s24, s24, s3
|
||||
vstmia a2!, {s16-s19}
|
||||
vstmia a2!, {s20-s23}
|
||||
2:
|
||||
vldmia a3!, {s16-s23}
|
||||
vldmia a4!, {s2}
|
||||
vcvt.f32.s32 s8, s8
|
||||
vcvt.f32.s32 s9, s9
|
||||
vcvt.f32.s32 s10, s10
|
||||
vcvt.f32.s32 s11, s11
|
||||
vcvt.f32.s32 s12, s12
|
||||
vcvt.f32.s32 s13, s13
|
||||
vcvt.f32.s32 s14, s14
|
||||
vcvt.f32.s32 s15, s15
|
||||
vmul.f32 s8, s8, s1
|
||||
vstmia a2!, {s24-s27}
|
||||
vstmia a2!, {s28-s31}
|
||||
1:
|
||||
vldmia a3!, {s24-s31}
|
||||
vldmia a4!, {s3}
|
||||
vcvt.f32.s32 s16, s16
|
||||
vcvt.f32.s32 s17, s17
|
||||
vcvt.f32.s32 s18, s18
|
||||
vcvt.f32.s32 s19, s19
|
||||
vcvt.f32.s32 s20, s20
|
||||
vcvt.f32.s32 s21, s21
|
||||
vcvt.f32.s32 s22, s22
|
||||
vcvt.f32.s32 s23, s23
|
||||
vmul.f32 s16, s16, s2
|
||||
vstmia a2!, {s8-s11}
|
||||
vstmia a2!, {s12-s15}
|
||||
|
||||
subs lr, lr, #8*3
|
||||
bpl 3b
|
||||
|
||||
vcvt.f32.s32 s24, s24
|
||||
vcvt.f32.s32 s25, s25
|
||||
vcvt.f32.s32 s26, s26
|
||||
vcvt.f32.s32 s27, s27
|
||||
vcvt.f32.s32 s28, s28
|
||||
vcvt.f32.s32 s29, s29
|
||||
vcvt.f32.s32 s30, s30
|
||||
vcvt.f32.s32 s31, s31
|
||||
vmul.f32 s24, s24, s3
|
||||
vstmia a2!, {s16-s19}
|
||||
vstmia a2!, {s20-s23}
|
||||
vstmia a2!, {s24-s27}
|
||||
vstmia a2!, {s28-s31}
|
||||
|
||||
fmxr FPSCR, a1
|
||||
vpop {s16-s31}
|
||||
pop {pc}
|
||||
|
||||
10: @ Array is (multiple of 3) x 8 floats long
|
||||
vldmia a3!, {s8-s15}
|
||||
vldmia a4!, {s1,s2}
|
||||
vldmia a3!, {s16-s23}
|
||||
vcvt.f32.s32 s8, s8
|
||||
vcvt.f32.s32 s9, s9
|
||||
vcvt.f32.s32 s10, s10
|
||||
vcvt.f32.s32 s11, s11
|
||||
vcvt.f32.s32 s12, s12
|
||||
vcvt.f32.s32 s13, s13
|
||||
vcvt.f32.s32 s14, s14
|
||||
vcvt.f32.s32 s15, s15
|
||||
vmul.f32 s8, s8, s1
|
||||
b 1b
|
||||
|
||||
11: @ Array is (1 + multiple of 3) x 8 floats long
|
||||
vldmia a3!, {s24-s31}
|
||||
vldmia a4!, {s3}
|
||||
vldmia a3!, {s8-s15}
|
||||
vldmia a4!, {s1}
|
||||
vcvt.f32.s32 s24, s24
|
||||
vcvt.f32.s32 s25, s25
|
||||
vcvt.f32.s32 s26, s26
|
||||
vcvt.f32.s32 s27, s27
|
||||
vcvt.f32.s32 s28, s28
|
||||
vcvt.f32.s32 s29, s29
|
||||
vcvt.f32.s32 s30, s30
|
||||
vcvt.f32.s32 s31, s31
|
||||
vmul.f32 s24, s24, s3
|
||||
b 2b
|
||||
|
||||
50:
|
||||
ldr lr, =0x03070000 @ RunFast mode, short vectors of length 8, stride 1
|
||||
fmrx ip, FPSCR
|
||||
fmxr FPSCR, lr
|
||||
51:
|
||||
vldmia a3!, {s8-s15}
|
||||
vldmia a4!, {s0}
|
||||
vcvt.f32.s32 s8, s8
|
||||
vcvt.f32.s32 s9, s9
|
||||
vcvt.f32.s32 s10, s10
|
||||
vcvt.f32.s32 s11, s11
|
||||
vcvt.f32.s32 s12, s12
|
||||
vcvt.f32.s32 s13, s13
|
||||
vcvt.f32.s32 s14, s14
|
||||
vcvt.f32.s32 s15, s15
|
||||
vmul.f32 s8, s8, s0
|
||||
subs a1, a1, #8
|
||||
vstmia a2!, {s8-s11}
|
||||
vstmia a2!, {s12-s15}
|
||||
bne 51b
|
||||
|
||||
fmxr FPSCR, ip
|
||||
pop {pc}
|
||||
endfunc
|
||||
|
||||
/**
|
||||
* ARM VFP optimised int32 to float conversion.
|
||||
* Assume len is a multiple of 8, destination buffer is at least 4 bytes aligned
|
||||
|
||||
@@ -32,19 +32,9 @@ static void int32_to_float_fmul_scalar_c(float *dst, const int32_t *src,
|
||||
dst[i] = src[i] * mul;
|
||||
}
|
||||
|
||||
static void int32_to_float_fmul_array8_c(FmtConvertContext *c, float *dst,
|
||||
const int32_t *src, const float *mul,
|
||||
int len)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < len; i += 8)
|
||||
c->int32_to_float_fmul_scalar(&dst[i], &src[i], *mul++, 8);
|
||||
}
|
||||
|
||||
av_cold void ff_fmt_convert_init(FmtConvertContext *c)
|
||||
{
|
||||
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_AARCH64
|
||||
ff_fmt_convert_init_aarch64(c);
|
||||
|
||||
@@ -37,23 +37,6 @@ typedef struct FmtConvertContext {
|
||||
*/
|
||||
void (*int32_to_float_fmul_scalar)(float *dst, const int32_t *src,
|
||||
float mul, int len);
|
||||
|
||||
/**
|
||||
* Convert an array of int32_t to float and multiply by a float value from another array,
|
||||
* stepping along the float array once for each 8 integers.
|
||||
* @param c pointer to FmtConvertContext.
|
||||
* @param dst destination array of float.
|
||||
* constraints: 16-byte aligned
|
||||
* @param src source array of int32_t.
|
||||
* constraints: 16-byte aligned
|
||||
* @param mul source array of float multipliers.
|
||||
* @param len number of elements to convert.
|
||||
* constraints: multiple of 8
|
||||
*/
|
||||
void (*int32_to_float_fmul_array8)(struct FmtConvertContext *c,
|
||||
float *dst, const int32_t *src,
|
||||
const float *mul, int len);
|
||||
|
||||
} FmtConvertContext;
|
||||
|
||||
void ff_fmt_convert_init(FmtConvertContext *c);
|
||||
|
||||
@@ -27,9 +27,6 @@
|
||||
|
||||
void ff_int32_to_float_fmul_scalar_rvv(float *dst, const int32_t *src,
|
||||
float mul, int len);
|
||||
void ff_int32_to_float_fmul_array8_rvv(FmtConvertContext *c, float *dst,
|
||||
const int32_t *src, const float *mul,
|
||||
int len);
|
||||
|
||||
av_cold void ff_fmt_convert_init_riscv(FmtConvertContext *c)
|
||||
{
|
||||
@@ -38,7 +35,6 @@ av_cold void ff_fmt_convert_init_riscv(FmtConvertContext *c)
|
||||
|
||||
if ((flags & AV_CPU_FLAG_RVV_F32) && (flags & AV_CPU_FLAG_RVB)) {
|
||||
c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_rvv;
|
||||
c->int32_to_float_fmul_array8 = ff_int32_to_float_fmul_array8_rvv;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -37,32 +37,3 @@ NOHWF mv a2, a3
|
||||
|
||||
ret
|
||||
endfunc
|
||||
|
||||
func ff_int32_to_float_fmul_array8_rvv, zve32f, zba
|
||||
lpad 0
|
||||
srai a4, a4, 3
|
||||
|
||||
1: vsetvli t0, a4, e32, m1, ta, ma
|
||||
vle32.v v24, (a3)
|
||||
slli t2, t0, 2 + 3
|
||||
vlseg8e32.v v16, (a2)
|
||||
vsetvli t3, zero, e32, m8, ta, ma
|
||||
vfcvt.f.x.v v16, v16
|
||||
vsetvli zero, a4, e32, m1, ta, ma
|
||||
vfmul.vv v16, v16, v24
|
||||
sub a4, a4, t0
|
||||
vfmul.vv v17, v17, v24
|
||||
sh2add a3, t0, a3
|
||||
vfmul.vv v18, v18, v24
|
||||
add a2, a2, t2
|
||||
vfmul.vv v19, v19, v24
|
||||
vfmul.vv v20, v20, v24
|
||||
vfmul.vv v21, v21, v24
|
||||
vfmul.vv v22, v22, v24
|
||||
vfmul.vv v23, v23, v24
|
||||
vsseg8e32.v v16, (a1)
|
||||
add a1, a1, t2
|
||||
bnez a4, 1b
|
||||
|
||||
ret
|
||||
endfunc
|
||||
|
||||
@@ -57,31 +57,3 @@ cglobal int32_to_float_fmul_scalar, 4, 4, %1, dst, src, mul, len
|
||||
|
||||
INIT_XMM sse2
|
||||
INT32_TO_FLOAT_FMUL_SCALAR 3
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; void ff_int32_to_float_fmul_array8(FmtConvertContext *c, float *dst, const int32_t *src,
|
||||
; const float *mul, int len);
|
||||
;------------------------------------------------------------------------------
|
||||
%macro INT32_TO_FLOAT_FMUL_ARRAY8 0
|
||||
cglobal int32_to_float_fmul_array8, 5, 5, 5, c, dst, src, mul, len
|
||||
shl lend, 2
|
||||
add srcq, lenq
|
||||
add dstq, lenq
|
||||
neg lenq
|
||||
.loop:
|
||||
movss m0, [mulq]
|
||||
SPLATD m0
|
||||
cvtdq2ps m1, [srcq+lenq ]
|
||||
cvtdq2ps m2, [srcq+lenq+16]
|
||||
mulps m1, m0
|
||||
mulps m2, m0
|
||||
mova [dstq+lenq ], m1
|
||||
mova [dstq+lenq+16], m2
|
||||
add mulq, 4
|
||||
add lenq, 32
|
||||
jl .loop
|
||||
RET
|
||||
%endmacro
|
||||
|
||||
INIT_XMM sse2
|
||||
INT32_TO_FLOAT_FMUL_ARRAY8
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
#include "libavcodec/fmtconvert.h"
|
||||
|
||||
void ff_int32_to_float_fmul_scalar_sse2(float *dst, const int32_t *src, float mul, int len);
|
||||
void ff_int32_to_float_fmul_array8_sse2(FmtConvertContext *c, float *dst, const int32_t *src,
|
||||
const float *mul, int len);
|
||||
|
||||
av_cold void ff_fmt_convert_init_x86(FmtConvertContext *c)
|
||||
{
|
||||
@@ -37,6 +35,5 @@ av_cold void ff_fmt_convert_init_x86(FmtConvertContext *c)
|
||||
|
||||
if (EXTERNAL_SSE2(cpu_flags)) {
|
||||
c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_sse2;
|
||||
c->int32_to_float_fmul_array8 = ff_int32_to_float_fmul_array8_sse2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,27 +81,5 @@ void checkasm_check_fmtconvert(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (check_func(c.int32_to_float_fmul_array8, "int32_to_float_fmul_array8")) {
|
||||
declare_func(void, FmtConvertContext *, float *, const int32_t *,
|
||||
const float *, int);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (j = 0; j < FF_ARRAY_ELEMS(length); j++) {
|
||||
|
||||
randomize_input(length[j]);
|
||||
|
||||
call_ref(&c, dst0, in, scale_arr, length[j]);
|
||||
call_new(&c, dst1, in, scale_arr, length[j]);
|
||||
|
||||
if (!float_near_ulp_array(dst0, dst1, 3, length[j])) {
|
||||
fail();
|
||||
fprintf(stderr, "int32_to_float_fmul_array8: len: %d\n", length[j]);
|
||||
break;
|
||||
}
|
||||
|
||||
bench_new(&c, dst1, in, scale_arr, length[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
report("fmtconvert");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user