~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.1.0/third_party/speex/libspeex/cb_search_bfin.h

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (1.1.11)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: package-import@ubuntu.com-20140128182336-3xenud1kbnwmf3mz
* New upstream release 
  - Fixes "New Upstream Release" (Closes: #735846)
  - Fixes "Ringtone does not stop" (Closes: #727164)
  - Fixes "[sflphone-kde] crash on startup" (Closes: #718178)
  - Fixes "sflphone GUI crashes when call is hung up" (Closes: #736583)
* Build-Depends: ensure GnuTLS 2.6
  - libucommon-dev (>= 6.0.7-1.1), libccrtp-dev (>= 2.0.6-3)
  - Fixes "FTBFS Build-Depends libgnutls{26,28}-dev" (Closes: #722040)
* Fix "boost 1.49 is going away" unversioned Build-Depends: (Closes: #736746)
* Add Build-Depends: libsndfile-dev, nepomuk-core-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2005 Analog Devices */
 
2
/**
 
3
   @author Jean-Marc Valin 
 
4
   @file cb_search_bfin.h
 
5
   @brief Fixed codebook functions (Blackfin version)
 
6
*/
 
7
/*
 
8
   Redistribution and use in source and binary forms, with or without
 
9
   modification, are permitted provided that the following conditions
 
10
   are met:
 
11
   
 
12
   - Redistributions of source code must retain the above copyright
 
13
   notice, this list of conditions and the following disclaimer.
 
14
   
 
15
   - Redistributions in binary form must reproduce the above copyright
 
16
   notice, this list of conditions and the following disclaimer in the
 
17
   documentation and/or other materials provided with the distribution.
 
18
   
 
19
   - Neither the name of the Xiph.org Foundation nor the names of its
 
20
   contributors may be used to endorse or promote products derived from
 
21
   this software without specific prior written permission.
 
22
   
 
23
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
24
   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
25
   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 
26
   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
 
27
   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 
28
   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 
29
   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 
30
   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 
31
   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 
32
   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 
33
   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
34
*/
 
35
 
 
36
#define OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK 
 
37
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)
 
38
{
 
39
   int i;
 
40
   for (i=0;i<shape_cb_size;i++)
 
41
   {
 
42
      __asm__ __volatile__ (
 
43
         "P0 = %0;\n\t"
 
44
         "LC0 = P0;\n\t"
 
45
         "P1 = %1;\n\t"
 
46
         "P2 = %2;\n\t"
 
47
         "P3 = %3;\n\t"
 
48
         "P0 = 1;\n\t"
 
49
         "L0 = 0;\n\t"
 
50
         "L1 = 0;\n\t"
 
51
         "R2 = 0;\n\t"
 
52
         "A1 = 0;\n\t"
 
53
         "LOOP outter%= LC0;\n\t"
 
54
         "LOOP_BEGIN outter%=;\n\t"
 
55
            "A0 = 0;\n\t"
 
56
            "P4 = P1;\n\t"
 
57
            "I1 = P2;\n\t"
 
58
            "R0 = B[P4++] (X) || R1.L = W[I1--];\n\t"
 
59
            "LOOP inner%= LC1 = P0;\n\t"
 
60
            "LOOP_BEGIN inner%=;\n\t"
 
61
               "A0 += R0.L*R1.L (IS) || R0 = B[P4++] (X) || R1.L = W[I1--];\n\t"
 
62
            "LOOP_END inner%=;\n\t"
 
63
            "R0 = A0;\n\t"
 
64
            "R0 >>>= 13;\n\t"
 
65
            "A1 += R0.L*R0.L (IS);\n\t"
 
66
            "W[P3++] = R0;\n\t"
 
67
            "P0 += 1;\n\t"
 
68
            "P2 += 2;\n\t"
 
69
         "LOOP_END outter%=;\n\t"
 
70
         "P4 = %4;\n\t"
 
71
         "R1 = A1;\n\t"
 
72
         "[P4] = R1;\n\t"
 
73
         :
 
74
      : "m" (subvect_size), "m" (shape_cb), "m" (r), "m" (resp), "m" (E)
 
75
      : "A0", "P0", "P1", "P2", "P3", "P4", "R0", "R1", "R2", "I0", "I1", "L0", 
 
76
        "L1", "A0", "A1", "memory"
 
77
#if !(__GNUC__ == 3)
 
78
         , "LC0", "LC1" /* gcc 3.4 doesn't know about LC registers */
 
79
#endif
 
80
      );
 
81
      shape_cb += subvect_size;
 
82
      resp += subvect_size;
 
83
      E++;
 
84
   }
 
85
}
 
86
 
 
87
#define OVERRIDE_TARGET_UPDATE
 
88
static inline void target_update(spx_word16_t *t, spx_word16_t g, spx_word16_t *r, int len)
 
89
{
 
90
   if (!len)
 
91
      return;
 
92
   __asm__ __volatile__
 
93
         (
 
94
         "I0 = %0;\n\t"
 
95
         "I1 = %1;\n\t"
 
96
         "L0 = 0;\n\t"
 
97
         "L1 = 0;\n\t"
 
98
         "R2 = 4096;\n\t"
 
99
         "LOOP tupdate%= LC0 = %3;\n\t"
 
100
         "LOOP_BEGIN tupdate%=;\n\t"
 
101
            "R0.L = W[I0] || R1.L = W[I1++];\n\t"
 
102
            "R1 = (A1 = R1.L*%2.L) (IS);\n\t"
 
103
            "R1 = R1 + R2;\n\t"
 
104
            "R1 >>>= 13;\n\t"
 
105
            "R0.L = R0.L - R1.L;\n\t"
 
106
            "W[I0++] = R0.L;\n\t"
 
107
         "LOOP_END tupdate%=;\n\t"
 
108
   :
 
109
   : "a" (t), "a" (r), "d" (g), "a" (len)
 
110
   : "R0", "R1", "R2", "A1", "I0", "I1", "L0", "L1"
 
111
         );
 
112
}