bowen liu
/
mbed-os-example-blinky
ex
Fork of mbed-os-example-mbed5-blinky by
Embed:
(wiki syntax)
Show/hide line numbers
vq_arm4.h
Go to the documentation of this file.
00001 /* Copyright (C) 2004 Jean-Marc Valin */ 00002 /** 00003 @file vq_arm4.h 00004 @brief ARM4-optimized vq routine 00005 */ 00006 /* 00007 Redistribution and use in source and binary forms, with or without 00008 modification, are permitted provided that the following conditions 00009 are met: 00010 00011 - Redistributions of source code must retain the above copyright 00012 notice, this list of conditions and the following disclaimer. 00013 00014 - Redistributions in binary form must reproduce the above copyright 00015 notice, this list of conditions and the following disclaimer in the 00016 documentation and/or other materials provided with the distribution. 00017 00018 - Neither the name of the Xiph.org Foundation nor the names of its 00019 contributors may be used to endorse or promote products derived from 00020 this software without specific prior written permission. 00021 00022 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00023 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00024 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00025 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 00026 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00027 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00028 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00029 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00030 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00031 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00032 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00033 */ 00034 00035 #define OVERRIDE_VQ_NBEST 00036 void vq_nbest(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack) 00037 { 00038 int i,j; 00039 for (i=0;i<entries;i+=4) 00040 { 00041 #if 1 00042 spx_word32_t dist1, dist2, dist3, dist4; 00043 int dead1, dead2, dead3, dead4, dead5, dead6, dead7, dead8; 00044 __asm__ __volatile__ ( 00045 "mov %0, #0 \n\t" 00046 "mov %1, #0 \n\t" 00047 "mov %2, #0 \n\t" 00048 "mov %3, #0 \n\t" 00049 "mov %10, %4 \n\t" 00050 "add %4, %4, %4\n\t" 00051 ".vqloop%=:\n\t" 00052 "ldrsh %7, [%5], #2 \n\t" 00053 "ldrsh %8, [%6] \n\t" 00054 "mov %9, %6 \n\t" 00055 "mla %0, %7, %8, %0 \n\t" 00056 "ldrsh %8, [%9, %4]! \n\t" 00057 "mla %1, %7, %8, %1 \n\t" 00058 "ldrsh %8, [%9, %4]!\n\t" 00059 "mla %2, %7, %8, %2 \n\t" 00060 "ldrsh %8, [%9, %4]! \n\t" 00061 "mla %3, %7, %8, %3 \n\t" 00062 "subs %10, %10, #1 \n\t" 00063 "add %6, %6, #2 \n\t" 00064 "bne .vqloop%=" 00065 : "=r" (dist1), "=r" (dist2), "=r" (dist3), "=r" (dist4), 00066 "=r" (dead1), "=r" (dead2), "=r" (codebook), "=r" (dead4), 00067 "=r" (dead5), "=r" (dead6), "=r" (dead7) 00068 : "4" (len), "5" (in), "6" (codebook) 00069 : "cc"); 00070 #else 00071 dist1=dist2=dist3=dist4=0; 00072 /* spx_word32_t dist1=0; 00073 spx_word32_t dist2=0; 00074 spx_word32_t dist3=0; 00075 spx_word32_t dist4=0;*/ 00076 for (j=0;j<2;j++) 00077 { 00078 const spx_word16_t *code = codebook; 00079 dist1 = MAC16_16(dist1,in[j],*code); 00080 code += len; 00081 dist2 = MAC16_16(dist2,in[j],*code); 00082 code += len; 00083 dist3 = MAC16_16(dist3,in[j],*code); 00084 code += len; 00085 dist4 = MAC16_16(dist4,in[j],*code); 00086 codebook++; 00087 } 00088 #endif 00089 dist1=SUB32(SHR(*E++,1),dist1); 00090 if (dist1<*best_dist || i==0) 00091 { 00092 *best_dist=dist1; 00093 *nbest=i; 00094 } 00095 dist2=SUB32(SHR(*E++,1),dist2); 00096 if (dist2<*best_dist) 00097 { 00098 *best_dist=dist2; 00099 *nbest=i+1; 00100 } 00101 dist3=SUB32(SHR(*E++,1),dist3); 00102 if (dist3<*best_dist) 00103 { 00104 *best_dist=dist3; 00105 *nbest=i+2; 00106 } 00107 dist4=SUB32(SHR(*E++,1),dist4); 00108 if (dist4<*best_dist) 00109 { 00110 *best_dist=dist4; 00111 *nbest=i+3; 00112 } 00113 codebook += 3*len; 00114 } 00115 }
Generated on Tue Jul 12 2022 16:28:54 by 1.7.2