• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1@/******************************************************************************
2@ *
3@ * Copyright (C) 2018 The Android Open Source Project
4@ *
5@ * Licensed under the Apache License, Version 2.0 (the "License");
6@ * you may not use this file except in compliance with the License.
7@ * You may obtain a copy of the License at:
8@ *
9@ * http://www.apache.org/licenses/LICENSE-2.0
10@ *
11@ * Unless required by applicable law or agreed to in writing, software
12@ * distributed under the License is distributed on an "AS IS" BASIS,
13@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14@ * See the License for the specific language governing permissions and
15@ * limitations under the License.
16@ *
17@ *****************************************************************************
18@ * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19@*/
20
21
22.text
23.p2align 2
24    .global ixheaacd_adjust_scale_armv7
25ixheaacd_adjust_scale_armv7:
26    STMFD           SP!, {R4-R11, R14}
27    LDR             R4, [SP, #44]
28    LDR             R5, [SP, #36]
29    LDR             R6, [SP, #40]
30    MOVS            R4, R4
31    BEQ             ENDRESSCALE
32    SUBS            R3, R3, R2
33    BLE             ENDRESSCALE
34    SUBS            R6, R6, R5
35    BLE             ENDRESSCALE
36
37    ADD             R9, R0, R5, LSL#2
38    LDR             R10, [R9], #4
39
40    CMP             R4, #31
41    MOVGT           R4, #31
42    CMP             R4, #-31
43    MOVLT           R4, #-31
44
45
46    LDR             R8, [SP, #48]
47    MOVS            R8, R8
48    BEQ             ELIF1
49
50
51    MOVS            R4, R4
52    BLE             ELIF2_1
53
54LOOP1:
55    ADD             R10, R10, R2, LSL #2
56    MOV             R7, R3
57
58INNLOOP1:
59    LDR             R11, [R10]
60    SUBS            R7, R7  , #2
61    LDRGE           R5, [R10, #4]
62
63    MOV             R11, R11, LSL R4
64    STR             R11, [R10], #4
65
66    MOVGE           R5, R5, LSL R4
67    STRGE           R5, [R10], #4
68
69    BGT             INNLOOP1
70
71    LDR             R10, [R9], #4
72    SUBS            R6, R6, #1
73    BGT             LOOP1
74
75    B               ENDRESSCALE
76
77ELIF2_1:
78    RSB             R4, R4, #0
79
80LOOP2:
81    ADD             R10, R10, R2, LSL #2
82    MOV             R7, R3
83INNLOOP2:
84    LDR             R11, [R10]
85    SUBS            R7, R7  , #2
86    LDRGE           R5, [R10, #4]
87
88    MOV             R11, R11, ASR R4
89    STR             R11, [R10], #4
90
91    MOVGE           R5, R5, ASR R4
92    STRGE           R5, [R10], #4
93
94    BGT             INNLOOP2
95
96    LDR             R10, [R9], #4
97    SUBS            R6, R6, #1
98    BGT             LOOP2
99
100
101
102
103    B               ENDRESSCALE
104
105ELIF1:
106    ADD             R5, R1, R5, LSL#2
107
108    MOVS            R4, R4
109    BLE             ELIF2_2
110LOOP3:
111    LDR             R8, [R5], #4
112    ADD             R10, R10, R2, LSL #2
113    ADD             R8, R8, R2, LSL #2
114    BICS            R7, R3, #1
115    BEQ             COUNTODD1
116INNLOOP3:
117    LDR             R11, [R10]
118    LDR             R1, [R8]
119    MOV             R11, R11, LSL R4
120    MOV             R1, R1, LSL R4
121    STR             R11, [R10], #4
122    STR             R1, [R8], #4
123
124    LDR             R11, [R10]
125    LDR             R1, [R8]
126    MOV             R11, R11, LSL R4
127    MOV             R1, R1, LSL R4
128    STR             R11, [R10], #4
129    STR             R1, [R8], #4
130
131    SUBS            R7, R7  , #2
132    BGT             INNLOOP3
133COUNTODD1:
134    BIC             R7, R3, #1
135    CMP             R7, R3
136    BEQ             INNLOOP3END
137
138    LDR             R11, [R10]
139    LDR             R1, [R8]
140    MOV             R11, R11, LSL R4
141    MOV             R1, R1, LSL R4
142    STR             R11, [R10], #4
143    STR             R1, [R8], #4
144
145
146
147INNLOOP3END:
148
149
150    LDR             R10, [R9], #4
151    SUBS            R6, R6, #1
152    BGT             LOOP3
153    B               ENDRESSCALE
154
155ELIF2_2:
156    RSB             R4, R4, #0
157
158LOOP4:
159    LDR             R8, [R5], #4
160    ADD             R10, R10, R2, LSL #2
161    ADD             R8, R8, R2, LSL #2
162    BICS            R7, R3, #1
163    BEQ             COUNTODD2
164INNLOOP4:
165    LDR             R11, [R10]
166    LDR             R1, [R8]
167    MOV             R11, R11, ASR R4
168    MOV             R1, R1, ASR R4
169    STR             R11, [R10], #4
170    STR             R1, [R8], #4
171
172    LDR             R11, [R10]
173    LDR             R1, [R8]
174    MOV             R11, R11, ASR R4
175    MOV             R1, R1, ASR R4
176    STR             R11, [R10], #4
177    STR             R1, [R8], #4
178
179
180    SUBS            R7, R7  , #2
181    BGT             INNLOOP4
182COUNTODD2:
183    BIC             R7, R3, #1
184    CMP             R7, R3
185    BEQ             INNLOOP4END
186
187    LDR             R11, [R10]
188    LDR             R1, [R8]
189    MOV             R11, R11, ASR R4
190    MOV             R1, R1, ASR R4
191    STR             R11, [R10], #4
192    STR             R1, [R8], #4
193
194
195INNLOOP4END:
196    LDR             R10, [R9], #4
197    SUBS            R6, R6, #1
198    BGT             LOOP4
199
200
201ENDRESSCALE:
202    LDMFD           sp!, {r4-r11, r15}
203
204
205
206