]> git.sesse.net Git - ffmpeg/blob - libavcodec/arm/fmtconvert_vfp.S
ARM: enable UAL syntax in asm.S
[ffmpeg] / libavcodec / arm / fmtconvert_vfp.S
1 /*
2  * Copyright (c) 2008 Siarhei Siamashka <ssvb@users.sourceforge.net>
3  *
4  * This file is part of Libav.
5  *
6  * Libav 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.
10  *
11  * Libav 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.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with Libav; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20
21 #include "config.h"
22 #include "asm.S"
23
24 /**
25  * ARM VFP optimized float to int16 conversion.
26  * Assume that len is a positive number and is multiple of 8, destination
27  * buffer is at least 4 bytes aligned (8 bytes alignment is better for
28  * performance), little endian byte sex
29  */
30 @ void ff_float_to_int16_vfp(int16_t *dst, const float *src, int len)
31 function ff_float_to_int16_vfp, export=1
32         push            {r4-r8,lr}
33         vpush           {d8-d11}
34         vldmia          r1!, {s16-s23}
35         vcvt.s32.f32    s0,  s16
36         vcvt.s32.f32    s1,  s17
37         vcvt.s32.f32    s2,  s18
38         vcvt.s32.f32    s3,  s19
39         vcvt.s32.f32    s4,  s20
40         vcvt.s32.f32    s5,  s21
41         vcvt.s32.f32    s6,  s22
42         vcvt.s32.f32    s7,  s23
43 1:
44         subs            r2,  r2,  #8
45         vmov            r3,  r4,  s0, s1
46         vmov            r5,  r6,  s2, s3
47         vmov            r7,  r8,  s4, s5
48         vmov            ip,  lr,  s6, s7
49         vldmiagt        r1!, {s16-s23}
50         ssat            r4,  #16, r4
51         ssat            r3,  #16, r3
52         ssat            r6,  #16, r6
53         ssat            r5,  #16, r5
54         pkhbt           r3,  r3,  r4, lsl #16
55         pkhbt           r4,  r5,  r6, lsl #16
56         vcvtgt.s32.f32  s0,  s16
57         vcvtgt.s32.f32  s1,  s17
58         vcvtgt.s32.f32  s2,  s18
59         vcvtgt.s32.f32  s3,  s19
60         vcvtgt.s32.f32  s4,  s20
61         vcvtgt.s32.f32  s5,  s21
62         vcvtgt.s32.f32  s6,  s22
63         vcvtgt.s32.f32  s7,  s23
64         ssat            r8,  #16, r8
65         ssat            r7,  #16, r7
66         ssat            lr,  #16, lr
67         ssat            ip,  #16, ip
68         pkhbt           r5,  r7,  r8, lsl #16
69         pkhbt           r6,  ip,  lr, lsl #16
70         stmia           r0!, {r3-r6}
71         bgt             1b
72
73         vpop            {d8-d11}
74         pop             {r4-r8,pc}
75 endfunc