fixed_generic.h File Reference

Generic fixed-point operations. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define ADD16(a, b)   ((spx_word16_t)((spx_word16_t)(a)+(spx_word16_t)(b)))
#define ADD32(a, b)   ((spx_word32_t)(a)+(spx_word32_t)(b))
#define DIV32(a, b)   (((spx_word32_t)(a))/((spx_word32_t)(b)))
#define DIV32_16(a, b)   ((spx_word16_t)(((spx_word32_t)(a))/((spx_word16_t)(b))))
#define EXTEND32(x)   ((spx_word32_t)(x))
#define EXTRACT16(x)   ((spx_word16_t)(x))
#define MAC16_16(c, a, b)   (ADD32((c),MULT16_16((a),(b))))
#define MAC16_16_P13(c, a, b)   (ADD32((c),SHR(ADD32(4096,MULT16_16((a),(b))),13)))
#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_32_Q11(c, a, b)   ADD32(c,ADD32(MULT16_16((a),SHR((b),11)), SHR(MULT16_16((a),((b)&0x000007ff)),11)))
#define MAC16_32_Q15(c, a, b)   ADD32(c,ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15)))
#define MUL_16_32_R15(a, bh, bl)   ADD32(MULT16_16((a),(bh)), SHR(MULT16_16((a),(bl)),15))
#define MULT16_16(a, b)   (((spx_word32_t)(spx_word16_t)(a))*((spx_word32_t)(spx_word16_t)(b)))
#define MULT16_16_16(a, b)   ((((spx_word16_t)(a))*((spx_word16_t)(b))))
#define MULT16_16_P13(a, b)   (SHR(ADD32(4096,MULT16_16((a),(b))),13))
#define MULT16_16_P14(a, b)   (SHR(ADD32(8192,MULT16_16((a),(b))),14))
#define MULT16_16_P15(a, b)   (SHR(ADD32(16384,MULT16_16((a),(b))),15))
#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))
#define MULT16_16_Q14(a, b)   (SHR(MULT16_16((a),(b)),14))
#define MULT16_16_Q15(a, b)   (SHR(MULT16_16((a),(b)),15))
#define MULT16_32_P15(a, b)   ADD32(MULT16_16((a),SHR((b),15)), PSHR(MULT16_16((a),((b)&0x00007fff)),15))
#define MULT16_32_Q11(a, b)   ADD32(MULT16_16((a),SHR((b),11)), SHR(MULT16_16((a),((b)&0x000007ff)),11))
#define MULT16_32_Q12(a, b)   ADD32(MULT16_16((a),SHR((b),12)), SHR(MULT16_16((a),((b)&0x00000fff)),12))
#define MULT16_32_Q13(a, b)   ADD32(MULT16_16((a),SHR((b),13)), SHR(MULT16_16((a),((b)&0x00001fff)),13))
#define MULT16_32_Q14(a, b)   ADD32(MULT16_16((a),SHR((b),14)), SHR(MULT16_16((a),((b)&0x00003fff)),14))
#define MULT16_32_Q15(a, b)   ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15))
#define NEG16(x)   (-(x))
#define NEG32(x)   (-(x))
#define PDIV32(a, b)   (((spx_word32_t)(a)+((spx_word16_t)(b)>>1))/((spx_word32_t)(b)))
#define PDIV32_16(a, b)   ((spx_word16_t)(((spx_word32_t)(a)+((spx_word16_t)(b)>>1))/((spx_word16_t)(b))))
#define PSHR(a, shift)   (SHR((a)+((EXTEND32(1)<<((shift))>>1)),shift))
#define PSHR16(a, shift)   (SHR16((a)+((1<<((shift))>>1)),shift))
#define PSHR32(a, shift)   (SHR32((a)+((EXTEND32(1)<<((shift))>>1)),shift))
#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 SATURATE(x, a)   (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
#define SATURATE16(x, a)   (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
#define SATURATE32(x, a)   (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
#define SHL(a, shift)   ((spx_word32_t)(a) << (shift))
#define SHL16(a, shift)   ((a) << (shift))
#define SHL32(a, shift)   ((a) << (shift))
#define SHR(a, shift)   ((a) >> (shift))
#define SHR16(a, shift)   ((a) >> (shift))
#define SHR32(a, shift)   ((a) >> (shift))
#define SUB16(a, b)   ((spx_word16_t)(a)-(spx_word16_t)(b))
#define SUB32(a, b)   ((spx_word32_t)(a)-(spx_word32_t)(b))
#define VSHR32(a, shift)   (((shift)>0) ? SHR32(a, shift) : SHL32(a, -(shift)))


