cb_search_arm4.h

Go to the documentation of this file.
00001 /* Copyright (C) 2004 Jean-Marc Valin */
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_COMPUTE_WEIGHTED_CODEBOOK
00036 static void compute_weighted_codebook(const signed char *shape_cb, const spx_sig_t *r, spx_word16_t *resp, spx_word16_t *resp2, spx_word32_t *E, int shape_cb_size, int subvect_size, char *stack)
00037 {
00038    int i, j, k;
00039   //const signed char *shape;
00040    for (i=0;i<shape_cb_size;i+=4)
00041    {
00042 
00043       //shape = shape_cb;
00044       E[0]=0;
00045       E[1]=0;
00046       E[2]=0;
00047       E[3]=0;
00048 
00049       /* Compute codeword response using convolution with impulse response */
00050       for(j=0;j<subvect_size;j++)
00051       {
00052 #if 1
00053           spx_word16_t *res;
00054           res = resp+j;
00055           spx_word32_t resj0,resj1,resj2,resj3;
00056           spx_word32_t dead1, dead2, dead3, dead4, dead5, dead6, dead7, dead8;
00057           __asm__ __volatile__ (
00058                 "mov %0, #0 \n\t"
00059                 "mov %1, #0 \n\t"
00060                 "mov %2, #0 \n\t"
00061                 "mov %3, #0 \n\t"
00062                 ".weighted%=: \n\t"
00063                 "ldrsb %8, [%6] \n\t"
00064                 "ldr %10, [%5], #-4 \n\t"
00065                 "mov %9, %6 \n\t"
00066                 "ldrsb %11, [%9, %7]! \n\t"
00067                 "mla %0, %10, %8, %0 \n\t"
00068                 "ldrsb %8, [%9, %7]! \n\t"
00069                 "mla %1, %10, %11, %1 \n\t"
00070                 "ldrsb %11, [%9, %7]! \n\t"
00071                 "mla %2, %10, %8, %2 \n\t"
00072                 "subs %4, %4, #1 \n\t"
00073                 "mla %3, %10, %11, %3 \n\t"
00074                 "add %6, %6, #1 \n\t"
00075                 "bne .weighted%= \n\t"
00076             : "=r" (resj0), "=r" (resj1), "=r" (resj2), "=r" (resj3),
00077           "=r" (dead1), "=r" (dead2), "=r" (dead3), "=r" (dead4),
00078           "=r" (dead5), "=r" (dead6), "=r" (dead7), "=r" (dead8)
00079             : "4" (j+1), "5" (r+j), "6" (shape_cb), "7" (subvect_size)
00080             : "cc", "memory");
00081 #else
00082           spx_word16_t *res;
00083           res = resp+j;
00084           spx_word32_t resj0=0;
00085           spx_word32_t resj1=0;
00086           spx_word32_t resj2=0;
00087           spx_word32_t resj3=0;
00088           for (k=0;k<=j;k++)
00089           {
00090              const signed char *shape=shape_cb+k;
00091              resj0 = MAC16_16(resj0,*shape,r[j-k]);
00092              shape += subvect_size;
00093              resj1 = MAC16_16(resj1,*shape,r[j-k]);
00094              shape += subvect_size;
00095              resj2 = MAC16_16(resj2,*shape,r[j-k]);
00096              shape += subvect_size;
00097              resj3 = MAC16_16(resj3,*shape,r[j-k]);
00098              shape += subvect_size;
00099           }
00100 #endif
00101 
00102 #ifdef FIXED_POINT
00103           resj0 = SHR(resj0, 11);
00104           resj1 = SHR(resj1, 11);
00105           resj2 = SHR(resj2, 11);
00106           resj3 = SHR(resj3, 11);
00107 #else
00108           resj0 *= 0.03125;
00109           resj1 *= 0.03125;
00110           resj2 *= 0.03125;
00111           resj3 *= 0.03125;
00112 #endif
00113 
00114           /* Compute codeword energy */
00115           E[0]=ADD32(E[0],MULT16_16(resj0,resj0));
00116           E[1]=ADD32(E[1],MULT16_16(resj1,resj1));
00117           E[2]=ADD32(E[2],MULT16_16(resj2,resj2));
00118           E[3]=ADD32(E[3],MULT16_16(resj3,resj3));
00119           *res = resj0;
00120           res += subvect_size;
00121           *res = resj1;
00122           res += subvect_size;
00123           *res = resj2;
00124           res += subvect_size;
00125           *res = resj3;
00126           res += subvect_size;
00127       }
00128       resp += subvect_size<<2;
00129       shape_cb += subvect_size<<2;
00130       E+=4;
00131    }
00132 
00133 }

Generated on Fri Dec 9 04:54:40 2005 for speex by  doxygen 1.4.5