omxVCCOMM_ExpandFrame_I_s.s revision 78e52bfac041d71ce53b5b13c2abf78af742b09d
1;//
2;// Copyright (C) 2007-2008 ARM Limited
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 Name:  omxVCCOMM_ExpandFrame_I_s.s
19;// OpenMAX DL: v1.0.2
20;// Revision:   12290
21;// Date:       Wednesday, April 9, 2008
22;//
23;//
24;//
25;//
26;// Description:
27;// This function will Expand Frame boundary pixels into Plane
28;//
29;//
30
31;// Include standard headers
32
33        INCLUDE omxtypes_s.h
34        INCLUDE armCOMM_s.h
35
36        M_VARIANTS CortexA8
37
38;// Import symbols required from other files
39;// (For example tables)
40
41
42;// Set debugging level
43DEBUG_ON    SETL {FALSE}
44
45
46
47    IF CortexA8
48
49        M_START omxVCCOMM_ExpandFrame_I,r11
50
51;//Input registers
52
53pSrcDstPlane    RN  0
54iFrameWidth     RN  1
55iFrameHeight    RN  2
56iExpandPels     RN  3
57iPlaneStep      RN  4
58pTop            RN  5
59pBot            RN  6
60pDstTop         RN  7
61pDstBot         RN  8
62pLeft           RN  5
63pRight          RN  6
64pDstLeft        RN  9
65pDstRight       RN  10
66Offset          RN  11
67Temp            RN  14
68Counter         RN  12
69Tmp             RN  7
70;//Output registers
71
72result          RN  0
73;// Neon registers
74qData0          QN  0.U8
75qData1          QN  1.U8
76dData0          DN  0.U8
77dData1          DN  1.U8
78dData2          DN  2.U8
79dData3          DN  3.U8
80
81        ;// Define stack arguments
82        M_ARG       pPlaneStep, 4
83
84        ;// Load argument from the stack
85        M_LDR       iPlaneStep, pPlaneStep
86
87        SUB         pTop, pSrcDstPlane, #0              ;// Top row pointer of the frame
88        MUL         Offset, iExpandPels, iPlaneStep     ;// E*Step
89        SUB         Temp, iFrameHeight, #1              ;// H-1
90        MUL         Temp, iPlaneStep, Temp              ;// (H-1)*Step
91        ADD         pBot, Temp, pSrcDstPlane            ;// BPtr = TPtr + (H-1)*Step
92        MOV         Temp, iFrameWidth                   ;// Outer loop counter
93
94        ;// Check if pSrcDstPlane and iPlaneStep are 16 byte aligned
95        TST         pSrcDstPlane, #0xf
96        TSTEQ       iPlaneStep, #0xf
97        BNE         Hor8Loop00
98
99        ;//
100        ;// Copy top and bottom region of the plane as follows
101        ;// top region = top row elements from the frame
102        ;// bottom region = last row elements from the frame
103        ;//
104
105        ;// Case for 16 byte alignment
106Hor16Loop00
107        SUB         pDstTop, pTop, Offset
108        VLD1        qData0, [pTop @128]!
109        MOV         Counter, iExpandPels                ;// Inner loop counter
110        ADD         pDstBot, pBot, iPlaneStep
111        VLD1        qData1, [pBot @128]!
112Ver16Loop0
113        VST1        qData0, [pDstTop @128], iPlaneStep
114        VST1        qData0, [pDstTop @128], iPlaneStep
115        VST1        qData0, [pDstTop @128], iPlaneStep
116        VST1        qData0, [pDstTop @128], iPlaneStep
117        VST1        qData0, [pDstTop @128], iPlaneStep
118        VST1        qData0, [pDstTop @128], iPlaneStep
119        VST1        qData0, [pDstTop @128], iPlaneStep
120        VST1        qData0, [pDstTop @128], iPlaneStep
121        SUBS        Counter, Counter, #8
122        VST1        qData1, [pDstBot @128], iPlaneStep
123        VST1        qData1, [pDstBot @128], iPlaneStep
124        VST1        qData1, [pDstBot @128], iPlaneStep
125        VST1        qData1, [pDstBot @128], iPlaneStep
126        VST1        qData1, [pDstBot @128], iPlaneStep
127        VST1        qData1, [pDstBot @128], iPlaneStep
128        VST1        qData1, [pDstBot @128], iPlaneStep
129        VST1        qData1, [pDstBot @128], iPlaneStep
130        BGT         Ver16Loop0
131
132        SUBS        Temp, Temp, #16
133        BGT         Hor16Loop00
134        B           EndAlignedLoop
135
136        ;// Case for 8 byte alignment
137Hor8Loop00
138        SUB         pDstTop, pTop, Offset
139        VLD1        qData0, [pTop @64]!
140        MOV         Counter, iExpandPels                ;// Inner loop counter
141        ADD         pDstBot, pBot, iPlaneStep
142        VLD1        qData1, [pBot @64]!
143Ver8Loop0
144        VST1        qData0, [pDstTop @64], iPlaneStep
145        VST1        qData0, [pDstTop @64], iPlaneStep
146        VST1        qData0, [pDstTop @64], iPlaneStep
147        VST1        qData0, [pDstTop @64], iPlaneStep
148        VST1        qData0, [pDstTop @64], iPlaneStep
149        VST1        qData0, [pDstTop @64], iPlaneStep
150        VST1        qData0, [pDstTop @64], iPlaneStep
151        VST1        qData0, [pDstTop @64], iPlaneStep
152        SUBS        Counter, Counter, #8
153        VST1        qData1, [pDstBot @64], iPlaneStep
154        VST1        qData1, [pDstBot @64], iPlaneStep
155        VST1        qData1, [pDstBot @64], iPlaneStep
156        VST1        qData1, [pDstBot @64], iPlaneStep
157        VST1        qData1, [pDstBot @64], iPlaneStep
158        VST1        qData1, [pDstBot @64], iPlaneStep
159        VST1        qData1, [pDstBot @64], iPlaneStep
160        VST1        qData1, [pDstBot @64], iPlaneStep
161        BGT         Ver8Loop0
162
163        SUBS        Temp, Temp, #16
164        BGT         Hor8Loop00
165
166EndAlignedLoop
167        ADD         Temp, pSrcDstPlane, iFrameWidth
168        SUB         pDstRight, Temp, Offset
169        SUB         pRight, Temp, #1
170        SUB         pDstLeft, pSrcDstPlane, Offset
171        SUB         pDstLeft, pDstLeft, iExpandPels
172        ADD         pLeft, pSrcDstPlane, #0
173
174        VLD1        {dData0 []}, [pLeft], iPlaneStep        ;// Top-Left corner pixel from frame duplicated in dData0
175        SUB         Offset, iPlaneStep, iExpandPels
176        VLD1        {dData1 []}, [pRight], iPlaneStep       ;// Top-Right corner pixel from frame duplicated in dData1
177        MOV         Temp, iExpandPels
178
179        ;//
180        ;// Copy top-left and top-right region of the plane as follows
181        ;// top-left region = top-left corner pixel from the frame
182        ;// top-right region = top-right corner pixel from the frame
183        ;//
184HorLoop11
185        MOV         Counter, iExpandPels
186VerLoop1
187        VST1        dData0, [pDstLeft], #8
188        SUBS        Counter, Counter, #8
189        VST1        dData1, [pDstRight], #8
190        BGT         VerLoop1
191
192        SUBS        Temp, Temp, #1
193        ADD         pDstLeft, pDstLeft, Offset
194        ADD         pDstRight, pDstRight, Offset
195        BPL         HorLoop11
196
197        SUB         iFrameHeight, iFrameHeight, #1
198        ;//
199        ;// Copy left and right region of the plane as follows
200        ;// Left region = copy the row with left start pixel from the frame
201        ;// Right region = copy the row with right end pixel from the frame
202        ;//
203HorLoop22
204        VLD1        {dData0 []}, [pLeft], iPlaneStep
205        MOV         Counter, iExpandPels
206        VLD1        {dData1 []}, [pRight], iPlaneStep
207VerLoop2
208        VST1        dData0, [pDstLeft], #8
209        SUBS        Counter, Counter, #8
210        VST1        dData1, [pDstRight], #8
211        BGT         VerLoop2
212
213        SUBS        iFrameHeight, iFrameHeight, #1
214        ADD         pDstLeft, pDstLeft, Offset
215        ADD         pDstRight, pDstRight, Offset
216        BGT         HorLoop22
217
218        MOV         Temp, iExpandPels
219        ;//
220        ;// Copy bottom-left and bottom-right region of the plane as follows
221        ;// bottom-left region = bottom-left corner pixel from the frame
222        ;// bottom-right region = bottom-right corner pixel from the frame
223        ;//
224HorLoop33
225        MOV         Counter, iExpandPels
226VerLoop3
227        VST1        dData0, [pDstLeft], #8
228        SUBS        Counter, Counter, #8
229        VST1        dData1, [pDstRight], #8
230        BGT         VerLoop3
231
232        SUBS        Temp, Temp, #1
233        ADD         pDstLeft, pDstLeft, Offset
234        ADD         pDstRight, pDstRight, Offset
235        BGT         HorLoop33
236End
237        MOV         r0, #OMX_Sts_NoErr
238
239        M_END
240
241    ENDIF
242
243
244
245
246;// Guarding implementation by the processor name
247
248
249
250    END
251