2 * Copyright (c) 2013 RISC OS Open Ltd <bavison@riscosopen.org>
4 * This file is part of FFmpeg.
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #include "libavutil/arm/asm.S"
25 * ARM VFP optimised int32 to float conversion.
26 * Assume len is a multiple of 8, destination buffer is at least 4 bytes aligned
27 * (16 bytes alignment is best for BCM2835), little-endian.
29 @ void ff_int32_to_float_fmul_array8_vfp(FmtConvertContext *c, float *dst, const int32_t *src, const float *mul, int len)
30 function ff_int32_to_float_fmul_array8_vfp, export=1
34 bcc 50f @ too short to pipeline
35 @ Now need to find (len / 8) % 3. The approximation
36 @ x / 24 = (x * 0xAB) >> 12
37 @ is good for x < 4096, which is true for both AC3 and DCA.
39 ldr ip, =0x03070000 @ RunFast mode, short vectors of length 8, stride 1
43 add a1, a1, a1, lsl #1
44 rsb a1, a1, lr, lsr #3
50 @ Array is (2 + multiple of 3) x 8 floats long
100 vcvt.f32.s32 s20, s20
101 vcvt.f32.s32 s21, s21
102 vcvt.f32.s32 s22, s22
103 vcvt.f32.s32 s23, s23
104 vmul.f32 s16, s16, s2
106 vstmia a2!, {s12-s15}
111 vcvt.f32.s32 s24, s24
112 vcvt.f32.s32 s25, s25
113 vcvt.f32.s32 s26, s26
114 vcvt.f32.s32 s27, s27
115 vcvt.f32.s32 s28, s28
116 vcvt.f32.s32 s29, s29
117 vcvt.f32.s32 s30, s30
118 vcvt.f32.s32 s31, s31
119 vmul.f32 s24, s24, s3
120 vstmia a2!, {s16-s19}
121 vstmia a2!, {s20-s23}
122 vstmia a2!, {s24-s27}
123 vstmia a2!, {s28-s31}
129 10: @ Array is (multiple of 3) x 8 floats long
132 vldmia a3!, {s16-s23}
135 vcvt.f32.s32 s10, s10
136 vcvt.f32.s32 s11, s11
137 vcvt.f32.s32 s12, s12
138 vcvt.f32.s32 s13, s13
139 vcvt.f32.s32 s14, s14
140 vcvt.f32.s32 s15, s15
144 11: @ Array is (1 + multiple of 3) x 8 floats long
145 vldmia a3!, {s24-s31}
149 vcvt.f32.s32 s24, s24
150 vcvt.f32.s32 s25, s25
151 vcvt.f32.s32 s26, s26
152 vcvt.f32.s32 s27, s27
153 vcvt.f32.s32 s28, s28
154 vcvt.f32.s32 s29, s29
155 vcvt.f32.s32 s30, s30
156 vcvt.f32.s32 s31, s31
157 vmul.f32 s24, s24, s3
161 ldr lr, =0x03070000 @ RunFast mode, short vectors of length 8, stride 1
169 vcvt.f32.s32 s10, s10
170 vcvt.f32.s32 s11, s11
171 vcvt.f32.s32 s12, s12
172 vcvt.f32.s32 s13, s13
173 vcvt.f32.s32 s14, s14
174 vcvt.f32.s32 s15, s15
178 vstmia a2!, {s12-s15}
186 * ARM VFP optimised int32 to float conversion.
187 * Assume len is a multiple of 8, destination buffer is at least 4 bytes aligned
188 * (16 bytes alignment is best for BCM2835), little-endian.
189 * TODO: could be further optimised by unrolling and interleaving, as above
191 @ void ff_int32_to_float_fmul_scalar_vfp(float *dst, const int32_t *src, float mul, int len)
192 function ff_int32_to_float_fmul_scalar_vfp, export=1
198 ldr tmp, =0x03070000 @ RunFast mode, short vectors of length 8, stride 1
205 vcvt.f32.s32 s10, s10
206 vcvt.f32.s32 s11, s11
207 vcvt.f32.s32 s12, s12
208 vcvt.f32.s32 s13, s13
209 vcvt.f32.s32 s14, s14
210 vcvt.f32.s32 s15, s15
214 vstmia a1!, {s12-s15}