23 #ifndef _ASTERISK_ULAW_H 24 #define _ASTERISK_ULAW_H 32 #define AST_ULAW_BIT_LOSS 3 33 #define AST_ULAW_STEP (1 << AST_ULAW_BIT_LOSS) 34 #define AST_ULAW_TAB_SIZE (32768 / AST_ULAW_STEP + 1) 35 #define AST_ULAW_SIGN_BIT 0x80 38 #ifndef G711_NEW_ALGORITHM 47 #ifndef G711_NEW_ALGORITHM 49 #define AST_LIN2MU(a) (__ast_lin2mu[((unsigned short)(a)) >> 2]) 53 #define AST_LIN2MU_LOOKUP(mag) \ 54 __ast_lin2mu[((mag) + AST_ULAW_STEP / 2) >> AST_ULAW_BIT_LOSS] 58 static inline void ast_ulaw_get_sign_mag(
short sample,
unsigned *sign,
unsigned *mag)
64 #if defined(G711_REDUCED_BRANCHING) 66 unsigned dual_mag = (-sample << 16) | (
unsigned short)sample;
67 *mag = (dual_mag >> (*sign >> 3)) & 0xffffU;
77 static inline unsigned char AST_LIN2MU(
short sample)
80 ast_ulaw_get_sign_mag(sample, &sign, &mag);
81 return ~(sign | AST_LIN2MU_LOOKUP(mag));
85 #define AST_MULAW(a) (__ast_mulaw[(a)])
void ast_ulaw_init(void)
Set up mu-law conversion table.
unsigned char __ast_lin2mu[16384]
converts signed linear to mulaw
#define AST_ULAW_SIGN_BIT
#define AST_ULAW_TAB_SIZE