]> git.sesse.net Git - ffmpeg/blob - libavcodec/arm/rv34dsp_neon.S
rv34: 1-pass inter MB reconstruction
[ffmpeg] / libavcodec / arm / rv34dsp_neon.S
1 /*
2  * Copyright (c) 2011 Janne Grunau <janne-libav@jannau.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 "asm.S"
22
23 .macro rv34_inv_transform
24         vld1.16         {q14-q15}, [r0,:128]
25         vmov.s16        d0,  #13
26         vshll.s16       q12, d29, #3
27         vshll.s16       q13, d29, #4
28         vshll.s16       q9,  d31, #3
29         vshll.s16       q1,  d31, #4
30         vmull.s16       q10, d28, d0
31         vmlal.s16       q10, d30, d0
32         vmull.s16       q11, d28, d0
33         vmlsl.s16       q11, d30, d0
34         vsubw.s16       q12, q12, d29   @ z2 = block[i+4*1]*7
35         vaddw.s16       q13, q13, d29   @ z3 = block[i+4*1]*17
36         vsubw.s16       q9,  q9,  d31
37         vaddw.s16       q1,  q1,  d31
38         vadd.s32        q13, q13, q9    @ z3 = 17*block[i+4*1] +  7*block[i+4*3]
39         vsub.s32        q12, q12, q1    @ z2 = 7*block[i+4*1]  - 17*block[i+4*3]
40         vadd.s32        q1,  q10, q13   @ z0 + z3
41         vadd.s32        q2,  q11, q12   @ z1 + z2
42         vsub.s32        q8,  q10, q13   @ z0 - z3
43         vsub.s32        q3,  q11, q12   @ z1 - z2
44         vtrn.32         q1,  q2
45         vtrn.32         q3,  q8
46         vswp            d3,  d6
47         vswp            d5,  d16
48         vmov.s32        d0,  #13
49         vadd.s32        q10, q1,  q3
50         vsub.s32        q11, q1,  q3
51         vshl.s32        q12, q2,  #3
52         vshl.s32        q9,  q2,  #4
53         vmul.s32        q13, q11, d0[0]
54         vshl.s32        q11, q8,  #4
55         vadd.s32        q9,  q9,  q2
56         vshl.s32        q15, q8,  #3
57         vsub.s32        q12, q12, q2
58         vadd.s32        q11, q11, q8
59         vmul.s32        q14, q10, d0[0]
60         vsub.s32        q8,  q15, q8
61         vsub.s32        q12, q12, q11
62         vadd.s32        q9,  q9,  q8
63         vadd.s32        q2,  q13, q12   @ z1 + z2
64         vadd.s32        q1,  q14, q9    @ z0 + z3
65         vsub.s32        q3,  q13, q12   @ z1 - z2
66         vsub.s32        q15, q14, q9    @ z0 - z3
67 .endm
68
69 /* void rv34_inv_transform_noround_neon(DCTELEM *block); */
70 function ff_rv34_inv_transform_noround_neon, export=1
71         rv34_inv_transform
72         vshl.s32        q11, q2,  #1
73         vshl.s32        q10, q1,  #1
74         vshl.s32        q12, q3,  #1
75         vshl.s32        q13, q15, #1
76         vadd.s32        q11, q11, q2
77         vadd.s32        q10, q10, q1
78         vadd.s32        q12, q12, q3
79         vadd.s32        q13, q13, q15
80         vshrn.s32       d0,  q10, #11   @ (z0 + z3)*3 >> 11
81         vshrn.s32       d1,  q11, #11   @ (z1 + z2)*3 >> 11
82         vshrn.s32       d2,  q12, #11   @ (z1 - z2)*3 >> 11
83         vshrn.s32       d3,  q13, #11   @ (z0 - z3)*3 >> 11
84         vst4.16         {d0[0], d1[0], d2[0], d3[0]}, [r0,:64]!
85         vst4.16         {d0[1], d1[1], d2[1], d3[1]}, [r0,:64]!
86         vst4.16         {d0[2], d1[2], d2[2], d3[2]}, [r0,:64]!
87         vst4.16         {d0[3], d1[3], d2[3], d3[3]}, [r0,:64]!
88         bx              lr
89 endfunc
90
91
92 /* void rv34_inv_transform_dc_noround_c(DCTELEM *block) */
93 function ff_rv34_inv_transform_noround_dc_neon, export=1
94         vld1.16         {d28[]}, [r0,:16]       @ block[0]
95         vmov.i16        d4,  #251
96         vorr.s16        d4,  #256               @ 13^2 * 3
97         vmull.s16       q3,  d28, d4
98         vshrn.s32       d0,  q3,  #11
99         vmov.i16        d1,  d0
100         vst1.64         {q0}, [r0,:128]!
101         vst1.64         {q0}, [r0,:128]!
102         bx              lr
103 endfunc