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