OSDN Git Service

original
[gb-231r1-is01/Gingerbread_2.3.3_r1_IS01.git] / frameworks / base / media / libstagefright / codecs / aacenc / src / asm / ARMV5E / CalcWindowEnergy_v5.s
1 @/*\r
2 @ ** Copyright 2003-2010, VisualOn, Inc.\r
3 @ **\r
4 @ ** Licensed under the Apache License, Version 2.0 (the "License");\r
5 @ ** you may not use this file except in compliance with the License.\r
6 @ ** You may obtain a copy of the License at\r
7 @ **\r
8 @ **     http://www.apache.org/licenses/LICENSE-2.0\r
9 @ **\r
10 @ ** Unless required by applicable law or agreed to in writing, software\r
11 @ ** distributed under the License is distributed on an "AS IS" BASIS,\r
12 @ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13 @ ** See the License for the specific language governing permissions and\r
14 @ ** limitations under the License.\r
15 @ */\r
16 \r
17 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r
18 @       File:           CalcWindowEnergy_v5.s\r
19 @\r
20 @       Content:        CalcWindowEnergy function armv5 assemble\r
21 @\r
22 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r
23 \r
24         .section .text\r
25         \r
26         .global CalcWindowEnergy\r
27 \r
28 CalcWindowEnergy:\r
29         stmdb   sp!, {r4 - r11, lr}\r
30         sub     r13, r13, #20 \r
31 \r
32   mov     r3, r3, lsl #16                         \r
33         ldr     r10, [r0, #168]                    @ states0 = blockSwitchingControl->iirStates[0];\r
34   mov     r3, r3, asr #16 \r
35         ldr     r11, [r0, #172]                    @ states1 = blockSwitchingControl->iirStates[1];\r
36 \r
37         mov     r2, r2, lsl #16\r
38         ldr     r12, hiPassCoeff                   @ Coeff0 = hiPassCoeff[0];      \r
39   mov     r2, r2, asr #16\r
40         ldr     r14, hiPassCoeff + 4                             @ Coeff1 = hiPassCoeff[1];\r
41         \r
42         mov                     r8, #0                                                                 @ w=0\r
43         mov                     r5, #0                                                                 @ wOffset = 0;\r
44         \r
45 BLOCK_BEGIN:\r
46         mov                     r6, #0                             @ accuUE = 0; \r
47         mov                     r7, #0                                                                       @ accuFE = 0; \r
48         mov                     r4, #0                                                                 @ i=0\r
49                                    \r
50         str                     r8, [r13, #4]   \r
51         str                     r0, [r13, #8]   \r
52         str                     r3, [r13, #12]\r
53         \r
54 ENERGY_BEG:     \r
55         mov     r9, r5, lsl #1  \r
56         ldrsh   r9, [r1, r9]                                                                                    @ tempUnfiltered = timeSignal[tidx];\r
57 \r
58         add                     r5, r5, r2                                                                                              @ tidx = tidx + chIncrement;\r
59         \r
60         smulwb  r3, r14, r9                                                                                             @ accu1 = L_mpy_ls(Coeff1, tempUnfiltered);     \r
61         smull           r0, r8, r12, r11                                                                        @ accu2 = fixmul( Coeff0, states1 );\r
62         \r
63         mov                     r3, r3, lsl #1\r
64         mov                     r8, r8, lsl #1\r
65 \r
66         sub                     r0, r3, r10                                                                                             @ accu3 = accu1 - states0;      \r
67         sub                     r8,     r0, r8                                                                                          @ out = accu3 - accu2;\r
68 \r
69         mov               r10, r3                                                                                                               @ states0 = accu1;\r
70         mov               r11, r8                                                                                                               @ states1 = out;  \r
71         \r
72         mul               r3, r9, r9    \r
73         mov     r8, r8, asr #16\r
74         \r
75         add               r4, r4, #1\r
76         add     r6, r6, r3, asr #7\r
77 \r
78         mul               r9, r8, r8    \r
79         ldr               r3, [r13, #12]\r
80 \r
81         add               r7, r7, r9, asr #7\r
82                 \r
83         cmp     r4, r3                            \r
84   blt     ENERGY_BEG       \r
85         \r
86         ldr               r0, [r13, #8]\r
87         ldr               r8, [r13, #4]\r
88         \r
89 ENERGY_END:\r
90         add               r4, r0, r8, lsl #2\r
91 \r
92         str     r6, [r4, #72]         \r
93         add               r8, r8, #1               \r
94   str     r7, [r4, #136]                   \r
95 \r
96         cmp               r8, #8\r
97         blt               BLOCK_BEGIN                                           \r
98 \r
99 BLOCK_END:\r
100         str     r10, [r0, #168]                    \r
101   str     r11, [r0, #172]                    \r
102   mov     r0, #1            \r
103                         \r
104   add     r13, r13, #20   \r
105         ldmia   sp!, {r4 - r11, pc}                  \r
106 \r
107 hiPassCoeff:\r
108         .word 0xbec8b439\r
109         .word   0x609d4952\r
110                 \r
111         @ENDP\r
112         .end\r