1@
2@ Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3@
4@ Use of this source code is governed by a BSD-style license
5@ that can be found in the LICENSE file in the root of the source
6@ tree. An additional intellectual property rights grant can be found
7@ in the file PATENTS.  All contributing project authors may
8@ be found in the AUTHORS file in the root of the source tree.
9@
10
11@ Contains a function for the core loop in the normalized lattice AR
12@ filter routine for iSAC codec, optimized for ARMv7 platforms.
13@
14@ Output is bit-exact with the reference C code in lattic_c.c
15@
16@ Register usage:
17@
18@ r0:  &ar_g_Q0
19@ r1:  &ar_f_Q0
20@ r2:  &cth_Q15
21@ r3:  &sth_Q15
22@ r4:  out loop counter
23@ r5:  tmpAR
24@ r9:  inner loop counter
25@ r12: constant #16384
26@ r6, r7, r8, r10, r11: scratch
27
28#include "settings.h"
29
30.arch armv7-a
31.global WebRtcIsacfix_FilterArLoop
32.align  2
33
34WebRtcIsacfix_FilterArLoop:
35.fnstart
36
37.save {r4-r11}
38  push    {r4-r11}
39
40  add     r1, #2                 @ &ar_f_Q0[1]
41  mov     r12, #16384
42  mov     r4, #HALF_SUBFRAMELEN
43  sub     r4, #1                 @ Outer loop counter = HALF_SUBFRAMELEN - 1
44
45HALF_SUBFRAME_LOOP:  @ for(n = 0; n < HALF_SUBFRAMELEN - 1; n++)
46
47  ldr     r9, [sp, #32]          @ Restore the inner loop counter to order_coef
48  ldrh    r5, [r1]               @ tmpAR = ar_f_Q0[n+1]
49  add     r0, r9, asl #1         @ Restore r0 to &ar_g_Q0[order_coef]
50  add     r2, r9, asl #1         @ Restore r2 to &cth_Q15[order_coef]
51  add     r3, r9, asl #1         @ Restore r3 to &sth_Q15[order_coef]
52
53ORDER_COEF_LOOP:  @ for(k = order_coef - 1 ; k >= 0; k--)
54
55  ldrh    r7, [r3, #-2]!         @ sth_Q15[k]
56  ldrh    r6, [r2, #-2]!         @ cth_Q15[k]
57
58  ldrh    r8, [r0, #-2]          @ ar_g_Q0[k]
59  smlabb  r11, r7, r5, r12       @ sth_Q15[k] * tmpAR + 16384
60  smlabb  r10, r6, r5, r12       @ cth_Q15[k] * tmpAR + 16384
61  smulbb  r7, r7, r8             @ sth_Q15[k] * ar_g_Q0[k]
62  smlabb  r11, r6, r8, r11       @ cth_Q15[k]*ar_g_Q0[k]+(sth_Q15[k]*tmpAR+16384)
63
64  sub     r10, r10, r7           @ cth_Q15[k]*tmpAR+16384-(sth_Q15[k]*ar_g_Q0[k])
65  ssat    r11, #16, r11, asr #15
66  ssat    r5, #16, r10, asr #15
67  strh    r11, [r0], #-2         @ Output: ar_g_Q0[k+1]
68
69  subs    r9, #1
70  bgt     ORDER_COEF_LOOP
71
72  strh    r5, [r0]               @ Output: ar_g_Q0[0] = tmpAR;
73  strh    r5, [r1], #2           @ Output: ar_f_Q0[n+1] = tmpAR;
74
75  subs    r4, #1
76  bne     HALF_SUBFRAME_LOOP
77
78  pop     {r4-r11}
79  bx      lr
80
81.fnend
82
83