Ignore:
Timestamp:
Jul 26, 2006 5:04:54 PM (18 years ago)
Author:
bennylp
Message:
  • Bring speex codec up to date with their SVN trunk
  • Speex codec should work in FIXED_POINT mode when PJ_HAS_FLOATING_POINT is set to zero.
  • ulaw2linear will return zero if zero is given (this would make the VAD works better, and it also fixed click noise when call is established/hangup).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia-codec/speex/fixed_bfin.h

    r278 r628  
    3737#define FIXED_BFIN_H 
    3838 
     39#undef PDIV32_16 
     40static inline spx_word16_t PDIV32_16(spx_word32_t a, spx_word16_t b) 
     41{ 
     42   spx_word32_t res, bb; 
     43   bb = b; 
     44   a += b>>1; 
     45   __asm__  ( 
     46         "P0 = 15;\n\t" 
     47         "R0 = %1;\n\t" 
     48         "R1 = %2;\n\t" 
     49         //"R0 = R0 + R1;\n\t" 
     50         "R0 <<= 1;\n\t" 
     51         "DIVS (R0, R1);\n\t" 
     52         "LOOP divide%= LC0 = P0;\n\t" 
     53         "LOOP_BEGIN divide%=;\n\t" 
     54            "DIVQ (R0, R1);\n\t" 
     55         "LOOP_END divide%=;\n\t" 
     56         "R0 = R0.L;\n\t" 
     57         "%0 = R0;\n\t" 
     58   : "=m" (res) 
     59   : "m" (a), "m" (bb) 
     60   : "P0", "R0", "R1", "cc"); 
     61   return res; 
     62} 
     63 
    3964#undef DIV32_16 
    4065static inline spx_word16_t DIV32_16(spx_word32_t a, spx_word16_t b) 
     
    4267   spx_word32_t res, bb; 
    4368   bb = b; 
     69   /* Make the roundinf consistent with the C version  
     70      (do we need to do that?)*/ 
     71   if (a<0)  
     72      a += (b-1); 
    4473   __asm__  ( 
    4574         "P0 = 15;\n\t" 
     
    80109   __asm__ 
    81110   ( 
    82          "%1 <<= 1;\n\t" 
    83          "A1 = %2.L*%1.L (M,IS);\n\t" 
    84          "A1 = A1 >>> 16;\n\t" 
    85          "R1 = (A1 += %2.L*%1.H) (IS);\n\t" 
    86          "%0 = R1;\n\t" 
    87    : "=&d" (res), "=&d" (b) 
     111         "A1 = %2.L*%1.L (M);\n\t" 
     112         "A1 = A1 >>> 15;\n\t" 
     113         "%0 = (A1 += %2.L*%1.H) ;\n\t" 
     114   : "=&W" (res), "=&d" (b) 
    88115   : "d" (a), "1" (b) 
    89    : "A1", "R1" 
     116   : "A1" 
    90117   ); 
    91118   return res; 
     
    98125   __asm__ 
    99126         ( 
    100          "%1 <<= 1;\n\t" 
    101          "A1 = %2.L*%1.L (M,IS);\n\t" 
    102          "A1 = A1 >>> 16;\n\t" 
    103          "R1 = (A1 += %2.L*%1.H) (IS);\n\t" 
    104          "%0 = R1 + %4;\n\t" 
    105    : "=&d" (res), "=&d" (b) 
     127         "A1 = %2.L*%1.L (M);\n\t" 
     128         "A1 = A1 >>> 15;\n\t" 
     129         "%0 = (A1 += %2.L*%1.H);\n\t" 
     130         "%0 = %0 + %4;\n\t" 
     131   : "=&W" (res), "=&d" (b) 
    106132   : "d" (a), "1" (b), "d" (c) 
    107    : "A1", "R1" 
     133   : "A1" 
    108134         ); 
    109135   return res; 
     
    116142   __asm__ 
    117143         ( 
    118          "%2 <<= 2;\n\t" 
    119          "A1 = %1.L*%2.L (M,IS);\n\t" 
    120          "A1 = A1 >>> 16;\n\t" 
    121          "R1 = (A1 += %1.L*%2.H) (IS);\n\t" 
    122          "%0 = R1;\n\t" 
    123    : "=d" (res), "=d" (a), "=d" (b) 
     144         "%2 <<= 1;\n\t" 
     145         "A1 = %1.L*%2.L (M);\n\t" 
     146         "A1 = A1 >>> 15;\n\t" 
     147         "%0 = (A1 += %1.L*%2.H);\n\t" 
     148   : "=W" (res), "=d" (a), "=d" (b) 
    124149   : "1" (a), "2" (b) 
    125    : "A1", "R1" 
     150   : "A1" 
    126151         ); 
    127152   return res; 
     
    134159   __asm__ 
    135160         ( 
    136          "%1 <<= 2;\n\t" 
    137          "A1 = %2.L*%1.L (M,IS);\n\t" 
    138          "A1 = A1 >>> 16;\n\t" 
    139          "R1 = (A1 += %2.L*%1.H) (IS);\n\t" 
    140          "%0 = R1 + %4;\n\t" 
    141    : "=&d" (res), "=&d" (b) 
     161         "%1 <<= 1;\n\t" 
     162         "A1 = %2.L*%1.L (M);\n\t" 
     163         "A1 = A1 >>> 15;\n\t" 
     164         "%0 = (A1 += %2.L*%1.H);\n\t" 
     165         "%0 = %0 + %4;\n\t" 
     166   : "=&W" (res), "=&d" (b) 
    142167   : "d" (a), "1" (b), "d" (c) 
    143    : "A1", "R1" 
     168   : "A1" 
    144169         ); 
    145170   return res; 
Note: See TracChangeset for help on using the changeset viewer.