1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
/*
* Copyright (c) 2023 Institue of Software Chinese Academy of Sciences (ISCAS).
*
* 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/riscv/asm.S"
func ff_ac3_exponent_min_rvv, zve32x
lpad 0
beqz a1, 3f
1:
vsetvli t2, a2, e8, m8, ta, ma
vle8.v v8, (a0)
addi t0, a0, 256
sub a2, a2, t2
mv t1, a1
2:
vle8.v v16, (t0)
addi t1, t1, -1
vminu.vv v8, v8, v16
addi t0, t0, 256
bnez t1, 2b
vse8.v v8, (a0)
add a0, a0, t2
bnez a2, 1b
3:
ret
endfunc
func ff_float_to_fixed24_rvv, zve32f, zba
lpad 0
li t1, 1 << 24
fcvt.s.w f0, t1
1:
vsetvli t0, a2, e32, m8, ta, ma
sub a2, a2, t0
vle32.v v0, (a1)
vfmul.vf v0, v0, f0
vfcvt.x.f.v v0, v0
sh2add a1, t0, a1
vse32.v v0, (a0)
sh2add a0, t0, a0
bnez a2, 1b
ret
endfunc
#if __riscv_xlen >= 64
func ff_sum_square_butterfly_int32_rvv, zve64x, zba
lpad 0
vsetvli t0, zero, e64, m8, ta, ma
vmv.v.x v0, zero
vmv.v.x v8, zero
1:
vsetvli t0, a3, e32, m2, tu, ma
vle32.v v16, (a1)
sub a3, a3, t0
vle32.v v20, (a2)
sh2add a1, t0, a1
vadd.vv v24, v16, v20
sh2add a2, t0, a2
vsub.vv v28, v16, v20
vwmacc.vv v0, v16, v16
vwmacc.vv v4, v20, v20
vwmacc.vv v8, v24, v24
vwmacc.vv v12, v28, v28
bnez a3, 1b
vsetvli t0, zero, e64, m4, ta, ma
vmv.s.x v16, zero
vmv.s.x v17, zero
vredsum.vs v16, v0, v16
vmv.s.x v18, zero
vredsum.vs v17, v4, v17
vmv.s.x v19, zero
vredsum.vs v18, v8, v18
vmv.x.s t0, v16
vredsum.vs v19, v12, v19
vmv.x.s t1, v17
sd t0, (a0)
vmv.x.s t2, v18
sd t1, 8(a0)
vmv.x.s t3, v19
sd t2, 16(a0)
sd t3, 24(a0)
ret
endfunc
#endif
func ff_sum_square_butterfly_float_rvv, zve32f, zba
lpad 0
vsetvli t0, zero, e32, m8, ta, ma
vmv.v.x v0, zero
vmv.v.x v8, zero
1:
vsetvli t0, a3, e32, m4, tu, ma
vle32.v v16, (a1)
sub a3, a3, t0
vle32.v v20, (a2)
sh2add a1, t0, a1
vfadd.vv v24, v16, v20
sh2add a2, t0, a2
vfsub.vv v28, v16, v20
vfmacc.vv v0, v16, v16
vfmacc.vv v4, v20, v20
vfmacc.vv v8, v24, v24
vfmacc.vv v12, v28, v28
bnez a3, 1b
vsetvli t0, zero, e32, m4, ta, ma
vmv.s.x v16, zero
vmv.s.x v17, zero
vfredsum.vs v16, v0, v16
vmv.s.x v18, zero
vfredsum.vs v17, v4, v17
vmv.s.x v19, zero
vfredsum.vs v18, v8, v18
vfmv.f.s ft0, v16
vfredsum.vs v19, v12, v19
vfmv.f.s ft1, v17
fsw ft0, (a0)
vfmv.f.s ft2, v18
fsw ft1, 4(a0)
vfmv.f.s ft3, v19
fsw ft2, 8(a0)
fsw ft3, 12(a0)
ret
endfunc
|