Detailed Description

Generic fixed-point operations.

Definition in file fixed_generic.h.


Define Documentation

#define ADD16 ( a,
b   )     ((spx_word16_t)((spx_word16_t)(a)+(spx_word16_t)(b)))

Definition at line 61 of file fixed_generic.h.

#define ADD32 ( a,
b   )     ((spx_word32_t)(a)+(spx_word32_t)(b))

Definition at line 63 of file fixed_generic.h.

#define DIV32 ( a,
b   )     (((spx_word32_t)(a))/((spx_word32_t)(b)))

Definition at line 103 of file fixed_generic.h.

#define DIV32_16 ( a,
b   )     ((spx_word16_t)(((spx_word32_t)(a))/((spx_word16_t)(b))))

Definition at line 101 of file fixed_generic.h.

#define EXTEND32 (  )     ((spx_word32_t)(x))

Definition at line 44 of file fixed_generic.h.

Referenced by cubic_coef().

#define EXTRACT16 (  )     ((spx_word16_t)(x))

Definition at line 43 of file fixed_generic.h.

Referenced by cubic_coef().

#define MAC16_16 ( c,
a,
b   )     (ADD32((c),MULT16_16((a),(b))))

Definition at line 73 of file fixed_generic.h.

#define MAC16_16_P13 ( c,
a,
b   )     (ADD32((c),SHR(ADD32(4096,MULT16_16((a),(b))),13)))

Definition at line 88 of file fixed_generic.h.

#define MAC16_16_Q11 ( c,
a,
b   )     (ADD32((c),SHR(MULT16_16((a),(b)),11)))

Definition at line 86 of file fixed_generic.h.

#define MAC16_16_Q13 ( c,
a,
b   )     (ADD32((c),SHR(MULT16_16((a),(b)),13)))

Definition at line 87 of file fixed_generic.h.

#define MAC16_32_Q11 ( c,
a,
b   )     ADD32(c,ADD32(MULT16_16((a),SHR((b),11)), SHR(MULT16_16((a),((b)&0x000007ff)),11)))

Definition at line 79 of file fixed_generic.h.

#define MAC16_32_Q15 ( c,
a,
b   )     ADD32(c,ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15)))

Definition at line 83 of file fixed_generic.h.

#define MUL_16_32_R15 ( a,
bh,
bl   )     ADD32(MULT16_16((a),(bh)), SHR(MULT16_16((a),(bl)),15))

Definition at line 99 of file fixed_generic.h.

#define MULT16_16 ( a,
b   )     (((spx_word32_t)(spx_word16_t)(a))*((spx_word32_t)(spx_word16_t)(b)))

Definition at line 71 of file fixed_generic.h.

Referenced by cubic_coef(), and resampler_basic_interpolate_single().

#define MULT16_16_16 ( a,
b   )     ((((spx_word16_t)(a))*((spx_word16_t)(b))))

Definition at line 68 of file fixed_generic.h.

#define MULT16_16_P13 ( a,
b   )     (SHR(ADD32(4096,MULT16_16((a),(b))),13))

Definition at line 95 of file fixed_generic.h.

#define MULT16_16_P14 ( a,
b   )     (SHR(ADD32(8192,MULT16_16((a),(b))),14))

Definition at line 96 of file fixed_generic.h.

#define MULT16_16_P15 ( a,
b   )     (SHR(ADD32(16384,MULT16_16((a),(b))),15))

Definition at line 97 of file fixed_generic.h.

Referenced by cubic_coef().

#define MULT16_16_Q11_32 ( a,
b   )     (SHR(MULT16_16((a),(b)),11))

Definition at line 90 of file fixed_generic.h.

#define MULT16_16_Q13 ( a,
b   )     (SHR(MULT16_16((a),(b)),13))

Definition at line 91 of file fixed_generic.h.

#define MULT16_16_Q14 ( a,
b   )     (SHR(MULT16_16((a),(b)),14))

Definition at line 92 of file fixed_generic.h.

#define MULT16_16_Q15 ( a,
b   )     (SHR(MULT16_16((a),(b)),15))

Definition at line 93 of file fixed_generic.h.

#define MULT16_32_P15 ( a,
b   )     ADD32(MULT16_16((a),SHR((b),15)), PSHR(MULT16_16((a),((b)&0x00007fff)),15))

