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:   9641
21;// Date:       Thursday, February 7, 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 ARM1136JS
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
48
49
50
51;// Guarding implementation by the processor name
52
53    IF  ARM1136JS
54
55;//Input Registers
56
57pSrcDstPlane    RN  0
58iFrameWidth     RN  1
59iFrameHeight    RN  2
60iExpandPels     RN  3
61
62
63;//Output Registers
64
65result          RN  0
66
67;//Local Scratch Registers
68
69iPlaneStep      RN  4
70pTop            RN  5
71pBottom         RN  6
72pBottomIndex    RN  7
73x               RN  8
74y               RN  9
75tempTop         RN  10
76tempBot         RN  11
77ColStep         RN  12
78pLeft           RN  5
79pRight          RN  6
80pRightIndex     RN  7
81tempLeft1       RN  10
82tempRight1      RN  11
83tempLeft2       RN  14
84tempRight2      RN  2
85indexY          RN  14
86RowStep         RN  12
87expandTo4bytes  RN  1                               ;// copy a byte to 4 bytes of a word
88
89        ;// Allocate stack memory required by the function
90
91
92        ;// Write function header
93        M_START omxVCCOMM_ExpandFrame_I,r11
94
95        ;// Define stack arguments
96        M_ARG   iPlaneStepOnStack, 4
97
98        ;// Load argument from the stack
99        M_LDR   iPlaneStep, iPlaneStepOnStack
100
101        MUL     pTop,iExpandPels,iPlaneStep
102        MLA     pBottom,iFrameHeight,iPlaneStep,pSrcDstPlane
103        SUB     x,iFrameWidth,#4
104        MOV     indexY,pTop
105        ADD     ColStep,indexY,#4
106        SUB     pBottomIndex,pBottom,iPlaneStep
107        SUB     pTop,pSrcDstPlane,pTop
108
109
110        ADD     pTop,pTop,x
111        ADD     pBottom,pBottom,x
112
113        ;//------------------------------------------------------------------------
114        ;// The following improves upon the C implmentation
115        ;// The x and y loops are interchanged: This ensures that the values of
116        ;// pSrcDstPlane [x] and pSrcDstPlane [(iFrameHeight - 1) * iPlaneStep + x]
117        ;// which depend only on loop variable 'x' are loaded once and used in
118        ;// multiple stores in the 'Y' loop
119        ;//------------------------------------------------------------------------
120
121        ;// xloop
122ExpandFrameTopBotXloop
123
124        LDR     tempTop,[pSrcDstPlane,x]
125        ;//------------------------------------------------------------------------
126        ;// pSrcDstPlane [(iFrameHeight - 1) * iPlaneStep + x] is simplified as:
127        ;// pSrcDstPlane + (iFrameHeight * iPlaneStep) - iPlaneStep + x ==
128        ;// pBottom - iPlaneStep + x == pBottomIndex [x]
129        ;// The value of pBottomIndex is calculated above this 'x' loop
130        ;//------------------------------------------------------------------------
131        LDR     tempBot,[pBottomIndex,x]
132
133        ;// yloop
134        MOV     y,iExpandPels
135
136ExpandFrameTopBotYloop
137        SUBS    y,y,#1
138        M_STR   tempTop,[pTop],iPlaneStep
139        M_STR   tempBot,[pBottom],iPlaneStep
140        BGT     ExpandFrameTopBotYloop
141
142        SUBS    x,x,#4
143        SUB     pTop,pTop,ColStep
144        SUB     pBottom,pBottom,ColStep
145        BGE     ExpandFrameTopBotXloop
146
147
148        ;// y loop
149        ;// The product is already calculated above : Reuse
150        ;//MUL     indexY,iExpandPels,iPlaneStep
151
152        SUB     pSrcDstPlane,pSrcDstPlane,indexY
153        SUB     pLeft,pSrcDstPlane,iExpandPels                  ;// pLeft->points to the top left of the expanded block
154        ADD     pRight,pSrcDstPlane,iFrameWidth
155        SUB     pRightIndex,pRight,#1
156
157        ADD     y,iFrameHeight,iExpandPels,LSL #1
158        LDR     expandTo4bytes,=0x01010101
159
160        RSB     RowStep,iExpandPels,iPlaneStep,LSL #1
161
162        ;// The Y Loop is unrolled twice
163ExpandFrameLeftRightYloop
164        LDRB    tempLeft2,[pSrcDstPlane,iPlaneStep]             ;// PreLoad the values
165        LDRB    tempRight2,[pRightIndex,iPlaneStep]
166        M_LDRB  tempLeft1,[pSrcDstPlane],iPlaneStep,LSL #1      ;// PreLoad the values
167        M_LDRB  tempRight1,[pRightIndex],iPlaneStep,LSL #1
168
169        SUB     x,iExpandPels,#4
170        MUL     tempLeft2,tempLeft2,expandTo4bytes              ;// Copy the single byte to 4 bytes
171        MUL     tempRight2,tempRight2,expandTo4bytes
172        MUL     tempLeft1,tempLeft1,expandTo4bytes              ;// Copy the single byte to 4 bytes
173        MUL     tempRight1,tempRight1,expandTo4bytes
174
175
176        ;// x loop
177ExpandFrameLeftRightXloop
178        SUBS    x,x,#4
179        STR     tempLeft2,[pLeft,iPlaneStep]                     ;// Store the 4 bytes at one go
180        STR     tempRight2,[pRight,iPlaneStep]
181        STR     tempLeft1,[pLeft],#4                             ;// Store the 4 bytes at one go
182        STR     tempRight1,[pRight],#4
183        BGE     ExpandFrameLeftRightXloop
184
185        SUBS    y,y,#2
186        ADD     pLeft,pLeft,RowStep
187        ADD     pRight,pRight,RowStep
188        BGT     ExpandFrameLeftRightYloop
189
190
191        ;// Set return value
192
193        MOV         result,#OMX_Sts_NoErr
194End
195
196        ;// Write function tail
197
198        M_END
199
200    ENDIF                                                    ;//ARM1136JS
201
202
203    END
204