summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/codecs/amrwbenc/src/asm/ARMV7/Deemph_32_neon.s
blob: 91feea0197d0565f6c66f5a33edd78d4a93973af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
@/*
@ ** Copyright 2003-2010, VisualOn, Inc.
@ **
@ ** Licensed under the Apache License, Version 2.0 (the "License");
@ ** you may not use this file except in compliance with the License.
@ ** You may obtain a copy of the License at
@ **
@ **     http://www.apache.org/licenses/LICENSE-2.0
@ **
@ ** Unless required by applicable law or agreed to in writing, software
@ ** distributed under the License is distributed on an "AS IS" BASIS,
@ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ ** See the License for the specific language governing permissions and
@ ** limitations under the License.
@ */
@
@void Deemph_32(
@     Word16 x_hi[],                        /* (i)     : input signal (bit31..16) */
@     Word16 x_lo[],                        /* (i)     : input signal (bit15..4)  */
@     Word16 y[],                           /* (o)     : output signal (x16)      */
@     Word16 mu,                            /* (i) Q15 : deemphasis factor        */
@     Word16 L,                             /* (i)     : vector size              */
@     Word16 * mem                          /* (i/o)   : memory (y[-1])           */
@     )

@x_hi     RN      R0
@x_lo     RN      R1
@y[]      RN      R2
@*mem     RN      R3

           .section  .text
           .global   Deemph_32_asm

Deemph_32_asm:

           STMFD   	r13!, {r4 - r12, r14}
	   MOV          r4, #2                   @i=0
	   LDRSH        r6, [r0], #2             @load x_hi[0]
	   LDRSH        r7, [r1], #2             @load x_lo[0]
	   LDR          r5, =22282               @r5---mu
	   MOV          r11, #0x8000

           @y[0]
	   MOV          r10, r6, LSL #16         @L_tmp = x_hi[0]<<16
	   MOV          r8,  r5, ASR #1          @fac = mu >> 1
	   LDR          r5,  [r3]
	   ADD          r12, r10, r7, LSL #4     @L_tmp += x_lo[0] << 4
	   MOV          r10, r12, LSL #3         @L_tmp <<= 3
	   MUL          r9, r5, r8
	   LDRSH        r6, [r0], #2             @load x_hi[1]
	   QDADD        r10, r10, r9
	   LDRSH        r7, [r1], #2             @load x_lo[1]
	   MOV          r12, r10, LSL #1         @L_tmp = L_mac(L_tmp, *mem, fac)
	   QADD         r10, r12, r11
	   MOV          r14, r10, ASR #16        @y[0] = round(L_tmp)


	   MOV          r10, r6, LSL #16
	   ADD          r12, r10, r7, LSL #4
           STRH         r14, [r2], #2            @update y[0]
	   MOV          r10, r12, LSL #3
	   MUL          r9, r14, r8
	   QDADD        r10, r10, r9
	   MOV          r12, r10, LSL #1
	   QADD         r10, r12, r11
	   MOV          r14, r10, ASR #16        @y[1] = round(L_tmp)

LOOP:
           LDRSH        r6, [r0], #2             @load x_hi[]
	   LDRSH        r7, [r1], #2
	   STRH         r14, [r2], #2
	   MOV          r10, r6, LSL #16
	   ADD          r12, r10, r7, LSL #4
	   MUL          r9, r14, r8
	   MOV          r10, r12, LSL #3
	   QDADD        r10, r10, r9
           LDRSH        r6, [r0], #2             @load x_hi[]
	   MOV          r12, r10, LSL #1
	   QADD         r10, r12, r11
	   LDRSH        r7, [r1], #2
	   MOV          r14, r10, ASR #16

	   MOV          r10, r6, LSL #16
	   ADD          r12, r10, r7, LSL #4
	   STRH         r14, [r2], #2
	   MUL          r9, r14, r8
	   MOV          r10, r12, LSL #3
	   QDADD        r10, r10, r9
           ADD          r4, r4, #2
	   MOV          r12, r10, LSL #1
	   QADD         r10, r12, r11
           CMP          r4, #64
	   MOV          r14, r10, ASR #16

           BLT          LOOP
           STR          r14, [r3]
           STRH         r14, [r2]

           LDMFD   	r13!, {r4 - r12, r15}

	   .end