Definition at line 81 of file fixed_generic.h.

#define MULT16_32_Q11 ( a,
b   )     ADD32(MULT16_16((a),SHR((b),11)), SHR(MULT16_16((a),((b)&0x000007ff)),11))

Definition at line 78 of file fixed_generic.h.

#define MULT16_32_Q12 ( a,
b   )     ADD32(MULT16_16((a),SHR((b),12)), SHR(MULT16_16((a),((b)&0x00000fff)),12))

Definition at line 74 of file fixed_generic.h.

#define MULT16_32_Q13 ( a,
b   )     ADD32(MULT16_16((a),SHR((b),13)), SHR(MULT16_16((a),((b)&0x00001fff)),13))

Definition at line 75 of file fixed_generic.h.

#define MULT16_32_Q14 ( a,
b   )     ADD32(MULT16_16((a),SHR((b),14)), SHR(MULT16_16((a),((b)&0x00003fff)),14))

Definition at line 76 of file fixed_generic.h.

#define MULT16_32_Q15 ( a,
b   )     ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15))

Definition at line 82 of file fixed_generic.h.

Referenced by resampler_basic_interpolate_single().

#define NEG16 (  )     (-(x))

Definition at line 41 of file fixed_generic.h.

#define NEG32 (  )     (-(x))

Definition at line 42 of file fixed_generic.h.

#define PDIV32 ( a,
b   )     (((spx_word32_t)(a)+((spx_word16_t)(b)>>1))/((spx_word32_t)(b)))

Definition at line 104 of file fixed_generic.h.

Referenced by resampler_basic_interpolate_single().

#define PDIV32_16 ( a,
b   )     ((spx_word16_t)(((spx_word32_t)(a)+((spx_word16_t)(b)>>1))/((spx_word16_t)(b))))

Definition at line 102 of file fixed_generic.h.

#define PSHR ( a,
shift   )     (SHR((a)+((EXTEND32(1)<<((shift))>>1)),shift))

Definition at line 57 of file fixed_generic.h.

#define PSHR16 ( a,
shift   )     (SHR16((a)+((1<<((shift))>>1)),shift))

Definition at line 49 of file fixed_generic.h.

#define PSHR32 ( a,
shift   )     (SHR32((a)+((EXTEND32(1)<<((shift))>>1)),shift))

#define QCONST16 ( x,
bits   )     ((spx_word16_t)(.5+(x)*(((spx_word32_t)1)<<(bits))))

Definition at line 38 of file fixed_generic.h.

Referenced by cubic_coef().

#define QCONST32 ( x,
bits   )     ((spx_word32_t)(.5+(x)*(((spx_word32_t)1)<<(bits))))

Definition at line 39 of file fixed_generic.h.

#define SATURATE ( x,
a   )     (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))

Definition at line 58 of file fixed_generic.h.

#define SATURATE16 ( x,
a   )     (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))

Definition at line 52 of file fixed_generic.h.

#define SATURATE32 ( x,
a   )     (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))

Definition at line 53 of file fixed_generic.h.

#define SHL ( a,
shift   )     ((spx_word32_t)(a) << (shift))

Definition at line 56 of file fixed_generic.h.

#define SHL16 ( a,
shift   )     ((a) << (shift))

Definition at line 46 of file fixed_generic.h.

#define SHL32 ( a,
shift   )     ((a) << (shift))

Definition at line 48 of file fixed_generic.h.

Referenced by resampler_basic_interpolate_single().

#define SHR ( a,
shift   )     ((a) >> (shift))

Definition at line 55 of file fixed_generic.h.

#define SHR16 ( a,
shift   )     ((a) >> (shift))

Definition at line 45 of file fixed_generic.h.

#define SHR32 ( a,
shift   )     ((a) >> (shift))

Definition at line 47 of file fixed_generic.h.

Referenced by cubic_coef().

#define SUB16 ( a,
b   )     ((spx_word16_t)(a)-(spx_word16_t)(b))

Definition at line 62 of file fixed_generic.h.

#define SUB32 ( a,
b   )     ((spx_word32_t)(a)-(spx_word32_t)(b))

Definition at line 64 of file fixed_generic.h.

Referenced by cubic_coef().

#define VSHR32 ( a,
shift   )     (((shift)>0) ? SHR32(a, shift) : SHL32(a, -(shift)))

Definition at line 51 of file fixed_generic.h.


Generated on Thu Apr 16 06:31:01 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6