1@/*
2@ ** Copyright 2003-2010, VisualOn, Inc.
3@ **
4@ ** Licensed under the Apache License, Version 2.0 (the "License");
5@ ** you may not use this file except in compliance with the License.
6@ ** You may obtain a copy of the License at
7@ **
8@ **     http://www.apache.org/licenses/LICENSE-2.0
9@ **
10@ ** Unless required by applicable law or agreed to in writing, software
11@ ** distributed under the License is distributed on an "AS IS" BASIS,
12@ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13@ ** See the License for the specific language governing permissions and
14@ ** limitations under the License.
15@ */
16
17@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
18@	File:		PrePostMDCT_v7.s
19@
20@	Content:	premdct and postmdct function armv7 assemble
21@
22@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
23
24	.section .text
25	.global	PreMDCT
26	.fnstart
27
28PreMDCT:
29	stmdb     sp!, {r4 - r11, lr}
30	.save	  {r4 - r11, lr}
31	fstmfdd   sp!, {d8 - d15}
32	.vsave	  {d8 - d15}
33
34	add         r9, r0, r1, lsl #2
35	sub         r3, r9, #32
36
37	movs        r1, r1, asr #2
38	beq         PreMDCT_END
39
40PreMDCT_LOOP:
41	VLD4.I32			{d0, d2, d4, d6}, [r2]!				@ cosa = *csptr++@ sina = *csptr++@
42	VLD4.I32			{d1, d3, d5, d7}, [r2]!				@ cosb = *csptr++@ sinb = *csptr++@
43	VLD2.I32			{d8, d9, d10, d11}, [r0]			@ tr1 = *(buf0 + 0)@ ti2 = *(buf0 + 1)@
44	VLD2.I32			{d13, d15}, [r3]!					@ tr2 = *(buf1 - 1)@ ti1 = *(buf1 + 0)@
45	VLD2.I32			{d12, d14}, [r3]!					@ tr2 = *(buf1 - 1)@ ti1 = *(buf1 + 0)@
46
47	VREV64.32			Q8, Q7
48	VREV64.32			Q9, Q6
49
50
51	VQDMULH.S32		Q10, Q0, Q4								@ MULHIGH(cosa, tr1)
52	VQDMULH.S32		Q11, Q1, Q8								@ MULHIGH(sina, ti1)
53	VQDMULH.S32		Q12, Q0, Q8								@ MULHIGH(cosa, ti1)
54	VQDMULH.S32		Q13, Q1, Q4								@ MULHIGH(sina, tr1)
55
56	VADD.S32			Q0, Q10, Q11						@ *buf0++ = MULHIGH(cosa, tr1) + MULHIGH(sina, ti1)@
57	VSUB.S32			Q1, Q12, Q13						@ *buf0++ = MULHIGH(cosa, ti1) - MULHIGH(sina, tr1)@
58
59	VST2.I32			{d0, d1, d2, d3}, [r0]!
60	sub						r3, r3, #32
61
62	VQDMULH.S32		Q10, Q2, Q9										@ MULHIGH(cosb, tr2)
63	VQDMULH.S32		Q11, Q3, Q5										@ MULHIGH(sinb, ti2)
64	VQDMULH.S32		Q12, Q2, Q5										@ MULHIGH(cosb, ti2)
65	VQDMULH.S32		Q13, Q3, Q9										@ MULHIGH(sinb, tr2)
66
67	VADD.S32			Q0, Q10, Q11									@ MULHIGH(cosa, tr2) + MULHIGH(sina, ti2)@
68	VSUB.S32			Q1, Q12, Q13									@ MULHIGH(cosa, ti2) - MULHIGH(sina, tr2)@
69
70	VREV64.32			Q3, Q1
71	VREV64.32			Q2, Q0
72
73	VST2.I32		{d5, d7}, [r3]!
74	VST2.I32		{d4, d6}, [r3]!
75
76	subs     		r1, r1, #4
77	sub		  		r3, r3, #64
78	bne       	PreMDCT_LOOP
79
80PreMDCT_END:
81	fldmfdd   sp!, {d8 - d15}
82	ldmia     sp!, {r4 - r11, pc}
83	@ENDP  @ |PreMDCT|
84	.fnend
85
86	.section .text
87	.global	PostMDCT
88	.fnstart
89
90PostMDCT:
91	stmdb     sp!, {r4 - r11, lr}
92	.save	  {r4 - r11, lr}
93	fstmfdd   sp!, {d8 - d15}
94	.vsave	  {d8 - d15}
95
96	add         r9, r0, r1, lsl #2
97	sub         r3, r9, #32
98
99	movs        r1, r1, asr #2
100	beq         PostMDCT_END
101
102PostMDCT_LOOP:
103	VLD4.I32			{d0, d2, d4, d6}, [r2]!				@ cosa = *csptr++@ sina = *csptr++@
104	VLD4.I32			{d1, d3, d5, d7}, [r2]!				@ cosb = *csptr++@ sinb = *csptr++@
105	VLD2.I32			{d8, d9, d10, d11}, [r0]			@ tr1 = *(zbuf1 + 0)@ ti1 = *(zbuf1 + 1)@
106	VLD2.I32			{d13, d15}, [r3]!							@ tr2 = *(zbuf2 - 1)@ ti2 = *(zbuf2 + 0)@
107	VLD2.I32			{d12, d14}, [r3]!							@ tr2 = *(zbuf2 - 1)@ ti2 = *(zbuf2 + 0)@
108
109	VREV64.32			Q8, Q6
110	VREV64.32			Q9, Q7
111
112	VQDMULH.S32		Q10, Q0, Q4										@ MULHIGH(cosa, tr1)
113	VQDMULH.S32		Q11, Q1, Q5										@ MULHIGH(sina, ti1)
114	VQDMULH.S32		Q12, Q0, Q5										@ MULHIGH(cosa, ti1)
115	VQDMULH.S32		Q13, Q1, Q4										@ MULHIGH(sina, tr1)
116
117	VADD.S32			Q0, Q10, Q11									@ *buf0++ = MULHIGH(cosa, tr1) + MULHIGH(sina, ti1)@
118	VSUB.S32			Q5, Q13, Q12									@ *buf1-- = MULHIGH(sina, tr1) - MULHIGH(cosa, ti1)@
119
120	VQDMULH.S32		Q10, Q2, Q8										@ MULHIGH(cosb, tr2)
121	VQDMULH.S32		Q11, Q3, Q9										@ MULHIGH(sinb, ti2)
122	VQDMULH.S32		Q12, Q2, Q9										@ MULHIGH(cosb, ti2)
123	VQDMULH.S32		Q13, Q3, Q8										@ MULHIGH(sinb, tr2)
124
125	VADD.S32			Q4, Q10, Q11									@ *buf1-- = MULHIGH(cosa, tr2) + MULHIGH(sina, ti2)@
126	VSUB.S32			Q1, Q13, Q12									@ *buf0++ = MULHIGH(sina, tr2) - MULHIGH(cosa, ti2)@
127
128	VREV64.32			Q2, Q4
129	VREV64.32			Q3, Q5
130
131	sub						r3, r3, #32
132	VST2.I32			{d0, d1, d2, d3}, [r0]!
133
134	VST2.I32			{d5, d7}, [r3]!
135	VST2.I32			{d4, d6}, [r3]!
136
137	subs     			r1, r1, #4
138	sub		  			r3, r3, #64
139	bne       	PostMDCT_LOOP
140
141PostMDCT_END:
142	fldmfdd   sp!, {d8 - d15}
143	ldmia     sp!, {r4 - r11, pc}
144
145	@ENDP  		@ |PostMDCT|
146	.fnend
147