diff options
author | Benny Prijono <bennylp@teluu.com> | 2006-07-26 17:04:54 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2006-07-26 17:04:54 +0000 |
commit | 2fa99a7ade8748fae314aeab2fea83e9bc88c36c (patch) | |
tree | 689c1cb15f7e7304b955e296748c800ce430542d /pjmedia/src/pjmedia-codec/speex/fixed_debug.h | |
parent | d80219f36636faa876c84b586e7b4b4815767be3 (diff) |
- 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).
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@628 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia/src/pjmedia-codec/speex/fixed_debug.h')
-rw-r--r-- | pjmedia/src/pjmedia-codec/speex/fixed_debug.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/pjmedia/src/pjmedia-codec/speex/fixed_debug.h b/pjmedia/src/pjmedia-codec/speex/fixed_debug.h index 7403a18e..65c5712d 100644 --- a/pjmedia/src/pjmedia-codec/speex/fixed_debug.h +++ b/pjmedia/src/pjmedia-codec/speex/fixed_debug.h @@ -40,8 +40,9 @@ extern long long spx_mips; #define MIPS_INC spx_mips++, -#define QCONST16(x,bits) ((spx_word16_t)((x)*(1<<(bits))+(1<<((bits)-1)))) -#define QCONST32(x,bits) ((spx_word32_t)((x)*(1<<(bits))+(1<<((bits)-1)))) +#define QCONST16(x,bits) ((spx_word16_t)(.5+(x)*(((spx_word32_t)1)<<(bits)))) +#define QCONST32(x,bits) ((spx_word32_t)(.5+(x)*(((spx_word32_t)1)<<(bits)))) + #define VERIFY_SHORT(x) ((x)<=32767&&(x)>=-32768) #define VERIFY_INT(x) ((x)<=2147483647LL&&(x)>=-2147483648LL) @@ -169,7 +170,7 @@ static inline short ADD16(int a, int b) } res = a+b; if (!VERIFY_SHORT(res)) - fprintf (stderr, "ADD16: output is not short: %d\n", res); + fprintf (stderr, "ADD16: output is not short: %d+%d=%d\n", a,b,res); spx_mips++; return res; } @@ -196,7 +197,9 @@ static inline int ADD32(long long a, long long b) } res = a+b; if (!VERIFY_INT(res)) + { fprintf (stderr, "ADD32: output is not int: %d\n", (int)res); + } spx_mips++; return res; } @@ -251,6 +254,8 @@ static inline int MULT16_16(int a, int b) #define MAC16_16(c,a,b) (spx_mips--,ADD32((c),MULT16_16((a),(b)))) #define MAC16_16_Q11(c,a,b) (ADD16((c),EXTRACT16(SHR32(MULT16_16((a),(b)),11)))) #define MAC16_16_Q13(c,a,b) (ADD16((c),EXTRACT16(SHR32(MULT16_16((a),(b)),13)))) +#define MAC16_16_P13(c,a,b) (ADD32((c),SHR(ADD32(4096,MULT16_16((a),(b))),13))) + static inline int MULT16_32_QX(int a, long long b, int Q) { @@ -437,7 +442,7 @@ static inline int DIV32(long long a, long long b) spx_mips+=36; return res; } - - +#define PDIV32(a,b) DIV32(ADD32((a),(b)>>1),b) +#define PDIV32_16(a,b) DIV32_16(ADD32((a),(b)>>1),b) #endif |