bowen liu
/
mbed-os-example-blinky
ex
Fork of mbed-os-example-mbed5-blinky by
Embed:
(wiki syntax)
Show/hide line numbers
cb_search_bfin.h
Go to the documentation of this file.
00001 /* Copyright (C) 2005 Analog Devices */ 00002 /** 00003 @author Jean-Marc Valin 00004 @file cb_search_bfin.h 00005 @brief Fixed codebook functions (Blackfin version) 00006 */ 00007 /* 00008 Redistribution and use in source and binary forms, with or without 00009 modification, are permitted provided that the following conditions 00010 are met: 00011 00012 - Redistributions of source code must retain the above copyright 00013 notice, this list of conditions and the following disclaimer. 00014 00015 - Redistributions in binary form must reproduce the above copyright 00016 notice, this list of conditions and the following disclaimer in the 00017 documentation and/or other materials provided with the distribution. 00018 00019 - Neither the name of the Xiph.org Foundation nor the names of its 00020 contributors may be used to endorse or promote products derived from 00021 this software without specific prior written permission. 00022 00023 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00024 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00025 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00026 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 00027 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00028 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00029 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00030 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00031 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00032 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00033 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 */ 00035 00036 #define OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK 00037 void compute_weighted_codebook(const signed char *shape_cb, const spx_word16_t *r, spx_word16_t *resp, spx_word16_t *resp2, spx_word32_t *E, int shape_cb_size, int subvect_size, char *stack) 00038 { 00039 int i; 00040 for (i=0;i<shape_cb_size;i++) 00041 { 00042 __asm__ __volatile__ ( 00043 "P0 = %0;\n\t" 00044 "LC0 = P0;\n\t" 00045 "P1 = %1;\n\t" 00046 "P2 = %2;\n\t" 00047 "P3 = %3;\n\t" 00048 "P0 = 1;\n\t" 00049 "L0 = 0;\n\t" 00050 "L1 = 0;\n\t" 00051 "R2 = 0;\n\t" 00052 "A1 = 0;\n\t" 00053 "LOOP outter%= LC0;\n\t" 00054 "LOOP_BEGIN outter%=;\n\t" 00055 "A0 = 0;\n\t" 00056 "P4 = P1;\n\t" 00057 "I1 = P2;\n\t" 00058 "R0 = B[P4++] (X) || R1.L = W[I1--];\n\t" 00059 "LOOP inner%= LC1 = P0;\n\t" 00060 "LOOP_BEGIN inner%=;\n\t" 00061 "A0 += R0.L*R1.L (IS) || R0 = B[P4++] (X) || R1.L = W[I1--];\n\t" 00062 "LOOP_END inner%=;\n\t" 00063 "R0 = A0;\n\t" 00064 "R0 >>>= 13;\n\t" 00065 "A1 += R0.L*R0.L (IS);\n\t" 00066 "W[P3++] = R0;\n\t" 00067 "P0 += 1;\n\t" 00068 "P2 += 2;\n\t" 00069 "LOOP_END outter%=;\n\t" 00070 "P4 = %4;\n\t" 00071 "R1 = A1;\n\t" 00072 "[P4] = R1;\n\t" 00073 : 00074 : "m" (subvect_size), "m" (shape_cb), "m" (r), "m" (resp), "m" (E) 00075 : "A0", "P0", "P1", "P2", "P3", "P4", "R0", "R1", "R2", "I0", "I1", "L0", 00076 "L1", "A0", "A1", "memory" 00077 #if !(__GNUC__ == 3) 00078 , "LC0", "LC1" /* gcc 3.4 doesn't know about LC registers */ 00079 #endif 00080 ); 00081 shape_cb += subvect_size; 00082 resp += subvect_size; 00083 E++; 00084 } 00085 } 00086 00087 #define OVERRIDE_TARGET_UPDATE 00088 static inline void target_update(spx_word16_t *t, spx_word16_t g, spx_word16_t *r, int len) 00089 { 00090 if (!len) 00091 return; 00092 __asm__ __volatile__ 00093 ( 00094 "I0 = %0;\n\t" 00095 "I1 = %1;\n\t" 00096 "L0 = 0;\n\t" 00097 "L1 = 0;\n\t" 00098 "R2 = 4096;\n\t" 00099 "LOOP tupdate%= LC0 = %3;\n\t" 00100 "LOOP_BEGIN tupdate%=;\n\t" 00101 "R0.L = W[I0] || R1.L = W[I1++];\n\t" 00102 "R1 = (A1 = R1.L*%2.L) (IS);\n\t" 00103 "R1 = R1 + R2;\n\t" 00104 "R1 >>>= 13;\n\t" 00105 "R0.L = R0.L - R1.L;\n\t" 00106 "W[I0++] = R0.L;\n\t" 00107 "LOOP_END tupdate%=;\n\t" 00108 : 00109 : "a" (t), "a" (r), "d" (g), "a" (len) 00110 : "R0", "R1", "R2", "A1", "I0", "I1", "L0", "L1" 00111 ); 00112 }
Generated on Tue Jul 12 2022 16:28:53 by 1.7.2