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

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.0.1/third_party/speex/libspeex/vq_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
 
   @file vq_bfin.h
4
 
   @author Jean-Marc Valin
5
 
   @brief Blackfin-optimized vq routine
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_VQ_NBEST
37
 
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)
38
 
{
39
 
   if (N==1)
40
 
   {
41
 
      best_dist[0] = 2147483647;
42
 
      {
43
 
         spx_word32_t dist;
44
 
         __asm__ __volatile__
45
 
               (
46
 
            "LC0 = %8;\n\t"
47
 
            "R2 = 0;\n\t"
48
 
            "I0 = %6;\n\t"
49
 
            "B0 = %6;\n\t"
50
 
            "L0 = %9;\n\t"
51
 
            "LOOP entries_loop%= LC0;\n\t"
52
 
            "LOOP_BEGIN entries_loop%=;\n\t"
53
 
               "%0 = [%4++];\n\t"
54
 
               "%0 >>= 1;\n\t"
55
 
               "A0 = %0;\n\t"
56
 
               "R0.L = W[%1++%7] || R1.L = W[I0++];\n\t"
57
 
               "LOOP vq_loop%= LC1 = %5;\n\t"
58
 
               "LOOP_BEGIN vq_loop%=;\n\t"
59
 
                  "%0 = (A0 -= R0.L*R1.L) (IS) || R0.L = W[%1++%7] || R1.L = W[I0++];\n\t"
60
 
               "LOOP_END vq_loop%=;\n\t"
61
 
               "%0 = (A0 -= R0.L*R1.L) (IS);\n\t"
62
 
               "cc = %0 < %2;\n\t"
63
 
               "if cc %2 = %0;\n\t"
64
 
               "if cc %3 = R2;\n\t"
65
 
               "R2 += 1;\n\t"
66
 
            "LOOP_END entries_loop%=;\n\t"
67
 
            : "=&D" (dist), "=&a" (codebook), "=&d" (best_dist[0]), "=&d" (nbest[0]), "=&a" (E)
68
 
            : "a" (len-1), "a" (in), "a" (2), "d" (entries), "d" (len<<1), "1" (codebook), "4" (E), "2" (best_dist[0]), "3" (nbest[0])
69
 
            : "R0", "R1", "R2", "I0", "L0", "B0", "A0", "cc", "memory"
70
 
               );
71
 
      }
72
 
   } else {
73
 
   int i,k,used;
74
 
   used = 0;
75
 
   for (i=0;i<entries;i++)
76
 
   {
77
 
      spx_word32_t dist;
78
 
      __asm__
79
 
            (
80
 
            "%0 >>= 1;\n\t"
81
 
            "A0 = %0;\n\t"
82
 
            "I0 = %3;\n\t"
83
 
            "L0 = 0;\n\t"
84
 
            "R0.L = W[%1++%4] || R1.L = W[I0++];\n\t"
85
 
            "LOOP vq_loop%= LC0 = %2;\n\t"
86
 
            "LOOP_BEGIN vq_loop%=;\n\t"
87
 
               "%0 = (A0 -= R0.L*R1.L) (IS) || R0.L = W[%1++%4] || R1.L = W[I0++];\n\t"
88
 
            "LOOP_END vq_loop%=;\n\t"
89
 
            "%0 = (A0 -= R0.L*R1.L) (IS);\n\t"
90
 
         : "=D" (dist), "=a" (codebook)
91
 
         : "a" (len-1), "a" (in), "a" (2), "1" (codebook), "0" (E[i])
92
 
         : "R0", "R1", "I0", "L0", "A0"
93
 
            );
94
 
      if (i<N || dist<best_dist[N-1])
95
 
      {
96
 
         for (k=N-1; (k >= 1) && (k > used || dist < best_dist[k-1]); k--)
97
 
         {
98
 
            best_dist[k]=best_dist[k-1];
99
 
            nbest[k] = nbest[k-1];
100
 
         }
101
 
         best_dist[k]=dist;
102
 
         nbest[k]=i;
103
 
         used++;
104
 
      }
105
 
   }
106
 
   }
107
 
}