ex
Fork of mbed-os-example-mbed5-blinky by
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/filters_arm4.h@47:9e361da97763, 2017-07-18 (annotated)
- Committer:
- TMBOY
- Date:
- Tue Jul 18 16:54:45 2017 +0800
- Revision:
- 47:9e361da97763
?
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| TMBOY | 47:9e361da97763 | 1 | /* Copyright (C) 2004 Jean-Marc Valin */ |
| TMBOY | 47:9e361da97763 | 2 | /** |
| TMBOY | 47:9e361da97763 | 3 | @file filters_arm4.h |
| TMBOY | 47:9e361da97763 | 4 | @brief Various analysis/synthesis filters (ARM4 version) |
| TMBOY | 47:9e361da97763 | 5 | */ |
| TMBOY | 47:9e361da97763 | 6 | /* |
| TMBOY | 47:9e361da97763 | 7 | Redistribution and use in source and binary forms, with or without |
| TMBOY | 47:9e361da97763 | 8 | modification, are permitted provided that the following conditions |
| TMBOY | 47:9e361da97763 | 9 | are met: |
| TMBOY | 47:9e361da97763 | 10 | |
| TMBOY | 47:9e361da97763 | 11 | - Redistributions of source code must retain the above copyright |
| TMBOY | 47:9e361da97763 | 12 | notice, this list of conditions and the following disclaimer. |
| TMBOY | 47:9e361da97763 | 13 | |
| TMBOY | 47:9e361da97763 | 14 | - Redistributions in binary form must reproduce the above copyright |
| TMBOY | 47:9e361da97763 | 15 | notice, this list of conditions and the following disclaimer in the |
| TMBOY | 47:9e361da97763 | 16 | documentation and/or other materials provided with the distribution. |
| TMBOY | 47:9e361da97763 | 17 | |
| TMBOY | 47:9e361da97763 | 18 | - Neither the name of the Xiph.org Foundation nor the names of its |
| TMBOY | 47:9e361da97763 | 19 | contributors may be used to endorse or promote products derived from |
| TMBOY | 47:9e361da97763 | 20 | this software without specific prior written permission. |
| TMBOY | 47:9e361da97763 | 21 | |
| TMBOY | 47:9e361da97763 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| TMBOY | 47:9e361da97763 | 23 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| TMBOY | 47:9e361da97763 | 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| TMBOY | 47:9e361da97763 | 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR |
| TMBOY | 47:9e361da97763 | 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| TMBOY | 47:9e361da97763 | 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| TMBOY | 47:9e361da97763 | 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| TMBOY | 47:9e361da97763 | 29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| TMBOY | 47:9e361da97763 | 30 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| TMBOY | 47:9e361da97763 | 31 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| TMBOY | 47:9e361da97763 | 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| TMBOY | 47:9e361da97763 | 33 | */ |
| TMBOY | 47:9e361da97763 | 34 | |
| TMBOY | 47:9e361da97763 | 35 | #define OVERRIDE_NORMALIZE16 |
| TMBOY | 47:9e361da97763 | 36 | int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int len) |
| TMBOY | 47:9e361da97763 | 37 | { |
| TMBOY | 47:9e361da97763 | 38 | spx_sig_t max_val=1; |
| TMBOY | 47:9e361da97763 | 39 | int sig_shift; |
| TMBOY | 47:9e361da97763 | 40 | int dead1, dead2, dead3, dead4, dead5, dead6; |
| TMBOY | 47:9e361da97763 | 41 | |
| TMBOY | 47:9e361da97763 | 42 | __asm__ __volatile__ ( |
| TMBOY | 47:9e361da97763 | 43 | "\tmov %1, #1 \n" |
| TMBOY | 47:9e361da97763 | 44 | "\tmov %3, #0 \n" |
| TMBOY | 47:9e361da97763 | 45 | |
| TMBOY | 47:9e361da97763 | 46 | ".normalize16loop1%=: \n" |
| TMBOY | 47:9e361da97763 | 47 | |
| TMBOY | 47:9e361da97763 | 48 | "\tldr %4, [%0], #4 \n" |
| TMBOY | 47:9e361da97763 | 49 | "\tcmps %4, %1 \n" |
| TMBOY | 47:9e361da97763 | 50 | "\tmovgt %1, %4 \n" |
| TMBOY | 47:9e361da97763 | 51 | "\tcmps %4, %3 \n" |
| TMBOY | 47:9e361da97763 | 52 | "\tmovlt %3, %4 \n" |
| TMBOY | 47:9e361da97763 | 53 | |
| TMBOY | 47:9e361da97763 | 54 | "\tsubs %2, %2, #1 \n" |
| TMBOY | 47:9e361da97763 | 55 | "\tbne .normalize16loop1%=\n" |
| TMBOY | 47:9e361da97763 | 56 | |
| TMBOY | 47:9e361da97763 | 57 | "\trsb %3, %3, #0 \n" |
| TMBOY | 47:9e361da97763 | 58 | "\tcmp %1, %3 \n" |
| TMBOY | 47:9e361da97763 | 59 | "\tmovlt %1, %3 \n" |
| TMBOY | 47:9e361da97763 | 60 | : "=r" (dead1), "=r" (max_val), "=r" (dead3), "=r" (dead4), |
| TMBOY | 47:9e361da97763 | 61 | "=r" (dead5), "=r" (dead6) |
| TMBOY | 47:9e361da97763 | 62 | : "0" (x), "2" (len) |
| TMBOY | 47:9e361da97763 | 63 | : "cc"); |
| TMBOY | 47:9e361da97763 | 64 | |
| TMBOY | 47:9e361da97763 | 65 | sig_shift=0; |
| TMBOY | 47:9e361da97763 | 66 | while (max_val>max_scale) |
| TMBOY | 47:9e361da97763 | 67 | { |
| TMBOY | 47:9e361da97763 | 68 | sig_shift++; |
| TMBOY | 47:9e361da97763 | 69 | max_val >>= 1; |
| TMBOY | 47:9e361da97763 | 70 | } |
| TMBOY | 47:9e361da97763 | 71 | |
| TMBOY | 47:9e361da97763 | 72 | __asm__ __volatile__ ( |
| TMBOY | 47:9e361da97763 | 73 | ".normalize16loop%=: \n" |
| TMBOY | 47:9e361da97763 | 74 | |
| TMBOY | 47:9e361da97763 | 75 | "\tldr %4, [%0], #4 \n" |
| TMBOY | 47:9e361da97763 | 76 | "\tldr %5, [%0], #4 \n" |
| TMBOY | 47:9e361da97763 | 77 | "\tmov %4, %4, asr %3 \n" |
| TMBOY | 47:9e361da97763 | 78 | "\tstrh %4, [%1], #2 \n" |
| TMBOY | 47:9e361da97763 | 79 | "\tldr %4, [%0], #4 \n" |
| TMBOY | 47:9e361da97763 | 80 | "\tmov %5, %5, asr %3 \n" |
| TMBOY | 47:9e361da97763 | 81 | "\tstrh %5, [%1], #2 \n" |
| TMBOY | 47:9e361da97763 | 82 | "\tldr %5, [%0], #4 \n" |
| TMBOY | 47:9e361da97763 | 83 | "\tmov %4, %4, asr %3 \n" |
| TMBOY | 47:9e361da97763 | 84 | "\tstrh %4, [%1], #2 \n" |
| TMBOY | 47:9e361da97763 | 85 | "\tsubs %2, %2, #1 \n" |
| TMBOY | 47:9e361da97763 | 86 | "\tmov %5, %5, asr %3 \n" |
| TMBOY | 47:9e361da97763 | 87 | "\tstrh %5, [%1], #2 \n" |
| TMBOY | 47:9e361da97763 | 88 | |
| TMBOY | 47:9e361da97763 | 89 | "\tbge .normalize16loop%=\n" |
| TMBOY | 47:9e361da97763 | 90 | : "=r" (dead1), "=r" (dead2), "=r" (dead3), "=r" (dead4), |
| TMBOY | 47:9e361da97763 | 91 | "=r" (dead5), "=r" (dead6) |
| TMBOY | 47:9e361da97763 | 92 | : "0" (x), "1" (y), "2" (len>>2), "3" (sig_shift) |
| TMBOY | 47:9e361da97763 | 93 | : "cc", "memory"); |
| TMBOY | 47:9e361da97763 | 94 | return sig_shift; |
| TMBOY | 47:9e361da97763 | 95 | } |
| TMBOY | 47:9e361da97763 | 96 |
