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_generic.h

    r278 r628  
    3636#define FIXED_GENERIC_H 
    3737 
    38 #define QCONST16(x,bits) ((spx_word16_t)(.5+(x)*(1<<(bits)))) 
    39 #define QCONST32(x,bits) ((spx_word32_t)(.5+(x)*(1<<(bits)))) 
     38#define QCONST16(x,bits) ((spx_word16_t)(.5+(x)*(((spx_word32_t)1)<<(bits)))) 
     39#define QCONST32(x,bits) ((spx_word32_t)(.5+(x)*(((spx_word32_t)1)<<(bits)))) 
    4040 
    4141#define NEG16(x) (-(x)) 
    4242#define NEG32(x) (-(x)) 
    43 #define EXTRACT16(x) ((spx_word16_t)x) 
    44 #define EXTEND32(x) ((spx_word32_t)x) 
     43#define EXTRACT16(x) ((spx_word16_t)(x)) 
     44#define EXTEND32(x) ((spx_word32_t)(x)) 
    4545#define SHR16(a,shift) ((a) >> (shift)) 
    4646#define SHL16(a,shift) ((a) << (shift)) 
     
    6262#define ADD32(a,b) ((spx_word32_t)(a)+(spx_word32_t)(b)) 
    6363#define SUB32(a,b) ((spx_word32_t)(a)-(spx_word32_t)(b)) 
    64 #define ADD64(a,b) ((spx_word64_t)(a)+(spx_word64_t)(b)) 
    6564 
    6665 
     
    8584#define MAC16_16_Q11(c,a,b)     (ADD32((c),SHR(MULT16_16((a),(b)),11))) 
    8685#define MAC16_16_Q13(c,a,b)     (ADD32((c),SHR(MULT16_16((a),(b)),13))) 
     86#define MAC16_16_P13(c,a,b)     (ADD32((c),SHR(ADD32(4096,MULT16_16((a),(b))),13))) 
    8787 
    8888#define MULT16_16_Q11_32(a,b) (SHR(MULT16_16((a),(b)),11)) 
     
    9898 
    9999#define DIV32_16(a,b) ((spx_word16_t)(((spx_word32_t)(a))/((spx_word16_t)(b)))) 
     100#define PDIV32_16(a,b) ((spx_word16_t)(((spx_word32_t)(a)+((spx_word16_t)(b)>>1))/((spx_word16_t)(b)))) 
    100101#define DIV32(a,b) (((spx_word32_t)(a))/((spx_word32_t)(b))) 
     102#define PDIV32(a,b) (((spx_word32_t)(a)+((spx_word16_t)(b)>>1))/((spx_word32_t)(b))) 
    101103 
    102104#endif 
Note: See TracChangeset for help on using the changeset viewer.