summaryrefslogtreecommitdiff
path: root/pjmedia/src/pjmedia-codec/speex/fixed_generic.h
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-07-26 17:04:54 +0000
committerBenny Prijono <bennylp@teluu.com>2006-07-26 17:04:54 +0000
commit2fa99a7ade8748fae314aeab2fea83e9bc88c36c (patch)
tree689c1cb15f7e7304b955e296748c800ce430542d /pjmedia/src/pjmedia-codec/speex/fixed_generic.h
parentd80219f36636faa876c84b586e7b4b4815767be3 (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_generic.h')
-rw-r--r--pjmedia/src/pjmedia-codec/speex/fixed_generic.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/pjmedia/src/pjmedia-codec/speex/fixed_generic.h b/pjmedia/src/pjmedia-codec/speex/fixed_generic.h
index d4bdc159..375050c3 100644
--- a/pjmedia/src/pjmedia-codec/speex/fixed_generic.h
+++ b/pjmedia/src/pjmedia-codec/speex/fixed_generic.h
@@ -35,13 +35,13 @@
#ifndef FIXED_GENERIC_H
#define FIXED_GENERIC_H
-#define QCONST16(x,bits) ((spx_word16_t)(.5+(x)*(1<<(bits))))
-#define QCONST32(x,bits) ((spx_word32_t)(.5+(x)*(1<<(bits))))
+#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 NEG16(x) (-(x))
#define NEG32(x) (-(x))
-#define EXTRACT16(x) ((spx_word16_t)x)
-#define EXTEND32(x) ((spx_word32_t)x)
+#define EXTRACT16(x) ((spx_word16_t)(x))
+#define EXTEND32(x) ((spx_word32_t)(x))
#define SHR16(a,shift) ((a) >> (shift))
#define SHL16(a,shift) ((a) << (shift))
#define SHR32(a,shift) ((a) >> (shift))
@@ -61,7 +61,6 @@
#define SUB16(a,b) ((spx_word16_t)(a)-(spx_word16_t)(b))
#define ADD32(a,b) ((spx_word32_t)(a)+(spx_word32_t)(b))
#define SUB32(a,b) ((spx_word32_t)(a)-(spx_word32_t)(b))
-#define ADD64(a,b) ((spx_word64_t)(a)+(spx_word64_t)(b))
/* result fits in 16 bits */
@@ -84,6 +83,7 @@
#define MAC16_16_Q11(c,a,b) (ADD32((c),SHR(MULT16_16((a),(b)),11)))
#define MAC16_16_Q13(c,a,b) (ADD32((c),SHR(MULT16_16((a),(b)),13)))
+#define MAC16_16_P13(c,a,b) (ADD32((c),SHR(ADD32(4096,MULT16_16((a),(b))),13)))
#define MULT16_16_Q11_32(a,b) (SHR(MULT16_16((a),(b)),11))
#define MULT16_16_Q13(a,b) (SHR(MULT16_16((a),(b)),13))
@@ -97,6 +97,8 @@
#define MUL_16_32_R15(a,bh,bl) ADD32(MULT16_16((a),(bh)), SHR(MULT16_16((a),(bl)),15))
#define DIV32_16(a,b) ((spx_word16_t)(((spx_word32_t)(a))/((spx_word16_t)(b))))
+#define PDIV32_16(a,b) ((spx_word16_t)(((spx_word32_t)(a)+((spx_word16_t)(b)>>1))/((spx_word16_t)(b))))
#define DIV32(a,b) (((spx_word32_t)(a))/((spx_word32_t)(b)))
+#define PDIV32(a,b) (((spx_word32_t)(a)+((spx_word16_t)(b)>>1))/((spx_word32_t)(b)))
#endif