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_conv_ergtoamplitude_armv7
25ixheaacd_conv_ergtoamplitude_armv7:
26
27    STMFD           sp!, {r4-r12, r14}
28
29    LDR             R5, [SP, #44]
30    LDR             R4, [SP, #40]
31    MOVW            R14, #0x1FF
32    MOVW            R10, #0x5A82
33
34LOOP1:
35
36    LDRSH           R6, [R2], #2
37    LDRSH           R7, [R2], #2
38    MOV             R12, #0
39    MOV             R9, #-16
40    MOVS            R6, R6
41    BLE             ENDIF1_1
42    CLZ             R8, R6
43    SUB             R8, R8, #17
44    SUB             R7, R7, R8
45    MOV             R11, R6, LSL R8
46
47    MOV             R11, R11, ASR #5
48    ANDS            R11, R11, R14
49
50    BIC             R11, R11, #1
51    LDRH            R12, [R11, R5]
52
53    TST             R7, #1
54    ADDNE           R7, R7, #3
55    SMULWBNE        R12, R12, R10
56
57
58    MOV             R9, R7, ASR #1
59ENDIF1_1:
60    STRH            R12, [R2, #-4]
61    STRH            R9, [R2, #-2]
62
63
64    LDRSH           R6, [R3], #2
65    LDRSH           R7, [R3], #2
66    MOV             R8, #0
67    MOV             R9, #-16
68    MOVS            R6, R6
69    BLE             ENDIF1_2
70    CLZ             R8, R6
71    SUB             R8, R8, #17
72    SUB             R7, R7, R8
73    MOV             R11, R6, LSL R8
74    MOV             R11, R11, ASR #5
75    ANDS            R11, R11, R14
76
77    BIC             R11, R11, #1
78    LDRH            R8, [R11, R5]
79    TST             R7, #1
80    ADDNE           R7, R7, #3
81
82    SMULWBNE        R8, R8, R10
83
84
85    MOV             R9, R7, ASR #1
86ENDIF1_2:
87    STRH            R8, [R3, #-4]
88    STRH            R9, [R3, #-2]
89
90
91
92    LDRSH           R6, [R4], #2
93    LDRSH           R7, [R4], #2
94    MOV             R8, #0
95    MOV             R9, #-16
96    MOVS            R6, R6
97    BLE             ENDIF1_3
98    CLZ             R8, R6
99    SUB             R8, R8, #17
100    SUB             R7, R7, R8
101    MOV             R11, R6, LSL R8
102    MOV             R11, R11, ASR #5
103    ANDS            R11, R11, R14
104
105    BIC             R11, R11, #1
106    LDRH            R8, [R11, R5]
107    TST             R7, #1
108    ADDNE           R7, R7, #3
109
110    SMULWBNE        R8, R8, R10
111
112
113    MOV             R9, R7, ASR #1
114ENDIF1_3:
115    STRH            R9, [R4, #-2]
116
117    SUB             R6, R1, R9
118    SUBS            R6, R6, #4
119
120    RSBLE           R6, R6, #0
121    MOVGT           R8, R8, ASR R6
122    MOVLE           R8, R8, LSL R6
123    STRH            R8, [R4, #-4]
124
125    SUBS            R0, R0, #1
126    BGT             LOOP1
127    LDMFD           sp!, {r4-r12, r15}
128
129
130
131
132
133