From 6d4d05a0b62d4d7be91f807943009f2ec57c2421 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Tue, 1 Aug 2006 23:09:35 +0000 Subject: Added simple WinCE application: - added pjsua_wince in pjsip-apps, which is a simple SIP UA application just to broadly test pjsip/pjmedia on WinCE. - Fix name conflicts in xpidf.c (e.g. ATOM variable conflicts with ATOM type in WinCE SDK). - Fix speex compilation errors on Wince (e.g. inline keyword is not recognized, replaced with PJ_INLINE). git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@641 74dad513-b988-da41-8d7b-12977e46ad98 --- pjmedia/src/pjmedia-codec/speex/cb_search.c | 2 +- pjmedia/src/pjmedia-codec/speex/config.h | 2 + pjmedia/src/pjmedia-codec/speex/ltp.c | 2 +- pjmedia/src/pjmedia-codec/speex/mdf.c | 10 +- pjmedia/src/pjmedia-codec/speex/preprocess_spx.c | 2 +- pjmedia/src/pjmedia/largefilter.h | 6 +- pjmedia/src/pjmedia/resample.c | 120 +++++++++++------------ pjmedia/src/pjmedia/smallfilter.h | 6 +- 8 files changed, 76 insertions(+), 74 deletions(-) (limited to 'pjmedia/src') diff --git a/pjmedia/src/pjmedia-codec/speex/cb_search.c b/pjmedia/src/pjmedia-codec/speex/cb_search.c index b4a223bc..0cf91057 100644 --- a/pjmedia/src/pjmedia-codec/speex/cb_search.c +++ b/pjmedia/src/pjmedia-codec/speex/cb_search.c @@ -85,7 +85,7 @@ static void compute_weighted_codebook(const signed char *shape_cb, const spx_wor #endif #ifndef OVERRIDE_TARGET_UPDATE -static inline void target_update(spx_word16_t *t, spx_word16_t g, spx_word16_t *r, int len) +PJ_INLINE(void) target_update(spx_word16_t *t, spx_word16_t g, spx_word16_t *r, int len) { int n; for (n=0;n + /* Check if we need to use the fixed point version */ #if !defined(PJ_HAS_FLOATING_POINT) || PJ_HAS_FLOATING_POINT==0 # define FIXED_POINT diff --git a/pjmedia/src/pjmedia-codec/speex/ltp.c b/pjmedia/src/pjmedia-codec/speex/ltp.c index 9a5a295e..009923de 100644 --- a/pjmedia/src/pjmedia-codec/speex/ltp.c +++ b/pjmedia/src/pjmedia-codec/speex/ltp.c @@ -152,7 +152,7 @@ void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *c #endif #ifndef OVERRIDE_COMPUTE_PITCH_ERROR -static inline spx_word32_t compute_pitch_error(spx_word16_t *C, spx_word16_t *g, spx_word16_t pitch_control) +PJ_INLINE(spx_word32_t) compute_pitch_error(spx_word16_t *C, spx_word16_t *g, spx_word16_t pitch_control) { spx_word32_t sum = 0; sum = ADD32(sum,MULT16_16(MULT16_16_16(g[0],pitch_control),C[0])); diff --git a/pjmedia/src/pjmedia-codec/speex/mdf.c b/pjmedia/src/pjmedia-codec/speex/mdf.c index eabf4339..94e08f7f 100644 --- a/pjmedia/src/pjmedia-codec/speex/mdf.c +++ b/pjmedia/src/pjmedia-codec/speex/mdf.c @@ -146,7 +146,7 @@ struct SpeexEchoState_ { int play_buf_pos; }; -static inline void filter_dc_notch16(const spx_int16_t *in, spx_word16_t radius, spx_word16_t *out, int len, spx_mem_t *mem) +PJ_INLINE(void) filter_dc_notch16(const spx_int16_t *in, spx_word16_t radius, spx_word16_t *out, int len, spx_mem_t *mem) { int i; spx_word16_t den2; @@ -170,7 +170,7 @@ static inline void filter_dc_notch16(const spx_int16_t *in, spx_word16_t radius, } } -static inline spx_word32_t mdf_inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len) +PJ_INLINE(spx_word32_t ) mdf_inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len) { spx_word32_t sum=0; len >>= 1; @@ -186,7 +186,7 @@ static inline spx_word32_t mdf_inner_prod(const spx_word16_t *x, const spx_word1 } /** Compute power spectrum of a half-complex (packed) vector */ -static inline void power_spectrum(const spx_word16_t *X, spx_word32_t *ps, int N) +PJ_INLINE(void) power_spectrum(const spx_word16_t *X, spx_word32_t *ps, int N) { int i, j; ps[0]=MULT16_16(X[0],X[0]); @@ -227,7 +227,7 @@ static inline void spectral_mul_accum(const spx_word16_t *X, const spx_word32_t acc[N-1] = PSHR32(tmp1,WEIGHT_SHIFT); } #else -static inline void spectral_mul_accum(const spx_word16_t *X, const spx_word32_t *Y, spx_word16_t *acc, int N, int M) +PJ_INLINE(void) spectral_mul_accum(const spx_word16_t *X, const spx_word32_t *Y, spx_word16_t *acc, int N, int M) { int i,j; for (i=0;i>= scl; if (v>MAX_HWORD) { @@ -232,31 +232,31 @@ static INLINE HWORD WordToHword(WORD v, int scl) } else if (v < MIN_HWORD) { v = MIN_HWORD; } - out = (HWORD) v; + out = (RES_HWORD) v; return out; } /* Sampling rate conversion using linear interpolation for maximum speed. */ static int - SrcLinear(const HWORD X[], HWORD Y[], double pFactor, UHWORD nx) + SrcLinear(const RES_HWORD X[], RES_HWORD Y[], double pFactor, RES_UHWORD nx) { - HWORD iconst; - UWORD time = 0; - const HWORD *xp; - HWORD *Ystart, *Yend; - WORD v,x1,x2; + RES_HWORD iconst; + RES_UWORD time = 0; + const RES_HWORD *xp; + RES_HWORD *Ystart, *Yend; + RES_WORD v,x1,x2; double dt; /* Step through input signal */ - UWORD dtb; /* Fixed-point version of Dt */ - UWORD endTime; /* When time reaches EndTime, return to user */ + RES_UWORD dtb; /* Fixed-point version of Dt */ + RES_UWORD endTime; /* When time reaches EndTime, return to user */ dt = 1.0/pFactor; /* Output sampling period */ dtb = dt*(1<>Na]; @@ -301,7 +301,7 @@ static WORD FilterUp(const HWORD Imp[], const HWORD ImpD[], if (Interp) while (Hp < End) { t = *Hp; /* Get filter coeff */ - t += (((WORD)*Hdp)*a)>>Na; /* t is now interp'd filter coeff */ + t += (((RES_WORD)*Hdp)*a)>>Na; /* t is now interp'd filter coeff */ Hdp += Npc; /* Filter coeff differences step */ t *= *Xp; /* Mult coeff by input sample */ if (t & (1<<(Nhxn-1))) /* Round, if needed */ @@ -327,17 +327,17 @@ static WORD FilterUp(const HWORD Imp[], const HWORD ImpD[], } -static WORD FilterUD(const HWORD Imp[], const HWORD ImpD[], - UHWORD Nwing, BOOL Interp, - const HWORD *Xp, HWORD Ph, HWORD Inc, UHWORD dhb) +static RES_WORD FilterUD(const RES_HWORD Imp[], const RES_HWORD ImpD[], + RES_UHWORD Nwing, RES_BOOL Interp, + const RES_HWORD *Xp, RES_HWORD Ph, RES_HWORD Inc, RES_UHWORD dhb) { - HWORD a; - const HWORD *Hp, *Hdp, *End; - WORD v, t; - UWORD Ho; + RES_HWORD a; + const RES_HWORD *Hp, *Hdp, *End; + RES_WORD v, t; + RES_UWORD Ho; v=0; - Ho = (Ph*(UWORD)dhb)>>Np; + Ho = (Ph*(RES_UWORD)dhb)>>Np; End = &Imp[Nwing]; if (Inc == 1) /* If doing right wing... */ { /* ...drop extra coeff, so when Ph is */ @@ -351,7 +351,7 @@ static WORD FilterUD(const HWORD Imp[], const HWORD ImpD[], t = *Hp; /* Get IR sample */ Hdp = &ImpD[Ho>>Na]; /* get interp (lower Na) bits from diff table*/ a = Ho & Amask; /* a is logically between 0 and 1 */ - t += (((WORD)*Hdp)*a)>>Na; /* t is now interp'd filter coeff */ + t += (((RES_WORD)*Hdp)*a)>>Na; /* t is now interp'd filter coeff */ t *= *Xp; /* Mult coeff by input sample */ if (t & 1<<(Nhxn-1)) /* Round, if needed */ t += 1<<(Nhxn-1); @@ -377,34 +377,34 @@ static WORD FilterUD(const HWORD Imp[], const HWORD ImpD[], /* Sampling rate up-conversion only subroutine; * Slightly faster than down-conversion; */ -static int SrcUp(const HWORD X[], HWORD Y[], double pFactor, - UHWORD nx, UHWORD pNwing, UHWORD pLpScl, - const HWORD pImp[], const HWORD pImpD[], BOOL Interp) +static int SrcUp(const RES_HWORD X[], RES_HWORD Y[], double pFactor, + RES_UHWORD nx, RES_UHWORD pNwing, RES_UHWORD pLpScl, + const RES_HWORD pImp[], const RES_HWORD pImpD[], RES_BOOL Interp) { - const HWORD *xp; - HWORD *Ystart, *Yend; - WORD v; + const RES_HWORD *xp; + RES_HWORD *Ystart, *Yend; + RES_WORD v; double dt; /* Step through input signal */ - UWORD dtb; /* Fixed-point version of Dt */ - UWORD time = 0; - UWORD endTime; /* When time reaches EndTime, return to user */ + RES_UWORD dtb; /* Fixed-point version of Dt */ + RES_UWORD time = 0; + RES_UWORD endTime; /* When time reaches EndTime, return to user */ dt = 1.0/pFactor; /* Output sampling period */ dtb = dt*(1<>Np]; /* Ptr to current input sample */ /* Perform left-wing inner product */ v = 0; - v = FilterUp(pImp, pImpD, pNwing, Interp, xp, (HWORD)(time&Pmask),-1); + v = FilterUp(pImp, pImpD, pNwing, Interp, xp, (RES_HWORD)(time&Pmask),-1); /* Perform right-wing inner product */ - v += FilterUp(pImp, pImpD, pNwing, Interp, xp+1, (HWORD)((-time)&Pmask),1); + v += FilterUp(pImp, pImpD, pNwing, Interp, xp+1, (RES_HWORD)((-time)&Pmask),1); v >>= Nhg; /* Make guard bits */ v *= pLpScl; /* Normalize for unity filter gain */ @@ -417,19 +417,19 @@ static int SrcUp(const HWORD X[], HWORD Y[], double pFactor, /* Sampling rate conversion subroutine */ -static int SrcUD(const HWORD X[], HWORD Y[], double pFactor, - UHWORD nx, UHWORD pNwing, UHWORD pLpScl, - const HWORD pImp[], const HWORD pImpD[], BOOL Interp) +static int SrcUD(const RES_HWORD X[], RES_HWORD Y[], double pFactor, + RES_UHWORD nx, RES_UHWORD pNwing, RES_UHWORD pLpScl, + const RES_HWORD pImp[], const RES_HWORD pImpD[], RES_BOOL Interp) { - const HWORD *xp; - HWORD *Ystart, *Yend; - WORD v; + const RES_HWORD *xp; + RES_HWORD *Ystart, *Yend; + RES_WORD v; double dh; /* Step through filter impulse response */ double dt; /* Step through input signal */ - UWORD time = 0; - UWORD endTime; /* When time reaches EndTime, return to user */ - UWORD dhb, dtb; /* Fixed-point versions of Dh,Dt */ + RES_UWORD time = 0; + RES_UWORD endTime; /* When time reaches EndTime, return to user */ + RES_UWORD dhb, dtb; /* Fixed-point versions of Dh,Dt */ dt = 1.0/pFactor; /* Output sampling period */ dtb = dt*(1<>Np]; /* Ptr to current input sample */ - v = FilterUD(pImp, pImpD, pNwing, Interp, xp, (HWORD)(time&Pmask), + v = FilterUD(pImp, pImpD, pNwing, Interp, xp, (RES_HWORD)(time&Pmask), -1, dhb); /* Perform left-wing inner product */ - v += FilterUD(pImp, pImpD, pNwing, Interp, xp+1, (HWORD)((-time)&Pmask), + v += FilterUD(pImp, pImpD, pNwing, Interp, xp+1, (RES_HWORD)((-time)&Pmask), 1, dhb); /* Perform right-wing inner product */ v >>= Nhg; /* Make guard bits */ v *= pLpScl; /* Normalize for unity filter gain */ diff --git a/pjmedia/src/pjmedia/smallfilter.h b/pjmedia/src/pjmedia/smallfilter.h index 367999d4..396fcb14 100644 --- a/pjmedia/src/pjmedia/smallfilter.h +++ b/pjmedia/src/pjmedia/smallfilter.h @@ -1,8 +1,8 @@ /* Included by resamplesubs.c */ -#define SMALL_FILTER_NMULT ((HWORD)13) +#define SMALL_FILTER_NMULT ((RES_HWORD)13) #define SMALL_FILTER_SCALE 13128 /* Unity-gain scale factor */ #define SMALL_FILTER_NWING 1536 /* Filter table length */ -static const HWORD SMALL_FILTER_IMP[] /* Impulse response */ = { +static const RES_HWORD SMALL_FILTER_IMP[] /* Impulse response */ = { 32767, 32766, 32764, @@ -1541,7 +1541,7 @@ static const HWORD SMALL_FILTER_IMP[] /* Impulse response */ = { -1 }; -static const HWORD SMALL_FILTER_IMPD[] = { +static const RES_HWORD SMALL_FILTER_IMPD[] = { -1, -2, -4, -- cgit v1.2.3