yading@10
|
1 /*
|
yading@10
|
2 * Copyright (c) 2008 Siarhei Siamashka <ssvb@users.sourceforge.net>
|
yading@10
|
3 *
|
yading@10
|
4 * This file is part of FFmpeg.
|
yading@10
|
5 *
|
yading@10
|
6 * FFmpeg is free software; you can redistribute it and/or
|
yading@10
|
7 * modify it under the terms of the GNU Lesser General Public
|
yading@10
|
8 * License as published by the Free Software Foundation; either
|
yading@10
|
9 * version 2.1 of the License, or (at your option) any later version.
|
yading@10
|
10 *
|
yading@10
|
11 * FFmpeg is distributed in the hope that it will be useful,
|
yading@10
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
yading@10
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
yading@10
|
14 * Lesser General Public License for more details.
|
yading@10
|
15 *
|
yading@10
|
16 * You should have received a copy of the GNU Lesser General Public
|
yading@10
|
17 * License along with FFmpeg; if not, write to the Free Software
|
yading@10
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
yading@10
|
19 */
|
yading@10
|
20
|
yading@10
|
21 #include "config.h"
|
yading@10
|
22 #include "libavutil/arm/asm.S"
|
yading@10
|
23
|
yading@10
|
24 /**
|
yading@10
|
25 * ARM VFP optimized float to int16 conversion.
|
yading@10
|
26 * Assume that len is a positive number and is multiple of 8, destination
|
yading@10
|
27 * buffer is at least 4 bytes aligned (8 bytes alignment is better for
|
yading@10
|
28 * performance), little-endian byte sex.
|
yading@10
|
29 */
|
yading@10
|
30 @ void ff_float_to_int16_vfp(int16_t *dst, const float *src, int len)
|
yading@10
|
31 function ff_float_to_int16_vfp, export=1
|
yading@10
|
32 push {r4-r8,lr}
|
yading@10
|
33 vpush {d8-d11}
|
yading@10
|
34 vldmia r1!, {s16-s23}
|
yading@10
|
35 vcvt.s32.f32 s0, s16
|
yading@10
|
36 vcvt.s32.f32 s1, s17
|
yading@10
|
37 vcvt.s32.f32 s2, s18
|
yading@10
|
38 vcvt.s32.f32 s3, s19
|
yading@10
|
39 vcvt.s32.f32 s4, s20
|
yading@10
|
40 vcvt.s32.f32 s5, s21
|
yading@10
|
41 vcvt.s32.f32 s6, s22
|
yading@10
|
42 vcvt.s32.f32 s7, s23
|
yading@10
|
43 1:
|
yading@10
|
44 subs r2, r2, #8
|
yading@10
|
45 vmov r3, r4, s0, s1
|
yading@10
|
46 vmov r5, r6, s2, s3
|
yading@10
|
47 vmov r7, r8, s4, s5
|
yading@10
|
48 vmov ip, lr, s6, s7
|
yading@10
|
49 it gt
|
yading@10
|
50 vldmiagt r1!, {s16-s23}
|
yading@10
|
51 ssat r4, #16, r4
|
yading@10
|
52 ssat r3, #16, r3
|
yading@10
|
53 ssat r6, #16, r6
|
yading@10
|
54 ssat r5, #16, r5
|
yading@10
|
55 pkhbt r3, r3, r4, lsl #16
|
yading@10
|
56 pkhbt r4, r5, r6, lsl #16
|
yading@10
|
57 itttt gt
|
yading@10
|
58 vcvtgt.s32.f32 s0, s16
|
yading@10
|
59 vcvtgt.s32.f32 s1, s17
|
yading@10
|
60 vcvtgt.s32.f32 s2, s18
|
yading@10
|
61 vcvtgt.s32.f32 s3, s19
|
yading@10
|
62 itttt gt
|
yading@10
|
63 vcvtgt.s32.f32 s4, s20
|
yading@10
|
64 vcvtgt.s32.f32 s5, s21
|
yading@10
|
65 vcvtgt.s32.f32 s6, s22
|
yading@10
|
66 vcvtgt.s32.f32 s7, s23
|
yading@10
|
67 ssat r8, #16, r8
|
yading@10
|
68 ssat r7, #16, r7
|
yading@10
|
69 ssat lr, #16, lr
|
yading@10
|
70 ssat ip, #16, ip
|
yading@10
|
71 pkhbt r5, r7, r8, lsl #16
|
yading@10
|
72 pkhbt r6, ip, lr, lsl #16
|
yading@10
|
73 stmia r0!, {r3-r6}
|
yading@10
|
74 bgt 1b
|
yading@10
|
75
|
yading@10
|
76 vpop {d8-d11}
|
yading@10
|
77 pop {r4-r8,pc}
|
yading@10
|
78 endfunc
|