sync with tizen_2.2
[sdk/emulator/qemu.git] / tizen / distrib / libav / libavcodec / arm / ac3dsp_neon.S
1 /*
2  * Copyright (c) 2011 Mans Rullgard <mans@mansr.com>
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 "asm.S"
22
23 function ff_ac3_max_msb_abs_int16_neon, export=1
24         vmov.i16        q0,  #0
25         vmov.i16        q2,  #0
26 1:      vld1.16         {q1},     [r0,:128]!
27         vabs.s16        q1,  q1
28         vld1.16         {q3},     [r0,:128]!
29         vabs.s16        q3,  q3
30         vorr            q0,  q0,  q1
31         vorr            q2,  q2,  q3
32         subs            r1,  r1,  #16
33         bgt             1b
34         vorr            q0,  q0,  q2
35         vorr            d0,  d0,  d1
36         vpmax.u16       d0,  d0,  d0
37         vpmax.u16       d0,  d0,  d0
38         vmov.u16        r0,  d0[0]
39         bx              lr
40 endfunc
41
42 function ff_ac3_exponent_min_neon, export=1
43         cmp             r1,  #0
44         bxeq            lr
45         push            {lr}
46         mov             r12, #256
47 1:
48         vld1.8          {q0},     [r0,:128]
49         mov             lr,  r1
50         add             r3,  r0,  #256
51 2:      vld1.8          {q1},     [r3,:128], r12
52         subs            lr,  lr,  #1
53         vmin.u8         q0,  q0,  q1
54         bgt             2b
55         subs            r2,  r2,  #16
56         vst1.8          {q0},     [r0,:128]!
57         bgt             1b
58         pop             {pc}
59 endfunc
60
61 function ff_ac3_lshift_int16_neon, export=1
62         vdup.16         q0,  r2
63 1:      vld1.16         {q1},     [r0,:128]
64         vshl.s16        q1,  q1,  q0
65         vst1.16         {q1},     [r0,:128]!
66         subs            r1,  r1,  #8
67         bgt             1b
68         bx              lr
69 endfunc
70
71 function ff_ac3_rshift_int32_neon, export=1
72         rsb             r2,  r2,  #0
73         vdup.32         q0,  r2
74 1:      vld1.32         {q1},     [r0,:128]
75         vshl.s32        q1,  q1,  q0
76         vst1.32         {q1},     [r0,:128]!
77         subs            r1,  r1,  #4
78         bgt             1b
79         bx              lr
80 endfunc
81
82 function ff_float_to_fixed24_neon, export=1
83 1:      vld1.32         {q0-q1},  [r1,:128]!
84         vcvt.s32.f32    q0,  q0,  #24
85         vld1.32         {q2-q3},  [r1,:128]!
86         vcvt.s32.f32    q1,  q1,  #24
87         vcvt.s32.f32    q2,  q2,  #24
88         vst1.32         {q0-q1},  [r0,:128]!
89         vcvt.s32.f32    q3,  q3,  #24
90         vst1.32         {q2-q3},  [r0,:128]!
91         subs            r2,  r2,  #16
92         bgt             1b
93         bx              lr
94 endfunc
95
96 function ff_ac3_extract_exponents_neon, export=1
97         vmov.i32        q14, #24
98         vmov.i32        q15, #8
99 1:
100         vld1.32         {q0},     [r1,:128]
101         vabs.s32        q1,  q0
102         vclz.i32        q3,  q1
103         vsub.i32        q3,  q3,  q15
104         vcge.s32        q2,  q3,  q14
105         vbit            q3,  q14, q2
106         vbic            q0,  q0,  q2
107         vmovn.i32       d6,  q3
108         vmovn.i16       d6,  q3
109         vst1.32         {q0},     [r1,:128]!
110         vst1.32         {d6[0]},  [r0,:32]!
111         subs            r2,  r2,  #4
112         bgt             1b
113         bx              lr
114 endfunc